Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
tile.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * A simple dialog for creating grid type arrangements of selected objects
4 *
5 * Authors:
6 * Bob Jamison ( based off trace dialog)
7 * John Cliff
8 * Other dudes from The Inkscape Organization
9 * Abhishek Sharma
10 * Declara Denis
11 *
12 * Copyright (C) 2004 Bob Jamison
13 * Copyright (C) 2004 John Cliff
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17
18#include "tile.h"
19
20#include <glibmm/i18n.h>
21#include <gtkmm/image.h>
22#include <gtkmm/notebook.h>
23
27#include "ui/icon-names.h"
28#include "ui/pack.h"
29
30namespace Inkscape::UI::Dialog {
31
32Gtk::Box& create_tab_label(const char* label_text, const char* icon_name) {
33 auto const box = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 4);
34 auto const image = Gtk::make_managed<Gtk::Image>();
35 image->set_from_icon_name(icon_name);
36 auto const label = Gtk::make_managed<Gtk::Label>(label_text, true);
37 UI::pack_start(*box, *image, false, true);
38 UI::pack_start(*box, *label, false, true);
39 return *box;
40}
41
43 : DialogBase("/dialogs/gridtiler", "AlignDistribute")
44{
45 _align_tab = Gtk::make_managed<AlignAndDistribute>(this);
46 _arrangeBox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL);
47 _arrangeBox->set_valign(Gtk::Align::START);
48 _notebook = Gtk::make_managed<Gtk::Notebook>();
49 _gridArrangeTab = Gtk::make_managed<GridArrangeTab>(this);
50 _polarArrangeTab = Gtk::make_managed<PolarArrangeTab>(this);
51
52 set_valign(Gtk::Align::START);
53
54 _notebook->set_valign(Gtk::Align::START);
55 _notebook->append_page(*_align_tab, create_tab_label(C_("Arrange dialog", "Align"), INKSCAPE_ICON("dialog-align-and-distribute")));
56 // TRANSLATORS: "Grid" refers to grid (columns/rows) arrangement
57 _notebook->append_page(*_gridArrangeTab, create_tab_label(C_("Arrange dialog", "Grid"), INKSCAPE_ICON("arrange-grid")));
58 // TRANSLATORS: "Circular" refers to circular/radial arrangement
59 _notebook->append_page(*_polarArrangeTab, create_tab_label(C_("Arrange dialog", "Circular"), INKSCAPE_ICON("arrange-circular")));
61 _notebook->signal_switch_page().connect([this](Widget*, guint page){
63 });
65
66 // Add button
67 _arrangeButton = Gtk::make_managed<Gtk::Button>(C_("Arrange dialog", "_Arrange"));
68 _arrangeButton->signal_clicked().connect(sigc::mem_fun(*this, &ArrangeDialog::_apply));
69 _arrangeButton->set_use_underline(true);
70 _arrangeButton->set_tooltip_text(_("Arrange selected objects"));
71 _arrangeButton->add_css_class("wide-apply-button");
72 _arrangeButton->set_visible(false);
73
74 auto const button_box = Gtk::make_managed<Gtk::Box>();
75 button_box->set_halign(Gtk::Align::CENTER);
76 button_box->set_spacing(6);
77 button_box->set_margin(4);
78 UI::pack_end(*button_box, *_arrangeButton);
79 UI::pack_start(*this, *button_box);
80
81 set_visible(true);
82
84}
85
87 // "align" page doesn't use "Arrange" button
88 if (_notebook->get_current_page() == 0) {
89 _arrangeButton->set_visible(false);
90 }
91 else {
92 _arrangeButton->set_visible(true);
93 }
94}
95
97{
98 switch(_notebook->get_current_page())
99 {
100 case 0:
101 // not applicable to align panel
102 break;
103 case 1:
105 break;
106 case 2:
108 break;
109 }
110}
111
117
118} // namespace Inkscape::UI::Dialog
119
120/*
121 Local Variables:
122 mode:c++
123 c-file-style:"stroustrup"
124 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
125 indent-tabs-mode:nil
126 fill-column:99
127 End:
128*/
129// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Align and Distribute widget.
uint64_t page
Definition canvas.cpp:171
void _apply()
Callback from Apply.
Definition tile.cpp:96
GridArrangeTab * _gridArrangeTab
Definition tile.h:54
void desktopReplaced() final
Called when the desktop has certainly changed.
Definition tile.cpp:112
PolarArrangeTab * _polarArrangeTab
Definition tile.h:55
AlignAndDistribute * _align_tab
Definition tile.h:53
DialogBase is the base class for the dialog system.
Definition dialog-base.h:40
SPDesktop * getDesktop() const
Definition dialog-base.h:77
void arrange() override
Do the actual work.
void arrange() override
Do the actual arrangement.
Macro for icon names used in Inkscape.
std::unique_ptr< Magick::Image > image
Glib::ustring label
Dialog code.
Definition desktop.h:117
Gtk::Box & create_tab_label(const char *label_text, const char *icon_name)
Definition tile.cpp:32
void pack_end(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the end of box.
Definition pack.cpp:153
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
Definition pack.cpp:141
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.