Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
layer-properties.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Author:
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 *
8 * Copyright (C) 2004 Bryce Harrington
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#ifndef INKSCAPE_DIALOG_LAYER_PROPERTIES_H
14#define INKSCAPE_DIALOG_LAYER_PROPERTIES_H
15
16#include <gtkmm/box.h>
17#include <gtkmm/checkbutton.h>
18#include <gtkmm/entry.h>
19#include <gtkmm/gesture.h> // Gtk::EventSequenceState
20#include <gtkmm/grid.h>
21#include <gtkmm/label.h>
22#include <gtkmm/scrolledwindow.h>
23#include <gtkmm/treestore.h>
24#include <gtkmm/treeview.h>
25#include <gtkmm/window.h>
26
27#include "layer-manager.h"
28
29namespace Gtk {
30class EventControllerKey;
31class GestureClick;
32}
33
34class SPDesktop;
35
36namespace Inkscape::UI::Dialog {
37
38/* FIXME: split the LayerPropertiesDialog class into three separate dialogs */
40{
41 NONE,
42 CREATE,
43 MOVE,
44 RENAME
45};
46
47class LayerPropertiesDialog final : public Gtk::Window
48{
49public:
59
60private:
62 ~LayerPropertiesDialog() override;
63
65 SPDesktop *_desktop = nullptr;
66 SPObject *_layer = nullptr;
67
68 struct PositionDropdownColumns : Gtk::TreeModel::ColumnRecord
69 {
70 Gtk::TreeModelColumn<LayerRelativePosition> position;
71 Gtk::TreeModelColumn<Glib::ustring> name;
72
74 {
75 add(position);
76 add(name);
77 }
78 };
79
83 Gtk::CheckButton _layer_position_radio[3];
84 Gtk::Grid _layout_table;
85
86 bool _position_visible = false;
87
88 struct ModelColumns : Gtk::TreeModel::ColumnRecord
89 {
90 Gtk::TreeModelColumn<SPObject *> object;
91 Gtk::TreeModelColumn<Glib::ustring> label;
92 Gtk::TreeModelColumn<bool> visible;
93 Gtk::TreeModelColumn<bool> locked;
94
96 {
97 add(object);
98 add(visible);
99 add(locked);
100 add(label);
101 }
102 };
103
104 Gtk::Box _mainbox;
105 Gtk::Box _buttonbox;
106
107 Gtk::TreeView _tree;
109 Glib::RefPtr<Gtk::TreeStore> _store;
110 Gtk::ScrolledWindow _scroller;
111
113 Gtk::CellRendererText _label_renderer;
114
115 Gtk::Button _close_button;
116 Gtk::Button _apply_button;
117
119 void _setLayer(SPObject *layer);
120
122 void _apply();
123
126 void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &iter);
127
128 void _addLayer(SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level);
130
131 bool on_key_pressed(Gtk::EventControllerKey const &controller,
132 unsigned keyval, unsigned keycode,
133 Gdk::ModifierType state);
134 Gtk::EventSequenceState on_click_pressed(int n_press, double x, double y);
135
136 void _doCreate();
137 void _doMove();
138 void _doRename();
139 void _setup();
140};
141
142} // namespace Inkscape::UI::Dialog
143
144#endif // INKSCAPE_DIALOG_LAYER_PROPERTIES_H
145
146/*
147 Local Variables:
148 mode:c++
149 c-file-style:"stroustrup"
150 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
151 indent-tabs-mode:nil
152 fill-column:99
153 End:
154*/
155// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
static void showMove(SPDesktop *desktop, SPObject *layer)
Gtk::EventSequenceState on_click_pressed(int n_press, double x, double y)
void _doCreate()
Creates a new layer based on the input entered in the dialog window.
void _doRename()
Renames a layer based on the user input in the dialog window.
static void showCreate(SPDesktop *desktop, SPObject *layer)
static void showRename(SPDesktop *desktop, SPObject *layer)
static void _showDialog(LayerPropertiesDialogType type, SPDesktop *desktop, SPObject *layer)
Static member function which displays a modal dialog of the given type.
void _setup_layers_controls()
Sets up the tree view of current layers.
bool on_key_pressed(Gtk::EventControllerKey const &controller, unsigned keyval, unsigned keycode, Gdk::ModifierType state)
void _setup_position_controls()
Sets up the combo box for choosing the relative position of the new layer.
void _setup()
Sets up the dialog depending on its type.
void _doMove()
Moves selection to the chosen layer.
void _apply()
Performs an action depending on the type of the dialog.
void _addLayer(SPObject *layer, Gtk::TreeModel::Row *parentRow, SPObject *target, int level)
Inserts the new layer into the document.
void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &iter)
Formats the label for a given layer row.
To do: update description of desktop.
Definition desktop.h:149
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
Definition desktop.h:50
Dialog code.
Definition desktop.h:117
SPDesktop * desktop