Реализован двухпанельный режим работы (вертиикальное разделение)
This commit is contained in:
parent
47f6cc436a
commit
3b52b9af34
|
@ -729,7 +729,7 @@ namespace eval Editor {
|
||||||
$txt tag remove sel {insert linestart} {insert lineend + 1char}
|
$txt tag remove sel {insert linestart} {insert lineend + 1char}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
proc BindKeys {w txt fileType} {
|
proc BindKeys {w txt fileType nb} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
# variable txt
|
# variable txt
|
||||||
# set txt $w.frmText.t
|
# set txt $w.frmText.t
|
||||||
|
@ -747,7 +747,7 @@ namespace eval Editor {
|
||||||
bind $txt <Insert> {OverWrite}
|
bind $txt <Insert> {OverWrite}
|
||||||
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
||||||
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
||||||
bind $txt <<Modified>> "SetModifiedFlag $w"
|
bind $txt <<Modified>> "SetModifiedFlag $w $nb"
|
||||||
bind $txt <Control-i> ImageBase64Encode
|
bind $txt <Control-i> ImageBase64Encode
|
||||||
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
||||||
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
||||||
|
@ -1272,7 +1272,7 @@ namespace eval Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horizontal split the Editor text widget
|
# Horizontal split the Editor text widget
|
||||||
proc SplitEditorH {w fileType} {
|
proc SplitEditorH {w fileType nb} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
puts [$w.panelTxt panes]
|
puts [$w.panelTxt panes]
|
||||||
if [winfo exists $w.frmText2] {
|
if [winfo exists $w.frmText2] {
|
||||||
|
@ -1281,7 +1281,7 @@ namespace eval Editor {
|
||||||
focus -force $w.frmText.t.t
|
focus -force $w.frmText.t.t
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set frmText [Editor::EditorWidget $w $fileType]
|
set frmText [Editor::EditorWidget $w $fileType $nb]
|
||||||
$frmText.t insert end [$w.frmText.t get 0.0 end]
|
$frmText.t insert end [$w.frmText.t get 0.0 end]
|
||||||
|
|
||||||
# $w.panelTxt add $w.frmText -weight 0
|
# $w.panelTxt add $w.frmText -weight 0
|
||||||
|
@ -1291,25 +1291,34 @@ namespace eval Editor {
|
||||||
ReadStructure $frmText.t ""
|
ReadStructure $frmText.t ""
|
||||||
focus -force $frmText.t.t
|
focus -force $frmText.t.t
|
||||||
}
|
}
|
||||||
|
|
||||||
proc SplitEditorV {w fileType} {
|
proc SplitEditorV {fileFullPath} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
.frmBody.panel add $frmTree -weight 0
|
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
|
||||||
|
set itemName ".frmWork.nbEditor2.$itemName"
|
||||||
puts [$w.panelTxt panes]
|
# puts $itemName
|
||||||
if [winfo exists $w.frmText2] {
|
if {[winfo exists $itemName] == 1} {
|
||||||
$w.panelTxt forget $w.frmText2
|
.frmWork.nbEditor2 forget $itemName
|
||||||
destroy $w.frmText2
|
destroy $itemName
|
||||||
|
if {[llength [.frmWork.nbEditor2 tabs]] == 0} {
|
||||||
|
if [lsearch -exact [.frmWork.panelNB panes] .frmWork.nbEditor2] {
|
||||||
|
grid forget .frmWork.nbEditor2
|
||||||
|
.frmWork.panelNB forget .frmWork.nbEditor2
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set frmText [Editor::EditorWidget $w $fileType]
|
pack .frmWork.nbEditor2 -side left -fill both -expand true
|
||||||
$frmText.t insert end [$w.frmText.t get 0.0 end]
|
pack propagate .frmWork.nbEditor2 false
|
||||||
|
# grid .frmWork.nbEditor2 -row 0 -column 1 -sticky nsew
|
||||||
|
# grid columnconfigure .frmWork .frmWork.nbEditor -weight 1
|
||||||
|
# grid rowconfigure .frmWork .frmWork.nbEditor -weight 1
|
||||||
|
# grid columnconfigure .frmWork .frmWork.nbEditor2 -weight 1
|
||||||
|
# grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1
|
||||||
|
.frmWork.panelNB add .frmWork.nbEditor2 -weight 0
|
||||||
|
puts [FileOper::Edit $fileFullPath .frmWork.nbEditor2]
|
||||||
|
|
||||||
|
|
||||||
# $w.panelTxt add $w.frmText -weight 0
|
|
||||||
$w.panelTxt add $frmText -weight 1
|
|
||||||
|
|
||||||
$frmText.t see [$w.frmText.t index insert]
|
|
||||||
# $frmText.t mark set insert [$w.frmText.t index insert]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc GoToLineNumber {text lineNumber} {
|
proc GoToLineNumber {text lineNumber} {
|
||||||
|
@ -1369,7 +1378,7 @@ namespace eval Editor {
|
||||||
focus $win.ent
|
focus $win.ent
|
||||||
}
|
}
|
||||||
|
|
||||||
proc EditorWidget {fr fileType} {
|
proc EditorWidget {fr fileType nb} {
|
||||||
global cfgVariables editors
|
global cfgVariables editors
|
||||||
|
|
||||||
if [winfo exists $fr.frmText] {
|
if [winfo exists $fr.frmText] {
|
||||||
|
@ -1416,7 +1425,7 @@ namespace eval Editor {
|
||||||
} else {
|
} else {
|
||||||
Highlight::Default $txt
|
Highlight::Default $txt
|
||||||
}
|
}
|
||||||
BindKeys $fr $txt $fileType
|
BindKeys $fr $txt $fileType $nb
|
||||||
return $frmText
|
return $frmText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,9 +1460,9 @@ namespace eval Editor {
|
||||||
set btnSplitV "btnSplitV[string range $itemName [expr [string last "." $itemName] +1] end]"
|
set btnSplitV "btnSplitV[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||||
set btnSplitH "btnSplitH[string range $itemName [expr [string last "." $itemName] +1] end]"
|
set btnSplitH "btnSplitH[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||||
ttk::button $fr.header.$btnSplitH -image split_horizontal_11x11 \
|
ttk::button $fr.header.$btnSplitH -image split_horizontal_11x11 \
|
||||||
-command "Editor::SplitEditorH $fr $fileType"
|
-command "Editor::SplitEditorH $fr $fileType $nb"
|
||||||
ttk::button $fr.header.$btnSplitV -image split_vertical_11x11 \
|
ttk::button $fr.header.$btnSplitV -image split_vertical_11x11 \
|
||||||
-command "Editor::SplitEditorV $fr $fileType" -state disable
|
-command "Editor::SplitEditorV $fileFullPath"
|
||||||
# pack $fr.$btnSplitH $fr.$btnSplitV -side right -anchor e
|
# pack $fr.$btnSplitH $fr.$btnSplitV -side right -anchor e
|
||||||
pack $fr.header.$lblName -side left -expand true -fill x
|
pack $fr.header.$lblName -side left -expand true -fill x
|
||||||
pack $fr.header.$btnSplitV $fr.header.$btnSplitH -side right
|
pack $fr.header.$btnSplitV $fr.header.$btnSplitH -side right
|
||||||
|
@ -1467,7 +1476,7 @@ namespace eval Editor {
|
||||||
if {[lsearch -exact $imageType $fileType] != -1} {
|
if {[lsearch -exact $imageType $fileType] != -1} {
|
||||||
ImageViewer $fileFullPath $itemName $fr
|
ImageViewer $fileFullPath $itemName $fr
|
||||||
} else {
|
} else {
|
||||||
set frmText [Editor::EditorWidget $fr $fileType]
|
set frmText [Editor::EditorWidget $fr $fileType $nb]
|
||||||
}
|
}
|
||||||
$fr.panelTxt add $frmText -weight 0
|
$fr.panelTxt add $frmText -weight 0
|
||||||
|
|
||||||
|
|
|
@ -195,9 +195,15 @@ namespace eval FileOper {
|
||||||
|
|
||||||
proc CloseAll {} {
|
proc CloseAll {} {
|
||||||
global nbEditor modified
|
global nbEditor modified
|
||||||
|
foreach nb2Item [.frmWork.nbEditor2 tabs] {
|
||||||
|
.frmWork.nbEditor2 forget $nb2Item
|
||||||
|
}
|
||||||
|
if {[lsearch -exact [.frmWork.panelNB panes] .frmWork.nbEditor2] != -1} {
|
||||||
|
.frmWork.panelNB forget .frmWork.nbEditor2
|
||||||
|
}
|
||||||
foreach nbItem [array names modified] {
|
foreach nbItem [array names modified] {
|
||||||
if {$modified($nbItem) eq "true"} {
|
if {[info exists modified($nbItem)] == 1 && $modified($nbItem) eq "true"} {
|
||||||
$nbEditor select $nbItem
|
catch {$nbEditor select $nbItem}
|
||||||
# puts "close tab $nbItem"
|
# puts "close tab $nbItem"
|
||||||
if {[Close] eq "cancel"} {return "cancel"}
|
if {[Close] eq "cancel"} {return "cancel"}
|
||||||
}
|
}
|
||||||
|
@ -277,7 +283,7 @@ namespace eval FileOper {
|
||||||
puts -nonewline $f $editedText
|
puts -nonewline $f $editedText
|
||||||
puts "$f was saved"
|
puts "$f was saved"
|
||||||
close $f
|
close $f
|
||||||
ResetModifiedFlag $nbEditorItem
|
ResetModifiedFlag $nbEditorItem $nbEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
proc SaveAll {} {
|
proc SaveAll {} {
|
||||||
|
@ -381,8 +387,8 @@ namespace eval FileOper {
|
||||||
$txt see 1.0
|
$txt see 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Edit {fileFullPath} {
|
proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} {
|
||||||
global nbEditor tree
|
global tree
|
||||||
if {[file exists $fileFullPath] == 0} {
|
if {[file exists $fileFullPath] == 0} {
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
|
@ -414,7 +420,7 @@ namespace eval FileOper {
|
||||||
Editor::Editor $fileFullPath $nbEditor $itemName
|
Editor::Editor $fileFullPath $nbEditor $itemName
|
||||||
ReadFile $fileFullPath $itemName
|
ReadFile $fileFullPath $itemName
|
||||||
$itemName.frmText.t highlight 1.0 end
|
$itemName.frmText.t highlight 1.0 end
|
||||||
ResetModifiedFlag $itemName
|
ResetModifiedFlag $itemName $nbEditor
|
||||||
$itemName.frmText.t see 1.1
|
$itemName.frmText.t see 1.1
|
||||||
}
|
}
|
||||||
$nbEditor select $itemName
|
$nbEditor select $itemName
|
||||||
|
|
11
lib/gui.tcl
11
lib/gui.tcl
|
@ -168,10 +168,19 @@ grid rowconfigure $frmTree 0 -weight 1
|
||||||
|
|
||||||
set frmWork [ttk::frame .frmWork -border 0 -relief flat]
|
set frmWork [ttk::frame .frmWork -border 0 -relief flat]
|
||||||
|
|
||||||
|
ttk::panedwindow $frmWork.panelNB -orient horizontal -style TPanedwindow
|
||||||
|
# grid $frmWork.panelNB -row 0 -column 0 -sticky nesw
|
||||||
|
pack $frmWork.panelNB -side left -fill both -expand true
|
||||||
|
|
||||||
set nbEditor [ttk::notebook $frmWork.nbEditor]
|
set nbEditor [ttk::notebook $frmWork.nbEditor]
|
||||||
pack $nbEditor -side left -fill both -expand true
|
pack $nbEditor -side left -fill both -expand true
|
||||||
|
# grid $nbEditor -row 0 -column 0 -sticky nsew
|
||||||
|
# grid columnconfigure $frmWork $nbEditor -weight 1
|
||||||
|
# grid rowconfigure $frmWork $nbEditor -weight 1
|
||||||
|
|
||||||
# set nbEditor2 [ttk::notebook $frmWork.nbEditor2]
|
set nbEditor2 [ttk::notebook $frmWork.nbEditor2]
|
||||||
|
|
||||||
|
$frmWork.panelNB add $nbEditor -weight 10
|
||||||
# pack $nbEditor2 -side left -fill both -expand true
|
# pack $nbEditor2 -side left -fill both -expand true
|
||||||
#
|
#
|
||||||
# Create an image CLOSE for tab
|
# Create an image CLOSE for tab
|
||||||
|
|
|
@ -187,16 +187,16 @@ proc YScrollCommand {txt canv} {
|
||||||
$canv yview"
|
$canv yview"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc ResetModifiedFlag {w} {
|
proc ResetModifiedFlag {w nbEditor} {
|
||||||
global modified nbEditor
|
global modified
|
||||||
$w.frmText.t edit modified false
|
$w.frmText.t edit modified false
|
||||||
set modified($w) "false"
|
set modified($w) "false"
|
||||||
set lbl [string trimleft [$nbEditor tab $w -text] "* "]
|
set lbl [string trimleft [$nbEditor tab $w -text] "* "]
|
||||||
# puts "ResetModifiedFlag: $lbl"
|
# puts "ResetModifiedFlag: $lbl"
|
||||||
$nbEditor tab $w -text $lbl
|
$nbEditor tab $w -text $lbl
|
||||||
}
|
}
|
||||||
proc SetModifiedFlag {w} {
|
proc SetModifiedFlag {w nbEditor} {
|
||||||
global modified nbEditor
|
global modified
|
||||||
#$w.frmText.t edit modified false
|
#$w.frmText.t edit modified false
|
||||||
set modified($w) "true"
|
set modified($w) "true"
|
||||||
set lbl [$nbEditor tab $w -text]
|
set lbl [$nbEditor tab $w -text]
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace eval Tree {
|
||||||
# $tree item $id -open false
|
# $tree item $id -open false
|
||||||
}
|
}
|
||||||
file {
|
file {
|
||||||
set v [FileOper::Edit $values]
|
set v [FileOper::Edit $values $nbEditor]
|
||||||
if {$v eq false} {
|
if {$v eq false} {
|
||||||
$tree delete $id
|
$tree delete $id
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ namespace eval Tree {
|
||||||
}
|
}
|
||||||
I[0-9]*? {
|
I[0-9]*? {
|
||||||
destroy .findVariables
|
destroy .findVariables
|
||||||
FileOper::Edit [lindex $values 2]
|
FileOper::Edit [lindex $values 2] $nbEditor
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
set parentItem [$tree parent $id]
|
set parentItem [$tree parent $id]
|
||||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
||||||
######################################################
|
######################################################
|
||||||
# Version: 2.0.0
|
# Version: 2.0.0
|
||||||
# Release: alpha
|
# Release: alpha
|
||||||
# Build: 28112022163633
|
# Build: 01122022113755
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# определим текущую версию, релиз и т.д.
|
# определим текущую версию, релиз и т.д.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user