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 
36  Gtk::Entry *w_tags = nullptr;
37  Gtk::Entry *w_tags_inherited = nullptr;
38  Gtk::ToggleButton *w_tags_inherit = nullptr;
39 
40  Gtk::TreeView *w_tv_pins = nullptr;
41  Gtk::TreeView *w_tv_pads = nullptr;
42  Gtk::Button *w_button_map = nullptr;
43  Gtk::Button *w_button_unmap = nullptr;
44  Gtk::Button *w_button_select_pin = nullptr;
45  Gtk::Button *w_button_select_pads = nullptr;
46  Gtk::Label *w_pin_stat = nullptr;
47  Gtk::Label *w_pad_stat = nullptr;
48 
49  Gtk::TextView *w_parametric;
50  Gtk::Button *w_parametric_from_base;
51 
52  class PinListColumns : public Gtk::TreeModelColumnRecord {
53  public:
54  PinListColumns()
55  {
56  Gtk::TreeModelColumnRecord::add(gate_name);
57  Gtk::TreeModelColumnRecord::add(gate_uuid);
58  Gtk::TreeModelColumnRecord::add(pin_name);
59  Gtk::TreeModelColumnRecord::add(pin_uuid);
60  Gtk::TreeModelColumnRecord::add(mapped);
61  }
62  Gtk::TreeModelColumn<Glib::ustring> gate_name;
63  Gtk::TreeModelColumn<Glib::ustring> pin_name;
64  Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
65  Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
66  Gtk::TreeModelColumn<bool> mapped;
67  };
68  PinListColumns pin_list_columns;
69 
70  Glib::RefPtr<Gtk::ListStore> pin_store;
71 
72  class PadListColumns : public Gtk::TreeModelColumnRecord {
73  public:
74  PadListColumns()
75  {
76  Gtk::TreeModelColumnRecord::add(pad_name);
77  Gtk::TreeModelColumnRecord::add(pad_uuid);
78  Gtk::TreeModelColumnRecord::add(gate_name);
79  Gtk::TreeModelColumnRecord::add(gate_uuid);
80  Gtk::TreeModelColumnRecord::add(pin_name);
81  Gtk::TreeModelColumnRecord::add(pin_uuid);
82  }
83  Gtk::TreeModelColumn<Glib::ustring> pad_name;
84  Gtk::TreeModelColumn<horizon::UUID> pad_uuid;
85  Gtk::TreeModelColumn<Glib::ustring> gate_name;
86  Gtk::TreeModelColumn<Glib::ustring> pin_name;
87  Gtk::TreeModelColumn<horizon::UUID> gate_uuid;
88  Gtk::TreeModelColumn<horizon::UUID> pin_uuid;
89  };
90  PadListColumns pad_list_columns;
91 
92  Glib::RefPtr<Gtk::ListStore> pad_store;
93 
94  void update_treeview();
95  void update_mapped();
96  void update_entries();
97  void change_package();
98  void populate_models();
99 };
100 } // namespace horizon
Definition: part_editor.cpp:11
Definition: editor_interface.hpp:4
Definition: part.hpp:13
Definition: part_editor.hpp:9
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:18
Definition: block.cpp:7