1 #pragma once 2 #include <gtkmm.h> 3 #include <array> 4 #include <set> 5 #include "util/status_dispatcher.hpp" 6 #include "util/changeable.hpp" 7 #include "common/pdf_export_settings.hpp" 8 #include "util/export_file_chooser.hpp" 9 10 namespace horizon { 11 12 class PDFExportWindow : public Gtk::Window, public Changeable { 13 friend class PDFLayerEditor; 14 15 public: 16 PDFExportWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class IDocument &c, 17 class PDFExportSettings &s, const std::string &project_dir); 18 static PDFExportWindow *create(Gtk::Window *p, class IDocument &c, class PDFExportSettings &s, 19 const std::string &project_dir); 20 21 void generate(); 22 void reload_layers(); 23 24 private: 25 class IDocument &core; 26 class PDFExportSettings &settings; 27 28 class MyExportFileChooser : public ExportFileChooser { 29 protected: 30 void prepare_chooser(Glib::RefPtr<Gtk::FileChooser> chooser) override; 31 void prepare_filename(std::string &filename) override; 32 }; 33 MyExportFileChooser export_filechooser; 34 35 Gtk::HeaderBar *header = nullptr; 36 Gtk::Entry *filename_entry = nullptr; 37 Gtk::Button *filename_button = nullptr; 38 class SpinButtonDim *min_line_width_sp = nullptr; 39 Gtk::SpinButton *holes_diameter_spin = nullptr; 40 Gtk::Grid *grid = nullptr; 41 Gtk::ListBox *layers_box; 42 Glib::RefPtr<Gtk::SizeGroup> sg_layer_name; 43 44 Gtk::Button *export_button = nullptr; 45 Gtk::Label *progress_label = nullptr; 46 Gtk::ProgressBar *progress_bar = nullptr; 47 Gtk::Revealer *progress_revealer = nullptr; 48 void update_export_button(); 49 50 Gtk::Spinner *spinner = nullptr; 51 52 StatusDispatcher status_dispatcher; 53 bool is_busy = false; 54 55 56 void export_thread(PDFExportSettings settings); 57 unsigned int n_layers = 0; 58 }; 59 } // namespace horizon 60