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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1104 - (show annotations) (download) (as text)
Sun Mar 18 17:15:00 2007 UTC (17 years ago) by persson
File MIME type: text/x-c++hdr
File size: 2684 byte(s)
* DimRegionEdit is now disbaled when no region is selected (fixes
  crash for "new file")
* instrument is selected after it is created
* minor code cleanup

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

  ViewVC Help
Powered by ViewVC