Добавлены и исправлены функции отображения меню, панели инструментов, панели файлов
This commit is contained in:
parent
24b7ed6693
commit
84795cfb47
26
lib/gui.tcl
26
lib/gui.tcl
|
@ -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
|
||||||
|
@ -71,10 +71,17 @@ 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
|
||||||
pack .frmMenu -side top -padx 1 -fill x
|
|
||||||
|
if {$cfgVariables(menuShow) eq "true"} {
|
||||||
|
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
|
||||||
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 .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
|
||||||
|
|
||||||
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
|
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
|
||||||
|
|
30
lib/menu.tcl
30
lib/menu.tcl
|
@ -69,16 +69,30 @@ 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"] \
|
||||||
$m.panelSide add radiobutton -label [::msgcat::mc "Left"] -variable cfgVariables(filesPanelPlace) -value 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 "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 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
|
||||||
$m.editorWrap add radiobutton -label [::msgcat::mc "None"] -variable cfgVariables(editorWrap) \
|
$m.editorWrap add radiobutton -label [::msgcat::mc "None"] -variable cfgVariables(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
|
||||||
|
}
|
||||||
|
|
|
@ -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"} {
|
||||||
|
if {$cfgVariables(filesPanelShow) eq "false"} {
|
||||||
|
set cfgVariables(filesPanelShow) true
|
||||||
|
} else {
|
||||||
|
set cfgVariables(filesPanelShow) false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {$cfgVariables(filesPanelShow) eq "false"} {
|
||||||
.frmBody.panel forget .frmBody.frmTree
|
.frmBody.panel forget .frmBody.frmTree
|
||||||
set cfgVariables(filesPanelShow) false
|
# set cfgVariables(filesPanelShow) true
|
||||||
} else {
|
} else {
|
||||||
switch $cfgVariables(filesPanelPlace) {
|
switch $cfgVariables(filesPanelPlace) {
|
||||||
"left" {
|
"left" {
|
||||||
|
@ -36,22 +43,50 @@ 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] {
|
||||||
$node.frmText.t configure -linemap $cfgVariables(lineNumberShow)
|
if [winfo exists $node.frmText.t] {
|
||||||
|
$node.frmText.t configure -linemap $cfgVariables(lineNumberShow)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
||||||
######################################################
|
######################################################
|
||||||
# Version: 2.0.0
|
# Version: 2.0.0
|
||||||
# Release: alpha
|
# Release: alpha
|
||||||
# Build: 18112022131247
|
# Build: 18112022164357
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# определим текущую версию, релиз и т.д.
|
# определим текущую версию, релиз и т.д.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user