1 |
schoenebeck |
1225 |
/* -*- 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_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 |
|
|
class DimRegionChooser : public Gtk::DrawingArea |
30 |
|
|
{ |
31 |
|
|
public: |
32 |
|
|
DimRegionChooser(); |
33 |
|
|
virtual ~DimRegionChooser(); |
34 |
|
|
|
35 |
|
|
void set_region(gig::Region* region); |
36 |
|
|
|
37 |
persson |
1261 |
sigc::signal<void> signal_dimregion_selected(); |
38 |
|
|
sigc::signal<void> signal_region_changed(); |
39 |
schoenebeck |
1225 |
|
40 |
|
|
gig::DimensionRegion* get_dimregion() { return dimreg; } |
41 |
|
|
|
42 |
|
|
protected: |
43 |
|
|
virtual void on_realize(); |
44 |
|
|
virtual bool on_expose_event(GdkEventExpose* e); |
45 |
|
|
virtual void on_size_request(GtkRequisition* requisition); |
46 |
|
|
virtual bool on_button_press_event(GdkEventButton* event); |
47 |
|
|
virtual bool on_button_release_event(GdkEventButton* event); |
48 |
|
|
virtual bool on_motion_notify_event(GdkEventMotion* event); |
49 |
|
|
virtual bool on_focus(Gtk::DirectionType direction); |
50 |
|
|
|
51 |
|
|
Glib::RefPtr<Gdk::GC> gc; |
52 |
|
|
Gdk::Color blue, red, black, white, green; |
53 |
|
|
|
54 |
|
|
gig::Instrument* instrument; |
55 |
|
|
gig::Region* region; |
56 |
|
|
int dimregno; |
57 |
|
|
|
58 |
persson |
1261 |
sigc::signal<void> dimregion_selected; |
59 |
|
|
sigc::signal<void> region_changed; |
60 |
schoenebeck |
1225 |
|
61 |
|
|
gig::DimensionRegion* dimreg; |
62 |
|
|
int focus_line; |
63 |
persson |
1303 |
int dimvalue[256]; |
64 |
schoenebeck |
1225 |
int label_width; |
65 |
|
|
int nbDimensions; |
66 |
|
|
|
67 |
|
|
// information needed during a resize |
68 |
|
|
struct { |
69 |
|
|
bool active; |
70 |
|
|
enum { |
71 |
|
|
none, |
72 |
|
|
left, |
73 |
|
|
right |
74 |
|
|
} selected; |
75 |
|
|
int pos; |
76 |
|
|
int min; |
77 |
|
|
int max; |
78 |
|
|
int dimension; |
79 |
|
|
int offset; |
80 |
|
|
} resize; |
81 |
|
|
|
82 |
|
|
bool cursor_is_resize; |
83 |
|
|
bool is_in_resize_zone(double x, double y); |
84 |
|
|
|
85 |
|
|
int h; |
86 |
|
|
int w; |
87 |
|
|
}; |
88 |
|
|
|
89 |
|
|
#endif |