2#include "core/core.hpp"
3#include "imp_interface.hpp"
4#include "keyseq_dialog.hpp"
5#include "main_window.hpp"
6#include "pool/pool.hpp"
7#include "preferences/preferences.hpp"
8#include "selection_filter_dialog.hpp"
9#include "util/window_state_store.hpp"
10#include "widgets/spin_button_dim.hpp"
11#include "widgets/warnings_box.hpp"
13#include "nlohmann/json.hpp"
14#include "search/searcher.hpp"
16#include "util/item_set.hpp"
17#include "canvas/canvas_gl.hpp"
18#include "grid_controller.hpp"
19#include "util/action_label.hpp"
21#include "core/clipboard/clipboard.hpp"
22#include "clipboard_handler.hpp"
23#include "util/win32_undef.hpp"
24#include "logger/log_dispatcher.hpp"
30 PoolParams(
const std::string &bp) : base_path(bp)
33 std::string base_path;
41 void run(
int argc,
char *argv[]);
42 virtual void handle_tool_change(ToolID
id);
43 virtual void construct() = 0;
44 void canvas_update_from_pp();
48 void set_read_only(
bool v);
55 WORK_LAYER_ONLY_ENABLED,
63 std::vector<int> layers;
64 Flag flags = Flag::DEFAULT;
67 virtual std::map<ObjectType, SelectionFilterInfo> get_selection_filter_info()
const;
68 virtual bool is_layered()
const
79 Gtk::Menu *context_menu =
nullptr;
80 std::unique_ptr<SelectionFilterDialog> selection_filter_dialog;
81 std::optional<GridController> grid_controller;
84 std::unique_ptr<Pool> pool;
87 std::unique_ptr<Pool> real_pool_caching;
91 class Core *core =
nullptr;
92 std::unique_ptr<ClipboardBase> clipboard =
nullptr;
93 std::unique_ptr<ClipboardHandler> clipboard_handler =
nullptr;
94 std::unique_ptr<KeySequenceDialog> key_sequence_dialog =
nullptr;
95 std::unique_ptr<ImpInterface> imp_interface =
nullptr;
96 Glib::RefPtr<Glib::Binding> grid_spacing_binding;
98 std::map<ActionToolID, ActionConnection> action_connections;
108 zmq::socket_t sock_broadcast_rx;
109 zmq::socket_t sock_project;
110 bool sockets_connected =
false;
113 bool no_update =
false;
114 bool distraction_free =
false;
116 virtual void canvas_update() = 0;
117 virtual void expand_selection_for_property_panel(std::set<SelectableRef> &sel_extra,
118 const std::set<SelectableRef> &sel);
119 void handle_selection_changed(
void);
120 virtual void handle_selection_cross_probe()
123 bool handle_key_press(
const GdkEventKey *key_event);
124 void handle_cursor_move(
const Coordi &pos);
125 bool handle_click(
const GdkEventButton *button_event);
126 virtual void handle_extra_button(
const GdkEventButton *button_event)
129 bool handle_click_release(
const GdkEventButton *button_event);
130 bool handle_context_menu(
const GdkEventButton *button_event);
131 void tool_process(ToolResponse &resp);
132 void tool_begin(ToolID
id,
bool override_selection =
false,
const std::set<SelectableRef> &sel = {},
133 std::unique_ptr<ToolData> data =
nullptr);
134 void add_tool_button(ToolID
id,
const std::string &label,
bool left =
true);
135 void handle_warning_selected(
const Coordi &pos);
136 virtual bool handle_broadcast(
const json &j);
137 bool handle_close(
const GdkEventAny *ev);
140 bool trigger_action(ActionToolID action, ActionSource source = ActionSource::UNKNOWN);
142 void connect_go_to_project_manager_action();
144 void add_tool_action(ActionToolID
id,
const std::string &action);
145 void add_hamburger_menu();
147 Preferences preferences;
149 virtual const CanvasPreferences &get_canvas_preferences()
151 return preferences.canvas_non_layer;
153 virtual void apply_preferences();
155 std::unique_ptr<WindowStateStore> state_store =
nullptr;
157 virtual void handle_maybe_drag(
bool ctrl);
159 virtual ActionCatalogItem::Availability get_editor_type_for_action()
const = 0;
160 ObjectType get_editor_type()
const;
162 void layer_up_down(
bool up);
163 void goto_layer(
int layer);
165 Gtk::Button *create_action_button(ActionToolID action);
167 void set_action_sensitive(ActionID,
bool v);
168 bool get_action_sensitive(ActionID)
const;
169 virtual void update_action_sensitivity();
171 typedef sigc::signal<void> type_signal_action_sensitive;
172 type_signal_action_sensitive signal_action_sensitive()
174 return s_signal_action_sensitive;
177 virtual std::string get_hud_text(std::set<SelectableRef> &sel);
178 std::string get_hud_text_for_component(
const Component *comp);
179 virtual const Block &get_block_for_group_tag_names();
180 std::string get_hud_text_for_net(
const Net *net);
182 void set_monitor_files(
const std::set<std::string> &files);
183 void set_monitor_items(
const ItemSet &items);
184 virtual void update_monitor()
187 void edit_pool_item(ObjectType type,
const UUID &uu);
189 void parameter_window_add_polygon_expand(
class ParameterWindow *parameter_window);
191 bool read_only =
false;
193 void tool_update_data(std::unique_ptr<ToolData> &data);
195 virtual void search_center(
const Searcher::SearchResult &res);
196 virtual ActionToolID get_doubleclick_action(ObjectType type,
const UUID &uu);
198 Glib::RefPtr<Gio::Menu> hamburger_menu;
202 static const std::string meta_suffix;
204 virtual void get_save_meta(
json &j)
208 virtual void set_window_title(
const std::string &s);
209 void set_window_title_from_block();
211 void update_view_hints();
212 virtual std::vector<std::string> get_view_hints();
214 Gtk::Box *view_options_menu =
nullptr;
215 void view_options_menu_append_action(
const std::string &label,
const std::string &action);
217 virtual Searcher *get_searcher_ptr()
224 return get_searcher_ptr();
227 Searcher &get_searcher()
229 auto s = get_searcher_ptr();
231 throw std::runtime_error(
"not implemented");
235 class ActionButton &add_action_button(ActionToolID action);
236 class ActionButtonMenu &add_action_button_menu(
const char *icon_name);
237 class ActionButton &add_action_button_polygon();
238 class ActionButton &add_action_button_line();
240 virtual ToolID get_tool_for_drag_move(
bool ctrl,
const std::set<SelectableRef> &sel)
const;
241 bool force_end_tool();
242 void reset_tool_hint_label();
244 std::set<ObjectRef> highlights;
246 virtual void update_highlights()
249 virtual void clear_highlights();
251 enum class ShowInPoolManagerPool { CURRENT, LAST };
252 void show_in_pool_manager(ObjectType type,
const UUID &uu, ShowInPoolManagerPool p);
254 virtual bool uses_dynamic_version()
const
259 virtual unsigned int get_required_version()
const
261 throw std::runtime_error(
"not implemented");
265 void fix_cursor_pos();
266 Glib::RefPtr<Gio::FileMonitor> preferences_monitor;
268 void update_selection_label();
269 std::string get_tool_settings_filename(ToolID
id);
273 std::map<std::string, Glib::RefPtr<Gio::FileMonitor>> file_monitors;
274 sigc::connection file_monitor_delay_connection;
276 void handle_file_changed(
const Glib::RefPtr<Gio::File> &file1,
const Glib::RefPtr<Gio::File> &file2,
277 Gio::FileMonitorEvent ev);
279 void create_context_menu(Gtk::Menu *parent,
const std::set<SelectableRef> &sel);
280 Gtk::MenuItem *create_context_menu_item(ActionToolID act);
282 KeySequence keys_current;
283 KeyMatchResult keys_match(
const KeySequence &keys)
const;
284 bool handle_action_key(
const GdkEventKey *ev);
285 void handle_tool_action(
const ActionConnection &conn);
286 void handle_select_polygon(
const ActionConnection &a);
288 void handle_search();
289 void search_go(
int dir);
290 std::list<Searcher::SearchResult> search_results;
291 unsigned int search_result_current = 0;
292 void update_search_markers();
293 void update_search_types_label();
294 void set_search_mode(
bool enabled,
bool focus =
true);
295 std::map<Searcher::Type, Gtk::CheckButton *> search_check_buttons;
297 LogDispatcher log_dispatcher;
298 class LogWindow *log_window =
nullptr;
299 std::set<SelectableRef> selection_for_drag_move;
301 Coordf cursor_pos_drag_begin;
302 Coordi cursor_pos_grid_drag_begin;
304 std::map<ActionID, bool> action_sensitivity;
305 type_signal_action_sensitive s_signal_action_sensitive;
307 bool property_panel_has_focus();
309 sigc::connection initial_view_all_conn;
311 bool sockets_broken =
false;
312 void show_sockets_broken_dialog(
const std::string &msg =
"");
313 bool needs_autosave =
false;
314 bool queue_autosave =
false;
316 void update_property_panels();
317 std::map<CanvasGL::SelectionTool, CanvasGL::SelectionQualifier> selection_qualifiers;
318 std::list<class ActionButtonBase *> action_buttons;
320 Glib::RefPtr<Gio::SimpleAction> bottom_view_action;
321 Glib::RefPtr<Gio::SimpleAction> distraction_free_action;
322 Glib::RefPtr<Gio::SimpleAction> show_pictures_action;
324 int left_panel_width = 0;
326 void tool_bar_set_actions(
const std::vector<ActionLabelInfo> &labels);
327 void tool_bar_append_action(InToolActionID action1, InToolActionID action2,
const std::string &s);
328 void tool_bar_clear_actions();
329 InToolKeySequencesPreferences in_tool_key_sequeces_preferences;
330 std::vector<ActionLabelInfo> in_tool_action_label_infos;
332 void show_preferences(std::optional<std::string> page = std::nullopt);
338 void handle_pan_action(
const ActionConnection &c);
339 void handle_zoom_action(
const ActionConnection &c);
341 std::string get_complete_display_name(
const SelectableRef &sr);
343 void set_flip_view(
bool flip);
344 void apply_arrow_keys();
345 void check_version();
347 void update_cursor(ToolID tool_id);
349 std::set<SelectableRef> last_canvas_selection;
351 Gtk::Button *undo_button =
nullptr;
352 Gtk::Button *redo_button =
nullptr;
354 unsigned int saved_version = 0;
356 class MSDTuningWindow *msd_tuning_window =
nullptr;
Definition: action.hpp:87
Definition: canvas_gl.hpp:18
Where Tools and and documents meet.
Definition: core.hpp:42
Definition: grids_window.hpp:14
Definition: imp_interface.hpp:12
Definition: main_window.hpp:7
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:22
Definition: property_panels.hpp:8
Definition: rules_window.hpp:13
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: warnings_box.hpp:7
a class to store JSON values
Definition: json.hpp:177