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