mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
audio clocks: switch cursor to other side, thinner; half-make delete key work
git-svn-id: svn://localhost/ardour2/branches/3.0@10697 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8b9118f6b7
commit
6c7ca5070e
1 changed files with 25 additions and 12 deletions
|
|
@ -282,24 +282,24 @@ AudioClock::render (cairo_t* cr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editing) {
|
if (editing) {
|
||||||
const double cursor_width = 4.0; /* need em width here, not 16 */
|
const double cursor_width = 12; /* need em width here, not 16 */
|
||||||
|
|
||||||
if (!insert_map.empty()) {
|
if (!insert_map.empty()) {
|
||||||
Pango::Rectangle cursor = _layout->get_cursor_strong_pos (insert_map[input_string.length()]);
|
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_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.8);
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x_leading_padding + cursor.get_x()/PANGO_SCALE,
|
x_leading_padding + cursor.get_x()/PANGO_SCALE + cursor_width,
|
||||||
(upper_height - layout_height)/2.0,
|
(upper_height - layout_height)/2.0,
|
||||||
cursor_width, cursor.get_height()/PANGO_SCALE);
|
2.0, cursor.get_height()/PANGO_SCALE);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
} else {
|
} else {
|
||||||
if (input_string.empty()) {
|
if (input_string.empty()) {
|
||||||
cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.8);
|
cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.8);
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
(get_width()/2.0) - cursor_width,
|
(get_width()/2.0),
|
||||||
(upper_height - layout_height)/2.0,
|
(upper_height - layout_height)/2.0,
|
||||||
cursor_width, upper_height);
|
2.0, upper_height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +441,7 @@ AudioClock::end_edit (bool modify)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
editing = false;
|
editing = false;
|
||||||
framepos_t pos;
|
framepos_t pos = 0; /* stupid gcc */
|
||||||
|
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case Timecode:
|
case Timecode:
|
||||||
|
|
@ -1117,6 +1117,11 @@ AudioClock::on_key_release_event (GdkEventKey *ev)
|
||||||
ChangeAborted(); /* EMIT SIGNAL */
|
ChangeAborted(); /* EMIT SIGNAL */
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case GDK_Delete:
|
||||||
|
case GDK_BackSpace:
|
||||||
|
input_string = input_string.substr (1, input_string.length() - 1);
|
||||||
|
goto use_input_string;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1127,10 +1132,12 @@ AudioClock::on_key_release_event (GdkEventKey *ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
input_string.insert (input_string.begin(), new_char);
|
input_string.insert (input_string.begin(), new_char);
|
||||||
|
|
||||||
|
use_input_string:
|
||||||
|
|
||||||
string::reverse_iterator ri;
|
string::reverse_iterator ri;
|
||||||
vector<int> insert_at;
|
vector<int> insert_at;
|
||||||
int highlight_length;
|
int highlight_length = 0;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
framepos_t pos;
|
framepos_t pos;
|
||||||
|
|
||||||
|
|
@ -1139,10 +1146,16 @@ AudioClock::on_key_release_event (GdkEventKey *ev)
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case Frames:
|
case Frames:
|
||||||
/* get this one in the right order, and to the right width */
|
/* get this one in the right order, and to the right width */
|
||||||
edit_string.push_back (new_char);
|
if (ev->keyval != GDK_Delete && ev->keyval != GDK_BackSpace) {
|
||||||
sscanf (edit_string.c_str(), "%" PRId64, &pos);
|
edit_string.push_back (new_char);
|
||||||
snprintf (buf, sizeof (buf), " %10" PRId64, pos);
|
} else {
|
||||||
edit_string = buf;
|
edit_string = edit_string.substr (0, edit_string.length() - 1);
|
||||||
|
}
|
||||||
|
if (!edit_string.empty()) {
|
||||||
|
sscanf (edit_string.c_str(), "%" PRId64, &pos);
|
||||||
|
snprintf (buf, sizeof (buf), " %10" PRId64, pos);
|
||||||
|
edit_string = buf;
|
||||||
|
}
|
||||||
highlight_length = edit_string.length();
|
highlight_length = edit_string.length();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue