1 |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2010 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 <gdkmm/colormap.h> |
25 |
#include <gdkmm/window.h> |
26 |
|
27 |
#include <gig.h> |
28 |
|
29 |
#include <set> |
30 |
|
31 |
class DimRegionChooser : public Gtk::DrawingArea |
32 |
{ |
33 |
public: |
34 |
DimRegionChooser(); |
35 |
virtual ~DimRegionChooser(); |
36 |
|
37 |
void set_region(gig::Region* region); |
38 |
|
39 |
sigc::signal<void>& signal_dimregion_selected(); |
40 |
sigc::signal<void>& signal_region_changed(); |
41 |
|
42 |
gig::DimensionRegion* get_dimregion() const { return dimreg; } |
43 |
void get_dimregions(const gig::Region* region, bool stereo, |
44 |
std::set<gig::DimensionRegion*>& dimregs) const; |
45 |
|
46 |
protected: |
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 |
virtual bool on_focus(Gtk::DirectionType direction); |
53 |
|
54 |
Gdk::Color blue, red, black, white, green; |
55 |
|
56 |
gig::Instrument* instrument; |
57 |
gig::Region* region; |
58 |
int dimregno; |
59 |
|
60 |
sigc::signal<void> dimregion_selected; |
61 |
sigc::signal<void> region_changed; |
62 |
|
63 |
gig::DimensionRegion* dimreg; |
64 |
int focus_line; |
65 |
int dimvalue[256]; |
66 |
int label_width; |
67 |
int nbDimensions; |
68 |
|
69 |
// information needed during a resize |
70 |
struct { |
71 |
bool active; |
72 |
enum { |
73 |
none, |
74 |
left, |
75 |
right |
76 |
} selected; |
77 |
int pos; |
78 |
int min; |
79 |
int max; |
80 |
int dimension; |
81 |
int offset; |
82 |
} resize; |
83 |
|
84 |
bool cursor_is_resize; |
85 |
bool is_in_resize_zone(double x, double y); |
86 |
|
87 |
int h; |
88 |
}; |
89 |
|
90 |
#endif |