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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1111 - (show annotations) (download) (as text)
Fri Mar 23 00:22:44 2007 UTC (17 years ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2825 byte(s)
* implemented adding and removing dimensions
  (adding dimensions yet segfaults, probably a libgig bug)

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_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 void manage_dimensions();
92 void on_dimension_manager_changed();
93 int new_region_pos;
94
95 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
96 Glib::RefPtr<Gtk::UIManager> uiManager;
97
98 DimensionManager dimensionManager;
99 };
100
101 #endif

  ViewVC Help
Powered by ViewVC