Добавлено сохранение состояния редактора (открытые каталоги, файлы)

This commit is contained in:
svkalinin 2022-09-15 16:51:11 +03:00
parent db3cc0cc7d
commit 26f8df5335
3 changed files with 21 additions and 2 deletions

View File

@ -22,9 +22,11 @@ if [info exists env(LANG)] {
} }
set ::configDefault "\[General\] set ::configDefault "\[General\]
locale=$locale
cfgModifyDate='' cfgModifyDate=''
opened=''
editedFiles=''
\[GUI\] \[GUI\]
locale=$locale
theme=dark theme=dark
toolBarShow=true toolBarShow=true
menuShow=true menuShow=true
@ -70,6 +72,7 @@ proc Config::read {dir} {
} }
proc Config::write {dir} { proc Config::write {dir} {
global activeProject
set cfgFile [ini::open [file join $dir projman.ini] "w"] set cfgFile [ini::open [file join $dir projman.ini] "w"]
foreach section [array names ::cfgINIsections] { foreach section [array names ::cfgINIsections] {
foreach key $::cfgINIsections($section) { foreach key $::cfgINIsections($section) {
@ -82,7 +85,9 @@ proc Config::write {dir} {
# Save an top level window geometry into config # Save an top level window geometry into config
ini::set $cfgFile "GUI" geometry [wm geometry .] ini::set $cfgFile "GUI" geometry [wm geometry .]
if {$activeProject ne ""} {
ini::set $cfgFile "General" opened $activeProject
}
ini::commit $cfgFile ini::commit $cfgFile
ini::close $cfgFile ini::close $cfgFile
} }

View File

@ -9,6 +9,7 @@
###################################################### ######################################################
proc GetFileMenu {m} { proc GetFileMenu {m} {
global activeProject
$m add command -label [::msgcat::mc "New file"] -command Editor::New\ $m add command -label [::msgcat::mc "New file"] -command Editor::New\
-accelerator "Ctrl+N" -accelerator "Ctrl+N"
$m add command -label [::msgcat::mc "Open file"] -accelerator "Ctrl+O" -command { $m add command -label [::msgcat::mc "Open file"] -accelerator "Ctrl+O" -command {
@ -24,6 +25,7 @@ proc GetFileMenu {m} {
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command { $m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
set folderPath [FileOper::OpenFolderDialog] set folderPath [FileOper::OpenFolderDialog]
if {$folderPath != ""} { if {$folderPath != ""} {
set activeProject $folderPath
FileOper::ReadFolder $folderPath FileOper::ReadFolder $folderPath
ReadFilesFromDirectory $folderPath $folderPath ReadFilesFromDirectory $folderPath $folderPath
} }

View File

@ -122,6 +122,18 @@ if [info exists opened] {
ResetModifiedFlag [FileOper::Edit $path] ResetModifiedFlag [FileOper::Edit $path]
} }
} }
} else {
if {$cfgVariables(opened) ne ""} {
set activeProject $cfgVariables(opened)
FileOper::ReadFolder $cfgVariables(opened)
ReadFilesFromDirectory $cfgVariables(opened) $cfgVariables(opened)
if {$cfgVariables(editedFiles) ne ""} {
foreach f [split $cfgVariables(editedFiles) " "] {
puts $f
FileOper::Edit $f
}
}
}
} }
# if [info exists project] { # if [info exists project] {