1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /**
3  * @brief Arranges Objects into a Grid
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 #ifndef INKSCAPE_UI_DIALOG_GRID_ARRANGE_TAB_H
19 #define INKSCAPE_UI_DIALOG_GRID_ARRANGE_TAB_H
20 
21 #include "ui/widget/scalar-unit.h"
22 #include "ui/dialog/arrange-tab.h"
23 
24 #include "ui/widget/anchor-selector.h"
25 #include "ui/widget/spinbutton.h"
26 
27 #include <gtkmm/checkbutton.h>
28 #include <gtkmm/radiobutton.h>
29 #include <gtkmm/radiobuttongroup.h>
30 
31 class SPDesktop;
32 
33 namespace Inkscape {
34 namespace UI {
35 namespace Dialog {
36 
37 class ArrangeDialog;
38 
39 /**
40  * Dialog for tiling an object
41  */
42 class GridArrangeTab : public ArrangeTab {
43 public:
44     GridArrangeTab(ArrangeDialog *parent);
45     ~GridArrangeTab() override = default;;
46 
47     /**
48      * Do the actual work
49      */
50     void arrange() override;
51 
52     /**
53      * Respond to selection change
54      */
55     void updateSelection();
56 
57     // Callbacks from spinbuttons
58     void on_row_spinbutton_changed();
59     void on_col_spinbutton_changed();
60     void on_xpad_spinbutton_changed();
61     void on_ypad_spinbutton_changed();
62     void on_RowSize_checkbutton_changed();
63     void on_ColSize_checkbutton_changed();
64     void on_rowSize_spinbutton_changed();
65     void on_colSize_spinbutton_changed();
66     void Spacing_button_changed();
67     void Align_changed();
68 
69 
70 private:
71     GridArrangeTab(GridArrangeTab const &d) = delete; // no copy
72     void operator=(GridArrangeTab const &d) = delete; // no assign
73 
74     ArrangeDialog         *Parent;
75 
76     bool updating;
77 
78     Gtk::Box               TileBox;
79 
80     // Number selected label
81     Gtk::Label            SelectionContentsLabel;
82 
83 
84     Gtk::Box              AlignHBox;
85     Gtk::Box              SpinsHBox;
86 
87     // Number per Row
88     Gtk::Box              NoOfColsBox;
89     Gtk::Label            NoOfColsLabel;
90     Inkscape::UI::Widget::SpinButton NoOfColsSpinner;
91     bool AutoRowSize;
92     Gtk::CheckButton      RowHeightButton;
93 
94     Gtk::Box              XByYLabelVBox;
95     Gtk::Label            padXByYLabel;
96     Gtk::Label            XByYLabel;
97 
98     // Number per Column
99     Gtk::Box              NoOfRowsBox;
100     Gtk::Label            NoOfRowsLabel;
101     Inkscape::UI::Widget::SpinButton NoOfRowsSpinner;
102     bool AutoColSize;
103     Gtk::CheckButton      ColumnWidthButton;
104 
105     // Alignment
106     Gtk::Label            AlignLabel;
107     Inkscape::UI::Widget::AnchorSelector        AlignmentSelector;
108     double VertAlign;
109     double HorizAlign;
110 
111     Inkscape::UI::Widget::UnitMenu      PaddingUnitMenu;
112     Inkscape::UI::Widget::ScalarUnit    XPadding;
113     Inkscape::UI::Widget::ScalarUnit    YPadding;
114     Gtk::Grid                          *PaddingTable;
115 
116     // BBox or manual spacing
117     Gtk::Box              SpacingVBox;
118     Gtk::RadioButtonGroup SpacingGroup;
119     Gtk::RadioButton      SpaceByBBoxRadioButton;
120     Gtk::RadioButton      SpaceManualRadioButton;
121     bool ManualSpacing;
122 
123     // Row height
124     Gtk::Box              RowHeightBox;
125     Inkscape::UI::Widget::SpinButton RowHeightSpinner;
126 
127     // Column width
128     Gtk::Box              ColumnWidthBox;
129     Inkscape::UI::Widget::SpinButton ColumnWidthSpinner;
130 
131     sigc::connection _selection_changed_connection;
132 
133   public:
134     void setDesktop(SPDesktop *);
135 };
136 
137 } //namespace Dialog
138 } //namespace UI
139 } //namespace Inkscape
140 
141 #endif /* INKSCAPE_UI_DIALOG_GRID_ARRANGE_TAB_H */
142 
143 /*
144   Local Variables:
145   mode:c++
146   c-file-style:"stroustrup"
147   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
148   indent-tabs-mode:nil
149   fill-column:99
150   End:
151 */
152 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
153