added "Reload" entry to the File menu

(Boeing r1888)
This commit is contained in:
ahrenholz 2014-10-22 19:33:32 +00:00
parent 0fbe03646c
commit 3422d13851
2 changed files with 7 additions and 6 deletions

View file

@ -475,8 +475,7 @@ proc mrufile { f args } {
# if it exists already, remove it from the list, add to the front; also limit # if it exists already, remove it from the list, add to the front; also limit
# the length of this list; if no file specified, erase the list # the length of this list; if no file specified, erase the list
proc addFileToMrulist { f } { proc addFileToMrulist { f } {
global g_mrulist g_prefs global g_mrulist g_prefs g_mru_index
set MRUI 14 ;# index of MRU list -- update when adding to File menu!
set oldlength [llength $g_mrulist] set oldlength [llength $g_mrulist]
set maxlength $g_prefs(num_recent) set maxlength $g_prefs(num_recent)
@ -489,7 +488,7 @@ proc addFileToMrulist { f } {
# clear the MRU list menu # clear the MRU list menu
if { $oldlength > 0 } { if { $oldlength > 0 } {
set end_of_menu [.menubar.file index end] set end_of_menu [.menubar.file index end]
.menubar.file delete $MRUI [expr {$end_of_menu - 2}] .menubar.file delete $g_mru_index [expr {$end_of_menu - 2}]
} }
if { $f == "" } { ;# used to reset MRU list if { $f == "" } { ;# used to reset MRU list
set g_mrulist {} set g_mrulist {}
@ -499,7 +498,7 @@ proc addFileToMrulist { f } {
set g_mrulist [linsert $g_mrulist 0 "$f"] set g_mrulist [linsert $g_mrulist 0 "$f"]
set g_mrulist [lrange $g_mrulist 0 [expr {$maxlength - 1}]] set g_mrulist [lrange $g_mrulist 0 [expr {$maxlength - 1}]]
set i $MRUI set i $g_mru_index
foreach f $g_mrulist { foreach f $g_mrulist {
.menubar.file insert $i command -label "$f" -command "mrufile $f" .menubar.file insert $i command -label "$f" -command "mrufile $f"
incr i 1 incr i 1

View file

@ -228,6 +228,9 @@ bind . <Control-n> "fileNewDialogBox"
-accelerator "Ctrl+O" -command { fileOpenDialogBox } -accelerator "Ctrl+O" -command { fileOpenDialogBox }
bind . <Control-o> "fileOpenDialogBox" bind . <Control-o> "fileOpenDialogBox"
.menubar.file add command -label "Reload" -underline 0 \
-command { openFile }
.menubar.file add command -label Save -underline 0 \ .menubar.file add command -label Save -underline 0 \
-accelerator "Ctrl+S" -command { fileSaveDialogBox "" } -accelerator "Ctrl+S" -command { fileSaveDialogBox "" }
bind . <Control-s> "fileSaveDialogBox {}" bind . <Control-s> "fileSaveDialogBox {}"
@ -277,7 +280,6 @@ bind . <Control-s> "fileSaveDialogBox {}"
$w.e1 insert 0 "lpr" $w.e1 insert 0 "lpr"
pack $w.e1 -side top -pady 5 -padx 10 -fill x pack $w.e1 -side top -pady 5 -padx 10 -fill x
} }
# Boeing: added "Save Screenshot" function and most-recently-used file list
.menubar.file add command -label "Save screenshot..." -command { .menubar.file add command -label "Save screenshot..." -command {
global currentFile global currentFile
set initialfile [file tail $currentFile] set initialfile [file tail $currentFile]
@ -295,10 +297,10 @@ bind . <Control-s> "fileSaveDialogBox {}"
} }
} }
.menubar.file add separator .menubar.file add separator
set g_mru_index 15 ;# index of first MRU list item
foreach f $g_mrulist { foreach f $g_mrulist {
.menubar.file add command -label "$f" -command "mrufile {$f}" .menubar.file add command -label "$f" -command "mrufile {$f}"
} }
# end Boeing changes
.menubar.file add separator .menubar.file add separator
.menubar.file add command -label Quit -underline 0 -command { exit } .menubar.file add command -label Quit -underline 0 -command { exit }