4 #include "util/uuid.hpp"
6 #include "util/win32_undef.hpp"
7 #include "nlohmann/json_fwd.hpp"
8 #include "util/editor_process.hpp"
9 #include "util/window_state_store.hpp"
10 #include "pool-prj-mgr-process.hpp"
11 #include "project/project.hpp"
12 #include "prj-mgr/prj-mgr_views.hpp"
13 #include "pool-mgr/view_create_pool.hpp"
14 #include "common/common.hpp"
19 enum class PoolUpdateStatus;
32 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
34 bool close_pool_or_project();
35 bool really_close_pool_or_project();
36 void wait_for_all_processes();
37 std::string get_filename()
const;
39 enum class SpawnFlags { NONE = 0, READ_ONLY = (1 << 0), TEMP = (1 << 1) };
42 SpawnFlags flags = SpawnFlags::NONE);
44 std::map<UUID, PoolProjectManagerProcess *> get_processes();
46 class Pool *pool =
nullptr;
49 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
50 type_signal_process_exited signal_process_exited()
52 return s_signal_process_exited;
55 typedef sigc::signal<void, std::string> type_signal_process_saved;
56 type_signal_process_saved signal_process_saved()
58 return s_signal_process_saved;
63 bool can_close =
true;
65 std::vector<UUID> procs_need_save;
70 std::string get_proc_filename(
const UUID &uu);
71 void process_save(
const UUID &uu);
72 void process_close(
const UUID &uu);
73 bool cleanup_pool_cache(Gtk::Window *parent);
75 enum class ViewMode { OPEN, POOL, PROJECT, CREATE_PROJECT, CREATE_POOL };
76 ViewMode get_view_mode()
const;
78 UUID get_pool_uuid()
const;
79 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
80 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
81 void update_pool_cache_status_now();
82 const std::string &get_project_title()
const;
84 void pool_update(
const std::vector<std::string> &filenames = {});
86 PoolProjectManagerApplication &app;
89 Glib::RefPtr<Gtk::Builder> builder;
90 Gtk::Stack *stack =
nullptr;
91 Gtk::Button *button_open =
nullptr;
92 Gtk::Button *button_close =
nullptr;
93 Gtk::Button *button_update =
nullptr;
94 Gtk::Button *button_cancel =
nullptr;
95 Gtk::MenuButton *button_new =
nullptr;
96 Gtk::Button *button_create =
nullptr;
97 Gtk::Button *button_save =
nullptr;
98 Gtk::MenuButton *hamburger_menu_button =
nullptr;
100 Gtk::HeaderBar *header =
nullptr;
101 Gtk::ListBox *recent_pools_listbox =
nullptr;
102 Gtk::ListBox *recent_projects_listbox =
nullptr;
103 std::vector<Gtk::ListBox *> recent_listboxes;
104 Gtk::Box *pool_box =
nullptr;
105 class PoolNotebook *pool_notebook =
nullptr;
107 Gtk::Label *pool_update_status_label =
nullptr;
108 Gtk::Revealer *pool_update_status_rev =
nullptr;
109 Gtk::Button *pool_update_status_close_button =
nullptr;
110 Gtk::ProgressBar *pool_update_progress =
nullptr;
111 sigc::connection pool_update_conn;
113 Gtk::InfoBar *info_bar =
nullptr;
114 Gtk::Label *info_bar_label =
nullptr;
115 Gtk::Button *show_output_button =
nullptr;
117 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
119 Gtk::MenuItem *menu_new_pool =
nullptr;
120 Gtk::MenuItem *menu_new_project =
nullptr;
122 class OutputWindow *output_window =
nullptr;
124 Gtk::InfoBar *info_bar_pool_doc =
nullptr;
126 Gtk::InfoBar *info_bar_version =
nullptr;
127 Gtk::Label *version_label =
nullptr;
129 std::unique_ptr<Project> project =
nullptr;
130 std::string project_filename;
131 bool project_needs_save =
false;
133 class PartBrowserWindow *part_browser_window =
nullptr;
136 ViewMode view_mode = ViewMode::OPEN;
137 void set_view_mode(ViewMode mode);
139 void update_recent_items();
143 void handle_recent();
144 void handle_update();
145 void handle_new_project();
146 void handle_new_pool();
147 void handle_create();
148 void handle_cancel();
152 bool on_delete_event(GdkEventAny *ev)
override;
154 WindowStateStore state_store;
156 std::map<UUID, PoolProjectManagerProcess> processes;
157 std::map<int, bool> pids_need_save;
158 PoolProjectManagerProcess *find_process(
const std::string &filename);
159 PoolProjectManagerProcess *find_top_schematic_process();
160 PoolProjectManagerProcess *find_board_process();
162 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
163 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
165 type_signal_process_exited s_signal_process_exited;
166 type_signal_process_saved s_signal_process_saved;
168 PoolProjectManagerViewCreateProject view_create_project;
169 PoolProjectManagerViewProject view_project;
170 PoolProjectManagerViewCreatePool view_create_pool;
172 void handle_place_part(
const UUID &uu);
173 void handle_assign_part(
const UUID &uu);
175 zmq::socket_t sock_mgr;
176 std::string sock_mgr_ep;
179 bool check_schema_update(
const std::string &base_path);
180 void check_pool_update(
const std::string &base_path);
182 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
184 void set_version_info(
const std::string &s);
185 bool project_read_only =
false;
187 bool migrate_project(
const std::string &path);
188 std::string project_title;
190 Glib::Dispatcher pool_update_dispatcher;
191 bool in_pool_update_handler =
false;
192 std::mutex pool_update_status_queue_mutex;
193 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_status_queue;
194 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_error_queue;
195 bool pool_updating =
false;
196 void pool_updated(
bool success);
197 std::string pool_update_last_file;
198 std::string pool_update_last_info;
199 unsigned int pool_update_n_files = 0;
200 unsigned int pool_update_n_files_last = 0;
201 std::vector<std::string> pool_update_filenames;
203 void pool_update_thread();
204 void handle_pool_update_progress();
205 void set_pool_updating(
bool v,
bool success);
206 void set_pool_update_status_text(
const std::string &txt);
207 void set_pool_update_progress(
float progress);
209 std::string get_pool_base_path()
const;
212 zmq::context_t &zctx;
Definition: pool_parametric.hpp:10
Definition: pool-prj-mgr-app_win.hpp:61
Definition: pool-prj-mgr-app_win.hpp:21
Definition: pool-prj-mgr-app.hpp:16
Definition: pool-prj-mgr-process.hpp:6
Definition: prj-mgr_views.hpp:9
Definition: prj-mgr_views.hpp:34
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:24
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
a class to store JSON values
Definition: json.hpp:170
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62