13
0

Use color modifiers for dynamic region styles.

This commit is contained in:
David Robillard 2014-12-16 20:37:16 -05:00
parent a12a065457
commit 6031308520
9 changed files with 65 additions and 92 deletions

View File

@ -29,6 +29,7 @@
#include "gtkmm2ext/keyboard.h"
#include "ardour_ui.h"
#include "automation_region_view.h"
#include "editing.h"
#include "editor.h"
@ -57,6 +58,10 @@ AutomationRegionView::AutomationRegionView (ArdourCanvas::Container*
}
group->raise_to_top();
trackview.editor().MouseModeChanged.connect(_mouse_mode_connection, invalidator (*this),
boost::bind (&AutomationRegionView::mouse_mode_changed, this),
gui_context ());
}
AutomationRegionView::~AutomationRegionView ()
@ -97,6 +102,27 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis
_line->set_offset (_region->start ());
}
uint32_t
AutomationRegionView::get_fill_color() const
{
const std::string mod_name = (_dragging ? "dragging region" :
trackview.editor().internal_editing() ? "editable region" :
"midi frame base");
if (_selected) {
return ARDOUR_UI::config()->color_mod ("selected region base", mod_name);
} else if (high_enough_for_name || !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
return ARDOUR_UI::config()->color_mod ("midi frame base", mod_name);
}
return ARDOUR_UI::config()->color_mod (fill_color, mod_name);
}
void
AutomationRegionView::mouse_mode_changed ()
{
// Adjust frame colour (become more transparent for internal tools)
set_frame_color();
}
bool
AutomationRegionView::canvas_group_event (GdkEvent* ev)
{

View File

@ -70,6 +70,8 @@ public:
// We are a ghost. Meta ghosts? Crazy talk.
virtual GhostRegion* add_ghost(TimeAxisView&) { return 0; }
uint32_t get_fill_color() const;
void set_height (double);
void reset_width_dependent_items(double pixel_width);
@ -79,6 +81,7 @@ protected:
void region_resized (const PBD::PropertyChange&);
bool canvas_group_event(GdkEvent* ev);
void add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points);
void mouse_mode_changed ();
void entered();
void exited();
@ -87,6 +90,7 @@ private:
ARDOUR::DoubleBeatsFramesConverter _source_relative_time_converter;
Evoral::Parameter _parameter;
boost::shared_ptr<AutomationLine> _line;
PBD::ScopedConnection _mouse_mode_connection;
};
#endif /* __gtk_ardour_automation_region_view_h__ */

View File

@ -1,18 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- The Dark Theme for Ardour -->
<Ardour>
<Colors>
<Color name="meter color0" value="0x008800FF"/>
<Color name="meter color1" value="0x00AA00FF"/>
<Color name="meter color2" value="0x00FF00FF"/>
<Color name="meter color3" value="0x00FF00FF"/>
<Color name="meter color4" value="0xFFF000ff"/>
<Color name="meter color5" value="0xFFF000ff"/>
<Color name="meter color6" value="0xFF8800ff"/>
<Color name="meter color7" value="0xFF8800ff"/>
<Color name="meter color8" value="0xFF0000ff"/>
<Color name="meter color9" value="0xFF0000ff"/>
<Color name="color 1" value="0x20b2b2ff"/>
<Color name="color 10" value="0xf0f0f0ff"/>
<Color name="color 100" value="0xe49c9cff"/>
@ -116,6 +104,16 @@
<Color name="color 97" value="0xccccccff"/>
<Color name="color 98" value="0x9effffff"/>
<Color name="color 99" value="0x5da3c1ff"/>
<Color name="meter color0" value="0x008800ff"/>
<Color name="meter color1" value="0x00aa00ff"/>
<Color name="meter color2" value="0x00ff00ff"/>
<Color name="meter color3" value="0x00ff00ff"/>
<Color name="meter color4" value="0xfff000ff"/>
<Color name="meter color5" value="0xfff000ff"/>
<Color name="meter color6" value="0xff8800ff"/>
<Color name="meter color7" value="0xff8800ff"/>
<Color name="meter color8" value="0xff0000ff"/>
<Color name="meter color9" value="0xff0000ff"/>
</Colors>
<ColorAliases>
<ColorAlias name="active crossfade" alias="color 1"/>
@ -481,6 +479,8 @@
<Modifier name="audio track base" modifier="= alpha:0.4078"/>
<Modifier name="automation track fill" modifier="= alpha:0.326156"/>
<Modifier name="crossfade alpha" modifier="= alpha:0.1803"/>
<Modifier name="dragging region" modifier="= alpha:0.9"/>
<Modifier name="editable region" modifier="= alpha:0.1"/>
<Modifier name="gain line inactive" modifier="= alpha:0.7725"/>
<Modifier name="ghost track base" modifier="= alpha:0.640782"/>
<Modifier name="ghost track midi fill" modifier="= alpha:0.228968"/>

View File

