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;
19 enum class CheckSchemaUpdateResult;
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 Gtk::InfoBar *info_bar_gitignore =
nullptr;
131 Gtk::InfoBar *info_bar_installation_uuid_mismatch =
nullptr;
133 std::unique_ptr<class Project> project;
134 std::string project_filename;
135 bool project_needs_save =
false;
137 class PartBrowserWindow *part_browser_window =
nullptr;
139 #if GTK_CHECK_VERSION(3, 24, 0)
140 static gboolean part_browser_key_pressed(GtkEventControllerKey *controller, guint keyval, guint keycode,
141 GdkModifierType state, gpointer user_data);
144 ViewMode view_mode = ViewMode::OPEN;
145 void set_view_mode(ViewMode mode);
147 void update_recent_items();
151 void handle_recent();
152 void handle_update();
153 void handle_new_project();
154 void handle_new_pool();
155 void handle_create();
156 void handle_cancel();
160 bool on_delete_event(GdkEventAny *ev)
override;
162 WindowStateStore state_store;
164 std::map<UUID, PoolProjectManagerProcess> processes;
165 std::map<int, bool> pids_need_save;
166 PoolProjectManagerProcess *find_process(
const std::string &filename);
167 PoolProjectManagerProcess *find_top_schematic_process();
168 PoolProjectManagerProcess *find_board_process();
170 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
171 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
173 type_signal_process_exited s_signal_process_exited;
174 type_signal_process_saved s_signal_process_saved;
176 PoolProjectManagerViewCreateProject view_create_project;
177 PoolProjectManagerViewProject view_project;
178 PoolProjectManagerViewCreatePool view_create_pool;
180 void handle_place_part(
const UUID &uu);
181 void handle_assign_part(
const UUID &uu);
183 zmq::socket_t sock_mgr;
184 std::string sock_mgr_ep;
187 void check_schema_update(
const std::string &base_path);
188 void check_pool_update(
const std::string &base_path);
190 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
192 void set_version_info(
const std::string &s);
193 bool project_read_only =
false;
195 bool migrate_project(
const std::string &path);
196 std::string project_title;
198 Glib::Dispatcher pool_update_dispatcher;
199 bool in_pool_update_handler =
false;
200 std::mutex pool_update_status_queue_mutex;
201 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_status_queue;
202 std::list<std::tuple<PoolUpdateStatus, std::string, std::string>> pool_update_error_queue;
203 bool pool_updating =
false;
204 void pool_updated(
bool success);
205 std::string pool_update_last_file;
206 std::string pool_update_last_info;
207 unsigned int pool_update_n_files = 0;
208 unsigned int pool_update_n_files_last = 0;
209 std::vector<std::string> pool_update_filenames;
211 void pool_update_thread();
212 void handle_pool_update_progress();
213 void set_pool_updating(
bool v,
bool success);
214 void set_pool_update_status_text(
const std::string &txt);
215 void set_pool_update_progress(
float progress);
217 std::string get_pool_base_path()
const;
219 std::string get_gitignore_filename()
const;
222 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:8
Definition: prj-mgr_views.hpp:33
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