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