Added sort procedure for projects tree
This commit is contained in:
parent
41c83d175a
commit
5fc93df431
|
@ -6,6 +6,9 @@
|
|||
##########################################################
|
||||
|
||||
0.4.5
|
||||
15.03.2018
|
||||
- Added sort procedure for projects tree
|
||||
|
||||
13.03.2018
|
||||
- Added small toolbar into project tree
|
||||
|
||||
|
@ -435,4 +438,5 @@ characters to the right of the insertion cursor.
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -965,6 +965,7 @@ proc ReadFileStructure {mod line lineNumber tree node} {
|
|||
set closeBrace [expr [string first "\}" $line]-1]
|
||||
set var [string range $line $openBrace end]
|
||||
regsub -all ":" $procName "_" prcNode
|
||||
set prcNode [string tolower $prcNode]
|
||||
if {$keyWord == "proc" || $keyWord == "sub" || $keyWord == "function" || $keyWord == "let"} {
|
||||
set img "proc.gif"
|
||||
} elseif {$keyWord == "class"} {
|
||||
|
@ -1004,3 +1005,4 @@ GetOp
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -622,3 +622,4 @@ proc FileOperation::FileDialog {tree operation} {
|
|||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ set bBoxProjectTree [ButtonBox $nbProjects.bboxProjectTree -spacing 0 -padx 1 -p
|
|||
#add_toolbar_button $bBoxProjectTree new_project.png {NewProj new "" ""} [::msgcat::mc "New project"]
|
||||
#add_toolbar_button $bBoxProjectTree del_project.png DelProj [::msgcat::mc "Delete project"]
|
||||
add_toolbar_button $bBoxProjectTree project_settings.png {NewProj edit $activeProject ""} [::msgcat::mc "Project settings"]
|
||||
add_toolbar_button $bBoxProjectTree sort.png SortTree [::msgcat::mc "Sort tree"]
|
||||
add_toolbar_button $bBoxProjectTree sort.png {SortTree [$noteBookFiles raise]} [::msgcat::mc "Sort tree"]
|
||||
pack $bBoxProjectTree -side top -pady 4 -anchor w
|
||||
|
||||
# Create FileTree
|
||||
|
@ -380,3 +380,4 @@ if {[info exists workingProject]} {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -181,3 +181,4 @@ proc GetFileMenu {m} {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -103,3 +103,4 @@ namespace eval pane {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -671,3 +671,4 @@ proc GetExtention {node} {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
56
lib/tree.tcl
56
lib/tree.tcl
|
@ -279,7 +279,7 @@ proc TreeDoubleClick {tree node} {
|
|||
} elseif {[file isdirectory $item] ==1} {
|
||||
# node is directory
|
||||
GetFiles $tree $node $item
|
||||
puts "GetFiles $tree $node $item"
|
||||
#puts "GetFiles $tree $node $item"
|
||||
} elseif {[string range $item 0 2] == "prc"} {
|
||||
# node is procedure (class, function, etc)
|
||||
$tree selection set $node
|
||||
|
@ -300,7 +300,7 @@ proc TreeDoubleClick {tree node} {
|
|||
} elseif {[file isfile $item] == 1} {
|
||||
#puts [$noteBook index $node]
|
||||
if {[$noteBook index $node] != -1} {
|
||||
puts "File тута $node"
|
||||
#puts "File тута $node"
|
||||
puts "fileList($node) $fileList($node)"
|
||||
} else {
|
||||
EditFile $tree $node $item
|
||||
|
@ -338,10 +338,52 @@ proc FileNotePageRaise {nb s} {
|
|||
}
|
||||
}
|
||||
|
||||
proc SortTree {nbNode} {
|
||||
global fontNormal imgDir
|
||||
if {$nbNode eq "files"} {
|
||||
set tree .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles
|
||||
} elseif {$nbNode eq "projects"} {
|
||||
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
|
||||
}
|
||||
SortTreeNodes $tree [$tree selection get]
|
||||
}
|
||||
proc SortTreeNodes {tree rootNode} {
|
||||
global fontNormal imgDir
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach i [lsort [$tree nodes $rootNode]] {
|
||||
#puts "$i [$tree itemcget $i -data]"
|
||||
set nodeData [$tree itemcget $i -data]
|
||||
set nodeText [$tree itemcget $i -text]
|
||||
set nodeImage [$tree itemcget $i -image]
|
||||
set subNodeList [$tree nodes $i]
|
||||
if {$subNodeList ne "" } {
|
||||
foreach j $subNodeList {
|
||||
lappend nodes($j) [$tree itemcget $j -data]
|
||||
lappend nodes($j) [$tree itemcget $j -text]
|
||||
lappend nodes($j) [$tree itemcget $j -image]
|
||||
#puts "--$nodes($i)"
|
||||
}
|
||||
}
|
||||
$tree delete $i
|
||||
$tree insert end $rootNode $i -text "$nodeText" -font $fontNormal \
|
||||
-data $nodeData -open 0\
|
||||
-image $nodeImage
|
||||
#-image [Bitmap::get [file join $imgDir folder.gif]]
|
||||
if {[info exists nodes]} {
|
||||
foreach g [array names nodes] {
|
||||
#puts ">$rootNode >> $nodes($g)"
|
||||
#puts ">>> [lindex $nodes($g) 0] : [lindex $nodes($g) 1] : [lindex $nodes($g) 2]"
|
||||
#puts "$tree insert end $i $g -text [lindex $nodes($g) 1] -font $fontNormal \
|
||||
#-data [lindex $nodes($g) 0] -open 0\
|
||||
#-image [lindex $nodes($g) 2]"
|
||||
$tree insert end $i $g -text [lindex $nodes($g) 1] -font $fontNormal \
|
||||
-data [lindex $nodes($g) 0] -open 0\
|
||||
-image [lindex $nodes($g) 2]
|
||||
#SortTreeNodes $tree $g
|
||||
}
|
||||
unset nodes
|
||||
}
|
||||
}
|
||||
#puts $nodeList
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user