summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-11-20 15:26:43 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-11-20 15:26:43 +0000
commitbf3091f3634a2572b0a7b88a0e0a4cd8078726ce (patch)
tree02ce2f4242f14238d884f2efabe0dbb2f0be69ad
parent0eb3cbdfa1fc5360b39039065001d654c11ff7bb (diff)
audio clocks: use defined cursor color
git-svn-id: svn://localhost/ardour2/branches/3.0@10707 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/audio_clock.cc46
-rw-r--r--gtk2_ardour/audio_clock.h1
2 files changed, 36 insertions, 11 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index e422881961..284885ad44 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -187,18 +187,21 @@ AudioClock::set_colors ()
uint32_t bg_color;
uint32_t text_color;
uint32_t editing_color;
+ uint32_t cursor_color;
if (active_state()) {
bg_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 active: background", get_name()));
text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 active: text", get_name()));
editing_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 active: edited text", get_name()));
+ cursor_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 active: cursor", get_name()));
} else {
bg_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: background", get_name()));
text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: text", get_name()));
editing_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: edited text", get_name()));
+ cursor_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: cursor", get_name()));
}
- /* store for bg in render() */
+ /* store for bg and cursor in render() */
UINT_TO_RGBA (bg_color, &r, &g, &b, &a);
@@ -207,6 +210,13 @@ AudioClock::set_colors ()
bg_b = b/255.0;
bg_a = a/255.0;
+ UINT_TO_RGBA (cursor_color, &r, &g, &b, &a);
+
+ cursor_r = r/255.0;
+ cursor_g = g/255.0;
+ cursor_b = b/255.0;
+ cursor_a = a/255.0;
+
/* rescale for Pango colors ... sigh */
r = lrint (r * 65535.0);
@@ -330,19 +340,33 @@ AudioClock::render (cairo_t* cr)
if (!insert_map.empty()) {
Pango::Rectangle cursor = _layout->get_cursor_strong_pos (insert_map[input_string.length()]);
- cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.8);
- cairo_rectangle (cr,
- layout_x_offset + cursor.get_x()/PANGO_SCALE + cursor_width,
- (upper_height - layout_height)/2.0,
- 2.0, cursor.get_height()/PANGO_SCALE);
+ cairo_set_source_rgba (cr, cursor_r, cursor_g, cursor_b, cursor_a);
+ if (!_fixed_width) {
+ cairo_rectangle (cr,
+ layout_x_offset + cursor.get_x()/PANGO_SCALE + cursor_width,
+ 0,
+ 2.0, cursor.get_height()/PANGO_SCALE);
+ } else {
+ cairo_rectangle (cr,
+ layout_x_offset + cursor.get_x()/PANGO_SCALE + cursor_width,
+ (upper_height - layout_height)/2.0,
+ 2.0, cursor.get_height()/PANGO_SCALE);
+ }
cairo_fill (cr);
} else {
if (input_string.empty()) {
- cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.8);
- cairo_rectangle (cr,
- (get_width()/2.0),
- (upper_height - layout_height)/2.0,
- 2.0, upper_height);
+ cairo_set_source_rgba (cr, cursor_r, cursor_g, cursor_b, cursor_a);
+ if (!_fixed_width) {
+ cairo_rectangle (cr,
+ (get_width()/2.0),
+ 0,
+ 2.0, upper_height);
+ } else {
+ cairo_rectangle (cr,
+ (get_width()/2.0),
+ (upper_height - layout_height)/2.0,
+ 2.0, upper_height);
+ }
cairo_fill (cr);
}
}
diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h
index 6510727336..42f2bf88be 100644
--- a/gtk2_ardour/audio_clock.h
+++ b/gtk2_ardour/audio_clock.h
@@ -218,6 +218,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
void dpi_reset ();
double bg_r, bg_g, bg_b, bg_a;
+ double cursor_r, cursor_g, cursor_b, cursor_a;
};
#endif /* __audio_clock_h__ */