Allow route groups to color their tracks (remainder of

#4064).


git-svn-id: svn://localhost/ardour2/branches/3.0@10043 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-08-31 19:14:12 +00:00
parent f3a6b8a9ba
commit 881b5a43e7
11 changed files with 73 additions and 15 deletions

View File

@ -517,6 +517,15 @@ GroupTabs::set_group_color (RouteGroup* group, Gdk::Color color)
char buf[64];
snprintf (buf, sizeof (buf), "%d:%d:%d", color.get_red(), color.get_green(), color.get_blue());
gui_state.set (group_gui_id (group), "color", buf);
/* This is a bit of a hack, but this might change
our route's effective color, so emit gui_changed
for our routes.
*/
for (RouteList::iterator i = group->route_list()->begin(); i != group->route_list()->end(); ++i) {
(*i)->gui_changed (X_("color"), 0);
}
}
/** @return the ID string to use for the GUI state of a route group */

View File

@ -375,10 +375,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
revert_to_default_display ();
if (set_color_from_route()) {
set_color (unique_random_color());
}
if (route()->is_master()) {
solo_button->hide ();
below_panner_box.hide ();

View File

@ -45,6 +45,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
, _select (_("Selection"))
, _edit (_("Editing"))
, _route_active (_("Route active state"))
, _share_color (_("Color"))
{
set_modal (true);
set_skip_taskbar_hint (true);
@ -84,6 +85,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
_name.set_text (_group->name ());
_active.set_active (_group->is_active ());
_color.set_color (GroupTabs::group_color (_group));
VBox* options_box = manage (new VBox);
options_box->set_spacing (6);
@ -102,10 +104,11 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
_select.set_active (_group->is_select());
_edit.set_active (_group->is_edit());
_route_active.set_active (_group->is_route_active());
_color.set_color (GroupTabs::group_color (_group));
_share_color.set_active (_group->is_color());
_name.signal_changed().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_color.signal_color_set().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_gain.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_relative.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_mute.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
@ -114,8 +117,8 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
_select.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_edit.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_route_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_color.signal_color_set().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
_share_color.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update));
gain_toggled ();
Table* table = manage (new Table (11, 4, false));
@ -138,7 +141,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
table->attach (_select, 1, 3, 6, 7, Gtk::FILL, Gtk::FILL, 0, 0);
table->attach (_edit, 1, 3, 7, 8, Gtk::FILL, Gtk::FILL, 0, 0);
table->attach (_route_active, 1, 3, 8, 9, Gtk::FILL, Gtk::FILL, 0, 0);
table->attach (_share_color, 1, 3, 9, 10, Gtk::FILL, Gtk::FILL, 0, 0);
options_box->pack_start (*table, false, true);
main_vbox->pack_start (*options_box, false, true);
@ -206,10 +209,11 @@ RouteGroupDialog::update ()
plist.add (Properties::relative, _relative.get_active());
plist.add (Properties::active, _active.get_active());
plist.add (Properties::name, string (_name.get_text()));
plist.add (Properties::color, _share_color.get_active());
GroupTabs::set_group_color (_group, _color.get_color ());
_group->apply_changes (plist);
GroupTabs::set_group_color (_group, _color.get_color ());
}
void

View File

@ -48,6 +48,7 @@ private:
Gtk::CheckButton _select;
Gtk::CheckButton _edit;
Gtk::CheckButton _route_active;
Gtk::CheckButton _share_color;
Gtk::Button* _ok;
Gtk::ColorButton _color;

View File

@ -914,7 +914,7 @@ void
RouteTimeAxisView::route_color_changed ()
{
if (_view) {
_view->apply_color (_color, StreamView::RegionColor);
_view->apply_color (color(), StreamView::RegionColor);
}
}
@ -2487,3 +2487,4 @@ RouteTimeAxisView::state_id() const
{
return string_compose ("rtav %1", _route->id().to_s());
}

View File

@ -44,6 +44,7 @@
#include "mixer_strip.h"
#include "automation_time_axis.h"
#include "route_time_axis.h"
#include "group_tabs.h"
#include "ardour/route.h"
#include "ardour/event_type_map.h"
@ -1809,3 +1810,18 @@ RouteUI::route_gui_changed (string what_changed)
}
}
}
/** @return the color that this route should use; it maybe its own,
or it maybe that of its route group.
*/
Gdk::Color
RouteUI::color () const
{
RouteGroup* g = _route->route_group ();
if (g && g->is_color()) {
return GroupTabs::group_color (g);
}
return _color;
}

View File

@ -57,6 +57,8 @@ class RouteUI : public virtual AxisView
virtual ~RouteUI();
Gdk::Color color () const;
virtual void set_route (boost::shared_ptr<ARDOUR::Route>);
virtual void set_button_names () = 0;

View File

@ -357,7 +357,7 @@ StreamView::diskstream_changed ()
}
void
StreamView::apply_color (Gdk::Color& color, ColorTarget target)
StreamView::apply_color (Gdk::Color color, ColorTarget target)
{
list<RegionView *>::iterator i;

View File

@ -89,7 +89,7 @@ public:
};
Gdk::Color get_region_color () const { return region_color; }
void apply_color (Gdk::Color&, ColorTarget t);
void apply_color (Gdk::Color, ColorTarget t);
uint32_t num_selected_regionviews () const;

View File

@ -44,6 +44,7 @@ namespace Properties {
extern PBD::PropertyDescriptor<bool> select;
extern PBD::PropertyDescriptor<bool> edit;
extern PBD::PropertyDescriptor<bool> route_active;
extern PBD::PropertyDescriptor<bool> color;
/* we use this, but its declared in region.cc */
extern PBD::PropertyDescriptor<bool> hidden;
};
@ -71,6 +72,7 @@ class RouteGroup : public SessionObject
bool is_select () const { return _select.val(); }
bool is_edit () const { return _edit.val(); }
bool is_route_active () const { return _route_active.val(); }
bool is_color () const { return _color.val(); }
bool empty() const {return routes->empty();}
size_t size() const { return routes->size();}
@ -89,6 +91,7 @@ class RouteGroup : public SessionObject
void set_select (bool yn);
void set_edit (bool yn);
void set_route_active (bool yn);
void set_color (bool yn);
bool enabled_property (PBD::PropertyID);
@ -141,6 +144,7 @@ private:
PBD::Property<bool> _select;
PBD::Property<bool> _edit;
PBD::Property<bool> _route_active;
PBD::Property<bool> _color;
void remove_when_going_away (boost::weak_ptr<Route>);
int set_state_2X (const XMLNode&, int);

View File

@ -51,6 +51,7 @@ namespace ARDOUR {
PropertyDescriptor<bool> select;
PropertyDescriptor<bool> edit;
PropertyDescriptor<bool> route_active;
PropertyDescriptor<bool> color;
}
}
@ -77,6 +78,8 @@ RouteGroup::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for edit = %1\n", Properties::edit.property_id));
Properties::route_active.property_id = g_quark_from_static_string (X_("route-active"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for route-active = %1\n", Properties::route_active.property_id));
Properties::color.property_id = g_quark_from_static_string (X_("color"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for color = %1\n", Properties::color.property_id));
}
#define ROUTE_GROUP_DEFAULT_PROPERTIES _relative (Properties::relative, false) \
@ -88,7 +91,8 @@ RouteGroup::make_property_quarks ()
, _recenable (Properties::recenable, false) \
, _select (Properties::select, false) \
, _edit (Properties::edit, false) \
, _route_active (Properties::route_active, false)
, _route_active (Properties::route_active, false) \
, _color (Properties::color, false)
RouteGroup::RouteGroup (Session& s, const string &n)
: SessionObject (s, n)
@ -107,6 +111,7 @@ RouteGroup::RouteGroup (Session& s, const string &n)
add_property (_select);
add_property (_edit);
add_property (_route_active);
add_property (_color);
}
RouteGroup::~RouteGroup ()
@ -282,6 +287,7 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
_recenable = true;
_edit = false;
_route_active = true;
_color = false;
} else if (node.name() == "EditGroup") {
_gain = false;
_mute = false;
@ -289,6 +295,7 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
_recenable = false;
_edit = true;
_route_active = false;
_color = false;
}
return 0;
@ -357,6 +364,24 @@ RouteGroup::set_route_active (bool yn)
_route_active = yn;
}
void
RouteGroup::set_color (bool yn)
{
if (is_color() == yn) {
return;
}
_color = yn;
/* This is a bit of a hack, but this might change
our route's effective color, so emit gui_changed
for our routes.
*/
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
(*i)->gui_changed (X_("color"), this);
}
}
void
RouteGroup::set_active (bool yn, void* /*src*/)
{
@ -399,7 +424,7 @@ RouteGroup::set_hidden (bool yn, void* /*src*/)
}
}
PropertyChanged (Properties::hidden); /* EMIT SIGNAL */
send_change (Properties::hidden);
_session.set_dirty ();
}