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}
|
|
|
|
|
#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
|
|
|
|
|
ttk::frame .frmBody -border 1 -relief raised
|
2022-08-24 15:04:19 +03:00
|
|
|
|
ttk::frame .frmStatus -border 0 -relief raised
|
2022-07-21 10:56:46 +03:00
|
|
|
|
pack .frmMenu -side top -padx 1 -fill x
|
|
|
|
|
pack .frmBody -side top -padx 1 -fill both -expand true
|
|
|
|
|
pack .frmStatus -side top -padx 1 -fill x
|
|
|
|
|
|
|
|
|
|
# pack .panel -expand true -fill both
|
|
|
|
|
# pack propagate .panel false
|
|
|
|
|
#pack [label .frmMenu.lbl -text "ddd"]
|
2022-08-03 12:21:28 +03:00
|
|
|
|
pack [ttk::label .frmStatus.lblPosition -justify right] -side right
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set frmTool [ttk::frame .frmBody.frmTool]
|
|
|
|
|
ttk::panedwindow .frmBody.panel -orient horizontal -style TPanedwindow
|
|
|
|
|
pack propagate .frmBody.panel false
|
|
|
|
|
|
|
|
|
|
pack .frmBody.frmTool -side left -fill y
|
|
|
|
|
pack .frmBody.panel -side left -fill both -expand true
|
|
|
|
|
|
2022-08-03 12:21:28 +03:00
|
|
|
|
ttk::button $frmTool.btn_tree -command ViewFilesTree -image tree_24x24
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
pack $frmTool.btn_tree -side top -padx 1 -pady 1
|
|
|
|
|
# #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
|
|
|
|
|
#
|
|
|
|
|
# # Дерево с полосами прокрутки
|
|
|
|
|
set frmTree [ttk::frame .frmBody.frmTree]
|
|
|
|
|
|
|
|
|
|
set tree [ttk::treeview $frmTree.tree -show tree \
|
2022-08-03 12:21:28 +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-08-24 15:04:19 +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-08-17 16:52:22 +03:00
|
|
|
|
set nbEditor [ttk::notebook $frmWork.nbEditor]
|
2022-07-21 10:56:46 +03:00
|
|
|
|
|
|
|
|
|
#grid $nbEditor -row 0 -column 0 -sticky nsew
|
|
|
|
|
pack $nbEditor -fill both -expand true
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bind TNotebook <Button-1> "NB::CloseTab %W %x %y\;[bind TNotebook <Button-1>]"
|
|
|
|
|
|
|
|
|
|
# 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)
|