2 #include "core/clipboard.hpp"
3 #include "core/core.hpp"
4 #include "core/cores.hpp"
5 #include "imp_interface.hpp"
6 #include "keyseq_dialog.hpp"
7 #include "main_window.hpp"
8 #include "pool/pool.hpp"
9 #include "preferences/preferences.hpp"
10 #include "selection_filter_dialog.hpp"
11 #include "util/window_state_store.hpp"
12 #include "widgets/spin_button_dim.hpp"
13 #include "widgets/warnings_box.hpp"
27 PoolParams(
const std::string &bp,
const std::string &cp =
"") : base_path(bp), cache_path(cp)
30 std::string base_path;
31 std::string cache_path;
34 std::unique_ptr<Pool> make_pool(
const PoolParams ¶ms);
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);
50 std::set<ObjectRef> highlights;
51 virtual void update_highlights(){};
61 std::vector<int> layers;
62 bool has_others =
false;
65 virtual std::map<ObjectType, SelectionFilterInfo> get_selection_filter_info()
const;
73 Gtk::Menu *context_menu =
nullptr;
75 std::unique_ptr<SelectionFilterDialog> selection_filter_dialog;
77 std::unique_ptr<Pool> pool;
79 std::unique_ptr<ClipboardManager> clipboard =
nullptr;
80 std::unique_ptr<KeySequenceDialog> key_sequence_dialog =
nullptr;
81 std::unique_ptr<ImpInterface> imp_interface =
nullptr;
82 Glib::RefPtr<Glib::Binding> grid_spacing_binding;
92 zmq::socket_t sock_broadcast_rx;
93 zmq::socket_t sock_project;
94 bool sockets_connected =
false;
96 bool no_update =
false;
98 virtual void canvas_update() = 0;
100 bool handle_key_press(GdkEventKey *key_event);
101 void handle_cursor_move(
const Coordi &pos);
102 bool handle_click(GdkEventButton *button_event);
103 bool handle_click_release(GdkEventButton *button_event);
104 bool handle_context_menu(GdkEventButton *button_event);
106 void tool_begin(ToolID
id,
bool override_selection =
false,
const std::set<SelectableRef> &sel = {},
107 std::unique_ptr<ToolData> data =
nullptr);
108 void add_tool_button(ToolID
id,
const std::string &label,
bool left =
true);
109 void handle_warning_selected(
const Coordi &pos);
110 virtual bool handle_broadcast(
const json &j);
111 bool handle_close(GdkEventAny *ev);
114 bool trigger_action(
const std::pair<ActionID, ToolID> &action);
115 bool trigger_action(ActionID aid);
116 bool trigger_action(ToolID tid);
118 void add_tool_action(ToolID tid,
const std::string &action);
119 void add_hamburger_menu();
125 return &preferences.canvas_non_layer;
127 virtual void apply_preferences();
129 std::unique_ptr<WindowStateStore> state_store =
nullptr;
131 virtual void handle_maybe_drag();
133 virtual ActionCatalogItem::Availability get_editor_type_for_action()
const = 0;
134 virtual ObjectType get_editor_type()
const = 0;
136 void layer_up_down(
bool up);
137 void goto_layer(
int layer);
139 Gtk::Button *create_action_button(std::pair<ActionID, ToolID> action);
141 void set_action_sensitive(std::pair<ActionID, ToolID>,
bool v);
142 bool get_action_sensitive(std::pair<ActionID, ToolID>)
const;
143 virtual void update_action_sensitivity();
145 typedef sigc::signal<void> type_signal_action_sensitive;
146 type_signal_action_sensitive signal_action_sensitive()
148 return s_signal_action_sensitive;
151 virtual std::string get_hud_text(std::set<SelectableRef> &sel);
152 std::string get_hud_text_for_component(
const Component *comp);
153 std::string get_hud_text_for_net(
const Net *net);
155 void set_monitor_files(
const std::set<std::string> &files);
156 void set_monitor_items(
const std::set<std::pair<ObjectType, UUID>> &items);
157 virtual void update_monitor()
160 void edit_pool_item(ObjectType type,
const UUID &uu);
162 void parameter_window_add_polygon_expand(
class ParameterWindow *parameter_window);
164 bool read_only =
false;
166 void tool_update_data(std::unique_ptr<ToolData> &data);
168 virtual void search_center(
const Core::SearchResult &res);
169 virtual std::pair<ActionID, ToolID> get_doubleclick_action(ObjectType type,
const UUID &uu);
171 Glib::RefPtr<Gio::Menu> hamburger_menu;
174 void fix_cursor_pos();
175 Glib::RefPtr<Gio::FileMonitor> preferences_monitor;
176 void handle_drag(
bool ctrl);
177 void update_selection_label();
178 std::string get_tool_settings_filename(ToolID
id);
182 std::map<std::string, Glib::RefPtr<Gio::FileMonitor>> file_monitors;
184 void handle_file_changed(
const Glib::RefPtr<Gio::File> &file1,
const Glib::RefPtr<Gio::File> &file2,
185 Gio::FileMonitorEvent ev);
187 ActionConnection &connect_action(ActionID action_id, ToolID tool_id,
188 std::function<
void(
const ActionConnection &)> cb);
190 void create_context_menu(Gtk::Menu *parent,
const std::set<SelectableRef> &sel);
192 KeySequence keys_current;
193 bool handle_action_key(GdkEventKey *ev);
194 void handle_tool_action(
const ActionConnection &conn);
196 void handle_search();
197 void search_go(
int dir);
198 std::list<Core::SearchResult> search_results;
199 unsigned int search_result_current = 0;
200 void update_search_markers();
201 void update_search_types_label();
202 void set_search_mode(
bool enabled,
bool focus =
true);
203 std::map<ObjectType, Gtk::CheckButton *> search_check_buttons;
205 class LogWindow *log_window =
nullptr;
206 std::set<SelectableRef> selection_for_drag_move;
207 Coordf cursor_pos_drag_begin;
208 Coordi cursor_pos_grid_drag_begin;
210 std::map<std::pair<ActionID, ToolID>,
bool> action_sensitivity;
211 type_signal_action_sensitive s_signal_action_sensitive;
213 GdkModifierType grid_fine_modifier = GDK_MOD1_MASK;
215 bool property_panel_has_focus();
217 sigc::connection initial_view_all_conn;
219 bool sockets_broken =
false;
220 void show_sockets_broken_dialog(
const std::string &msg =
"");
221 bool needs_autosave =
false;
222 bool queue_autosave =
false;