MCP: better display of parameter values, off by one error when collecting controls for buttons, more GUI
git-svn-id: svn://localhost/ardour2/branches/3.0@11964 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <gtkmm/notebook.h>
|
||||
#include <gtkmm/cellrenderercombo.h>
|
||||
|
||||
#include "pbd/strsplit.h"
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/actions.h"
|
||||
|
||||
@@ -103,22 +105,79 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
|
||||
available_action_model = TreeStore::create (available_action_columns);
|
||||
|
||||
vector<string> a_names;
|
||||
vector<string> a_paths;
|
||||
vector<string> a_tooltips;
|
||||
vector<string> a_keys;
|
||||
vector<Gtk::AccelKey> a_bindings;
|
||||
vector<string> paths;
|
||||
vector<string> labels;
|
||||
vector<string> tooltips;
|
||||
vector<string> keys;
|
||||
vector<AccelKey> bindings;
|
||||
typedef std::map<string,TreeIter> NodeMap;
|
||||
NodeMap nodes;
|
||||
NodeMap::iterator r;
|
||||
|
||||
ActionManager::get_all_actions (a_names, a_paths, a_tooltips, a_keys, a_bindings);
|
||||
ActionManager::get_all_actions (labels, paths, tooltips, keys, bindings);
|
||||
|
||||
vector<string>::iterator n = a_names.begin();
|
||||
vector<string>::iterator p = a_paths.begin();
|
||||
TreeModel::Row r;
|
||||
vector<string>::iterator k;
|
||||
vector<string>::iterator p;
|
||||
vector<string>::iterator t;
|
||||
vector<string>::iterator l;
|
||||
|
||||
for (; n != a_names.end(); ++n, ++p) {
|
||||
r = *(available_action_model->append());
|
||||
r[available_action_columns.name] = (*n);
|
||||
r[available_action_columns.path] = (*p);
|
||||
available_action_model->clear ();
|
||||
|
||||
for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) {
|
||||
|
||||
TreeModel::Row row;
|
||||
vector<string> parts;
|
||||
|
||||
parts.clear ();
|
||||
|
||||
split (*p, parts, '/');
|
||||
|
||||
if (parts.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//kinda kludgy way to avoid displaying menu items as mappable
|
||||
if ( parts[1] == _("Main_menu") )
|
||||
continue;
|
||||
if ( parts[1] == _("JACK") )
|
||||
continue;
|
||||
if ( parts[1] == _("redirectmenu") )
|
||||
continue;
|
||||
if ( parts[1] == _("Editor_menus") )
|
||||
continue;
|
||||
if ( parts[1] == _("RegionList") )
|
||||
continue;
|
||||
if ( parts[1] == _("ProcessorMenu") )
|
||||
continue;
|
||||
|
||||
if ((r = nodes.find (parts[1])) == nodes.end()) {
|
||||
|
||||
/* top level is missing */
|
||||
|
||||
TreeIter rowp;
|
||||
TreeModel::Row parent;
|
||||
rowp = available_action_model->append();
|
||||
nodes[parts[1]] = rowp;
|
||||
parent = *(rowp);
|
||||
parent[available_action_columns.name] = parts[1];
|
||||
|
||||
row = *(available_action_model->append (parent.children()));
|
||||
|
||||
} else {
|
||||
|
||||
row = *(available_action_model->append ((*r->second)->children()));
|
||||
|
||||
}
|
||||
|
||||
/* add this action */
|
||||
|
||||
if (l->empty ()) {
|
||||
row[available_action_columns.name] = *t;
|
||||
} else {
|
||||
row[available_action_columns.name] = *l;
|
||||
}
|
||||
|
||||
row[available_action_columns.path] = (*p);
|
||||
}
|
||||
|
||||
function_key_editor.append_column (_("Key"), function_key_columns.name);
|
||||
@@ -126,7 +185,7 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
CellRendererCombo* action_renderer = manage (new CellRendererCombo);
|
||||
action_renderer->property_model() = available_action_model;
|
||||
action_renderer->property_editable() = true;
|
||||
action_renderer->property_text_column() = 1;
|
||||
action_renderer->property_text_column() = 0;
|
||||
action_renderer->property_has_entry() = false;
|
||||
|
||||
TreeViewColumn* col;
|
||||
@@ -159,22 +218,24 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
|
||||
function_key_model = ListStore::create (function_key_columns);
|
||||
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F1";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F2";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F3";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F4";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F5";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F6";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F7";
|
||||
r = *(function_key_model->append());
|
||||
r[function_key_columns.name] = "F8";
|
||||
TreeModel::Row row;
|
||||
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F1";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F2";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F3";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F4";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F5";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F6";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F7";
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F8";
|
||||
|
||||
function_key_editor.set_model (function_key_model);
|
||||
}
|
||||
|
||||
@@ -1341,6 +1341,8 @@ MackieControlProtocol::pull_route_range (list<uint32_t>& down, RouteList& select
|
||||
ls = (*s)->n_strips ();
|
||||
}
|
||||
|
||||
ls += 1;
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("adding strips for surface %1 (%2 .. %3)\n",
|
||||
(*s)->number(), fs, ls));
|
||||
|
||||
|
||||
@@ -291,21 +291,13 @@ Strip::notify_gain_changed (bool force_update)
|
||||
|
||||
if (_surface->mcp().flip_mode()) {
|
||||
_surface->write (_vpot->set_all (pos, true, Pot::wrap));
|
||||
do_parameter_display (GainAutomation, pos);
|
||||
} else {
|
||||
_surface->write (_fader->set_position (pos));
|
||||
do_parameter_display (GainAutomation, pos);
|
||||
}
|
||||
|
||||
float dB = fast_coefficient_to_dB (pos);
|
||||
if (pos == 0.0) {
|
||||
_surface->write (display (1, " 0.0"));
|
||||
} else {
|
||||
char buf[16];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%6.1f", dB);
|
||||
_surface->write (display (1, buf));
|
||||
}
|
||||
|
||||
queue_display_reset (500);
|
||||
queue_display_reset (3000);
|
||||
_last_gain_position_written = pos;
|
||||
|
||||
} else {
|
||||
@@ -371,17 +363,13 @@ Strip::notify_panner_changed (bool force_update)
|
||||
if (_surface->mcp().flip_mode()) {
|
||||
|
||||
_surface->write (_fader->set_position (pos));
|
||||
|
||||
do_parameter_display (PanAzimuthAutomation, pos);
|
||||
} else {
|
||||
_surface->write (_vpot->set_all (pos, true, Pot::dot));
|
||||
do_parameter_display (PanAzimuthAutomation, pos);
|
||||
}
|
||||
|
||||
if (pannable->panner()) {
|
||||
string str = pannable->panner()->value_as_string (pannable->pan_azimuth_control);
|
||||
_surface->write (display (1, str));
|
||||
queue_display_reset (500);
|
||||
}
|
||||
|
||||
|
||||
queue_display_reset (3000);
|
||||
_last_pan_position_written = pos;
|
||||
}
|
||||
}
|
||||
@@ -433,14 +421,20 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press)));
|
||||
|
||||
bool state = (bs == press);
|
||||
|
||||
_fader->set_in_use (state);
|
||||
_fader->start_touch (_surface->mcp().transport_frame(), modified);
|
||||
/* never use the modified control for fader stuff */
|
||||
|
||||
if (bs != press) {
|
||||
/* fader touch ended, revert back to label display for fader */
|
||||
_surface->write (display (1, static_display_string()));
|
||||
if (bs == press) {
|
||||
|
||||
_fader->set_in_use (true);
|
||||
_fader->start_touch (_surface->mcp().transport_frame(), false);
|
||||
boost::shared_ptr<AutomationControl> ac = _fader->control (false);
|
||||
if (ac) {
|
||||
do_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value()));
|
||||
queue_display_reset (3000);
|
||||
}
|
||||
} else {
|
||||
_fader->set_in_use (false);
|
||||
_fader->stop_touch (_surface->mcp().transport_frame(), true, false);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -490,6 +484,37 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Strip::do_parameter_display (AutomationType type, float val)
|
||||
{
|
||||
float dB;
|
||||
|
||||
switch (type) {
|
||||
case GainAutomation:
|
||||
dB = fast_coefficient_to_dB (val);
|
||||
if (val == 0.0) {
|
||||
_surface->write (display (1, " -inf "));
|
||||
} else {
|
||||
char buf[16];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%6.1f", dB);
|
||||
_surface->write (display (1, buf));
|
||||
}
|
||||
break;
|
||||
|
||||
case PanAzimuthAutomation:
|
||||
if (_route) {
|
||||
boost::shared_ptr<Pannable> p = _route->pannable();
|
||||
if (p) {
|
||||
string str = p->panner()->value_as_string (p->pan_azimuth_control);
|
||||
_surface->write (display (1, str));
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Strip::handle_fader (Fader& fader, float position)
|
||||
{
|
||||
@@ -499,11 +524,8 @@ Strip::handle_fader (Fader& fader, float position)
|
||||
|
||||
fader.set_value (position, modified);
|
||||
fader.start_touch (_surface->mcp().transport_frame(), modified);
|
||||
queue_display_reset (3000);
|
||||
|
||||
if (!_surface->mcp().device_info().has_touch_sense_faders()) {
|
||||
_surface->mcp().add_in_use_timeout (*_surface, fader, fader.control (modified));
|
||||
}
|
||||
|
||||
// must echo bytes back to slider now, because
|
||||
// the notifier only works if the fader is not being
|
||||
// touched. Which it is if we're getting input.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "pbd/property_basics.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour/types.h"
|
||||
#include "control_protocol/types.h"
|
||||
|
||||
#include "control_group.h"
|
||||
@@ -114,6 +115,7 @@ private:
|
||||
void queue_display_reset (uint32_t msecs);
|
||||
void clear_display_reset ();
|
||||
void reset_display ();
|
||||
void do_parameter_display (ARDOUR::AutomationType, float val);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user