diff --git a/lib/editor.tcl b/lib/editor.tcl index d8e3630..2588002 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -1378,6 +1378,7 @@ namespace eval Editor { return } set frmText [Editor::EditorWidget $w $fileType $nb] + # puts "Editor::SplitEditorH: w - $w" $frmText.t insert end [$w.frmText.t get 0.0 end] # $w.panelTxt add $w.frmText -weight 0 @@ -1392,7 +1393,7 @@ namespace eval Editor { global cfgVariables regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName set itemName ".frmWork.nbEditor2.$itemName" - # puts $itemName + puts "Editor::SplitEditoprV: nb item - $itemName" if {[winfo exists $itemName] == 1} { .frmWork.nbEditor2 forget $itemName destroy $itemName diff --git a/lib/files.tcl b/lib/files.tcl index f7de728..b3c2996 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -298,9 +298,13 @@ namespace eval FileOper { } } - proc Close {} { + proc Close {{nbEditorWindow ""}} { global nbEditor modified tree editors - set nbItem [$nbEditor select] + if {$nbEditorWindow eq ""} { + set nbEditorWindow $nbEditor + } + set nbItem [$nbEditorWindow select] + # puts "Procedure FileOper::Close: item - $nbItem" # puts "close tab $nbItem" if {$nbItem == ""} {return} @@ -310,14 +314,14 @@ namespace eval FileOper { -icon question -type yesnocancel \ -detail [::msgcat::mc "Do you want to save it?"]] switch $answer { - yes {Save close} + yes {Save close $nbEditorWindow} no {} cancel {return "cancel"} } } } - if {[$nbEditor select] eq $nbItem} { - $nbEditor forget $nbItem + if {[$nbEditorWindow select] eq $nbItem} { + $nbEditorWindow forget $nbItem destroy $nbItem } set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]" @@ -341,10 +345,11 @@ namespace eval FileOper { .frmStatus.lblPosition configure -text "" .frmStatus.lblEncoding configure -text "" .frmStatus.lblSize configure -text "" - NB::NextTab $nbEditor 0 + + NB::NextTab $nbEditorWindow 0 } - proc Save {{type ""}} { + proc Save {{type ""} {nbEditorWindow ""}} { global nbEditor tree env activeProject dir if [info exists activeProject] { @@ -353,8 +358,15 @@ namespace eval FileOper { set dirProject $env(HOME) } - set nbEditorItem [$nbEditor select] - # puts "Saved editor text: $nbEditorItem" + if {$nbEditorWindow eq ""} { + set nbEditorWindow $nbEditor + set str [split [focus] "."] + set nbEditorWindow "[lindex $str 0].[lindex $str 1].[lindex $str 2]" + # puts "FileOper::Save: current window $nbEditorWindow" + } + # puts "FileOper::Save: $nbEditorWindow" + set nbEditorItem [$nbEditorWindow select] + puts "Saved editor text: $nbEditorItem" if [string match "*untitled*" $nbEditorItem] { set filePath [tk_getSaveFile -initialdir $dirProject -filetypes $::types -parent .] if {$filePath eq ""} { @@ -362,7 +374,7 @@ namespace eval FileOper { } # set fileName [string range $filePath [expr [string last "/" $filePath]+1] end] set fileName [file tail $filePath] - $nbEditor tab $nbEditorItem -text $fileName + $nbEditorWindow tab $nbEditorItem -text $fileName # set treeitem [Tree::InsertItem $tree {} $filePath "file" $fileName] set lblName "lbl[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end]" $nbEditorItem.header.$lblName configure -text $filePath @@ -375,7 +387,7 @@ namespace eval FileOper { puts -nonewline $f $editedText # puts "$f was saved" close $f - ResetModifiedFlag $nbEditorItem $nbEditor + ResetModifiedFlag $nbEditorItem $nbEditorWindow if {[file tail $filePath] eq "projman.ini"} { Config::read $dir(cfg) } diff --git a/lib/notebook.tcl b/lib/notebook.tcl index 3c9f9e6..3df850b 100644 --- a/lib/notebook.tcl +++ b/lib/notebook.tcl @@ -51,7 +51,8 @@ namespace eval NB { return } if {[$w identify $x $y] == "close_button"} { - FileOper::Close + # puts "NB::PressTab: w - $w" + FileOper::Close $w } else { set txt [$w select].frmText.t if [winfo exists $txt] { @@ -63,7 +64,12 @@ namespace eval NB { proc NextTab {w step} { global tree set i [expr [$w index end] - 1] + # puts "NB::NextTab $w" if {[$w select] eq ""} { + # puts "NB::NextTab no items availabels" + if {$w eq ".frmWork.nbEditor2"} { + .frmWork.panelNB forget .frmWork.nbEditor2 + } return } set nbItemIndex [$w index [$w select]] @@ -75,7 +81,6 @@ namespace eval NB { $w select [expr $nbItemIndex + $step] } set nbItem [string trimleft [$w select] "$w."] - # puts $nbItem append treeItemName "file" "::" $nbItem Tree::SelectItem $treeItemName diff --git a/projman.tcl b/projman.tcl index e96f583..eb73e3d 100755 --- a/projman.tcl +++ b/projman.tcl @@ -9,7 +9,7 @@ exec wish8.6 "$0" -- "$@" # Home page: https://nuk-svk.ru ###################################################### # Version: 2.0.0 -# Release: alpha21 +# Release: alpha22 # Build: 03122025180445 ######################################################