summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/livepatheffect-add.h
blob: bd8dca4c066a543df9ba9cbc673482da37ee57bd (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// SPDX-License-Identifier: GPL-2.0-or-later
/**
 * @file
 * Dialog for adding a live path effect.
 *
 * Author:
 *
 * Copyright (C) 2012 Authors
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H
#define INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H

#include "live_effects/effect-enum.h"
#include <gtkmm/adjustment.h>
#include <gtkmm/box.h>
#include <gtkmm/builder.h>
#include <gtkmm/dialog.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/flowbox.h>
#include <gtkmm/flowboxchild.h>
#include <gtkmm/image.h>
#include <gtkmm/label.h>
#include <gtkmm/overlay.h>
#include <gtkmm/popover.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/searchentry.h>
#include <gtkmm/stylecontext.h>
#include <gtkmm/switch.h>
#include <gtkmm/viewport.h>

class SPDesktop;

namespace Inkscape {
namespace UI {
namespace Dialog {
      
/**
 * A dialog widget to list the live path effects that can be added
 *
 */
class LivePathEffectAdd {
  public:
    LivePathEffectAdd();
    ~LivePathEffectAdd() = default;
    ;

    /**
     * Show the dialog
     */
    static void show(SPDesktop *desktop);
    /**
     * Returns true is the "Add" button was pressed
     */
    static bool isApplied() { return instance()._applied; }

    static const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *getActiveData();

  protected:
    /**
     * Close button was clicked
     */
    void onClose();
    bool on_filter(Gtk::FlowBoxChild *child);
    int on_sort(Gtk::FlowBoxChild *child1, Gtk::FlowBoxChild *child2);
    void on_search();
    void on_focus(Gtk::Widget *widg);
    bool pop_description(GdkEventCrossing *evt, Glib::RefPtr<Gtk::Builder> builder_effect);
    bool hide_pop_description(GdkEventCrossing *evt);
    bool fav_toggler(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect);
    bool apply(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect,
               const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *to_add);
    bool on_press_enter(GdkEventKey *key, Glib::RefPtr<Gtk::Builder> builder_effect,
                        const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *to_add);
    bool expand(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect);
    bool show_fav_toggler(GdkEventButton *evt);
    void viewChanged(gint mode);
    bool mouseover(GdkEventCrossing *evt, GtkWidget *wdg);
    bool mouseout(GdkEventCrossing *evt, GtkWidget *wdg);
    void reload_effect_list();
    /**
     * Add button was clicked
     */
    void onAdd();
    /**
     * Tree was clicked
     */
    void onButtonEvent(GdkEventButton* evt);

    /**
     * Key event
     */
    void onKeyEvent(GdkEventKey* evt);
private:
  Gtk::Button _add_button;
  Gtk::Button _close_button;
  Gtk::Dialog *_LPEDialogSelector;
  Glib::RefPtr<Gtk::Builder> _builder;
  Gtk::FlowBox *_LPESelectorFlowBox;
  Gtk::Popover *_LPESelectorEffectInfoPop;
  Gtk::EventBox *_LPESelectorEffectEventFavShow;
  Gtk::EventBox *_LPESelectorEffectInfoEventBox;
  Gtk::RadioButton *_LPESelectorEffectRadioList;
  Gtk::RadioButton *_LPESelectorEffectRadioPackLess;
  Gtk::RadioButton *_LPESelectorEffectRadioPackMore;
  Gtk::Switch *_LPEExperimental;
  Gtk::SearchEntry *_LPEFilter;
  Gtk::ScrolledWindow *_LPEScrolled;
  Gtk::Label *_LPEInfo;
  Gtk::Box *_LPESelector;
  guint _visiblelpe;
  Glib::ustring _item_type;
  bool _has_clip;
  bool _has_mask;
  Gtk::FlowBoxChild *_lasteffect;
  const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *_to_add;
  bool _showfavs;
  bool _applied;
  class Effect;
  const LivePathEffect::EnumEffectDataConverter<LivePathEffect::EffectType> &converter;
  static LivePathEffectAdd &instance()
  {
      static LivePathEffectAdd instance_;
      return instance_;
  }
  LivePathEffectAdd(LivePathEffectAdd const &) = delete;            // no copy
  LivePathEffectAdd &operator=(LivePathEffectAdd const &) = delete; // no assign
};
 
} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif // INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_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 :