Horizon
pnp_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 "util/changeable.hpp"
7 #include "util/export_file_chooser.hpp"
8 #include "board/pnp.hpp"
9 #include "widgets/column_chooser.hpp"
10 
11 namespace horizon {
12 
13 class PnPExportWindow : public Gtk::Window, public Changeable {
14 
15 public:
16  PnPExportWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const class Board &brd,
17  class PnPExportSettings &settings, const std::string &project_dir);
18  static PnPExportWindow *create(Gtk::Window *p, const class Board &brd, class PnPExportSettings &settings,
19  const std::string &project_dir);
20 
21  void set_can_export(bool v);
22  void generate();
23  void update_preview();
24  void update();
25 
26 private:
27  const class Board &board;
28  class PnPExportSettings &settings;
29 
30  ExportFileChooser export_filechooser;
31 
32  Gtk::Button *export_button = nullptr;
33  Gtk::Label *done_label = nullptr;
34  Gtk::Revealer *done_revealer = nullptr;
35  Gtk::Entry *directory_entry = nullptr;
36  Gtk::Button *directory_button = nullptr;
37 
38  Gtk::ComboBoxText *mode_combo = nullptr;
39  Gtk::CheckButton *nopopulate_check = nullptr;
40  Gtk::Label *filename_merged_label = nullptr;
41  Gtk::Label *filename_top_label = nullptr;
42  Gtk::Label *filename_bottom_label = nullptr;
43  Gtk::Entry *filename_merged_entry = nullptr;
44  Gtk::Entry *filename_top_entry = nullptr;
45  Gtk::Entry *filename_bottom_entry = nullptr;
46 
47  Gtk::CheckButton *customize_check = nullptr;
48  Gtk::Revealer *customize_revealer = nullptr;
49  Gtk::Grid *customize_grid = nullptr;
50 
51  bool can_export = true;
52  void update_export_button();
53 
54  void update_filename_visibility();
55 
56  Gtk::TreeView *preview_tv = nullptr;
57 
58  WindowStateStore state_store;
59 
60  ColumnChooser *column_chooser = nullptr;
61 
62  class MyAdapter : public ColumnChooser::Adapter<PnPColumn> {
63  public:
65  std::string get_column_name(int col) const override;
66  std::map<int, std::string> get_column_names() const override;
67  };
68 
69  MyAdapter adapter;
70 
71  void flash(const std::string &s);
72  sigc::connection flash_connection;
73 
74  class ListColumnsPreview : public Gtk::TreeModelColumnRecord {
75  public:
76  ListColumnsPreview()
77  {
78  Gtk::TreeModelColumnRecord::add(row);
79  }
80  Gtk::TreeModelColumn<PnPRow> row;
81  };
82  ListColumnsPreview list_columns_preview;
83 
84  Glib::RefPtr<Gtk::ListStore> store;
85 };
86 } // namespace horizon
Definition: board.hpp:43
Definition: changeable.hpp:5
Definition: column_chooser.hpp:23
Definition: column_chooser.hpp:6
Definition: export_file_chooser.hpp:7
Definition: pnp_export_settings.hpp:11
Definition: pnp_export_window.hpp:13
Definition: window_state_store.hpp:25