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