Added GoTo line into toolbar

Fixed fileinfo update when tree one click
Fixed bug with opened files have extention is a upper case
This commit is contained in:
Sergey Kalinin 2018-02-24 19:42:49 +03:00
parent 5deb2a17a9
commit 823591ae92
7 changed files with 53 additions and 18 deletions

View File

@ -10,6 +10,9 @@
- Fixed Add to project procedure
- Fixed hot key Cntrl+S saved prosedure when saved opened file from File Browser
- Refactoring all Tree procedures
- Added GoTo line into toolbar
- Fixed fileinfo update when tree one click
- Fixed bug with opened files have extention is a upper case
22.02.2018
- Refactoring Settigs procedure source code
@ -398,3 +401,4 @@ characters to the right of the insertion cursor.

4
errors
View File

@ -0,0 +1,4 @@
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)

View File

@ -142,6 +142,18 @@ proc GoToLineNumber {text w} {
Position $text .frmStatus.frmLine.lblLine
}
}
#.frmBody.frmWork.noteBook.f_home_svk_projects_tcl_projman_projman_conf.text
proc ToolBarGoToLineNumber {w} {
global noteBook
set lineNumber [$w.entGoTo get]
append text $noteBook .f [$noteBook raise] ".text"
catch {
focus $text
$text mark set insert $lineNumber.0
$text see $lineNumber.0
}
#Position ;#$text .frmStatus.frmLine.lblLine
}
## SEARCH DIALOG FORM ##
set findHistory ""
set findString ""
@ -579,13 +591,13 @@ proc EditFile {tree node fileName} {
set replace 0
set file [file tail $fileName]
set name [file rootname $file]
set fileExt [string range [file extension $fileName] 1 end]
set fileExt [string tolower [string range [file extension $fileName] 1 end]]
set parentNode [$tree parent $node]
set project [$tree itemcget $parentNode -data]
# set w [$noteBook insert end $node -text "$file" -image [Bitmap::get [file join $imgDir [GetImage $fileName].gif]] \
#-background $editor(bg) -foreground $editor(fg)]
set w [$noteBook insert end $node -text "$file" -image [Bitmap::get [file join $imgDir [GetImage $fileName].gif]]]
puts $w
#puts $w
# create array with file names #
if {[info exists fileList($node)] != 1} {
set fileList($node) [list $fileName 0]
@ -641,7 +653,8 @@ proc EditFile {tree node fileName} {
break
}
bind $text <Control-idiaeresis> GoToLine
bind $text <Control-g> GoToLine
#bind $text <Control-g> GoToLine
bind $text <Control-g> {focus .frmTool.frmGoto.entGoTo}
bind $text <Control-agrave> Find
bind $text <Control-f> Find
bind $text <F3> {FindNext $w.text 1}
@ -928,7 +941,7 @@ proc ReadFileStructure {mod line lineNumber tree node} {
if {[regexp -nocase -all -line -- {proc (::|)(\w+)(::|)(\w+) \{(.*)\} \{} $line match v1 v2 v3 v4 params]} {
set procName "$v1$v2$v3$v4"
lappend procList($activeProject) [list $procName [string trim $params]]
puts "proc $procName $params"
#puts "proc $procName $params"
}
if {$keyWord == "proc" || $keyWord == "let" || $keyWord == "class" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "fun" } {
set dot "_"
@ -954,3 +967,4 @@ GetOp

View File

@ -67,12 +67,12 @@ proc HighLightTCL {text line lineNumber node} {
#puts $workLine
if {[regexp -nocase -all -line -- {proc (::|)(\w+)(::|-|_|)(\w+)(.+) \{(.*)\} \{} $workLine match v1 v2 v3 v4 v5 params]} {
set word "$v1$v2$v3$v4$v5"
puts $word
#puts $word
set length [string length $word]
set startPos [string first [string trim $word] $line]
#set endPos [expr $startPos + $length]
set workLine [string range $workLine $length end]
puts "$length $startPos $endPos\n$workLine"
#puts "$length $startPos $endPos\n$workLine"
$text tag add procName $lineNumber.$startPos $lineNumber.$endPos
set startPos [expr $endPos + 1]
} else {
@ -234,4 +234,3 @@ proc HighLightTCL {text line lineNumber node} {
}
}

View File

@ -515,7 +515,7 @@ proc AddToProj {fileName mode workingTree} {
set dir [file dirname $fullPath]
set parentNode [$workingTree parent $node]
}
#puts "$node $parentNode $workingTree $fullPath"
#puts ">>>>$node $parentNode $workingTree $fullPath"
if {$type == "tcl"} {
set img "tcl"
@ -549,12 +549,12 @@ proc AddToProj {fileName mode workingTree} {
set dot "_"
set name [file rootname $fileName]
set ext [string range [file extension $fileName] 1 end]
set subNode "$name$dot$ext"
if {[$workingTree exists $subNode] == 1} {
puts $count
append subNode "_$count"
incr count
if {$ext ne "" } {
set subNode "$parentNode$dot$name$dot$ext"
} else {
set subNode "$parentNode$dot$name"
}
#puts ">>>>$subNode"
$workingTree insert end $parentNode $subNode -text $fileName \
-data [file join $dir $fileName] -open 1\
-image [Bitmap::get [file join $imgDir $img.gif]]\
@ -1008,3 +1008,4 @@ proc InsertTitle {newFile type} {

View File

@ -46,8 +46,10 @@ proc CreateToolBar {} {
set bboxHelp [ButtonBox .frmTool.bboxHelp -spacing 0 -padx 1 -pady 1 -bg $editor(bg)]
add_toolbar_button $bboxHelp help.png {ShowHelp} [::msgcat::mc "Help"]
pack $bboxFile [Separator] $bboxEdit [Separator] $bboxProj [Separator] $bboxHelp -side left -anchor w
# GoTo field
set frm [frame .frmTool.frmGoto -bg $editor(bg)]
GoToLineButton $frm
pack $bboxFile [Separator] $bboxEdit [Separator] $bboxProj [Separator] $bboxHelp [Separator] $frm -side left -anchor w
}
}
@ -60,5 +62,15 @@ proc add_toolbar_button {path icon command helptext} {
-padx 1 -pady 1 -command $command -helptext $helptext
}
# Separator for toolbar
proc GoToLineButton {w} {
global noteBook fontNormal editor
label $w.text -text [::msgcat::mc "Line number"] -font $fontNormal \
-bg $editor(bg) -fg $editor(fg)
entry $w.entGoTo -width 6 -validate key -validatecommand "ValidNumber %W %P" \
-bg $editor(bg) -fg $editor(fg)
pack $w.text $w.entGoTo -side left -anchor nw -padx 2 -pady 2
bind $w.entGoTo <Return> "+ToolBarGoToLineNumber $w"
}

View File

@ -219,10 +219,10 @@ proc TreeOneClick {tree node} {
return
}
} elseif {[file isfile $item] == 1 } {
if {[$noteBook index $node] != -1} {
if {[file exists $item] == 1} {
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
if {[$noteBook index $node] != -1} {
PageRaise $tree $node
if {[file exists $item] == 1} {
}
}
} elseif {[string range $item 0 2] == "prc"} {
@ -341,3 +341,4 @@ proc FileNotePageRaise {nb s} {