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

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

View File

@ -9,6 +9,7 @@
######################################################
proc GetFileMenu {m} {
global activeProject
$m add command -label [::msgcat::mc "New file"] -command Editor::New\
-accelerator "Ctrl+N"
$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 {
set folderPath [FileOper::OpenFolderDialog]
if {$folderPath != ""} {
set activeProject $folderPath
FileOper::ReadFolder $folderPath
ReadFilesFromDirectory $folderPath $folderPath
}

View File

@ -122,6 +122,18 @@ if [info exists opened] {
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] {