From b7c5e24f4a10558942cde30c3cc4eb995846df3d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Jul 2007 01:29:33 +0000 Subject: Allow setting control values out of range. Move to glade-3 (files hopefully compatible?). git-svn-id: http://svn.drobilla.net/lad/ingen@567 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/MidiControlNode.cpp | 5 + src/libs/gui/ControlGroups.cpp | 27 +- src/libs/gui/PortPropertiesWindow.cpp | 22 +- src/libs/gui/ingen_gui.glade | 936 ++++++++++++++++++---------------- 4 files changed, 512 insertions(+), 478 deletions(-) diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index a90416e2..05454bdb 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -75,6 +75,11 @@ MidiControlNode::process(SampleCount nframes, FrameTime start, FrameTime end) assert(midi_in->this_nframes() == nframes); while (midi_in->get_event(×tamp, &size, &buffer) < nframes) { + + cerr << "EVENT: "; + for (size_t i=0; i < size; ++i) + cerr << buffer[i] << " "; + cerr << endl; //const FrameTime time = start + (FrameTime)timestamp; diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index 4de4e0c6..2d68492c 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "interface/EngineInterface.h" #include "client/PluginModel.h" #include "client/NodeModel.h" @@ -27,8 +28,7 @@ #include "GladeFactory.h" #include "App.h" -using std::cerr; using std::cout; using std::endl; - +using namespace std; using namespace Ingen::Client; namespace Ingen { @@ -140,7 +140,7 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr pm) _slider->set_increments(0, 0); _slider->set_range(min, max); - _value_spinner->set_range(min, max); + //_value_spinner->set_range(min, max); set_value(pm->value()); @@ -179,8 +179,14 @@ SliderControlGroup::set_value(float val) { _enable_signal = false; if (_enabled) { - if (_slider->get_value() != val) + if (_slider->get_value() != val) { + const Gtk::Adjustment* range = _slider->get_adjustment(); + const float lower = range->get_lower(); + const float upper = range->get_upper(); + if (val < lower || val > upper) + set_range(min(lower, val), max(lower, val)); _slider->set_value(val); + } if (_value_spinner->get_value() != val) _value_spinner->set_value(val); } @@ -192,7 +198,7 @@ void SliderControlGroup::set_range(float min, float max) { _slider->set_range(min, max); - _value_spinner->set_range(min, max); + //_value_spinner->set_range(min, max); } @@ -248,17 +254,8 @@ SliderControlGroup::update_value_from_spinner() if (_enable_signal) { _enable_signal = false; const float value = _value_spinner->get_value(); - - /*if (value < _min_spinner->get_value()) { - _min_spinner->set_value(value); - _slider->set_range(_min_spinner->get_value(), _max_spinner->get_value()); - } - if (value > _max_spinner->get_value()) { - _max_spinner->set_value(value); - _slider->set_range(_min_spinner->get_value(), _max_spinner->get_value()); - }*/ - _slider->set_value(value); + set_value(value); _control_panel->value_changed(_port_model, value); diff --git a/src/libs/gui/PortPropertiesWindow.cpp b/src/libs/gui/PortPropertiesWindow.cpp index 10b65641..92df6ce5 100644 --- a/src/libs/gui/PortPropertiesWindow.cpp +++ b/src/libs/gui/PortPropertiesWindow.cpp @@ -68,7 +68,7 @@ PortPropertiesWindow::init(ControlGroup* control, SharedPtr pm) float max = 1.0f; const Atom& min_atom = pm->get_metadata("ingen:minimum"); - const Atom& max_atom = pm->get_metadata("ingen_maximum"); + const Atom& max_atom = pm->get_metadata("ingen:maximum"); if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) { min = min_atom.get_float(); max = max_atom.get_float(); @@ -121,12 +121,12 @@ PortPropertiesWindow::metadata_update(const string& key, const Atom& value) void PortPropertiesWindow::min_changed() { - float min = _min_spinner->get_value(); - const float max = _max_spinner->get_value(); + const float min = _min_spinner->get_value(); + float max = _max_spinner->get_value(); - if (min >= max) { - min = max - 1.0; - _min_spinner->set_value(min); + if (max <= min) { + max = min + 1.0; + _max_spinner->set_value(max); } _control->set_range(min, max); @@ -139,12 +139,12 @@ PortPropertiesWindow::min_changed() void PortPropertiesWindow::max_changed() { - const float min = _min_spinner->get_value(); - float max = _max_spinner->get_value(); + float min = _min_spinner->get_value(); + const float max = _max_spinner->get_value(); - if (max <= min) { - max = min + 1.0; - _max_spinner->set_value(max); + if (min >= max) { + min = max - 1.0; + _min_spinner->set_value(min); } _control->set_range(min, max); diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 6eaf300e..e0777069 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -481,60 +481,53 @@ 3 12 - + True - True - Clear filter text (show all plugins) - gtk-clear - True + 1 + Node Name: + True - 2 - 3 + 2 + 3 GTK_FILL - + True - Name contains: + 1 + 2 + 1 + 2 GTK_FILL - - + True - True - True - Search string to filter plugin list - * - 1 - 2 - 6 + 1 + 2 + GTK_FILL + GTK_FILL - + True - False - True - Add selected plugin to patch - gtk-add - True 2 3 - 2 - 3 + 1 + 2 GTK_FILL - + GTK_FILL @@ -554,6 +547,7 @@ True Polyphonic True + 0 True True @@ -576,51 +570,60 @@ - + True + False + True + Add selected plugin to patch + gtk-add + True + 0 2 3 - 1 - 2 + 2 + 3 GTK_FILL - GTK_FILL + - + True + True + True + Search string to filter plugin list + * - 1 - 2 - GTK_FILL - GTK_FILL + 1 + 2 + 6 - + True + Name contains: - 1 - 2 - 1 - 2 GTK_FILL + - + True - 1 - Node Name: - True + True + Clear filter text (show all plugins) + gtk-clear + True + 0 - 2 - 3 + 2 + 3 GTK_FILL @@ -651,61 +654,61 @@ 2 2 - + True - True - True - * - True + 0 + Name: - 1 - 2 - - 4 + GTK_FILL + GTK_EXPAND + 5 - + True - True - 1 0 100 1 10 10 - 1 + 0 + Polyphony: - 1 - 2 1 2 GTK_FILL - - 4 + GTK_EXPAND + 5 - + True - 0 - Polyphony: + True + 1 0 100 1 10 10 + 1 + 1 + 2 1 2 GTK_FILL - GTK_EXPAND - 5 + + 4 - + True - 0 - Name: + True + True + * + True - GTK_FILL - GTK_EXPAND - 5 + 1 + 2 + + 4 @@ -732,6 +735,7 @@ True gtk-cancel True + 0 @@ -740,6 +744,7 @@ True True True + 0 True @@ -805,69 +810,63 @@ 12 4 - + True - - - True - True - Specify the name for the new patch - Specify: - True - True - load_subpatch_name_from_file_radio - - - False - False - - - - - True - False - True - Specify the name for the new patch - * - True - - - False - 1 - - + 0 + <b>Name: </b> + True - 3 - 4 - GTK_FILL + GTK_FILL + - + True 0 + <b>Polyphony: </b> + True - 2 - 3 + 1 + 2 GTK_FILL - + True True - Set polyphony to the same value as the parent (containing) patch - Same as parent (?) + Use the name stored in the patch file + Load from file True + 0 + True True - load_subpatch_poly_from_file_radio - 2 - 3 + 1 + 2 + GTK_FILL + + + + + + True + True + Use the polyphony value stored in the patch file + Load from file + True + 0 + True + True + + + 1 + 2 1 2 GTK_FILL @@ -884,6 +883,7 @@ Specify a custom polyphony value for new patch Specify: True + 0 True load_subpatch_poly_from_file_radio @@ -917,18 +917,19 @@ - + True True - Use the polyphony value stored in the patch file - Load from file + Set polyphony to the same value as the parent (containing) patch + Same as parent (?) True - True + 0 True + load_subpatch_poly_from_file_radio - 1 - 2 + 2 + 3 1 2 GTK_FILL @@ -936,46 +937,55 @@ - - True - True - Use the name stored in the patch file - Load from file - True - True - True - - - 1 - 2 - GTK_FILL - - - - - + True 0 - <b>Polyphony: </b> - True - 1 - 2 + 2 + 3 GTK_FILL - + True - 0 - <b>Name: </b> - True + + + True + True + Specify the name for the new patch + Specify: + True + 0 + True + load_subpatch_name_from_file_radio + + + False + False + + + + + True + False + True + Specify the name for the new patch + * + True + + + False + 1 + + - GTK_FILL - + 3 + 4 + GTK_FILL @@ -1036,6 +1046,54 @@ 4 12 4 + + + True + 0 + <b>Polyphony: </b> + True + + + GTK_FILL + + + + + + True + True + Use the same polyphony as the current patch + Keep current + True + 0 + True + True + + + 1 + 2 + GTK_FILL + + + + + + True + True + Use the polyphony value stored in the patch file + Load from file + True + 0 + True + load_patch_poly_from_current_radio + + + 2 + 3 + GTK_FILL + + + True @@ -1045,6 +1103,7 @@ True Specify: True + 0 True load_patch_poly_from_current_radio @@ -1070,55 +1129,9 @@ 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - True - Use the polyphony value stored in the patch file - Load from file - True - True - load_patch_poly_from_current_radio - - - 2 - 3 - GTK_FILL - - - - - - True - True - Use the same polyphony as the current patch - Keep current - True - True - True - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Polyphony: </b> - True - - + 4 GTK_FILL - + GTK_FILL @@ -1184,22 +1197,46 @@ - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 - + True - 0 - 4 - 4 - <b>Name</b> - True - True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + + + True + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + + + + + True + True + + + True + Apply changed controls to all voices + All Voices + True + 0 + True False @@ -1207,66 +1244,54 @@ - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 1 - 0 - 0 - 2 - 2 - 2 + 5 - + True True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - 0 -9.9999999999999999e+45 1.0000000000000001e+63 1 10 10 - 4 + Apply changed controls to one voice only + Specific Voice: + True + 0 + True + control_panel_all_voices_radio + + + False + False + + + + + True + False + True + Voice control changes are applied to + 1 1 100 1 10 10 + 1 + True + + 1 + + False + False 1 False - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 -1e+113 1e+137 0 0 0 - 63 - False - - - False + 5 1 - - 3 - 4 - - - - - True - - - 1 - 2 - GTK_FILL - @@ -1312,6 +1337,7 @@ + False False @@ -1499,45 +1525,32 @@ - + + True + + + 1 + 2 + GTK_FILL + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - 0 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - - - - - - - True - True - - - True - Apply changed controls to all voices - All Voices - True - True + 0 + 4 + 4 + <b>Name</b> + True + True False @@ -1545,53 +1558,57 @@ - + True - 5 - - - True - True - Apply changed controls to one voice only - Specific Voice: - True - True - control_panel_all_voices_radio - - - False - False - - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + 1 + 0 + 0 + 2 + 2 + 2 - + True - False True - Voice control changes are applied to - 1 1 100 1 10 10 - 1 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + 0 -9.9999999999999999e+45 1.0000000000000001e+63 1 10 10 + 4 True - - 1 - - False - False 1 False - 5 + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 -1e+113 1e+137 0 0 0 + 63 + False + + + False 1 + + 3 + 4 + @@ -1643,6 +1660,7 @@ True gtk-clear True + 0 @@ -1651,6 +1669,7 @@ True gtk-close True + 0 1 @@ -1679,51 +1698,51 @@ 2 2 - + True - 0 + <b>Patch Search Path: </b> + True - 1 - 2 GTK_FILL - + True - <i>Example: /foo/bar:/home/john/patches:/usr/share/om/patches</i> - True + True + * 1 2 - 1 - 2 - GTK_FILL - - True - True - * + + True + <i>Example: /foo/bar:/home/john/patches:/usr/share/om/patches</i> + True 1 2 + 1 + 2 + GTK_FILL - + True - <b>Patch Search Path: </b> - True + 0 + 1 + 2 GTK_FILL @@ -1745,6 +1764,7 @@ Save these settings for future sessions gtk-save True + 0 @@ -1753,6 +1773,7 @@ True gtk-cancel True + 0 1 @@ -1765,6 +1786,7 @@ Apply these settings to this session only gtk-ok True + 0 2 @@ -1852,6 +1874,7 @@ True gtk-cancel True + 0 @@ -1862,6 +1885,7 @@ Apply these changes to be saved the next time the patch is saved gtk-ok True + 0 1 @@ -1935,6 +1959,7 @@ True gtk-cancel True + 0 @@ -1943,6 +1968,7 @@ True True True + 0 True @@ -2054,6 +2080,7 @@ True Polyphonic True + 0 True @@ -2091,7 +2118,7 @@ 10 6 - + True 0 - @@ -2099,34 +2126,28 @@ 1 2 - 2 - 3 GTK_FILL - + True 0 - Name: + Type: - 2 - 3 GTK_FILL - + True 0 - - + URI: - 1 - 2 1 2 GTK_FILL @@ -2134,12 +2155,14 @@ - + True 0 - URI: + - + 1 + 2 1 2 GTK_FILL @@ -2147,18 +2170,20 @@ - + True 0 - Type: + Name: + 2 + 3 GTK_FILL - + True 0 - @@ -2166,6 +2191,8 @@ 1 2 + 2 + 3 GTK_FILL @@ -2308,6 +2335,7 @@ Contributors: True + False 4 1 @@ -2319,32 +2347,64 @@ Contributors: 2 8 - + True - 0 + + + True + False + True + 16180 1 65535 1 10 10 + 1 + True + + + False + False + + + + + 1 + 2 + 1 + 2 + GTK_FILL + 8 + + + + + True + + + True + True + * + True + 28 + osc.udp://localhost:16180 + + 1 2 - 2 - 3 GTK_FILL - + GTK_FILL + 8 - + True - False True - Use internal engine + Connect to running server at: True + 0 True - connect_server_radiobutton - 2 - 3 GTK_FILL @@ -2355,6 +2415,7 @@ Contributors: True Launch and connect to server on port: True + 0 True connect_server_radiobutton @@ -2366,65 +2427,35 @@ Contributors: - + True + False True - Connect to running server at: + Use internal engine True + 0 True + connect_server_radiobutton + 2 + 3 GTK_FILL - + True - - - True - True - * - True - 28 - osc.udp://localhost:16180 - - + 0 1 2 + 2 + 3 GTK_FILL - GTK_FILL - 8 - - - - - True - - - True - False - True - 16180 1 65535 1 10 10 - 1 - True - - - False - False - - - - - 1 - 2 - 1 - 2 - GTK_FILL - 8 + @@ -2448,6 +2479,7 @@ Contributors: True gtk-quit True + 0 @@ -2746,26 +2778,19 @@ Contributors: 2 8 - - True - 0 - Short Name: - - - 1 - 2 - GTK_FILL - - - - - + True - 0 - Symbol: + True + Enter a short name suitable for use as an identifier or filename. + +The first character must be one of _, a-z or A-Z and subsequenct characters can be from _, a-z, A-Z or 0-9. + + * + True - GTK_FILL + 1 + 2 @@ -2786,19 +2811,26 @@ Contributors: - + True - True - Enter a short name suitable for use as an identifier or filename. - -The first character must be one of _, a-z or A-Z and subsequenct characters can be from _, a-z, A-Z or 0-9. - - * - True + 0 + Symbol: - 1 - 2 + GTK_FILL + + + + + + True + 0 + Short Name: + + + 1 + 2 + GTK_FILL @@ -2944,26 +2976,17 @@ Thank you for contributing. 2 4 - - True - 0 - Maximum Value: - - - 1 - 2 - GTK_FILL - - - - - + True - 0 - Minimum Value: + True + 0 -100000000 100000000 1 10 10 + 1 + 5 + True - GTK_FILL + 1 + 2 @@ -2985,17 +3008,26 @@ Thank you for contributing. - + True - True - 0 -100000000 100000000 1 10 10 - 1 - 5 - True + 0 + Minimum Value: - 1 - 2 + GTK_FILL + + + + + + True + 0 + Maximum Value: + + + 1 + 2 + GTK_FILL -- cgit v1.2.1