mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
5c244eaca7
## Link to GitHub Issue or related Pull Request, if one exists #73 ## Description of change Generated cards now start with E0040100 to fully match real cards. The placeholder example `E004010000000000` is replaced with `E0040100FFFFFFFF`. The invalid placeholder/fallback PCBID `04040000000000000000` is replaced with `01201000000000010101`, which contains a valid header/checksum, making it closer resemble a real PCBID while still clearly being an example.
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <optional>
|
|
|
|
#include "overlay/window.h"
|
|
|
|
namespace overlay::windows {
|
|
|
|
struct CardEntry {
|
|
std::string name = "unnamed";
|
|
std::string id = "E0040100FFFFFFFF";
|
|
std::string search_string = "";
|
|
bool read_only = false;
|
|
float color[3] {};
|
|
};
|
|
|
|
class CardManager : public Window {
|
|
public:
|
|
|
|
CardManager(SpiceOverlay *overlay);
|
|
~CardManager() override;
|
|
|
|
void build_content() override;
|
|
|
|
private:
|
|
|
|
std::filesystem::path config_path;
|
|
bool config_dirty = false;
|
|
std::vector<CardEntry> cards;
|
|
char name_buffer[65] {};
|
|
char card_buffer[17] {};
|
|
float color_buffer[3] {};
|
|
|
|
std::optional<CardEntry> card_cmd_overrides[2];
|
|
|
|
std::optional<CardEntry> loaded_card[2];
|
|
CardEntry *current_card = nullptr;
|
|
|
|
std::string search_filter = "";
|
|
std::string search_filter_in_lower_case = "";
|
|
|
|
void config_load();
|
|
void config_save();
|
|
|
|
void generate_search_string(CardEntry *card);
|
|
void generate_random_color();
|
|
|
|
bool build_card(int reader);
|
|
void open_card_editor();
|
|
void build_card_editor();
|
|
void build_card_list();
|
|
void build_card_selectable(CardEntry &card);
|
|
void build_footer();
|
|
|
|
void insert_card_over_api(int reader, CardEntry &card);
|
|
};
|
|
}
|