1 #pragma once
2 #include <gtkmm.h>
3 #include <array>
4 #include <set>
5 #include "util/export_file_chooser.hpp"
6 #include "util/changeable.hpp"
7 
8 namespace horizon {
9 
10 class StepExportWindow : public Gtk::Window, public Changeable {
11 public:
12     StepExportWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class IDocumentBoard &c,
13                      const std::string &project_dir);
14     static StepExportWindow *create(Gtk::Window *p, class IDocumentBoard &c, const std::string &project_dir);
15 
16     void set_can_export(bool v);
17     void generate();
18 
19 private:
20     class IDocumentBoard &core;
21     class STEPExportSettings &settings;
22     Gtk::HeaderBar *header = nullptr;
23     Gtk::Entry *filename_entry = nullptr;
24     Gtk::Button *filename_button = nullptr;
25     Gtk::Button *export_button = nullptr;
26     Gtk::Switch *include_3d_models_switch = nullptr;
27     Gtk::Entry *prefix_entry = nullptr;
28 
29     Gtk::TextView *log_textview = nullptr;
30     Gtk::Spinner *spinner = nullptr;
31     bool can_export = true;
32     void update_export_button();
33     Glib::RefPtr<Gtk::TextTag> tag;
34 
35     class MyExportFileChooser : public ExportFileChooser {
36     protected:
37         void prepare_chooser(Glib::RefPtr<Gtk::FileChooser> chooser) override;
38         void prepare_filename(std::string &filename) override;
39     };
40     MyExportFileChooser export_filechooser;
41 
42     Glib::Dispatcher export_dispatcher;
43     std::mutex msg_queue_mutex;
44     std::deque<std::string> msg_queue;
45     bool export_running = false;
46 
47     void set_is_busy(bool v);
48 
49     void export_thread(STEPExportSettings settings);
50 };
51 } // namespace horizon
52