1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006-2011 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
21 |
#define GIGEDIT_DIMREGIONCHOOSER_H |
#define GIGEDIT_DIMREGIONCHOOSER_H |
22 |
|
|
23 |
#include <gtkmm/drawingarea.h> |
#include <gtkmm/drawingarea.h> |
|
#include <gdkmm/colormap.h> |
|
24 |
#include <gdkmm/window.h> |
#include <gdkmm/window.h> |
25 |
|
|
26 |
|
#include "compat.h" |
27 |
|
|
28 |
#include <gig.h> |
#include <gig.h> |
29 |
|
|
30 |
|
#include <set> |
31 |
|
|
32 |
class DimRegionChooser : public Gtk::DrawingArea |
class DimRegionChooser : public Gtk::DrawingArea |
33 |
{ |
{ |
34 |
public: |
public: |
35 |
DimRegionChooser(); |
DimRegionChooser(); |
36 |
virtual ~DimRegionChooser(); |
virtual ~DimRegionChooser(); |
37 |
|
|
|
void set_fromto(int from, int to); |
|
|
|
|
38 |
void set_region(gig::Region* region); |
void set_region(gig::Region* region); |
39 |
|
|
40 |
sigc::signal<void> signal_dimregion_selected(); |
sigc::signal<void>& signal_dimregion_selected(); |
41 |
sigc::signal<void> signal_region_changed(); |
sigc::signal<void>& signal_region_changed(); |
42 |
|
|
43 |
gig::DimensionRegion* get_dimregion() { return dimreg; } |
gig::DimensionRegion* get_dimregion() const { return dimreg; } |
44 |
|
void get_dimregions(const gig::Region* region, bool stereo, |
45 |
|
std::set<gig::DimensionRegion*>& dimregs) const; |
46 |
|
|
47 |
protected: |
protected: |
48 |
virtual void on_realize(); |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
49 |
virtual bool on_expose_event(GdkEventExpose* e); |
virtual bool on_expose_event(GdkEventExpose* e); |
50 |
virtual void on_size_request(GtkRequisition* requisition); |
#else |
51 |
|
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
52 |
|
#endif |
53 |
virtual bool on_button_press_event(GdkEventButton* event); |
virtual bool on_button_press_event(GdkEventButton* event); |
54 |
virtual bool on_button_release_event(GdkEventButton* event); |
virtual bool on_button_release_event(GdkEventButton* event); |
55 |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
56 |
virtual bool on_focus(Gtk::DirectionType direction); |
virtual bool on_focus(Gtk::DirectionType direction); |
57 |
|
|
58 |
Glib::RefPtr<Gdk::GC> gc; |
Gdk::RGBA red, black, white; |
|
Gdk::Color blue, red, black, white, green; |
|
59 |
|
|
60 |
gig::Instrument* instrument; |
gig::Instrument* instrument; |
61 |
gig::Region* region; |
gig::Region* region; |
66 |
|
|
67 |
gig::DimensionRegion* dimreg; |
gig::DimensionRegion* dimreg; |
68 |
int focus_line; |
int focus_line; |
69 |
int dimvalue_from[256]; |
int dimvalue[256]; |
|
int dimvalue_to[256]; |
|
70 |
int label_width; |
int label_width; |
71 |
|
bool labels_changed; |
72 |
int nbDimensions; |
int nbDimensions; |
73 |
|
|
74 |
// information needed during a resize |
// information needed during a resize |
88 |
|
|
89 |
bool cursor_is_resize; |
bool cursor_is_resize; |
90 |
bool is_in_resize_zone(double x, double y); |
bool is_in_resize_zone(double x, double y); |
91 |
|
void update_after_resize(); |
92 |
|
|
93 |
int h; |
int h; |
|
int w; |
|
94 |
}; |
}; |
95 |
|
|
96 |
#endif |
#endif |