From 48a97e7026c701c883d78ea510660377d6e942db Mon Sep 17 00:00:00 2001 From: svkalinin Date: Thu, 21 Jul 2022 16:01:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20=D1=81=D0=BE?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=BA?= =?UTF-8?q?=D1=80=D1=8B=D1=82=D0=B8=D0=B8=20=D0=B2=D0=BA=D0=BB=D0=B0=D0=B4?= =?UTF-8?q?=D0=BA=D0=B8=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=20=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=B2=D1=8B=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=20=D0=B8=D0=B7=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=BC=D1=8B=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BD=D0=B5=D1=81=D0=BE=D1=85=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 4 ++++ debian/build-deb-projman.sh | 2 +- lib/files.tcl | 24 ++++++++++++++++++++++-- lib/gui.tcl | 1 - lib/procedure.tcl | 7 +++++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c9431f9..7232244 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/debian/build-deb-projman.sh b/debian/build-deb-projman.sh index 02d053d..b1c98d7 100755 --- a/debian/build-deb-projman.sh +++ b/debian/build-deb-projman.sh @@ -17,4 +17,4 @@ dpkg-buildpackage #cp ../projman_${VERSION}-${RELEASE}_amd64.deb /files/ -rm projman \ No newline at end of file +rm projman diff --git a/lib/files.tcl b/lib/files.tcl index b7e5a6f..e232ee2 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -47,13 +47,32 @@ 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 {} { diff --git a/lib/gui.tcl b/lib/gui.tcl index 938f40e..ff61e87 100644 --- a/lib/gui.tcl +++ b/lib/gui.tcl @@ -161,4 +161,3 @@ if {$cfgVariables(toolBarShow) eq "true"} { } .frmBody.panel add $frm_work -weight 1 # # - diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 3f4d8ed..0d3de49 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -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 } -