/[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 2626 - (show 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 /* -*- c++ -*-
2 * Copyright (C) 2006-2014 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/uimanager.h>
25 #include <gtkmm/menu.h>
26 #include <gdkmm/window.h>
27
28 #include "compat.h"
29
30 #include <gig.h>
31
32 #include <set>
33 #include <map>
34
35 class DimRegionChooser : public Gtk::DrawingArea
36 {
37 public:
38 DimRegionChooser(Gtk::Window& window);
39 virtual ~DimRegionChooser();
40
41 void set_region(gig::Region* region);
42
43 sigc::signal<void>& signal_dimregion_selected();
44 sigc::signal<void>& signal_region_changed();
45
46 gig::DimensionRegion* get_main_dimregion() const;
47 void get_dimregions(const gig::Region* region, bool stereo,
48 std::set<gig::DimensionRegion*>& dimregs) const;
49
50 protected:
51 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
52 virtual bool on_expose_event(GdkEventExpose* e);
53 #else
54 virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
55 #endif
56 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 bool onKeyPressed(GdkEventKey* key);
61 bool onKeyReleased(GdkEventKey* key);
62 void refresh_all();
63 void split_dimension_zone();
64 void delete_dimension_zone();
65
66 Gdk::RGBA red, black, white;
67
68 gig::Instrument* instrument;
69 gig::Region* region;
70
71 sigc::signal<void> dimregion_selected;
72 sigc::signal<void> region_changed;
73
74 //std::set<gig::DimensionRegion*> dimregs; ///< Reflects which dimension regions are currently selected.
75 int focus_line;
76 std::map<gig::dimension_t, std::set<int> > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected.
77 int label_width;
78 bool labels_changed;
79 int nbDimensions;
80
81 // 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
89 // 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 bool multiSelectKeyDown;
105
106 bool cursor_is_resize;
107 bool is_in_resize_zone(double x, double y);
108 void update_after_resize();
109
110 int h;
111
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 };
117
118 #endif

  ViewVC Help
Powered by ViewVC