1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006-2014 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> |
24 |
#include <gdkmm/colormap.h> |
#include <gtkmm/uimanager.h> |
25 |
|
#include <gtkmm/menu.h> |
26 |
#include <gdkmm/window.h> |
#include <gdkmm/window.h> |
27 |
|
|
28 |
|
#include "compat.h" |
29 |
|
|
30 |
#include <gig.h> |
#include <gig.h> |
31 |
|
|
32 |
|
#include <set> |
33 |
|
#include <map> |
34 |
|
|
35 |
class DimRegionChooser : public Gtk::DrawingArea |
class DimRegionChooser : public Gtk::DrawingArea |
36 |
{ |
{ |
37 |
public: |
public: |
38 |
DimRegionChooser(); |
DimRegionChooser(Gtk::Window& window); |
39 |
virtual ~DimRegionChooser(); |
virtual ~DimRegionChooser(); |
40 |
|
|
|
void set_fromto(int from, int to); |
|
|
|
|
41 |
void set_region(gig::Region* region); |
void set_region(gig::Region* region); |
42 |
|
|
43 |
sigc::signal<void> signal_dimregion_selected(); |
sigc::signal<void>& signal_dimregion_selected(); |
44 |
sigc::signal<void> signal_region_changed(); |
sigc::signal<void>& signal_region_changed(); |
45 |
|
|
46 |
gig::DimensionRegion* get_dimregion() { return dimreg; } |
gig::DimensionRegion* get_main_dimregion() const; |
47 |
|
void get_dimregions(const gig::Region* region, bool stereo, |
48 |
|
std::set<gig::DimensionRegion*>& dimregs) const; |
49 |
|
|
50 |
protected: |
protected: |
51 |
virtual void on_realize(); |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
52 |
virtual bool on_expose_event(GdkEventExpose* e); |
virtual bool on_expose_event(GdkEventExpose* e); |
53 |
virtual void on_size_request(GtkRequisition* requisition); |
#else |
54 |
|
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
55 |
|
#endif |
56 |
virtual bool on_button_press_event(GdkEventButton* event); |
virtual bool on_button_press_event(GdkEventButton* event); |
57 |
virtual bool on_button_release_event(GdkEventButton* event); |
virtual bool on_button_release_event(GdkEventButton* event); |
58 |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
59 |
virtual bool on_focus(Gtk::DirectionType direction); |
virtual bool on_focus(Gtk::DirectionType direction); |
60 |
|
bool onKeyPressed(GdkEventKey* key); |
61 |
|
bool onKeyReleased(GdkEventKey* key); |
62 |
|
void refresh_all(); |
63 |
|
void split_dimension_zone(); |
64 |
|
void delete_dimension_zone(); |
65 |
|
|
66 |
Glib::RefPtr<Gdk::GC> gc; |
Gdk::RGBA red, black, white; |
|
Gdk::Color blue, red, black, white, green; |
|
67 |
|
|
68 |
gig::Instrument* instrument; |
gig::Instrument* instrument; |
69 |
gig::Region* region; |
gig::Region* region; |
|
int dimregno; |
|
70 |
|
|
71 |
sigc::signal<void> dimregion_selected; |
sigc::signal<void> dimregion_selected; |
72 |
sigc::signal<void> region_changed; |
sigc::signal<void> region_changed; |
73 |
|
|
74 |
gig::DimensionRegion* dimreg; |
//std::set<gig::DimensionRegion*> dimregs; ///< Reflects which dimension regions are currently selected. |
75 |
int focus_line; |
int focus_line; |
76 |
int dimvalue_from[256]; |
std::map<gig::dimension_t, std::set<int> > dimzones; ///< Reflects which zone(s) of the individual dimension are currently selected. |
|
int dimvalue_to[256]; |
|
77 |
int label_width; |
int label_width; |
78 |
|
bool labels_changed; |
79 |
int nbDimensions; |
int nbDimensions; |
80 |
|
|
81 |
|
// the "main" dimension region is the one that is used to i.e. evaluate the |
82 |
|
// precise custom velocity splits (could also be interpreted for focus stuff, |
83 |
|
// i.e. keyboard arrow key navigation) |
84 |
|
// NOTE: these may *not* necessarily currently be selected ! |
85 |
|
gig::dimension_t maindimtype; |
86 |
|
std::map<gig::dimension_t,int> maindimcase; |
87 |
|
int maindimregno; |
88 |
|
|
89 |
// information needed during a resize |
// information needed during a resize |
90 |
struct { |
struct { |
91 |
bool active; |
bool active; |
101 |
int offset; |
int offset; |
102 |
} resize; |
} resize; |
103 |
|
|
104 |
|
bool multiSelectKeyDown; |
105 |
|
|
106 |
bool cursor_is_resize; |
bool cursor_is_resize; |
107 |
bool is_in_resize_zone(double x, double y); |
bool is_in_resize_zone(double x, double y); |
108 |
|
void update_after_resize(); |
109 |
|
|
110 |
int h; |
int h; |
111 |
int w; |
|
112 |
|
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
113 |
|
Glib::RefPtr<Gtk::UIManager> uiManager; |
114 |
|
Gtk::Menu* popup_menu_inside_dimregion; |
115 |
|
Gtk::Menu* popup_menu_outside_dimregion; |
116 |
}; |
}; |
117 |
|
|
118 |
#endif |
#endif |