MCP: gui stuff

git-svn-id: svn://localhost/ardour2/branches/3.0@12007 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-18 16:21:16 +00:00
parent 7a2c0b9d9a
commit d53364f2cf
3 changed files with 62 additions and 8 deletions

View File

@ -25,6 +25,8 @@
#include <gtkmm/treestore.h>
#include <gtkmm/notebook.h>
#include <gtkmm/cellrenderercombo.h>
#include <gtkmm/scale.h>
#include <gtkmm/alignment.h>
#include "pbd/strsplit.h"
@ -65,14 +67,21 @@ MackieControlProtocol::build_gui ()
MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
: _cp (p)
, touch_sensitivity_adjustment (0, 0, 9, 1, 4)
, touch_sensitivity_scale (touch_sensitivity_adjustment)
, recalibrate_fader_button (_("Recalibrate Faders"))
{
Gtk::Label* l;
Gtk::Alignment* align;
set_border_width (12);
Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 2));
table->set_spacings (4);
table->attach (*manage (new Gtk::Label (_("Device Type:"))), 0, 1, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (_surface_combo, 1, 2, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0));
Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 7));
table->set_row_spacings (4);
table->set_col_spacings (6);
l = manage (new Gtk::Label (_("Device Type:")));
table->attach (*l, 0, 1, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (_surface_combo, 1, 2, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 20);
vector<string> surfaces;
@ -83,6 +92,45 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
_surface_combo.set_active_text (p.device_info().name());
_surface_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::surface_combo_changed));
RadioButtonGroup rb_group = absolute_touch_mode_button.get_group();
touch_move_mode_button.set_group (rb_group);
l = manage (new Gtk::Label (_("Button click")));
l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 1, 2, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (relay_click_button);
table->attach (*align, 1, 2, 1, 2, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Backlight")));
l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 2, 3, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (backlight_button);
table->attach (*align, 1, 2, 2, 3, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Send Fader Position Only When Touched")));
l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 3, 4, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (absolute_touch_mode_button);
table->attach (*align, 1, 2, 3, 4, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Send Fader Position When Moved")));
l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 4, 5, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (touch_move_mode_button);
table->attach (*align, 1, 2, 4, 5, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Fader Touch Sense Sensitivity")));
l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0));
touch_sensitivity_scale.property_digits() = 0;
touch_sensitivity_scale.property_draw_value() = false;
table->attach (touch_sensitivity_scale, 1, 2, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0));
table->attach (recalibrate_fader_button, 1, 2, 6, 7, AttachOptions(FILL|EXPAND), AttachOptions (0));
vector<string> profiles;
profiles.push_back ("default");
@ -102,8 +150,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
VBox* fkey_packer = manage (new VBox);
HBox* profile_packer = manage (new HBox);
Label* l = manage (new Gtk::Label (_("Profile/Settings:")));
l = manage (new Gtk::Label (_("Profile/Settings:")));
profile_packer->pack_start (*l, false, false);
profile_packer->pack_start (_profile_combo, true, true);
profile_packer->set_spacing (12);

View File

@ -94,5 +94,13 @@ class MackieControlProtocolGUI : public Gtk::Notebook
void profile_combo_changed ();
std::map<std::string,std::string> action_map; // map from action names to paths
Gtk::CheckButton relay_click_button;
Gtk::CheckButton backlight_button;
Gtk::RadioButton absolute_touch_mode_button;
Gtk::RadioButton touch_move_mode_button;
Gtk::Adjustment touch_sensitivity_adjustment;
Gtk::HScale touch_sensitivity_scale;
Gtk::Button recalibrate_fader_button;
};

View File

@ -331,7 +331,6 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin
Strip* strip = dynamic_cast<Strip*> (&fader->group());
float pos = (pb >> 4)/1023.0; // only the top 10 bytes are used
if (strip) {
std::cerr << "New fader position " << pos << " SPtG = " << slider_position_to_gain (pos) << std::endl;
strip->handle_fader (*fader, pos);
} else {
/* master fader */