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 "prj-mgr/prj-mgr_views.hpp"
12 #include "pool-mgr/view_create_pool.hpp"
13 #include "common/common.hpp"
18 enum class PoolUpdateStatus;
31 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
33 bool close_pool_or_project();
34 bool really_close_pool_or_project();
35 void wait_for_all_processes();
36 std::string get_filename()
const;
38 enum class SpawnFlags { NONE = 0, READ_ONLY = (1 << 0), TEMP = (1 << 1) };
41 SpawnFlags flags = SpawnFlags::NONE);
43 std::map<UUID, PoolProjectManagerProcess *> get_processes();
45 class Pool *pool =
nullptr;
48 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
49 type_signal_process_exited signal_process_exited()
51 return s_signal_process_exited;
54 typedef sigc::signal<void, std::string> type_signal_process_saved;
55 type_signal_process_saved signal_process_saved()
57 return s_signal_process_saved;
62 bool can_close =
true;
64 std::vector<UUID> procs_need_save;
69 std::string get_proc_filename(
const UUID &uu);
70 void process_save(
const UUID &uu);
71 void process_close(
const UUID &uu);
72 bool cleanup_pool_cache(Gtk::Window *parent);
74 enum class ViewMode { OPEN, POOL, PROJECT, CREATE_PROJECT, CREATE_POOL };
75 ViewMode get_view_mode()
const;
77 UUID get_pool_uuid()
const;
78 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
79 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
80 void update_pool_cache_status_now();
81 const std::string &get_project_title()
const;
83 void pool_update(
const std::vector<std::string> &filenames = {});
85 PoolProjectManagerApplication &app;
88 Glib::RefPtr<Gtk::Builder> builder;
89 Gtk::Stack *stack =
nullptr;
90 Gtk::Button *button_open =
nullptr;
91 Gtk::Button *button_close =
nullptr;
92 Gtk::Button *button_update =
nullptr;
93 Gtk::Button *button_cancel =
nullptr;
94 Gtk::MenuButton *button_new =
nullptr;
95 Gtk::Button *button_create =
nullptr;
96 Gtk::Button *button_save =
nullptr;
97 Gtk::MenuButton *hamburger_menu_button =
nullptr;
99 Gtk::HeaderBar *header =
nullptr;
100 Gtk::ListBox *recent_pools_listbox =
nullptr;
101 Gtk::ListBox *recent_projects_listbox =
nullptr;
102 std::vector<Gtk::ListBox *> recent_listboxes;
103 Gtk::Box *pool_box =
nullptr;
104 class PoolNotebook *pool_notebook =
nullptr;
106 Gtk::Label *pool_update_status_label =
nullptr;
107 Gtk::Revealer *pool_update_status_rev =
nullptr;
108 Gtk::Button *pool_update_status_close_button =
nullptr;
109 Gtk::ProgressBar *pool_update_progress =
nullptr;
110 sigc::connection pool_update_conn;
112 Gtk::InfoBar *info_bar =
nullptr;
113 Gtk::Label *info_bar_label =
nullptr;
114 Gtk::Button *show_output_button =
nullptr;
116 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
118 Gtk::MenuItem *menu_new_pool =
nullptr;
119 Gtk::MenuItem *menu_new_project =
nullptr;
121 class OutputWindow *output_window =
nullptr;
123 Gtk::InfoBar *info_bar_pool_doc =
nullptr;
125 Gtk::InfoBar *info_bar_version =
nullptr;
126 Gtk::Label *version_label =
nullptr;
128 Gtk::InfoBar *info_bar_gitignore =
nullptr;
130 std::unique_ptr<class Project> project;
131 std::string project_filename;
132 bool project_needs_save =
false;
134 class PartBrowserWindow *part_browser_window =
nullptr;
137 ViewMode view_mode = ViewMode::OPEN;
138 void set_view_mode(ViewMode mode);
140 void update_recent_items();
144 void handle_recent();
145 void handle_update();
146 void handle_new_project();
147 void handle_new_pool();
148 void handle_create();
149 void handle_cancel();
153 bool on_delete_event(GdkEventAny *ev)
override;
155 WindowStateStore state_store;
157 std::map<UUID, PoolProjectManagerProcess> processes;
158 std::map<int, bool> pids_need_save;
159 PoolProjectManagerProcess *find_process(
const std::string &filename);
160 PoolProjectManagerProcess *find_top_schematic_process();
161 PoolProjectManagerProcess *find_board_process();
163 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
164 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
166 type_signal_process_exited s_signal_process_exited;
167 type_signal_process_saved s_signal_process_saved;
169 PoolProjectManagerViewCreateProject view_create_project;
170 PoolProjectManagerViewProject view_project;
171 PoolProjectManagerViewCreatePool view_create_pool;
173 void handle_place_part(
const UUID &uu);
174 void handle_assign_part(
const UUID &uu);
176 zmq::socket_t sock_mgr;
177 std::string sock_mgr_ep;
180 bool check_schema_update(
const std::string &base_path);
181 void check_pool_update(
const std::string &base_path);
183 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
185 void set_version_info(
const std::string &s);
186 bool project_read_only =
false;
188 bool migrate_project(
const std::string &path);
189 std::string project_title;
191 Glib::Dispatcher pool_update_dispatcher;
192 bool in_pool_update_handler =
false;
193 std::mutex pool_update_status_queue_mutex;
194 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_status_queue;
195 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_error_queue;
196 bool pool_updating =
false;
197 void pool_updated(
bool success);
198 std::string pool_update_last_file;
199 std::string pool_update_last_info;
200 unsigned int pool_update_n_files = 0;
201 unsigned int pool_update_n_files_last = 0;
202 std::vector<std::string> pool_update_filenames;
204 void pool_update_thread();
205 void handle_pool_update_progress();
206 void set_pool_updating(
bool v,
bool success);
207 void set_pool_update_status_text(
const std::string &txt);
208 void set_pool_update_progress(
float progress);
210 std::string get_pool_base_path()
const;
212 std::string get_gitignore_filename()
const;
215 zmq::context_t &zctx;
Definition: pool_parametric.hpp:10
Definition: pool-prj-mgr-app_win.hpp:60
Definition: pool-prj-mgr-app_win.hpp:20
Definition: pool-prj-mgr-app.hpp:16
Definition: pool-prj-mgr-process.hpp:6
Definition: prj-mgr_views.hpp:8
Definition: prj-mgr_views.hpp:33
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