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

@ -6,6 +6,9 @@
######################################################### #########################################################
0.4.5 0.4.5
14.02.2018
- Added saving main window geometry into projman.conf file when close programm
13.02.2018 13.02.2018
- Added gray theme - Added gray theme
- Fixed work with file from directory (FileBrowser function). - Fixed work with file from directory (FileBrowser function).
@ -401,5 +404,6 @@ Fixed bug with PageRise function

14
TODO
View File

@ -6,6 +6,7 @@
########################################################## ##########################################################
1. GUI 1. GUI
- Запомнить размер и местоположение окна и при запуске соответсвенно устанавливать.
- one click tree procedure - one click tree procedure
- added tcl-console - added tcl-console
@ -52,13 +53,9 @@
- code/encode text files - code/encode text files
- Add Insert curent date procedure - Add Insert curent date procedure
- search procedure with reguliar expretions - search procedure with reguliar expretions
- Comment/uncomment selected area
- On/Off wrap function - On/Off wrap function
9. Locale (messages)
- autodetect system locale
10. Help system 10. Help system
- patching html_lib - patching html_lib
- searchin in help - searchin in help
@ -73,12 +70,3 @@
########################################

0
errors Normal file
View File

View File

@ -7,7 +7,6 @@
# Author: Sergey Kalinin banzaj28@yandex.ru # # Author: Sergey Kalinin banzaj28@yandex.ru #
########################################################### ###########################################################
## SETTING VARIABLES AND DIRECTORYES ## ## SETTING VARIABLES AND DIRECTORYES ##
set ver "0.4.5" set ver "0.4.5"
set imgDir img set imgDir img
@ -34,7 +33,7 @@ if {$tcl_platform(platform) == "unix"} {
} }
proc InsertEnt {entry text} { proc InsertEnt {entry text} {
$entry delete 0 end entry delete 0 end
$entry insert end $text $entry insert end $text
} }
proc SelectDir {dir} { proc SelectDir {dir} {
@ -382,3 +381,5 @@ proc SetVarLang {lang} {
} }
} }

View File

@ -41,6 +41,7 @@ proc auto_completition_proc { widget } {
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} { if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} {
return return
} }
#puts $procList()
set start_word [$widget get "insert - 1 chars wordstart" insert] set start_word [$widget get "insert - 1 chars wordstart" insert]
set box [$widget bbox insert] set box [$widget bbox insert]
set box_x [expr [lindex $box 0] + [winfo rootx $widget] ] set box_x [expr [lindex $box 0] + [winfo rootx $widget] ]
@ -50,9 +51,12 @@ proc auto_completition_proc { widget } {
set pos "1.0" set pos "1.0"
set last_pos "" set last_pos ""
puts "$start_word" puts "$start_word"
puts [regsub -all -- "\$" $start_word "\\\$" word] #puts [regsub -all -- "\$" $start_word "\\\$" word]
puts $word #puts $word
#set list_word($start_word) 1 #set list_word($start_word) 1
#puts $varList($activeProject)
puts $procList($activeProject)
if {[string index $start_word 0] == "\$"} { if {[string index $start_word 0] == "\$"} {
set workList $varList($activeProject) set workList $varList($activeProject)
} else { } 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} { proc EditFile {tree node fileName} {
global projDir workDir imgDir noteBook fontNormal fontBold w fileList replace nodeEdit procList global projDir workDir imgDir noteBook fontNormal fontBold w fileList replace nodeEdit procList
global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject
global varList
set nodeEdit $node set nodeEdit $node
set replace 0 set replace 0
set file [file tail $fileName] set file [file tail $fileName]
@ -933,6 +934,19 @@ proc EditFile {tree node fileName} {
} else { } else {
scan $line "%s%s" keyWord procName 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 != "" # && $procName != ""
if {$keyWord == "proc" || $keyWord == "let" || $keyWord == "class" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "fun" } { if {$keyWord == "proc" || $keyWord == "let" || $keyWord == "class" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "fun" } {
set dot "_" set dot "_"
@ -946,7 +960,7 @@ proc EditFile {tree node fileName} {
set img "class.gif" set img "class.gif"
} }
if {$keyWord =="proc"} { 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]] #$w.text tag add procName $lineNumber.[expr $startPos + $length] $lineNumber.[string wordend $line [expr $startPos + $length +2]]
} }
if {[$tree exists $prcNode$dot$lineNumber] !=1} { 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 -image [Bitmap::get [file join $imgDir $img]] -font $fontNormal
} }
} }
if {$keyWord =="set"} {
lappend varList($activeProject) [list $procName "param"]]
}
incr lineNumber incr lineNumber
} }
close $file close $file
@ -1247,3 +1258,7 @@ GetOp

View File

@ -179,6 +179,7 @@ proc HighLightTCL {text line lineNumber node} {
incr end $startPos incr end $startPos
$text tag add bracequad $lineNumber.$start $lineNumber.$end $text tag add bracequad $lineNumber.$start $lineNumber.$end
set startPos $end set startPos $end
$text tag lower bracequad
} else { } else {
break 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 Modules
## MAIN INTERFACE ## ## 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 title . "Tcl/Tk Project Manager $ver"
wm iconname . "Tcl/Tk Project Manager $ver" wm iconname . "Tcl/Tk Project Manager $ver"
wm protocol . WM_DELETE_WINDOW Quit 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 ## ## QUIT PROJECT MANAGER PROCEDURE ##
proc Quit {} { proc Quit {} {
global workDir
set v [FileDialog tree close_all] set v [FileDialog tree close_all]
if {$v == "cancel"} { if {$v == "cancel"} {
return return
} else { } 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 exit
} }
} }
@ -750,3 +763,7 @@ proc GetExtention {node} {

View File

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

View File

@ -8,6 +8,8 @@
# Modification date: Чт янв 11 10:38:33 MSK 2018 # Modification date: Чт янв 11 10:38:33 MSK 2018
########################################################### ###########################################################
set topLevelGeometry "1200x1046+0+0"
# Normal Font # Normal Font
set fontNormal "helvetica 10 normal roman" set fontNormal "helvetica 10 normal roman"
# Bold Font # # Bold Font #

View File

@ -118,6 +118,4 @@ option add *NoteBook.bg $editor(bg) startupFile
option add *NoteBook.fg $editor(fg) startupFile option add *NoteBook.fg $editor(fg) startupFile
option add *Listbox.foreground $editor(fg) startupFile option add *Listbox.foreground $editor(fg) startupFile
option add *Listbox.background $editor(bg) startupFile option add *Listbox.background $editor(bg) startupFile
option add *Scrollbar.background $editor(bg) startupFile option add *Scrollbar.background $editor(bg) startupFile