Some FileDialog fixes

This commit is contained in:
Sergey Kalinin 2018-02-08 16:53:55 +03:00
parent d2a0e3fd31
commit fa64acd016
3 changed files with 35 additions and 35 deletions

View File

@ -363,7 +363,7 @@ proc Replace {text incr} {
# focus -force .replace # focus -force .replace
} }
## FILE OPERATION ## ## FILE OPERATION ##
proc FileDialog {$tree operation} { proc FileDialog {tree operation} {
global noteBook fontNormal fontBold fileList noteBook projDir activeProject imgDir editor global noteBook fontNormal fontBold fileList noteBook projDir activeProject imgDir editor
set dot "_" set dot "_"
set types { set types {
@ -407,7 +407,7 @@ proc FileDialog {$tree operation} {
-type yesno -icon question -default yes] -type yesno -icon question -default yes]
case $answer { case $answer {
yes { yes {
FileDialog close FileDialog $tree close
file delete -force "$fullPath" file delete -force "$fullPath"
$tree delete $node $tree delete $node
$tree configure -redraw 1 $tree configure -redraw 1
@ -520,7 +520,7 @@ proc FileDialog {$tree operation} {
-title [::msgcat::mc "Warning"]] -title [::msgcat::mc "Warning"]]
case $answer { case $answer {
yes { yes {
FileDialog save FileDialog $tree save
# FileDialog close # FileDialog close
} }
no { no {
@ -588,7 +588,7 @@ proc FileDialog {$tree operation} {
-title [::msgcat::mc "Warning"]] -title [::msgcat::mc "Warning"]]
case $answer { case $answer {
yes { yes {
FileDialog save FileDialog $tree save
} }
no {} no {}
cancel {return cancel} cancel {return cancel}
@ -971,12 +971,12 @@ proc EditFile {tree node fileName} {
bind $text <Control-ecircumflex> ReplaceDialog bind $text <Control-ecircumflex> ReplaceDialog
bind $text <Control-r> ReplaceDialog bind $text <Control-r> ReplaceDialog
bind $text <F4> {ReplaceCommand $w.text 1} bind $text <F4> {ReplaceCommand $w.text 1}
bind $text <Control-ucircumflex> {FileDialog save} bind $text <Control-ucircumflex> {FileDialog $tree save}
bind $text <Control-s> {FileDialog save} bind $text <Control-s> {FileDialog $tree save}
bind $text <Control-ocircumflex> {FileDialog save_as} bind $text <Control-ocircumflex> {FileDialog $tree save_as}
bind $text <Shift-Control-s> {FileDialog save_as} bind $text <Shift-Control-s> {FileDialog $tree save_as}
bind $text <Control-odiaeresis> {FileDialog close} bind $text <Control-odiaeresis> {FileDialog $tree close}
bind $text <Control-w> {FileDialog close} bind $text <Control-w> {FileDialog $tree close}
bind $text <Control-division> "tk_textCut $w.text;break" bind $text <Control-division> "tk_textCut $w.text;break"
bind $text <Control-x> "tk_textCut $w.text;break" bind $text <Control-x> "tk_textCut $w.text;break"
bind $text <Control-ntilde> "tk_textCopy $w.text;break" bind $text <Control-ntilde> "tk_textCopy $w.text;break"

View File

@ -35,19 +35,19 @@ $mn add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog
-font $fontNormal -accelerator "Ctrl+N" -font $fontNormal -accelerator "Ctrl+N"
$mn add command -label [::msgcat::mc "New project"] -command {NewProjDialog "new"}\ $mn add command -label [::msgcat::mc "New project"] -command {NewProjDialog "new"}\
-font $fontNormal -font $fontNormal
$m add command -label [::msgcat::mc "Open"] -command {FileDialog open}\ #$m add command -label [::msgcat::mc "Open"] -command {FileDialog open}\
-font $fontNormal -accelerator "Ctrl+O" -state disable #-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" -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 -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 -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" -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 -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" -font $fontNormal -accelerator "Ctrl+D"
$m add separator $m add separator
$m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8" $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"} { if {$toolBar == "Yes"} {
set bboxFile [ButtonBox .frmTool.bboxFile -spacing 0 -padx 1 -pady 1 -bg $editor(bg)] 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 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.png {FileDialog $tree 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_as.png {FileDialog $tree 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_all.png {FileDialog $tree save_all} [::msgcat::mc "Save all"]
add_toolbar_button $bboxFile printer.png {PrintDialog} [::msgcat::mc "Print ..."] 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)] 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"] add_toolbar_button $bboxEdit copy.png {TextOperation copy} [::msgcat::mc "Copy into clipboard"]
@ -308,8 +308,8 @@ $tree bindText <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
$tree bindImage <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]" $tree bindImage <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]"
$tree bindImage <ButtonPress-1> "TreeOneClick $tree [$tree selection get]" $tree bindImage <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
$tree bindText <Shift-Button-1> {$tree selection add [$tree selection get]} $tree bindText <Shift-Button-1> {$tree selection add [$tree selection get]}
bind $frmTree.tree.c <Control-acircumflex> {FileDialog delete} bind $frmTree.tree.c <Control-acircumflex> {FileDialog $tree delete}
bind $frmTree.tree.c <Control-d> {FileDialog delete} bind $frmTree.tree.c <Control-d> {FileDialog $tree delete}
bind $frmTree.tree.c <Return> { bind $frmTree.tree.c <Return> {
set node [$tree selection get] set node [$tree selection get]
TreeOneClick $tree $node TreeOneClick $tree $node
@ -323,19 +323,19 @@ $m add command -label [::msgcat::mc "New file"] -command {AddToProjDialog file}\
-font $fontNormal -accelerator "Ctrl+N" -font $fontNormal -accelerator "Ctrl+N"
$m add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory}\ $m add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory}\
-font $fontNormal -accelerator "Alt + Ctrl+N" -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 -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" -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" -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 -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" -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 -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" -font $fontNormal -accelerator "Ctrl+D"
$m add separator $m add separator
$m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8" $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 ## ## TABS popups ##
set m .popupTabs set m .popupTabs
menu $m -font $fontNormal -bg $editor(bg) -fg $editor(fg) 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" -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 -font $fontNormal
proc PopupMenuTab {menu x y} { proc PopupMenuTab {menu x y} {

View File

@ -192,7 +192,7 @@ proc MakeTGZ {} {
ok {return 0} ok {return 0}
} }
} }
FileDialog save_all FileDialog tree save_all
set file [open [file join $workDir $activeProject.proj] r] set file [open [file join $workDir $activeProject.proj] r]
while {[gets $file line]>=0} { while {[gets $file line]>=0} {
scan $line "%s" keyWord scan $line "%s" keyWord
@ -404,7 +404,7 @@ proc SendEmail {mail} {
} }
## QUIT PROJECT MANAGER PROCEDURE ## ## QUIT PROJECT MANAGER PROCEDURE ##
proc Quit {} { proc Quit {} {
set v [FileDialog close_all] set v [FileDialog tree close_all]
if {$v == "cancel"} { if {$v == "cancel"} {
return return
} else { } else {