From 0c58139974237aa65d859689ab15fb1cf665c339 Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Tue, 6 Mar 2018 12:55:04 +0300 Subject: [PATCH] Added procedure arguments into tree Change read config procedure (error fixed) Fixed error when project running --- CHANGELOG | 6 ++++++ errors | 4 ---- img/param.gif | Bin 73 -> 119 bytes img/var.gif | Bin 0 -> 109 bytes lib/editor.tcl | 40 +++++++++++++++++++++++++++++----------- lib/filedialog.tcl | 20 +++++++++++--------- lib/menu.tcl | 4 ---- lib/projects.tcl | 2 ++ lib/settings.tcl | 1 + projman.tcl | 18 ++++++++++++------ 10 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 img/var.gif diff --git a/CHANGELOG b/CHANGELOG index 40d03fd..97fa024 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,11 @@ ########################################################## 0.4.5 +06.03.2018 +- Added procedure arguments into tree +- Change read config procedure (error fixed) +- Fixed error when project running + 05.03.2018 - Fixed "Add new file" toolbar button press - Fixed "Control+S" hotkey error @@ -412,3 +417,4 @@ characters to the right of the insertion cursor. + diff --git a/errors b/errors index 3db057a..e69de29 100644 --- a/errors +++ b/errors @@ -1,4 +0,0 @@ -Error in startup script: couldn't read file "/home/svk/projects/tcl/projman/lib/lib/main.tcl": no such file or directory - while executing -"source [file join $dataDir main.tcl]" - (file "/home/svk/projects/tcl/projman/projman.tcl" line 98) diff --git a/img/param.gif b/img/param.gif index 6ce93fd5974aff373982d9bf686a96acdd082970..140a9ce93e801713d026c83bca04fdaaf162bf51 100644 GIT binary patch literal 119 zcmZ?wbhEHbcaC6Hzp*IkPD-<5A;7MalUa78o_ua5e8==-+pl MQNVSo7YlBi?-JP91U0sU*1f7dg6H8K46v{J8 zG8EiBeFGSDK*~WH8JJZ$cCGm?uuDRAL3nHBl#SOHiv-`0ZB{C|IhBb;d%w`}xu&6} IHB1cF0Nq$6AOHXW literal 0 HcmV?d00001 diff --git a/lib/editor.tcl b/lib/editor.tcl index 5414131..0bce7b1 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -2,7 +2,7 @@ # Tcl/Tk Project Manager # # all procedure file # # Copyright (c) "Sergey Kalinin", 2002, http://nuk-svk.ru # -# Author: Sergey Kalinin banzaj28@yandex.ru # +# Author: Sergey Kalinin banzaj28@yandex.ru # ########################################################### ## GETTING OPERATORS FOR COMPLITE PROCEDURE # proc GetOp {} { @@ -610,8 +610,8 @@ proc EditFile {tree node fileName} { #-background $editor(bg) -foreground $editor(fg)] set w [$noteBook insert end $node -text "$file" -image [Bitmap::get [file join $imgDir [GetImage $fileName].gif]]] - #set lblEditFileFullPath [label $w.lblEditFileFullPath -text [regsub -all -- {/|\\} $fileName " > "] -anchor w] - #pack $lblEditFileFullPath -side top -fill x + EditorFileNavigateMenu $w $fileName + #puts $w # create array with file names # if {[info exists fileList($node)] != 1} { @@ -932,7 +932,8 @@ proc ReadFileStructure {mod line lineNumber tree node} { global projDir workDir imgDir noteBook fontNormal fontBold fileList replace nodeEdit procList global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject global varList - + set dot "_" + # Insert procedure names into tree # regsub -all {\t} $line " " line set w $noteBook.f$node @@ -959,7 +960,6 @@ proc ReadFileStructure {mod line lineNumber tree node} { #puts "proc $procName $params" } if {$keyWord == "proc" || $keyWord == "let" || $keyWord == "class" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "fun" } { - set dot "_" set openBrace [string first "\{" $line] set closeBrace [expr [string first "\}" $line]-1] set var [string range $line $openBrace end] @@ -971,15 +971,33 @@ proc ReadFileStructure {mod line lineNumber tree node} { } if {[$tree exists $prcNode$dot$lineNumber] !=1} { $tree insert end $node $prcNode$dot$lineNumber -text $procName \ - -data "prc_$procName"\ - -image [Bitmap::get [file join $imgDir $img]] -font $fontNormal - #$tree insert end $prcNode$dot$lineNumber param_$prcNode$dot$lineNumber -text $params \ - #-data "prc_$procName" \ - #-image [Bitmap::get [file join $imgDir param.gif]] -font $fontNormal - + -data "prc_$procName" -font $fontNormal \ + -image [Bitmap::get [file join $imgDir $img]] + if {[info exists params] == 1 && $params ne ""} { + foreach par $params { + $tree insert end $prcNode$dot$lineNumber param_$prcNode$dot$lineNumber$dot$par \ + -text $par -data "param_$procName$dot$par" -font $fontNormal \ + -image [Bitmap::get [file join $imgDir param.gif]] + } + } } } + if {$keyWord == "set"} { + # set var $procName + # $tree insert end $node var$dot$lineNumber$dot$var \ + # -text $var -data "var_$procName$dot$var" -font $fontNormal \ + # -image [Bitmap::get [file join $imgDir var.gif]] + } +} + +# View modern notebook tab header for edited file +# like as : "> dir1 > dir2 > file.tcl" +proc EditorFileNavigateMenu {w fullPathFile} { + set lblEditFileFullPath [label $w.lblEditFileFullPath -text [regsub -all -- {/|\\} $fullPathFile " > "] -anchor w] + pack $lblEditFileFullPath -side top -fill x -padx 2 -pady 3 } #################################### GetOp + + diff --git a/lib/filedialog.tcl b/lib/filedialog.tcl index 3e1618a..d2ef209 100644 --- a/lib/filedialog.tcl +++ b/lib/filedialog.tcl @@ -137,6 +137,17 @@ proc FileDialog {nbNode operation} { # Progress start # LabelUpdate .frmStatus.frmProgress.lblProgress "[::msgcat::mc "Opened file in progress"]" set linesCount [$text count -lines $lineNumber.0 end] + + ######## change the active tree if file opened from different tree ###### + if {[$tree exists $node] == 0 && $tree eq ".frmBody.frmCat.noteBook.fprojects.frmTree.tree"} { + set tree .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles + } elseif {[$tree exists $node] == 0 && $tree eq ".frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles" } { + set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree + } else { + return + } + ########## end ######## + foreach item [$tree nodes $node] { puts $item $tree delete $item @@ -611,12 +622,3 @@ proc FileOperation::FileDialog {tree operation} { } } - - - - - - - - - diff --git a/lib/menu.tcl b/lib/menu.tcl index 504bfd5..7f026fe 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -91,7 +91,3 @@ proc GetMenu {m} { $me add command -label [::msgcat::mc "CP1251"] -command {TextEncode cp1251} -font $fontNormal $me add command -label [::msgcat::mc "CP866"] -command {TextEncode cp866} -font $fontNormal } - - - - diff --git a/lib/projects.tcl b/lib/projects.tcl index 2b79f2b..305b55d 100644 --- a/lib/projects.tcl +++ b/lib/projects.tcl @@ -885,6 +885,7 @@ proc MakeProj {action t} { $w.frame.text tag add bold $lineNum.0 $lineNum.end # open and manipulate executed program chanel # + cd $projDirName if {$action == "compile"} { set cmdCompile "" CompileOption "$projCompiler $prog" @@ -1010,3 +1011,4 @@ proc InsertTitle {newFile type} { + diff --git a/lib/settings.tcl b/lib/settings.tcl index 31f4d30..c79a3a2 100644 --- a/lib/settings.tcl +++ b/lib/settings.tcl @@ -645,3 +645,4 @@ proc Settings {nBook} { } + diff --git a/projman.tcl b/projman.tcl index 728faff..07dd3b6 100755 --- a/projman.tcl +++ b/projman.tcl @@ -64,7 +64,18 @@ if {[file exists [file join $workDir projman.conf]] == 0} { file copy -force -- projman.conf [file join $workDir projman.conf] } -source [file join $workDir projman.conf] +#source [file join $workDir projman.conf] +# Read the projman.conf file and setting the variable +set config [open [file join $workDir projman.conf] RDONLY] +while {[gets $config line]>=0} { + if [regexp -nocase -all -line -- {(set)\s(.+)\s"(.+|)"} $line match op var data] { + regsub -all -- {\$env\(HOME\)} $data "$env(HOME)" data + regsub -all -- {\$workDir} $data "$workDir" data + set $var $data + } +} + + ## CREATE WORK DIR ## if {[file exists $rpmDir] != 1} {file mkdir $rpmDir} @@ -160,8 +171,3 @@ option add *Dialog.msg.background $editor(bg) # option add *Entry.highlightBackground $bg userDefault # option add *Text.HighlightThickness 2 userDefault # option add *Entry.HighlightThickness 1 userDefault - - - - -