Добавлены и исправлены функции отображения меню, панели инструментов, панели файлов

This commit is contained in:
svkalinin 2022-11-18 16:44:55 +03:00
parent 24b7ed6693
commit 84795cfb47
4 changed files with 90 additions and 23 deletions

View File

@ -56,8 +56,8 @@ bind . <Control-K> {
} }
bind . <Control-s> {FileOper::Save} bind . <Control-s> {FileOper::Save}
bind . <Control-S> {FileOper::Save} bind . <Control-S> {FileOper::Save}
bind . <Alt-p> ViewFilesTree bind . <Alt-p> {ViewFilesTree true}
bind . <Button-3> {catch [PopupMenu %X %Y]}
#ttk::style configure TPanedwindow -background blue #ttk::style configure TPanedwindow -background blue
#ttk::style configure Sash -sashthickness 5 #ttk::style configure Sash -sashthickness 5
@ -72,9 +72,16 @@ if [info exists cfgVariables(theme)] {
ttk::frame .frmMenu -border 0 -relief raised ttk::frame .frmMenu -border 0 -relief raised
ttk::frame .frmBody -border 0 -relief raised ttk::frame .frmBody -border 0 -relief raised
ttk::frame .frmStatus -border 0 -relief raised ttk::frame .frmStatus -border 0 -relief raised
if {$cfgVariables(menuShow) eq "true"} {
pack .frmMenu -side top -padx 1 -fill x pack .frmMenu -side top -padx 1 -fill x
}
pack .frmBody -side top -padx 1 -fill both -expand true pack .frmBody -side top -padx 1 -fill both -expand true
if {$cfgVariables(statusBarShow) eq "true"} {
pack .frmStatus -side top -padx 1 -fill x pack .frmStatus -side top -padx 1 -fill x
}
# pack .panel -expand true -fill both # pack .panel -expand true -fill both
# pack propagate .panel false # pack propagate .panel false
@ -104,12 +111,19 @@ ttk::menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuH
GetHelpMenu [menu .frmMenu.mnuHelp.m] GetHelpMenu [menu .frmMenu.mnuHelp.m]
pack .frmMenu.mnuHelp -side right pack .frmMenu.mnuHelp -side right
# PopUP menu
menu .popup
GetFileMenu .popup
GetEditMenu .popup
GetViewMenu .popup
set frmTool [ttk::frame .frmBody.frmTool] set frmTool [ttk::frame .frmBody.frmTool]
ttk::panedwindow .frmBody.panel -orient horizontal -style TPanedwindow ttk::panedwindow .frmBody.panel -orient horizontal -style TPanedwindow
pack propagate .frmBody.panel false pack propagate .frmBody.panel false
if {$cfgVariables(toolBarShow) eq "true"} {
pack .frmBody.frmTool -side left -fill y pack .frmBody.frmTool -side left -fill y
}
pack .frmBody.panel -side left -fill both -expand true pack .frmBody.panel -side left -fill both -expand true
ttk::button $frmTool.btn_tree -command ViewFilesTree -image tree_24x24 ttk::button $frmTool.btn_tree -command ViewFilesTree -image tree_24x24

View File

@ -69,15 +69,29 @@ proc GetEditMenu {m} {
proc GetViewMenu {m} { proc GetViewMenu {m} {
global cfgVariables global cfgVariables
$m add command -label [::msgcat::mc "View panel"] -command ViewFilesTree $m add checkbutton -label [::msgcat::mc "View panel"] -command ViewFilesTree \
-variable cfgVariables(filesPanelShow) -onvalue true -offvalue false \
-accelerator "Alt+P"
menu $m.panelSide menu $m.panelSide
$m add cascade -label [::msgcat::mc "Panel side"] -menu $m.panelSide $m add cascade -label [::msgcat::mc "Panel side"] -menu $m.panelSide
$m.panelSide add radiobutton -label [::msgcat::mc "Left"] \
-variable cfgVariables(filesPanelPlace) -value left
$m.panelSide add radiobutton -label [::msgcat::mc "Right"] \
-variable cfgVariables(filesPanelPlace) -value right
$m.panelSide add radiobutton -label [::msgcat::mc "Left"] -variable cfgVariables(filesPanelPlace) -value left $m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenu \
$m.panelSide add radiobutton -label [::msgcat::mc "Right"] -variable cfgVariables(filesPanelPlace) -value right -variable cfgVariables(menuShow) -onvalue true -offvalue false
$m add checkbutton -label [::msgcat::mc "Toolbar"] -command ViewToolBar \
-variable cfgVariables(toolBarShow) -onvalue true -offvalue false
$m add checkbutton -label [::msgcat::mc "Statusbar"] -command ViewStatusBar \
-variable cfgVariables(statusBarShow) -onvalue true -offvalue false
$m add separator $m add separator
$m add command -label [::msgcat::mc "View line numbers"] -command ViewLineNumbers # $m add command -label [::msgcat::mc "View line numbers"] \
# -command ViewLineNumbers
$m add checkbutton -label [::msgcat::mc "View line numbers"] \
-variable cfgVariables(lineNumberShow) -onvalue true -offvalue false \
-command ViewLineNumbers
menu $m.editorWrap menu $m.editorWrap
$m add cascade -label [::msgcat::mc "Editors word wrapping"] -menu $m.editorWrap $m add cascade -label [::msgcat::mc "Editors word wrapping"] -menu $m.editorWrap
@ -104,3 +118,7 @@ proc GetViewMenu {m} {
proc GetHelpMenu {m} { proc GetHelpMenu {m} {
$m add command -label [::msgcat::mc "About ..."] -command Help::About $m add command -label [::msgcat::mc "About ..."] -command Help::About
} }
proc PopupMenu {x y} {
tk_popup .popup $x $y
}

View File

@ -19,11 +19,18 @@ proc Quit {} {
} }
} }
proc ViewFilesTree {} { proc ViewFilesTree {{hotkey "false"}} {
global cfgVariables global cfgVariables
if {$cfgVariables(filesPanelShow) eq "true"} { if {$hotkey eq "true"} {
.frmBody.panel forget .frmBody.frmTree if {$cfgVariables(filesPanelShow) eq "false"} {
set cfgVariables(filesPanelShow) true
} else {
set cfgVariables(filesPanelShow) false set cfgVariables(filesPanelShow) false
}
}
if {$cfgVariables(filesPanelShow) eq "false"} {
.frmBody.panel forget .frmBody.frmTree
# set cfgVariables(filesPanelShow) true
} else { } else {
switch $cfgVariables(filesPanelPlace) { switch $cfgVariables(filesPanelPlace) {
"left" { "left" {
@ -36,24 +43,52 @@ proc ViewFilesTree {} {
.frmBody.panel insert 0 .frmBody.frmTree .frmBody.panel insert 0 .frmBody.frmTree
} }
} }
set cfgVariables(filesPanelShow) true # set cfgVariables(filesPanelShow) false
} }
} }
proc ViewToolBar {} {
global cfgVariables
if {$cfgVariables(toolBarShow) eq "false"} {
pack forget .frmBody.frmTool
} else {
# pack
}
}
proc ViewStatusBar {} {
global cfgVariables
if {$cfgVariables(statusBarShow) eq "false"} {
pack forget .frmStatus
} else {
# pack
}
}
proc ViewMenu {} {
global cfgVariables
if {$cfgVariables(menuShow) eq "false"} {
pack forget .frmMenu
} else {
# pack
}
}
# Enable/Disabled line numbers in editor # Enable/Disabled line numbers in editor
proc ViewLineNumbers {} { proc ViewLineNumbers {} {
global cfgVariables nbEditor global cfgVariables nbEditor
# Changed global settigs # Changed global settigs
if {$cfgVariables(lineNumberShow) eq "true"} { # if {$cfgVariables(lineNumberShow) eq "true"} {
set cfgVariables(lineNumberShow) false # set cfgVariables(lineNumberShow) false
} else { # } else {
set cfgVariables(lineNumberShow) true # set cfgVariables(lineNumberShow) true
} # }
# apply changes for opened tabs # apply changes for opened tabs
foreach node [$nbEditor tabs] { foreach node [$nbEditor tabs] {
if [winfo exists $node.frmText.t] {
$node.frmText.t configure -linemap $cfgVariables(lineNumberShow) $node.frmText.t configure -linemap $cfgVariables(lineNumberShow)
} }
} }
}
proc ViewHelper {helper} { proc ViewHelper {helper} {
global cfgVariables global cfgVariables

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha # Release: alpha
# Build: 18112022131247 # Build: 18112022164357
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.