/[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 1261 - (show annotations) (download) (as text)
Thu Jul 5 17:12:20 2007 UTC (16 years, 8 months ago) by persson
File MIME type: text/x-c++hdr
File size: 2921 byte(s)
* a changed file is now marked with an asterisk in the window title
* added close confirmation dialog, shown if file is changed
* "save" means "save as" for new files
* enabled acceleration keys
* add .gig to filename in "save as" if it's not already there
* filename character encodings other than utf-8 supported

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

  ViewVC Help
Powered by ViewVC