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"
19 enum class PoolUpdateStatus;
20 enum class CheckSchemaUpdateResult;
33 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
35 bool close_pool_or_project();
36 bool really_close_pool_or_project();
37 void wait_for_all_processes();
38 std::string get_filename()
const;
40 enum class SpawnFlags { NONE = 0, READ_ONLY = (1 << 0), TEMP = (1 << 1) };
47 SpawnResult spawn(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &args,
48 SpawnFlags flags = SpawnFlags::NONE);
50 std::map<UUID, PoolProjectManagerProcess *> get_processes();
52 class Pool *pool =
nullptr;
55 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
56 type_signal_process_exited signal_process_exited()
58 return s_signal_process_exited;
61 typedef sigc::signal<void, std::string> type_signal_process_saved;
62 type_signal_process_saved signal_process_saved()
64 return s_signal_process_saved;
69 bool can_close =
true;
71 std::vector<UUID> procs_need_save;
76 std::string get_proc_filename(
const UUID &uu);
77 void process_save(
const UUID &uu);
78 void process_close(
const UUID &uu);
79 bool cleanup_pool_cache(Gtk::Window *parent);
81 enum class ViewMode { OPEN, POOL, PROJECT, CREATE_PROJECT, CREATE_POOL };
82 ViewMode get_view_mode()
const;
84 UUID get_pool_uuid()
const;
85 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
86 void pool_notebook_show_settings_tab();
87 void open_pool(
const std::string &pool_json);
88 void update_pool_cache_status_now();
89 const std::string &get_project_title()
const;
91 void pool_update(
const std::vector<std::string> &filenames = {});
93 PoolProjectManagerApplication &app;
96 Glib::RefPtr<Gtk::Builder> builder;
97 Gtk::Stack *stack =
nullptr;
98 Gtk::Button *button_open =
nullptr;
99 Gtk::Button *button_close =
nullptr;
100 Gtk::Button *button_update =
nullptr;
101 Gtk::Button *button_cancel =
nullptr;
102 Gtk::MenuButton *button_new =
nullptr;
103 Gtk::Button *button_create =
nullptr;
104 Gtk::Button *button_save =
nullptr;
105 Gtk::MenuButton *hamburger_menu_button =
nullptr;
107 Gtk::HeaderBar *header =
nullptr;
108 Gtk::ListBox *recent_pools_listbox =
nullptr;
109 Gtk::ListBox *recent_projects_listbox =
nullptr;
110 std::vector<Gtk::ListBox *> recent_listboxes;
111 Gtk::Box *pool_box =
nullptr;
112 class PoolNotebook *pool_notebook =
nullptr;
114 Gtk::Label *pool_update_status_label =
nullptr;
115 Gtk::Revealer *pool_update_status_rev =
nullptr;
116 Gtk::Button *pool_update_status_close_button =
nullptr;
117 Gtk::ProgressBar *pool_update_progress =
nullptr;
118 sigc::connection pool_update_conn;
120 Gtk::InfoBar *info_bar =
nullptr;
121 Gtk::Label *info_bar_label =
nullptr;
122 Gtk::Button *show_output_button =
nullptr;
124 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
126 Gtk::MenuItem *menu_new_pool =
nullptr;
127 Gtk::MenuItem *menu_new_project =
nullptr;
129 class OutputWindow *output_window =
nullptr;
131 Gtk::InfoBar *info_bar_pool_doc =
nullptr;
133 Gtk::InfoBar *info_bar_version =
nullptr;
134 Gtk::Label *version_label =
nullptr;
136 Gtk::InfoBar *info_bar_gitignore =
nullptr;
138 Gtk::InfoBar *info_bar_installation_uuid_mismatch =
nullptr;
140 std::unique_ptr<class Project> project;
141 std::string project_filename;
142 bool project_needs_save =
false;
144 class PartBrowserWindow *part_browser_window =
nullptr;
146 #if GTK_CHECK_VERSION(3, 24, 0)
147 static gboolean part_browser_key_pressed(GtkEventControllerKey *controller, guint keyval, guint keycode,
148 GdkModifierType state, gpointer user_data);
151 ViewMode view_mode = ViewMode::OPEN;
152 void set_view_mode(ViewMode mode);
154 void update_recent_items();
158 void handle_recent();
159 void handle_update();
160 void handle_new_project();
161 void handle_new_pool();
162 void handle_create();
163 void handle_cancel();
167 bool on_delete_event(GdkEventAny *ev)
override;
169 WindowStateStore state_store;
171 std::map<UUID, PoolProjectManagerProcess> processes;
172 std::map<int, bool> pids_need_save;
173 PoolProjectManagerProcess *find_process(
const std::string &filename);
174 PoolProjectManagerProcess *find_top_schematic_process();
175 PoolProjectManagerProcess *find_board_process();
177 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
178 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
180 type_signal_process_exited s_signal_process_exited;
181 type_signal_process_saved s_signal_process_saved;
183 PoolProjectManagerViewCreateProject view_create_project;
184 PoolProjectManagerViewProject view_project;
185 PoolProjectManagerViewCreatePool view_create_pool;
187 void handle_place_part(
const UUID &uu);
188 void handle_assign_part(
const UUID &uu);
190 zmq::socket_t sock_mgr;
191 std::string sock_mgr_ep;
194 bool check_schema_update(
const std::string &base_path);
196 void check_pool_update(
const std::string &base_path);
197 void check_mtimes(
const std::string &base_path);
198 std::thread check_mtimes_thread;
199 Glib::Dispatcher check_mtimes_dispatcher;
201 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
203 void set_version_info(
const std::string &s);
204 bool project_read_only =
false;
206 bool migrate_project(
const std::string &path);
207 std::string project_title;
209 Glib::Dispatcher pool_update_dispatcher;
210 bool in_pool_update_handler =
false;
211 std::mutex pool_update_status_queue_mutex;
212 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_status_queue;
213 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_error_queue;
214 bool pool_updating =
false;
215 void pool_updated(
bool success);
216 std::string pool_update_last_file;
217 std::string pool_update_last_info;
218 unsigned int pool_update_n_files = 0;
219 unsigned int pool_update_n_files_last = 0;
220 std::vector<std::string> pool_update_filenames;
222 void pool_update_thread();
223 void handle_pool_update_progress();
224 void set_pool_updating(
bool v,
bool success);
225 void set_pool_update_status_text(
const std::string &txt);
226 void set_pool_update_progress(
float progress);
228 std::string get_pool_base_path()
const;
230 std::string get_gitignore_filename()
const;
233 zmq::context_t &zctx;
Definition: pool_parametric.hpp:10
Definition: pool-prj-mgr-app_win.hpp:67
Definition: pool-prj-mgr-app_win.hpp:22
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:35
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:22
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:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62
Definition: pool-prj-mgr-app_win.hpp:42