Begining work with autocomplition procedure for variables

This commit is contained in:
Sergey Kalinin 2018-01-12 13:44:26 +03:00
parent 472ff86c2b
commit a46c13788f
9 changed files with 39 additions and 36 deletions

View File

@ -12,6 +12,7 @@
- Actualizing information into "About" dialog - Actualizing information into "About" dialog
- Corrected color settings for all widgets - Corrected color settings for all widgets
- Change default color scheme - Change default color scheme
- Remove ctag, change autocomplitt procedure
0.4.4 0.4.4
@ -361,5 +362,6 @@ Fixed bug with PageRise function

View File

@ -36,9 +36,10 @@ proc auto_completition { widget } {
} ;# proc auto_completition } ;# proc auto_completition
## PROCEDURE LIST ## ## PROCEDURE LIST ##
## by BanZaj ## ## by BanZaj ##
proc auto_completition_proc { widget } { proc auto_completition_proc { widget } {
global procList activeProject noteBook global procList activeProject noteBook varList
set nodeEdit [$noteBook raise] set nodeEdit [$noteBook raise]
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} { if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} {
return return
@ -51,21 +52,26 @@ proc auto_completition_proc { widget } {
set cnt 0 set cnt 0
set pos "1.0" set pos "1.0"
set last_pos "" set last_pos ""
set pattern "$start_word\\w*" puts "$start_word"
puts [regsub -all -- "\$" $start_word "\\\$" word]
puts $word
#set list_word($start_word) 1 #set list_word($start_word) 1
if [info exists procList($activeProject)] { if {[string index $start_word 0] == "\$"} {
set len [llength $procList($activeProject)] set workList $varList($activeProject)
} else {
set workList $procList($activeProject)
}
if [info exists workList] {
set len [llength $workList]
} else { } else {
return return
} }
set i 0 set i 0
while {$len >=$i} { while {$len >=$i} {
set line [lindex $procList($activeProject) $i] set line [lindex $ $i]
scan $line "%s" word scan $line "%s" word
if [regexp -nocase -all -- {\s\{.*?\}+\s} $line par] { if {[string match "$start_word*" $word]} {
regsub -all (\{|\}) $par " " par set list_word($word) $i
set word_ "$word [string trim $par]"
if {[string match "$start_word*" $word]} {set list_word($word_) $i}
} }
incr i incr i
} }
@ -165,3 +171,7 @@ proc auto_completition_key { widget K A } {

View File

@ -853,8 +853,8 @@ proc TextEncode {encode} {
## EDITING FILE ## ## EDITING FILE ##
proc EditFile {node fileName} { proc EditFile {node fileName} {
global projDir workDir imgDir tree noteBook fontNormal fontBold w fileList replace nodeEdit global projDir workDir imgDir tree noteBook fontNormal fontBold w fileList replace nodeEdit procList
global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject
set nodeEdit $node set nodeEdit $node
set replace 0 set replace 0
set file [file tail $fileName] set file [file tail $fileName]
@ -923,14 +923,22 @@ proc EditFile {node fileName} {
} elseif {$keyWord == "class"} { } elseif {$keyWord == "class"} {
set img "class.gif" 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} { if {[$tree exists $prcNode$dot$lineNumber] !=1} {
$tree insert end $node $prcNode$dot$lineNumber -text $procName \ $tree insert end $node $prcNode$dot$lineNumber -text $procName \
-data "prc_$procName"\ -data "prc_$procName"\
-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
} }
#puts $procList
close $file close $file
$w.text mark set insert 0.0 $w.text mark set insert 0.0
$w.text see insert $w.text see insert
@ -1138,3 +1146,4 @@ GetOp

View File

@ -225,3 +225,4 @@ proc HighLightTCL {text line lineNumber node} {

View File

@ -385,8 +385,3 @@ $tree configure -redraw 1
set activeProject "" set activeProject ""
focus -force $tree focus -force $tree

View File

@ -1,18 +0,0 @@
÷ÏÔ ÐÉÝÁ ÄÌÑ ÒÁÚÍÙÛÌÅÎÉÊ. õÔÏÞÎÕ. üÔÏÔ ËÏÄ ÐÒÅÄÎÁÚÎÁÞÅÎ ÄÌÑ ÒÁÂÏÔÙ ÐÏÄ Win32 ÐÒÉ ÕÓÌÏ×ÉÉ, ÞÔÏ ×ÅÓÔØ ÔÅËÓÔ ÎÁÂÒÁÎ × koi8-r ËÏÄÉÒÏ×ËÅ. ëÁË ÅÇÏ ÄÏÄÅÌÁÔØ, ÄÕÍÁÀ, ÓÏÏÂÒÁÚÉÛØ ÓÁÍ:
set lang ru
set mc_source {
mcset $lang "File" "æÁÊÌ"
mcset $lang "New..." "îÏ×ÙÊ..."
}
set mc_source [encoding convertto koi8-r $mc_source]
set mc_source [encoding convertfrom cp1251 $mc_source]
eval $mc_source
++++++++++++++++++++++++++
set mc_source [encoding convertto koi8-r $mc_source]
set mc_source [encoding convertfrom [encoding system] $mc_source]

View File

@ -1115,3 +1115,5 @@ proc TextOperation {oper} {

View File

@ -132,3 +132,4 @@ option add *Scrollbar.background $editor(bg) startupFile

View File

@ -53,3 +53,4 @@ proc GetTagList_ {tagFile} {