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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1103 - (show annotations) (download) (as text)
Sun Mar 18 07:26:43 2007 UTC (13 years, 6 months ago) by persson
File MIME type: text/x-c++hdr
File size: 2726 byte(s)
* implemented add and remove region
* fixed crash in DimRegionChooser for instruments without regions

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
28 #include <gtkmm/menu.h>
29
30 #include <gig.h>
31
32 class RegionChooser : public Gtk::DrawingArea
33 {
34 public:
35 RegionChooser();
36 virtual ~RegionChooser();
37
38 void set_instrument(gig::Instrument* instrument);
39 void set_region(gig::Region* region);
40
41 sigc::signal<void> signal_sel_changed();
42
43 gig::Region* get_region() { return region; }
44
45 protected:
46 virtual void on_realize();
47 virtual bool on_expose_event(GdkEventExpose* e);
48 virtual void on_size_request(GtkRequisition* requisition);
49 virtual bool on_button_press_event(GdkEventButton* event);
50 virtual bool on_button_release_event(GdkEventButton* event);
51 virtual bool on_motion_notify_event(GdkEventMotion* event);
52
53 gig::Region* get_region(int key);
54
55 Glib::RefPtr<Gdk::GC> gc;
56 Gdk::Color blue, red, black, white, green, grey1;
57
58 void draw_region(int from, int to, const Gdk::Color& color);
59
60 sigc::signal<void> sel_changed_signal;
61
62 gig::Instrument* instrument;
63 gig::Region* region;
64
65 // information needed during a resize
66 struct {
67 bool active;
68 enum {
69 undecided,
70 moving_high_limit,
71 moving_low_limit
72 } mode;
73 int pos;
74 int min;
75 int max;
76 gig::Region* region;
77 gig::Region* prev_region;
78 } resize;
79
80 bool cursor_is_resize;
81 bool is_in_resize_zone(double x, double y);
82
83 int h1;
84 int width;
85
86 Gtk::Menu* popup_menu_inside_region;
87 Gtk::Menu* popup_menu_outside_region;
88 void show_region_properties();
89 void add_region();
90 void delete_region();
91 int new_region_pos;
92
93 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
94 Glib::RefPtr<Gtk::UIManager> uiManager;
95 };
96
97 #endif

  ViewVC Help
Powered by ViewVC