From eb2cbf99c68fbef86b097739df0d9b5abbb9ded8 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Wed, 23 Nov 2022 11:14:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B8=D0=B5=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B?= =?UTF-8?q?=D1=82=D0=BE=D0=B3=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B5?= =?UTF-8?q?=20=D0=B8=20=D0=B2=D1=8B=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=8D=D1=82=D0=BE=D0=B3=D0=BE=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=B2=20=D0=B4=D0=B5=D1=80=D0=B5=D0=B2=D0=B5,?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B2=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BE=D0=BA=20=D0=B2=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/files.tcl | 4 ++++ lib/notebook.tcl | 15 ++++++++++++++- lib/tree.tcl | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/files.tcl b/lib/files.tcl index 8d1d27b..23b58ea 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -398,6 +398,10 @@ namespace eval FileOper { regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName set itemName "$nbEditor.$itemName" set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName] + + # переместим указатель на нужный файл в дереве + Tree::SelectItem $treeItemName + if {[winfo exists $itemName] == 0} { NB::InsertItem $nbEditor $fileFullPath "file" Editor::Editor $fileFullPath $nbEditor $itemName diff --git a/lib/notebook.tcl b/lib/notebook.tcl index bacfbd5..338d4fb 100644 --- a/lib/notebook.tcl +++ b/lib/notebook.tcl @@ -38,8 +38,13 @@ namespace eval NB { } proc PressTab {w x y} { + global tree if {[$w identify tab $x $y] ne ""} { $w select [$w identify tab $x $y] + set nbItem [string trimleft [$w select] "$w."] + # puts $nbItem + append treeItemName "file" "::" $nbItem + Tree::SelectItem $treeItemName } else { return } @@ -54,6 +59,7 @@ namespace eval NB { } proc NextTab {w step} { + global tree set i [expr [$w index end] - 1] set nbItemIndex [$w index [$w select]] if {$nbItemIndex eq 0 && $step eq "-1"} { @@ -63,7 +69,14 @@ namespace eval NB { } else { $w select [expr $nbItemIndex + $step] } + set nbItem [string trimleft [$w select] "$w."] + # puts $nbItem + append treeItemName "file" "::" $nbItem + Tree::SelectItem $treeItemName + set txt [$w select].frmText.t - focus -force $txt.t + if [winfo exists $txt] { + focus -force $txt.t + } } } diff --git a/lib/tree.tcl b/lib/tree.tcl index 5d378e6..2cf7fe8 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -136,4 +136,12 @@ namespace eval Tree { return [$tree item $item -values] } } + + proc SelectItem {treeItemName} { + global tree + if [$tree exists $treeItemName] { + $tree see $treeItemName + $tree selection set $treeItemName + } + } }