Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
desktop-widget.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
17/* Authors:
18 * Lauris Kaplinski <lauris@kaplinski.com>
19 * MenTaLguY <mental@rydia.net>
20 * bulia byak <buliabyak@users.sf.net>
21 * Ralf Stephan <ralf@ark.in-berlin.de>
22 * John Bintz <jcoswell@coswellproductions.org>
23 * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
24 * Jon A. Cruz <jon@joncruz.org>
25 * Abhishek Sharma
26 *
27 * Copyright (C) 2007 Johan Engelen
28 * Copyright (C) 2006 John Bintz
29 * Copyright (C) 2004 MenTaLguY
30 * Copyright (C) 1999-2002 Lauris Kaplinski
31 * Copyright (C) 2000-2001 Ximian, Inc.
32 *
33 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
34 */
35
36#ifndef SEEN_SP_DESKTOP_WIDGET_H
37#define SEEN_SP_DESKTOP_WIDGET_H
38
39#include "message.h"
40#include "preferences.h"
41
42namespace Glib {
43class ustring;
44} // namespace Glib
45
46namespace Gio {
47class ActionMap;
48} // namespace Gio
49
50namespace Gtk {
51class Grid;
52class Paned;
53class Toolbar;
54class Widget;
55} // namespace Gtk
56
57class InkscapeWindow;
58class SPDocument;
59class SPDesktop;
60class SPObject;
61
62namespace Inkscape::UI {
63
64namespace Dialog {
65class DialogContainer;
66class DialogMultipaned;
67class SwatchesPanel;
68} // namespace Dialog
69
70namespace Toolbar {
71class Toolbars;
72class CommandToolbar;
73class SnapToolbar;
74class ToolToolbar;
75} // namespace Toolbars
76
77namespace Widget {
78class Button;
79class Canvas;
80class CanvasGrid;
81class SpinButton;
82class StatusBar;
83} // namespace Widget
84
85} // namespace Inkscape::UI
86
88class SPDesktopWidget : public Gtk::Box
89{
90 using parent_type = Gtk::Box;
91
92public:
93 SPDesktopWidget(InkscapeWindow *inkscape_window);
94 ~SPDesktopWidget() override;
95
98 std::vector<SPDesktop *> const &get_desktops() const { return _desktops; }
100 InkscapeWindow const *get_window() const { return _window; }
102 double get_dt2r() const { return _dt2r; }
103
104 Gio::ActionMap *get_action_map();
105
106 void on_realize() override;
107 void on_unrealize() override;
108
109 void addDesktop(SPDesktop *desktop, int pos = -1);
112
113 void advanceTab(int by);
114
115private:
116 sigc::scoped_connection modified_connection;
117
118 std::vector<SPDesktop *> _desktops;
119 SPDesktop *_desktop = nullptr;
120
122
123 Gtk::Paned *_tbbox = nullptr;
124 Gtk::Box *_hbox = nullptr;
125 std::unique_ptr<Inkscape::UI::Dialog::DialogContainer> _container;
127 Gtk::Grid* _top_toolbars = nullptr;
128
131
134
135 double _dt2r;
137
138 sigc::scoped_connection _tool_changed_conn;
139
140public:
141 void setMessage(Inkscape::MessageType type, char const *message);
143 void letRotateGrabFocus();
144 void letZoomGrabFocus();
146 void setWindowSize(Geom::IntPoint const &size);
147 void setWindowTransient(Gtk::Window &window, int transient_policy);
148 void presentWindow();
149 void showInfoDialog(Glib::ustring const &message);
150 bool warnDialog (Glib::ustring const &text);
151 Gtk::Widget *get_toolbar_by_name(const Glib::ustring &name);
152 void setToolboxFocusTo(char const *);
153 void setToolboxAdjustmentValue(char const *id, double value);
154 bool isToolboxButtonActive(char const *id) const;
156 void onFocus(bool has_focus);
158 void showNotice(Glib::ustring const &msg, int timeout = 0);
159
162
163 // Canvas Grid Widget
164 void update_zoom();
165 void update_rotation();
166 void repack_snaptoolbar();
167
168 void layoutWidgets();
169 void toggle_scrollbars();
171 void toggle_rulers();
172 void sticky_zoom_toggled();
173 void sticky_zoom_updated();
174
175private:
177 std::unique_ptr<Inkscape::UI::Toolbar::Toolbars> tool_toolbars;
178 std::unique_ptr<Inkscape::UI::Toolbar::CommandToolbar> command_toolbar;
179 std::unique_ptr<Inkscape::UI::Toolbar::SnapToolbar> snap_toolbar;
185
186 void _updateUnit();
187 void _updateNamedview();
188 void _updateTitle();
190 void remove_from_top_toolbar_or_hbox(Gtk::Widget &widget);
191};
192
193#endif /* !SEEN_SP_DESKTOP_WIDGET_H */
194
195/*
196 Local Variables:
197 mode:c++
198 c-file-style:"stroustrup"
199 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
200 indent-tabs-mode:nil
201 fill-column:99
202 End:
203*/
204// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
Two-dimensional point with integer coordinates.
Definition int-point.h:57
Two-dimensional point that doubles as a vector.
Definition point.h:66
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned contain...
A dialog that displays paint swatches.
Definition swatches.h:58
A Gtk::Grid widget that contains rulers, scrollbars, buttons, and, of course, the canvas.
Definition canvas-grid.h:66
A widget for Inkscape's canvas.
Definition canvas.h:56
A GtkBox on an SPDesktop.
bool warnDialog(Glib::ustring const &text)
Gtk::Widget * get_toolbar_by_name(const Glib::ustring &name)
std::unique_ptr< Inkscape::UI::Toolbar::Toolbars > tool_toolbars
sigc::scoped_connection _tool_changed_conn
std::vector< SPDesktop * > const & get_desktops() const
~SPDesktopWidget() override
Inkscape::PrefObserver _ds_sticky_zoom
InkscapeWindow const * get_window() const
void setToolboxAdjustmentValue(char const *id, double value)
Inkscape::UI::Widget::Canvas * get_canvas()
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).
double get_dt2r() const
InkscapeWindow * get_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
Inkscape::UI::Widget::CanvasGrid * get_canvas_grid()
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 *)
void viewSetPosition(Geom::Point p)
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
SPDesktop * get_desktop()
Inkscape::PrefObserver _tb_visible_buttons
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
Typed SVG document implementation.
Definition document.h:101
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
sigc::scoped_connection timeout
Glib::ustring msg
Geom::IntPoint size
Definition desktop.h:50
User interface code.
Definition desktop.h:113
std::unique_ptr< Preferences::PreferencesObserver > PrefObserver
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
Singleton class to access the preferences file in a convenient way.
SPDesktop * desktop
Glib::ustring name
Definition toolbars.cpp:55