Добавлен диалог сохранения файла при закрытии вкладки редактора и при выходе из программы если есть несохраненные файлы
This commit is contained in:
parent
dadf1eb964
commit
48a97e7026
|
@ -31,3 +31,7 @@
|
|||
- Fixed indent text
|
||||
- Fixed insert " and '
|
||||
- Added a main window geometry option into config, and autosave current geometry
|
||||
|
||||
21/07/2022
|
||||
- Added Save file dialog before tab was closed
|
||||
- Added Save file dialog when exiting, if file was modify
|
||||
|
|
|
@ -48,12 +48,31 @@ namespace eval FileOper {
|
|||
return $fullPath
|
||||
}
|
||||
|
||||
proc CloseAll {} {
|
||||
global nbEditor modified
|
||||
foreach nbItem [array names modified] {
|
||||
if {$modified($nbItem) eq "true"} {
|
||||
$nbEditor select $nbItem
|
||||
puts "close tab $nbItem"
|
||||
if {[Close] eq "cancel"} {return "cancel"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc Close {} {
|
||||
global nbEditor modified tree
|
||||
set nbItem [$nbEditor select]
|
||||
puts "close tab $nbItem"
|
||||
if {$nbItem == ""} {return}
|
||||
if {$modified($nbItem) eq "true"} {
|
||||
Save
|
||||
set answer [tk_messageBox -message [::msgcat::mc "File was modifyed"] \
|
||||
-icon question -type yesnocancel \
|
||||
-detail [::msgcat::mc "Do you want to save it?"]]
|
||||
switch $answer {
|
||||
yes Save
|
||||
no {}
|
||||
cancel {return "cancel"}
|
||||
}
|
||||
}
|
||||
$nbEditor forget $nbItem
|
||||
destroy $nbItem
|
||||
|
@ -61,6 +80,7 @@ namespace eval FileOper {
|
|||
if {[$tree parent $treeItem] eq "" } {
|
||||
$tree delete $treeItem
|
||||
}
|
||||
unset modified($nbItem)
|
||||
}
|
||||
|
||||
proc Save {} {
|
||||
|
|
|
@ -161,4 +161,3 @@ if {$cfgVariables(toolBarShow) eq "true"} {
|
|||
}
|
||||
.frmBody.panel add $frm_work -weight 1
|
||||
# #
|
||||
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
proc Quit {} {
|
||||
global dir
|
||||
Config::write $dir(cfg)
|
||||
exit
|
||||
if {[FileOper::CloseAll] eq "cancel"} {
|
||||
return "cancel"
|
||||
} else {
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
proc ViewFilesTree {} {
|
||||
|
@ -70,4 +74,3 @@ proc SetModifiedFlag {w} {
|
|||
$nbEditor tab $w -text $lbl
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user