Refactoring all procedures is the Tree working
This commit is contained in:
parent
164317de93
commit
98de397ae9
|
@ -6,6 +6,11 @@
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|
||||||
0.4.5
|
0.4.5
|
||||||
|
24.02.2018
|
||||||
|
- Fixed Add to project procedure
|
||||||
|
- Fixed hot key Cntrl+S saved prosedure when saved opened file from File Browser
|
||||||
|
- Refactoring all Tree procedures
|
||||||
|
|
||||||
22.02.2018
|
22.02.2018
|
||||||
- Refactoring Settigs procedure source code
|
- Refactoring Settigs procedure source code
|
||||||
- Some changes into messages files (localisation)
|
- Some changes into messages files (localisation)
|
||||||
|
@ -390,3 +395,6 @@ characters to the right of the insertion cursor.
|
||||||
- Fix small error with delete project procedure
|
- Fix small error with delete project procedure
|
||||||
- Fix uncorrect cursor position counter into editor
|
- Fix uncorrect cursor position counter into editor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
## ABOUT PROGRAMM DIALOG ##
|
## ABOUT PROGRAMM DIALOG ##
|
||||||
proc AboutDialog {} {
|
proc AboutDialog {} {
|
||||||
global docDir imgDir tree noteBook ver fontNormal dataDir env editor
|
global docDir imgDir tree noteBook ver fontNormal dataDir env editor rootDir
|
||||||
set w {}
|
set w {}
|
||||||
# prevent double creation "About" page
|
# prevent double creation "About" page
|
||||||
if { [catch {set w [$noteBook insert end about -text [::msgcat::mc "About ..."]]} ] } {
|
if { [catch {set w [$noteBook insert end about -text [::msgcat::mc "About ..."]]} ] } {
|
||||||
|
@ -409,8 +409,8 @@ proc AboutDialog {} {
|
||||||
|
|
||||||
$noteBook raise about
|
$noteBook raise about
|
||||||
focus $w.frmBtn.btnOk
|
focus $w.frmBtn.btnOk
|
||||||
if {[file exists $env(HOME)/projects/tcl/projman]==1} {
|
if {[file exists [file join $rootDir THANKS]] == 1} {
|
||||||
set file [open [file join $env(HOME)/projects/tcl/projman THANKS] r]
|
set file [open [file join $rootDir THANKS] r]
|
||||||
} else {
|
} else {
|
||||||
set file [open [file join $docDir THANKS] r]
|
set file [open [file join $docDir THANKS] r]
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ proc ReplaceChar {text} {
|
||||||
$text delete $posY.$posX $posY.[expr $posX + 1]
|
$text delete $posY.$posX $posY.[expr $posX + 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## OVERWRITE SYMBOL PROCEDURE ##
|
## OVERWRITE SYMBOL PROCEDURE ##
|
||||||
proc OverWrite {} {
|
proc OverWrite {} {
|
||||||
global replace fontNormal
|
global replace fontNormal
|
||||||
|
@ -573,7 +574,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
|
global varList noteBookFiles
|
||||||
set nodeEdit $node
|
set nodeEdit $node
|
||||||
set replace 0
|
set replace 0
|
||||||
set file [file tail $fileName]
|
set file [file tail $fileName]
|
||||||
|
@ -647,12 +648,12 @@ proc EditFile {tree node fileName} {
|
||||||
bind $text <Control-ecircumflex> ReplaceDialog
|
bind $text <Control-ecircumflex> ReplaceDialog
|
||||||
bind $text <Control-r> ReplaceDialog
|
bind $text <Control-r> ReplaceDialog
|
||||||
bind $text <F4> {ReplaceCommand $w.text 1}
|
bind $text <F4> {ReplaceCommand $w.text 1}
|
||||||
bind $text <Control-ucircumflex> {FileDialog $tree save}
|
bind $text <Control-ucircumflex> {FileDialog [$noteBookFiles raise] save}
|
||||||
bind $text <Control-s> {FileDialog $tree save}
|
bind $text <Control-s> {FileDialog [$noteBookFiles raise] save}
|
||||||
bind $text <Control-ocircumflex> {FileDialog $tree save_as}
|
bind $text <Control-ocircumflex> {FileDialog [$noteBookFiles raise] save_as}
|
||||||
bind $text <Shift-Control-s> {FileDialog $tree save_as}
|
bind $text <Shift-Control-s> {FileDialog [$noteBookFiles raise] save_as}
|
||||||
bind $text <Control-odiaeresis> {FileDialog $tree close}
|
bind $text <Control-odiaeresis> {FileDialog [$noteBookFiles raise] close}
|
||||||
bind $text <Control-w> {FileDialog $tree close}
|
bind $text <Control-w> {FileDialog [$noteBookFiles raise] close}
|
||||||
bind $text <Control-division> "tk_textCut $w.text;break"
|
bind $text <Control-division> "tk_textCut $w.text;break"
|
||||||
bind $text <Control-x> "tk_textCut $w.text;break"
|
bind $text <Control-x> "tk_textCut $w.text;break"
|
||||||
bind $text <Control-ntilde> "tk_textCopy $w.text;break"
|
bind $text <Control-ntilde> "tk_textCopy $w.text;break"
|
||||||
|
@ -951,3 +952,5 @@ proc ReadFileStructure {mod line lineNumber tree node} {
|
||||||
####################################
|
####################################
|
||||||
GetOp
|
GetOp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ proc FileDialog {nbNode operation} {
|
||||||
} elseif {$nbNode eq "projects"} {
|
} elseif {$nbNode eq "projects"} {
|
||||||
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
|
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
|
||||||
}
|
}
|
||||||
|
puts "node $nbNode , Tree - $tree"
|
||||||
if {$operation == "open"} {
|
if {$operation == "open"} {
|
||||||
set dir $projDir
|
set dir $projDir
|
||||||
set fullPath [tk_getOpenFile -initialdir $dir -filetypes $types -parent $noteBook]
|
set fullPath [tk_getOpenFile -initialdir $dir -filetypes $types -parent $noteBook]
|
||||||
|
@ -618,3 +618,4 @@ proc FileOperation::FileDialog {tree operation} {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
33
lib/main.tcl
33
lib/main.tcl
|
@ -284,7 +284,34 @@ set nbFiles [$noteBookFiles insert end files -text [::msgcat::mc "Files"] \
|
||||||
|
|
||||||
|
|
||||||
# Create FileTree
|
# Create FileTree
|
||||||
FileTree::create $nbFiles
|
#FileTree::create $nbFiles
|
||||||
|
set frmTreeFiles [ScrolledWindow $nbFiles.frmTreeFiles -bg $editor(bg) -background $editor(bg) ]
|
||||||
|
|
||||||
|
set treeFiles [
|
||||||
|
Tree $frmTreeFiles.treeFiles \
|
||||||
|
-relief sunken -borderwidth 1 -width 5 -highlightthickness 0\
|
||||||
|
-redraw 0 -dropenabled 1 -dragenabled 1 -dragevent 3 \
|
||||||
|
-background $editor(bg) -selectbackground $editor(selectbg) -selectforeground white\
|
||||||
|
-droptypes {
|
||||||
|
TREE_NODE {copy {} move {} link {}}
|
||||||
|
LISTBOX_ITEM {copy {} move {} link {}}
|
||||||
|
} -opencmd {TreeOpen} \
|
||||||
|
-closecmd {TreeClose}
|
||||||
|
]
|
||||||
|
$frmTreeFiles setwidget $treeFiles
|
||||||
|
pack $frmTreeFiles -side top -fill both -expand true
|
||||||
|
$treeFiles bindText <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
|
||||||
|
$treeFiles bindImage <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
|
||||||
|
$treeFiles bindImage <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
|
||||||
|
$treeFiles bindText <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
|
||||||
|
GetAllDirs $treeFiles
|
||||||
|
|
||||||
|
$treeFiles bindText <Shift-Button-1> {$treeFiles selection add $treeFiles [$treeFiles selection get]}
|
||||||
|
# Added menu
|
||||||
|
|
||||||
|
GetMenuFileTree [menu .popMenuFileTree -bg $editor(bg) -fg $editor(fg)] ;# pop-up edit menu
|
||||||
|
|
||||||
|
bind $frmTreeFiles.treeFiles.c <Button-3> {catch [PopupMenuFileTree $treeFiles %X %Y]}
|
||||||
|
|
||||||
# Create Project tree
|
# Create Project tree
|
||||||
set frmTree [ScrolledWindow $nbProjects.frmTree -bg $editor(bg)]
|
set frmTree [ScrolledWindow $nbProjects.frmTree -bg $editor(bg)]
|
||||||
|
@ -391,7 +418,9 @@ focus -force $tree
|
||||||
# Opened last active project
|
# Opened last active project
|
||||||
if {[info exists workingProject]} {
|
if {[info exists workingProject]} {
|
||||||
if {$workingProject ne ""} {
|
if {$workingProject ne ""} {
|
||||||
TreeDoubleClick .frmBody.frmCat.noteBook.fprojects.frmTree.tree $workingProject
|
.frmBody.frmCat.noteBook.fprojects.frmTree.tree opentree $workingProject
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
######################################################
|
######################################################
|
||||||
# Tcl/Tk Project Manager
|
# Tcl/Tk Project Manager
|
||||||
# Distributed under GNU Public License
|
# Distributed under GNU Public License
|
||||||
# Author: Sergey Kalinin banzaj28@yandex.ru
|
# Author: Sergey Kalinin banzaj28@yandex.ru
|
||||||
|
@ -92,5 +92,3 @@ proc GetMenu {m} {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -491,8 +491,9 @@ proc AddNewProjectIntoTree {proj} {
|
||||||
$tree insert end root $prjName -text "$projName" -font $fontNormal \
|
$tree insert end root $prjName -text "$projName" -font $fontNormal \
|
||||||
-data "prj_$prjName" -open 0\
|
-data "prj_$prjName" -open 0\
|
||||||
-image [Bitmap::get [file join $imgDir folder.gif]]
|
-image [Bitmap::get [file join $imgDir folder.gif]]
|
||||||
GetFiles [file join $string] $prjName $tree
|
GetFiles $tree $prjName [file join $string]
|
||||||
set dir $string
|
set dir $string
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,6 +571,7 @@ proc AddToProj {fileName mode workingTree} {
|
||||||
EditFile [GetTreeForNode $subNode] $subNode [file join $dir $fileName]
|
EditFile [GetTreeForNode $subNode] $subNode [file join $dir $fileName]
|
||||||
}
|
}
|
||||||
## ADD FILE INTO PROJECT DIALOG##
|
## ADD FILE INTO PROJECT DIALOG##
|
||||||
|
|
||||||
proc AddToProjDialog {mode node} {
|
proc AddToProjDialog {mode node} {
|
||||||
global projDir workDir activeProject imgDir mod workingTree
|
global projDir workDir activeProject imgDir mod workingTree
|
||||||
set mod $mode
|
set mod $mode
|
||||||
|
@ -1003,3 +1005,4 @@ proc InsertTitle {newFile type} {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
409
lib/tree.tcl
409
lib/tree.tcl
|
@ -9,187 +9,9 @@
|
||||||
# Procedure for operation wwith Tree widget
|
# Procedure for operation wwith Tree widget
|
||||||
#
|
#
|
||||||
####################################################
|
####################################################
|
||||||
namespace eval FileTree {
|
|
||||||
variable count
|
|
||||||
variable dblclick
|
|
||||||
}
|
|
||||||
set count 1
|
|
||||||
|
|
||||||
proc FileTree::create {nb} {
|
proc GetAllDirs {treeFiles} {
|
||||||
global editor
|
global projDir workDir fontNormal imgDir module env
|
||||||
global treeFiles
|
|
||||||
set frmTreeFiles [ScrolledWindow $nb.frmTreeFiles -bg $editor(bg) -background $editor(bg) ]
|
|
||||||
|
|
||||||
set treeFiles [
|
|
||||||
Tree $frmTreeFiles.treeFiles \
|
|
||||||
-relief sunken -borderwidth 1 -width 5 -highlightthickness 0\
|
|
||||||
-redraw 0 -dropenabled 1 -dragenabled 1 -dragevent 3 \
|
|
||||||
-background $editor(bg) -selectbackground $editor(selectbg) -selectforeground white\
|
|
||||||
-droptypes {
|
|
||||||
TREE_NODE {copy {} move {} link {}}
|
|
||||||
LISTBOX_ITEM {copy {} move {} link {}}
|
|
||||||
} -opencmd {FileTree::select tree 1 $treeFiles} \
|
|
||||||
-closecmd {FileTree::select tree 1 $treeFiles}
|
|
||||||
]
|
|
||||||
$frmTreeFiles setwidget $treeFiles
|
|
||||||
pack $frmTreeFiles -side top -fill both -expand true
|
|
||||||
$treeFiles bindText <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
|
|
||||||
$treeFiles bindImage <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
|
|
||||||
$treeFiles bindImage <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
|
|
||||||
$treeFiles bindText <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
|
|
||||||
$treeFiles bindText <Shift-Button-1> {$treeFiles selection add $treeFiles [$treeFiles selection get]}
|
|
||||||
# Added menu
|
|
||||||
GetMenuFileTree [menu .popMenuFileTree -bg $editor(bg) -fg $editor(fg)] ;# pop-up edit menu
|
|
||||||
|
|
||||||
bind $frmTreeFiles.treeFiles.c <Button-3> {catch [PopupMenuFileTree $treeFiles %X %Y]}
|
|
||||||
|
|
||||||
FileTree::GetAllDirs $treeFiles
|
|
||||||
}
|
|
||||||
|
|
||||||
proc FileTree::init { treeFile } {
|
|
||||||
global tcl_platform count
|
|
||||||
|
|
||||||
set count 0
|
|
||||||
if { $tcl_platform(platform) == "unix" } {
|
|
||||||
set rootdir [glob "~"]
|
|
||||||
} else {
|
|
||||||
set rootdir "c:\\"
|
|
||||||
}
|
|
||||||
$treeFile insert end root home -text $rootdir -data $rootdir -open 1 \
|
|
||||||
-image [Bitmap::get openfold]
|
|
||||||
getdir $treeFile home $rootdir
|
|
||||||
FileTree::select tree 1 $treeFile home
|
|
||||||
$treeFile configure -redraw 1
|
|
||||||
|
|
||||||
# ScrollView
|
|
||||||
set w .top
|
|
||||||
toplevel $w
|
|
||||||
wm withdraw $w
|
|
||||||
wm protocol $w WM_DELETE_WINDOW {
|
|
||||||
# don't kill me
|
|
||||||
}
|
|
||||||
wm resizable $w 0 0
|
|
||||||
wm title $w "Drag rectangle to scroll directory tree"
|
|
||||||
wm transient $w .
|
|
||||||
ScrollView $w.sv -window $treeFile -fill white -relief sunken -bd 1 \
|
|
||||||
-width 300 -height 300
|
|
||||||
pack $w.sv -fill both -expand yes
|
|
||||||
}
|
|
||||||
|
|
||||||
proc FileTree::getdir { treeFile node path } {
|
|
||||||
global count
|
|
||||||
|
|
||||||
set lentries [glob -nocomplain [file join $path "*"]]
|
|
||||||
set lfiles {}
|
|
||||||
foreach f $lentries {
|
|
||||||
set tail [file tail $f]
|
|
||||||
if { [file isdirectory $f] } {
|
|
||||||
$treeFile insert end $node n:$count \
|
|
||||||
-text $tail \
|
|
||||||
-image [Bitmap::get folder] \
|
|
||||||
-drawcross allways \
|
|
||||||
-data $f
|
|
||||||
incr count
|
|
||||||
} else {
|
|
||||||
lappend lfiles $tail
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$treeFile itemconfigure $node -drawcross auto -data $lfiles
|
|
||||||
}
|
|
||||||
|
|
||||||
proc FileTree::moddir { idx treeFile node } {
|
|
||||||
if { $idx && [$treeFile itemcget $node -drawcross] == "allways" } {
|
|
||||||
getdir $treeFile $node [$treeFile itemcget $node -data]
|
|
||||||
if { [llength [$treeFile nodes $node]] } {
|
|
||||||
$treeFile itemconfigure $node -image [Bitmap::get openfold]
|
|
||||||
} else {
|
|
||||||
$treeFile itemconfigure $node -image [Bitmap::get folder]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$treeFile itemconfigure $node -image [Bitmap::get [lindex {folder openfold} $idx]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc FileTree::select { where num treeFile node } {
|
|
||||||
variable dblclick
|
|
||||||
|
|
||||||
set dblclick 1
|
|
||||||
if { $num == 1 } {
|
|
||||||
if { $where == "tree" && [lsearch [$treeFile selection get] $node] != -1 } {
|
|
||||||
unset dblclick
|
|
||||||
#after 500 "DemoTree::edit tree $treeFile $list $node"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if { $where == "tree" } {
|
|
||||||
select_node $treeFile $node
|
|
||||||
} else {
|
|
||||||
#$list selection set $node
|
|
||||||
}
|
|
||||||
} elseif { $where == "list" && [$treeFile exists $node] } {
|
|
||||||
set parent [$treeFile parent $node]
|
|
||||||
while { $parent != "root" } {
|
|
||||||
$treeFile itemconfigure $parent -open 1
|
|
||||||
set parent [$treeFile parent $parent]
|
|
||||||
}
|
|
||||||
select_node $treeFile $node
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc FileTree::select_node { treeFile node } {
|
|
||||||
$treeFile selection set $node
|
|
||||||
update
|
|
||||||
#eval $list delete [$list item 0 end]
|
|
||||||
|
|
||||||
set dir [$treeFile itemcget $node -data]
|
|
||||||
if { [$treeFile itemcget $node -drawcross] == "allways" } {
|
|
||||||
getdir $treeFile $node $dir
|
|
||||||
set dir [$treeFile itemcget $node -data]
|
|
||||||
}
|
|
||||||
|
|
||||||
set num 0
|
|
||||||
foreach f $dir {
|
|
||||||
if {[$treeFile exists $node:file:$num] !=1} {
|
|
||||||
$treeFile insert end $node $node:file:$num -text [file tail $f] -data $f \
|
|
||||||
-image [Bitmap::get file]
|
|
||||||
incr num
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc FileTree::edit { where treeFile node } {
|
|
||||||
variable dblclick
|
|
||||||
|
|
||||||
if { [info exists dblclick] } {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if { $where == "tree" && [lsearch [$treeFile selection get] $node] != -1 } {
|
|
||||||
set res [$treeFile edit $node [$treeFile itemcget $node -text]]
|
|
||||||
if { $res != "" } {
|
|
||||||
$treeFile itemconfigure $node -text $res
|
|
||||||
$treeFile selection set $node
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc FileTree::expand { treeFile but } {
|
|
||||||
if { [set cur [$treeFile selection get]] != "" } {
|
|
||||||
if { $but == 0 } {
|
|
||||||
$treeFile opentree $cur
|
|
||||||
} else {
|
|
||||||
$treeFile closetree $cur
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
proc FileTree::GetAllDirs {treeFiles} {
|
|
||||||
global projDir workDir fontNormal imgDir module env nodeCounter
|
|
||||||
set rList ""
|
set rList ""
|
||||||
set rootDir $env(HOME)
|
set rootDir $env(HOME)
|
||||||
if {[catch {cd $rootDir}] != 0} {
|
if {[catch {cd $rootDir}] != 0} {
|
||||||
|
@ -198,159 +20,74 @@ proc FileTree::GetAllDirs {treeFiles} {
|
||||||
set rootNode [$treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
|
set rootNode [$treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
|
||||||
-data "dir_root" -open 1\
|
-data "dir_root" -open 1\
|
||||||
-image [Bitmap::get [file join $imgDir folder.gif]]]
|
-image [Bitmap::get [file join $imgDir folder.gif]]]
|
||||||
incr nodeCounter
|
|
||||||
|
|
||||||
# $treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
|
|
||||||
# -data "dir_root" -open 0\
|
|
||||||
# -image [Bitmap::get [file join $imgDir folder.gif]]
|
|
||||||
GetFiles [file join $rootDir] $rootNode $treeFiles
|
|
||||||
#set dir $string
|
|
||||||
|
|
||||||
|
GetFiles $treeFiles $rootNode [file join $rootDir]
|
||||||
$treeFiles configure -redraw 1
|
$treeFiles configure -redraw 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## GETTING FILES FROM SUBDIR ##
|
|
||||||
proc GetFilesSubdir {tree node dir} {
|
proc GetFilesSubdir {tree node dir} {
|
||||||
global fontNormal projDir workDir activeProject imgDir count
|
global fontNormal projDir workDir activeProject imgDir
|
||||||
global backUpFileShow dotFileShow
|
global backUpFileShow dotFileShow
|
||||||
set rList ""
|
set rList ""
|
||||||
|
puts "$tree $node $dir"
|
||||||
if {[catch {cd $dir}] != 0} {
|
if {[catch {cd $dir}] != 0} {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if {$dotFileShow eq "Yes"} {
|
if {$dotFileShow eq "Yes"} {
|
||||||
foreach file [lsort [glob -nocomplain .*]] {
|
foreach file [lsort [glob -nocomplain .*]] {
|
||||||
if {$file == "." || $file == ".."} {
|
if {$file != "." || $file != ".."} {
|
||||||
#puts $file
|
|
||||||
} else {
|
|
||||||
lappend rList [list [file join $dir $file]]
|
lappend rList [list [file join $dir $file]]
|
||||||
set fileName [file join $file]
|
set fileName [file join $dir $file]
|
||||||
set img [GetImage $fileName]
|
GetFile $tree $fileName $parent
|
||||||
set dot "_"
|
|
||||||
regsub -all {\.} $fileName "_" subNode
|
|
||||||
set subNode "$activeProject$dot$node$dot$subNode$dot$count"
|
|
||||||
if {[$tree exists $subNode] == 1} {return}
|
|
||||||
if {$backUpFileShow == "Yes"} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
}
|
||||||
if {$backUpFileShow == "No"} {
|
|
||||||
if {[file isdirectory $fileName] == 1} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
} else {
|
|
||||||
if {[string index $fileName end] != "~"} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
incr count
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach file [lsort [glob -nocomplain *]] {
|
foreach file [lsort [glob -nocomplain *]] {
|
||||||
lappend rList [list [file join $dir $file]]
|
lappend rList [list [file join $dir $file]]
|
||||||
set fileName [file join $file]
|
set fileName [file join $dir $file]
|
||||||
set img [GetImage $fileName]
|
GetFile $tree $fileName $parent
|
||||||
set dot "_"
|
|
||||||
regsub -all {\.} $fileName "_" subNode
|
|
||||||
set subNode "$activeProject$dot$node$dot$subNode$dot$count"
|
|
||||||
if {[$tree exists $subNode] == 1} {return}
|
|
||||||
if {$backUpFileShow == "Yes"} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
if {$backUpFileShow == "No"} {
|
|
||||||
if {[file isdirectory $fileName] == 1} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
} else {
|
|
||||||
if {[string index $fileName end] != "~"} {
|
|
||||||
$tree insert end $node $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
incr count
|
|
||||||
incr nodeCouner
|
|
||||||
}
|
}
|
||||||
$tree itemconfigure $node -open 1
|
$tree itemconfigure $node -open 1
|
||||||
}
|
}
|
||||||
## GETTING FILES FROM PROJECT DIR AND INSERT INTO TREE WIDGET ##
|
## GETTING FILES FROM PROJECT DIR AND INSERT INTO TREE WIDGET ##
|
||||||
proc GetFiles {dir project tree} {
|
proc GetFile {tree fileName parent} {
|
||||||
global fontNormal backUpFileShow dotFileShow imgDir count
|
global fontNormal backUpFileShow dotFileShow imgDir
|
||||||
|
set img [GetImage $fileName]
|
||||||
|
set dot "_"
|
||||||
|
regsub -all {\.|/|\\} $fileName "_" subNode
|
||||||
|
puts $subNode
|
||||||
|
if {[$tree exists $subNode] != 1} {
|
||||||
|
$tree insert end $parent $subNode -text [file tail $fileName] \
|
||||||
|
-data $fileName -open 1\
|
||||||
|
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
||||||
|
-font $fontNormal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proc GetFiles {tree parent dir} {
|
||||||
|
global fontNormal backUpFileShow dotFileShow imgDir
|
||||||
set rList ""
|
set rList ""
|
||||||
|
puts "$dir $parent $tree"
|
||||||
if {[catch {cd $dir}] != 0} {
|
if {[catch {cd $dir}] != 0} {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if {$dotFileShow eq "Yes"} {
|
if {$dotFileShow eq "Yes"} {
|
||||||
foreach file [lsort [glob -nocomplain .*]] {
|
foreach file [lsort [glob -nocomplain .*]] {
|
||||||
if {$file == "." || $file == ".."} {
|
if {$file != "." || $file != ".."} {
|
||||||
#puts $file
|
|
||||||
} else {
|
|
||||||
lappend rList [list [file join $dir $file]]
|
lappend rList [list [file join $dir $file]]
|
||||||
set fileName [file join $file]
|
set fileName [file join $dir $file]
|
||||||
set img [GetImage $fileName]
|
|
||||||
set dot "_"
|
GetFile $tree $fileName $parent
|
||||||
regsub -all {\.} $fileName "_" subNode
|
|
||||||
set subNode "$project$dot$subNode$dot$count"
|
|
||||||
if {$backUpFileShow == "Yes"} {
|
|
||||||
$tree insert end $project $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
}
|
||||||
if {$backUpFileShow == "No"} {
|
|
||||||
if {[string index $fileName end] != "~"} {
|
|
||||||
$tree insert end $project $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
incr count
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach file [lsort [glob -nocomplain *]] {
|
foreach file [lsort [glob -nocomplain *]] {
|
||||||
lappend rList [list [file join $dir $file]]
|
lappend rList [list [file join $dir $file]]
|
||||||
set fileName [file join $file]
|
set fileName [file join $dir $file]
|
||||||
set img [GetImage $fileName]
|
GetFile $tree $fileName $parent
|
||||||
set dot "_"
|
|
||||||
regsub -all {\.} $fileName "_" subNode
|
|
||||||
set subNode "$project$dot$subNode$dot$count"
|
|
||||||
if {$backUpFileShow == "Yes"} {
|
|
||||||
$tree insert end $project $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
if {$backUpFileShow == "No"} {
|
|
||||||
if {[string index $fileName end] != "~"} {
|
|
||||||
$tree insert end $project $subNode -text $fileName \
|
|
||||||
-data [file join $dir $fileName] -open 1\
|
|
||||||
-image [Bitmap::get [file join $imgDir $img.gif]]\
|
|
||||||
-font $fontNormal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
incr count
|
|
||||||
}
|
}
|
||||||
$tree configure -redraw 1
|
$tree configure -redraw 1
|
||||||
}
|
}
|
||||||
|
|
||||||
## GETTING PROJECT NAMES FROM DIR AND PUTS INTO
|
## GETTING PROJECT NAMES FROM DIR AND PUTS INTO
|
||||||
proc GetProj {tree} {
|
proc GetProj {tree} {
|
||||||
global projDir workDir fontNormal imgDir module
|
global projDir workDir fontNormal imgDir module
|
||||||
|
@ -376,8 +113,10 @@ proc GetProj {tree} {
|
||||||
$tree insert end root $prjName -text "$projName" -font $fontNormal \
|
$tree insert end root $prjName -text "$projName" -font $fontNormal \
|
||||||
-data "prj_$prjName" -open 0\
|
-data "prj_$prjName" -open 0\
|
||||||
-image [Bitmap::get [file join $imgDir folder.gif]]
|
-image [Bitmap::get [file join $imgDir folder.gif]]
|
||||||
GetFiles [file join $string] $prjName $tree
|
puts "GetFiles $tree $prjName $string"
|
||||||
set dir $string
|
GetFiles $tree $project $string
|
||||||
|
#$tree itemconfigure $prjName -open 1
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,17 +125,13 @@ proc GetProj {tree} {
|
||||||
|
|
||||||
## SHOW PUP-UP MENUS ##
|
## SHOW PUP-UP MENUS ##
|
||||||
proc PopupMenuFileTree {treeFiles x y} {
|
proc PopupMenuFileTree {treeFiles x y} {
|
||||||
#global fontNormal fontBold imgDir activeProject
|
|
||||||
#set node [$treeFiles selection get]
|
|
||||||
if {[$treeFiles selection get] != ""} {
|
if {[$treeFiles selection get] != ""} {
|
||||||
set node [$treeFiles selection get]
|
set node [$treeFiles selection get]
|
||||||
$treeFiles selection set $node
|
$treeFiles selection set $node
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
#set item [$treeFiles itemcget $node -data]
|
|
||||||
if {[info exists fileList($node)] != 1} {
|
if {[info exists fileList($node)] != 1} {
|
||||||
# set fileList($node) $item
|
|
||||||
tk_popup .popupFile $x $y
|
tk_popup .popupFile $x $y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,32 +201,29 @@ proc TreeClose {node} {
|
||||||
}
|
}
|
||||||
## TREE ONE CLICK PROCEDURE ##
|
## TREE ONE CLICK PROCEDURE ##
|
||||||
proc TreeOneClick {tree node} {
|
proc TreeOneClick {tree node} {
|
||||||
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
global noteBook fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
||||||
$tree selection get
|
$tree selection get
|
||||||
$tree selection set $node
|
$tree selection set $node
|
||||||
#puts "$tree >>> $node"
|
|
||||||
set item [$tree itemcget $node -data]
|
set item [$tree itemcget $node -data]
|
||||||
if {[string range $item 0 2] == "prj"} {
|
if {[string range $item 0 2] == "prj"} {
|
||||||
set activeProject [string range $item 4 end]
|
set activeProject [string range $item 4 end]
|
||||||
#puts $activeProject
|
|
||||||
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
||||||
if {[file exists [file join $workDir $activeProject.tags]] == 1} {
|
if {[file exists [file join $workDir $activeProject.tags]] == 1} {
|
||||||
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
} elseif {[file isdirectory $item] == 1} {
|
||||||
if {[info exists fileList($node)] != 1} {
|
if {[$noteBook index $node] == -1} {
|
||||||
if {[file isdirectory $item] == 1} {
|
|
||||||
return
|
return
|
||||||
} else {
|
}
|
||||||
|
} elseif {[file isfile $item] == 1 } {
|
||||||
|
if {[$noteBook index $node] != -1} {
|
||||||
if {[file exists $item] == 1} {
|
if {[file exists $item] == 1} {
|
||||||
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
|
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PageRaise $tree $node
|
PageRaise $tree $node
|
||||||
}
|
}
|
||||||
if {[string range $item 0 2] == "prc"} {
|
}
|
||||||
|
} elseif {[string range $item 0 2] == "prc"} {
|
||||||
set parent [$tree parent $node]
|
set parent [$tree parent $node]
|
||||||
set file [$tree itemcget $parent -data]
|
set file [$tree itemcget $parent -data]
|
||||||
set fileExt [string range [file extension $file] 1 end]
|
set fileExt [string range [file extension $file] 1 end]
|
||||||
|
@ -522,35 +254,32 @@ proc TreeOneClick {tree node} {
|
||||||
focus -force $text
|
focus -force $text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## TREE DOUBLE CLICK PROCEDURE ##
|
## TREE DOUBLE CLICK PROCEDURE ##
|
||||||
proc TreeDoubleClick {tree node} {
|
proc TreeDoubleClick {tree node} {
|
||||||
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold noteBook
|
||||||
#puts "$tree $node"
|
|
||||||
$tree selection set $node
|
$tree selection set $node
|
||||||
set item [$tree itemcget $node -data]
|
set item [$tree itemcget $node -data]
|
||||||
#puts $item
|
|
||||||
if {[$tree itemcget $node -open] == 1} {
|
if {[$tree itemcget $node -open ] == 1} {
|
||||||
$tree itemconfigure $node -open 0
|
puts " $item $tree itemcget $node -open"
|
||||||
} elseif {[$tree itemcget $node -open] == 0} {
|
$tree closetree $node
|
||||||
$tree itemconfigure $node -open 1
|
} elseif {[$tree itemcget $node -open ] == 0} {
|
||||||
|
puts " $item $tree itemcget $node -open"
|
||||||
|
$tree opentree $node
|
||||||
}
|
}
|
||||||
|
$tree opentree $node
|
||||||
if {[string range $item 0 2] == "prj"} {
|
if {[string range $item 0 2] == "prj"} {
|
||||||
|
# node is project
|
||||||
set activeProject [string range $item 4 end]
|
set activeProject [string range $item 4 end]
|
||||||
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
||||||
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
#GetFilesSubdir $tree $node $item
|
||||||
}
|
} elseif {[file isdirectory $item] ==1} {
|
||||||
|
# node is directory
|
||||||
if {[info exists fileList($node)] != 1} {
|
GetFiles $tree $node $item
|
||||||
if {[file isdirectory $item] == 1} {
|
puts "GetFiles $tree $node $item"
|
||||||
GetFilesSubdir $tree $node $item
|
} elseif {[string range $item 0 2] == "prc"} {
|
||||||
} else {
|
# node is procedure (class, function, etc)
|
||||||
if {[file exists $item] == 1} {
|
|
||||||
EditFile $tree $node $item
|
|
||||||
LabelUpdate .frmStatus.frmFile.lblFile "[file size $item] b."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if {[string range $item 0 2] == "prc"} {
|
|
||||||
$tree selection set $node
|
$tree selection set $node
|
||||||
set parent [$tree parent $node]
|
set parent [$tree parent $node]
|
||||||
if {[info exists fileList($parent)] != 1} {
|
if {[info exists fileList($parent)] != 1} {
|
||||||
|
@ -566,9 +295,19 @@ proc TreeDoubleClick {tree node} {
|
||||||
set findString "proc [string range $item $index1 $index2] "
|
set findString "proc [string range $item $index1 $index2] "
|
||||||
FindProc $text $findString $node
|
FindProc $text $findString $node
|
||||||
focus -force $text
|
focus -force $text
|
||||||
|
} elseif {[file isfile $item] == 1} {
|
||||||
|
#puts [$noteBook index $node]
|
||||||
|
if {[$noteBook index $node] != -1} {
|
||||||
|
puts "File тута $node"
|
||||||
|
puts "fileList($node) $fileList($node)"
|
||||||
|
} else {
|
||||||
|
EditFile $tree $node $item
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
## UPDATE TREE ##
|
## UPDATE TREE ##
|
||||||
proc UpdateTree {} {
|
proc UpdateTree {} {
|
||||||
|
|
30
projman.tcl
30
projman.tcl
|
@ -35,25 +35,11 @@ puts $tclDir
|
||||||
set rootDir [pwd]
|
set rootDir [pwd]
|
||||||
#set rootDir "/usr"
|
#set rootDir "/usr"
|
||||||
#set tclDir "/usr/bin"
|
#set tclDir "/usr/bin"
|
||||||
|
set dataDir "[file join $rootDir lib]"
|
||||||
if {[file exists $env(HOME)/projects/tcl/projman]==1} {
|
set docDir "[file join $rootDir hlp ru]"
|
||||||
set dataDir "[file join $env(HOME) projects tcl projman lib]"
|
set imgDir "[file join $rootDir img]"
|
||||||
set docDir "[file join $env(HOME) projects tcl projman hlp ru]"
|
set msgDir "[file join $rootDir msgs]"
|
||||||
set imgDir "[file join $env(HOME) projects tcl projman img]"
|
set binDir $rootDir
|
||||||
set msgDir "[file join $env(HOME) projects tcl projman msgs]"
|
|
||||||
set binDir "[file join $env(HOME) projects tcl projman]"
|
|
||||||
} else {
|
|
||||||
set dataDir "[file join $rootDir lib]"
|
|
||||||
set docDir "[file join $rootDir hlp ru]"
|
|
||||||
set imgDir "[file join $rootDir img]"
|
|
||||||
set msgDir "[file join $rootDir msgs]"
|
|
||||||
set binDir $rootDir
|
|
||||||
# set binDir [file join $rootDir bin]
|
|
||||||
# set dataDir [file join $rootDir share projman]
|
|
||||||
# set docDir [file join $rootDir share doc projman-$ver]
|
|
||||||
# set imgDir [file join $dataDir img]
|
|
||||||
# set msgDir [file join $dataDir msgs]
|
|
||||||
}
|
|
||||||
set hlDir [file join $dataDir highlight]
|
set hlDir [file join $dataDir highlight]
|
||||||
|
|
||||||
if {$tcl_platform(platform) == "unix"} {
|
if {$tcl_platform(platform) == "unix"} {
|
||||||
|
@ -150,7 +136,7 @@ option add *Listbox.Background $editor(bg) interactive
|
||||||
#option add *Menubutton.font $guifont userDefault
|
#option add *Menubutton.font $guifont userDefault
|
||||||
option add *Dialog.msg.background $editor(bg)
|
option add *Dialog.msg.background $editor(bg)
|
||||||
|
|
||||||
# option add *Text.Background $textbg userDefault
|
# option add *Text.Background $textbg userDefault
|
||||||
# option add *Entry.Background $textbg userDefault
|
# option add *Entry.Background $textbg userDefault
|
||||||
# option add *Text.Foreground $textfg userDefault
|
# option add *Text.Foreground $textfg userDefault
|
||||||
# option add *Entry.Foreground $textfg userDefault
|
# option add *Entry.Foreground $textfg userDefault
|
||||||
|
@ -174,9 +160,5 @@ option add *Dialog.msg.background $editor(bg)
|
||||||
# option add *Entry.highlightBackground $bg userDefault
|
# option add *Entry.highlightBackground $bg userDefault
|
||||||
# option add *Text.HighlightThickness 2 userDefault
|
# option add *Text.HighlightThickness 2 userDefault
|
||||||
# option add *Entry.HighlightThickness 1 userDefault
|
# option add *Entry.HighlightThickness 1 userDefault
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user