I am submitting this again - my previous patch removed some new
features.
This patch adds a few keybindings that I felt to be missing from
xconfig.
The PageDown, PageUp, Home, End, Down, and Up keys now work. I
also added the following mnemonic keybindings: Alt-q for "Quit
without Saving", Alt-s for "Save and Exit", Alt-n for Next,
Alt-p for Prev, and Esc to leave a submenu. Suggestions welcome.
-Kip
diff -Naur linux/scripts/header.tk linux-new/scripts/header.tk
--- linux/scripts/header.tk Sun May 21 20:18:08 2000
+++ linux-new/scripts/header.tk Tue May 30 23:57:03 2000
@@ -110,6 +110,8 @@
wm geometry $w +$winx+$winy
}
+bind all <Alt-q> {maybe_exit .maybe}
+
proc maybe_exit { w } {
catch {destroy $w}
toplevel $w -class Dialog
@@ -128,6 +130,8 @@
-width 20 -command "destroy $w; focus $oldFocus"
pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
pack $w.f -pady 10 -side bottom -padx 10 -anchor w
+ bind $w <Return> "exit"
+ bind $w <Escape> "destroy $w; focus $oldFocus"
focus $w
global winx; global winy
set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
@@ -531,6 +535,9 @@
wm maxsize $w [winfo width $w] $sizy
}
+bind all <Alt-s> { catch {exec cp -f .config .config.old}; \
+ writeconfig .config include/linux/autoconf.h; wrapup .wrap }
+
proc wrapup {w } {
catch {destroy $w}
toplevel $w -class Dialog
@@ -554,6 +561,7 @@
pack $w.f.back -side bottom -pady 10 -anchor s
pack $w.f -pady 10 -side top -padx 10 -anchor s
focus $w
+ bind $w <Return> "exit"
global winx; global winy
set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
wm geometry $w +$winx+$winy
diff -Naur linux/scripts/tail.tk linux-new/scripts/tail.tk
--- linux/scripts/tail.tk Sun May 21 20:18:08 2000
+++ linux-new/scripts/tail.tk Wed May 31 00:01:39 2000
@@ -32,11 +32,11 @@
update_define 1 $total_menus 0
update_mainmenu
-button .f0.right.save -anchor w -text "Save and Exit" \
+button .f0.right.save -anchor w -text "Save and Exit" -underline 0\
-command { catch {exec cp -f .config .config.old}; \
writeconfig .config include/linux/autoconf.h; wrapup .wrap }
-button .f0.right.quit -anchor w -text "Quit Without Saving" \
+button .f0.right.quit -anchor w -text "Quit Without Saving" -underline 0\
-command { maybe_exit .maybe }
button .f0.right.load -anchor w -text "Load Configuration from File" \
diff -Naur linux/scripts/tkgen.c linux-new/scripts/tkgen.c
--- linux/scripts/tkgen.c Sun May 21 20:18:08 2000
+++ linux-new/scripts/tkgen.c Wed May 31 00:03:38 2000
@@ -149,18 +149,10 @@
printf( "\tpack $w.m -pady 10 -side top -padx 10\n" );
printf( "\twm title $w \"%s\" \n\n", label );
- /*
- * Attach the "Prev", "Next" and "OK" buttons at the end of the window.
- */
- printf( "\tframe $w.f\n" );
- if ( toplevel )
- printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" );
- else
- printf( "\tbutton $w.f.back -text \"OK\" \\\n" );
- printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d\"\n",
- menu_num );
- printf( "\tbutton $w.f.next -text \"Next\" \\\n" );
- printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; " );
+ printf( "\tbind $w <Escape> \"catch {focus $oldFocus}; destroy $w; unregister_active %d; break\"\n", menu_num);
+
+ printf("\tset nextscript ");
+ printf("\"catch {focus $oldFocus}; " );
/*
* We are checking which windows should be destroyed and which are
* common parrents with the next one. Remember that menu_num field
@@ -182,13 +174,48 @@
}
printf( "menu%d .menu%d \\\"$title\\\"\"\n",
menu_num+1, menu_num+1 );
- if ( menu_num == tot_menu_num )
- printf( "\t$w.f.next configure -state disabled\n" );
- printf( "\tbutton $w.f.prev -text \"Prev\" \\\n" );
+
+ /*
+ * Attach the "Prev", "Next" and "OK" buttons at the end of the window.
+ */
+ printf( "\tframe $w.f\n" );
+ if ( toplevel )
+ printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" );
+ else
+ printf( "\tbutton $w.f.back -text \"OK\" \\\n" );
+ printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d\"\n",
+ menu_num );
+ printf( "\tbutton $w.f.next -text \"Next\" -underline 0\\\n" );
+ printf( "\t\t-width 15 -command $nextscript\n");
+
+ if ( menu_num == tot_menu_num ) {
+ printf( "\t$w.f.next configure -state disabled\n" );
+ /*
+ * this is a bit hackish but Alt-n must be rebound
+ * otherwise if the user press Alt-n on the last menu
+ * it will give him/her the next menu of one of the
+ * previous options
+ */
+ printf( "\tbind all <Alt-n> \"puts \\\"no more menus\\\" \"\n");
+ }
+ else
+ {
+ /*
+ * I should be binding to $w not all - but if I do nehat I get the error "unknown path"
+ */
+ printf( "\tbind all <Alt-n> $nextscript\n");
+ }
+ printf( "\tbutton $w.f.prev -text \"Prev\" -underline 0\\\n" );
printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d; menu%d .menu%d \\\"$title\\\"\"\n",
menu_num, menu_num-1, menu_num-1 );
- if ( menu_num == 1 )
+ if ( menu_num == 1 ) {
printf( "\t$w.f.prev configure -state disabled\n" );
+ }
+ else
+ {
+ printf( "\tbind $w <Alt-p> \"catch {focus $oldFocus}; destroy $w; unregister_active %d; menu%d .menu%d \\\"$title\\\";break\"\n",
+ menu_num, menu_num-1, menu_num-1 );
+ }
printf( "\tpack $w.f.back $w.f.next $w.f.prev -side left -expand on\n" );
printf( "\tpack $w.f -pady 10 -side bottom -anchor w -fill x\n" );
@@ -215,6 +242,12 @@
printf( "\t\t-relief flat -borderwidth 0 -yscrollcommand \"$w.config.vscroll set\" \\\n" );
printf( "\t\t-width [expr [winfo screenwidth .] * 1 / 2] \n" );
printf( "\tframe $w.config.f\n" );
+ printf( "\tbind $w <Key-Down> \"$w.config.canvas yview scroll 1 unit;break;\"\n");
+ printf( "\tbind $w <Key-Up> \"$w.config.canvas yview scroll -1 unit;break;\"\n");
+ printf( "\tbind $w <Key-Next> \"$w.config.canvas yview scroll 1 page;break;\"\n");
+ printf( "\tbind $w <Key-Prior> \"$w.config.canvas yview scroll -1 page;break;\"\n");
+ printf( "\tbind $w <Key-Home> \"$w.config.canvas yview moveto 0;break;\"\n");
+ printf( "\tbind $w <Key-End> \"$w.config.canvas yview moveto 1 ;break;\"\n");
printf( "\tpack $w.config.canvas -side right -fill y\n" );
printf("\n\n");
}
Adds sensible keybindings to xconfig e.g. PageDown, PageUp, Alt-S for Save,
Esc for leaving a submenu, etc.
Kip Macy, kip@eventdriven.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:26 EST