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
|
|
|
|
|
######################################################
|
|
|
|
|
# GUI module
|
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
|
|
if {[info exists cfgVariables(geometry)]} {
|
|
|
|
|
wm geometry . $cfgVariables(geometry)
|
|
|
|
|
} else {
|
|
|
|
|
wm geometry . 1024x768
|
|
|
|
|
}
|
|
|
|
|
# Заголовок окна
|
2022-08-12 15:19:57 +03:00
|
|
|
|
wm title . "ProjMan \($projman(Version)-$projman(Release)\)"
|
2022-07-21 10:56:46 +03:00
|
|
|
|
wm iconname . "ProjMan"
|
|
|
|
|
# иконка окна (берется из файла lib/imges.tcl)
|
|
|
|
|
wm iconphoto . projman
|
|
|
|
|
wm protocol . WM_DELETE_WINDOW Quit
|
|
|
|
|
wm overrideredirect . 0
|
|
|
|
|
#wm positionfrom . user
|
|
|
|
|
|
|
|
|
|
bind . <Control-q> Quit
|
|
|
|
|
bind . <Control-Q> Quit
|
|
|
|
|
bind . <Control-eacute> Quit
|
|
|
|
|
bind . <Insert> Add
|
|
|
|
|
bind . <Delete> Del
|
|
|
|
|
bind . <Control-Return> Edit
|
|
|
|
|
bind . <F1> ShowHelpDialog
|
|
|
|
|
bind . <Control-n> Editor::New
|
|
|
|
|
bind . <Control-N> Editor::New
|
|
|
|
|
bind . <Control-o> {
|
|
|
|
|
set filePath [FileOper::OpenDialog]
|
|
|
|
|
if {$filePath != ""} {
|
|
|
|
|
FileOper::Edit $filePath
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bind . <Control-O> {
|
|
|
|
|
set filePath [FileOper::OpenDialog]
|
|
|
|
|
if {$filePath != ""} {
|
|
|
|
|
FileOper::Edit $filePath
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bind . <Control-k> {
|
|
|
|
|
set folderPath [FileOper::OpenFolderDialog]
|
|
|
|
|
if {$folderPath != ""} {
|
|
|
|
|
FileOper::ReadFolder $folderPath
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bind . <Control-K> {
|
|
|
|
|
set folderPath [FileOper::OpenFolderDialog]
|
|
|
|
|
if {$folderPath != ""} {
|
|
|
|
|
FileOper::ReadFolder $folderPath
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bind . <Control-s> {FileOper::Save}
|
|
|
|
|
bind . <Control-S> {FileOper::Save}
|
2022-11-18 16:44:55 +03:00
|
|
|
|
bind . <Alt-p> {ViewFilesTree true}
|
|
|
|
|
bind . <Button-3> {catch [PopupMenu %X %Y]}
|
2022-08-30 16:44:28 +03:00
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
|
#ttk::style configure TPanedwindow -background blue
|
|
|
|
|
#ttk::style configure Sash -sashthickness 5
|
|
|
|
|
#ttk::style configure TButton -padding 60 -relief flat -bg black
|
|
|
|
|
#ttk::style configure Custom.Treeview -foreground red
|
|
|
|
|
#ttk::style configure Custom.Treeview -rowheight 20
|
|
|
|
|
|
|
|
|
|
if [info exists cfgVariables(theme)] {
|
|
|
|
|
ttk::style theme use $cfgVariables(theme)
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-17 20:50:58 +03:00
|
|
|
|
ttk::frame .frmMenu -border 0 -relief raised
|
2022-11-14 15:12:11 +03:00
|
|
|
|
ttk::frame .frmBody -border 0 -relief raised
|
2022-11-18 16:44:55 +03:00
|
|
|
|
ttk::frame .frmStatus -border 0 -relief raised
|
|
|
|
|
|
|
|
|
|
if {$cfgVariables(menuShow) eq "true"} {
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack -side top -padx 1 -fill x
|
|
|
|
|
grid .frmMenu -row 0 -column 0 -sticky new
|
2022-11-18 16:44:55 +03:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack .frmBody -side top -padx 1 -fill both -expand true
|
|
|
|
|
grid .frmBody -row 1 -column 0 -sticky nsew
|
2022-11-18 16:44:55 +03:00
|
|
|
|
|
|
|
|
|
if {$cfgVariables(statusBarShow) eq "true"} {
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack .frmStatus -side top -padx 1 -fill x
|
|
|
|
|
grid .frmStatus -row 2 -column 0 -sticky sew
|
2022-11-18 16:44:55 +03:00
|
|
|
|
}
|
2022-11-22 14:55:24 +03:00
|
|
|
|
grid columnconfigure . .frmBody -weight 1
|
|
|
|
|
grid rowconfigure . .frmBody -weight 1
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
# pack .panel -expand true -fill both
|
|
|
|
|
# pack propagate .panel false
|
|
|
|
|
#pack [label .frmMenu.lbl -text "ddd"]
|
2022-11-10 14:53:58 +03:00
|
|
|
|
|
2022-10-19 09:05:55 +03:00
|
|
|
|
pack [ttk::label .frmStatus.lblGitLogo -justify left] -side left
|
2022-11-10 15:36:34 +03:00
|
|
|
|
pack [ttk::label .frmStatus.lblGit] -side left -expand true -fill x
|
2022-10-21 14:01:53 +03:00
|
|
|
|
bind .frmStatus.lblGit <Button-1><ButtonRelease-1> {
|
|
|
|
|
Git::BranchDialog %X %Y
|
|
|
|
|
}
|
2022-11-10 15:58:27 +03:00
|
|
|
|
pack [ttk::label .frmStatus.lblPosition -justify right] -side left -expand true -fill x
|
|
|
|
|
pack [ttk::label .frmStatus.lblSize -justify center] -side right -fill x
|
|
|
|
|
pack [ttk::label .frmStatus.lblEncoding -justify center] -side right -fill x
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-08-17 16:52:22 +03:00
|
|
|
|
ttk::menubutton .frmMenu.mnuFile -text [::msgcat::mc "File"] -menu .frmMenu.mnuFile.m
|
2022-07-21 10:56:46 +03:00
|
|
|
|
GetFileMenu [menu .frmMenu.mnuFile.m]
|
|
|
|
|
|
2022-08-17 16:52:22 +03:00
|
|
|
|
ttk::menubutton .frmMenu.mnuEdit -text [::msgcat::mc "Edit"] -menu .frmMenu.mnuEdit.m
|
2022-07-21 10:56:46 +03:00
|
|
|
|
GetEditMenu [menu .frmMenu.mnuEdit.m]
|
|
|
|
|
|
2022-08-17 16:52:22 +03:00
|
|
|
|
ttk::menubutton .frmMenu.mnuView -text [::msgcat::mc "View"] -menu .frmMenu.mnuView.m
|
2022-07-21 10:56:46 +03:00
|
|
|
|
GetViewMenu [menu .frmMenu.mnuView.m]
|
|
|
|
|
|
|
|
|
|
pack .frmMenu.mnuFile .frmMenu.mnuEdit .frmMenu.mnuView -side left
|
|
|
|
|
|
2022-08-17 16:52:22 +03:00
|
|
|
|
ttk::menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuHelp.m
|
2022-08-12 15:19:57 +03:00
|
|
|
|
GetHelpMenu [menu .frmMenu.mnuHelp.m]
|
2022-07-21 10:56:46 +03:00
|
|
|
|
pack .frmMenu.mnuHelp -side right
|
|
|
|
|
|
2022-11-18 16:44:55 +03:00
|
|
|
|
# PopUP menu
|
|
|
|
|
menu .popup
|
|
|
|
|
GetFileMenu .popup
|
|
|
|
|
GetEditMenu .popup
|
|
|
|
|
GetViewMenu .popup
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
set frmTool [ttk::frame .frmBody.frmTool]
|
|
|
|
|
ttk::panedwindow .frmBody.panel -orient horizontal -style TPanedwindow
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack propagate .frmBody.panel false
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-11-18 16:44:55 +03:00
|
|
|
|
if {$cfgVariables(toolBarShow) eq "true"} {
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack .frmBody.frmTool -side left -fill y
|
|
|
|
|
grid .frmBody.frmTool -row 0 -column 0 -sticky nsw
|
2022-11-18 16:44:55 +03:00
|
|
|
|
}
|
2022-11-22 14:55:24 +03:00
|
|
|
|
# pack .frmBody.panel -side left -fill both -expand true
|
|
|
|
|
grid .frmBody.panel -row 0 -column 1 -sticky nesw
|
|
|
|
|
grid columnconfigure .frmBody .frmBody.panel -weight 1
|
|
|
|
|
grid rowconfigure .frmBody .frmBody.panel -weight 1
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-11-22 16:29:26 +03:00
|
|
|
|
ttk::button $frmTool.btn_tree -command ToolBtnTreePress -image tree_24x24
|
2022-10-17 16:55:22 +03:00
|
|
|
|
ttk::button $frmTool.btn_search -command FileOper::FindInFiles -image search_24x24
|
|
|
|
|
ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-10-17 16:55:22 +03:00
|
|
|
|
pack $frmTool.btn_tree $frmTool.btn_search $frmTool.btn_git -side top -padx 1 -pady 1
|
2022-07-21 10:56:46 +03:00
|
|
|
|
# #label $frmTool.lbl_logo -image tcl
|
|
|
|
|
# pack $frmTool.btn_quit -side bottom -padx 5 -pady 5
|
|
|
|
|
# #pack $frmTool.lbl_logo -side bottom -padx 5 -pady 5
|
|
|
|
|
#
|
|
|
|
|
# # Дерево с полосами прокрутки
|
2022-11-14 15:12:11 +03:00
|
|
|
|
set frmTree [ttk::frame .frmBody.frmTree -border 0]
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
set tree [ttk::treeview $frmTree.tree -show tree \
|
2022-11-11 16:22:50 +03:00
|
|
|
|
-xscrollcommand [list .frmBody.frmTree.h set] \
|
|
|
|
|
-yscrollcommand [list .frmBody.frmTree.v set]]
|
|
|
|
|
|
2022-08-24 15:04:19 +03:00
|
|
|
|
# $tree heading #0 -text "Files tree"
|
|
|
|
|
# $tree column #0 -anchor e
|
|
|
|
|
|
2022-08-03 12:21:28 +03:00
|
|
|
|
ttk::scrollbar $frmTree.h -orient horizontal -command [list $frmTree.tree xview]
|
|
|
|
|
ttk::scrollbar $frmTree.v -orient vertical -command [list $frmTree.tree yview]
|
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
|
bind $tree <Double-ButtonPress-1> {Tree::DoublePressItem $tree}
|
2022-11-14 15:12:11 +03:00
|
|
|
|
bind $tree <ButtonRelease-1> {Tree::PressItem $tree; break}
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
grid $tree -row 0 -column 0 -sticky nsew
|
2022-08-03 12:21:28 +03:00
|
|
|
|
grid $frmTree.v -row 0 -column 1 -sticky nsew
|
|
|
|
|
# grid $frmTree.h -row 1 -column 0 -sticky nsew
|
2022-07-21 10:56:46 +03:00
|
|
|
|
grid columnconfigure $frmTree 0 -weight 1
|
|
|
|
|
grid rowconfigure $frmTree 0 -weight 1
|
|
|
|
|
|
2022-08-17 20:50:58 +03:00
|
|
|
|
set frmWork [ttk::frame .frmWork -border 0 -relief flat]
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-12-01 12:37:13 +03:00
|
|
|
|
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
|
|
|
|
|
|
2022-08-17 16:52:22 +03:00
|
|
|
|
set nbEditor [ttk::notebook $frmWork.nbEditor]
|
2022-09-15 09:35:23 +03:00
|
|
|
|
pack $nbEditor -side left -fill both -expand true
|
2022-12-01 12:37:13 +03:00
|
|
|
|
# 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]
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
2022-12-01 12:37:13 +03:00
|
|
|
|
$frmWork.panelNB add $nbEditor -weight 10
|
2022-09-15 09:35:23 +03:00
|
|
|
|
# pack $nbEditor2 -side left -fill both -expand true
|
|
|
|
|
#
|
2022-07-21 10:56:46 +03:00
|
|
|
|
# Create an image CLOSE for tab
|
|
|
|
|
ttk::style element create close_button image close_10x10 -height 12 -width 12 -sticky e -padding {10 0}
|
|
|
|
|
|
|
|
|
|
ttk::style layout TNotebook.Tab {
|
|
|
|
|
Notebook.tab -sticky nswe -children {
|
|
|
|
|
Notebook.padding -expand 1 -sticky nswe -children {
|
|
|
|
|
Notebook.label
|
|
|
|
|
-expand 1 -sticky nesw -side left close_button -side right
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-30 16:44:28 +03:00
|
|
|
|
bind TNotebook <Button-1> "catch {NB::PressTab %W %x %y}\;[bind TNotebook <Button-1>];break"
|
|
|
|
|
# bind <<NotebookTabChanged>> "NB::PressTab %W %x %y"
|
2022-09-15 09:35:23 +03:00
|
|
|
|
bind TNotebook <ButtonRelease-1> "NB::PressTab %W %x %y"
|
2022-11-23 12:50:07 +03:00
|
|
|
|
# bind TNotebook <Control-w> FileOper::Close
|
2022-08-30 16:44:28 +03:00
|
|
|
|
# bind . <Control-Tab> "NB::NextTab $nbEditor"
|
|
|
|
|
bind . <Control-Next> "NB::NextTab $nbEditor 1"
|
|
|
|
|
bind . <Control-Prior> "NB::NextTab $nbEditor -1"
|
2022-07-21 10:56:46 +03:00
|
|
|
|
# ttk::scrollbar $nbEditor.hsb1 -orient horizontal -command [list $frm_tree.work xview]
|
|
|
|
|
# ttk::scrollbar $fbEditor.vsb1 -orient vertical -command [list $frm_tree.work yview]
|
|
|
|
|
# set tree [ttk::treeview $frm_tree.tree -show tree \
|
|
|
|
|
# -xscrollcommand [list $frm_tree.hsb1 set] -yscrollcommand [list $frm_tree.vsb1 set]]
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# # назначение обработчика нажатия кнопкой мыши
|
|
|
|
|
# #bind $frm_tree.tree <ButtonRelease> "TreePress %x %y %X %Y $frm_tree.tree"
|
|
|
|
|
# bind $frm_tree.tree <ButtonRelease> "TreePress $frm_tree.tree"
|
|
|
|
|
|
|
|
|
|
#.panel add $frmTool -weight 1
|
2022-08-17 16:52:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {$cfgVariables(filesPanelShow) eq "true"} {
|
|
|
|
|
switch $cfgVariables(filesPanelPlace) {
|
|
|
|
|
"left" {
|
|
|
|
|
.frmBody.panel add $frmTree -weight 0
|
|
|
|
|
.frmBody.panel add $frmWork -weight 1
|
|
|
|
|
}
|
|
|
|
|
"right" {
|
|
|
|
|
.frmBody.panel add $frmWork -weight 1
|
|
|
|
|
.frmBody.panel add $frmTree
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
.frmBody.panel add $frmWork -weight 1
|
2022-08-24 15:04:19 +03:00
|
|
|
|
}
|
2022-08-01 16:24:42 +03:00
|
|
|
|
|
|
|
|
|
ttk::style configure . \
|
|
|
|
|
-foreground $::cfgVariables(guiFG) \
|
|
|
|
|
-font $::cfgVariables(guiFont)
|