2022-07-21 10:56:46 +03:00
|
|
|
######################################################
|
|
|
|
# ProjMan 2
|
|
|
|
# Distributed under GNU Public License
|
|
|
|
# Author: Sergey Kalinin svk@nuk-svk.ru
|
|
|
|
# Copyright (c) "", 2022, https://nuk-svk.ru
|
|
|
|
######################################################
|
|
|
|
#
|
|
|
|
# Operation with NoteBook widget module
|
|
|
|
#
|
|
|
|
######################################################
|
|
|
|
|
|
|
|
namespace eval NB {
|
|
|
|
proc InsertItem {nb item type} {
|
|
|
|
switch $type {
|
|
|
|
file {
|
|
|
|
regsub -all {\.|/|\\|\s} $item "_" itemName
|
|
|
|
if [winfo exists $nb.$itemName] {
|
|
|
|
set fm $nb.$itemName
|
|
|
|
} else {
|
|
|
|
set fm [ttk::frame $nb.$itemName]
|
|
|
|
pack $fm -side top -expand true -fill both
|
|
|
|
$nb add $fm -text [file tail $item];# -image close_12x12 -compound right
|
|
|
|
$nb select $fm
|
|
|
|
}
|
|
|
|
}
|
2022-10-17 16:55:22 +03:00
|
|
|
git {
|
2022-10-19 09:05:55 +03:00
|
|
|
if [winfo exists $nb.$item] {
|
|
|
|
return $nb.$item
|
|
|
|
}
|
2022-10-17 16:55:22 +03:00
|
|
|
set fm [ttk::frame $nb.$item]
|
|
|
|
pack $fm -side top -expand true -fill both
|
|
|
|
$nb add $fm -text Git;# -image close_12x12 -compound right
|
|
|
|
$nb select $fm
|
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
}
|
2022-08-30 16:44:28 +03:00
|
|
|
# puts "NB item - $fm"
|
2022-07-21 10:56:46 +03:00
|
|
|
return $fm
|
|
|
|
}
|
2022-07-27 16:55:04 +03:00
|
|
|
|
2022-08-30 16:44:28 +03:00
|
|
|
proc PressTab {w x y} {
|
2022-09-16 16:26:52 +03:00
|
|
|
if {[$w identify tab $x $y] ne ""} {
|
|
|
|
$w select [$w identify tab $x $y]
|
|
|
|
} else {
|
|
|
|
return
|
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
if {[$w identify $x $y] == "close_button"} {
|
|
|
|
FileOper::Close
|
2022-08-30 16:44:28 +03:00
|
|
|
} else {
|
|
|
|
set txt [$w select].frmText.t
|
2022-10-19 09:05:55 +03:00
|
|
|
if [winfo exists $txt] {
|
|
|
|
focus -force $txt.t
|
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
}
|
|
|
|
}
|
2022-08-30 16:44:28 +03:00
|
|
|
|
|
|
|
proc NextTab {w step} {
|
|
|
|
set i [expr [$w index end] - 1]
|
|
|
|
set nbItemIndex [$w index [$w select]]
|
|
|
|
if {$nbItemIndex eq 0 && $step eq "-1"} {
|
|
|
|
$w select $i
|
|
|
|
} elseif {$nbItemIndex eq $i && $step eq "1"} {
|
|
|
|
$w select 0
|
|
|
|
} else {
|
|
|
|
$w select [expr $nbItemIndex + $step]
|
|
|
|
}
|
|
|
|
set txt [$w select].frmText.t
|
|
|
|
focus -force $txt.t
|
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
}
|