33 enum class SelectionMode { HOVER, NORMAL };
34 void set_selection_mode(SelectionMode mode);
35 SelectionMode get_selection_mode()
const;
36 typedef sigc::signal<void, SelectionMode> type_signal_selection_mode_changed;
37 type_signal_selection_mode_changed signal_selection_mode_changed()
39 return s_signal_selection_mode_changed;
42 enum class SelectionTool { BOX, LASSO, PAINT };
43 SelectionTool selection_tool = SelectionTool::BOX;
45 enum class SelectionQualifier { INCLUDE_ORIGIN, INCLUDE_BOX, TOUCH_BOX, AUTO };
46 SelectionQualifier selection_qualifier = SelectionQualifier::INCLUDE_ORIGIN;
48 enum class HighlightMode { HIGHLIGHT, DIM, SHADOW };
49 void set_highlight_mode(HighlightMode mode);
50 HighlightMode get_highlight_mode()
const;
51 void set_highlight_enabled(
bool x);
52 void set_highlight_on_top(
bool on_top);
54 enum class LayerMode { AS_IS, WORK_ONLY, SHADOW_OTHER };
55 void set_layer_mode(LayerMode mode);
57 std::set<SelectableRef> get_selection()
const;
58 void set_selection(
const std::set<SelectableRef> &sel,
bool emit =
true);
60 void set_cursor_pos(
const Coordi &c);
61 void set_cursor_external(
bool v);
62 Coordi get_cursor_pos()
const;
63 Coordf get_cursor_pos_win()
const;
64 Target get_current_target()
const;
65 void set_selection_allowed(
bool a);
66 std::pair<float, Coordf> get_scale_and_offset()
const;
67 void set_scale_and_offset(
float sc,
Coordf ofs);
68 Coordi snap_to_grid(
const Coordi &c,
unsigned int div = 1)
const;
70 void set_flip_view(
bool fl);
71 bool get_flip_view()
const override;
73 void set_view_angle(
float a);
74 float get_view_angle()
const override;
76 void set_cursor_size(
float size);
77 void set_cursor_size(Appearance::CursorSize);
79 void clear()
override;
81 typedef sigc::signal<void> type_signal_selection_changed;
82 type_signal_selection_changed signal_selection_changed()
84 return s_signal_selection_changed;
87 type_signal_selection_changed signal_hover_selection_changed()
89 return s_signal_hover_selection_changed;
92 typedef sigc::signal<void, const Coordi &> type_signal_cursor_moved;
93 type_signal_cursor_moved signal_cursor_moved()
95 return s_signal_cursor_moved;
98 typedef sigc::signal<void, unsigned int> type_signal_grid_mul_changed;
99 type_signal_grid_mul_changed signal_grid_mul_changed()
101 return s_signal_grid_mul_changed;
103 unsigned int get_grid_mul()
const
108 typedef sigc::signal<std::string, const SelectableRef &> type_signal_request_display_name;
109 type_signal_request_display_name signal_request_display_name()
111 return s_signal_request_display_name;
114 typedef sigc::signal<void, bool &> type_signal_can_steal_focus;
115 type_signal_can_steal_focus signal_can_steal_focus()
117 return s_signal_can_steal_focus;
120 typedef sigc::signal<void> type_signal_scale_changed;
121 type_signal_scale_changed signal_scale_changed()
123 return s_signal_scale_changed;
126 void center_and_zoom(
const Coordf ¢er,
float scale = -1);
128 void zoom_to_bbox(
const std::pair<Coordf, Coordf> &bb);
129 void ensure_min_size(
float w,
float h);
130 void zoom_to(
const Coordf &c,
float inc);
132 Glib::PropertyProxy<int> property_work_layer()
134 return p_property_work_layer.get_proxy();
136 Glib::PropertyProxy<float> property_layer_opacity()
138 return p_property_layer_opacity.get_proxy();
140 Glib::PropertyProxy_ReadOnly<float> property_layer_opacity()
const
142 return Glib::PropertyProxy_ReadOnly<float>(
this,
"layer-opacity");
145 void update_markers()
override;
147 std::set<SelectableRef> get_selection_at(
const Coordi &c)
const;
149 void update_cursor_pos(
double x,
double y);
153 const Color &get_color(ColorP colorp)
const;
155 bool touchpad_pan =
false;
157 bool smooth_zoom =
true;
158 bool snap_to_targets =
true;
160 float zoom_base = 1.5;
162 void inhibit_drag_selection();
164 int _animate_step(GdkFrameClock *frame_clock);
166 float get_width()
const
170 float get_height()
const
177 bool layer_is_annotation(
int l)
const;
179 std::set<SnapFilter> snap_filter;
181 void set_grid_spacing(uint64_t x, uint64_t y);
182 void set_grid_spacing(uint64_t s);
183 Coordi get_grid_spacing()
const;
184 void set_grid_origin(
const Coordi &c);
188 bool layer_is_visible(
int layer)
const;
189 bool layer_is_visible(
LayerRange layer)
const;
191 void set_colors2(
const std::vector<ColorI> &c);
193 int get_last_grid_div()
const;
195 void append_target(
const Target &target);
199 bool show_pictures =
true;
204 void push()
override;
205 void request_push()
override;
208 static const int MAT3_XX = 0;
209 static const int MAT3_X0 = 2;
210 static const int MAT3_YY = 4;
211 static const int MAT3_Y0 = 5;
213 float m_width, m_height;
218 glm::mat3 viewmat_noflip;
219 bool flip_view =
false;
220 float view_angle = 0;
221 void update_viewmat();
226 bool cursor_external =
false;
229 GLuint stencilrenderbuffer;
231 bool needs_resize =
false;
234 PF_TRIANGLES = (1 << 0),
235 PF_CURSOR = (1 << 1),
236 PF_SELECTABLES = (1 << 2),
237 PF_MARKER = (1 << 3),
238 PF_DRAG_SELECTION = (1 << 4),
241 PushFilter push_filter = PF_ALL;
242 void request_push(PushFilter filter);
244 void resize_buffers();
255 enum class ZoomTo { CURSOR, CENTER };
257 void pan_drag_begin(GdkEventButton *button_event);
258 void pan_drag_end(GdkEventButton *button_event);
259 void pan_drag_move(GdkEventMotion *motion_event);
260 void pan_drag_move(GdkEventScroll *scroll_event, ScrollDirection scroll_direction);
261 void pan_zoom(GdkEventScroll *scroll_event, ZoomTo zoom_to, ScrollDirection scroll_direction);
262 void start_smooth_zoom(
const Coordf &c,
float inc);
263 void cursor_move(GdkEvent *motion_event);
264 void hover_prelight_update(GdkEvent *motion_event);
265 bool pan_dragging =
false;
269 void set_scale(
float x,
float y,
float new_scale);
271 bool selection_allowed =
true;
272 Glib::Property<int> p_property_work_layer;
273 Glib::Property<float> p_property_layer_opacity;
275 Gtk::Menu *clarify_menu;
277 HighlightMode highlight_mode = HighlightMode::HIGHLIGHT;
278 bool highlight_enabled =
false;
279 bool highlight_on_top =
false;
282 LayerMode layer_mode = LayerMode::AS_IS;
284 bool drag_selection_inhibited =
false;
287 float zoom_animation_scale_orig = 1;
288 Coordf zoom_animation_pos;
290 Gdk::ModifierType grid_fine_modifier = Gdk::MOD1_MASK;
291 float cursor_size = 20;
293 static const int first_annotation_layer = 20000;
294 int annotation_layer_current = first_annotation_layer;
295 std::map<int, CanvasAnnotation> annotations;
297 void draw_bitmap_text(
const Coordf &p,
float scale,
const std::string &rtext,
int angle, ColorP color,
299 std::pair<Coordf, Coordf> measure_bitmap_text(
const std::string &text)
const override;
300 void draw_bitmap_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
301 int layer, TextBoxMode mode)
override;
303 SelectionMode selection_mode = SelectionMode::HOVER;
305 Glib::RefPtr<Gtk::GestureZoom> gesture_zoom;
306 void zoom_gesture_begin_cb(GdkEventSequence *seq);
307 void zoom_gesture_update_cb(GdkEventSequence *seq);
310 float gesture_zoom_scale_orig = 1;
312 Glib::RefPtr<Gtk::GestureDrag> gesture_drag;
315 void drag_gesture_begin_cb(GdkEventSequence *seq);
316 void drag_gesture_update_cb(GdkEventSequence *seq);
318 bool can_snap_to_target(
const Target &t)
const;
320 std::vector<ColorI> colors2;
322 bool can_set_scale()
const;
324 int last_grid_div = 1;
327 void on_size_allocate(Gtk::Allocation &alloc)
override;
328 void on_realize()
override;
329 bool on_render(
const Glib::RefPtr<Gdk::GLContext> &context)
override;
330 bool on_button_press_event(GdkEventButton *button_event)
override;
331 bool on_button_release_event(GdkEventButton *button_event)
override;
332 bool on_motion_notify_event(GdkEventMotion *motion_event)
override;
333 bool on_scroll_event(GdkEventScroll *scroll_event)
override;
334 Glib::RefPtr<Gdk::GLContext> on_create_context()
override;
336 type_signal_selection_changed s_signal_selection_changed;
337 type_signal_selection_changed s_signal_hover_selection_changed;
338 type_signal_selection_mode_changed s_signal_selection_mode_changed;
339 type_signal_cursor_moved s_signal_cursor_moved;
340 type_signal_grid_mul_changed s_signal_grid_mul_changed;
341 type_signal_request_display_name s_signal_request_display_name;
342 type_signal_can_steal_focus s_signal_can_steal_focus;
343 type_signal_scale_changed s_signal_scale_changed;