From 3aa7dacfdf214f0db9330d975e94b7697a0259eb Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 18 Nov 2011 05:25:22 +0000 Subject: [PATCH] bad first pass at a cursor for clock editing. lots to do here. cursor is not in the right place as soon as we pass a non-digit. color is hard-coded. and more. but .. hey, look, its a cursor .. git-svn-id: svn://localhost/ardour2/branches/3.0@10671 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/audio_clock.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index e1e468e544..6b2f621ab0 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -280,6 +280,19 @@ AudioClock::render (cairo_t* cr) Gtkmm2ext::rounded_rectangle (cr, 0, upper_height + separator_height, _width, h, 9); } } + + if (editing) { + Pango::Rectangle cursor = _layout->get_cursor_strong_pos (edit_string.length() - input_string.length() - 1); + cerr << "index at " << edit_string.length() - input_string.length() - 1 + << " cursor at " << cursor.get_x()/PANGO_SCALE << ", " << cursor.get_y()/PANGO_SCALE + << " " << cursor.get_width()/PANGO_SCALE + << " .. " << cursor.get_height()/PANGO_SCALE + << endl; + cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.3); + cairo_rectangle (cr, 6 + cursor.get_x()/PANGO_SCALE, cursor.get_y()/PANGO_SCALE, + 10, cursor.get_height()/PANGO_SCALE); + cairo_fill (cr); + } } void @@ -371,7 +384,6 @@ AudioClock::start_edit () input_string.clear (); editing = true; - show_edit_status (1); queue_draw (); Keyboard::magic_widget_grab_focus ();