Update stripable color on the fly
This commit is contained in:
parent
dc98fa6f3f
commit
35407c7fe8
@ -74,6 +74,7 @@ StripableColorDialog::reset ()
|
|||||||
_stripable->set_active_color_picker (0);
|
_stripable->set_active_color_picker (0);
|
||||||
}
|
}
|
||||||
_stripable.reset ();
|
_stripable.reset ();
|
||||||
|
_color_changed_connection.disconnect ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -91,15 +92,17 @@ StripableColorDialog::popup (boost::shared_ptr<ARDOUR::Stripable> s)
|
|||||||
|
|
||||||
_stripable = s;
|
_stripable = s;
|
||||||
_stripable->set_active_color_picker (this);
|
_stripable->set_active_color_picker (this);
|
||||||
|
_initial_color = _stripable->presentation_info().color ();
|
||||||
set_title (string_compose (_("Color Selection: %1"), s->name()));
|
set_title (string_compose (_("Color Selection: %1"), s->name()));
|
||||||
|
|
||||||
get_colorsel()->set_has_opacity_control (false);
|
get_colorsel()->set_has_opacity_control (false);
|
||||||
get_colorsel()->set_has_palette (true);
|
get_colorsel()->set_has_palette (true);
|
||||||
|
|
||||||
Gdk::Color c = gdk_color_from_rgba (_stripable->presentation_info().color ());
|
Gdk::Color c = gdk_color_from_rgba (_initial_color);
|
||||||
|
|
||||||
get_colorsel()->set_previous_color (c);
|
get_colorsel()->set_previous_color (c);
|
||||||
get_colorsel()->set_current_color (c);
|
get_colorsel()->set_current_color (c);
|
||||||
|
_color_changed_connection = get_colorsel()->signal_color_changed().connect (sigc::mem_fun (*this, &StripableColorDialog::color_changed));
|
||||||
|
|
||||||
present ();
|
present ();
|
||||||
}
|
}
|
||||||
@ -109,6 +112,16 @@ StripableColorDialog::finish_color_edit (int response)
|
|||||||
{
|
{
|
||||||
if (_stripable && response == RESPONSE_OK) {
|
if (_stripable && response == RESPONSE_OK) {
|
||||||
_stripable->presentation_info().set_color (gdk_color_to_rgba (get_colorsel()->get_current_color()));
|
_stripable->presentation_info().set_color (gdk_color_to_rgba (get_colorsel()->get_current_color()));
|
||||||
|
} else {
|
||||||
|
_stripable->presentation_info().set_color (_initial_color);
|
||||||
}
|
}
|
||||||
reset ();
|
reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StripableColorDialog::color_changed ()
|
||||||
|
{
|
||||||
|
if (_stripable) {
|
||||||
|
_stripable->presentation_info().set_color (gdk_color_to_rgba (get_colorsel()->get_current_color()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -34,8 +34,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
void initialize_color_palette ();
|
void initialize_color_palette ();
|
||||||
void finish_color_edit (int response);
|
void finish_color_edit (int response);
|
||||||
|
void color_changed ();
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Stripable> _stripable;
|
boost::shared_ptr<ARDOUR::Stripable> _stripable;
|
||||||
|
ARDOUR::PresentationInfo::color_t _initial_color;
|
||||||
|
|
||||||
|
sigc::connection _color_changed_connection;
|
||||||
|
|
||||||
|
|
||||||
static bool palette_initialized;
|
static bool palette_initialized;
|
||||||
|
Loading…
Reference in New Issue
Block a user