1 |
/* -*- c++ -*- |
2 |
* Copyright (C) 2013-2014 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 of the |
7 |
* License, or (at 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 this program; if not, write to the Free Software |
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 |
* 02110-1301, USA. |
18 |
*/ |
19 |
|
20 |
#ifndef GIGEDIT_MIDIRULES_H |
21 |
#define GIGEDIT_MIDIRULES_H |
22 |
|
23 |
#include <gig.h> |
24 |
|
25 |
#include <gtkmm/box.h> |
26 |
#include <gtkmm/button.h> |
27 |
#include <gtkmm/buttonbox.h> |
28 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 12) || GTKMM_MAJOR_VERSION > 2 |
29 |
#include <gtkmm/cellrendererspin.h> |
30 |
#endif |
31 |
#include <gtkmm/comboboxtext.h> |
32 |
#include <gtkmm/label.h> |
33 |
#include <gtkmm/liststore.h> |
34 |
#include <gtkmm/scrolledwindow.h> |
35 |
#include <gtkmm/separatortoolitem.h> |
36 |
#include <gtkmm/toolbar.h> |
37 |
#include <gtkmm/toolbutton.h> |
38 |
#include <gtkmm/treemodel.h> |
39 |
#include <gtkmm/treeview.h> |
40 |
#include <gtkmm/window.h> |
41 |
|
42 |
#include "paramedit.h" |
43 |
#include "compat.h" |
44 |
|
45 |
class MidiRuleCtrlTrigger : public Gtk::VBox, |
46 |
public PropEditor<gig::MidiRuleCtrlTrigger> { |
47 |
public: |
48 |
MidiRuleCtrlTrigger(); |
49 |
void set_rule(gig::MidiRuleCtrlTrigger* r); |
50 |
|
51 |
protected: |
52 |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
53 |
public: |
54 |
ModelColumns() { |
55 |
add(trigger_point); |
56 |
add(descending); |
57 |
add(vel_sensitivity); |
58 |
add(key); |
59 |
add(note_off); |
60 |
add(switch_logic); |
61 |
add(velocity); |
62 |
add(override_pedal); |
63 |
} |
64 |
|
65 |
Gtk::TreeModelColumn<int> trigger_point; |
66 |
Gtk::TreeModelColumn<bool> descending; |
67 |
Gtk::TreeModelColumn<int> vel_sensitivity; |
68 |
Gtk::TreeModelColumn<Glib::ustring> key; |
69 |
Gtk::TreeModelColumn<bool> note_off; |
70 |
Gtk::TreeModelColumn<bool> switch_logic; |
71 |
Gtk::TreeModelColumn<int> velocity; |
72 |
Gtk::TreeModelColumn<bool> override_pedal; |
73 |
} columns; |
74 |
|
75 |
int append_num_column(const char* title, |
76 |
const Gtk::TreeModelColumn<int>& column, |
77 |
int lower = 0, int upper = 127); |
78 |
int append_note_column(const char* title, |
79 |
const Gtk::TreeModelColumn<Glib::ustring>& column); |
80 |
void num_editing_started(Gtk::CellEditable* editable, |
81 |
const Glib::ustring& path, |
82 |
Gtk::CellRendererSpin* renderer); |
83 |
void note_editing_started(Gtk::CellEditable* editable, |
84 |
const Glib::ustring& path, |
85 |
Gtk::CellRendererSpin* renderer); |
86 |
void num_edited(const Glib::ustring& path, const Glib::ustring& new_text, |
87 |
const Gtk::TreeModelColumn<int>& column); |
88 |
void note_edited(const Glib::ustring& path, const Glib::ustring& new_text, |
89 |
const Gtk::TreeModelColumn<Glib::ustring>& column); |
90 |
void row_changed(const Gtk::TreeModel::Path& path, |
91 |
const Gtk::TreeModel::iterator& iter); |
92 |
void row_inserted(const Gtk::TreeModel::Path& path, |
93 |
const Gtk::TreeModel::iterator& iter); |
94 |
void row_deleted(const Gtk::TreeModel::Path& path); |
95 |
|
96 |
Table table; |
97 |
NumEntryTemp<uint8_t> eControllerNumber; |
98 |
|
99 |
Gtk::VBox vbox; |
100 |
Glib::RefPtr<Gtk::ListStore> list_store; |
101 |
Gtk::TreeView tree_view; |
102 |
Gtk::ScrolledWindow scrolled_window; |
103 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
104 |
Gtk::HButtonBox toolbar; |
105 |
Gtk::Button add_button; |
106 |
Gtk::Button remove_button; |
107 |
#else |
108 |
Gtk::Toolbar toolbar; |
109 |
Gtk::ToolButton add_button; |
110 |
Gtk::ToolButton remove_button; |
111 |
#endif |
112 |
|
113 |
void sel_changed(); |
114 |
void add_row(); |
115 |
void remove_row(); |
116 |
}; |
117 |
|
118 |
|
119 |
class MidiRuleLegato : public Table, |
120 |
public PropEditor<gig::MidiRuleLegato> { |
121 |
public: |
122 |
MidiRuleLegato(); |
123 |
void set_rule(gig::MidiRuleLegato* r); |
124 |
|
125 |
protected: |
126 |
BoolEntry eBypassUseController; |
127 |
NoteEntry eBypassKey; |
128 |
NumEntryTemp<uint8_t> eBypassController; |
129 |
NumEntryTemp<uint16_t> eThresholdTime; |
130 |
NumEntryTemp<uint16_t> eReleaseTime; |
131 |
NoteEntry eKeyRangeLow; |
132 |
NoteEntry eKeyRangeHigh; |
133 |
NoteEntry eReleaseTriggerKey; |
134 |
NoteEntry eAltSustain1Key; |
135 |
NoteEntry eAltSustain2Key; |
136 |
|
137 |
void BypassUseController_toggled(); |
138 |
}; |
139 |
|
140 |
|
141 |
class MidiRules : public Gtk::Window, |
142 |
public PropEditor<gig::Instrument> { |
143 |
public: |
144 |
MidiRules(); |
145 |
void set_instrument(gig::Instrument* instrument); |
146 |
|
147 |
protected: |
148 |
enum { |
149 |
NONE = 0, |
150 |
CTRL_TRIGGER, |
151 |
LEGATO, |
152 |
NUMBER_OF_RULES |
153 |
}; |
154 |
|
155 |
Gtk::VBox vbox; |
156 |
|
157 |
Gtk::Label label; |
158 |
Gtk::ComboBoxText combo; |
159 |
Gtk::HBox hbox; |
160 |
|
161 |
Gtk::HBox box; |
162 |
|
163 |
MidiRuleCtrlTrigger ctrl_trigger; |
164 |
MidiRuleLegato legato; |
165 |
|
166 |
Gtk::HButtonBox button_box; |
167 |
Gtk::Button quit_button; |
168 |
|
169 |
const Glib::ustring unknown; |
170 |
|
171 |
void combo_changed(); |
172 |
bool remove_unknown_from_combo(); |
173 |
}; |
174 |
|
175 |
#endif |