Refactoring all procedures is the Tree working

0.4.6
Sergey 2018-02-24 18:03:35 +03:00
parent 164317de93
commit 98de397ae9
9 changed files with 141 additions and 378 deletions

View File

@ -6,6 +6,11 @@
##########################################################
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
- Refactoring Settigs procedure source code
- 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 uncorrect cursor position counter into editor

View File

@ -8,7 +8,7 @@
## ABOUT PROGRAMM DIALOG ##
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 {}
# prevent double creation "About" page
if { [catch {set w [$noteBook insert end about -text [::msgcat::mc "About ..."]]} ] } {
@ -409,8 +409,8 @@ proc AboutDialog {} {
$noteBook raise about
focus $w.frmBtn.btnOk
if {[file exists $env(HOME)/projects/tcl/projman]==1} {
set file [open [file join $env(HOME)/projects/tcl/projman THANKS] r]
if {[file exists [file join $rootDir THANKS]] == 1} {
set file [open [file join $rootDir THANKS] r]
} else {
set file [open [file join $docDir THANKS] r]
}

View File

@ -81,6 +81,7 @@ proc ReplaceChar {text} {
$text delete $posY.$posX $posY.[expr $posX + 1]
}
}
## OVERWRITE SYMBOL PROCEDURE ##
proc OverWrite {} {
global replace fontNormal
@ -573,7 +574,7 @@ proc TextEncode {encode} {
proc EditFile {tree node fileName} {
global projDir workDir imgDir noteBook fontNormal fontBold w fileList replace nodeEdit procList
global backUpFileCreate fileExt progress editor braceHighLightBG braceHighLightFG activeProject
global varList
global varList noteBookFiles
set nodeEdit $node
set replace 0
set file [file tail $fileName]
@ -647,12 +648,12 @@ proc EditFile {tree node fileName} {
bind $text <Control-ecircumflex> ReplaceDialog
bind $text <Control-r> ReplaceDialog
bind $text <F4> {ReplaceCommand $w.text 1}
bind $text <Control-ucircumflex> {FileDialog $tree save}
bind $text <Control-s> {FileDialog $tree save}
bind $text <Control-ocircumflex> {FileDialog $tree save_as}
bind $text <Shift-Control-s> {FileDialog $tree save_as}
bind $text <Control-odiaeresis> {FileDialog $tree close}
bind $text <Control-w> {FileDialog $tree close}
bind $text <Control-ucircumflex> {FileDialog [$noteBookFiles raise] save}
bind $text <Control-s> {FileDialog [$noteBookFiles raise] save}
bind $text <Control-ocircumflex> {FileDialog [$noteBookFiles raise] save_as}
bind $text <Shift-Control-s> {FileDialog [$noteBookFiles raise] save_as}
bind $text <Control-odiaeresis> {FileDialog [$noteBookFiles raise] close}
bind $text <Control-w> {FileDialog [$noteBookFiles raise] close}
bind $text <Control-division> "tk_textCut $w.text;break"
bind $text <Control-x> "tk_textCut $w.text;break"
bind $text <Control-ntilde> "tk_textCopy $w.text;break"
@ -951,3 +952,5 @@ proc ReadFileStructure {mod line lineNumber tree node} {
####################################
GetOp

View File

@ -35,7 +35,7 @@ proc FileDialog {nbNode operation} {
} elseif {$nbNode eq "projects"} {
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
}
puts "node $nbNode , Tree - $tree"
if {$operation == "open"} {
set dir $projDir
set fullPath [tk_getOpenFile -initialdir $dir -filetypes $types -parent $noteBook]
@ -618,3 +618,4 @@ proc FileOperation::FileDialog {tree operation} {

View File

@ -284,7 +284,34 @@ set nbFiles [$noteBookFiles insert end files -text [::msgcat::mc "Files"] \
# 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
set frmTree [ScrolledWindow $nbProjects.frmTree -bg $editor(bg)]
@ -347,7 +374,7 @@ $m add separator
$m add command -label [::msgcat::mc "Add to existing project"] -command {AddToProjDialog "" [$noteBookFiles raise]} \
-font $fontNormal -state disable
$m add command -label [::msgcat::mc "Add as new project"] -command {OpenProj [$noteBookFiles raise]} -font $fontNormal
## POPUP PROJECT-MENU ##
set m [menu .popupProj -font $fontNormal -bg $editor(bg) -fg $editor(fg)]
@ -391,7 +418,9 @@ focus -force $tree
# Opened last active project
if {[info exists workingProject]} {
if {$workingProject ne ""} {
TreeDoubleClick .frmBody.frmCat.noteBook.fprojects.frmTree.tree $workingProject
.frmBody.frmCat.noteBook.fprojects.frmTree.tree opentree $workingProject
}
}

View File

@ -1,4 +1,4 @@
######################################################
######################################################
# Tcl/Tk Project Manager
# Distributed under GNU Public License
# Author: Sergey Kalinin banzaj28@yandex.ru
@ -92,5 +92,3 @@ proc GetMenu {m} {
}

View File

@ -491,8 +491,9 @@ proc AddNewProjectIntoTree {proj} {
$tree insert end root $prjName -text "$projName" -font $fontNormal \
-data "prj_$prjName" -open 0\
-image [Bitmap::get [file join $imgDir folder.gif]]
GetFiles [file join $string] $prjName $tree
GetFiles $tree $prjName [file join $string]
set dir $string
}
}
}
@ -570,6 +571,7 @@ proc AddToProj {fileName mode workingTree} {
EditFile [GetTreeForNode $subNode] $subNode [file join $dir $fileName]
}
## ADD FILE INTO PROJECT DIALOG##
proc AddToProjDialog {mode node} {
global projDir workDir activeProject imgDir mod workingTree
set mod $mode
@ -1003,3 +1005,4 @@ proc InsertTitle {newFile type} {
}

View File

@ -9,187 +9,9 @@
# Procedure for operation wwith Tree widget
#
####################################################
namespace eval FileTree {
variable count
variable dblclick
}
set count 1
proc FileTree::create {nb} {
global editor
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
proc GetAllDirs {treeFiles} {
global projDir workDir fontNormal imgDir module env
set rList ""
set rootDir $env(HOME)
if {[catch {cd $rootDir}] != 0} {
@ -198,159 +20,74 @@ proc FileTree::GetAllDirs {treeFiles} {
set rootNode [$treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
-data "dir_root" -open 1\
-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
}
## GETTING FILES FROM SUBDIR ##
proc GetFilesSubdir {tree node dir} {
global fontNormal projDir workDir activeProject imgDir count
global fontNormal projDir workDir activeProject imgDir
global backUpFileShow dotFileShow
set rList ""
puts "$tree $node $dir"
if {[catch {cd $dir}] != 0} {
return ""
}
if {$dotFileShow eq "Yes"} {
foreach file [lsort [glob -nocomplain .*]] {
if {$file == "." || $file == ".."} {
#puts $file
} else {
if {$file != "." || $file != ".."} {
lappend rList [list [file join $dir $file]]
set fileName [file join $file]
set img [GetImage $fileName]
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
}
}
}
set fileName [file join $dir $file]
GetFile $tree $fileName $parent
}
incr count
}
}
foreach file [lsort [glob -nocomplain *]] {
lappend rList [list [file join $dir $file]]
set fileName [file join $file]
set img [GetImage $fileName]
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
set fileName [file join $dir $file]
GetFile $tree $fileName $parent
}
$tree itemconfigure $node -open 1
}
## GETTING FILES FROM PROJECT DIR AND INSERT INTO TREE WIDGET ##
proc GetFiles {dir project tree} {
global fontNormal backUpFileShow dotFileShow imgDir count
proc GetFile {tree fileName parent} {
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 ""
puts "$dir $parent $tree"
if {[catch {cd $dir}] != 0} {
return ""
}
if {$dotFileShow eq "Yes"} {
foreach file [lsort [glob -nocomplain .*]] {
if {$file == "." || $file == ".."} {
#puts $file
} else {
if {$file != "." || $file != ".."} {
lappend rList [list [file join $dir $file]]
set fileName [file join $file]
set img [GetImage $fileName]
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
}
}
set fileName [file join $dir $file]
GetFile $tree $fileName $parent
}
incr count
}
}
foreach file [lsort [glob -nocomplain *]] {
lappend rList [list [file join $dir $file]]
set fileName [file join $file]
set img [GetImage $fileName]
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
set fileName [file join $dir $file]
GetFile $tree $fileName $parent
}
$tree configure -redraw 1
}
## GETTING PROJECT NAMES FROM DIR AND PUTS INTO
proc GetProj {tree} {
global projDir workDir fontNormal imgDir module
@ -376,8 +113,10 @@ proc GetProj {tree} {
$tree insert end root $prjName -text "$projName" -font $fontNormal \
-data "prj_$prjName" -open 0\
-image [Bitmap::get [file join $imgDir folder.gif]]
GetFiles [file join $string] $prjName $tree
set dir $string
puts "GetFiles $tree $prjName $string"
GetFiles $tree $project $string
#$tree itemconfigure $prjName -open 1
}
}
}
@ -386,17 +125,13 @@ proc GetProj {tree} {
## SHOW PUP-UP MENUS ##
proc PopupMenuFileTree {treeFiles x y} {
#global fontNormal fontBold imgDir activeProject
#set node [$treeFiles selection get]
if {[$treeFiles selection get] != ""} {
set node [$treeFiles selection get]
$treeFiles selection set $node
} else {
return
}
#set item [$treeFiles itemcget $node -data]
if {[info exists fileList($node)] != 1} {
# set fileList($node) $item
tk_popup .popupFile $x $y
}
}
@ -466,32 +201,29 @@ proc TreeClose {node} {
}
## TREE ONE CLICK PROCEDURE ##
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 set $node
#puts "$tree >>> $node"
set item [$tree itemcget $node -data]
if {[string range $item 0 2] == "prj"} {
set activeProject [string range $item 4 end]
#puts $activeProject
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
if {[file exists [file join $workDir $activeProject.tags]] == 1} {
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
}
return
}
if {[info exists fileList($node)] != 1} {
if {[file isdirectory $item] == 1} {
} elseif {[file isdirectory $item] == 1} {
if {[$noteBook index $node] == -1} {
return
} else {
}
} elseif {[file isfile $item] == 1 } {
if {[$noteBook index $node] != -1} {
if {[file exists $item] == 1} {
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
PageRaise $tree $node
}
}
} else {
PageRaise $tree $node
}
if {[string range $item 0 2] == "prc"} {
} elseif {[string range $item 0 2] == "prc"} {
set parent [$tree parent $node]
set file [$tree itemcget $parent -data]
set fileExt [string range [file extension $file] 1 end]
@ -522,35 +254,32 @@ proc TreeOneClick {tree node} {
focus -force $text
}
}
## TREE DOUBLE CLICK PROCEDURE ##
proc TreeDoubleClick {tree node} {
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
#puts "$tree $node"
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold noteBook
$tree selection set $node
set item [$tree itemcget $node -data]
#puts $item
if {[$tree itemcget $node -open] == 1} {
$tree itemconfigure $node -open 0
} elseif {[$tree itemcget $node -open] == 0} {
$tree itemconfigure $node -open 1
if {[$tree itemcget $node -open ] == 1} {
puts " $item $tree itemcget $node -open"
$tree closetree $node
} 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"} {
# node is project
set activeProject [string range $item 4 end]
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
}
if {[info exists fileList($node)] != 1} {
if {[file isdirectory $item] == 1} {
GetFilesSubdir $tree $node $item
} else {
if {[file exists $item] == 1} {
EditFile $tree $node $item
LabelUpdate .frmStatus.frmFile.lblFile "[file size $item] b."
}
}
}
if {[string range $item 0 2] == "prc"} {
#GetFilesSubdir $tree $node $item
} elseif {[file isdirectory $item] ==1} {
# node is directory
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
set parent [$tree parent $node]
if {[info exists fileList($parent)] != 1} {
@ -566,10 +295,20 @@ proc TreeDoubleClick {tree node} {
set findString "proc [string range $item $index1 $index2] "
FindProc $text $findString $node
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 ##
proc UpdateTree {} {
global tree

View File

@ -35,25 +35,11 @@ puts $tclDir
set rootDir [pwd]
#set rootDir "/usr"
#set tclDir "/usr/bin"
if {[file exists $env(HOME)/projects/tcl/projman]==1} {
set dataDir "[file join $env(HOME) projects tcl projman lib]"
set docDir "[file join $env(HOME) projects tcl projman hlp ru]"
set imgDir "[file join $env(HOME) projects tcl projman img]"
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 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 hlDir [file join $dataDir highlight]
if {$tcl_platform(platform) == "unix"} {
@ -149,8 +135,8 @@ option add *Listbox.Background $editor(bg) interactive
#option add *Menu.font $guifont userDefault
#option add *Menubutton.font $guifont userDefault
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 *Text.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 *Text.HighlightThickness 2 userDefault
# option add *Entry.HighlightThickness 1 userDefault
#
#