13
0

colin's wall clock patch update, modified to update every second, not every millisecond

git-svn-id: svn://localhost/ardour2/branches/3.0@13732 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-12-26 16:44:09 +00:00
parent 6f2216c112
commit 5c847268af
2 changed files with 178 additions and 36 deletions

View File

@ -428,7 +428,7 @@ ARDOUR_UI::post_engine ()
#ifndef GTKOSX #ifndef GTKOSX
/* OS X provides a nearly-always visible wallclock, so don't be stupid */ /* OS X provides a nearly-always visible wallclock, so don't be stupid */
update_wall_clock (); update_wall_clock ();
Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 60000); Glib::signal_timeout().connect_seconds (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 1000);
#endif #endif
update_disk_space (); update_disk_space ();
@ -1101,13 +1101,16 @@ ARDOUR_UI::update_wall_clock ()
{ {
time_t now; time_t now;
struct tm *tm_now; struct tm *tm_now;
char buf[16]; static int last_min = -1;
time (&now); time (&now);
tm_now = localtime (&now); tm_now = localtime (&now);
if (last_min != tm_now->tm_min) {
sprintf (buf, "%02d:%02d", tm_now->tm_hour, tm_now->tm_min); char buf[16];
wall_clock_label.set_text (buf); sprintf (buf, "%02d:%02d", tm_now->tm_hour, tm_now->tm_min);
wall_clock_label.set_text (buf);
last_min = tm_now->tm_min;
}
return TRUE; return TRUE;
} }

View File

