From 84795cfb470c0d2946ff0b508e57731a0a2e0b2f Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 18 Nov 2022 16:44:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B8=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BC=D0=B5=D0=BD=D1=8E,=20=D0=BF=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8=20=D0=B8=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2,=20=D0=BF=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/gui.tcl | 26 ++++++++++++++++------ lib/menu.tcl | 30 ++++++++++++++++++++------ lib/procedure.tcl | 55 ++++++++++++++++++++++++++++++++++++++--------- projman.tcl | 2 +- 4 files changed, 90 insertions(+), 23 deletions(-) diff --git a/lib/gui.tcl b/lib/gui.tcl index a624ce7..06c90b3 100644 --- a/lib/gui.tcl +++ b/lib/gui.tcl @@ -56,8 +56,8 @@ bind . { } bind . {FileOper::Save} bind . {FileOper::Save} -bind . ViewFilesTree - +bind . {ViewFilesTree true} +bind . {catch [PopupMenu %X %Y]} #ttk::style configure TPanedwindow -background blue #ttk::style configure Sash -sashthickness 5 @@ -71,10 +71,17 @@ if [info exists cfgVariables(theme)] { ttk::frame .frmMenu -border 0 -relief raised ttk::frame .frmBody -border 0 -relief raised -ttk::frame .frmStatus -border 0 -relief raised -pack .frmMenu -side top -padx 1 -fill x +ttk::frame .frmStatus -border 0 -relief raised + +if {$cfgVariables(menuShow) eq "true"} { + 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 + +if {$cfgVariables(statusBarShow) eq "true"} { + pack .frmStatus -side top -padx 1 -fill x +} # pack .panel -expand true -fill both # pack propagate .panel false @@ -104,12 +111,19 @@ ttk::menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuH GetHelpMenu [menu .frmMenu.mnuHelp.m] pack .frmMenu.mnuHelp -side right +# PopUP menu +menu .popup +GetFileMenu .popup +GetEditMenu .popup +GetViewMenu .popup 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 +if {$cfgVariables(toolBarShow) eq "true"} { + pack .frmBody.frmTool -side left -fill y +} pack .frmBody.panel -side left -fill both -expand true ttk::button $frmTool.btn_tree -command ViewFilesTree -image tree_24x24 diff --git a/lib/menu.tcl b/lib/menu.tcl index f7c2e9a..8b6986b 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -69,16 +69,30 @@ proc GetEditMenu {m} { proc GetViewMenu {m} { 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 $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.panelSide add radiobutton -label [::msgcat::mc "Right"] \ + -variable cfgVariables(filesPanelPlace) -value right + + $m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenu \ + -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 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 $m add cascade -label [::msgcat::mc "Editors word wrapping"] -menu $m.editorWrap $m.editorWrap add radiobutton -label [::msgcat::mc "None"] -variable cfgVariables(editorWrap) \ @@ -104,3 +118,7 @@ proc GetViewMenu {m} { proc GetHelpMenu {m} { $m add command -label [::msgcat::mc "About ..."] -command Help::About } + +proc PopupMenu {x y} { + tk_popup .popup $x $y +} diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 7ddd071..d51c4b8 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -19,11 +19,18 @@ proc Quit {} { } } -proc ViewFilesTree {} { +proc ViewFilesTree {{hotkey "false"}} { global cfgVariables - if {$cfgVariables(filesPanelShow) eq "true"} { + if {$hotkey eq "true"} { + if {$cfgVariables(filesPanelShow) eq "false"} { + set cfgVariables(filesPanelShow) true + } else { + set cfgVariables(filesPanelShow) false + } + } + if {$cfgVariables(filesPanelShow) eq "false"} { .frmBody.panel forget .frmBody.frmTree - set cfgVariables(filesPanelShow) false + # set cfgVariables(filesPanelShow) true } else { switch $cfgVariables(filesPanelPlace) { "left" { @@ -36,22 +43,50 @@ proc ViewFilesTree {} { .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 proc ViewLineNumbers {} { global cfgVariables nbEditor + # Changed global settigs - if {$cfgVariables(lineNumberShow) eq "true"} { - set cfgVariables(lineNumberShow) false - } else { - set cfgVariables(lineNumberShow) true - } + # if {$cfgVariables(lineNumberShow) eq "true"} { + # set cfgVariables(lineNumberShow) false + # } else { + # set cfgVariables(lineNumberShow) true + # } # apply changes for opened tabs foreach node [$nbEditor tabs] { - $node.frmText.t configure -linemap $cfgVariables(lineNumberShow) + if [winfo exists $node.frmText.t] { + $node.frmText.t configure -linemap $cfgVariables(lineNumberShow) + } } } diff --git a/projman.tcl b/projman.tcl index e03a4c7..9873d1e 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 18112022131247 +# Build: 18112022164357 ###################################################### # определим текущую версию, релиз и т.д.