/[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 1322 - (show annotations) (download) (as text)
Tue Sep 4 11:04:56 2007 UTC (16 years, 7 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3757 byte(s)
* as counterpart to latest LS commit: added experimental support to
  synchronize gigedit with LinuxSampler to avoid race conditions / crash
  while modifying data structures and playing the instrument with LS at
  the same time
* packaging fixes: don't use a hard coded path to install the LS plugin
  DLL, trying to substitute the given LS plugin directory by the
  '${libdir}' automake variable (mandatory i.e. for Gentoo ebuild) and
  include plugin/linuxsamplerplugin.h into the release tarball
  ('make dist')
* updated German translation (po/de.po)

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 sigc::signal<void, gig::Instrument*> signal_instrument_struct_to_be_changed();
45 sigc::signal<void, gig::Instrument*> signal_instrument_struct_changed();
46
47 sigc::signal<void, gig::Region*> signal_region_to_be_changed();
48 sigc::signal<void, gig::Region*> signal_region_changed_signal();
49
50 gig::Region* get_region() { return region; }
51
52 protected:
53 virtual void on_realize();
54 virtual bool on_expose_event(GdkEventExpose* e);
55 virtual void on_size_request(GtkRequisition* requisition);
56 virtual bool on_button_press_event(GdkEventButton* event);
57 virtual bool on_button_release_event(GdkEventButton* event);
58 virtual bool on_motion_notify_event(GdkEventMotion* event);
59
60 gig::Region* get_region(int key);
61
62 Glib::RefPtr<Gdk::GC> gc;
63 Gdk::Color blue, red, grey1;
64
65 void draw_region(int from, int to, const Gdk::Color& color);
66
67 sigc::signal<void> region_selected;
68 sigc::signal<void> instrument_changed;
69
70 sigc::signal<void, gig::Instrument*> instrument_struct_to_be_changed_signal;
71 sigc::signal<void, gig::Instrument*> instrument_struct_changed_signal;
72
73 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
74 sigc::signal<void, gig::Region*> region_changed_signal;
75
76 gig::Instrument* instrument;
77 gig::Region* region;
78
79 void motion_resize_region(int x, int y);
80 void motion_move_region(int x, int y);
81
82 // information needed during a resize
83 struct {
84 bool active;
85 enum {
86 undecided,
87 moving_high_limit,
88 moving_low_limit
89 } mode;
90 int pos;
91 int min;
92 int max;
93 gig::Region* region;
94 gig::Region* prev_region;
95 } resize;
96
97 // information needed during a region move
98 struct {
99 bool active;
100 double from_x;
101 int pos;
102 bool touch_left;
103 bool touch_right;
104 } move;
105
106 bool cursor_is_resize;
107 bool is_in_resize_zone(double x, double y);
108
109 int h1;
110 int width;
111
112 Gtk::Menu* popup_menu_inside_region;
113 Gtk::Menu* popup_menu_outside_region;
114 void show_region_properties();
115 void add_region();
116 void delete_region();
117 void manage_dimensions();
118 void on_dimension_manager_changed();
119 int new_region_pos;
120
121 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
122 Glib::RefPtr<Gtk::UIManager> uiManager;
123
124 DimensionManager dimensionManager;
125 };
126
127 #endif

  ViewVC Help
Powered by ViewVC