Добавлен диалог сохранения файла при закрытии вкладки редактора и при выходе из программы если есть несохраненные файлы
This commit is contained in:
parent
dadf1eb964
commit
48a97e7026
|
@ -31,3 +31,7 @@
|
||||||
- Fixed indent text
|
- Fixed indent text
|
||||||
- Fixed insert " and '
|
- Fixed insert " and '
|
||||||
- Added a main window geometry option into config, and autosave current geometry
|
- 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
|
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 {} {
|
proc Close {} {
|
||||||
global nbEditor modified tree
|
global nbEditor modified tree
|
||||||
set nbItem [$nbEditor select]
|
set nbItem [$nbEditor select]
|
||||||
|
puts "close tab $nbItem"
|
||||||
if {$nbItem == ""} {return}
|
if {$nbItem == ""} {return}
|
||||||
if {$modified($nbItem) eq "true"} {
|
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
|
$nbEditor forget $nbItem
|
||||||
destroy $nbItem
|
destroy $nbItem
|
||||||
|
@ -61,6 +80,7 @@ namespace eval FileOper {
|
||||||
if {[$tree parent $treeItem] eq "" } {
|
if {[$tree parent $treeItem] eq "" } {
|
||||||
$tree delete $treeItem
|
$tree delete $treeItem
|
||||||
}
|
}
|
||||||
|
unset modified($nbItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Save {} {
|
proc Save {} {
|
||||||
|
|
|
@ -161,4 +161,3 @@ if {$cfgVariables(toolBarShow) eq "true"} {
|
||||||
}
|
}
|
||||||
.frmBody.panel add $frm_work -weight 1
|
.frmBody.panel add $frm_work -weight 1
|
||||||
# #
|
# #
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
proc Quit {} {
|
proc Quit {} {
|
||||||
global dir
|
global dir
|
||||||
Config::write $dir(cfg)
|
Config::write $dir(cfg)
|
||||||
exit
|
if {[FileOper::CloseAll] eq "cancel"} {
|
||||||
|
return "cancel"
|
||||||
|
} else {
|
||||||
|
exit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc ViewFilesTree {} {
|
proc ViewFilesTree {} {
|
||||||
|
@ -70,4 +74,3 @@ proc SetModifiedFlag {w} {
|
||||||
$nbEditor tab $w -text $lbl
|
$nbEditor tab $w -text $lbl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user