Horizon
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 
7 namespace horizon {
8 
9 class PartEditor : public Gtk::Box, public PoolEditorInterface {
10 public:
11  PartEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class Part *p, class Pool *po);
12  static PartEditor *create(class Part *p, class Pool *po);
13  void reload() override;
14  void save() override;
15 
16  virtual ~PartEditor(){};
17 
18 private:
19  class Part *part;
20  class Pool *pool;
21 
22  class EntryWithInheritance *w_mpn = nullptr;
23  class EntryWithInheritance *w_value = nullptr;
24  class EntryWithInheritance *w_manufacturer = nullptr;
25  class EntryWithInheritance *w_description = nullptr;
26  class EntryWithInheritance *w_datasheet = nullptr;
27  std::map<Part::Attribute, class EntryWithInheritance *> attr_editors;
28 
29 
30  Gtk::Label *w_entity_label = nullptr;
31  Gtk::Label *w_package_label = nullptr;
32  Gtk::Label *w_base_label = nullptr;
33  Gtk::Button *w_change_package_button = nullptr;
34  Gtk::ComboBoxText *w_model_combo = nullptr;
35  Gtk::ToggleButton *w_model_inherit = nullptr;
36 
37  Gtk::Entry *w_tags = nullptr;
38  Gtk::Entry *w_tags_inherited = nullptr;
39  Gtk::ToggleButton *w_tags_inherit = nullptr;
40 
41  Gtk::TreeView *w_tv_pins = nullptr;
42  Gtk::TreeView *w_tv_pads = nullptr;
43  Gtk::Button *w_button_map = nullptr;
44  Gtk::Button *w_button_unmap = nullptr;
45  Gtk::Button *w_button_select_pin = nullptr;
46  Gtk::Button *w_button_select_pads = nullptr;
47  Gtk::Label *w_pin_stat = nullptr;
48  Gtk::Label *w_pad_stat = nullptr;
49 
50  Gtk::TextView *w_parametric;
51  Gtk::Button *w_parametric_from_base;
52 
53  class PinListColumns : public Gtk::TreeModelColumnRecord {
54  public:
55  PinListColumns()
56  {
57  Gtk::TreeModelColumnRecord::add(gate_name);
58  Gtk::TreeModelColumnRecord::add(gate_uuid);
59  Gtk::TreeModelColumnRecord::add(pin_name);
60  Gtk::TreeModelColumnRecord::add(pin_uuid);
61  Gtk::TreeModelColumnRecord::add(mapped);
62  }
63  Gtk::TreeModelColumn<Glib::ustring> gate_name;
64  Gtk::TreeModelColumn<Glib::ustring> pin_name;
65  Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
66  Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
67  Gtk::TreeModelColumn<bool> mapped;
68  };
69  PinListColumns pin_list_columns;
70 
71  Glib::RefPtr<Gtk::ListStore> pin_store;
72 
73  class PadListColumns : public Gtk::TreeModelColumnRecord {
74  public:
75  PadListColumns()
76  {
77  Gtk::TreeModelColumnRecord::add(pad_name);
78  Gtk::TreeModelColumnRecord::add(pad_uuid);
79  Gtk::TreeModelColumnRecord::add(gate_name);
80  Gtk::TreeModelColumnRecord::add(gate_uuid);
81  Gtk::TreeModelColumnRecord::add(pin_name);
82  Gtk::TreeModelColumnRecord::add(pin_uuid);
83  }
84  Gtk::TreeModelColumn<Glib::ustring> pad_name;
85  Gtk::TreeModelColumn<horizon::UUID> pad_uuid;
86  Gtk::TreeModelColumn<Glib::ustring> gate_name;
87  Gtk::TreeModelColumn<Glib::ustring> pin_name;
88  Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
89  Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
90  };
91  PadListColumns pad_list_columns;
92 
93  Glib::RefPtr<Gtk::ListStore> pad_store;
94 
95  void update_treeview();
96  void update_mapped();
97  void update_entries();
98  void change_package();
99  void populate_models();
100  void update_model_inherit();
101 };
102 } // namespace horizon
Definition: part_editor.cpp:12
Definition: editor_interface.hpp:5
Definition: part.hpp:13
Definition: part_editor.hpp:9
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:19
Definition: block.cpp:9