Fixed AutoComplite precedure for TCL/TK-projects

Added colored icon for main window
Fixed "Close all" procedure if opened files from projects and file browser
This commit is contained in:
Sergey Kalinin
2018-02-15 16:00:22 +03:00
parent 91fa85203b
commit b3da4421d8
10 changed files with 182 additions and 207 deletions

View File

@@ -36,13 +36,13 @@ proc auto_completition { widget } {
## by BanZaj ##
proc auto_completition_proc { widget } {
global procList activeProject noteBook varList
global procList activeProject noteBook varList wishOpList
set nodeEdit [$noteBook raise]
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "about" || $nodeEdit == "debug"} {
return
}
#puts $procList()
set start_word [$widget get "insert - 1 chars wordstart" insert]
set start_word [string tolower [$widget get "insert - 1 chars wordstart" insert]]
set box [$widget bbox insert]
set box_x [expr [lindex $box 0] + [winfo rootx $widget] ]
set box_y [expr [lindex $box 1] + [winfo rooty $widget] + [lindex $box 3] ]
@@ -55,23 +55,28 @@ proc auto_completition_proc { widget } {
#puts $word
#set list_word($start_word) 1
#puts $varList($activeProject)
puts $procList($activeProject)
if {[string index $start_word 0] == "\$"} {
set workList $varList($activeProject)
} else {
#puts $procList($activeProject)
#puts [lindex $wishOpList 0]
if {[info exists procList($activeProject)]} {
set workList $procList($activeProject)
if [info exists workList] {
set len [llength $workList]
set i 0
while {$len >=$i} {
set line [lindex $workList $i]
scan $line "%s" word
if {[string match "$start_word*" [string tolower $word]]} {
set list_word($word) $i
}
incr i
}
}
}
if [info exists workList] {
set len [llength $workList]
} else {
return
}
set i 0
while {$len >=$i} {
set line [lindex $ $i]
scan $line "%s" word
if {[string match "$start_word*" $word]} {
while {$i <= [llength $wishOpList]} {
set word [lindex $wishOpList $i]
if {[string match "$start_word*" [string tolower $word]]} {
set list_word($word) $i
}
incr i
@@ -176,6 +181,9 @@ proc auto_completition_key { widget K A } {

View File

@@ -366,7 +366,8 @@ proc Replace {text incr} {
}
## FILE OPERATION ##
proc FileDialog {tree operation} {
global noteBook fontNormal fontBold fileList noteBook projDir activeProject imgDir editor
global noteBook noteBookFiles fontNormal fontBold
global fileList projDir activeProject imgDir editor
set dot "_"
set types {
{"Tcl files" {.tcl}}
@@ -565,6 +566,8 @@ proc FileDialog {tree operation} {
} else {
focus -force $noteBook.f$node
}
set tree [GetTreeForNode $node]
focus $tree
$tree selection set $node
} else {
LabelUpdate .frmStatus.frmLine.lblLine ""
@@ -577,6 +580,12 @@ proc FileDialog {tree operation} {
$noteBook raise [$noteBook page 0]
set nbNode [$noteBook raise]
set tree [GetTreeForNode $nbNode]
if {$tree eq ".frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles"} {
$noteBookFiles raise files
} elseif {$tree eq ".frmBody.frmCat.noteBook.fprojects.frmTree.tree"} {
$noteBookFiles raise projects
}
while {$nbNode != ""} {
if {$nbNode == "newproj" || $nbNode == "settings" || $nbNode == "about" || $nbNode == "debug"} {
$noteBook delete $nbNode
@@ -600,6 +609,7 @@ proc FileDialog {tree operation} {
cancel {return cancel}
}
}
set tree [GetTreeForNode $nbNode]
set nl [$tree nodes $nbNode 0 end]
if {$nl != ""} {
foreach n $nl {
@@ -729,15 +739,17 @@ proc _PageTab {} {
}
## RAISED NOTEBOOK TAB IF CLICK MOUSE BUTTON ##
proc PageRaise {tree node} {
global noteBook fileList editor nodeEdit
global noteBook fileList editor nodeEdit noteBookFiles
#puts $node
$noteBook raise $node
set tree [GetTreeForNode $node]
if {$tree eq ".frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles"} {
$noteBookFiles raise files
} elseif {$tree eq ".frmBody.frmCat.noteBook.fprojects.frmTree.tree"} {
$noteBookFiles raise projects
}
set nodeEdit [$noteBook raise]
#set nodeEdit $node
puts $node
puts $nodeEdit
if {$node == "newproj" || $node == "settings" || $node == "about" || $node == "debug"} {
return
} else {
@@ -937,7 +949,7 @@ proc EditFile {tree node fileName} {
###################
if {[regexp -nocase -all -line -- {proc (.*) \{(.*)\}} $line match procName params]} {
set procList($activeProject) [list $procName [string trim $params]]
lappend procList($activeProject) [list $procName [string trim $params]]
puts "proc $procName $params"
}
if {[regexp -nocase -all -line -- {set (\w+)} $line match varName]} {
@@ -1004,10 +1016,12 @@ proc EditFile {tree node fileName} {
bind $text <Control-igrave> "tk_textPaste $w.text;break"
bind $text <Control-v> {TextOperation paste; break}
bind $text <Control-adiaeresis> "auto_completition $text"
bind $text <Control-l> "auto_completition $text"
#bind $text <Control-adiaeresis> "auto_completition $text"
#bind $text <Control-l> "auto_completition $text"
bind $text <Control-icircumflex> "auto_completition_proc $text"
bind $text <Control-j> "auto_completition_proc $text"
#bind $text <Control-Tab> "auto_completition_proc $text"
bind $text <Control-q> Find
bind $text <Control-comma> {TextOperation comment}
bind $text <Control-period> {TextOperation uncomment}
@@ -1256,6 +1270,13 @@ GetOp

View File

@@ -16,6 +16,8 @@ if {[info exists topLevelGeometry]} {
wm title . "Tcl/Tk Project Manager $ver"
wm iconname . "Tcl/Tk Project Manager $ver"
image create photo icon -format png -file [file join $imgDir icons large projman.png]
wm iconphoto . icon
wm protocol . WM_DELETE_WINDOW Quit
wm overrideredirect . 0
wm positionfrom . user
@@ -393,14 +395,3 @@ $tree configure -redraw 1
set activeProject ""
focus -force $tree

View File

@@ -99,3 +99,4 @@ namespace eval pane {

View File

@@ -906,3 +906,4 @@ proc InsertTitle {newFile type} {

View File

@@ -565,3 +565,4 @@ proc GetTreeForNode {node} {
}