Horizon
fab_output_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/export_file_chooser.hpp"
7 #include "util/changeable.hpp"
8 #include "util/done_revealer_controller.hpp"
9 
10 namespace horizon {
11 
12 class FabOutputWindow : public Gtk::Window, public Changeable {
13  friend class GerberLayerEditor;
14 
15 public:
16  FabOutputWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class IDocumentBoard &c,
17  const std::string &project_dir);
18  static FabOutputWindow *create(Gtk::Window *p, class IDocumentBoard &c, const std::string &project_dir);
19 
20  void set_can_generate(bool v);
21  void reload_layers();
22  void generate();
23 
24 private:
25  class IDocumentBoard &core;
26  class Board &brd;
27  class GerberOutputSettings &settings;
28  class ODBOutputSettings &odb_settings;
29  Gtk::ListBox *gerber_layers_box = nullptr;
30  Gtk::Entry *npth_filename_entry = nullptr;
31  Gtk::Entry *pth_filename_entry = nullptr;
32  Gtk::Label *npth_filename_label = nullptr;
33  Gtk::Label *pth_filename_label = nullptr;
34  Gtk::Entry *prefix_entry = nullptr;
35  Gtk::Entry *directory_entry = nullptr;
36  class SpinButtonDim *outline_width_sp = nullptr;
37  Gtk::Button *generate_button = nullptr;
38  Gtk::Button *directory_button = nullptr;
39  Gtk::ComboBoxText *drill_mode_combo = nullptr;
40  Gtk::TextView *log_textview = nullptr;
41  Gtk::Switch *zip_output_switch = nullptr;
42  bool can_export = true;
43  void update_export_button();
44 
45  Gtk::Entry *odb_filename_entry = nullptr;
46  Gtk::Button *odb_filename_button = nullptr;
47  Gtk::Box *odb_filename_box = nullptr;
48  Gtk::Label *odb_filename_label = nullptr;
49 
50  Gtk::Entry *odb_directory_entry = nullptr;
51  Gtk::Button *odb_directory_button = nullptr;
52  Gtk::Box *odb_directory_box = nullptr;
53  Gtk::Label *odb_directory_label = nullptr;
54 
55  Gtk::RadioButton *odb_format_tgz_rb = nullptr;
56  Gtk::RadioButton *odb_format_directory_rb = nullptr;
57  Gtk::RadioButton *odb_format_zip_rb = nullptr;
58 
59  Gtk::Entry *odb_job_name_entry = nullptr;
60 
61  Gtk::Stack *stack = nullptr;
62 
63  ExportFileChooser export_filechooser;
64  class ODBExportFileChooserFilename : public ExportFileChooser {
65  public:
66  ODBExportFileChooserFilename(const ODBOutputSettings &settings);
67 
68  protected:
69  void prepare_chooser(Glib::RefPtr<Gtk::FileChooser> chooser) override;
70  void prepare_filename(std::string &filename) override;
71 
72  const ODBOutputSettings &settings;
73  };
74  ODBExportFileChooserFilename odb_export_filechooser_filename;
75 
76  ExportFileChooser odb_export_filechooser_directory;
77 
78  Gtk::Revealer *done_revealer = nullptr;
79  Gtk::Label *done_label = nullptr;
80  Gtk::Button *done_close_button = nullptr;
81  DoneRevealerController done_revealer_controller;
82 
83  Gtk::Revealer *odb_done_revealer = nullptr;
84  Gtk::Label *odb_done_label = nullptr;
85  Gtk::Button *odb_done_close_button = nullptr;
86  DoneRevealerController odb_done_revealer_controller;
87 
88  Glib::RefPtr<Gtk::SizeGroup> sg_layer_name;
89 
90  WindowStateStore state_store;
91 
92  void update_drill_visibility();
93  void update_odb_visibility();
94  unsigned int n_layers = 0;
95 };
96 } // namespace horizon
Definition: board.hpp:47
Definition: changeable.hpp:5
Definition: done_revealer_controller.hpp:5
Definition: export_file_chooser.hpp:7
Definition: fab_output_window.hpp:12
Definition: fab_output_window.cpp:14
Definition: gerber_output_settings.hpp:10
Definition: idocument_board.hpp:5
Definition: odb_output_settings.hpp:10
Definition: spin_button_dim.hpp:5
Definition: window_state_store.hpp:25