1 |
schoenebeck |
1225 |
/* -*- c++ -*- |
2 |
schoenebeck |
2556 |
* Copyright (C) 2006-2014 Andreas Persson |
3 |
schoenebeck |
1225 |
* |
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 |
schoenebeck |
2556 |
#include <gtkmm/uimanager.h> |
25 |
|
|
#include <gtkmm/menu.h> |
26 |
schoenebeck |
1225 |
#include <gdkmm/window.h> |
27 |
|
|
|
28 |
persson |
2169 |
#include "compat.h" |
29 |
|
|
|
30 |
schoenebeck |
1225 |
#include <gig.h> |
31 |
|
|
|
32 |
persson |
1533 |
#include <set> |
33 |
|
|
|
34 |
schoenebeck |
1225 |
class DimRegionChooser : public Gtk::DrawingArea |
35 |
|
|
{ |
36 |
|
|
public: |
37 |
|
|
DimRegionChooser(); |
38 |
|
|
virtual ~DimRegionChooser(); |
39 |
|
|
|
40 |
|
|
void set_region(gig::Region* region); |
41 |
|
|
|
42 |
schoenebeck |
1339 |
sigc::signal<void>& signal_dimregion_selected(); |
43 |
|
|
sigc::signal<void>& signal_region_changed(); |
44 |
schoenebeck |
1225 |
|
45 |
persson |
1533 |
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 |
schoenebeck |
1225 |
|
49 |
|
|
protected: |
50 |
persson |
2169 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
51 |
schoenebeck |
1225 |
virtual bool on_expose_event(GdkEventExpose* e); |
52 |
persson |
2246 |
#else |
53 |
|
|
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
54 |
persson |
2169 |
#endif |
55 |
schoenebeck |
1225 |
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 |
schoenebeck |
2556 |
void refresh_all(); |
60 |
|
|
void split_dimension_zone(); |
61 |
|
|
void delete_dimension_zone(); |
62 |
schoenebeck |
1225 |
|
63 |
persson |
2169 |
Gdk::RGBA red, black, white; |
64 |
schoenebeck |
1225 |
|
65 |
|
|
gig::Instrument* instrument; |
66 |
|
|
gig::Region* region; |
67 |
|
|
int dimregno; |
68 |
|
|
|
69 |
persson |
1261 |
sigc::signal<void> dimregion_selected; |
70 |
|
|
sigc::signal<void> region_changed; |
71 |
schoenebeck |
1225 |
|
72 |
|
|
gig::DimensionRegion* dimreg; |
73 |
|
|
int focus_line; |
74 |
persson |
1303 |
int dimvalue[256]; |
75 |
schoenebeck |
1225 |
int label_width; |
76 |
persson |
2246 |
bool labels_changed; |
77 |
schoenebeck |
1225 |
int nbDimensions; |
78 |
|
|
|
79 |
schoenebeck |
2556 |
int dimtype; |
80 |
|
|
int dimzone; |
81 |
|
|
|
82 |
schoenebeck |
1225 |
// 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 |
persson |
2246 |
void update_after_resize(); |
100 |
schoenebeck |
1225 |
|
101 |
|
|
int h; |
102 |
schoenebeck |
2556 |
|
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 |
schoenebeck |
1225 |
}; |
108 |
|
|
|
109 |
|
|
#endif |