Horizon
Loading...
Searching...
No Matches
part_editor.hpp
1#pragma once
2#include <gtkmm.h>
3#include "common/common.hpp"
4#include "pool/part.hpp"
5#include "editor_interface.hpp"
6#include "widgets/generic_combo_box.hpp"
7
8namespace horizon {
9
10class PartEditor : public Gtk::Box, public PoolEditorInterface {
11public:
12 PartEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class Part &p, class IPool &po,
13 class PoolParametric &pp);
14 static PartEditor *create(class Part &p, class IPool &po, class PoolParametric &pp);
15 void reload() override;
16 void save() override;
17
18 virtual ~PartEditor(){};
19
20private:
21 class Part &part;
22 class IPool &pool;
23 class PoolParametric &pool_parametric;
24
25 class EntryWithInheritance *w_mpn = nullptr;
26 class EntryWithInheritance *w_value = nullptr;
27 class EntryWithInheritance *w_manufacturer = nullptr;
28 class EntryWithInheritance *w_description = nullptr;
29 class EntryWithInheritance *w_datasheet = nullptr;
30 std::map<Part::Attribute, class EntryWithInheritance *> attr_editors;
31
32
33 Gtk::Label *w_entity_label = nullptr;
34 Gtk::Label *w_package_label = nullptr;
35 Gtk::Label *w_base_label = nullptr;
36 Gtk::Button *w_change_package_button = nullptr;
37 GenericComboBox<UUID> *w_model_combo = nullptr;
38 Gtk::ToggleButton *w_model_inherit = nullptr;
39
40 class TagEntry *w_tags = nullptr;
41 Gtk::Entry *w_tags_inherited = nullptr;
42 Gtk::ToggleButton *w_tags_inherit = nullptr;
43
44 Gtk::TreeView *w_tv_pins = nullptr;
45 Gtk::TreeView *w_tv_pads = nullptr;
46 Gtk::Button *w_button_map = nullptr;
47 Gtk::Button *w_button_unmap = nullptr;
48 Gtk::Button *w_button_automap = nullptr;
49 Gtk::Button *w_button_select_pin = nullptr;
50 Gtk::Button *w_button_select_pads = nullptr;
51 Gtk::Button *w_button_copy_from_other = nullptr;
52 Gtk::Label *w_pin_stat = nullptr;
53 Gtk::Label *w_pad_stat = nullptr;
54
55 Gtk::ComboBoxText *w_parametric_table_combo = nullptr;
56 Gtk::Box *w_parametric_box = nullptr;
57 Gtk::Button *w_parametric_from_base = nullptr;
58
59 Gtk::Label *w_orderable_MPNs_label = nullptr;
60 Gtk::Button *w_orderable_MPNs_add_button = nullptr;
61 Gtk::Box *w_orderable_MPNs_box = nullptr;
62
63 Gtk::Label *w_flags_label = nullptr;
64 Gtk::Grid *w_flags_grid = nullptr;
65
66 Gtk::RadioButton *w_override_prefix_inherit_button = nullptr;
67 Gtk::RadioButton *w_override_prefix_no_button = nullptr;
68 Gtk::RadioButton *w_override_prefix_yes_button = nullptr;
69 Gtk::Entry *w_override_prefix_entry = nullptr;
70
71 class PinListColumns : public Gtk::TreeModelColumnRecord {
72 public:
73 PinListColumns()
74 {
75 Gtk::TreeModelColumnRecord::add(gate_name);
76 Gtk::TreeModelColumnRecord::add(gate_uuid);
77 Gtk::TreeModelColumnRecord::add(pin_name);
78 Gtk::TreeModelColumnRecord::add(pin_uuid);
79 Gtk::TreeModelColumnRecord::add(mapped);
80 }
81 Gtk::TreeModelColumn<Glib::ustring> gate_name;
82 Gtk::TreeModelColumn<Glib::ustring> pin_name;
83 Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
84 Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
85 Gtk::TreeModelColumn<bool> mapped;
86 };
87 PinListColumns pin_list_columns;
88
89 Glib::RefPtr<Gtk::ListStore> pin_store;
90
91 class PadListColumns : public Gtk::TreeModelColumnRecord {
92 public:
93 PadListColumns()
94 {
95 Gtk::TreeModelColumnRecord::add(pad_name);
96 Gtk::TreeModelColumnRecord::add(pad_uuid);
97 Gtk::TreeModelColumnRecord::add(gate_name);
98 Gtk::TreeModelColumnRecord::add(gate_uuid);
99 Gtk::TreeModelColumnRecord::add(pin_name);
100 Gtk::TreeModelColumnRecord::add(pin_uuid);
101 }
102 Gtk::TreeModelColumn<Glib::ustring> pad_name;
103 Gtk::TreeModelColumn<horizon::UUID> pad_uuid;
104 Gtk::TreeModelColumn<Glib::ustring> gate_name;
105 Gtk::TreeModelColumn<Glib::ustring> pin_name;
106 Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
107 Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
108 };
109 PadListColumns pad_list_columns;
110
111 Glib::RefPtr<Gtk::ListStore> pad_store;
112
113 void update_orderable_MPNs_label();
114 void update_treeview();
115 void update_mapped();
116 void update_entries();
117 void change_package();
118 void populate_models();
119 void update_model_inherit();
120 void map_pin(Gtk::TreeModel::iterator it_pin);
121 void copy_from_other_part();
122 void update_map_buttons();
123 void update_flags_label();
124 void update_prefix_entry();
125
126 class ParametricEditor *parametric_editor = nullptr;
127 void update_parametric_editor();
128 class OrderableMPNEditor *create_orderable_MPN_editor(const UUID &uu);
129};
130} // namespace horizon
Definition part_editor.cpp:17
Definition generic_combo_box.hpp:5
Definition ipool.hpp:14
Definition part_editor.cpp:100
Definition parametric.hpp:11
Definition part_editor.hpp:10
Definition part.hpp:15
Definition editor_interface.hpp:6
Definition pool_parametric.hpp:10
Definition tag_entry.hpp:9
This class encapsulates a UUID and allows it to be uses as a value type.
Definition uuid.hpp:16