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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1262 - (show annotations) (download) (as text)
Sun Jul 22 15:07:08 2007 UTC (16 years, 8 months ago) by persson
File MIME type: text/x-c++hdr
File size: 3174 byte(s)
* regions can now be moved, not just resized
* improved labels in instrument properties dialog
* remove file extensions from file names when importing samples
* fixed some more checkbox layouts

1 /* -*- c++ -*-
2 * Copyright (C) 2006, 2007 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_REGIONCHOOSER_H
21 #define GIGEDIT_REGIONCHOOSER_H
22
23 #include <gtkmm/drawingarea.h>
24 #include <gdkmm/colormap.h>
25 #include <gtkmm/uimanager.h>
26 #include <gdkmm/window.h>
27 #include <gtkmm/menu.h>
28
29 #include "dimensionmanager.h"
30
31 #include <gig.h>
32
33 class RegionChooser : public Gtk::DrawingArea
34 {
35 public:
36 RegionChooser();
37 virtual ~RegionChooser();
38
39 void set_instrument(gig::Instrument* instrument);
40
41 sigc::signal<void> signal_region_selected();
42 sigc::signal<void> signal_instrument_changed();
43
44 gig::Region* get_region() { return region; }
45
46 protected:
47 virtual void on_realize();
48 virtual bool on_expose_event(GdkEventExpose* e);
49 virtual void on_size_request(GtkRequisition* requisition);
50 virtual bool on_button_press_event(GdkEventButton* event);
51 virtual bool on_button_release_event(GdkEventButton* event);
52 virtual bool on_motion_notify_event(GdkEventMotion* event);
53
54 gig::Region* get_region(int key);
55
56 Glib::RefPtr<Gdk::GC> gc;
57 Gdk::Color blue, red, grey1;
58
59 void draw_region(int from, int to, const Gdk::Color& color);
60
61 sigc::signal<void> region_selected;
62 sigc::signal<void> instrument_changed;
63
64 gig::Instrument* instrument;
65 gig::Region* region;
66
67 void motion_resize_region(int x, int y);
68 void motion_move_region(int x, int y);
69
70 // information needed during a resize
71 struct {
72 bool active;
73 enum {
74 undecided,
75 moving_high_limit,
76 moving_low_limit
77 } mode;
78 int pos;
79 int min;
80 int max;
81 gig::Region* region;
82 gig::Region* prev_region;
83 } resize;
84
85 // information needed during a region move
86 struct {
87 bool active;
88 double from_x;
89 int pos;
90 bool touch_left;
91 bool touch_right;
92 } move;
93
94 bool cursor_is_resize;
95 bool is_in_resize_zone(double x, double y);
96
97 int h1;
98 int width;
99
100 Gtk::Menu* popup_menu_inside_region;
101 Gtk::Menu* popup_menu_outside_region;
102 void show_region_properties();
103 void add_region();
104 void delete_region();
105 void manage_dimensions();
106 void on_dimension_manager_changed();
107 int new_region_pos;
108
109 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
110 Glib::RefPtr<Gtk::UIManager> uiManager;
111
112 DimensionManager dimensionManager;
113 };
114
115 #endif

  ViewVC Help
Powered by ViewVC