Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
desktop-widget.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Authors:
6 * Lauris Kaplinski <lauris@kaplinski.com>
7 * MenTaLguY <mental@rydia.net>
8 * bulia byak <buliabyak@users.sf.net>
9 * Ralf Stephan <ralf@ark.in-berlin.de>
10 * John Bintz <jcoswell@coswellproductions.org>
11 * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
12 * Jon A. Cruz <jon@joncruz.org>
13 * Abhishek Sharma
14 *
15 * Copyright (C) 2007 Johan Engelen
16 * Copyright (C) 2006 John Bintz
17 * Copyright (C) 2004 MenTaLguY
18 * Copyright (C) 1999-2002 Lauris Kaplinski
19 * Copyright (C) 2000-2001 Ximian, Inc.
20 *
21 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
22 */
23
24#include "desktop-widget.h"
25
26#include <algorithm>
27#include <string>
28#include <2geom/rect.h>
29#include <glibmm/i18n.h>
30#include <glibmm/ustring.h>
31#include <gtkmm/adjustment.h>
32#include <gtkmm/checkbutton.h>
33#include <gtkmm/grid.h>
34#include <gtkmm/label.h>
35#include <gtkmm/messagedialog.h>
36#include <gtkmm/paned.h>
37#include <gtkmm/widget.h>
38
40#include "conn-avoid-ref.h"
41#include "helper/mathfns.h"
42#include "message-context.h"
43#include "ui/tools/tool-base.h"
44#include "desktop.h"
45#include "document.h"
46#include "document-undo.h"
47#include "enums.h"
48#include "inkscape.h"
49#include "inkscape-window.h"
50#include "object/sp-image.h"
51#include "object/sp-namedview.h"
55#include "ui/dialog-run.h"
56#include "ui/dialog/swatches.h"
57#include "ui/monitor.h" // Monitor aspect ratio
58#include "ui/shortcuts.h"
59#include "ui/themes.h"
63#include "ui/toolbar/toolbars.h"
65#include "ui/tools/tool-data.h"
66#include "ui/util.h"
68#include "ui/widget/canvas.h"
69#include "ui/widget/ink-ruler.h"
74#include "util/units.h"
76
82
83//---------------------------------------------------------------------
84/* SPDesktopWidget */
85
87 : Gtk::Box(Gtk::Orientation::VERTICAL)
88 , _window{inkscape_window}
89{
90 set_name("SPDesktopWidget");
91
92 auto prefs = Inkscape::Preferences::get();
93
94 /* Status bar */
95 _statusbar = Gtk::make_managed<Inkscape::UI::Widget::StatusBar>();
96 _statusbar->set_vexpand(false);
97 prepend(*_statusbar);
98
99 /* Swatch Bar */
100 _panels = Gtk::make_managed<Inkscape::UI::Dialog::SwatchesPanel>(true, "/embedded/swatches");
101 _panels->set_vexpand(false);
102 prepend(*_panels);
103
104 /* DesktopHBox (Vertical toolboxes, canvas) */
105 _hbox = Gtk::make_managed<Gtk::Box>();
106 _hbox->set_vexpand(true);
107 _hbox->set_name("DesktopHbox");
108
109 _tbbox = Gtk::make_managed<Gtk::Paned>(Gtk::Orientation::HORIZONTAL);
110 _tbbox->set_vexpand(true);
111 _tbbox->set_name("ToolboxCanvasPaned");
112 _hbox->append(*_tbbox);
113
114 prepend(*_hbox);
115
116 _top_toolbars = Gtk::make_managed<Gtk::Grid>();
117 _top_toolbars->set_name("TopToolbars");
118 prepend(*_top_toolbars);
119
120 /* Toolboxes */
121 tool_toolbars = std::make_unique<Inkscape::UI::Toolbar::Toolbars>();
122 _top_toolbars->attach(*tool_toolbars, 0, 1);
123
124 tool_toolbox = Gtk::make_managed<Inkscape::UI::Toolbar::ToolToolbar>(inkscape_window);
125 _tbbox->set_start_child(*tool_toolbox);
126 _tbbox->set_resize_start_child(false);
127 _tbbox->set_shrink_start_child(false);
128 auto adjust_pos = [=, this](){
129 int minimum_width, natural_width;
130 int ignore;
131 tool_toolbox->measure(Gtk::Orientation::HORIZONTAL, -1, minimum_width, natural_width, ignore, ignore);
132 if (minimum_width > 0) {
133 int pos = _tbbox->get_position();
134 int new_pos = pos + minimum_width / 2;
135 const auto max = 5; // max buttons in a row
136 new_pos = std::min(new_pos - new_pos % minimum_width, max * minimum_width);
137 if (pos != new_pos) _tbbox->set_position(new_pos);
138 }
139 };
140 _tbbox->property_position().signal_changed().connect([=](){ adjust_pos(); });
141
142 snap_toolbar = std::make_unique<Inkscape::UI::Toolbar::SnapToolbar>(_window);
143 _hbox->append(*snap_toolbar); // May be moved later.
144
145 _tb_snap_pos = prefs->createObserver("/toolbox/simplesnap", sigc::mem_fun(*this, &SPDesktopWidget::repack_snaptoolbar));
147
148 auto tbox_width = prefs->getEntry("/toolbox/tools/width");
149 if (tbox_width.isSet()) {
150 _tbbox->set_position(tbox_width.getIntLimited(32, 8, 500));
151 }
152
153 auto set_toolbar_prefs = [=, this]() {
156 int s = prefs->getIntLimited(Inkscape::UI::Toolbar::tools_icon_size, min, min, max);
158 adjust_pos();
159 };
160
161 // watch for changes
162 _tb_icon_sizes1 = prefs->createObserver(Inkscape::UI::Toolbar::tools_icon_size, [=]() { set_toolbar_prefs(); });
164
165 // restore preferences
166 set_toolbar_prefs();
167
168 /* Canvas Grid (canvas, rulers, scrollbars, etc.) */
169 // DialogMultipaned owns it
170 auto cg = std::make_unique<Inkscape::UI::Widget::CanvasGrid>(this);
171 _canvas_grid = cg.get();
172
173 /* Canvas */
174 _ds_sticky_zoom = prefs->createObserver("/options/stickyzoom/value", [this]() { sticky_zoom_updated(); });
176
177 /* Dialog Container */
178 _container = std::make_unique<DialogContainer>(inkscape_window);
179 _columns = _container->get_columns();
180 _tbbox->set_end_child(*_container);
181 _tbbox->set_resize_end_child(true);
182 _tbbox->set_shrink_end_child(true);
183
184 // separator widget in tbox
185 auto& tbox_separator = *_tbbox->get_children().at(1);
186 tbox_separator.set_name("TBoxCanvasSeparator");
187
188 _canvas_grid->set_hexpand(true);
189 _canvas_grid->set_vexpand(true);
190 _columns->append(std::move(cg));
191
192 // ------------------ Finish Up -------------------- //
194
195 snap_toolbar->mode_update(); // Hide/show parts.
196
197 command_toolbar = std::make_unique<Inkscape::UI::Toolbar::CommandToolbar>();
198 _top_toolbars->attach(*command_toolbar, 0, 0);
199}
200
210
212{
213 auto const it = std::find(_desktops.begin(), _desktops.end(), desktop);
214 assert(it != _desktops.end());
215
216 auto tabs = _canvas_grid->getTabsWidget();
217
218 if (desktop == _desktop) {
219 if (_desktops.size() > 1) {
220 auto oldpos = tabs->positionOfTab(_desktop);
221 auto newpos = oldpos == _desktops.size() - 1 ? oldpos - 1 : oldpos + 1;
222 switchDesktop(tabs->tabAtPosition(newpos));
223 } else {
224 switchDesktop(nullptr);
225 }
226 }
227
228 tabs->removeTab(desktop);
230 _desktops.erase(it);
231 desktop->setDesktopWidget(nullptr);
232
233 if (_desktops.empty()) {
235 }
236}
237
239{
240 if (desktop == _desktop) {
241 return;
242 }
243
245 _canvas = _desktop ? _desktop->getCanvas() : nullptr;
246
248
249 if (_desktop) {
250 _canvas->grab_focus();
251
252 // Add the shape geometry to libavoid for autorouting connectors.
253 // This needs desktop set for its spacing preferences.
255 }
256
258
259 if (_desktop) {
260 auto set_tool = [this] {
261 tool_toolbars->setTool(_desktop->getTool());
263 };
264 _tool_changed_conn = _desktop->connectEventContextChanged([=] (auto, auto) { set_tool(); });
265 set_tool();
266 } else {
267 tool_toolbars->setTool(nullptr);
268 }
269
271
272 if (_desktop) {
274
275 _updateNamedview(); // sets _dt2r, required by updateRulers()
276
277 // Once desktop is set, we can update rulers
279
280 auto msgstack = _desktop->messageStack();
281 setMessage(msgstack->currentMessageType(), msgstack->currentMessage());
282
283 auto tabs = _canvas_grid->getTabsWidget();
284 tabs->switchTab(_desktop);
285
286 // Update window's current active tool, display mode, colour mode, cms mode
287 // Todo: These should really be tab- or canvas-level actions.
288 if (auto action = dynamic_cast<Gio::SimpleAction *>(_window->lookup_action("tool-switch").get())) {
289 action->set_state(Glib::Variant<Glib::ustring>::create(pref_path_to_tool_name(_desktop->getTool()->getPrefsPath().c_str())));
290 }
291 if (auto action = dynamic_cast<Gio::SimpleAction *>(_window->lookup_action("canvas-display-mode").get())) {
292 action->set_state(Glib::Variant<int>::create((int)_desktop->getCanvas()->get_render_mode()));
293 }
294 if (auto action = dynamic_cast<Gio::SimpleAction *>(_window->lookup_action("canvas-color-mode").get())) {
295 action->set_state(Glib::Variant<bool>::create(_desktop->getCanvas()->get_color_mode() == Inkscape::ColorMode::GRAYSCALE));
296 }
297 if (auto action = dynamic_cast<Gio::SimpleAction *>(_window->lookup_action("canvas-color-manage").get())) {
298 action->set_state(Glib::Variant<bool>::create(_desktop->getCanvas()->get_cms_active()));
299 }
300 }
301
303}
304
306{
307 auto tabs = _canvas_grid->getTabsWidget();
308 auto oldpos = tabs->positionOfTab(_desktop);
309 auto newpos = Util::safemod<int>(oldpos + by, _desktops.size());
310 switchDesktop(tabs->tabAtPosition(newpos));
311}
312
323
325{
326 _statusbar->set_message(type, message);
327}
328
334{
335 if (_tbbox) {
336 Inkscape::Preferences::get()->setInt("/toolbox/tools/width", _tbbox->get_position());
337 }
338
339 _panels->setDesktop(nullptr);
340
341 modified_connection.disconnect();
342 _desktops.clear();
343
344 _container.reset();
345
346 parent_type::on_unrealize();
347}
348
350
358{
359 if (_window) {
360 auto const doc = _desktop->doc();
361
362 std::string Name;
363 if (doc->isModifiedSinceSave()) {
364 Name += "*";
365 }
366
367 Name += doc->getDocumentName();
368
369 if (auto const v = _desktop->viewNumber(); v > 1) {
370 Name += ": ";
371 Name += std::to_string(v);
372 }
373 Name += " (";
374
375 auto const canvas = _desktop->getCanvas();
376 auto const render_mode = canvas->get_render_mode();
377 auto const color_mode = canvas->get_color_mode();
378
379 if (render_mode == Inkscape::RenderMode::OUTLINE) {
380 Name += N_("outline");
381 } else if (render_mode == Inkscape::RenderMode::NO_FILTERS) {
382 Name += N_("no filters");
383 } else if (render_mode == Inkscape::RenderMode::VISIBLE_HAIRLINES) {
384 Name += N_("enhance thin lines");
385 } else if (render_mode == Inkscape::RenderMode::OUTLINE_OVERLAY) {
386 Name += N_("outline overlay");
387 }
388
389 if (color_mode != Inkscape::ColorMode::NORMAL &&
390 render_mode != Inkscape::RenderMode::NORMAL) {
391 Name += ", ";
392 }
393
394 if (color_mode == Inkscape::ColorMode::GRAYSCALE) {
395 Name += N_("grayscale");
396 } else if (color_mode == Inkscape::ColorMode::PRINT_COLORS_PREVIEW) {
397 Name += N_("print colors preview");
398 }
399
400 if (Name.back() == '(') {
401 Name.erase(Name.size() - 2);
402 } else {
403 Name += ")";
404 }
405
406 Name += " - Inkscape";
407
408 // Name += " (";
409 // Name += Inkscape::version_string;
410 // Name += ")";
411
412 _window->set_title(Name);
413 }
414}
415
420
421void SPDesktopWidget::showNotice(Glib::ustring const &msg, int timeout)
422{
424}
425
430{
431 parent_type::on_realize();
432
433 auto const dark = INKSCAPE.themecontext->isCurrentThemeDark(_window);
434 Preferences::get()->setBool("/theme/darkTheme", dark);
435 INKSCAPE.themecontext->getChangeThemeSignal().emit();
436 INKSCAPE.themecontext->add_gtk_css(true);
437}
438
446
454
456{
457 // Listen on namedview modification
458 modified_connection = _desktop->getNamedView()->connectModified([this] (auto, unsigned flags) {
459 if (flags & SP_OBJECT_MODIFIED_FLAG) {
460 _updateUnit();
461
462 // Update unit trackers in certain toolbars, to address https://bugs.launchpad.net/inkscape/+bug/362995.
464 }
465 });
466
467 _updateUnit();
468 _updateTitle();
469}
470
471void
476
477void
482
483void
488
490{
491 if (_window) {
492 return {_window->get_width(), _window->get_height()};
493 } else {
494 return {};
495 }
496}
497
499{
500 if (_window) {
501 _window->set_default_size(size.x(), size.y());
502 }
503}
504
511void SPDesktopWidget::setWindowTransient(Gtk::Window &window, int transient_policy)
512{
513 if (_window) {
514 window.set_transient_for(*_window);
515
516 /*
517 * This enables "aggressive" transientization,
518 * i.e. dialogs always emerging on top when you switch documents. Note
519 * however that this breaks "click to raise" policy of a window
520 * manager because the switched-to document will be raised at once
521 * (so that its transients also could raise)
522 */
523 if (transient_policy == PREFS_DIALOGS_WINDOWS_AGGRESSIVE) {
524 // Without this, a transient window doesn't always emerge on top.
525 _window->present();
526 }
527 }
528}
529
531{
532 if (_window) {
533 _window->present();
534 }
535}
536
537void SPDesktopWidget::showInfoDialog(Glib::ustring const &message)
538{
539 if (!_window) return;
540
541 Gtk::MessageDialog dialog{*_window, message, false, Gtk::MessageType::INFO, Gtk::ButtonsType::OK};
542 dialog.property_destroy_with_parent() = true;
543 dialog.set_name("InfoDialog");
544 dialog.set_title(_("Note:")); // probably want to take this as a parameter.
546}
547
548bool SPDesktopWidget::warnDialog (Glib::ustring const &text)
549{
550 Gtk::MessageDialog dialog{*_window, text, false, Gtk::MessageType::WARNING, Gtk::ButtonsType::OK_CANCEL};
551 auto const response = Inkscape::UI::dialog_run(dialog);
552 return response == Gtk::ResponseType::OK;
553}
554
560{
561 Glib::ustring pref_root;
562 auto prefs = Inkscape::Preferences::get();
563
564 if (_desktop && _desktop->is_focusMode()) {
565 pref_root = "/focus/";
566 } else if (_desktop && _desktop->is_fullscreen()) {
567 pref_root = "/fullscreen/";
568 } else {
569 pref_root = "/window/";
570 }
571
572 command_toolbar->set_visible(prefs->getBool(pref_root + "commands/state", true));
573
574 snap_toolbar->set_visible(prefs->getBool(pref_root + "snaptoolbox/state", true));
575
576 tool_toolbars->set_visible(prefs->getBool(pref_root + "toppanel/state", true));
577
578 tool_toolbox->set_visible(prefs->getBool(pref_root + "toolbox/state", true));
579
580 _statusbar->set_visible(prefs->getBool(pref_root + "statusbar/state", true));
581 _statusbar->update_visibility(); // Individual items in bar
582
583 _panels->set_visible(prefs->getBool(pref_root + "panels/state", true));
584
585 _canvas_grid->ShowScrollbars(prefs->getBool(pref_root + "scrollbars/state", true));
586 _canvas_grid->ShowRulers( prefs->getBool(pref_root + "rulers/state", true));
587
588 // Move command toolbar as required.
589
590 // If interface_mode unset, use screen aspect ratio. Needs to be synced with "canvas-interface-mode" action.
591 Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_primary();
592 double const width = monitor_geometry.get_width();
593 double const height = monitor_geometry.get_height();
594 bool widescreen = (height > 0 && width/height > 1.65);
595 widescreen = prefs->getBool(pref_root + "interface_mode", widescreen);
596
597 // Unlink command toolbar.
599
600 // Link command toolbar back.
601 auto orientation_c = GTK_ORIENTATION_HORIZONTAL;
602 if (!widescreen) {
603 _top_toolbars->attach(*command_toolbar, 0, 0); // Always first in Grid
604 command_toolbar->set_hexpand(true);
605 orientation_c = GTK_ORIENTATION_HORIZONTAL;
606 } else {
607 _hbox->append(*command_toolbar);
608 orientation_c = GTK_ORIENTATION_VERTICAL;
609 command_toolbar->set_hexpand(false);
610 }
611 // Toolbar is actually child:
612 Inkscape::UI::for_each_child(*command_toolbar, [=, this](Gtk::Widget &widget) {
613 if (auto toolbar = dynamic_cast<Gtk::Box *>(&widget)) {
614 gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar->gobj()), orientation_c); // Missing in C++interface!
615 }
617 });
618
620}
621
622Gtk::Widget *SPDesktopWidget::get_toolbar_by_name(const Glib::ustring &name)
623{
624 auto const widget = Inkscape::UI::find_widget_by_name(*tool_toolbars, name, false);
625
626 if (!widget) {
627 std::cerr << "SPDesktopWidget::get_toolbar_by_name: failed to find: " << name << std::endl;
628 }
629
630 return widget;
631}
632
633void
635{
636 // Look for a named widget
638 if (hb) {
639 hb->grab_focus();
640 }
641}
642
643void
644SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value)
645{
646 // Look for a named widget
648 if (hb) {
649 auto sb = dynamic_cast<Inkscape::UI::Widget::SpinButton *>(hb);
650 auto a = sb->get_adjustment();
651
652 if(a) a->set_value(value);
653 } else {
654 g_warning ("Could not find GtkAdjustment for %s\n", id);
655 }
656}
657
658bool
659SPDesktopWidget::isToolboxButtonActive(char const * const id) const
660{
661 auto const widget = const_cast<Gtk::Widget const *>(
663
664 if (!widget) {
665 //g_message( "Unable to locate item for {%s}", id );
666 return false;
667 }
668
669 if (auto const button = dynamic_cast<Gtk::ToggleButton const *>(widget)) {
670 return button->get_active();
671 }
672
673 //g_message( "Item for {%s} is of an unsupported type", id );
674 return false;
675}
676
682{
683 auto prefs = Inkscape::Preferences::get();
684 bool is_perm = prefs->getInt("/toolbox/simplesnap", 1) == 2;
685 auto &aux = *tool_toolbars;
686 auto &snap = *snap_toolbar;
687
688 // Only remove from the parent if the status has changed
689 auto parent = snap.get_parent();
690 if (parent && ((is_perm && parent != _hbox) || (!is_perm && parent != _top_toolbars))) {
692 }
693
694 // Only repack if there's no parent widget now.
695 if (!snap.get_parent()) {
696 if (is_perm) {
697 _hbox->append(snap);
698 } else {
699 _top_toolbars->attach(snap, 1, 0, 1, 2);
700 }
701 }
702
703 // Always reset the various constraints, even if not repacked.
704 if (is_perm) {
705 snap.set_valign(Gtk::Align::START);
706 return;
707 }
708
709 // This ensures that the Snap toolbox is on the top and only takes the needed space.
710 _top_toolbars->remove(aux);
711 _top_toolbars->remove(snap);
712 if (Inkscape::UI::get_children(*_top_toolbars).size() == 3 && command_toolbar->get_visible()) {
713 _top_toolbars->attach(aux, 0, 1, 2, 1);
714 _top_toolbars->attach(snap, 1, 0, 1, 2);
715 snap.set_valign(Gtk::Align::START);
716 } else {
717 _top_toolbars->attach(aux, 0, 1, 1, 1);
718 _top_toolbars->attach(snap, 1, 0, 2, 2);
719 snap.set_valign(Gtk::Align::CENTER);
720 }
721}
722
724{
725 auto const unit = _desktop->getNamedView()->getDisplayUnit();
726
727 _dt2r = 1.0 / unit->factor;
728
731 _canvas_grid->GetVRuler()->set_tooltip_text(gettext(unit->name_plural.c_str()));
732 _canvas_grid->GetHRuler()->set_tooltip_text(gettext(unit->name_plural.c_str()));
734}
735
736// We make the desktop window with focus active. Signal is connected in inkscape-window.cpp
737void SPDesktopWidget::onFocus(bool const has_focus)
738{
739 if (!has_focus) return;
740
742 if (prefs->getBool("/options/bitmapautoreload/value", true)) {
743 auto const &imageList = _desktop->doc()->getResourceList("image");
744 for (auto it : imageList) {
745 auto image = cast<SPImage>(it);
746 image->refresh_if_outdated();
747 }
748 }
749}
750
751// ------------------------ Zoom ------------------------
752
753void
755{
757 prefs->setBool("/options/stickyzoom/value", _canvas_grid->GetStickyZoom()->get_active());
758}
759
760void
762{
764 _canvas_grid->GetStickyZoom()->set_active(prefs->getBool("/options/stickyzoom/value", false));
765}
766
767void
772
773// ---------------------- Rotation ------------------------
774
775void
780
781// --------------- Rulers/Scrollbars/Etc. -----------------
782
783void
785 // TODO: Turn into action and remove this function.
787}
788
789void
791{
792 // TODO: Turn into action and remove this function.
794}
795
796void
798{
799 // TODO: Turn into action and remove this function.
801}
802
804 return _window;
805}
806
808{
809 g_assert(_top_toolbars);
810 g_assert(_hbox );
811
812 auto const parent = widget.get_parent();
813 if (!parent) return;
814
815 if (parent == _top_toolbars) {
816 _top_toolbars->remove(widget);
817 } else if (parent == _hbox) {
818 _hbox->remove(widget);
819 } else {
820 g_critical("SPDesktopWidget::remove_from_top_toolbar_or_hbox(): unexpected parent!");
821 }
822}
823
824/*
825 Local Variables:
826 mode:c++
827 c-file-style:"stroustrup"
828 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
829 indent-tabs-mode:nil
830 fill-column:99
831 End:
832*/
833// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
Rewrite of code originally in desktop-widget.cpp.
Inkscape canvas widget.
Two-dimensional point with integer coordinates.
Definition int-point.h:57
constexpr IntCoord x() const noexcept
Definition int-point.h:77
constexpr IntCoord y() const noexcept
Definition int-point.h:79
Two-dimensional point that doubles as a vector.
Definition point.h:66
void windowClose(InkscapeWindow *window)
static InkscapeApplication * instance()
Singleton instance.
void setActiveTab(SPDesktop *desktop)
Preference storage class.
Definition preferences.h:66
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
void setInt(Glib::ustring const &pref_path, int value)
Set an integer value.
void setBool(Glib::ustring const &pref_path, bool value)
Set a Boolean value.
void setDesktop(SPDesktop *new_desktop)
Called when the desktop might have changed for this dialog.
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned contain...
void get_children()=delete
We manage our own child list. Call get_multipaned_children()
void append(std::unique_ptr< Gtk::Widget > child)
DialogWindow holds DialogContainer instances for undocked dialogs.
std::string const & getPrefsPath() const
Definition tool-base.h:120
void ShowRulers(bool state=true)
Gtk::CheckButton * GetStickyZoom()
void ShowScrollbars(bool state=true)
Inkscape::UI::Widget::Ruler * GetVRuler()
Definition canvas-grid.h:99
void showNotice(Glib::ustring const &msg, int timeout=0)
Inkscape::UI::Widget::Ruler * GetHRuler()
Definition canvas-grid.h:98
void ShowCommandPalette(bool state=true)
Inkscape::UI::Widget::TabsWidget * getTabsWidget()
Inkscape::RenderMode get_render_mode() const
Definition canvas.h:98
bool get_cms_active() const
Definition canvas.h:106
Inkscape::ColorMode get_color_mode() const
Definition canvas.h:99
void set_unit(Inkscape::Util::Unit const *unit)
Definition ink-ruler.cpp:79
SpinButton widget, that allows entry of simple math expressions (also units, when linked with UnitMen...
Definition spinbutton.h:52
void set_desktop(SPDesktop *desktop)
void set_coordinate(const Geom::Point &p)
void set_message(const Inkscape::MessageType type, const char *message)
void addTab(SPDesktop *desktop, int pos=-1)
int positionOfTab(SPDesktop *desktop) const
void switchTab(SPDesktop *desktop)
void refreshTitle(SPDesktop *desktop)
bool warnDialog(Glib::ustring const &text)
Gtk::Widget * get_toolbar_by_name(const Glib::ustring &name)
SPDesktopWidget(InkscapeWindow *inkscape_window)
std::unique_ptr< Inkscape::UI::Toolbar::Toolbars > tool_toolbars
sigc::scoped_connection _tool_changed_conn
~SPDesktopWidget() override
Inkscape::PrefObserver _ds_sticky_zoom
void setToolboxAdjustmentValue(char const *id, double value)
Inkscape::PrefObserver _tb_icon_sizes2
bool isToolboxButtonActive(char const *id) const
void _updateTitle()
Set the title in the desktop-window (if desktop has an own window).
Inkscape::PrefObserver _tb_snap_pos
void setWindowTransient(Gtk::Window &window, int transient_policy)
std::unique_ptr< Inkscape::UI::Dialog::DialogContainer > _container
void remove_from_top_toolbar_or_hbox(Gtk::Widget &widget)
void onFocus(bool has_focus)
void desktopChangedDocument(SPDesktop *desktop)
InkscapeWindow * _window
void showNotice(Glib::ustring const &msg, int timeout=0)
Inkscape::PrefObserver _tb_icon_sizes1
Gtk::Grid * _top_toolbars
Inkscape::UI::Toolbar::ToolToolbar * tool_toolbox
Gtk::Paned * _tbbox
void layoutWidgets()
Hide whatever the user does not want to see in the window.
std::unique_ptr< Inkscape::UI::Toolbar::CommandToolbar > command_toolbar
Inkscape::UI::Widget::Canvas * _canvas
void advanceTab(int by)
sigc::scoped_connection modified_connection
void repack_snaptoolbar()
Choose where to pack the snap toolbar.
Inkscape::UI::Dialog::DialogContainer * getDialogContainer()
void setCoordinateStatus(Geom::Point p)
Inkscape::UI::Dialog::DialogMultipaned * _columns
void removeDesktop(SPDesktop *desktop)
void showInfoDialog(Glib::ustring const &message)
void setWindowSize(Geom::IntPoint const &size)
void setMessage(Inkscape::MessageType type, char const *message)
void setToolboxFocusTo(char const *)
std::vector< SPDesktop * > _desktops
Gio::ActionMap * get_action_map()
void on_unrealize() override
Called before SPDesktopWidget destruction.
Inkscape::UI::Widget::StatusBar * _statusbar
void switchDesktop(SPDesktop *desktop)
SPDesktop * _desktop
Geom::IntPoint getWindowSize() const
void desktopChangedTitle(SPDesktop *desktop)
Inkscape::UI::Dialog::SwatchesPanel * _panels
std::unique_ptr< Inkscape::UI::Toolbar::SnapToolbar > snap_toolbar
void addDesktop(SPDesktop *desktop, int pos=-1)
void on_realize() override
Callback to realize desktop widget.
Inkscape::UI::Widget::CanvasGrid * _canvas_grid
A grid to display the canvas, rulers, and scrollbars.
To do: update description of desktop.
Definition desktop.h:149
Inkscape::UI::Widget::Canvas * getCanvas() const
Definition desktop.h:190
Inkscape::MessageStack * messageStack() const
Definition desktop.h:160
bool is_fullscreen() const
Definition desktop.cpp:929
SPNamedView * getNamedView() const
Definition desktop.h:191
Inkscape::UI::Tools::ToolBase * getTool() const
Definition desktop.h:187
SPDocument * doc() const
Definition desktop.h:159
void setDesktopWidget(SPDesktopWidget *dtw)
Definition desktop.cpp:208
int viewNumber() const
Definition desktop.h:194
bool is_focusMode() const
Checks to see if the user is working in focused mode.
Definition desktop.cpp:939
sigc::connection connectEventContextChanged(F &&slot)
Definition desktop.h:261
char const * getDocumentName() const
basename or other human-readable label for the document.
Definition document.h:236
std::vector< SPObject * > const getResourceList(char const *key)
Inkscape::Util::Unit const * getDisplayUnit() const
Returns namedview's default unit.
sigc::connection connectModified(sigc::slot< void(SPObject *, unsigned int)> slot)
Connects to the modification notification signal.
Definition sp-object.h:705
Toolbar for Commands.
void init_avoided_shape_geometry(SPDesktop *desktop)
A class for handling shape interaction with libavoid.
sigc::scoped_connection timeout
Glib::ustring msg
Geom::IntPoint size
A class to hold:
Editable view implementation.
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned.
A widget with multiple panes.
A window for floating docks.
static char const *const parent
Definition dir-util.cpp:70
TODO: insert short description here.
@ PREFS_DIALOGS_WINDOWS_AGGRESSIVE
Definition enums.h:143
std::unique_ptr< Magick::Image > image
Inkscape - An SVG editor.
Glib::ustring label
Interface for locally managing a current status message.
helper functions for retrieving monitor geometry, etc.
Definition desktop.h:50
static constexpr const int min_pixel_size
static constexpr const char * tools_icon_size
static constexpr const char * ctrlbars_icon_size
static constexpr const int max_pixel_size
void set_icon_sizes(Gtk::Widget *parent, int pixel_size)
Recursively set all the icon sizes inside this parent widget.
Definition util.cpp:113
Gtk::Widget * find_widget_by_name(Gtk::Widget &parent, Glib::ustring const &name, bool visible_only)
Returns a named descendent of parent, which has the given name, or nullptr if there's none.
Definition util.cpp:184
std::vector< Gtk::Widget * > get_children(Gtk::Widget &widget)
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling().
Definition util.cpp:156
Gtk::Widget * for_each_child(Gtk::Widget &widget, Func &&func, bool const plus_self=false, bool const recurse=false, int const level=0)
Call Func with a reference to each child of parent, until it returns _break.
Definition util.h:103
int dialog_run(Gtk::Dialog &dialog)
This is a GTK4 porting aid meant to replace the removal of the Gtk::Dialog synchronous API.
Gdk::Rectangle get_monitor_geometry_primary()
get monitor geometry of primary monitor
Definition monitor.cpp:61
MessageType
A hint about the meaning of a message; is it an ordinary message, a message advising the user of some...
Definition message.h:25
Axis-aligned rectangle.
SVG <image> implementation.
Color swatches dialog.
SPDesktop * desktop
Inkscape document tabs bar.
double height
double width
Gtk <themes> helper code.
Glib::ustring const & pref_path_to_tool_name(Glib::UStringView pref_path)
Definition tool-data.cpp:77
Glib::ustring name
Definition toolbars.cpp:55
A container for toolbars, displaying one toolbar at a time.
TODO: insert short description here.