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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2556 - (show annotations) (download) (as text)
Fri May 16 23:19:23 2014 UTC (9 years, 10 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3076 byte(s)
* Dimension zone amount: Support for increasing and decreasing the amount of
  dimension zones by right clicking on the respective zone and either
  selecting "delete" or "split" in the popup menu.

1 /* -*- c++ -*-
2 * Copyright (C) 2006-2014 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_DIMREGIONCHOOSER_H
21 #define GIGEDIT_DIMREGIONCHOOSER_H
22
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm/uimanager.h>
25 #include <gtkmm/menu.h>
26 #include <gdkmm/window.h>
27
28 #include "compat.h"
29
30 #include <gig.h>
31
32 #include <set>
33
34 class DimRegionChooser : public Gtk::DrawingArea
35 {
36 public:
37 DimRegionChooser();
38 virtual ~DimRegionChooser();
39
40 void set_region(gig::Region* region);
41
42 sigc::signal<void>& signal_dimregion_selected();
43 sigc::signal<void>& signal_region_changed();
44
45 gig::DimensionRegion* get_dimregion() const { return dimreg; }
46 void get_dimregions(const gig::Region* region, bool stereo,
47 std::set<gig::DimensionRegion*>& dimregs) const;
48
49 protected:
50 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
51 virtual bool on_expose_event(GdkEventExpose* e);
52 #else
53 virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
54 #endif
55 virtual bool on_button_press_event(GdkEventButton* event);
56 virtual bool on_button_release_event(GdkEventButton* event);
57 virtual bool on_motion_notify_event(GdkEventMotion* event);
58 virtual bool on_focus(Gtk::DirectionType direction);
59 void refresh_all();
60 void split_dimension_zone();
61 void delete_dimension_zone();
62
63 Gdk::RGBA red, black, white;
64
65 gig::Instrument* instrument;
66 gig::Region* region;
67 int dimregno;
68
69 sigc::signal<void> dimregion_selected;
70 sigc::signal<void> region_changed;
71
72 gig::DimensionRegion* dimreg;
73 int focus_line;
74 int dimvalue[256];
75 int label_width;
76 bool labels_changed;
77 int nbDimensions;
78
79 int dimtype;
80 int dimzone;
81
82 // information needed during a resize
83 struct {
84 bool active;
85 enum {
86 none,
87 left,
88 right
89 } selected;
90 int pos;
91 int min;
92 int max;
93 int dimension;
94 int offset;
95 } resize;
96
97 bool cursor_is_resize;
98 bool is_in_resize_zone(double x, double y);
99 void update_after_resize();
100
101 int h;
102
103 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
104 Glib::RefPtr<Gtk::UIManager> uiManager;
105 Gtk::Menu* popup_menu_inside_dimregion;
106 Gtk::Menu* popup_menu_outside_dimregion;
107 };
108
109 #endif

  ViewVC Help
Powered by ViewVC