projects
/
ardour.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8c79f70
)
hopefully fix up selection of color for region name text, under all conditions
author
Paul Davis
<paul@linuxaudiosystems.com>
Thu, 5 Jun 2014 16:00:24 +0000
(12:00 -0400)
committer
Paul Davis
<paul@linuxaudiosystems.com>
Thu, 5 Jun 2014 16:04:42 +0000
(12:04 -0400)
gtk2_ardour/audio_region_view.cc
patch
|
blob
|
history
gtk2_ardour/region_view.cc
patch
|
blob
|
history
gtk2_ardour/region_view.h
patch
|
blob
|
history
gtk2_ardour/time_axis_view_item.cc
patch
|
blob
|
history
gtk2_ardour/time_axis_view_item.h
patch
|
blob
|
history
diff --git
a/gtk2_ardour/audio_region_view.cc
b/gtk2_ardour/audio_region_view.cc
index 256c777cd4ffa908e4b1d83f12e12f0e94c361db..db5c609e7ce0724bb016af67a008fa9ada4a7e7e 100644
(file)
--- a/
gtk2_ardour/audio_region_view.cc
+++ b/
gtk2_ardour/audio_region_view.cc
@@
-1455,12
+1455,6
@@
AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave)
ArdourCanvas::color_to_rgba (fill, r, g, b, a);
fill = ArdourCanvas::rgba_to_color (r, g, b, 0.85); /* magic number, not user controllable */
outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
ArdourCanvas::color_to_rgba (fill, r, g, b, a);
fill = ArdourCanvas::rgba_to_color (r, g, b, 0.85); /* magic number, not user controllable */
outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
-
- if (!Config->get_show_name_highlight()) {
- /* recolor name text because it needs to contrast with
- the waveform background, not the name highlight.
- */
- }
}
wave->set_fill_color (fill);
}
wave->set_fill_color (fill);
diff --git
a/gtk2_ardour/region_view.cc
b/gtk2_ardour/region_view.cc
index dfdf0651f62104e00fb2d37c31ce3a0bc7db748d..d6c006a77b27085f42a60b415517f48f35f74d44 100644
(file)
--- a/
gtk2_ardour/region_view.cc
+++ b/
gtk2_ardour/region_view.cc
@@
-740,12
+740,6
@@
RegionView::remove_ghost (GhostRegion* ghost)
}
}
}
}
-uint32_t
-RegionView::get_fill_color ()
-{
- return fill_color;
-}
-
void
RegionView::set_height (double h)
{
void
RegionView::set_height (double h)
{
diff --git
a/gtk2_ardour/region_view.h
b/gtk2_ardour/region_view.h
index a5d5fddbd08acb5d2be6a0b4b82e0264e52a9a04..59c1e364b85f2b6a1be5e3fd6e89e93777ba715b 100644
(file)
--- a/
gtk2_ardour/region_view.h
+++ b/
gtk2_ardour/region_view.h
@@
-90,8
+90,6
@@
class RegionView : public TimeAxisViewItem
void remove_ghost_in (TimeAxisView&);
void remove_ghost (GhostRegion*);
void remove_ghost_in (TimeAxisView&);
void remove_ghost (GhostRegion*);
- uint32_t get_fill_color ();
-
virtual void entered (bool) {}
virtual void exited () {}
virtual void entered (bool) {}
virtual void exited () {}
diff --git
a/gtk2_ardour/time_axis_view_item.cc
b/gtk2_ardour/time_axis_view_item.cc
index b697db733f8254bd4f09687e1d8fab53a2338805..051f983ea7bedc9945884090d9c554e1c877ad66 100644
(file)
--- a/
gtk2_ardour/time_axis_view_item.cc
+++ b/
gtk2_ardour/time_axis_view_item.cc
@@
-772,61
+772,60
@@
TimeAxisViewItem::set_colors()
name_highlight->set_fill_color (fill_color);
}
name_highlight->set_fill_color (fill_color);
}
- if (name_text) {
- 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;
-
- ArdourCanvas::color_to_rgba (fill_color, r, g, b, a);
-
- /* Use W3C contrast guideline calculation */
+ set_name_text_color ();
+ set_trim_handle_colors();
+}
- 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));
+void
+TimeAxisViewItem::set_name_text_color ()
+{
+ if (!name_text) {
+ return;
+ }
+
+ double r, g, b, a;
- 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))
;
+ const double black_r = 0.0;
+ const double black_g = 0.0;
+
const double black_b = 0.0
;
- 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));
- }
+ const double white_r = 1.0;
+ const double white_g = 1.0;
+ const double white_b = 1.0;
-#if 0
- double h, s, v;
+ uint32_t f;
+
+ if (Config->get_show_name_highlight()) {
+ /* name text will always be on top of name highlight, which
+ will always use our fill color.
+ */
+ f = fill_color;
+ } else {
+ /* name text will be on top of the item, whose color
+ may vary depending on various conditions.
+ */
+ f = get_fill_color ();
+ }
-
ArdourCanvas::color_to_hsv (fill_color, h, s, v
);
+
ArdourCanvas::color_to_rgba (f, r, g, b, a
);
- if (v == 0.0) {
- /* fill is black, set text to white */
- name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
- } else if (v == 1.0) {
- /* fill is white, set text to black */
- name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
- } else {
+ /* Use W3C contrast guideline calculation */
- h = fabs (fmod ((h - 180), 360.0)); /* complementary color */
- s = 1.0; /* fully saturate */
- v = 0.9; /* increase lightness/brightness/value */
+ 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));
- name_text->set_color (ArdourCanvas::hsv_to_color (h, s, v, 1.0));
- }
-#endif
+ 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));
}
}
-
- set_trim_handle_colors();
}
uint32_t
}
uint32_t
diff --git
a/gtk2_ardour/time_axis_view_item.h
b/gtk2_ardour/time_axis_view_item.h
index ff353739950e6f66683e2100c41e6e3a82e8f141..87101aad3b5c1930f9cc23cce826608b5a1a7a30 100644
(file)
--- a/
gtk2_ardour/time_axis_view_item.h
+++ b/
gtk2_ardour/time_axis_view_item.h
@@
-73,6
+73,7
@@
class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
virtual void set_height(double h);
void set_y (double);
void set_color (Gdk::Color const &);
virtual void set_height(double h);
void set_y (double);
void set_color (Gdk::Color const &);
+ void set_name_text_color ();
uint32_t get_fill_color () const;
uint32_t get_fill_color () const;