From de6b7015b91d370f83e4189c05393eefceab0678 Mon Sep 17 00:00:00 2001 From: mdw Date: Mon, 15 Sep 2003 02:49:14 +0000 Subject: [PATCH] Monoalphabetic match filter. Simplify the button list. --- anag-gui.in | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/anag-gui.in b/anag-gui.in index 327164e..317f304 100644 --- a/anag-gui.in +++ b/anag-gui.in @@ -176,19 +176,25 @@ frame .f-entry frame .f-list frame .f-buttons -button .b-anagram -text "Anagram" -underline 0 \ - -command { run-search "-anagram" $word } -button .b-subgram -text "Subgram" -underline 0 \ - -command { run-search "-subgram" $word } -button .b-glob -text "Crossword" -underline 5 \ - -command { run-search "-wildcard" $word } -button .b-track -text "Trackword" -underline 0 \ - -command { run-search "-trackword" $word } -button .b-regexp -text "Regexp" -underline 0 \ - -command { run-search "-regexp" $word } +foreach {opt text mnem} { + anagram Anagram a + subgram Subgram s + wildcard Crossword w + trackword Trackword t + mono Monoalphabetic m + regexp "Regular expression" r +} { + button .b-$opt -text $text \ + -underline [string first $mnem [string tolower $text]] \ + -command [concat [list run-search -$opt] \$word] + bind . [list tkButtonInvoke .b-$opt] + pack .b-$opt -in .f-buttons -fill x -padx 2 -pady 2 +} button .b-custom -text "Custom" -underline 0 \ -command { run-search-v [wordlist $word] } +bind . { tkButtonInvoke .b-custom } +pack .b-custom -in .f-buttons -fill x -padx 2 -pady 2 listbox .list \ -xscrollcommand { .f-list.xscroll set } \ @@ -204,9 +210,6 @@ grid .f-list.yscroll -row 0 -column 1 -sticky ns grid rowconfigure .f-list 0 -weight 1 grid columnconfigure .f-list 0 -weight 1 -pack .b-custom .b-track .b-regexp .b-glob .b-subgram .b-anagram \ - -in .f-buttons -fill x -padx 2 -pady 2 - pack .e-word -in .f-entry -expand yes -fill x -padx 2 -pady 2 pack .f-entry -fill x @@ -223,9 +226,3 @@ menu .menu.file focus .e-word bind .e-word { tkButtonInvoke .b-anagram } -bind . { tkButtonInvoke .b-anagram } -bind . { tkButtonInvoke .b-track } -bind . { tkButtonInvoke .b-subgram } -bind . { tkButtonInvoke .b-glob } -bind . { tkButtonInvoke .b-regexp } -bind . { tkButtonInvoke .b-custom } -- 2.11.0