1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2008 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 |
23 |
#include <vector> |
#include <vector> |
24 |
|
|
25 |
#include <gtkmm/drawingarea.h> |
#include <gtkmm/drawingarea.h> |
|
#include <gdkmm/colormap.h> |
|
26 |
#include <gtkmm/uimanager.h> |
#include <gtkmm/uimanager.h> |
27 |
#include <gdkmm/window.h> |
#include <gdkmm/window.h> |
28 |
#include <gtkmm/menu.h> |
#include <gtkmm/menu.h> |
29 |
|
|
30 |
#include "dimensionmanager.h" |
#include "dimensionmanager.h" |
31 |
|
#include "paramedit.h" |
32 |
|
#include "compat.h" |
33 |
|
|
34 |
#include <gig.h> |
#include <gig.h> |
35 |
|
|
36 |
|
enum virt_keyboard_mode_t { |
37 |
|
VIRT_KEYBOARD_MODE_NORMAL, |
38 |
|
VIRT_KEYBOARD_MODE_CHORD |
39 |
|
}; |
40 |
|
|
41 |
class SortedRegions { |
class SortedRegions { |
42 |
private: |
private: |
43 |
std::vector<gig::Region*> regions; |
std::vector<gig::Region*> regions; |
69 |
sigc::signal<void, gig::Region*>& signal_region_to_be_changed(); |
sigc::signal<void, gig::Region*>& signal_region_to_be_changed(); |
70 |
sigc::signal<void, gig::Region*>& signal_region_changed_signal(); |
sigc::signal<void, gig::Region*>& signal_region_changed_signal(); |
71 |
|
|
72 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit(); |
73 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released(); |
74 |
|
|
75 |
gig::Region* get_region() { return region; } |
gig::Region* get_region() { return region; } |
76 |
|
|
77 |
void on_note_on_event(int key, int velocity); |
void on_note_on_event(int key, int velocity); |
78 |
void on_note_off_event(int key, int velocity); |
void on_note_off_event(int key, int velocity); |
79 |
|
|
80 |
|
Gtk::HBox m_VirtKeybPropsBox; |
81 |
|
|
82 |
protected: |
protected: |
83 |
virtual void on_realize(); |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
84 |
virtual bool on_expose_event(GdkEventExpose* e); |
virtual bool on_expose_event(GdkEventExpose* e); |
85 |
virtual void on_size_request(GtkRequisition* requisition); |
#endif |
86 |
|
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); |
87 |
virtual bool on_button_press_event(GdkEventButton* event); |
virtual bool on_button_press_event(GdkEventButton* event); |
88 |
virtual bool on_button_release_event(GdkEventButton* event); |
virtual bool on_button_release_event(GdkEventButton* event); |
89 |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
virtual bool on_motion_notify_event(GdkEventMotion* event); |
90 |
|
|
91 |
gig::Region* get_region(int key); |
gig::Region* get_region(int key); |
92 |
|
|
93 |
Glib::RefPtr<Gdk::GC> gc; |
Gdk::RGBA activeKeyColor, red, grey1, white, black; |
|
Gdk::Color activeKeyColor, red, grey1, white, black; |
|
94 |
|
|
95 |
sigc::signal<void> region_selected; |
sigc::signal<void> region_selected; |
96 |
sigc::signal<void> instrument_changed; |
sigc::signal<void> instrument_changed; |
101 |
sigc::signal<void, gig::Region*> region_to_be_changed_signal; |
sigc::signal<void, gig::Region*> region_to_be_changed_signal; |
102 |
sigc::signal<void, gig::Region*> region_changed_signal; |
sigc::signal<void, gig::Region*> region_changed_signal; |
103 |
|
|
104 |
|
sigc::signal<void, int/*key*/, int/*velocity*/> keyboard_key_hit_signal; |
105 |
|
sigc::signal<void, int/*key*/, int/*velocity*/> keyboard_key_released_signal; |
106 |
|
|
107 |
gig::Instrument* instrument; |
gig::Instrument* instrument; |
108 |
gig::Region* region; |
gig::Region* region; |
109 |
SortedRegions regions; |
SortedRegions regions; |
110 |
|
|
111 |
bool is_black_key(int key); |
bool is_black_key(int key); |
112 |
void draw_region(int from, int to, const Gdk::Color& color); |
void draw_key(int key, const Gdk::RGBA& color); |
113 |
|
void draw_digit(int key); |
114 |
void motion_resize_region(int x, int y); |
void motion_resize_region(int x, int y); |
115 |
void motion_move_region(int x, int y); |
void motion_move_region(int x, int y); |
116 |
|
|
155 |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
156 |
Glib::RefPtr<Gtk::UIManager> uiManager; |
Glib::RefPtr<Gtk::UIManager> uiManager; |
157 |
|
|
158 |
|
// properties of the virtaul keyboard |
159 |
|
ChoiceEntry<virt_keyboard_mode_t> m_VirtKeybModeChoice; |
160 |
|
Gtk::Label m_VirtKeybVelocityLabelDescr; |
161 |
|
Gtk::Label m_VirtKeybVelocityLabel; |
162 |
|
Gtk::Label m_VirtKeybOffVelocityLabelDescr; |
163 |
|
Gtk::Label m_VirtKeybOffVelocityLabel; |
164 |
|
int currentActiveKey; |
165 |
|
|
166 |
DimensionManager dimensionManager; |
DimensionManager dimensionManager; |
167 |
}; |
}; |
168 |
|
|