mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
substantial changes in color management, involving a reduction in the use of Gdk::Color and more consistent logic for region coloring.
Group tabs now also get the text drawn in an appropriately contrast-y color
This commit is contained in:
parent
438179d278
commit
ce08ec0de0
31 changed files with 287 additions and 259 deletions
|
|
@ -76,7 +76,7 @@ static const int32_t sync_mark_width = 9;
|
||||||
static double const handle_size = 10; /* height of fade handles */
|
static double const handle_size = 10; /* height of fade handles */
|
||||||
|
|
||||||
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||||
Gdk::Color const & basic_color)
|
uint32_t basic_color)
|
||||||
: RegionView (parent, tv, r, spu, basic_color)
|
: RegionView (parent, tv, r, spu, basic_color)
|
||||||
, sync_mark(0)
|
, sync_mark(0)
|
||||||
, fade_in_handle(0)
|
, fade_in_handle(0)
|
||||||
|
|
@ -90,7 +90,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
|
||||||
, end_xfade_rect (0)
|
, end_xfade_rect (0)
|
||||||
, _end_xfade_visible (false)
|
, _end_xfade_visible (false)
|
||||||
, _amplitude_above_axis(1.0)
|
, _amplitude_above_axis(1.0)
|
||||||
, fade_color(0)
|
|
||||||
, trim_fade_in_drag_active(false)
|
, trim_fade_in_drag_active(false)
|
||||||
, trim_fade_out_drag_active(false)
|
, trim_fade_out_drag_active(false)
|
||||||
{
|
{
|
||||||
|
|
@ -98,7 +97,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||||
Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
|
uint32_t basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
|
||||||
: RegionView (parent, tv, r, spu, basic_color, recording, visibility)
|
: RegionView (parent, tv, r, spu, basic_color, recording, visibility)
|
||||||
, sync_mark(0)
|
, sync_mark(0)
|
||||||
, fade_in_handle(0)
|
, fade_in_handle(0)
|
||||||
|
|
@ -112,7 +111,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
|
||||||
, end_xfade_rect (0)
|
, end_xfade_rect (0)
|
||||||
, _end_xfade_visible (false)
|
, _end_xfade_visible (false)
|
||||||
, _amplitude_above_axis(1.0)
|
, _amplitude_above_axis(1.0)
|
||||||
, fade_color(0)
|
|
||||||
, trim_fade_in_drag_active(false)
|
, trim_fade_in_drag_active(false)
|
||||||
, trim_fade_out_drag_active(false)
|
, trim_fade_out_drag_active(false)
|
||||||
{
|
{
|
||||||
|
|
@ -132,33 +130,24 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt
|
||||||
, end_xfade_rect (0)
|
, end_xfade_rect (0)
|
||||||
, _end_xfade_visible (false)
|
, _end_xfade_visible (false)
|
||||||
, _amplitude_above_axis (other._amplitude_above_axis)
|
, _amplitude_above_axis (other._amplitude_above_axis)
|
||||||
, fade_color(0)
|
|
||||||
, trim_fade_in_drag_active(false)
|
, trim_fade_in_drag_active(false)
|
||||||
, trim_fade_out_drag_active(false)
|
, trim_fade_out_drag_active(false)
|
||||||
{
|
{
|
||||||
Gdk::Color c;
|
init (true);
|
||||||
int r,g,b,a;
|
|
||||||
|
|
||||||
UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
|
|
||||||
c.set_rgb_p (r/255.0, g/255.0, b/255.0);
|
|
||||||
|
|
||||||
init (c, true);
|
|
||||||
|
|
||||||
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
|
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
AudioRegionView::init (bool wfd)
|
||||||
{
|
{
|
||||||
// FIXME: Some redundancy here with RegionView::init. Need to figure out
|
// FIXME: Some redundancy here with RegionView::init. Need to figure out
|
||||||
// where order is important and where it isn't...
|
// where order is important and where it isn't...
|
||||||
|
|
||||||
RegionView::init (basic_color, wfd);
|
RegionView::init (wfd);
|
||||||
|
|
||||||
_amplitude_above_axis = 1.0;
|
_amplitude_above_axis = 1.0;
|
||||||
|
|
||||||
compute_colors (basic_color);
|
|
||||||
|
|
||||||
create_waves ();
|
create_waves ();
|
||||||
|
|
||||||
if (!_recregion) {
|
if (!_recregion) {
|
||||||
|
|
@ -995,16 +984,6 @@ AudioRegionView::set_amplitude_above_axis (gdouble a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
AudioRegionView::compute_colors (Gdk::Color const & basic_color)
|
|
||||||
{
|
|
||||||
RegionView::compute_colors (basic_color);
|
|
||||||
|
|
||||||
/* gain color computed in envelope_active_changed() */
|
|
||||||
|
|
||||||
fade_color = UINT_RGBA_CHANGE_A (fill_color, 120);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioRegionView::set_colors ()
|
AudioRegionView::set_colors ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,13 @@ class AudioRegionView : public RegionView
|
||||||
RouteTimeAxisView&,
|
RouteTimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::AudioRegion>,
|
boost::shared_ptr<ARDOUR::AudioRegion>,
|
||||||
double initial_samples_per_pixel,
|
double initial_samples_per_pixel,
|
||||||
Gdk::Color const & basic_color);
|
uint32_t base_color);
|
||||||
|
|
||||||
AudioRegionView (ArdourCanvas::Group *,
|
AudioRegionView (ArdourCanvas::Group *,
|
||||||
RouteTimeAxisView&,
|
RouteTimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::AudioRegion>,
|
boost::shared_ptr<ARDOUR::AudioRegion>,
|
||||||
double samples_per_pixel,
|
double samples_per_pixel,
|
||||||
Gdk::Color const & basic_color,
|
uint32_t base_color,
|
||||||
bool recording,
|
bool recording,
|
||||||
TimeAxisViewItem::Visibility);
|
TimeAxisViewItem::Visibility);
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ class AudioRegionView : public RegionView
|
||||||
|
|
||||||
~AudioRegionView ();
|
~AudioRegionView ();
|
||||||
|
|
||||||
virtual void init (Gdk::Color const & base_color, bool wait_for_data);
|
void init (bool wait_for_data);
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
|
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
|
||||||
|
|
||||||
|
|
@ -173,8 +173,6 @@ class AudioRegionView : public RegionView
|
||||||
|
|
||||||
double _amplitude_above_axis;
|
double _amplitude_above_axis;
|
||||||
|
|
||||||
uint32_t fade_color;
|
|
||||||
|
|
||||||
void reset_fade_shapes ();
|
void reset_fade_shapes ();
|
||||||
void reset_fade_in_shape ();
|
void reset_fade_in_shape ();
|
||||||
void reset_fade_out_shape ();
|
void reset_fade_out_shape ();
|
||||||
|
|
@ -193,7 +191,6 @@ class AudioRegionView : public RegionView
|
||||||
|
|
||||||
void set_colors ();
|
void set_colors ();
|
||||||
void set_waveform_colors ();
|
void set_waveform_colors ();
|
||||||
void compute_colors (Gdk::Color const &);
|
|
||||||
void reset_width_dependent_items (double pixel_width);
|
void reset_width_dependent_items (double pixel_width);
|
||||||
void set_frame_color ();
|
void set_frame_color ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
region_view->init (region_color, wait_for_waves);
|
region_view->init (wait_for_waves);
|
||||||
region_view->set_amplitude_above_axis(_amplitude_above_axis);
|
region_view->set_amplitude_above_axis(_amplitude_above_axis);
|
||||||
region_view->set_height (child_height ());
|
region_view->set_height (child_height ());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
|
||||||
|
|
||||||
RouteTimeAxisView::set_route (rt);
|
RouteTimeAxisView::set_route (rt);
|
||||||
|
|
||||||
_view->apply_color (color (), StreamView::RegionColor);
|
_view->apply_color (gdk_color_to_rgba (color()), StreamView::RegionColor);
|
||||||
|
|
||||||
// Make sure things are sane...
|
// Make sure things are sane...
|
||||||
assert(!is_track() || is_audio_track());
|
assert(!is_track() || is_audio_track());
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ AutomationRegionView::AutomationRegionView (ArdourCanvas::Group*
|
||||||
const Evoral::Parameter& param,
|
const Evoral::Parameter& param,
|
||||||
boost::shared_ptr<ARDOUR::AutomationList> list,
|
boost::shared_ptr<ARDOUR::AutomationList> list,
|
||||||
double spu,
|
double spu,
|
||||||
Gdk::Color const & basic_color)
|
uint32_t basic_color)
|
||||||
: RegionView(parent, time_axis, region, spu, basic_color, true)
|
: RegionView(parent, time_axis, region, spu, basic_color, true)
|
||||||
, _parameter(param)
|
, _parameter(param)
|
||||||
{
|
{
|
||||||
|
|
@ -63,13 +63,11 @@ AutomationRegionView::~AutomationRegionView ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
|
AutomationRegionView::init (bool /*wfd*/)
|
||||||
{
|
{
|
||||||
_enable_display = false;
|
_enable_display = false;
|
||||||
|
|
||||||
RegionView::init(basic_color, false);
|
RegionView::init (false);
|
||||||
|
|
||||||
compute_colors (basic_color);
|
|
||||||
|
|
||||||
reset_width_dependent_items ((double) _region->length() / samples_per_pixel);
|
reset_width_dependent_items ((double) _region->length() / samples_per_pixel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ public:
|
||||||
const Evoral::Parameter& parameter,
|
const Evoral::Parameter& parameter,
|
||||||
boost::shared_ptr<ARDOUR::AutomationList>,
|
boost::shared_ptr<ARDOUR::AutomationList>,
|
||||||
double initial_samples_per_pixel,
|
double initial_samples_per_pixel,
|
||||||
Gdk::Color const & basic_color);
|
uint32_t basic_color);
|
||||||
|
|
||||||
~AutomationRegionView();
|
~AutomationRegionView();
|
||||||
|
|
||||||
void init (Gdk::Color const & basic_color, bool wfd);
|
void init (bool wfd);
|
||||||
|
|
||||||
inline AutomationTimeAxisView* automation_view() const
|
inline AutomationTimeAxisView* automation_view() const
|
||||||
{ return dynamic_cast<AutomationTimeAxisView*>(&trackview); }
|
{ return dynamic_cast<AutomationTimeAxisView*>(&trackview); }
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
|
||||||
_samples_per_pixel, region_color
|
_samples_per_pixel, region_color
|
||||||
);
|
);
|
||||||
|
|
||||||
region_view->init (region_color, false);
|
region_view->init (false);
|
||||||
region_views.push_front (region_view);
|
region_views.push_front (region_view);
|
||||||
|
|
||||||
/* follow global waveform setting */
|
/* follow global waveform setting */
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
|
||||||
*/
|
*/
|
||||||
static Gdk::Color unique_random_color();
|
static Gdk::Color unique_random_color();
|
||||||
|
|
||||||
|
|
||||||
Gdk::Color _color;
|
Gdk::Color _color;
|
||||||
|
|
||||||
static std::list<Gdk::Color> used_colors;
|
static std::list<Gdk::Color> used_colors;
|
||||||
|
|
|
||||||
|
|
@ -743,7 +743,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
|
||||||
|
|
||||||
if (first_move) {
|
if (first_move) {
|
||||||
rv->drag_start ();
|
rv->drag_start ();
|
||||||
rv->fake_set_opaque (true);
|
rv->set_opacity_for_drag (true);
|
||||||
|
|
||||||
/* reparent the regionview into a group above all
|
/* reparent the regionview into a group above all
|
||||||
* others
|
* others
|
||||||
|
|
@ -938,6 +938,10 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
|
||||||
void
|
void
|
||||||
RegionMotionDrag::finished (GdkEvent *, bool)
|
RegionMotionDrag::finished (GdkEvent *, bool)
|
||||||
{
|
{
|
||||||
|
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
|
i->view->set_opacity_for_drag (false);
|
||||||
|
}
|
||||||
|
|
||||||
for (vector<TimeAxisView*>::iterator i = _time_axis_views.begin(); i != _time_axis_views.end(); ++i) {
|
for (vector<TimeAxisView*>::iterator i = _time_axis_views.begin(); i != _time_axis_views.end(); ++i) {
|
||||||
if (!(*i)->view()) {
|
if (!(*i)->view()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1196,7 +1200,7 @@ RegionMoveDrag::finished_no_copy (
|
||||||
visible.
|
visible.
|
||||||
*/
|
*/
|
||||||
rv->hide_region_editor();
|
rv->hide_region_editor();
|
||||||
rv->fake_set_opaque (false);
|
rv->set_opacity_for_drag (false);
|
||||||
|
|
||||||
remove_region_from_playlist (rv->region(), i->initial_playlist, modified_playlists);
|
remove_region_from_playlist (rv->region(), i->initial_playlist, modified_playlists);
|
||||||
|
|
||||||
|
|
@ -1431,7 +1435,7 @@ RegionMotionDrag::aborted (bool)
|
||||||
rv->get_canvas_group()->reparent (rtv->view()->canvas_item());
|
rv->get_canvas_group()->reparent (rtv->view()->canvas_item());
|
||||||
rv->get_canvas_group()->set_y_position (0);
|
rv->get_canvas_group()->set_y_position (0);
|
||||||
rv->drag_end ();
|
rv->drag_end ();
|
||||||
rv->fake_set_opaque (false);
|
rv->set_opacity_for_drag (false);
|
||||||
rv->move (-_total_x_delta, 0);
|
rv->move (-_total_x_delta, 0);
|
||||||
rv->set_height (rtv->view()->child_height ());
|
rv->set_height (rtv->view()->child_height ());
|
||||||
}
|
}
|
||||||
|
|
@ -1833,7 +1837,7 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
|
||||||
DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt));
|
DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt));
|
||||||
if (first_move) {
|
if (first_move) {
|
||||||
rv->drag_start ();
|
rv->drag_start ();
|
||||||
rv->fake_set_opaque (true);
|
rv->set_opacity_for_drag (true);
|
||||||
rv->region()->clear_changes ();
|
rv->region()->clear_changes ();
|
||||||
rv->region()->suspend_property_changes();
|
rv->region()->suspend_property_changes();
|
||||||
}
|
}
|
||||||
|
|
@ -1881,7 +1885,7 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
|
||||||
|
|
||||||
for (list<AVDraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
for (list<AVDraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
i->view->drag_end();
|
i->view->drag_end();
|
||||||
i->view->fake_set_opaque (false);
|
i->view->set_opacity_for_drag (false);
|
||||||
i->view->region()->resume_property_changes ();
|
i->view->region()->resume_property_changes ();
|
||||||
|
|
||||||
_editor->session()->add_command (new StatefulDiffCommand (i->view->region()));
|
_editor->session()->add_command (new StatefulDiffCommand (i->view->region()));
|
||||||
|
|
@ -2017,7 +2021,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
|
||||||
|
|
||||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
RegionView* rv = i->view;
|
RegionView* rv = i->view;
|
||||||
rv->fake_set_opaque (false);
|
rv->set_opacity_for_drag (false);
|
||||||
rv->enable_display (false);
|
rv->enable_display (false);
|
||||||
rv->region()->playlist()->clear_owned_changes ();
|
rv->region()->playlist()->clear_owned_changes ();
|
||||||
|
|
||||||
|
|
@ -2200,7 +2204,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
i->view->thaw_after_trim ();
|
i->view->thaw_after_trim ();
|
||||||
i->view->enable_display (true);
|
i->view->enable_display (true);
|
||||||
i->view->fake_set_opaque (true);
|
i->view->set_opacity_for_drag (true);
|
||||||
|
|
||||||
/* Trimming one region may affect others on the playlist, so we need
|
/* Trimming one region may affect others on the playlist, so we need
|
||||||
to get undo Commands from the whole playlist rather than just the
|
to get undo Commands from the whole playlist rather than just the
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,17 @@
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "ardour/route_group.h"
|
#include "ardour/route_group.h"
|
||||||
#include "editor_group_tabs.h"
|
|
||||||
|
#include "canvas/utils.h"
|
||||||
|
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
#include "route_time_axis.h"
|
#include "editor_group_tabs.h"
|
||||||
#include "utils.h"
|
|
||||||
#include "editor_route_groups.h"
|
#include "editor_route_groups.h"
|
||||||
#include "editor_routes.h"
|
#include "editor_routes.h"
|
||||||
|
#include "rgb_macros.h"
|
||||||
|
#include "route_time_axis.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -83,13 +88,19 @@ void
|
||||||
EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
||||||
{
|
{
|
||||||
double const arc_radius = get_width();
|
double const arc_radius = get_width();
|
||||||
|
double r, g, b, a;
|
||||||
|
|
||||||
if (tab.group && tab.group->is_active()) {
|
if (tab.group && tab.group->is_active()) {
|
||||||
cairo_set_source_rgba (cr, tab.color.get_red_p (), tab.color.get_green_p (), tab.color.get_blue_p (), 1);
|
ArdourCanvas::color_to_rgba (tab.color, r, g, b, a);
|
||||||
} else {
|
} else {
|
||||||
cairo_set_source_rgba (cr, 1, 1, 1, 0.2);
|
r = 0.0;
|
||||||
|
g = 0.0;
|
||||||
|
b = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a = 1.0;
|
||||||
|
|
||||||
|
cairo_set_source_rgba (cr, r, g, b, a);
|
||||||
cairo_move_to (cr, 0, tab.from + arc_radius);
|
cairo_move_to (cr, 0, tab.from + arc_radius);
|
||||||
cairo_arc (cr, get_width(), tab.from + arc_radius, arc_radius, M_PI, 3 * M_PI / 2);
|
cairo_arc (cr, get_width(), tab.from + arc_radius, arc_radius, M_PI, 3 * M_PI / 2);
|
||||||
cairo_line_to (cr, get_width(), tab.to);
|
cairo_line_to (cr, get_width(), tab.to);
|
||||||
|
|
@ -103,7 +114,10 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
|
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
|
||||||
|
|
||||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
ArdourCanvas::Color c = contrasting_text_color (ArdourCanvas::rgba_to_color (r, g, b, a));
|
||||||
|
ArdourCanvas::color_to_rgba (c, r, g, b, a);
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, r, g, b);
|
||||||
cairo_move_to (cr, get_width() - ext.height / 2, tab.from + (f.second + tab.to - tab.from) / 2);
|
cairo_move_to (cr, get_width() - ext.height / 2, tab.from + (f.second + tab.to - tab.from) / 2);
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_rotate (cr, - M_PI / 2);
|
cairo_rotate (cr, - M_PI / 2);
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
|
||||||
c.set_rgb(0,65535,0); // FIXME: error color from style
|
c.set_rgb(0,65535,0); // FIXME: error color from style
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
set_color(c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
|
set_color_from_rgba (c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,23 +30,23 @@
|
||||||
#include "gtkmm2ext/cell_renderer_color_selector.h"
|
#include "gtkmm2ext/cell_renderer_color_selector.h"
|
||||||
|
|
||||||
#include "ardour/route_group.h"
|
#include "ardour/route_group.h"
|
||||||
|
|
||||||
#include "editor.h"
|
|
||||||
#include "keyboard.h"
|
|
||||||
#include "marker.h"
|
|
||||||
#include "time_axis_view.h"
|
|
||||||
#include "prompter.h"
|
|
||||||
#include "gui_thread.h"
|
|
||||||
#include "editor_group_tabs.h"
|
|
||||||
#include "route_group_dialog.h"
|
|
||||||
#include "route_time_axis.h"
|
|
||||||
#include "editor_routes.h"
|
|
||||||
#include "editor_route_groups.h"
|
|
||||||
#include "ardour_ui.h"
|
|
||||||
|
|
||||||
#include "ardour/route.h"
|
#include "ardour/route.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
|
||||||
|
#include "ardour_ui.h"
|
||||||
|
#include "editor.h"
|
||||||
|
#include "editor_group_tabs.h"
|
||||||
|
#include "editor_route_groups.h"
|
||||||
|
#include "editor_routes.h"
|
||||||
|
#include "gui_thread.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "marker.h"
|
||||||
|
#include "prompter.h"
|
||||||
|
#include "route_group_dialog.h"
|
||||||
|
#include "route_time_axis.h"
|
||||||
|
#include "time_axis_view.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -72,6 +72,7 @@ EditorRouteGroups::EditorRouteGroups (Editor* e)
|
||||||
|
|
||||||
Gtkmm2ext::CellRendererColorSelector* color_renderer = manage (new Gtkmm2ext::CellRendererColorSelector);
|
Gtkmm2ext::CellRendererColorSelector* color_renderer = manage (new Gtkmm2ext::CellRendererColorSelector);
|
||||||
TreeViewColumn* color_column = manage (new TreeViewColumn ("", *color_renderer));
|
TreeViewColumn* color_column = manage (new TreeViewColumn ("", *color_renderer));
|
||||||
|
|
||||||
color_column->add_attribute (color_renderer->property_color(), _columns.gdkcolor);
|
color_column->add_attribute (color_renderer->property_color(), _columns.gdkcolor);
|
||||||
|
|
||||||
_display.append_column (*color_column);
|
_display.append_column (*color_column);
|
||||||
|
|
@ -269,7 +270,6 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev)
|
||||||
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
||||||
case 0:
|
case 0:
|
||||||
c = (*iter)[_columns.gdkcolor];
|
c = (*iter)[_columns.gdkcolor];
|
||||||
|
|
||||||
color_dialog.get_colorsel()->set_previous_color (c);
|
color_dialog.get_colorsel()->set_previous_color (c);
|
||||||
color_dialog.get_colorsel()->set_current_color (c);
|
color_dialog.get_colorsel()->set_current_color (c);
|
||||||
|
|
||||||
|
|
@ -278,7 +278,7 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev)
|
||||||
break;
|
break;
|
||||||
case RESPONSE_ACCEPT:
|
case RESPONSE_ACCEPT:
|
||||||
c = color_dialog.get_colorsel()->get_current_color();
|
c = color_dialog.get_colorsel()->get_current_color();
|
||||||
GroupTabs::set_group_color (group, c);
|
GroupTabs::set_group_color (group, gdk_color_to_rgba (c));
|
||||||
ARDOUR_UI::config()->set_dirty ();
|
ARDOUR_UI::config()->set_dirty ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -409,7 +409,7 @@ EditorRouteGroups::row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel
|
||||||
|
|
||||||
group->apply_changes (plist);
|
group->apply_changes (plist);
|
||||||
|
|
||||||
GroupTabs::set_group_color ((*iter)[_columns.routegroup], (*iter)[_columns.gdkcolor]);
|
GroupTabs::set_group_color ((*iter)[_columns.routegroup], gdk_color_to_rgba ((*iter)[_columns.gdkcolor]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -430,7 +430,10 @@ EditorRouteGroups::add (RouteGroup* group)
|
||||||
row[_columns.active_shared] = group->is_route_active ();
|
row[_columns.active_shared] = group->is_route_active ();
|
||||||
row[_columns.active_state] = group->is_active ();
|
row[_columns.active_state] = group->is_active ();
|
||||||
row[_columns.is_visible] = !group->is_hidden();
|
row[_columns.is_visible] = !group->is_hidden();
|
||||||
row[_columns.gdkcolor] = GroupTabs::group_color (group);
|
|
||||||
|
Gdk::Color c;
|
||||||
|
set_color_from_rgba (c, GroupTabs::group_color (group));
|
||||||
|
row[_columns.gdkcolor] = c;
|
||||||
|
|
||||||
_in_row_change = true;
|
_in_row_change = true;
|
||||||
|
|
||||||
|
|
@ -500,7 +503,10 @@ EditorRouteGroups::property_changed (RouteGroup* group, const PropertyChange&)
|
||||||
(*iter)[_columns.active_shared] = group->is_route_active ();
|
(*iter)[_columns.active_shared] = group->is_route_active ();
|
||||||
(*iter)[_columns.active_state] = group->is_active ();
|
(*iter)[_columns.active_state] = group->is_active ();
|
||||||
(*iter)[_columns.is_visible] = !group->is_hidden();
|
(*iter)[_columns.is_visible] = !group->is_hidden();
|
||||||
(*iter)[_columns.gdkcolor] = GroupTabs::group_color (group);
|
|
||||||
|
Gdk::Color c;
|
||||||
|
set_color_from_rgba (c, GroupTabs::group_color (group));
|
||||||
|
(*iter)[_columns.gdkcolor] = c;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
|
#include "rgb_macros.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -535,19 +536,30 @@ GroupTabs::remove_group (RouteGroup* g)
|
||||||
|
|
||||||
/** Set the color of the tab of a route group */
|
/** Set the color of the tab of a route group */
|
||||||
void
|
void
|
||||||
GroupTabs::set_group_color (RouteGroup* group, Gdk::Color color)
|
GroupTabs::set_group_color (RouteGroup* group, uint32_t color)
|
||||||
{
|
{
|
||||||
assert (group);
|
assert (group);
|
||||||
|
uint32_t r, g, b, a;
|
||||||
|
|
||||||
|
UINT_TO_RGBA (color, &r, &g, &b, &a);
|
||||||
|
|
||||||
/* Hack to disallow black route groups; force a dark grey instead */
|
/* Hack to disallow black route groups; force a dark grey instead */
|
||||||
if (color.get_red() == 0 && color.get_green() == 0 && color.get_blue() == 0) {
|
|
||||||
color.set_grey_p (0.1);
|
if (r == 0 && g == 0 && b == 0) {
|
||||||
|
r = 25;
|
||||||
|
g = 25;
|
||||||
|
b = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
|
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
|
||||||
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf (buf, sizeof (buf), "%d:%d:%d", color.get_red(), color.get_green(), color.get_blue());
|
|
||||||
|
/* for historical reasons the colors must be stored as 16 bit color
|
||||||
|
* values. Ugh.
|
||||||
|
*/
|
||||||
|
|
||||||
|
snprintf (buf, sizeof (buf), "%d:%d:%d", (r<<8), (g<<8), (b<<8));
|
||||||
gui_state.set_property (group_gui_id (group), "color", buf);
|
gui_state.set_property (group_gui_id (group), "color", buf);
|
||||||
|
|
||||||
/* the group color change notification */
|
/* the group color change notification */
|
||||||
|
|
@ -577,35 +589,35 @@ GroupTabs::group_gui_id (RouteGroup* group)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the color to use for a route group tab */
|
/** @return the color to use for a route group tab */
|
||||||
Gdk::Color
|
uint32_t
|
||||||
GroupTabs::group_color (RouteGroup* group)
|
GroupTabs::group_color (RouteGroup* group)
|
||||||
{
|
{
|
||||||
assert (group);
|
assert (group);
|
||||||
|
|
||||||
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
|
GUIObjectState& gui_state = *ARDOUR_UI::instance()->gui_object_state;
|
||||||
|
|
||||||
string const gui_id = group_gui_id (group);
|
string const gui_id = group_gui_id (group);
|
||||||
|
|
||||||
bool empty;
|
bool empty;
|
||||||
string const color = gui_state.get_string (gui_id, "color", &empty);
|
string const color = gui_state.get_string (gui_id, "color", &empty);
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
/* no color has yet been set, so use a random one */
|
/* no color has yet been set, so use a random one */
|
||||||
Gdk::Color const color = unique_random_color (_used_colors);
|
uint32_t c = gdk_color_to_rgba (unique_random_color (_used_colors));
|
||||||
set_group_color (group, color);
|
set_group_color (group, c);
|
||||||
return color;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Color c;
|
|
||||||
|
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
|
/* for historical reasons, colors are stored as 16 bit values.
|
||||||
|
*/
|
||||||
|
|
||||||
sscanf (color.c_str(), "%d:%d:%d", &r, &g, &b);
|
sscanf (color.c_str(), "%d:%d:%d", &r, &g, &b);
|
||||||
|
|
||||||
c.set_red (r);
|
r /= 256;
|
||||||
c.set_green (g);
|
g /= 256;
|
||||||
c.set_blue (b);
|
b /= 256;
|
||||||
|
|
||||||
return c;
|
return RGBA_TO_UINT (r, g, b, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ public:
|
||||||
|
|
||||||
void run_new_group_dialog (ARDOUR::RouteList const &);
|
void run_new_group_dialog (ARDOUR::RouteList const &);
|
||||||
|
|
||||||
static void set_group_color (ARDOUR::RouteGroup *, Gdk::Color);
|
static void set_group_color (ARDOUR::RouteGroup *, uint32_t);
|
||||||
static std::string group_gui_id (ARDOUR::RouteGroup *);
|
static std::string group_gui_id (ARDOUR::RouteGroup *);
|
||||||
static Gdk::Color group_color (ARDOUR::RouteGroup *);
|
static uint32_t group_color (ARDOUR::RouteGroup *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ protected:
|
||||||
|
|
||||||
double from;
|
double from;
|
||||||
double to;
|
double to;
|
||||||
Gdk::Color color; ///< color
|
uint32_t color; ///< color
|
||||||
ARDOUR::RouteGroup* group; ///< route group
|
ARDOUR::RouteGroup* group; ///< route group
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ PBD::Signal1<void, MidiRegionView *> MidiRegionView::SelectionCleared;
|
||||||
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
||||||
|
|
||||||
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
||||||
boost::shared_ptr<MidiRegion> r, double spu, Gdk::Color const & basic_color)
|
boost::shared_ptr<MidiRegion> r, double spu, uint32_t basic_color)
|
||||||
: RegionView (parent, tv, r, spu, basic_color)
|
: RegionView (parent, tv, r, spu, basic_color)
|
||||||
, _current_range_min(0)
|
, _current_range_min(0)
|
||||||
, _current_range_max(0)
|
, _current_range_max(0)
|
||||||
|
|
@ -125,7 +125,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
||||||
boost::shared_ptr<MidiRegion> r, double spu, Gdk::Color& basic_color,
|
boost::shared_ptr<MidiRegion> r, double spu, uint32_t basic_color,
|
||||||
TimeAxisViewItem::Visibility visibility)
|
TimeAxisViewItem::Visibility visibility)
|
||||||
: RegionView (parent, tv, r, spu, basic_color, false, visibility)
|
: RegionView (parent, tv, r, spu, basic_color, false, visibility)
|
||||||
, _current_range_min(0)
|
, _current_range_min(0)
|
||||||
|
|
@ -197,13 +197,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||||
, pre_press_cursor (0)
|
, pre_press_cursor (0)
|
||||||
, _note_player (0)
|
, _note_player (0)
|
||||||
{
|
{
|
||||||
Gdk::Color c;
|
init (false);
|
||||||
int r,g,b,a;
|
|
||||||
|
|
||||||
UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
|
|
||||||
c.set_rgb_p (r/255.0, g/255.0, b/255.0);
|
|
||||||
|
|
||||||
init (c, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<MidiRegion> region)
|
MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<MidiRegion> region)
|
||||||
|
|
@ -231,17 +225,11 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
|
||||||
, pre_press_cursor (0)
|
, pre_press_cursor (0)
|
||||||
, _note_player (0)
|
, _note_player (0)
|
||||||
{
|
{
|
||||||
Gdk::Color c;
|
init (true);
|
||||||
int r,g,b,a;
|
|
||||||
|
|
||||||
UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
|
|
||||||
c.set_rgb_p (r/255.0, g/255.0, b/255.0);
|
|
||||||
|
|
||||||
init (c, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
MidiRegionView::init (bool wfd)
|
||||||
{
|
{
|
||||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||||
|
|
||||||
|
|
@ -256,9 +244,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||||
_model = midi_region()->midi_source(0)->model();
|
_model = midi_region()->midi_source(0)->model();
|
||||||
_enable_display = false;
|
_enable_display = false;
|
||||||
|
|
||||||
RegionView::init (basic_color, false);
|
RegionView::init (false);
|
||||||
|
|
||||||
compute_colors (basic_color);
|
|
||||||
|
|
||||||
set_height (trackview.current_height());
|
set_height (trackview.current_height());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,14 +71,14 @@ public:
|
||||||
RouteTimeAxisView&,
|
RouteTimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::MidiRegion>,
|
boost::shared_ptr<ARDOUR::MidiRegion>,
|
||||||
double initial_samples_per_pixel,
|
double initial_samples_per_pixel,
|
||||||
Gdk::Color const & basic_color);
|
uint32_t base_color);
|
||||||
|
|
||||||
MidiRegionView (const MidiRegionView& other);
|
MidiRegionView (const MidiRegionView& other);
|
||||||
MidiRegionView (const MidiRegionView& other, boost::shared_ptr<ARDOUR::MidiRegion>);
|
MidiRegionView (const MidiRegionView& other, boost::shared_ptr<ARDOUR::MidiRegion>);
|
||||||
|
|
||||||
~MidiRegionView ();
|
~MidiRegionView ();
|
||||||
|
|
||||||
virtual void init (Gdk::Color const & basic_color, bool wfd);
|
void init (bool wfd);
|
||||||
|
|
||||||
const boost::shared_ptr<ARDOUR::MidiRegion> midi_region() const;
|
const boost::shared_ptr<ARDOUR::MidiRegion> midi_region() const;
|
||||||
|
|
||||||
|
|
@ -313,7 +313,7 @@ protected:
|
||||||
RouteTimeAxisView&,
|
RouteTimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::MidiRegion>,
|
boost::shared_ptr<ARDOUR::MidiRegion>,
|
||||||
double samples_per_pixel,
|
double samples_per_pixel,
|
||||||
Gdk::Color& basic_color,
|
uint32_t basic_color,
|
||||||
TimeAxisViewItem::Visibility);
|
TimeAxisViewItem::Visibility);
|
||||||
|
|
||||||
void region_resized (const PBD::PropertyChange&);
|
void region_resized (const PBD::PropertyChange&);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b
|
||||||
RegionView* region_view = new MidiRegionView (_canvas_group, _trackview, region,
|
RegionView* region_view = new MidiRegionView (_canvas_group, _trackview, region,
|
||||||
_samples_per_pixel, region_color);
|
_samples_per_pixel, region_color);
|
||||||
|
|
||||||
region_view->init (region_color, false);
|
region_view->init (false);
|
||||||
|
|
||||||
return region_view;
|
return region_view;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,17 @@
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "ardour/route_group.h"
|
#include "ardour/route_group.h"
|
||||||
|
|
||||||
|
#include "canvas/utils.h"
|
||||||
|
|
||||||
#include "mixer_group_tabs.h"
|
#include "mixer_group_tabs.h"
|
||||||
#include "mixer_strip.h"
|
#include "mixer_strip.h"
|
||||||
#include "mixer_ui.h"
|
#include "mixer_ui.h"
|
||||||
#include "utils.h"
|
#include "rgb_macros.h"
|
||||||
#include "i18n.h"
|
|
||||||
#include "route_group_dialog.h"
|
#include "route_group_dialog.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
|
|
@ -91,13 +96,19 @@ void
|
||||||
MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
||||||
{
|
{
|
||||||
double const arc_radius = get_height();
|
double const arc_radius = get_height();
|
||||||
|
double r, g, b, a;
|
||||||
|
|
||||||
if (tab.group && tab.group->is_active()) {
|
if (tab.group && tab.group->is_active()) {
|
||||||
cairo_set_source_rgba (cr, tab.color.get_red_p (), tab.color.get_green_p (), tab.color.get_blue_p (), 1);
|
ArdourCanvas::color_to_rgba (tab.color, r, g, b, a);
|
||||||
} else {
|
} else {
|
||||||
cairo_set_source_rgba (cr, 1, 1, 1, 0.2);
|
r = 0.0;
|
||||||
|
g = 0.0;
|
||||||
|
b = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a = 1.0;
|
||||||
|
|
||||||
|
cairo_set_source_rgba (cr, r, g, b, a);
|
||||||
cairo_arc (cr, tab.from + arc_radius, get_height(), arc_radius, M_PI, 3 * M_PI / 2);
|
cairo_arc (cr, tab.from + arc_radius, get_height(), arc_radius, M_PI, 3 * M_PI / 2);
|
||||||
cairo_line_to (cr, tab.to - arc_radius, 0);
|
cairo_line_to (cr, tab.to - arc_radius, 0);
|
||||||
cairo_arc (cr, tab.to - arc_radius, get_height(), arc_radius, 3 * M_PI / 2, 2 * M_PI);
|
cairo_arc (cr, tab.to - arc_radius, get_height(), arc_radius, 3 * M_PI / 2, 2 * M_PI);
|
||||||
|
|
@ -110,7 +121,10 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
|
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
|
||||||
|
|
||||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
ArdourCanvas::Color c = contrasting_text_color (ArdourCanvas::rgba_to_color (r, g, b, a));
|
||||||
|
ArdourCanvas::color_to_rgba (c, r, g, b, a);
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, r, g, b);
|
||||||
cairo_move_to (cr, tab.from + (tab.to - tab.from - f.second) / 2, get_height() - ext.height / 2);
|
cairo_move_to (cr, tab.from + (tab.to - tab.from - f.second) / 2, get_height() - ext.height / 2);
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_show_text (cr, f.first.c_str());
|
cairo_show_text (cr, f.first.c_str());
|
||||||
|
|
|
||||||
|
|
@ -170,18 +170,14 @@ NoteBase::base_color()
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case TrackColor:
|
case TrackColor:
|
||||||
{
|
{
|
||||||
Gdk::Color color = _region.midi_stream_view()->get_region_color();
|
uint32_t color = _region.midi_stream_view()->get_region_color();
|
||||||
return UINT_INTERPOLATE (RGBA_TO_UINT(
|
return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (color, opacity),
|
||||||
SCALE_USHORT_TO_UINT8_T(color.get_red()),
|
ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(),
|
||||||
SCALE_USHORT_TO_UINT8_T(color.get_green()),
|
0.5);
|
||||||
SCALE_USHORT_TO_UINT8_T(color.get_blue()),
|
|
||||||
opacity),
|
|
||||||
ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(), 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ChannelColors:
|
case ChannelColors:
|
||||||
return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (NoteBase::midi_channel_colors[_note->channel()],
|
return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (NoteBase::midi_channel_colors[_note->channel()], opacity),
|
||||||
opacity),
|
|
||||||
ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(), 0.5);
|
ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(), 0.5);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
|
||||||
TimeAxisView& tv,
|
TimeAxisView& tv,
|
||||||
boost::shared_ptr<ARDOUR::Region> r,
|
boost::shared_ptr<ARDOUR::Region> r,
|
||||||
double spu,
|
double spu,
|
||||||
Gdk::Color const & basic_color,
|
uint32_t basic_color,
|
||||||
bool automation)
|
bool automation)
|
||||||
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation,
|
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation,
|
||||||
(automation ? TimeAxisViewItem::ShowFrame :
|
(automation ? TimeAxisViewItem::ShowFrame :
|
||||||
|
|
@ -131,7 +131,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
|
||||||
TimeAxisView& tv,
|
TimeAxisView& tv,
|
||||||
boost::shared_ptr<ARDOUR::Region> r,
|
boost::shared_ptr<ARDOUR::Region> r,
|
||||||
double spu,
|
double spu,
|
||||||
Gdk::Color const & basic_color,
|
uint32_t basic_color,
|
||||||
bool recording,
|
bool recording,
|
||||||
TimeAxisViewItem::Visibility visibility)
|
TimeAxisViewItem::Visibility visibility)
|
||||||
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility)
|
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility)
|
||||||
|
|
@ -152,7 +152,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegionView::init (Gdk::Color const & basic_color, bool wfd)
|
RegionView::init (bool wfd)
|
||||||
{
|
{
|
||||||
editor = 0;
|
editor = 0;
|
||||||
valid = true;
|
valid = true;
|
||||||
|
|
@ -163,8 +163,6 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||||
sync_mark = 0;
|
sync_mark = 0;
|
||||||
sync_line = 0;
|
sync_line = 0;
|
||||||
|
|
||||||
compute_colors (basic_color);
|
|
||||||
|
|
||||||
if (name_highlight) {
|
if (name_highlight) {
|
||||||
name_highlight->set_data ("regionview", this);
|
name_highlight->set_data ("regionview", this);
|
||||||
name_highlight->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
|
name_highlight->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
|
||||||
|
|
@ -539,27 +537,13 @@ RegionView::set_frame_color ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_region->opaque()) {
|
if (!_region->opaque()) {
|
||||||
fill_opacity = 130;
|
|
||||||
} else {
|
|
||||||
fill_opacity = 60;
|
fill_opacity = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeAxisViewItem::set_frame_color ();
|
TimeAxisViewItem::set_frame_color ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RegionView::fake_set_opaque (bool yn)
|
|
||||||
{
|
|
||||||
if (yn) {
|
|
||||||
fill_opacity = 130;
|
|
||||||
} else {
|
|
||||||
fill_opacity = 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_frame_color ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RegionView::show_region_editor ()
|
RegionView::show_region_editor ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class RegionView : public TimeAxisViewItem
|
||||||
TimeAxisView& time_view,
|
TimeAxisView& time_view,
|
||||||
boost::shared_ptr<ARDOUR::Region> region,
|
boost::shared_ptr<ARDOUR::Region> region,
|
||||||
double samples_per_pixel,
|
double samples_per_pixel,
|
||||||
Gdk::Color const & basic_color,
|
uint32_t base_color,
|
||||||
bool automation = false);
|
bool automation = false);
|
||||||
|
|
||||||
RegionView (const RegionView& other);
|
RegionView (const RegionView& other);
|
||||||
|
|
@ -61,7 +61,7 @@ class RegionView : public TimeAxisViewItem
|
||||||
|
|
||||||
~RegionView ();
|
~RegionView ();
|
||||||
|
|
||||||
virtual void init (Gdk::Color const & base_color, bool wait_for_data);
|
virtual void init (bool wait_for_data);
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Region> region() const { return _region; }
|
boost::shared_ptr<ARDOUR::Region> region() const { return _region; }
|
||||||
|
|
||||||
|
|
@ -79,7 +79,6 @@ class RegionView : public TimeAxisViewItem
|
||||||
void lower_to_bottom ();
|
void lower_to_bottom ();
|
||||||
|
|
||||||
bool set_position(framepos_t pos, void* src, double* delta = 0);
|
bool set_position(framepos_t pos, void* src, double* delta = 0);
|
||||||
void fake_set_opaque (bool yn);
|
|
||||||
|
|
||||||
virtual void show_region_editor ();
|
virtual void show_region_editor ();
|
||||||
void hide_region_editor ();
|
void hide_region_editor ();
|
||||||
|
|
@ -133,7 +132,7 @@ class RegionView : public TimeAxisViewItem
|
||||||
TimeAxisView&,
|
TimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::Region>,
|
boost::shared_ptr<ARDOUR::Region>,
|
||||||
double samples_per_pixel,
|
double samples_per_pixel,
|
||||||
Gdk::Color const & basic_color,
|
uint32_t basic_color,
|
||||||
bool recording,
|
bool recording,
|
||||||
TimeAxisViewItem::Visibility);
|
TimeAxisViewItem::Visibility);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,20 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ardour/route_group.h"
|
||||||
|
#include "ardour/session.h"
|
||||||
|
|
||||||
#include <gtkmm/table.h>
|
#include <gtkmm/table.h>
|
||||||
#include <gtkmm/stock.h>
|
#include <gtkmm/stock.h>
|
||||||
#include <gtkmm/messagedialog.h>
|
#include <gtkmm/messagedialog.h>
|
||||||
#include "ardour/route_group.h"
|
|
||||||
#include "ardour/session.h"
|
|
||||||
#include "route_group_dialog.h"
|
#include "route_group_dialog.h"
|
||||||
#include "group_tabs.h"
|
#include "group_tabs.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
@ -84,7 +89,10 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new)
|
||||||
|
|
||||||
_name.set_text (_group->name ());
|
_name.set_text (_group->name ());
|
||||||
_active.set_active (_group->is_active ());
|
_active.set_active (_group->is_active ());
|
||||||
_color.set_color (GroupTabs::group_color (_group));
|
|
||||||
|
Gdk::Color c;
|
||||||
|
set_color_from_rgba (c, GroupTabs::group_color (_group));
|
||||||
|
_color.set_color (c);
|
||||||
|
|
||||||
VBox* options_box = manage (new VBox);
|
VBox* options_box = manage (new VBox);
|
||||||
options_box->set_spacing (6);
|
options_box->set_spacing (6);
|
||||||
|
|
@ -212,7 +220,7 @@ RouteGroupDialog::update ()
|
||||||
|
|
||||||
_group->apply_changes (plist);
|
_group->apply_changes (plist);
|
||||||
|
|
||||||
GroupTabs::set_group_color (_group, _color.get_color ());
|
GroupTabs::set_group_color (_group, gdk_color_to_rgba (_color.get_color ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -2015,7 +2015,9 @@ RouteUI::color () const
|
||||||
RouteGroup* g = _route->route_group ();
|
RouteGroup* g = _route->route_group ();
|
||||||
|
|
||||||
if (g && g->is_color()) {
|
if (g && g->is_color()) {
|
||||||
return GroupTabs::group_color (g);
|
Gdk::Color c;
|
||||||
|
set_color_from_rgba (c, GroupTabs::group_color (g));
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _color;
|
return _color;
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,13 @@ StreamView::diskstream_changed ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StreamView::apply_color (Gdk::Color color, ColorTarget target)
|
StreamView::apply_color (Gdk::Color const& c, ColorTarget target)
|
||||||
|
{
|
||||||
|
return apply_color (gdk_color_to_rgba (c), target);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StreamView::apply_color (uint32_t color, ColorTarget target)
|
||||||
{
|
{
|
||||||
list<RegionView *>::iterator i;
|
list<RegionView *>::iterator i;
|
||||||
|
|
||||||
|
|
@ -356,7 +362,7 @@ StreamView::apply_color (Gdk::Color color, ColorTarget target)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StreamBaseColor:
|
case StreamBaseColor:
|
||||||
stream_base_color = RGBA_TO_UINT (color.get_red_p(), color.get_green_p(), color.get_blue_p(), 255);
|
stream_base_color = color;
|
||||||
canvas_rect->set_fill_color (stream_base_color);
|
canvas_rect->set_fill_color (stream_base_color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,9 @@ public:
|
||||||
StreamBaseColor
|
StreamBaseColor
|
||||||
};
|
};
|
||||||
|
|
||||||
Gdk::Color get_region_color () const { return region_color; }
|
uint32_t get_region_color () const { return region_color; }
|
||||||
void apply_color (Gdk::Color, ColorTarget t);
|
void apply_color (uint32_t, ColorTarget t);
|
||||||
|
void apply_color (Gdk::Color const &, ColorTarget t);
|
||||||
|
|
||||||
uint32_t num_selected_regionviews () const;
|
uint32_t num_selected_regionviews () const;
|
||||||
|
|
||||||
|
|
@ -164,7 +165,7 @@ protected:
|
||||||
bool rec_updating;
|
bool rec_updating;
|
||||||
bool rec_active;
|
bool rec_active;
|
||||||
|
|
||||||
Gdk::Color region_color; ///< Contained region color
|
uint32_t region_color; ///< Contained region color
|
||||||
uint32_t stream_base_color; ///< Background color
|
uint32_t stream_base_color; ///< Background color
|
||||||
|
|
||||||
PBD::ScopedConnectionList playlist_connections;
|
PBD::ScopedConnectionList playlist_connections;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const TimeAxisViewItem::Visibility TapeAudioRegionView::default_tape_visibility
|
||||||
TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
||||||
boost::shared_ptr<AudioRegion> r,
|
boost::shared_ptr<AudioRegion> r,
|
||||||
double spu,
|
double spu,
|
||||||
Gdk::Color const & basic_color)
|
uint32_t basic_color)
|
||||||
|
|
||||||
: AudioRegionView (parent, tv, r, spu, basic_color, false,
|
: AudioRegionView (parent, tv, r, spu, basic_color, false,
|
||||||
TimeAxisViewItem::Visibility ((r->position() != 0) ? default_tape_visibility :
|
TimeAxisViewItem::Visibility ((r->position() != 0) ? default_tape_visibility :
|
||||||
|
|
@ -58,13 +58,13 @@ TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTime
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TapeAudioRegionView::init (Gdk::Color const & basic_color, bool /*wfw*/)
|
TapeAudioRegionView::init (bool /*wfw*/)
|
||||||
{
|
{
|
||||||
/* never wait for data: always just create the waves, connect once and then
|
/* never wait for data: always just create the waves, connect once and then
|
||||||
we'll update whenever we need to.
|
we'll update whenever we need to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AudioRegionView::init(basic_color, false);
|
AudioRegionView::init (false);
|
||||||
|
|
||||||
/* every time the wave data changes and peaks are ready, redraw */
|
/* every time the wave data changes and peaks are ready, redraw */
|
||||||
|
|
||||||
|
|
@ -91,10 +91,3 @@ TapeAudioRegionView::update (uint32_t /*n*/)
|
||||||
// CAIROCANVAS
|
// CAIROCANVAS
|
||||||
// waves[n]->rebuild ();
|
// waves[n]->rebuild ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TapeAudioRegionView::set_frame_color ()
|
|
||||||
{
|
|
||||||
fill_opacity = 255;
|
|
||||||
AudioRegionView::set_frame_color ();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,12 @@ class TapeAudioRegionView : public AudioRegionView
|
||||||
RouteTimeAxisView&,
|
RouteTimeAxisView&,
|
||||||
boost::shared_ptr<ARDOUR::AudioRegion>,
|
boost::shared_ptr<ARDOUR::AudioRegion>,
|
||||||
double initial_samples_per_pixel,
|
double initial_samples_per_pixel,
|
||||||
Gdk::Color const & base_color);
|
uint32_t base_color);
|
||||||
~TapeAudioRegionView ();
|
~TapeAudioRegionView ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init (Gdk::Color const & base_color, bool wait_for_waves);
|
void init (bool wait_for_waves);
|
||||||
|
|
||||||
void set_frame_color ();
|
|
||||||
void update (uint32_t n);
|
void update (uint32_t n);
|
||||||
|
|
||||||
static const TimeAxisViewItem::Visibility default_tape_visibility;
|
static const TimeAxisViewItem::Visibility default_tape_visibility;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ TimeAxisViewItem::set_constant_heights ()
|
||||||
* @param automation true if this is an automation region view
|
* @param automation true if this is an automation region view
|
||||||
*/
|
*/
|
||||||
TimeAxisViewItem::TimeAxisViewItem(
|
TimeAxisViewItem::TimeAxisViewItem(
|
||||||
const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color,
|
const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, uint32_t base_color,
|
||||||
framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
|
framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
|
||||||
)
|
)
|
||||||
: trackview (tv)
|
: trackview (tv)
|
||||||
|
|
@ -148,25 +148,18 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
||||||
, _dragging (other._dragging)
|
, _dragging (other._dragging)
|
||||||
, _width (0.0)
|
, _width (0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
Gdk::Color c;
|
|
||||||
int r,g,b,a;
|
|
||||||
|
|
||||||
UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
|
|
||||||
c.set_rgb_p (r/255.0, g/255.0, b/255.0);
|
|
||||||
|
|
||||||
/* share the other's parent, but still create a new group */
|
/* share the other's parent, but still create a new group */
|
||||||
|
|
||||||
ArdourCanvas::Group* parent = other.group->parent();
|
ArdourCanvas::Group* parent = other.group->parent();
|
||||||
|
|
||||||
_selected = other._selected;
|
_selected = other._selected;
|
||||||
|
|
||||||
init (parent, other.samples_per_pixel, c, other.frame_position,
|
init (parent, other.samples_per_pixel, other.fill_color, other.frame_position,
|
||||||
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
|
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
|
TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_color,
|
||||||
framepos_t start, framepos_t duration, Visibility vis,
|
framepos_t start, framepos_t duration, Visibility vis,
|
||||||
bool wide, bool high)
|
bool wide, bool high)
|
||||||
{
|
{
|
||||||
|
|
@ -174,6 +167,8 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color cons
|
||||||
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
|
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
|
||||||
group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
|
group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
|
||||||
|
|
||||||
|
fill_color = base_color;
|
||||||
|
pre_drag_fill_color = base_color;
|
||||||
samples_per_pixel = fpp;
|
samples_per_pixel = fpp;
|
||||||
frame_position = start;
|
frame_position = start;
|
||||||
item_duration = duration;
|
item_duration = duration;
|
||||||
|
|
@ -642,9 +637,10 @@ TimeAxisViewItem::manage_name_highlight ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeAxisViewItem::set_color (Gdk::Color const & base_color)
|
TimeAxisViewItem::set_color (uint32_t base_color)
|
||||||
{
|
{
|
||||||
compute_colors (base_color);
|
fill_color = base_color;
|
||||||
|
fill_opacity = UINT_RGBA_A (fill_color);
|
||||||
set_colors ();
|
set_colors ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -666,24 +662,6 @@ TimeAxisViewItem::get_name_highlight()
|
||||||
return name_highlight;
|
return name_highlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate some contrasting color for displaying various parts of this item, based upon the base color.
|
|
||||||
*
|
|
||||||
* @param color the base color of the item
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
TimeAxisViewItem::compute_colors (Gdk::Color const & base_color)
|
|
||||||
{
|
|
||||||
unsigned char r,g,b;
|
|
||||||
|
|
||||||
/* FILL: change opacity to a fixed value */
|
|
||||||
|
|
||||||
r = base_color.get_red()/256;
|
|
||||||
g = base_color.get_green()/256;
|
|
||||||
b = base_color.get_blue()/256;
|
|
||||||
fill_color = RGBA_TO_UINT(r,g,b,160);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to set the various canvas item colors
|
* Convenience method to set the various canvas item colors
|
||||||
*/
|
*/
|
||||||
|
|
@ -707,15 +685,6 @@ TimeAxisViewItem::set_name_text_color ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double r, g, b, a;
|
|
||||||
|
|
||||||
const double black_r = 0.0;
|
|
||||||
const double black_g = 0.0;
|
|
||||||
const double black_b = 0.0;
|
|
||||||
|
|
||||||
const double white_r = 1.0;
|
|
||||||
const double white_g = 1.0;
|
|
||||||
const double white_b = 1.0;
|
|
||||||
|
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
|
|
||||||
|
|
@ -731,25 +700,7 @@ TimeAxisViewItem::set_name_text_color ()
|
||||||
f = get_fill_color ();
|
f = get_fill_color ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArdourCanvas::color_to_rgba (f, r, g, b, a);
|
name_text->set_color (contrasting_text_color (f));
|
||||||
|
|
||||||
/* Use W3C contrast guideline calculation */
|
|
||||||
|
|
||||||
double white_contrast = (max (r, white_r) - min (r, white_r)) +
|
|
||||||
(max (g, white_g) - min (g, white_g)) +
|
|
||||||
(max (b, white_b) - min (b, white_b));
|
|
||||||
|
|
||||||
double black_contrast = (max (r, black_r) - min (r, black_r)) +
|
|
||||||
(max (g, black_g) - min (g, black_g)) +
|
|
||||||
(max (b, black_b) - min (b, black_b));
|
|
||||||
|
|
||||||
if (white_contrast > black_contrast) {
|
|
||||||
/* use white */
|
|
||||||
name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
|
|
||||||
} else {
|
|
||||||
/* use black */
|
|
||||||
name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -777,22 +728,25 @@ TimeAxisViewItem::get_fill_color () const
|
||||||
if (_recregion) {
|
if (_recregion) {
|
||||||
f = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
|
f = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
|
||||||
} else {
|
} else {
|
||||||
|
if ((!Config->get_show_name_highlight() || high_enough_for_name) && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
|
||||||
if (high_enough_for_name && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
|
|
||||||
f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
|
f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
|
||||||
|
/* use the opacity as set for the FrameBase color */
|
||||||
|
o = UINT_RGBA_A (f);
|
||||||
} else {
|
} else {
|
||||||
f = fill_color;
|
f = fill_color;
|
||||||
|
o = fill_opacity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tweak opacity */
|
/* tweak opacity */
|
||||||
|
|
||||||
if (!rect_visible) {
|
if (!rect_visible) {
|
||||||
|
/* if the frame/rect is marked as invisible, then the
|
||||||
|
* fill should be transparent. simplest: set
|
||||||
|
* alpha/opacity to zero.
|
||||||
|
*/
|
||||||
o = 0;
|
o = 0;
|
||||||
} else {
|
|
||||||
o = fill_opacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UINT_RGBA_CHANGE_A (f, o);
|
return UINT_RGBA_CHANGE_A (f, o);
|
||||||
|
|
@ -829,6 +783,17 @@ TimeAxisViewItem::set_frame_color()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeAxisViewItem::set_opacity_for_drag (bool drag_starting)
|
||||||
|
{
|
||||||
|
if (drag_starting) {
|
||||||
|
fill_opacity = 130;
|
||||||
|
} else {
|
||||||
|
fill_opacity = UINT_RGBA_A (fill_color);
|
||||||
|
}
|
||||||
|
set_frame_color ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeAxisViewItem::set_frame_gradient ()
|
TimeAxisViewItem::set_frame_gradient ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
||||||
void set_name_text(const std::string&);
|
void set_name_text(const std::string&);
|
||||||
virtual void set_height(double h);
|
virtual void set_height(double h);
|
||||||
void set_y (double);
|
void set_y (double);
|
||||||
void set_color (Gdk::Color const &);
|
void set_color (uint32_t);
|
||||||
void set_name_text_color ();
|
void set_name_text_color ();
|
||||||
|
void set_opacity_for_drag (bool drag_starting);
|
||||||
|
|
||||||
uint32_t get_fill_color () const;
|
uint32_t get_fill_color () const;
|
||||||
|
|
||||||
|
|
@ -169,16 +170,15 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TimeAxisViewItem(const std::string &, ArdourCanvas::Group&, TimeAxisView&, double, Gdk::Color const &,
|
TimeAxisViewItem (const std::string &, ArdourCanvas::Group&, TimeAxisView&, double, uint32_t fill_color,
|
||||||
framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
|
framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
|
||||||
|
|
||||||
TimeAxisViewItem (const TimeAxisViewItem&);
|
TimeAxisViewItem (const TimeAxisViewItem&);
|
||||||
|
|
||||||
void init (ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
|
void init (ArdourCanvas::Group*, double, uint32_t, framepos_t, framepos_t, Visibility, bool, bool);
|
||||||
|
|
||||||
virtual bool canvas_group_event (GdkEvent*);
|
virtual bool canvas_group_event (GdkEvent*);
|
||||||
|
|
||||||
virtual void compute_colors (Gdk::Color const &);
|
|
||||||
virtual void set_colors();
|
virtual void set_colors();
|
||||||
virtual void set_frame_color();
|
virtual void set_frame_color();
|
||||||
virtual void set_frame_gradient ();
|
virtual void set_frame_gradient ();
|
||||||
|
|
@ -232,6 +232,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
||||||
|
|
||||||
uint32_t fill_opacity;
|
uint32_t fill_opacity;
|
||||||
uint32_t fill_color;
|
uint32_t fill_color;
|
||||||
|
uint32_t pre_drag_fill_color;
|
||||||
uint32_t frame_color_r;
|
uint32_t frame_color_r;
|
||||||
uint32_t frame_color_g;
|
uint32_t frame_color_g;
|
||||||
uint32_t frame_color_b;
|
uint32_t frame_color_b;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@
|
||||||
#include <gtkmm2ext/utils.h>
|
#include <gtkmm2ext/utils.h>
|
||||||
#include "ardour/rc_configuration.h"
|
#include "ardour/rc_configuration.h"
|
||||||
#include "ardour/filesystem_paths.h"
|
#include "ardour/filesystem_paths.h"
|
||||||
|
|
||||||
#include "canvas/item.h"
|
#include "canvas/item.h"
|
||||||
|
#include "canvas/utils.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
@ -288,7 +290,7 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s
|
||||||
if (state == Gtk::STATE_NORMAL && rgba) {
|
if (state == Gtk::STATE_NORMAL && rgba) {
|
||||||
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
|
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
|
||||||
} else {
|
} else {
|
||||||
return (uint32_t) RGB_TO_UINT(r,g,b);
|
return (uint32_t) RGBA_TO_UINT(r,g,b,255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,9 +342,69 @@ rgba_p_from_style (string style, float *r, float *g, float *b, string attr, int
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_color (Gdk::Color& c, int rgb)
|
set_color_from_rgb (Gdk::Color& c, uint32_t rgb)
|
||||||
{
|
{
|
||||||
c.set_rgb((rgb >> 16)*256, ((rgb & 0xff00) >> 8)*256, (rgb & 0xff)*256);
|
/* Gdk::Color color ranges are 16 bit, so scale from 8 bit by
|
||||||
|
multiplying by 256.
|
||||||
|
*/
|
||||||
|
c.set_rgb ((rgb >> 16)*256, ((rgb & 0xff00) >> 8)*256, (rgb & 0xff)*256);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_color_from_rgba (Gdk::Color& c, uint32_t rgba)
|
||||||
|
{
|
||||||
|
/* Gdk::Color color ranges are 16 bit, so scale from 8 bit by
|
||||||
|
multiplying by 256.
|
||||||
|
*/
|
||||||
|
c.set_rgb ((rgba >> 24)*256, ((rgba & 0xff0000) >> 16)*256, ((rgba & 0xff00) >> 8)*256);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
gdk_color_to_rgba (Gdk::Color const& c)
|
||||||
|
{
|
||||||
|
/* since alpha value is not available from a Gdk::Color, it is
|
||||||
|
hardcoded as 0xff (aka 255 or 1.0)
|
||||||
|
*/
|
||||||
|
|
||||||
|
const uint32_t r = c.get_red_p () * 255.0;
|
||||||
|
const uint32_t g = c.get_green_p () * 255.0;
|
||||||
|
const uint32_t b = c.get_blue_p () * 255.0;
|
||||||
|
const uint32_t a = 0xff;
|
||||||
|
|
||||||
|
return RGBA_TO_UINT (r,g,b,a);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
contrasting_text_color (uint32_t c)
|
||||||
|
{
|
||||||
|
double r, g, b, a;
|
||||||
|
ArdourCanvas::color_to_rgba (c, r, g, b, a);
|
||||||
|
|
||||||
|
const double black_r = 0.0;
|
||||||
|
const double black_g = 0.0;
|
||||||
|
const double black_b = 0.0;
|
||||||
|
|
||||||
|
const double white_r = 1.0;
|
||||||
|
const double white_g = 1.0;
|
||||||
|
const double white_b = 1.0;
|
||||||
|
|
||||||
|
/* Use W3C contrast guideline calculation */
|
||||||
|
|
||||||
|
double white_contrast = (max (r, white_r) - min (r, white_r)) +
|
||||||
|
(max (g, white_g) - min (g, white_g)) +
|
||||||
|
(max (b, white_b) - min (b, white_b));
|
||||||
|
|
||||||
|
double black_contrast = (max (r, black_r) - min (r, black_r)) +
|
||||||
|
(max (g, black_g) - min (g, black_g)) +
|
||||||
|
(max (b, black_b) - min (b, black_b));
|
||||||
|
|
||||||
|
if (white_contrast > black_contrast) {
|
||||||
|
/* use white */
|
||||||
|
return ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0);
|
||||||
|
} else {
|
||||||
|
/* use black */
|
||||||
|
return ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,10 @@ bool rgba_p_from_style (std::string, float*, float*, float*, std::string = "fg",
|
||||||
|
|
||||||
void decorate (Gtk::Window& w, Gdk::WMDecoration d);
|
void decorate (Gtk::Window& w, Gdk::WMDecoration d);
|
||||||
|
|
||||||
void set_color (Gdk::Color&, int);
|
void set_color_from_rgb (Gdk::Color&, uint32_t);
|
||||||
|
void set_color_from_rgba (Gdk::Color&, uint32_t);
|
||||||
|
uint32_t gdk_color_to_rgba (Gdk::Color const&);
|
||||||
|
uint32_t contrasting_text_color (uint32_t c);
|
||||||
|
|
||||||
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
|
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
|
||||||
bool forward_key_press (GdkEventKey* ev);
|
bool forward_key_press (GdkEventKey* ev);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue