File Browser added
This commit is contained in:
parent
70bf20d61e
commit
d2a0e3fd31
|
@ -8,6 +8,7 @@
|
||||||
0.4.5
|
0.4.5
|
||||||
08.02.2018
|
08.02.2018
|
||||||
- Auto indent added for () [] braces
|
- Auto indent added for () [] braces
|
||||||
|
- File Browser added. Now we will edited any file without project
|
||||||
|
|
||||||
07.02.2018
|
07.02.2018
|
||||||
- Tcl, Perl, PHP highlight comment procedure fixed
|
- Tcl, Perl, PHP highlight comment procedure fixed
|
||||||
|
@ -392,6 +393,8 @@ Fixed bug with PageRise function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
###########################################################
|
###########################################################
|
||||||
# Tcl/Tk Project Manager #
|
# Tcl/Tk Project Manager #
|
||||||
# install script #
|
# install script #
|
||||||
# Copyright (c) "Sergey Kalinin", 2001, http://nuk-svk.ru #
|
# Copyright (c) "Sergey Kalinin", 2001, http://nuk-svk.ru #
|
||||||
# Author: Sergey Kalinin banzaj28@yandex.ru #
|
# Author: Sergey Kalinin banzaj28@yandex.ru #
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
## SETTING VARIABLES AND DIRECTORYES ##
|
## SETTING VARIABLES AND DIRECTORYES ##
|
||||||
|
@ -17,7 +17,6 @@ set fontNormal "helvetica 12 normal roman"
|
||||||
package require msgcat
|
package require msgcat
|
||||||
package require BWidget
|
package require BWidget
|
||||||
|
|
||||||
|
|
||||||
::msgcat::mclocale en
|
::msgcat::mclocale en
|
||||||
::msgcat::mcload msgs
|
::msgcat::mcload msgs
|
||||||
|
|
||||||
|
@ -399,3 +398,4 @@ proc SetVarLang {lang} {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -363,8 +363,8 @@ proc Replace {text incr} {
|
||||||
# focus -force .replace
|
# focus -force .replace
|
||||||
}
|
}
|
||||||
## FILE OPERATION ##
|
## FILE OPERATION ##
|
||||||
proc FileDialog {operation} {
|
proc FileDialog {$tree operation} {
|
||||||
global noteBook fontNormal fontBold fileList tree noteBook projDir activeProject imgDir editor
|
global noteBook fontNormal fontBold fileList noteBook projDir activeProject imgDir editor
|
||||||
set dot "_"
|
set dot "_"
|
||||||
set types {
|
set types {
|
||||||
{"Tcl files" {.tcl}}
|
{"Tcl files" {.tcl}}
|
||||||
|
@ -686,7 +686,7 @@ proc PageTab {key} {
|
||||||
}
|
}
|
||||||
$nb see [lindex [$nb pages] $newIndex]
|
$nb see [lindex [$nb pages] $newIndex]
|
||||||
$nb raise [lindex [$nb pages] $newIndex]
|
$nb raise [lindex [$nb pages] $newIndex]
|
||||||
PageRaise [lindex [$nb pages] $newIndex]
|
PageRaise $tree [lindex [$nb pages] $newIndex]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,8 +722,8 @@ proc _PageTab {} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
## RAISED NOTEBOOK TAB IF CLICK MOUSE BUTTON ##
|
## RAISED NOTEBOOK TAB IF CLICK MOUSE BUTTON ##
|
||||||
proc PageRaise {node} {
|
proc PageRaise {tree node} {
|
||||||
global noteBook tree fileList editor nodeEdit
|
global noteBook fileList editor nodeEdit
|
||||||
#puts $node
|
#puts $node
|
||||||
$noteBook raise $node
|
$noteBook raise $node
|
||||||
set nodeEdit [$noteBook raise]
|
set nodeEdit [$noteBook raise]
|
||||||
|
@ -765,7 +765,7 @@ proc TabIns {text} {
|
||||||
set posNum [lindex [split $pos "."] 1]
|
set posNum [lindex [split $pos "."] 1]
|
||||||
if {$lineNum > 1} {
|
if {$lineNum > 1} {
|
||||||
# get current text
|
# get current text
|
||||||
set curText [$text get $lineNum.0 "$lineNum.0 lineend"]
|
set curText [$text get $lineNum.0 "$lineNum.0 lineend"]
|
||||||
#get text of prev line
|
#get text of prev line
|
||||||
set prevLineNum [expr {$lineNum - 1}]
|
set prevLineNum [expr {$lineNum - 1}]
|
||||||
set prevText [$text get $prevLineNum.0 "$prevLineNum.0 lineend"]
|
set prevText [$text get $prevLineNum.0 "$prevLineNum.0 lineend"]
|
||||||
|
@ -820,7 +820,6 @@ proc TabIns {text} {
|
||||||
set shouldBeSpaces [expr {$shouldBeSpaces - $indentSize}]
|
set shouldBeSpaces [expr {$shouldBeSpaces - $indentSize}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set spaceNum [string length $spaces]
|
set spaceNum [string length $spaces]
|
||||||
if {$shouldBeSpaces > $spaceNum} {
|
if {$shouldBeSpaces > $spaceNum} {
|
||||||
#insert spaces
|
#insert spaces
|
||||||
|
@ -870,8 +869,8 @@ proc TextEncode {encode} {
|
||||||
}
|
}
|
||||||
|
|
||||||
## EDITING FILE ##
|
## EDITING FILE ##
|
||||||
proc EditFile {node fileName} {
|
proc EditFile {tree node fileName} {
|
||||||
global projDir workDir imgDir tree 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
|
||||||
set nodeEdit $node
|
set nodeEdit $node
|
||||||
set replace 0
|
set replace 0
|
||||||
|
@ -1225,3 +1224,10 @@ proc TextOperation {oper} {
|
||||||
####################################
|
####################################
|
||||||
GetOp
|
GetOp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
31
lib/main.tcl
31
lib/main.tcl
|
@ -278,7 +278,17 @@ pack $frmWork -side left -fill both -expand true
|
||||||
## CREATE PANE ##
|
## CREATE PANE ##
|
||||||
pane::create .frmBody.frmCat .frmBody.frmWork
|
pane::create .frmBody.frmCat .frmBody.frmWork
|
||||||
|
|
||||||
set frmTree [ScrolledWindow $frmCat.frmTree -bg $editor(bg)]
|
# NoteBook - Projects and Files
|
||||||
|
#################### WORKING AREA ####################
|
||||||
|
set noteBookFiles [NoteBook $frmCat.noteBook -font $fontNormal -side top -bg $editor(bg) -fg $editor(fg)]
|
||||||
|
pack $noteBookFiles -fill both -expand true -padx 2 -pady 2
|
||||||
|
set nbProjects [$noteBookFiles insert end projects -text [::msgcat::mc "Projects"]]
|
||||||
|
set nbFiles [$noteBookFiles insert end files -text [::msgcat::mc "Files"]]
|
||||||
|
|
||||||
|
FileTree::create $nbFiles
|
||||||
|
|
||||||
|
# tree
|
||||||
|
set frmTree [ScrolledWindow $nbProjects.frmTree -bg $editor(bg)]
|
||||||
global tree noteBook
|
global tree noteBook
|
||||||
set tree [Tree $frmTree.tree \
|
set tree [Tree $frmTree.tree \
|
||||||
-relief sunken -borderwidth 1 -width 5 -height 5 -highlightthickness 1\
|
-relief sunken -borderwidth 1 -width 5 -height 5 -highlightthickness 1\
|
||||||
|
@ -291,17 +301,19 @@ set tree [Tree $frmTree.tree \
|
||||||
$frmTree setwidget $tree
|
$frmTree setwidget $tree
|
||||||
pack $frmTree -side top -fill both -expand true
|
pack $frmTree -side top -fill both -expand true
|
||||||
|
|
||||||
$tree bindText <Double-ButtonPress-1> "TreeDoubleClick [$tree selection get]"
|
$noteBookFiles raise projects
|
||||||
$tree bindText <ButtonPress-1> "TreeOneClick [$tree selection get]"
|
|
||||||
$tree bindImage <Double-ButtonPress-1> "TreeDoubleClick [$tree selection get]"
|
$tree bindText <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]"
|
||||||
$tree bindImage <ButtonPress-1> "TreeOneClick [$tree selection get]"
|
$tree bindText <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
|
||||||
|
$tree bindImage <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]"
|
||||||
|
$tree bindImage <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
|
||||||
$tree bindText <Shift-Button-1> {$tree selection add [$tree selection get]}
|
$tree bindText <Shift-Button-1> {$tree selection add [$tree selection get]}
|
||||||
bind $frmTree.tree.c <Control-acircumflex> {FileDialog delete}
|
bind $frmTree.tree.c <Control-acircumflex> {FileDialog delete}
|
||||||
bind $frmTree.tree.c <Control-d> {FileDialog delete}
|
bind $frmTree.tree.c <Control-d> {FileDialog delete}
|
||||||
bind $frmTree.tree.c <Return> {
|
bind $frmTree.tree.c <Return> {
|
||||||
set node [$tree selection get]
|
set node [$tree selection get]
|
||||||
TreeOneClick $node
|
TreeOneClick $tree $node
|
||||||
TreeDoubleClick $node
|
TreeDoubleClick $tree $node
|
||||||
}
|
}
|
||||||
|
|
||||||
## POPUP FILE-MENU ##
|
## POPUP FILE-MENU ##
|
||||||
|
@ -358,7 +370,7 @@ bind $frmTree.tree.c <Shift-Button-5> "$tree xview scroll 2 units"
|
||||||
#################### WORKING AREA ####################
|
#################### WORKING AREA ####################
|
||||||
set noteBook [NoteBook $frmWork.noteBook -font $fontNormal -side top -bg $editor(bg) -fg $editor(fg)]
|
set noteBook [NoteBook $frmWork.noteBook -font $fontNormal -side top -bg $editor(bg) -fg $editor(fg)]
|
||||||
pack $noteBook -fill both -expand true -padx 2 -pady 2
|
pack $noteBook -fill both -expand true -padx 2 -pady 2
|
||||||
$noteBook bindtabs <ButtonRelease-1> "PageRaise [$noteBook raise]"
|
$noteBook bindtabs <ButtonRelease-1> "PageRaise $tree [$noteBook raise]"
|
||||||
$noteBook bindtabs <Button-3> {catch [PopupMenuTab .popupTabs %X %Y]}
|
$noteBook bindtabs <Button-3> {catch [PopupMenuTab .popupTabs %X %Y]}
|
||||||
|
|
||||||
#bind . <Control-udiaeresis> PageTab
|
#bind . <Control-udiaeresis> PageTab
|
||||||
|
@ -378,6 +390,3 @@ focus -force $tree
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,31 +28,6 @@ proc LabelUpdate {widget value} {
|
||||||
global fontNormal
|
global fontNormal
|
||||||
$widget configure -text $value -font $fontNormal
|
$widget configure -text $value -font $fontNormal
|
||||||
}
|
}
|
||||||
## SHOW PUP-UP MENUS ##
|
|
||||||
proc PopupMenuTree {x y} {
|
|
||||||
global tree fontNormal fontBold imgDir activeProject
|
|
||||||
set node [$tree selection get]
|
|
||||||
if {$node ==""} {
|
|
||||||
set answer [tk_messageBox\
|
|
||||||
-message "[::msgcat::mc "Not found active project"]"\
|
|
||||||
-type ok -icon warning]
|
|
||||||
case $answer {
|
|
||||||
ok {return 0}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$tree selection set $node
|
|
||||||
set item [$tree itemcget $node -data]
|
|
||||||
if {[string range $item 0 2] == "prj"} {
|
|
||||||
set activeProject [string range $item 4 end]
|
|
||||||
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
|
||||||
tk_popup .popupProj $x $y
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if {[info exists fileList($node)] != 1} {
|
|
||||||
# set fileList($node) $item
|
|
||||||
tk_popup .popupFile $x $y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proc PopupMenuEditor {x y} {
|
proc PopupMenuEditor {x y} {
|
||||||
tk_popup .popMnuEdit $x $y
|
tk_popup .popMnuEdit $x $y
|
||||||
}
|
}
|
||||||
|
@ -66,16 +41,16 @@ proc FileAttr {file} {
|
||||||
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
||||||
append fileAttribute $modifyTime
|
append fileAttribute $modifyTime
|
||||||
} elseif {$tcl_platform(platform) == "mac"} {
|
} elseif {$tcl_platform(platform) == "mac"} {
|
||||||
|
|
||||||
} elseif {$tcl_platform(platform) == "unix"} {
|
} elseif {$tcl_platform(platform) == "unix"} {
|
||||||
set unixTime [file mtime $file]
|
set unixTime [file mtime $file]
|
||||||
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
||||||
append fileAttribute $modifyTime
|
append fileAttribute $modifyTime
|
||||||
}
|
}
|
||||||
# get file size
|
# get file size
|
||||||
set size [file size $file]
|
set size [file size $file]
|
||||||
if {$size < 1024} {
|
if {$size < 1024} {
|
||||||
set fileSize "$size b"
|
set fileSize "$size b"
|
||||||
}
|
}
|
||||||
if {$size >= 1024} {
|
if {$size >= 1024} {
|
||||||
set s [expr ($size.0) / 1024]
|
set s [expr ($size.0) / 1024]
|
||||||
|
@ -93,318 +68,6 @@ if {$size < 1024} {
|
||||||
}
|
}
|
||||||
append fileAttribute ", $fileSize"
|
append fileAttribute ", $fileSize"
|
||||||
}
|
}
|
||||||
## OPEN TREE PROCEDURE
|
|
||||||
proc TreeOpen {node} {
|
|
||||||
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
|
||||||
|
|
||||||
$tree selection set $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
|
|
||||||
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir openfold.gif]]
|
|
||||||
if {[file exists [file join $workDir $activeProject.tags]] == 1} {
|
|
||||||
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
|
||||||
} else {
|
|
||||||
DoModule ctags
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if {[info exists fileList($node)] != 1} {
|
|
||||||
set fileList($node) $item
|
|
||||||
if {[file isdirectory $item] == 1} {
|
|
||||||
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir openfold.gif]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
## CLOSE TREE PROCEDURE ##
|
|
||||||
proc TreeClose {node} {
|
|
||||||
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
|
||||||
|
|
||||||
$tree selection set $node
|
|
||||||
set item [$tree itemcget $node -data]
|
|
||||||
if {[string range $item 0 2] == "prj"} {
|
|
||||||
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir folder.gif]]
|
|
||||||
}
|
|
||||||
if {[info exists fileList($node)] != 1} {
|
|
||||||
if {[file isdirectory $item] == 1} {
|
|
||||||
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir folder.gif]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
## TREE ONE CLICK PROCEDURE ##
|
|
||||||
proc TreeOneClick {node} {
|
|
||||||
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
|
||||||
$tree selection set $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
|
|
||||||
} else {
|
|
||||||
DoModule ctags
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if {[info exists fileList($node)] != 1} {
|
|
||||||
if {[file isdirectory $item] == 1} {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
if {[file exists $item] == 1} {
|
|
||||||
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PageRaise $node
|
|
||||||
}
|
|
||||||
if {[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]
|
|
||||||
if {[info exists fileList($parent)] == 0} {
|
|
||||||
EditFile $parent $file
|
|
||||||
}
|
|
||||||
PageRaise $parent
|
|
||||||
$tree selection set $node
|
|
||||||
set text "$noteBook.f$parent.text"
|
|
||||||
set index1 [expr [string first "_" $item]+1]
|
|
||||||
set index2 [expr [string last "_" $item]11]
|
|
||||||
if {$fileExt == "java" || $fileExt == "ja"} {
|
|
||||||
set findString "class [string range $item $index1 $index2] "
|
|
||||||
} elseif {$fileExt == "perl" || $fileExt == "pl"} {
|
|
||||||
set findString "sub [string range $item $index1 $index2]"
|
|
||||||
} elseif {$fileExt == "ml" || $fileExt == "mli"} {
|
|
||||||
set findString "let [string range $item $index1 $index2]"
|
|
||||||
} elseif {$fileExt == "php" || $fileExt == "phtml"} {
|
|
||||||
set findString "function [string range $item $index1 $index2]"
|
|
||||||
puts $findString
|
|
||||||
#return
|
|
||||||
} elseif {$fileExt == "rb"} {
|
|
||||||
set findString "class [string range $item $index1 $index2]"
|
|
||||||
} else {
|
|
||||||
set findString "proc [string range $item $index1 $index2] "
|
|
||||||
}
|
|
||||||
FindProc $text $findString $node
|
|
||||||
focus -force $text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
## TREE DOUBLE CLICK PROCEDURE ##
|
|
||||||
proc TreeDoubleClick {node} {
|
|
||||||
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
|
||||||
|
|
||||||
$tree selection set $node
|
|
||||||
set item [$tree itemcget $node -data]
|
|
||||||
if {[$tree itemcget $node -open] == 1} {
|
|
||||||
$tree itemconfigure $node -open 0
|
|
||||||
} elseif {[$tree itemcget $node -open] == 0} {
|
|
||||||
$tree itemconfigure $node -open 1
|
|
||||||
}
|
|
||||||
if {[string range $item 0 2] == "prj"} {
|
|
||||||
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 $node $item
|
|
||||||
} else {
|
|
||||||
if {[file exists $item] == 1} {
|
|
||||||
EditFile $node $item
|
|
||||||
LabelUpdate .frmStatus.frmFile.lblFile "[file size $item] b."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if {[string range $item 0 2] == "prc"} {
|
|
||||||
$tree selection set $node
|
|
||||||
set parent [$tree parent $node]
|
|
||||||
if {[info exists fileList($parent)] != 1} {
|
|
||||||
set file [$tree itemcget $parent -data]
|
|
||||||
EditFile $parent $file
|
|
||||||
$noteBook raise $parent
|
|
||||||
} else {
|
|
||||||
$noteBook raise $parent
|
|
||||||
}
|
|
||||||
set text "$noteBook.f$parent.text"
|
|
||||||
set index1 [expr [string first "_" $item]+1]
|
|
||||||
set index2 [expr [string last "_" $item]11]
|
|
||||||
set findString "proc [string range $item $index1 $index2] "
|
|
||||||
FindProc $text $findString $node
|
|
||||||
focus -force $text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
## GETTING FILES FROM SUBCIR ##
|
|
||||||
proc GetFilesSubdir {node dir} {
|
|
||||||
global fontNormal tree projDir workDir activeProject imgDir count
|
|
||||||
global backUpFileShow
|
|
||||||
set count 1
|
|
||||||
set rList ""
|
|
||||||
if {[catch {cd $dir}] != 0} {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
foreach file [lsort [glob -nocomplain .*]] {
|
|
||||||
if {$file == "." || $file == ".."} {
|
|
||||||
puts $file
|
|
||||||
} else {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
$tree itemconfigure $node -open 1
|
|
||||||
}
|
|
||||||
## GETTING FILES FROM PROJECT DIR AND INSERT INTO TREE WIDGET ##
|
|
||||||
proc GetFiles {dir project tree} {
|
|
||||||
global fontNormal backUpFileShow imgDir
|
|
||||||
set rList ""
|
|
||||||
set count 1
|
|
||||||
if {[catch {cd $dir}] != 0} {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
foreach file [lsort [glob -nocomplain .*]] {
|
|
||||||
if {$file == "." || $file == ".."} {
|
|
||||||
puts $file
|
|
||||||
} else {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
$tree configure -redraw 1
|
|
||||||
}
|
|
||||||
## GETTING PROJECT NAMES FROM DIR AND PUTS INTO
|
|
||||||
proc GetProj {tree} {
|
|
||||||
global projDir workDir fontNormal imgDir module
|
|
||||||
set rList ""
|
|
||||||
if {[catch {cd $workDir}] != 0} {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
foreach proj [lsort [glob -nocomplain *.proj]] {
|
|
||||||
lappend rList [list [file join $workDir $proj]]
|
|
||||||
set projFile [open [file join $workDir $proj] r]
|
|
||||||
set prjName [file rootname $proj]
|
|
||||||
while {[gets $projFile line]>=0} {
|
|
||||||
scan $line "%s" keyWord
|
|
||||||
set string [string range $line [string first "\"" $line] [string last "\"" $line]]
|
|
||||||
set string [string trim $string "\""]
|
|
||||||
if {$keyWord == "ProjectName"} {
|
|
||||||
regsub -all " " $string "_" project
|
|
||||||
set projName "$string"
|
|
||||||
}
|
|
||||||
if {$keyWord == "ProjectDirName"} {
|
|
||||||
set projList($prjName) [file dirname $string]
|
|
||||||
puts "$projList($prjName) - $string"
|
|
||||||
$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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$tree configure -redraw 1
|
|
||||||
}
|
|
||||||
|
|
||||||
## ABOUT PROGRAMM DIALOG ##
|
## ABOUT PROGRAMM DIALOG ##
|
||||||
proc AboutDialog {} {
|
proc AboutDialog {} {
|
||||||
|
@ -964,12 +627,6 @@ proc SelectDir {dir} {
|
||||||
-parent .]
|
-parent .]
|
||||||
return $dirName
|
return $dirName
|
||||||
}
|
}
|
||||||
## UPDATE TREE ##
|
|
||||||
proc UpdateTree {} {
|
|
||||||
global tree
|
|
||||||
$tree delete [$tree nodes root]
|
|
||||||
GetProj $tree
|
|
||||||
}
|
|
||||||
## TOOLBAR ON/OFF PROCEDURE ##
|
## TOOLBAR ON/OFF PROCEDURE ##
|
||||||
proc ToolBar {} {
|
proc ToolBar {} {
|
||||||
global toolBar
|
global toolBar
|
||||||
|
@ -1088,3 +745,6 @@ proc GetExtention {node} {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,11 @@ proc Settings {} {
|
||||||
} else {
|
} else {
|
||||||
puts $file "set backUpFileDelete \"Yes\""
|
puts $file "set backUpFileDelete \"Yes\""
|
||||||
}
|
}
|
||||||
|
if {$dotFileShow == "false"} {
|
||||||
|
puts $file "set dotFileShow \"No\""
|
||||||
|
} else {
|
||||||
|
puts $file "set dotFileShow \"Yes\""
|
||||||
|
}
|
||||||
puts $file "\n# Don't edit this line"
|
puts $file "\n# Don't edit this line"
|
||||||
puts $file "# Directorys Settings #"
|
puts $file "# Directorys Settings #"
|
||||||
puts $file "set projDir \"[$main.frmProjDir.txtProjDir get]\""
|
puts $file "set projDir \"[$main.frmProjDir.txtProjDir get]\""
|
||||||
|
@ -259,9 +264,16 @@ proc Settings {} {
|
||||||
-font $fontNormal -onvalue true -offvalue false
|
-font $fontNormal -onvalue true -offvalue false
|
||||||
pack $frm_12.lblBackUpDel -side left
|
pack $frm_12.lblBackUpDel -side left
|
||||||
pack $frm_12.chkBackUpDel -side left
|
pack $frm_12.chkBackUpDel -side left
|
||||||
|
set frm_13 [frame $main.frmDotFilesShow -bg $editor(bg)]
|
||||||
|
label $frm_13.lblDotFilesShow -text [::msgcat::mc "Show dot files"]\
|
||||||
|
-width 30 -anchor w -font $fontNormal -fg $editor(fg)
|
||||||
|
checkbutton $frm_13.chkDotFilesShow -text "" -variable showDotFiles \
|
||||||
|
-font $fontNormal -onvalue true -offvalue false
|
||||||
|
pack $frm_13.lblDotFilesShow -side left
|
||||||
|
pack $frm_13.chkDotFilesShow -side left
|
||||||
|
|
||||||
pack $frm_1 $frm_2 $frm_5 $frm_3 $frm_4 $frm_6 $frm_7 \
|
pack $frm_1 $frm_2 $frm_5 $frm_3 $frm_4 $frm_6 $frm_7 \
|
||||||
$frm_8 $frm_9 $frm_10 $frm_11 $frm_12 -side top -fill both -expand true
|
$frm_8 $frm_9 $frm_10 $frm_11 $frm_12 $frm_13 -side top -fill both -expand true
|
||||||
|
|
||||||
#################### EDITOR PREF #########################
|
#################### EDITOR PREF #########################
|
||||||
set editFrm [$nb insert end editor -text "[::msgcat::mc "Editor"]"]
|
set editFrm [$nb insert end editor -text "[::msgcat::mc "Editor"]"]
|
||||||
|
@ -865,3 +877,5 @@ proc SaveSettings {} {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
566
lib/tree.tcl
Normal file
566
lib/tree.tcl
Normal file
|
@ -0,0 +1,566 @@
|
||||||
|
#####################################################
|
||||||
|
# Tcl/Tk Project Manager
|
||||||
|
# Distributed under GNU Public License
|
||||||
|
# Author: Sergey Kalinin s.v.kalinin28@gmail.com
|
||||||
|
# Copyright (c) "https://nuk-svk.ru", 2018
|
||||||
|
# Git repo: https://bitbucket.org/svk28/projman
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# Procedure for operation wwith Tree widget
|
||||||
|
#
|
||||||
|
####################################################
|
||||||
|
namespace eval FileTree {
|
||||||
|
variable count
|
||||||
|
variable dblclick
|
||||||
|
}
|
||||||
|
|
||||||
|
proc FileTree::create {nb} {
|
||||||
|
global editor
|
||||||
|
global treeFiles
|
||||||
|
set frmTreeFiles [ScrolledWindow $nb.frmTreeFiles -bg $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]}
|
||||||
|
|
||||||
|
FileTree::GetAllDirs $treeFiles
|
||||||
|
}
|
||||||
|
|
||||||
|
proc FileTree::init { treeFile } {
|
||||||
|
global tcl_platform
|
||||||
|
variable 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 } {
|
||||||
|
variable 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
|
||||||
|
set rList ""
|
||||||
|
set rootDir $env(HOME)
|
||||||
|
if {[catch {cd $rootDir}] != 0} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
$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] root $treeFiles
|
||||||
|
#set dir $string
|
||||||
|
|
||||||
|
$treeFiles configure -redraw 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## GETTING FILES FROM SUBDIR ##
|
||||||
|
proc GetFilesSubdir {tree node dir} {
|
||||||
|
global fontNormal projDir workDir activeProject imgDir count
|
||||||
|
global backUpFileShow dotFileShow
|
||||||
|
set count 1
|
||||||
|
set rList ""
|
||||||
|
if {[catch {cd $dir}] != 0} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if {$dotFileShow eq "Yes"} {
|
||||||
|
foreach file [lsort [glob -nocomplain .*]] {
|
||||||
|
if {$file == "." || $file == ".."} {
|
||||||
|
puts $file
|
||||||
|
} else {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
$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
|
||||||
|
set rList ""
|
||||||
|
set count 1
|
||||||
|
if {[catch {cd $dir}] != 0} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if {$dotFileShow eq "Yes"} {
|
||||||
|
foreach file [lsort [glob -nocomplain .*]] {
|
||||||
|
if {$file == "." || $file == ".."} {
|
||||||
|
puts $file
|
||||||
|
} else {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
$tree configure -redraw 1
|
||||||
|
}
|
||||||
|
## GETTING PROJECT NAMES FROM DIR AND PUTS INTO
|
||||||
|
proc GetProj {tree} {
|
||||||
|
global projDir workDir fontNormal imgDir module
|
||||||
|
set rList ""
|
||||||
|
if {[catch {cd $workDir}] != 0} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
foreach proj [lsort [glob -nocomplain *.proj]] {
|
||||||
|
lappend rList [list [file join $workDir $proj]]
|
||||||
|
set projFile [open [file join $workDir $proj] r]
|
||||||
|
set prjName [file rootname $proj]
|
||||||
|
while {[gets $projFile line]>=0} {
|
||||||
|
scan $line "%s" keyWord
|
||||||
|
set string [string range $line [string first "\"" $line] [string last "\"" $line]]
|
||||||
|
set string [string trim $string "\""]
|
||||||
|
if {$keyWord == "ProjectName"} {
|
||||||
|
regsub -all " " $string "_" project
|
||||||
|
set projName "$string"
|
||||||
|
}
|
||||||
|
if {$keyWord == "ProjectDirName"} {
|
||||||
|
set projList($prjName) [file dirname $string]
|
||||||
|
puts "$projList($prjName) - $string"
|
||||||
|
$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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tree configure -redraw 1
|
||||||
|
}
|
||||||
|
|
||||||
|
## SHOW PUP-UP MENUS ##
|
||||||
|
proc PopupMenuTree {x y} {
|
||||||
|
global tree fontNormal fontBold imgDir activeProject
|
||||||
|
set node [$tree selection get]
|
||||||
|
if {$node ==""} {
|
||||||
|
set answer [tk_messageBox\
|
||||||
|
-message "[::msgcat::mc "Not found active project"]"\
|
||||||
|
-type ok -icon warning]
|
||||||
|
case $answer {
|
||||||
|
ok {return 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tree selection set $node
|
||||||
|
set item [$tree itemcget $node -data]
|
||||||
|
if {[string range $item 0 2] == "prj"} {
|
||||||
|
set activeProject [string range $item 4 end]
|
||||||
|
.frmStatus.frmActive.lblActive configure -text [$tree itemcget $node -text] -font $fontBold
|
||||||
|
tk_popup .popupProj $x $y
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if {[info exists fileList($node)] != 1} {
|
||||||
|
# set fileList($node) $item
|
||||||
|
tk_popup .popupFile $x $y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## OPEN TREE PROCEDURE
|
||||||
|
proc TreeOpen {node} {
|
||||||
|
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
||||||
|
|
||||||
|
$tree selection set $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
|
||||||
|
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir openfold.gif]]
|
||||||
|
if {[file exists [file join $workDir $activeProject.tags]] == 1} {
|
||||||
|
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
||||||
|
} else {
|
||||||
|
DoModule ctags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {[info exists fileList($node)] != 1} {
|
||||||
|
set fileList($node) $item
|
||||||
|
if {[file isdirectory $item] == 1} {
|
||||||
|
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir openfold.gif]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
## CLOSE TREE PROCEDURE ##
|
||||||
|
proc TreeClose {node} {
|
||||||
|
global fontNormal tree projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
||||||
|
|
||||||
|
$tree selection set $node
|
||||||
|
set item [$tree itemcget $node -data]
|
||||||
|
if {[string range $item 0 2] == "prj"} {
|
||||||
|
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir folder.gif]]
|
||||||
|
}
|
||||||
|
if {[info exists fileList($node)] != 1} {
|
||||||
|
if {[file isdirectory $item] == 1} {
|
||||||
|
$tree itemconfigure $node -image [Bitmap::get [file join $imgDir folder.gif]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
## TREE ONE CLICK PROCEDURE ##
|
||||||
|
proc TreeOneClick {tree node} {
|
||||||
|
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
||||||
|
#puts [$tree selection get]
|
||||||
|
puts [$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} {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if {[file exists $item] == 1} {
|
||||||
|
LabelUpdate .frmStatus.frmHelp.lblHelp [FileAttr $item]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PageRaise $tree $node
|
||||||
|
}
|
||||||
|
if {[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]
|
||||||
|
if {[info exists fileList($parent)] == 0} {
|
||||||
|
EditFile $parent $file
|
||||||
|
}
|
||||||
|
PageRaise $tree $parent
|
||||||
|
$tree selection set $node
|
||||||
|
set text "$noteBook.f$parent.text"
|
||||||
|
set index1 [expr [string first "_" $item]+1]
|
||||||
|
set index2 [expr [string last "_" $item]11]
|
||||||
|
if {$fileExt == "java" || $fileExt == "ja"} {
|
||||||
|
set findString "class [string range $item $index1 $index2] "
|
||||||
|
} elseif {$fileExt == "perl" || $fileExt == "pl"} {
|
||||||
|
set findString "sub [string range $item $index1 $index2]"
|
||||||
|
} elseif {$fileExt == "ml" || $fileExt == "mli"} {
|
||||||
|
set findString "let [string range $item $index1 $index2]"
|
||||||
|
} elseif {$fileExt == "php" || $fileExt == "phtml"} {
|
||||||
|
set findString "function [string range $item $index1 $index2]"
|
||||||
|
puts $findString
|
||||||
|
#return
|
||||||
|
} elseif {$fileExt == "rb"} {
|
||||||
|
set findString "class [string range $item $index1 $index2]"
|
||||||
|
} else {
|
||||||
|
set findString "proc [string range $item $index1 $index2] "
|
||||||
|
}
|
||||||
|
FindProc $text $findString $node
|
||||||
|
focus -force $text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
## TREE DOUBLE CLICK PROCEDURE ##
|
||||||
|
proc TreeDoubleClick {tree node} {
|
||||||
|
global fontNormal projDir workDir activeProject fileList noteBook findString imgDir fontBold
|
||||||
|
$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 {[string range $item 0 2] == "prj"} {
|
||||||
|
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"} {
|
||||||
|
$tree selection set $node
|
||||||
|
set parent [$tree parent $node]
|
||||||
|
if {[info exists fileList($parent)] != 1} {
|
||||||
|
set file [$tree itemcget $parent -data]
|
||||||
|
EditFile $parent $file
|
||||||
|
$noteBook raise $parent
|
||||||
|
} else {
|
||||||
|
$noteBook raise $parent
|
||||||
|
}
|
||||||
|
set text "$noteBook.f$parent.text"
|
||||||
|
set index1 [expr [string first "_" $item]+1]
|
||||||
|
set index2 [expr [string last "_" $item]11]
|
||||||
|
set findString "proc [string range $item $index1 $index2] "
|
||||||
|
FindProc $text $findString $node
|
||||||
|
focus -force $text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## UPDATE TREE ##
|
||||||
|
proc UpdateTree {} {
|
||||||
|
global tree
|
||||||
|
$tree delete [$tree nodes root]
|
||||||
|
GetProj $tree
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
::msgcat::mcset en "File was modifyed. Close?"
|
::msgcat::mcset en "File was modifyed. Close?"
|
||||||
::msgcat::mcset en "File was modifyed. Save?"
|
::msgcat::mcset en "File was modifyed. Save?"
|
||||||
::msgcat::mcset en "File saved"
|
::msgcat::mcset en "File saved"
|
||||||
|
::msgcat::mcset en "Files"
|
||||||
::msgcat::mcset en "Find"
|
::msgcat::mcset en "Find"
|
||||||
::msgcat::mcset en "Font normal"
|
::msgcat::mcset en "Font normal"
|
||||||
::msgcat::mcset en "Font bold"
|
::msgcat::mcset en "Font bold"
|
||||||
|
@ -167,3 +168,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
|
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
|
||||||
::msgcat::mcset ru "Exit" "Выход"
|
::msgcat::mcset ru "Exit" "Выход"
|
||||||
::msgcat::mcset ru "File" "Файл"
|
::msgcat::mcset ru "File" "Файл"
|
||||||
|
::msgcat::mcset ru "Files" "Файлы"
|
||||||
::msgcat::mcset ru "File already exists. Overwrite?" "Файл уже существует. Переписать?"
|
::msgcat::mcset ru "File already exists. Overwrite?" "Файл уже существует. Переписать?"
|
||||||
::msgcat::mcset ru "File was modifyed. Close?" "Файл был изменен. Закрыть?"
|
::msgcat::mcset ru "File was modifyed. Close?" "Файл был изменен. Закрыть?"
|
||||||
::msgcat::mcset ru "File was modifyed. Save?" "Файл был изменен. Сохранить?"
|
::msgcat::mcset ru "File was modifyed. Save?" "Файл был изменен. Сохранить?"
|
||||||
|
@ -172,3 +173,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ set toolBar "Yes"
|
||||||
set backUpFileShow "No"
|
set backUpFileShow "No"
|
||||||
set backUpFileCreate "No"
|
set backUpFileCreate "No"
|
||||||
set backUpFileDelete "No"
|
set backUpFileDelete "No"
|
||||||
|
set dotFileShow "No"
|
||||||
|
|
||||||
# Don't edit this line
|
# Don't edit this line
|
||||||
# Directorys Settings #
|
# Directorys Settings #
|
||||||
|
@ -71,3 +72,5 @@ set color(sixBG) "#ffdbdb"
|
||||||
set color(sql) "#ffff828f0000"
|
set color(sql) "#ffff828f0000"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -120,3 +120,6 @@ option add *Scrollbar.background $editor(bg) startupFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user