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