2022-07-21 10:56:46 +03:00
|
|
|
######################################################
|
|
|
|
# ProjMan 2
|
|
|
|
# Distributed under GNU Public License
|
|
|
|
# Author: Sergey Kalinin svk@nuk-svk.ru
|
|
|
|
# Copyright (c) "", 2022, https://nuk-svk.ru
|
|
|
|
######################################################
|
|
|
|
# The config file procedures
|
|
|
|
# create
|
|
|
|
# copy
|
|
|
|
# save
|
|
|
|
######################################################
|
|
|
|
|
|
|
|
namespace eval Config {} {
|
|
|
|
variable cfgINISections
|
|
|
|
variable cfgVariables
|
|
|
|
}
|
|
|
|
|
|
|
|
if [info exists env(LANG)] {
|
|
|
|
set locale $env(LANG)
|
|
|
|
} else {
|
|
|
|
set locale "en"
|
|
|
|
}
|
|
|
|
|
|
|
|
set ::configDefault "\[General\]
|
|
|
|
cfgModifyDate=''
|
2022-09-18 10:21:38 +03:00
|
|
|
opened=
|
|
|
|
editedFiles=
|
2022-09-22 16:40:58 +03:00
|
|
|
searchCommand=/usr/bin/grep
|
|
|
|
searchCommandOptions=-r -n -H
|
2022-10-17 16:55:22 +03:00
|
|
|
gitCommand=/usr/bin/git
|
2022-07-21 10:56:46 +03:00
|
|
|
\[GUI\]
|
2022-09-15 16:51:11 +03:00
|
|
|
locale=$locale
|
2022-07-21 10:56:46 +03:00
|
|
|
theme=dark
|
|
|
|
toolBarShow=true
|
|
|
|
menuShow=true
|
|
|
|
filesPanelShow=true
|
2022-08-17 16:52:22 +03:00
|
|
|
filesPanelPlace=left
|
2022-07-21 10:56:46 +03:00
|
|
|
geometry=1024x768
|
2022-08-01 16:20:47 +03:00
|
|
|
guiFont={Droid Sans Mono} 9
|
|
|
|
guiFontBold={Droid Sans Mono} 9 bold
|
|
|
|
guiFG=#cccccc
|
2022-07-21 10:56:46 +03:00
|
|
|
\[Editor\]
|
|
|
|
autoFormat=true
|
2022-08-17 16:52:22 +03:00
|
|
|
font=Monospace 10
|
|
|
|
fontBold=Monospace 10
|
2022-07-21 10:56:46 +03:00
|
|
|
backGround=#333333
|
|
|
|
foreground=#cccccc
|
|
|
|
selectbg=#10a410a410a4
|
2022-08-17 16:52:22 +03:00
|
|
|
selectLightBg=grey
|
2022-07-21 10:56:46 +03:00
|
|
|
nbNormal=#000000
|
|
|
|
nbModify=#ffff5d705d70
|
2022-08-24 14:59:35 +03:00
|
|
|
lineNumberFG=#444444
|
|
|
|
lineNumberBG=#151515
|
2022-07-21 10:56:46 +03:00
|
|
|
selectBorder=0
|
|
|
|
# must be: none, word or char
|
|
|
|
editorWrap=word
|
|
|
|
lineNumberShow=true
|
|
|
|
tabSize=4
|
2022-10-28 13:27:54 +03:00
|
|
|
procedureHelper=false
|
|
|
|
variableHelper=true
|
2022-07-21 10:56:46 +03:00
|
|
|
"
|
|
|
|
proc Config::create {dir} {
|
|
|
|
set cfgFile [open [file join $dir projman.ini] "w+"]
|
|
|
|
puts $cfgFile $::configDefault
|
|
|
|
close $cfgFile
|
|
|
|
}
|
|
|
|
|
|
|
|
proc Config::read {dir} {
|
|
|
|
set cfgFile [ini::open [file join $dir projman.ini] "r"]
|
|
|
|
foreach section [ini::sections $cfgFile] {
|
|
|
|
foreach key [ini::keys $cfgFile $section] {
|
|
|
|
lappend ::cfgINIsections($section) $key
|
|
|
|
set ::cfgVariables($key) [ini::value $cfgFile $section $key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ini::close $cfgFile
|
|
|
|
}
|
|
|
|
|
|
|
|
proc Config::write {dir} {
|
2022-09-15 16:51:11 +03:00
|
|
|
global activeProject
|
2022-07-21 10:56:46 +03:00
|
|
|
set cfgFile [ini::open [file join $dir projman.ini] "w"]
|
|
|
|
foreach section [array names ::cfgINIsections] {
|
|
|
|
foreach key $::cfgINIsections($section) {
|
|
|
|
ini::set $cfgFile $section $key $::cfgVariables($key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set systemTime [clock seconds]
|
|
|
|
# Set a config modify time (i don't know why =))'
|
|
|
|
ini::set $cfgFile "General" cfgModifyDate [clock format $systemTime -format "%D %H:%M:%S"]
|
|
|
|
|
|
|
|
# Save an top level window geometry into config
|
|
|
|
ini::set $cfgFile "GUI" geometry [wm geometry .]
|
2022-09-18 10:21:38 +03:00
|
|
|
if {[info exists activeProject] !=0 && $activeProject ne ""} {
|
2022-09-15 16:51:11 +03:00
|
|
|
ini::set $cfgFile "General" opened $activeProject
|
2022-09-16 16:36:26 +03:00
|
|
|
} else {
|
|
|
|
ini::set $cfgFile "General" opened ""
|
2022-09-15 16:51:11 +03:00
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
ini::commit $cfgFile
|
|
|
|
ini::close $cfgFile
|
|
|
|
}
|