Added saving main window geometry into projman.conf file when close programm

This commit is contained in:
Sergey Kalinin
2018-02-15 12:51:28 +03:00
parent 3eaa8bb66f
commit 91fa85203b
13 changed files with 79 additions and 38 deletions

View File

@@ -41,6 +41,7 @@ proc auto_completition_proc { widget } {
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} {
return
}
#puts $procList()
set start_word [$widget get "insert - 1 chars wordstart" insert]
set box [$widget bbox insert]
set box_x [expr [lindex $box 0] + [winfo rootx $widget] ]
@@ -50,9 +51,12 @@ proc auto_completition_proc { widget } {
set pos "1.0"
set last_pos ""
puts "$start_word"
puts [regsub -all -- "\$" $start_word "\\\$" word]
puts $word
#puts [regsub -all -- "\$" $start_word "\\\$" word]
#puts $word
#set list_word($start_word) 1
#puts $varList($activeProject)
puts $procList($activeProject)
if {[string index $start_word 0] == "\$"} {
set workList $varList($activeProject)
} else {
@@ -171,6 +175,8 @@ proc auto_completition_key { widget K A } {

View File

@@ -881,6 +881,7 @@ proc TextEncode {encode} {
proc EditFile {tree node fileName} {
global projDir workDir imgDir noteBook fontNormal fontBold w fileList replace nodeEdit procList
global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject
global varList
set nodeEdit $node
set replace 0
set file [file tail $fileName]
@@ -933,6 +934,19 @@ proc EditFile {tree node fileName} {
} else {
scan $line "%s%s" keyWord procName
}
###################
if {[regexp -nocase -all -line -- {proc (.*) \{(.*)\}} $line match procName params]} {
set procList($activeProject) [list $procName [string trim $params]]
puts "proc $procName $params"
}
if {[regexp -nocase -all -line -- {set (\w+)} $line match varName]} {
#set varList($activeProject) [list [string trim $varName]]
#puts "variable $varName"
}
###################
# && $procName != ""
if {$keyWord == "proc" || $keyWord == "let" || $keyWord == "class" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "fun" } {
set dot "_"
@@ -946,7 +960,7 @@ proc EditFile {tree node fileName} {
set img "class.gif"
}
if {$keyWord =="proc"} {
lappend procList($activeProject) [list $procName "param"]
#$w.text tag add procName $lineNumber.[expr $startPos + $length] $lineNumber.[string wordend $line [expr $startPos + $length +2]]
}
if {[$tree exists $prcNode$dot$lineNumber] !=1} {
@@ -955,9 +969,6 @@ proc EditFile {tree node fileName} {
-image [Bitmap::get [file join $imgDir $img]] -font $fontNormal
}
}
if {$keyWord =="set"} {
lappend varList($activeProject) [list $procName "param"]]
}
incr lineNumber
}
close $file
@@ -1247,3 +1258,7 @@ GetOp

View File

@@ -179,6 +179,7 @@ proc HighLightTCL {text line lineNumber node} {
incr end $startPos
$text tag add bracequad $lineNumber.$start $lineNumber.$end
set startPos $end
$text tag lower bracequad
} else {
break
}
@@ -211,5 +212,3 @@ proc HighLightTCL {text line lineNumber node} {
}
}

View File

@@ -1436,3 +1436,4 @@ proc HM::cgiMap {data} {

View File

@@ -7,7 +7,13 @@
Modules
## MAIN INTERFACE ##
wm geometry . 1200x1024+0+0
#
if {[info exists topLevelGeometry]} {
wm geometry . $topLevelGeometry
} else {
wm geometry . 1200x1024+0+0
}
wm title . "Tcl/Tk Project Manager $ver"
wm iconname . "Tcl/Tk Project Manager $ver"
wm protocol . WM_DELETE_WINDOW Quit
@@ -397,3 +403,4 @@ focus -force $tree

View File

@@ -404,10 +404,23 @@ proc SendEmail {mail} {
}
## QUIT PROJECT MANAGER PROCEDURE ##
proc Quit {} {
global workDir
set v [FileDialog tree close_all]
if {$v == "cancel"} {
return
} else {
# copy projman.conf file and rewrite them
# open projman.conf file and write current main window geometry
file copy -force [file join $workDir projman.conf] [file join $workDir projman.conf.old]
set file [open [file join $workDir projman.conf.old] RDONLY]
set file1 [open [file join $workDir projman.conf] WRONLY]
while {[gets $file line]>=0} {
if {[regexp -nocase -all -- {set topLevelGeometry} $line match]} {
puts $file1 "set topLevelGeometry \"[winfo geometry .]\""
} else {
puts $file1 "$line"
}
}
exit
}
}
@@ -750,3 +763,7 @@ proc GetExtention {node} {

View File

@@ -8,10 +8,10 @@
## SETTING DIALOG ##
proc Settings {} {
global fontNormal fontBold imgDir workDir
global editor color nb
global editor color nb topLevelGeometry
global main editFrm network
global toolBar autoFormat backUpDel backUpCreate backUpShow localeSet localeList wrapSet wrapList
set topLevelGeometry [winfo geometry .]
set w .pref
# destroy the find window if it already exists
if {[winfo exists $w]} {
@@ -40,12 +40,12 @@ proc Settings {} {
puts $file "# TCL/Tk Project Manager #"
puts $file "# version $ver #"
puts $file "# #"
puts $file "# Copyright \(c\) \"Sergey Kalinin\", 2001, http://nuk-svk.ru #"
puts $file "# Authors: Sergey Kalinin \(aka BanZaj\) banzaj28@yandex.ru #"
puts $file "# Copyright \(c\) \"Sergey Kalinin\", 2001, http://nuk-svk.ru #"
puts $file "# Authors: Sergey Kalinin \(aka BanZaj\) banzaj28@yandex.ru #"
puts $file "###########################################################"
puts $file "# Modification date: [exec date]"
puts $file "###########################################################\n"
puts $file "set topLevelGeometry \"$topLevelGeometry\""
puts $file "# Normal Font"
puts $file "set fontNormal \"[$main.frmFontNormal.txtFontNormal get]\""
puts $file "# Bold Font #"
@@ -430,7 +430,7 @@ proc Settings {} {
set frm_20 [frame $editFrm.frmColorString -bg $editor(bg)]
label $frm_20.lblColorString -text [::msgcat::mc "Quote string"]\
-width 30 -anchor w -font $fontNormal
entry $frm_20.txtColorString -background $editor(bg)
entry $frm_20.txtColorString -background $editor(bg)
button $frm_20.btnColorString -borderwidth {1} -font $fontNormal \
-command {ColorSelect $editFrm.frmColorString.txtColorString $editFrm.frmColorString.btnColorString} \
-text "Select color"\
@@ -480,7 +480,7 @@ proc Settings {} {
set frm_26 [frame $editFrm.frmColorPercent -bg $editor(bg)]
label $frm_26.lblColorPercent -text [::msgcat::mc "Percent \%"]\
-width 30 -anchor w -font $fontNormal
-width 30 -anchor w -font $fontNormal
entry $frm_26.txtColorPercent -background $editor(bg)
button $frm_26.btnColorPercent -borderwidth {1} -font $fontNormal \
-command {ColorSelect $editFrm.frmColorPercent.txtColorPercent $editFrm.frmColorPercent.btnColorPercent} \
@@ -777,7 +777,7 @@ proc LoadSettings {} {
## SAVE SETTINGS PROCEDURE ##
proc SaveSettings {} {
global editor color workDir
global editor color workDir topLevelGeometry
global main editFrm network wrapSet
file copy -force [file join $workDir projman.conf] [file join $workDir projman.conf.old]
set file [open [file join $workDir projman.conf] w]
@@ -785,12 +785,12 @@ proc SaveSettings {} {
puts $file "# TCL/Tk Project Manager #"
puts $file "# version $ver #"
puts $file "# #"
puts $file "# Copyright \(c\) \"Sergey Kalinin\", 2001, http://nuk-svk.ru #"
puts $file "# Authors: Sergey Kalinin \(aka BanZaj\) banzaj28@yandex.ru #"
puts $file "# Copyright \(c\) \"Sergey Kalinin\", 2001, http://nuk-svk.ru #"
puts $file "# Authors: Sergey Kalinin \(aka BanZaj\) banzaj28@yandex.ru #"
puts $file "###########################################################\n"
puts $file "# Modification date: [exec date]"
puts $file "###########################################################\n"
puts $file "set topLevelGeometry \"$topLevelGeometry\""
puts $file "# Normal Font"
puts $file "set fontNormal \"[$main.frmFontNormal.txtFontNormal get]\""
puts $file "# Bold Font #"
@@ -879,3 +879,6 @@ proc SaveSettings {} {