summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/align-and-distribute.h
blob: 15cfdd99d201d72b5370be290cfeec503e017eea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * @brief Align and Distribute widget
 */
/* Authors:
 *   Tavmjong Bah
 *
 *   Based on dialog by:
 *     Bryce W. Harrington <bryce@bryceharrington.org>
 *     Aubanel MONNIER <aubi@libertysurf.fr>
 *     Frank Felfe <innerspace@iname.com>
 *     Lauris Kaplinski <lauris@kaplinski.com>
 *
 * Copyright (C) 2021 Tavmjong Bah
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_UI_WIDGET_ALIGN_AND_DISTRIBUTE_H
#define INKSCAPE_UI_WIDGET_ALIGN_AND_DISTRIBUTE_H

#include <sigc++/connection.h>
#include <gtkmm.h>

class SPDesktop;

namespace Inkscape {
namespace UI {

namespace Tools {
class ToolBase;
}

namespace Dialog {
class DialogBase;

class AlignAndDistribute : public Gtk::Box
{
public:
    AlignAndDistribute(Inkscape::UI::Dialog::DialogBase* dlg);
    ~AlignAndDistribute() override = default;

    void desktop_changed(SPDesktop* desktop);
    void tool_changed(SPDesktop* desktop); // Need to show different widgets for node vs. other tools.
    void tool_changed_callback(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec);

private:

    // ********* Widgets ********** //

    Gtk::Box* align_and_distribute_box    = nullptr;
    Gtk::Box* align_and_distribute_object = nullptr; // Hidden when node tool active.
    Gtk::Box* align_and_distribute_node   = nullptr; // Visible when node tool active.

    // Align
    Gtk::ToggleButton* align_move_as_group      = nullptr;
    Gtk::ComboBox*     align_relative_object    = nullptr;
    Gtk::ComboBox*     align_relative_node      = nullptr;

    // Remove overlap
    Gtk::Button*       remove_overlap_button  = nullptr;
    Gtk::SpinButton*   remove_overlap_hgap    = nullptr;
    Gtk::SpinButton*   remove_overlap_vgap    = nullptr;


    // ********* Signal handlers ********** //

    void on_align_as_group_clicked();
    void on_align_relative_object_changed();
    void on_align_relative_node_changed();

    bool on_align_button_press_event(GdkEventButton* button_event, const std::string& align_to);
    bool on_remove_overlap_button_press_event(GdkEventButton* button_event);
    bool on_align_node_button_press_event(GdkEventButton* button_event, const std::string& align_to);

    sigc::connection tool_connection;

};

} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif // INKSCAPE_UI_WIDGET_ALIGN_AND_DISTRIBUTE_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :