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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1090 - (show annotations) (download) (as text)
Sat Mar 10 17:08:15 2007 UTC (14 years ago) by persson
File MIME type: text/x-c++hdr
File size: 2415 byte(s)
* implemented resizing of 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 <gdkmm/window.h>
26
27 #include <gig.h>
28
29 class RegionChooser : public Gtk::DrawingArea
30 {
31 public:
32 RegionChooser();
33 virtual ~RegionChooser();
34
35 void set_instrument(gig::Instrument* instrument);
36 void set_region(gig::Region* region);
37
38 sigc::signal<void> signal_sel_changed();
39
40 gig::Region* get_region() { return region; }
41
42 protected:
43 virtual void on_realize();
44 virtual bool on_expose_event(GdkEventExpose* e);
45 virtual void on_size_request(GtkRequisition* requisition);
46 virtual bool on_button_press_event(GdkEventButton* event);
47 virtual bool on_button_release_event(GdkEventButton* event);
48 virtual bool on_motion_notify_event(GdkEventMotion* event);
49
50 // virtual void on_size_allocate(Gtk::Allocation& allocation);
51
52 Glib::RefPtr<Gdk::GC> gc;
53 Gdk::Color blue, red, black, white, green, grey1;
54
55 void draw_region(int from, int to, const Gdk::Color& color);
56
57 sigc::signal<void> sel_changed_signal;
58
59 gig::Instrument* instrument;
60 gig::Region* region;
61
62 // information needed during a resize
63 struct {
64 bool active;
65 enum {
66 undecided,
67 moving_high_limit,
68 moving_low_limit
69 } mode;
70 int pos;
71 int min;
72 int max;
73 gig::Region* region;
74 gig::Region* prev_region;
75 } resize;
76
77 bool cursor_is_resize;
78 bool is_in_resize_zone(double x, double y);
79
80 int h1;
81 int width;
82 };
83
84 #endif

  ViewVC Help
Powered by ViewVC