From fa64acd016b76c5f78091a82f1b4689fd5e353bc Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Thu, 8 Feb 2018 16:53:55 +0300 Subject: [PATCH] Some FileDialog fixes --- lib/editor.tcl | 20 ++++++++++---------- lib/main.tcl | 46 +++++++++++++++++++++++----------------------- lib/procedure.tcl | 4 ++-- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index f6f743b..1318914 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -363,7 +363,7 @@ proc Replace {text incr} { # focus -force .replace } ## FILE OPERATION ## -proc FileDialog {$tree operation} { +proc FileDialog {tree operation} { global noteBook fontNormal fontBold fileList noteBook projDir activeProject imgDir editor set dot "_" set types { @@ -407,7 +407,7 @@ proc FileDialog {$tree operation} { -type yesno -icon question -default yes] case $answer { yes { - FileDialog close + FileDialog $tree close file delete -force "$fullPath" $tree delete $node $tree configure -redraw 1 @@ -520,7 +520,7 @@ proc FileDialog {$tree operation} { -title [::msgcat::mc "Warning"]] case $answer { yes { - FileDialog save + FileDialog $tree save # FileDialog close } no { @@ -588,7 +588,7 @@ proc FileDialog {$tree operation} { -title [::msgcat::mc "Warning"]] case $answer { yes { - FileDialog save + FileDialog $tree save } no {} cancel {return cancel} @@ -971,12 +971,12 @@ proc EditFile {tree node fileName} { bind $text ReplaceDialog bind $text ReplaceDialog bind $text {ReplaceCommand $w.text 1} - bind $text {FileDialog save} - bind $text {FileDialog save} - bind $text {FileDialog save_as} - bind $text {FileDialog save_as} - bind $text {FileDialog close} - bind $text {FileDialog close} + bind $text {FileDialog $tree save} + bind $text {FileDialog $tree save} + bind $text {FileDialog $tree save_as} + bind $text {FileDialog $tree save_as} + bind $text {FileDialog $tree close} + bind $text {FileDialog $tree close} bind $text "tk_textCut $w.text;break" bind $text "tk_textCut $w.text;break" bind $text "tk_textCopy $w.text;break" diff --git a/lib/main.tcl b/lib/main.tcl index 436b00b..5f5a1af 100644 --- a/lib/main.tcl +++ b/lib/main.tcl @@ -35,19 +35,19 @@ $mn add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog -font $fontNormal -accelerator "Ctrl+N" $mn add command -label [::msgcat::mc "New project"] -command {NewProjDialog "new"}\ -font $fontNormal -$m add command -label [::msgcat::mc "Open"] -command {FileDialog open}\ --font $fontNormal -accelerator "Ctrl+O" -state disable -$m add command -label [::msgcat::mc "Save"] -command {FileDialog save}\ +#$m add command -label [::msgcat::mc "Open"] -command {FileDialog open}\ +#-font $fontNormal -accelerator "Ctrl+O" -state disable +$m add command -label [::msgcat::mc "Save"] -command {FileDialog $tree save}\ -font $fontNormal -accelerator "Ctrl+S" -$m add command -label [::msgcat::mc "Save as"] -command {FileDialog save_as}\ +$m add command -label [::msgcat::mc "Save as"] -command {FileDialog $tree save_as}\ -font $fontNormal -$m add command -label [::msgcat::mc "Save all"] -command {FileDialog save_all}\ +$m add command -label [::msgcat::mc "Save all"] -command {FileDialog $tree save_all}\ -font $fontNormal -$m add command -label [::msgcat::mc "Close"] -command {FileDialog close}\ +$m add command -label [::msgcat::mc "Close"] -command {FileDialog $tree close}\ -font $fontNormal -accelerator "Ctrl+W" -$m add command -label [::msgcat::mc "Close all"] -command {FileDialog close_all}\ +$m add command -label [::msgcat::mc "Close all"] -command {FileDialog $tree close_all}\ -font $fontNormal -$m add command -label [::msgcat::mc "Delete"] -command {FileDialog delete}\ +$m add command -label [::msgcat::mc "Delete"] -command {FileDialog $tree delete}\ -font $fontNormal -accelerator "Ctrl+D" $m add separator $m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8" @@ -219,11 +219,11 @@ proc CreateToolBar {} { if {$toolBar == "Yes"} { set bboxFile [ButtonBox .frmTool.bboxFile -spacing 0 -padx 1 -pady 1 -bg $editor(bg)] add_toolbar_button $bboxFile new.png {AddToProjDialog file} [::msgcat::mc "Create new file"] - add_toolbar_button $bboxFile save.png {FileDialog save} [::msgcat::mc "Save file"] - add_toolbar_button $bboxFile save_as.png {FileDialog save_as} [::msgcat::mc "Save file as"] - add_toolbar_button $bboxFile save_all.png {FileDialog save_all} [::msgcat::mc "Save all"] + add_toolbar_button $bboxFile save.png {FileDialog $tree save} [::msgcat::mc "Save file"] + add_toolbar_button $bboxFile save_as.png {FileDialog $tree save_as} [::msgcat::mc "Save file as"] + add_toolbar_button $bboxFile save_all.png {FileDialog $tree save_all} [::msgcat::mc "Save all"] add_toolbar_button $bboxFile printer.png {PrintDialog} [::msgcat::mc "Print ..."] - add_toolbar_button $bboxFile close.png {FileDialog close} [::msgcat::mc "Close"] + add_toolbar_button $bboxFile close.png {FileDialog $tree close} [::msgcat::mc "Close"] set bboxEdit [ButtonBox .frmTool.bboxEdit -spacing 0 -padx 1 -pady 1 -bg $editor(bg)] add_toolbar_button $bboxEdit copy.png {TextOperation copy} [::msgcat::mc "Copy into clipboard"] @@ -308,8 +308,8 @@ $tree bindText "TreeOneClick $tree [$tree selection get]" $tree bindImage "TreeDoubleClick $tree [$tree selection get]" $tree bindImage "TreeOneClick $tree [$tree selection get]" $tree bindText {$tree selection add [$tree selection get]} -bind $frmTree.tree.c {FileDialog delete} -bind $frmTree.tree.c {FileDialog delete} +bind $frmTree.tree.c {FileDialog $tree delete} +bind $frmTree.tree.c {FileDialog $tree delete} bind $frmTree.tree.c { set node [$tree selection get] TreeOneClick $tree $node @@ -323,19 +323,19 @@ $m add command -label [::msgcat::mc "New file"] -command {AddToProjDialog file}\ -font $fontNormal -accelerator "Ctrl+N" $m add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory}\ -font $fontNormal -accelerator "Alt + Ctrl+N" -$m add command -label [::msgcat::mc "Open"] -command {FileDialog open}\ +$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\ -font $fontNormal -accelerator "Ctrl+O" -state disable -$m add command -label [::msgcat::mc "Save"] -command {FileDialog save}\ +$m add command -label [::msgcat::mc "Save"] -command {FileDialog $tree save}\ -font $fontNormal -accelerator "Ctrl+S" -$m add command -label [::msgcat::mc "Save as"] -command {FileDialog save_as}\ +$m add command -label [::msgcat::mc "Save as"] -command {FileDialog $tree save_as}\ -font $fontNormal -accelerator "Ctrl+A" -$m add command -label [::msgcat::mc "Save all"] -command {FileDialog save_all}\ +$m add command -label [::msgcat::mc "Save all"] -command {FileDialog $tree save_all}\ -font $fontNormal -$m add command -label [::msgcat::mc "Close"] -command {FileDialog close}\ +$m add command -label [::msgcat::mc "Close"] -command {FileDialog $tree close}\ -font $fontNormal -accelerator "Ctrl+W" -$m add command -label [::msgcat::mc "Close all"] -command {FileDialog close_all}\ +$m add command -label [::msgcat::mc "Close all"] -command {FileDialog $tree close_all}\ -font $fontNormal -$m add command -label [::msgcat::mc "Delete"] -command {FileDialog delete}\ +$m add command -label [::msgcat::mc "Delete"] -command {FileDialog $tree delete}\ -font $fontNormal -accelerator "Ctrl+D" $m add separator $m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8" @@ -348,9 +348,9 @@ GetProjMenu $m ## TABS popups ## set m .popupTabs menu $m -font $fontNormal -bg $editor(bg) -fg $editor(fg) -$m add command -label [::msgcat::mc "Close"] -command {FileDialog close}\ +$m add command -label [::msgcat::mc "Close"] -command {FileDialog $tree close}\ -font $fontNormal -accelerator "Ctrl+W" -$m add command -label [::msgcat::mc "Close all"] -command {FileDialog close_all}\ +$m add command -label [::msgcat::mc "Close all"] -command {FileDialog $tree close_all}\ -font $fontNormal proc PopupMenuTab {menu x y} { diff --git a/lib/procedure.tcl b/lib/procedure.tcl index d37b0f0..2894562 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -192,7 +192,7 @@ proc MakeTGZ {} { ok {return 0} } } - FileDialog save_all + FileDialog tree save_all set file [open [file join $workDir $activeProject.proj] r] while {[gets $file line]>=0} { scan $line "%s" keyWord @@ -404,7 +404,7 @@ proc SendEmail {mail} { } ## QUIT PROJECT MANAGER PROCEDURE ## proc Quit {} { - set v [FileDialog close_all] + set v [FileDialog tree close_all] if {$v == "cancel"} { return } else {