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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3089 - (hide annotations) (download) (as text)
Sun Jan 15 19:18:39 2017 UTC (21 months, 4 weeks ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4298 byte(s)
* Implemented resizing multiple dimension region zones at once, which is
  controlled by the infamous checkbox trio "all regions",
  "all dimension splits" and "both channels".
* Bumped version (1.0.0.svn25).

1 schoenebeck 1225 /* -*- c++ -*-
2 schoenebeck 3068 * Copyright (C) 2006-2017 Andreas Persson
3 schoenebeck 1225 *
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 schoenebeck 2556 #include <gtkmm/uimanager.h>
25     #include <gtkmm/menu.h>
26 schoenebeck 1225 #include <gdkmm/window.h>
27    
28 persson 2169 #include "compat.h"
29    
30 schoenebeck 3068 #ifdef LIBGIG_HEADER_FILE
31     # include LIBGIG_HEADER_FILE(gig.h)
32     #else
33     # include <gig.h>
34     #endif
35 schoenebeck 1225
36 persson 1533 #include <set>
37 schoenebeck 2626 #include <map>
38 persson 1533
39 schoenebeck 1225 class DimRegionChooser : public Gtk::DrawingArea
40     {
41     public:
42 schoenebeck 2626 DimRegionChooser(Gtk::Window& window);
43 schoenebeck 1225 virtual ~DimRegionChooser();
44    
45     void set_region(gig::Region* region);
46    
47 schoenebeck 1339 sigc::signal<void>& signal_dimregion_selected();
48     sigc::signal<void>& signal_region_changed();
49 schoenebeck 1225
50 schoenebeck 2626 gig::DimensionRegion* get_main_dimregion() const;
51 persson 1533 void get_dimregions(const gig::Region* region, bool stereo,
52     std::set<gig::DimensionRegion*>& dimregs) const;
53 schoenebeck 2695 bool select_dimregion(gig::DimensionRegion* dimrgn);
54 schoenebeck 1225
55 schoenebeck 3089 // those 3 are ATM only relevant when resizing custom dimension region zones
56     void setModifyBothChannels(bool b);
57     void setModifyAllDimensionRegions(bool b);
58     void setModifyAllRegions(bool b);
59    
60 schoenebeck 1225 protected:
61 persson 2169 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
62 schoenebeck 1225 virtual bool on_expose_event(GdkEventExpose* e);
63 persson 2246 #else
64     virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
65 persson 2169 #endif
66 schoenebeck 1225 virtual bool on_button_press_event(GdkEventButton* event);
67     virtual bool on_button_release_event(GdkEventButton* event);
68     virtual bool on_motion_notify_event(GdkEventMotion* event);
69     virtual bool on_focus(Gtk::DirectionType direction);
70 schoenebeck 2626 bool onKeyPressed(GdkEventKey* key);
71     bool onKeyReleased(GdkEventKey* key);
72 schoenebeck 2556 void refresh_all();
73     void split_dimension_zone();
74     void delete_dimension_zone();
75 schoenebeck 2695 void resetSelectedZones();
76 schoenebeck 1225
77 persson 2169 Gdk::RGBA red, black, white;
78 schoenebeck 1225
79     gig::Instrument* instrument;
80     gig::Region* region;
81    
82 persson 1261 sigc::signal<void> dimregion_selected;
83     sigc::signal<void> region_changed;
84 schoenebeck 1225
85 schoenebeck 3089 // those 3 are ATM only relevant when resizing custom dimension region zones
86     bool modifybothchannels;
87     bool modifyalldimregs;
88     bool modifyallregions;
89    
90 schoenebeck 2626 //std::set<gig::DimensionRegion*> dimregs; ///< Reflects which dimension regions are currently selected.
91 schoenebeck 1225 int focus_line;
92 schoenebeck 2626 std::map<gig::dimension_t, std::set<int> > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected.
93 schoenebeck 1225 int label_width;
94 persson 2246 bool labels_changed;
95 schoenebeck 1225 int nbDimensions;
96    
97 schoenebeck 2626 // the "main" dimension region is the one that is used to i.e. evaluate the
98     // precise custom velocity splits (could also be interpreted for focus stuff,
99     // i.e. keyboard arrow key navigation)
100     // NOTE: these may *not* necessarily currently be selected !
101     gig::dimension_t maindimtype;
102     std::map<gig::dimension_t,int> maindimcase;
103     int maindimregno;
104 schoenebeck 2556
105 schoenebeck 1225 // information needed during a resize
106     struct {
107     bool active;
108     enum {
109     none,
110     left,
111     right
112     } selected;
113     int pos;
114     int min;
115     int max;
116     int dimension;
117 schoenebeck 3089 gig::dimension_def_t dimensionDef;
118     int zone;
119 schoenebeck 1225 } resize;
120    
121 schoenebeck 2626 bool multiSelectKeyDown;
122    
123 schoenebeck 1225 bool cursor_is_resize;
124     bool is_in_resize_zone(double x, double y);
125 persson 2246 void update_after_resize();
126 schoenebeck 1225
127     int h;
128 schoenebeck 2556
129     Glib::RefPtr<Gtk::ActionGroup> actionGroup;
130     Glib::RefPtr<Gtk::UIManager> uiManager;
131     Gtk::Menu* popup_menu_inside_dimregion;
132     Gtk::Menu* popup_menu_outside_dimregion;
133 schoenebeck 1225 };
134    
135     #endif

  ViewVC Help
Powered by ViewVC