Horizon
bom_export_window.hpp
1 #pragma once
2 #include <array>
3 #include <gtkmm.h>
4 #include <set>
5 #include "util/window_state_store.hpp"
6 #include "block/bom.hpp"
7 #include "util/changeable.hpp"
8 
9 namespace horizon {
10 
11 class BOMExportWindow : public Gtk::Window, public Changeable {
12 
13 public:
14  BOMExportWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class Block *block,
15  class BOMExportSettings *settings);
16  static BOMExportWindow *create(Gtk::Window *p, class Block *block, class BOMExportSettings *settings);
17 
18  void set_can_export(bool v);
19  void generate();
20  void update_preview();
21 
22 private:
23  class Block *block;
24  class BOMExportSettings *settings;
25 
26  Gtk::Button *export_button = nullptr;
27  Gtk::ComboBoxText *sort_column_combo = nullptr;
28  Gtk::ComboBoxText *sort_order_combo = nullptr;
29  Gtk::Revealer *done_revealer = nullptr;
30  Gtk::Label *done_label = nullptr;
31  Gtk::Entry *filename_entry = nullptr;
32  Gtk::Button *filename_button = nullptr;
33 
34  class ListColumns : public Gtk::TreeModelColumnRecord {
35  public:
36  ListColumns()
37  {
38  Gtk::TreeModelColumnRecord::add(name);
39  Gtk::TreeModelColumnRecord::add(column);
40  }
41  Gtk::TreeModelColumn<BOMColumn> column;
42  Gtk::TreeModelColumn<Glib::ustring> name;
43  };
44  ListColumns list_columns;
45 
46  Glib::RefPtr<Gtk::ListStore> columns_store;
47  Glib::RefPtr<Gtk::TreeModelFilter> columns_available;
48 
49  Glib::RefPtr<Gtk::ListStore> columns_store_included;
50 
51  Gtk::TreeView *cols_available_tv = nullptr;
52  Gtk::TreeView *cols_included_tv = nullptr;
53  Gtk::TreeView *preview_tv = nullptr;
54 
55  Gtk::Button *col_inc_button = nullptr;
56  Gtk::Button *col_excl_button = nullptr;
57  Gtk::Button *col_up_button = nullptr;
58  Gtk::Button *col_down_button = nullptr;
59 
60  WindowStateStore state_store;
61 
62  void incl_excl_col(bool incl);
63  void up_down_col(bool up);
64  void update_incl_excl_sensitivity();
65  void update_cols_included();
66 
67  void flash(const std::string &s);
68  sigc::connection flash_connection;
69 
70  class ListColumnsPreview : public Gtk::TreeModelColumnRecord {
71  public:
72  ListColumnsPreview()
73  {
74  Gtk::TreeModelColumnRecord::add(row);
75  }
76  Gtk::TreeModelColumn<BOMRow> row;
77  };
78  ListColumnsPreview list_columns_preview;
79 
80  Glib::RefPtr<Gtk::ListStore> bom_store;
81 };
82 } // namespace horizon
Definition: changeable.hpp:5
Definition: window_state_store.hpp:20
Definition: bom_export_settings.hpp:10
A block is one level of hierarchy in the netlist.
Definition: block.hpp:26
Definition: block.cpp:9
Definition: bom_export_window.hpp:11