@ -426,8 +426,6 @@ MidiRegionView::enter_notify (GdkEventCrossing* ev)
bool
MidiRegionView::leave_notify (GdkEventCrossing*)
{
_mouse_mode_connection.disconnect ();
leave_internal();
_entered = false;
@ -3242,40 +3240,17 @@ MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, boo
}
uint32_t
MidiRegionView::fill_opacity() const
MidiRegionView::get_fill_color() const
{
uint32_t a = RegionView::fill_opacity();
if (trackview.editor().current_mouse_mode() == MouseDraw ||
trackview.editor().current_mouse_mode() == MouseContent) {
/* Make rect more transparent when in an internal mode. This should
probably be configurable somehow. */
a /= 2;
}
return a;
}
void
MidiRegionView::set_frame_color()
{
uint32_t f;
TimeAxisViewItem::set_frame_color ();
if (!frame) {
return;
}
const std::string mod_name = (_dragging ? "dragging region" :
trackview.editor().internal_editing() ? "editable region" :
"midi frame base");
if (_selected) {
f = ARDOUR_UI::config()->color ("selected region base");
return ARDOUR_UI::config()->color_mod ("selected region base", mod_name);
} else if (high_enough_for_name || !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
f = ARDOUR_UI::config()->color_mod ("midi frame base", "midi frame base");
} else {
f = fill_color;
return ARDOUR_UI::config()->color_mod ("midi frame base", mod_name);
}
f = UINT_RGBA_CHANGE_A (f, fill_opacity());
frame->set_fill_color (f);
return ARDOUR_UI::config()->color_mod (fill_color, mod_name);
}
void

View File

@ -106,11 +106,9 @@ public:
inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); }
void set_frame_color();
uint32_t get_fill_color() const;
void color_handler ();
uint32_t fill_opacity() const;
void show_step_edit_cursor (Evoral::MusicalTime pos);
void move_step_edit_cursor (Evoral::MusicalTime pos);
void hide_step_edit_cursor ();

View File

@ -510,18 +510,6 @@ RegionView::set_duration (framecnt_t frames, void *src)
return true;
}
uint32_t
RegionView::fill_opacity () const
{
if (!_region->opaque()) {
return 60;
}
uint32_t normal_tavi_opacity = TimeAxisViewItem::fill_opacity ();
return normal_tavi_opacity;
}
void
RegionView::set_colors ()
{
@ -534,10 +522,14 @@ RegionView::set_colors ()
}
}
void
RegionView::set_frame_color ()
uint32_t
RegionView::get_fill_color () const
{
TimeAxisViewItem::set_frame_color ();
uint32_t f = TimeAxisViewItem::get_fill_color();
if (_region->opaque()) {
f = UINT_RGBA_CHANGE_A (f, 255);
}
return f;
}
void

View File

@ -85,6 +85,8 @@ class RegionView : public TimeAxisViewItem
virtual void region_changed (const PBD::PropertyChange&);
uint32_t get_fill_color () const;
virtual GhostRegion* add_ghost (TimeAxisView&) = 0;
void remove_ghost_in (TimeAxisView&);
void remove_ghost (GhostRegion*);
@ -149,11 +151,8 @@ class RegionView : public TimeAxisViewItem
void lock_toggle ();
virtual void set_colors ();
virtual void set_frame_color ();
virtual void reset_width_dependent_items (double pixel_width);
uint32_t fill_opacity () const;
virtual void color_handler () {}
boost::shared_ptr<ARDOUR::Region> _region;

View File

@ -691,49 +691,30 @@ TimeAxisViewItem::set_name_text_color ()
name_text->set_color (ArdourCanvas::contrasting_text_color (f));
}
uint32_t
TimeAxisViewItem::fill_opacity () const
{
if (_dragging) {
return 130;
}
uint32_t col = ARDOUR_UI::config()->color_mod (_fill_color_name, _fill_color_name);
return UINT_RGBA_A (col);
}
uint32_t
TimeAxisViewItem::get_fill_color () const
{
uint32_t f;
uint32_t o = fill_opacity ();
const std::string mod_name = (_dragging ? "dragging region" : _fill_color_name);
if (_selected) {
f = ARDOUR_UI::config()->color ("selected region base");
f = ARDOUR_UI::config()->color_mod ("selected region base", mod_name);
if (o == 0) {
/* some condition of this item has set fill opacity to
* zero, but it has been selected, so use a mid-way
* alpha value to make it reasonably visible.
*/
o = 130;
}
} else {
if (_recregion) {
f = ARDOUR_UI::config()->color ("recording rect");
} else {
if ((!Config->get_show_name_highlight() || high_enough_for_name) && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
f = ARDOUR_UI::config()->color_mod (_fill_color_name, _fill_color_name);
f = ARDOUR_UI::config()->color_mod (_fill_color_name, mod_name);
} else {
f = fill_color;
f = ARDOUR_UI::config()->color_mod (fill_color, mod_name);
}
}
}
return UINT_RGBA_CHANGE_A (f, o);
return f;
}
/**

View File

@ -76,7 +76,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
void set_color (uint32_t);
void set_name_text_color ();
uint32_t get_fill_color () const;
virtual uint32_t get_fill_color () const;
ArdourCanvas::Item* get_canvas_frame();
ArdourCanvas::Item* get_canvas_group();
@ -215,8 +215,6 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
uint32_t fill_color;
virtual uint32_t fill_opacity() const;
uint32_t last_item_width;
int name_text_width;
bool wide_enough_for_name;