/[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 2626 - (hide annotations) (download) (as text)
Thu Jun 12 15:12:00 2014 UTC (9 years, 10 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3721 byte(s)
* Dimension Region Selector: implemented multi zone selection by press and
  hold CTRL key.
* Dimension Region Selector: show bottom and upper limit values for all
  dimension zones, not just the currently selected ones.
* Dimension Region Selector: Fixed drawing issues when zone sizes were
  altered by mouse drag and labels being displayed at wrong positions.

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

  ViewVC Help
Powered by ViewVC