/[svn]/gigedit/trunk/src/gigedit/midirules.h
ViewVC logotype

Annotation of /gigedit/trunk/src/gigedit/midirules.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2894 - (hide annotations) (download) (as text)
Sat Apr 30 14:42:14 2016 UTC (8 years ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5968 byte(s)
* Enabled auto save & restore of window size & position of all
  remaining windows.
* Bumped version (1.0.0.svn7).

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

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC