Add in key shortcut (alt-h) to toggle history window

This commit is contained in:
duncan_ferguson 2007-11-28 22:49:59 +00:00
parent b7889e7236
commit 60c7d7b3fa
2 changed files with 34 additions and 11 deletions

View file

@ -2,6 +2,7 @@
* Update X resources class to allow use of terms other than XTerm
* Apply patch from Harald Weidner to stop error messages in Debian Etch
* Add in key shortcut (alt-h) to toggle history window
2008-11-28 Duncan Ferguson <duncan_ferguson@user.sf.net> - v3.21-1

View file

@ -168,6 +168,7 @@ sub load_config_defaults() {
$config{key_quit} = "Control-q";
$config{key_addhost} = "Control-plus";
$config{key_clientname} = "Alt-n";
$config{key_history} = "Alt-h";
$config{key_retilehosts} = "Alt-r";
$config{key_paste} = "Control-v";
$config{mouse_paste} = "Button-2";
@ -608,11 +609,23 @@ sub change_main_window_title() {
$windows{main_window}->title( $config{title} . " [$number]" );
}
sub show_history() {
if ( $config{show_history} ) {
$windows{history}->packForget();
$config{show_history} = 0;
}
else {
$windows{history}->pack(
-fill => "x",
-expand => 1,
);
$config{show_history} = 1;
}
}
sub update_display_text($) {
my $char = shift;
warn("config{show_history}=$config{show_history}");
return if ( !$config{show_history} );
logmsg( 2, "Dropping :$char: into display" );
@ -1375,19 +1388,21 @@ sub create_windows() {
-expand => 1,
);
$windows{history} = $windows{main_window}->Scrolled(
"ROText",
-insertborderwidth => 4,
-width => $config{history_width},
-height => $config{history_height},
-state => 'normal',
-takefocus => 0,
);
$windows{history}->bindtags(undef);
if ( $config{show_history} ) {
$windows{history} = $windows{main_window}->Scrolled(
"ROText",
-insertborderwidth => 4,
-width => $config{history_width},
-height => $config{history_height},
-state => 'normal',
-takefocus => 0,
)->pack(
$windows{history}->pack(
-fill => "x",
-expand => 1,
);
$windows{history}->bindtags(undef);
}
$windows{main_window}->bind( '<Destroy>' => \&exit_prog );
@ -1588,6 +1603,7 @@ sub key_event {
send_clientname() if ( $hotkey eq "key_clientname" );
add_host_by_name() if ( $hotkey eq "key_addhost" );
retile_hosts("force") if ( $hotkey eq "key_retilehosts" );
show_history() if ( $hotkey eq "key_history" );
exit_prog() if ( $hotkey eq "key_quit" );
}
return;
@ -1637,6 +1653,12 @@ sub create_menubar() {
$menus{file} = $menus{bar}->cascade(
-label => 'File',
-menuitems => [
[
"command",
"Show History",
-command => \&show_history,
-accelerator => $config{key_history},
],
[
"command",
"Exit",