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