/[svn]/gigedit/trunk/src/gigedit/dimregionchooser.h
ViewVC logotype

Contents of /gigedit/trunk/src/gigedit/dimregionchooser.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3409 - (show annotations) (download) (as text)
Tue Jan 23 16:30:56 2018 UTC (6 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5794 byte(s)
* Added new main menu item "View" -> "Tooltips for Beginners" which allows
  to disable tooltips intended for newbies only (default: on).
* Bumped version (1.1.0.svn3).

1 /* -*- c++ -*-
2 * Copyright (C) 2006-2017 Andreas Persson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with program; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #ifndef GIGEDIT_DIMREGIONCHOOSER_H
21 #define GIGEDIT_DIMREGIONCHOOSER_H
22
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm/menu.h>
25 #include <gdkmm/window.h>
26
27 #include "compat.h"
28
29 #ifdef LIBGIG_HEADER_FILE
30 # include LIBGIG_HEADER_FILE(gig.h)
31 #else
32 # include <gig.h>
33 #endif
34
35 #if USE_GTKMM_BUILDER
36 # include <gtkmm/builder.h>
37 #else
38 # include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4
39 #endif
40
41 #include <set>
42 #include <map>
43
44 #include "global.h"
45
46 class DimRegionChooser : public Gtk::DrawingArea
47 {
48 public:
49 DimRegionChooser(Gtk::Window& window);
50 virtual ~DimRegionChooser();
51
52 void set_region(gig::Region* region);
53
54 sigc::signal<void>& signal_dimregion_selected();
55 sigc::signal<void>& signal_region_changed();
56
57 gig::DimensionRegion* get_main_dimregion() const;
58 void get_dimregions(const gig::Region* region, bool stereo,
59 std::set<gig::DimensionRegion*>& dimregs) const;
60 bool select_dimregion(gig::DimensionRegion* dimrgn);
61 void select_next_dimzone(bool add = false);
62 void select_prev_dimzone(bool add = false);
63 void select_next_dimension();
64 void select_prev_dimension();
65
66 // those 3 are ATM only relevant when resizing custom dimension region zones
67 // and for painting those auto selected zones with gray hatched pattern
68 void setModifyBothChannels(bool b);
69 void setModifyAllDimensionRegions(bool b);
70 void setModifyAllRegions(bool b);
71
72 protected:
73 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
74 virtual bool on_expose_event(GdkEventExpose* e);
75 #else
76 virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
77 #endif
78 virtual bool on_button_press_event(GdkEventButton* event);
79 virtual bool on_button_release_event(GdkEventButton* event);
80 virtual bool on_motion_notify_event(GdkEventMotion* event);
81 virtual bool on_focus(Gtk::DirectionType direction);
82 #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
83 bool onKeyPressed(Gdk::EventKey& key);
84 bool onKeyReleased(Gdk::EventKey& key);
85 #else
86 bool onKeyPressed(GdkEventKey* key);
87 bool onKeyReleased(GdkEventKey* key);
88 #endif
89 void refresh_all();
90 void on_show_tooltips_changed();
91 void split_dimension_zone();
92 void delete_dimension_zone();
93 void resetSelectedZones();
94 void select_dimzone_by_dir(int dir, bool add = false);
95 void drawIconsFor(gig::dimension_t dimension, uint zone,
96 const Cairo::RefPtr<Cairo::Context>& cr,
97 int x, int y, int w, int h);
98
99 Gdk::RGBA red, blue, black, white;
100 Glib::RefPtr<Gdk::Pixbuf> blueHatchedPatternARGB;
101 Cairo::RefPtr<Cairo::SurfacePattern> blueHatchedSurfacePattern;
102 Glib::RefPtr<Gdk::Pixbuf> blueHatchedPattern2ARGB;
103 Cairo::RefPtr<Cairo::SurfacePattern> blueHatchedSurfacePattern2;
104 Glib::RefPtr<Gdk::Pixbuf> grayBlueHatchedPatternARGB;
105 Cairo::RefPtr<Cairo::SurfacePattern> grayBlueHatchedSurfacePattern;
106
107 gig::Instrument* instrument;
108 gig::Region* region;
109
110 sigc::signal<void> dimregion_selected;
111 sigc::signal<void> region_changed;
112
113 // those 3 are ATM only relevant when resizing custom dimension region zones
114 // and for painting those auto selected zones with gray hatched pattern
115 bool modifybothchannels;
116 bool modifyalldimregs;
117 bool modifyallregions;
118
119 int focus_line;
120 std::map<gig::dimension_t, std::set<int> > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected.
121 int label_width;
122 bool labels_changed;
123 int nbDimensions;
124
125 // the "main" dimension region is the one that is used to i.e. evaluate the
126 // precise custom velocity splits (could also be interpreted for focus stuff,
127 // i.e. keyboard arrow key navigation)
128 // NOTE: these may *not* necessarily currently be selected !
129 gig::dimension_t maindimtype;
130 DimensionCase maindimcase;
131 int maindimregno;
132
133 // information needed during a resize
134 struct {
135 bool active;
136 enum {
137 none,
138 left,
139 right
140 } selected;
141 int pos;
142 int min;
143 int max;
144 int dimension;
145 gig::dimension_def_t dimensionDef;
146 int zone;
147 } resize;
148
149 bool multiSelectKeyDown;
150 bool primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key
151 bool shiftKeyDown;
152
153 bool cursor_is_resize;
154 bool is_in_resize_zone(double x, double y);
155 void update_after_resize();
156
157 int h;
158
159 Glib::RefPtr<ActionGroup> actionGroup;
160 #if USE_GTKMM_BUILDER
161 Glib::RefPtr<Gtk::Builder> uiManager;
162 #else
163 Glib::RefPtr<Gtk::UIManager> uiManager;
164 #endif
165 Gtk::Menu* popup_menu_inside_dimregion;
166 Gtk::Menu* popup_menu_outside_dimregion;
167
168 private:
169 Glib::RefPtr<Action> actionDeleteDimZone;
170 Glib::RefPtr<Action> actionSplitDimZone;
171 };
172
173 #endif

  ViewVC Help
Powered by ViewVC