Horizon
Loading...
Searching...
No Matches
kicad_symbol_import_wizard.hpp
1#pragma once
2#include <gtkmm.h>
3#include "common/common.hpp"
4#include "pool/unit.hpp"
5#include "pool/part.hpp"
6#include "pool/entity.hpp"
7#include "pool/pool.hpp"
8#include "../pool_notebook.hpp" //for processes
9#include "util/window_state_store.hpp"
10#include "util/kicad_lib_parser.hpp"
11
12namespace horizon {
13
14class KiCadSymbolImportWizard : public Gtk::Window {
15 friend class GateEditorImportWizard;
16
17public:
18 KiCadSymbolImportWizard(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const UUID &pkg_uuid,
19 class Pool &po, class PoolProjectManagerAppWindow &aw, const std::string &lib_filename);
20 static KiCadSymbolImportWizard *create(const UUID &pkg_uuid, class Pool &po, class PoolProjectManagerAppWindow &aw,
21 const std::string &lib_filename);
22 std::vector<std::string> get_files_saved() const;
23 void reload();
24
26
27private:
28 Pool &pool;
29
30 class PoolProjectManagerAppWindow &appwin;
31
32 Gtk::HeaderBar *header = nullptr;
33 Gtk::Button *button_skip = nullptr;
34 Gtk::Button *button_next = nullptr;
35 Gtk::Button *button_finish = nullptr;
36 Gtk::Button *button_prev = nullptr;
37 Gtk::Box *edit_gates_box = nullptr;
38 Gtk::Stack *stack = nullptr;
39 class PoolBrowserPackage *browser_package = nullptr;
40 class PreviewCanvas *symbol_preview = nullptr;
41 Gtk::SpinButton *preview_part_sp = nullptr;
42 Gtk::TreeView *tv_symbols = nullptr;
43 Gtk::Box *part_box = nullptr;
44 Gtk::CheckButton *merge_pins_cb = nullptr;
45 Gtk::Label *fp_info_label = nullptr;
46 Gtk::Label *fp_info_label_sym = nullptr;
47 static std::string get_fp_info(const KiCadSymbol &s);
48
49 void update_symbol_preview();
50 void update_symbol_preview_part();
51 std::vector<Symbol> symbols_for_preview;
52
53 std::list<KiCadSymbol> k_symbols;
54 const KiCadSymbol *k_sym = nullptr;
55 void select_symbol();
56 void import(std::shared_ptr<const Package> pkg);
57
58 Gtk::Button *button_part_edit = nullptr;
59 Gtk::Button *button_autofill = nullptr;
60
61 void autofill();
62
63 class ListColumns : public Gtk::TreeModelColumnRecord {
64 public:
65 ListColumns()
66 {
67 Gtk::TreeModelColumnRecord::add(name);
68 Gtk::TreeModelColumnRecord::add(sym);
69 }
70 Gtk::TreeModelColumn<Glib::ustring> name;
71 Gtk::TreeModelColumn<const KiCadSymbol *> sym;
72 };
73 ListColumns list_columns;
74
75 Glib::RefPtr<Gtk::ListStore> symbols_store;
76
77 UUID entity_uuid;
78 UUID part_uuid;
79 std::map<UUID, UUID> symbols; // unit->symbol
80
81 void handle_next();
82 void handle_skip();
83 void handle_finish();
84 void handle_select();
85 void handle_prev();
86 void handle_edit_part();
87 void handle_edit_entity();
88 void finish();
89 void update_can_finish();
90
91 std::vector<std::string> get_filenames();
92 std::vector<std::string> files_saved;
93
94
95 class LocationEntry *entity_location_entry = nullptr;
96 class LocationEntry *part_location_entry = nullptr;
97 class LocationEntry *pack_location_entry(const Glib::RefPtr<Gtk::Builder> &x, const std::string &w,
98 Gtk::Button **button_other = nullptr);
99
100 std::map<std::string, class PoolProjectManagerProcess *> processes;
101
102 void update_buttons();
103 std::string get_rel_entity_filename();
104
105 enum class Mode { SYMBOL, PACKAGE, EDIT };
106 Mode mode = Mode::SYMBOL;
107 void set_mode(Mode mo);
108
109 WindowStateStore state_store;
110};
111} // namespace horizon
Definition gate_editor.hpp:9
Definition kicad_symbol_import_wizard.hpp:14
Definition kicad_lib_parser.hpp:14
Definition location_entry.hpp:6
Definition pool_browser_package.hpp:5
Definition pool-prj-mgr-app_win.hpp:22
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition pool.hpp:22
Definition preview_canvas.hpp:7
This class encapsulates a UUID and allows it to be uses as a value type.
Definition uuid.hpp:16
Definition window_state_store.hpp:25