/[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 2695 - (hide annotations) (download) (as text)
Tue Jan 6 18:11:27 2015 UTC (9 years, 3 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3809 byte(s)
* Sample Referenve View Dialog: Clicking on a reference in the list closes
  the dialog and jumps directly to the respective instrument, region and
  dimension region the respective sample reference is located at.

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

  ViewVC Help
Powered by ViewVC