@ -22,12 +22,14 @@ $winkey = 'Mod4\>\<Super';
$make_cheatsheet = 1; $make_cheatsheet = 1;
$make_accelmap = 0; $make_accelmap = 0;
$merge_from = ""; $merge_from = "";
$html = 0;
GetOptions ("platform=s" => \$platform, GetOptions ("platform=s" => \$platform,
"winkey=s" => \$winkey, "winkey=s" => \$winkey,
"cheatsheet" => \$make_cheatsheet, "cheatsheet" => \$make_cheatsheet,
"accelmap" => \$make_accelmap, "accelmap" => \$make_accelmap,
"merge=s" => \$merge_from); "merge=s" => \$merge_from,
"html" => \$html);
if ($platform eq "darwin") { if ($platform eq "darwin") {
@ -73,37 +75,78 @@ if ($platform eq "darwin") {
$mouse_modifier_map{$winkey} => 'Win'; $mouse_modifier_map{$winkey} => 'Win';
} }
%keycodes = ( %keycodes = ();
'asciicircum' => '\\verb=^=',
'apostrophe' => '\'', if ($html) {
'bracketleft' => '[', %keycodes = (
'bracketright' => ']', 'asciicircum' => '^',
'braceleft' => '\\{', 'apostrophe' => '\'',
'braceright' => '\\}', 'bracketleft' => '[',
'backslash' => '$\\backslash$', 'bracketright' => ']',
'slash' => '/', 'braceleft' => '{',
'rightanglebracket' => '>', 'braceright' => '}',
'leftanglebracket' => '<', 'backslash' => '\\',
'ampersand' => '\\&', 'slash' => '/',
'comma' => ',', 'rightanglebracket' => '&gt;',
'period' => '.', 'leftanglebracket' => '&lt;',
'semicolon' => ';', 'ampersand' => '&',
'colon' => ':', 'comma' => ',',
'equal' => '=', 'period' => '.',
'minus' => '-', 'semicolon' => ';',
'plus' => '+', 'colon' => ':',
'grave' => '`', 'equal' => '=',
'rightarrow' => '$\rightarrow$', 'minus' => '-',
'leftarrow' => '$\\leftarrow$', 'plus' => '+',
'uparrow' => '$\\uparrow$', 'grave' => '`',
'downarrow' => '$\\downarrow$', 'rightarrow' => '&rarr;',
'Page_Down' => 'Page Down', 'leftarrow' => '&larr;',
'Page_Up' => 'Page Up', 'uparrow' => '&uarr;',
'space' => 'space', 'downarrow' => '&darr;',
'KP_' => 'KP$\_$', 'Page_Down' => 'PageDown',
'greater' => '>', 'Page_Up' => 'PageUp',
'less' => '<', 'space' => 'space',
'KP_Right' => 'KP-&rarr;',
'KP_Left' => 'KP-&larr;',
'KP_Up' => 'KP-&uarr;',
'KP_Down' => 'KP-&darr;',
'KP_0' => 'KP-0;',
'greater' => '&gt;',
'less' => '&lt;',
);
} else {
%keycodes = (
'asciicircum' => '\\verb=^=',
'apostrophe' => '\'',
'bracketleft' => '[',
'bracketright' => ']',
'braceleft' => '\\{',
'braceright' => '\\}',
'backslash' => '$\\backslash$',
'slash' => '/',
'rightanglebracket' => '>',
'leftanglebracket' => '<',
'ampersand' => '\\&',
'comma' => ',',
'period' => '.',
'semicolon' => ';',
'colon' => ':',
'equal' => '=',
'minus' => '-',
'plus' => '+',
'grave' => '`',
'rightarrow' => '$\rightarrow$',
'leftarrow' => '$\\leftarrow$',
'uparrow' => '$\\uparrow$',
'downarrow' => '$\\downarrow$',
'Page_Down' => 'Page Down',
'Page_Up' => 'Page Up',
'space' => 'space',
'KP_' => 'KP$\_$',
'greater' => '>',
'less' => '<',
); );
}
if ($merge_from) { if ($merge_from) {
open (BINDINGS, $merge_from) || die ("merge from bindings: file not readable"); open (BINDINGS, $merge_from) || die ("merge from bindings: file not readable");
@ -226,6 +269,102 @@ if ($make_accelmap || !$make_cheatsheet) {
exit 0; exit 0;
} }
if ($html) {
@groups_sorted_by_number = sort { $group_numbering{$a} <=> $group_numbering{$b} } keys %group_numbering;
foreach $gk (@groups_sorted_by_number) {
if ($gk =~ /^m/) {
# mouse stuff - ignore
next;
}
# $bref is a reference to the array of arrays for this group
$bref = $group_bindings{$gk};
if (scalar @$bref > 1) {
$name = $group_names{$gk};
$name =~ s/\\linebreak.*//;
$name =~ s/\\&/&/;
$name =~ s/\$\\_\$/-/g;
$name =~ s/\\[a-z]+ //g;
$name =~ s/[{}]//g;
$name =~ s/\\par//g;
print "<h3>$name</h3>\n";
$gtext = $group_text{$gk};
$gtext =~ s/\\linebreak.*//;
$gtext =~ s/\\&/&/;
$gtext =~ s/\$\\_\$/-/g;
$gtext =~ s/\\[a-z]+ //g;
$gtext =~ s/[{}]//g;
$gtext =~ s/\\par//g;
if (!($gtext eq "")) {
print "$gtext\n\n";
}
# ignore the first entry, which was empty
shift (@$bref);
# set up the list
print "<dl class=\"bindings\">\n";
# sort the array of arrays by the descriptive text for nicer appearance,
# and print them
for $bbref (sort { @$a[1] cmp @$b[1] } @$bref) {
# $bbref is a reference to an array
$binding = @$bbref[0];
$text = @$bbref[1];
if ($binding =~ /:/) { # mouse binding with "where" clause
($binding,$where) = split (/:/, $binding, 2);
}
foreach $k (keys %cs_modifier_map) {
$binding =~ s/\@$k\@/$cs_modifier_map{$k}/;
}
# remove braces for HTML
$binding =~ s/></\+/g;
$binding =~ s/^<//;
$binding =~ s/>/\+/;
# substitute keycode names for something printable
$re = qr/${ \(join'|', map quotemeta, keys %keycodes)}/;
$binding =~ s/($re)/$keycodes{$1}/g;
# tidy up description
$descr = @$bbref[1];
$descr =~ s/\\linebreak.*//;
$descr =~ s/\\&/&/;
$descr =~ s/\$\\_\$/-/g;
$descr =~ s/\\[a-z]+ //g;
$descr =~ s/[{}]//g;
$descr =~ s/\\par//g;
print "<dt>$descr</dt><dd>$binding</dd>\n";
}
print "</dl>\n";
}
}
print "&nbsp; <!-- remove this if more text is added below -->\n";
exit 0;
}
# Now print the cheatsheet # Now print the cheatsheet
$boilerplate_header = <<END_HEADER; $boilerplate_header = <<END_HEADER;