mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +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);
|
||||
|
||||
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
|
||||
context->set_identity_matrix();
|
||||
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->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
|
||||
|
|
|
|||
|
|
@ -161,21 +161,23 @@ PassThru::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
|||
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||
|
||||
if (_enabled) {
|
||||
/* outer white circle */
|
||||
//outer white circle
|
||||
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->fill();
|
||||
|
||||
/* black circle */
|
||||
//black circle
|
||||
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->fill();
|
||||
|
||||
/* inner white circle */
|
||||
//inner white circle
|
||||
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->fill();
|
||||
}
|
||||
|
||||
context->set_identity_matrix();
|
||||
}
|
||||
|
||||
TriggerMaster::TriggerMaster (Item* parent)
|
||||
|
|
@ -188,6 +190,13 @@ TriggerMaster::TriggerMaster (Item* parent)
|
|||
|
||||
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->set ("");
|
||||
name_text->set_ignore_events (false);
|
||||
|
|
@ -250,15 +259,16 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
|||
|
||||
render_children (area, context);
|
||||
|
||||
/* 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);
|
||||
//drop-shadow at top
|
||||
if (true) {
|
||||
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 ();
|
||||
context->set_identity_matrix ();
|
||||
|
||||
/* line at top */
|
||||
} 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));
|
||||
|
|
@ -266,6 +276,7 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
|||
context->fill ();
|
||||
context->set_identity_matrix();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TriggerMaster::owner_prop_change (PropertyChange const& pc)
|
||||
|
|
@ -296,6 +307,7 @@ TriggerMaster::event_handler (GdkEvent* ev)
|
|||
case GDK_ENTER_NOTIFY:
|
||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||
name_text->set_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 ());
|
||||
}
|
||||
redraw ();
|
||||
|
|
@ -311,10 +323,7 @@ TriggerMaster::event_handler (GdkEvent* ev)
|
|||
case 3:
|
||||
context_menu ();
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -441,6 +450,13 @@ TriggerMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
|||
|
||||
_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 twidth = width - _poly_size - (_poly_margin * 3);
|
||||
|
||||
|
|
@ -471,6 +487,7 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
|||
if (!trigger) {
|
||||
name_text->set (text);
|
||||
_loopster->hide();
|
||||
stop_shape->show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -486,8 +503,10 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
|||
double f = trigger->position_as_fraction ();
|
||||
_loopster->set_fraction(f);
|
||||
_loopster->show();
|
||||
stop_shape->hide();
|
||||
} else {
|
||||
_loopster->hide();
|
||||
stop_shape->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -496,6 +515,7 @@ TriggerMaster::set_default_colors ()
|
|||
{
|
||||
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ());
|
||||
name_text->set_color (UIConfiguration::instance().color("neutral:foreground"));
|
||||
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:midground"));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -516,8 +536,8 @@ CueMaster::CueMaster (Item* parent)
|
|||
Event.connect (sigc::mem_fun (*this, &CueMaster::event_handler));
|
||||
|
||||
stop_shape = new ArdourCanvas::Polygon (this);
|
||||
stop_shape->set_outline (false);
|
||||
stop_shape->set_fill (true);
|
||||
stop_shape->set_outline (true);
|
||||
stop_shape->set_fill (false);
|
||||
stop_shape->name = X_("stopbutton");
|
||||
stop_shape->set_ignore_events (true);
|
||||
stop_shape->show ();
|
||||
|
|
@ -561,16 +581,15 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
|||
|
||||
render_children (area, context);
|
||||
|
||||
{
|
||||
//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);
|
||||
//drop-shadow at top
|
||||
if (true) {
|
||||
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 ();
|
||||
context->set_identity_matrix ();
|
||||
}
|
||||
|
||||
} else {
|
||||
//line at top
|
||||
context->set_identity_matrix();
|
||||
context->translate (self.x0, self.y0-0.5);
|
||||
|
|
@ -579,6 +598,7 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
|||
context->fill ();
|
||||
context->set_identity_matrix ();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CueMaster::event_handler (GdkEvent* ev)
|
||||
|
|
@ -593,7 +613,7 @@ CueMaster::event_handler (GdkEvent* ev)
|
|||
case GDK_ENTER_NOTIFY:
|
||||
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
||||
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 ());
|
||||
}
|
||||
break;
|
||||
|
|
@ -627,11 +647,13 @@ CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
|||
|
||||
_poly_size = height - (_poly_margin * 2);
|
||||
|
||||
float centering_offset = (width/2)-_poly_margin-_poly_size/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));
|
||||
p.push_back (Duple (centering_offset+ _poly_margin, _poly_margin));
|
||||
p.push_back (Duple (centering_offset+ _poly_margin, _poly_size));
|
||||
p.push_back (Duple (centering_offset+ _poly_size, _poly_size));
|
||||
p.push_back (Duple (centering_offset+ _poly_size, _poly_margin));
|
||||
stop_shape->set (p);
|
||||
|
||||
float tleft = _poly_size + (_poly_margin * 3);
|
||||
|
|
@ -651,7 +673,7 @@ CueMaster::set_default_colors ()
|
|||
{
|
||||
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ());
|
||||
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
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ public:
|
|||
void _size_allocate (ArdourCanvas::Rect const&);
|
||||
|
||||
ArdourCanvas::Text* name_text;
|
||||
ArdourCanvas::Polygon* stop_shape;
|
||||
|
||||
void toggle_thru ();
|
||||
void maybe_update ();
|
||||
|
|
|
|||
|
|
@ -254,26 +254,25 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
|||
|
||||
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
|
||||
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();
|
||||
}
|
||||
|
||||
{
|
||||
//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->rectangle(0, 0, width, 1);
|
||||
context->fill ();
|
||||
context->set_identity_matrix();
|
||||
}
|
||||
|
||||
//follow-action icon
|
||||
if (_trigger.region()) {
|
||||
context->set_identity_matrix();
|
||||
context->translate (self.x0, self.y0-0.5);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue