Tidy up route colouring a bit so that colours are the

same for both the time axis view and the mixer strip.


git-svn-id: svn://localhost/ardour2/branches/3.0@10035 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-08-30 15:44:00 +00:00
parent e400a2ea24
commit 3b018f6902
7 changed files with 42 additions and 31 deletions

View File

@ -45,12 +45,8 @@ namespace ARDOUR {
class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
/**
* Returns the current 'Track' Color
*
* @return the current Track Color
*/
Gdk::Color color() const { return _color; }
/** @return the track's own color */
Gdk::Color color () const { return _color; }
ARDOUR::Session* session() const { return _session; }

View File

@ -469,7 +469,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
}
_route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
_route->gui_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::route_gui_changed, this, _1, _2), gui_context());
set_stuff_from_route ();
@ -918,7 +917,7 @@ MixerStrip::update_diskstream_display ()
input_selector->hide_all ();
}
show_route_color ();
route_color_changed ();
} else {
@ -1317,21 +1316,8 @@ MixerStrip::route_group_changed ()
}
}
void
MixerStrip::route_gui_changed (string what_changed, void*)
{
ENSURE_GUI_THREAD (*this, &MixerStrip::route_gui_changed, what_changed, ignored)
if (what_changed == "color") {
if (set_color_from_route () == 0) {
show_route_color ();
}
}
}
void
MixerStrip::show_route_color ()
MixerStrip::route_color_changed ()
{
name_button.modify_bg (STATE_NORMAL, color());
top_event_box.modify_bg (STATE_NORMAL, color());

View File

@ -264,8 +264,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
Gtk::Style *passthru_style;
void route_gui_changed (std::string, void*);
void show_route_color ();
void route_color_changed ();
void show_passthru_color ();
void name_changed ();

View File

@ -911,10 +911,8 @@ RouteTimeAxisView::set_height (uint32_t h)
}
void
RouteTimeAxisView::set_color (Gdk::Color const & c)
RouteTimeAxisView::route_color_changed ()
{
RouteUI::set_color (c);
if (_view) {
_view->apply_color (_color, StreamView::RegionColor);
}

View File

@ -212,8 +212,6 @@ protected:
void reset_samples_per_unit ();
void horizontal_position_changed ();
void set_color (Gdk::Color const &);
virtual void build_automation_action_menu (bool);
virtual void append_extra_display_menu_items () {}
void build_display_menu ();
@ -246,6 +244,8 @@ protected:
void setup_processor_menu_and_curves ();
void route_color_changed ();
boost::shared_ptr<AutomationTimeAxisView> gain_track;
StreamView* _view;

View File

@ -206,6 +206,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_route->PropertyChanged.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::property_changed, this, _1), gui_context());
_route->io_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::setup_invert_buttons, this), gui_context ());
_route->gui_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::route_gui_changed, this, _1), gui_context ());
if (_session->writable() && is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
@ -1258,6 +1259,9 @@ RouteUI::choose_color ()
}
}
/** Set the route's own color. This may not be used for display if
* the route is in a group which shares its color with its routes.
*/
void
RouteUI::set_color (const Gdk::Color & c)
{
@ -1266,14 +1270,26 @@ RouteUI::set_color (const Gdk::Color & c)
_color = c;
snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue());
set_gui_property ("color", buf);
/* note: we use the route state ID here so that color is the same for both
the time axis view and the mixer strip
*/
gui_object_state().set<string> (route_state_id(), X_("color"), buf);
_route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
}
/** @return GUI state ID for things that are common to the route in all its representations */
string
RouteUI::route_state_id () const
{
return string_compose (X_("route %1"), _route->id().to_s());
}
int
RouteUI::set_color_from_route ()
{
const string str = gui_property ("color");
const string str = gui_object_state().get_string (route_state_id(), X_("color"));
if (str.empty()) {
return 1;
@ -1782,3 +1798,14 @@ RouteUI::request_redraw ()
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
}
}
/** The Route's gui_changed signal has been emitted */
void
RouteUI::route_gui_changed (string what_changed)
{
if (what_changed == "color") {
if (set_color_from_route () == 0) {
route_color_changed ();
}
}
}

View File

@ -222,11 +222,16 @@ class RouteUI : public virtual AxisView
void set_invert_sensitive (bool);
bool verify_new_route_name (const std::string& name);
void route_gui_changed (std::string);
virtual void route_color_changed () {}
private:
void check_rec_enable_sensitivity ();
void parameter_changed (std::string const &);
void relabel_solo_button ();
std::string route_state_id () const;
struct SoloMuteRelease {
SoloMuteRelease (bool was_active)
: active (was_active)