mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
pixel pushing: return of drop-shadows (maybe)
This commit is contained in:
parent
27ba2c7ea6
commit
26df9ccdf8
4 changed files with 113 additions and 94 deletions
|
|
@ -170,7 +170,14 @@ CueEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
if (_cue_idx%2==0) {
|
if (_cue_idx==0) {
|
||||||
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
||||||
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||||
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||||
|
context->set_source (drop_shadow_pattern);
|
||||||
|
context->rectangle(0, 0, width, 6*scale );
|
||||||
|
context->fill ();
|
||||||
|
} else if (_cue_idx%2==0) {
|
||||||
//line at top
|
//line at top
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix();
|
||||||
context->translate (self.x0, self.y0-0.5);
|
context->translate (self.x0, self.y0-0.5);
|
||||||
|
|
@ -179,16 +186,6 @@ CueEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
||||||
context->fill ();
|
context->fill ();
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
//line at right
|
|
||||||
context->set_identity_matrix();
|
|
||||||
context->translate (self.x0, self.y0-0.5);
|
|
||||||
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
|
||||||
context->rectangle(width-1, 0, width, height);
|
|
||||||
context->fill ();
|
|
||||||
context->set_identity_matrix();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -161,21 +161,23 @@ PassThru::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||||
|
|
||||||
if (_enabled) {
|
if (_enabled) {
|
||||||
/* outer white circle */
|
//outer white circle
|
||||||
set_source_rgba (context, rgba_to_color (1, 1, 1, 1));
|
set_source_rgba (context, rgba_to_color (1,1,1,1));
|
||||||
context->arc (size / 2, size / 2, size / 2 - 3 * scale, 0, 2 * M_PI);
|
context->arc ( size/2, size/2, size/2 - 3*scale, 0, 2*M_PI );
|
||||||
context->fill ();
|
context->fill();
|
||||||
|
|
||||||
/* black circle */
|
//black circle
|
||||||
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
||||||
context->arc (size / 2, size / 2, size / 2 - 5 * scale, 0, 2 * M_PI);
|
context->arc ( size/2, size/2, size/2 - 5*scale, 0, 2*M_PI );
|
||||||
context->fill ();
|
context->fill();
|
||||||
|
|
||||||
/* inner white circle */
|
//inner white circle
|
||||||
set_source_rgba (context, rgba_to_color (1, 1, 1, 1));
|
set_source_rgba (context, rgba_to_color (1,1,1,1));
|
||||||
context->arc (size / 2, size / 2, size / 2 - 7 * scale, 0, 2 * M_PI);
|
context->arc ( size/2, size/2, size/2 - 7*scale, 0, 2*M_PI );
|
||||||
context->fill ();
|
context->fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context->set_identity_matrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerMaster::TriggerMaster (Item* parent)
|
TriggerMaster::TriggerMaster (Item* parent)
|
||||||
|
|
@ -188,6 +190,13 @@ TriggerMaster::TriggerMaster (Item* parent)
|
||||||
|
|
||||||
Event.connect (sigc::mem_fun (*this, &TriggerMaster::event_handler));
|
Event.connect (sigc::mem_fun (*this, &TriggerMaster::event_handler));
|
||||||
|
|
||||||
|
stop_shape = new ArdourCanvas::Polygon (this);
|
||||||
|
stop_shape->set_outline (true);
|
||||||
|
stop_shape->set_fill (false);
|
||||||
|
stop_shape->name = X_("stopbutton");
|
||||||
|
stop_shape->set_ignore_events (true);
|
||||||
|
stop_shape->show ();
|
||||||
|
|
||||||
name_text = new Text (this);
|
name_text = new Text (this);
|
||||||
name_text->set ("");
|
name_text->set ("");
|
||||||
name_text->set_ignore_events (false);
|
name_text->set_ignore_events (false);
|
||||||
|
|
@ -250,21 +259,23 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
/* line at right */
|
//drop-shadow at top
|
||||||
context->set_identity_matrix ();
|
if (true) {
|
||||||
context->translate (self.x0, self.y0 - 0.5);
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
||||||
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||||
context->rectangle (width - 1, 0, width, height);
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||||
|
context->set_source (drop_shadow_pattern);
|
||||||
|
context->rectangle(0, 0, width, 6*scale );
|
||||||
context->fill ();
|
context->fill ();
|
||||||
context->set_identity_matrix ();
|
} else {
|
||||||
|
//line at top
|
||||||
/* line at top */
|
context->set_identity_matrix();
|
||||||
context->set_identity_matrix ();
|
context->translate (self.x0, self.y0-0.5);
|
||||||
context->translate (self.x0, self.y0 - 0.5);
|
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
||||||
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
context->rectangle(0, 0, width, 1.);
|
||||||
context->rectangle (0, 0, width, 1.);
|
|
||||||
context->fill ();
|
context->fill ();
|
||||||
context->set_identity_matrix ();
|
context->set_identity_matrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -295,14 +306,15 @@ TriggerMaster::event_handler (GdkEvent* ev)
|
||||||
break;
|
break;
|
||||||
case GDK_ENTER_NOTIFY:
|
case GDK_ENTER_NOTIFY:
|
||||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||||
name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
|
name_text->set_color (UIConfiguration::instance().color("neutral:foregroundest"));
|
||||||
set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
|
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:foreground"));
|
||||||
|
set_fill_color (HSV (fill_color()).lighter(0.15).color ());
|
||||||
}
|
}
|
||||||
redraw ();
|
redraw ();
|
||||||
break;
|
break;
|
||||||
case GDK_LEAVE_NOTIFY:
|
case GDK_LEAVE_NOTIFY:
|
||||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||||
set_default_colors ();
|
set_default_colors();
|
||||||
}
|
}
|
||||||
redraw ();
|
redraw ();
|
||||||
break;
|
break;
|
||||||
|
|
@ -311,10 +323,7 @@ TriggerMaster::event_handler (GdkEvent* ev)
|
||||||
case 3:
|
case 3:
|
||||||
context_menu ();
|
context_menu ();
|
||||||
return true;
|
return true;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -441,6 +450,13 @@ TriggerMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
|
|
||||||
_poly_size = height - (_poly_margin * 2);
|
_poly_size = height - (_poly_margin * 2);
|
||||||
|
|
||||||
|
Points p;
|
||||||
|
p.push_back (Duple (_poly_margin, _poly_margin));
|
||||||
|
p.push_back (Duple (_poly_margin, _poly_size));
|
||||||
|
p.push_back (Duple (_poly_size, _poly_size));
|
||||||
|
p.push_back (Duple (_poly_size, _poly_margin));
|
||||||
|
stop_shape->set (p);
|
||||||
|
|
||||||
float tleft = _poly_size + (_poly_margin * 3);
|
float tleft = _poly_size + (_poly_margin * 3);
|
||||||
float twidth = width - _poly_size - (_poly_margin * 3);
|
float twidth = width - _poly_size - (_poly_margin * 3);
|
||||||
|
|
||||||
|
|
@ -470,7 +486,8 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
||||||
ARDOUR::Trigger* trigger = _triggerbox->currently_playing ();
|
ARDOUR::Trigger* trigger = _triggerbox->currently_playing ();
|
||||||
if (!trigger) {
|
if (!trigger) {
|
||||||
name_text->set (text);
|
name_text->set (text);
|
||||||
_loopster->hide ();
|
_loopster->hide();
|
||||||
|
stop_shape->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,18 +501,21 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
||||||
|
|
||||||
if (trigger->active ()) {
|
if (trigger->active ()) {
|
||||||
double f = trigger->position_as_fraction ();
|
double f = trigger->position_as_fraction ();
|
||||||
_loopster->set_fraction (f);
|
_loopster->set_fraction(f);
|
||||||
_loopster->show ();
|
_loopster->show();
|
||||||
|
stop_shape->hide();
|
||||||
} else {
|
} else {
|
||||||
_loopster->hide ();
|
_loopster->hide();
|
||||||
|
stop_shape->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerMaster::set_default_colors ()
|
TriggerMaster::set_default_colors ()
|
||||||
{
|
{
|
||||||
set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.25).color ());
|
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ());
|
||||||
name_text->set_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
name_text->set_color (UIConfiguration::instance().color("neutral:foreground"));
|
||||||
|
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:midground"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -516,8 +536,8 @@ CueMaster::CueMaster (Item* parent)
|
||||||
Event.connect (sigc::mem_fun (*this, &CueMaster::event_handler));
|
Event.connect (sigc::mem_fun (*this, &CueMaster::event_handler));
|
||||||
|
|
||||||
stop_shape = new ArdourCanvas::Polygon (this);
|
stop_shape = new ArdourCanvas::Polygon (this);
|
||||||
stop_shape->set_outline (false);
|
stop_shape->set_outline (true);
|
||||||
stop_shape->set_fill (true);
|
stop_shape->set_fill (false);
|
||||||
stop_shape->name = X_("stopbutton");
|
stop_shape->name = X_("stopbutton");
|
||||||
stop_shape->set_ignore_events (true);
|
stop_shape->set_ignore_events (true);
|
||||||
stop_shape->show ();
|
stop_shape->show ();
|
||||||
|
|
@ -561,23 +581,23 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
{
|
//drop-shadow at top
|
||||||
//line at right
|
if (true) {
|
||||||
context->set_identity_matrix ();
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
||||||
context->translate (self.x0, self.y0 - 0.5);
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||||
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||||
context->rectangle (width - 1, 0, width, height);
|
context->set_source (drop_shadow_pattern);
|
||||||
|
context->rectangle(0, 0, width, 6*scale );
|
||||||
|
context->fill ();
|
||||||
|
} else {
|
||||||
|
//line at top
|
||||||
|
context->set_identity_matrix();
|
||||||
|
context->translate (self.x0, self.y0-0.5);
|
||||||
|
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
||||||
|
context->rectangle(0, 0, width, 1.);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
context->set_identity_matrix ();
|
context->set_identity_matrix ();
|
||||||
}
|
}
|
||||||
|
|
||||||
//line at top
|
|
||||||
context->set_identity_matrix ();
|
|
||||||
context->translate (self.x0, self.y0 - 0.5);
|
|
||||||
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
|
||||||
context->rectangle (0, 0, width, 1.);
|
|
||||||
context->fill ();
|
|
||||||
context->set_identity_matrix ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -586,20 +606,20 @@ CueMaster::event_handler (GdkEvent* ev)
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
if (ev->button.button == 1) {
|
if (ev->button.button == 1) {
|
||||||
_session->stop_all_triggers ();
|
_session->stop_all_triggers();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_ENTER_NOTIFY:
|
case GDK_ENTER_NOTIFY:
|
||||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||||
name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
|
name_text->set_color (UIConfiguration::instance().color("neutral:foregroundest"));
|
||||||
stop_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
|
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:foreground"));
|
||||||
set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
|
set_fill_color (HSV (fill_color()).lighter(0.15).color ());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_LEAVE_NOTIFY:
|
case GDK_LEAVE_NOTIFY:
|
||||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||||
set_default_colors ();
|
set_default_colors();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -627,11 +647,13 @@ CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
|
|
||||||
_poly_size = height - (_poly_margin * 2);
|
_poly_size = height - (_poly_margin * 2);
|
||||||
|
|
||||||
|
float centering_offset = (width/2)-_poly_margin-_poly_size/2;
|
||||||
|
|
||||||
Points p;
|
Points p;
|
||||||
p.push_back (Duple (_poly_margin, _poly_margin));
|
p.push_back (Duple (centering_offset+ _poly_margin, _poly_margin));
|
||||||
p.push_back (Duple (_poly_margin, _poly_size));
|
p.push_back (Duple (centering_offset+ _poly_margin, _poly_size));
|
||||||
p.push_back (Duple (_poly_size, _poly_size));
|
p.push_back (Duple (centering_offset+ _poly_size, _poly_size));
|
||||||
p.push_back (Duple (_poly_size, _poly_margin));
|
p.push_back (Duple (centering_offset+ _poly_size, _poly_margin));
|
||||||
stop_shape->set (p);
|
stop_shape->set (p);
|
||||||
|
|
||||||
float tleft = _poly_size + (_poly_margin * 3);
|
float tleft = _poly_size + (_poly_margin * 3);
|
||||||
|
|
@ -649,9 +671,9 @@ CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
void
|
void
|
||||||
CueMaster::set_default_colors ()
|
CueMaster::set_default_colors ()
|
||||||
{
|
{
|
||||||
set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.25).color ());
|
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ());
|
||||||
name_text->set_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
name_text->set_color (UIConfiguration::instance().color("neutral:foreground"));
|
||||||
stop_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:midground"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public:
|
||||||
void _size_allocate (ArdourCanvas::Rect const&);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
|
|
||||||
ArdourCanvas::Text* name_text;
|
ArdourCanvas::Text* name_text;
|
||||||
|
ArdourCanvas::Polygon* stop_shape;
|
||||||
|
|
||||||
void toggle_thru ();
|
void toggle_thru ();
|
||||||
void maybe_update ();
|
void maybe_update ();
|
||||||
|
|
|
||||||
|
|
@ -254,26 +254,25 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
if (_trigger.index()%2==0) {
|
if (_trigger.index()==1) {
|
||||||
|
//drop-shadow at top
|
||||||
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
||||||
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||||
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||||
|
context->set_source (drop_shadow_pattern);
|
||||||
|
context->rectangle(0, 0, width, 6*scale );
|
||||||
|
context->fill ();
|
||||||
|
} else if (_trigger.index()%2==0) {
|
||||||
//line at top
|
//line at top
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix();
|
||||||
context->translate (self.x0, self.y0-0.5);
|
context->translate (self.x0, self.y0-0.5);
|
||||||
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
||||||
context->rectangle(0, 0, width, 1.);
|
context->rectangle(0, 0, width, 1);
|
||||||
context->fill ();
|
|
||||||
context->set_identity_matrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
//line at right
|
|
||||||
context->set_identity_matrix();
|
|
||||||
context->translate (self.x0, self.y0-0.5);
|
|
||||||
set_source_rgba (context, rgba_to_color (0,0,0,1));
|
|
||||||
context->rectangle(width-1, 0, width, height);
|
|
||||||
context->fill ();
|
context->fill ();
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//follow-action icon
|
||||||
if (_trigger.region()) {
|
if (_trigger.region()) {
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix();
|
||||||
context->translate (self.x0, self.y0-0.5);
|
context->translate (self.x0, self.y0-0.5);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue