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

This commit is contained in:
svkalinin 2022-08-17 16:52:22 +03:00
parent bd3d5bb4b5
commit 031cf564cf
9 changed files with 83 additions and 39 deletions

View File

@ -66,4 +66,10 @@
16/08/2022 16/08/2022
- Added selection of all words in the text by clicking on the any word - Added selection of all words in the text by clicking on the any word
17/08/2022
- Added "Vew Panel" menu and "Panel side" (left/right)
- Changed standard Tk menu on TTK::menu
- Added config options filesPanelPlace (left/right)
- Fixed ViewFilesTree procedure with rigth variable filesPanelShow (true/false)

View File

@ -29,17 +29,19 @@ theme=dark
toolBarShow=true toolBarShow=true
menuShow=true menuShow=true
filesPanelShow=true filesPanelShow=true
filesPanelPlace=left
geometry=1024x768 geometry=1024x768
guiFont={Droid Sans Mono} 9 guiFont={Droid Sans Mono} 9
guiFontBold={Droid Sans Mono} 9 bold guiFontBold={Droid Sans Mono} 9 bold
guiFG=#cccccc guiFG=#cccccc
\[Editor\] \[Editor\]
autoFormat=true autoFormat=true
font=courier 10 normal roman font=Monospace 10
fontBold=courier 10 bold roman fontBold=Monospace 10
backGround=#333333 backGround=#333333
foreground=#cccccc foreground=#cccccc
selectbg=#10a410a410a4 selectbg=#10a410a410a4
selectLightBg=grey
nbNormal=#000000 nbNormal=#000000
nbModify=#ffff5d705d70 nbModify=#ffff5d705d70
lineNumberFG=#a9a9a9 lineNumberFG=#a9a9a9

View File

@ -640,8 +640,8 @@ namespace eval Editor {
if {$cfgVariables(lineNumberShow) eq "false"} { if {$cfgVariables(lineNumberShow) eq "false"} {
$txt configure -linemap 0 $txt configure -linemap 0
} }
$txt tag configure lightBracket -background #000000 -foreground #00ffff $txt tag configure lightBracket -background $cfgVariables(selectLightBg) -foreground #00ffff
$txt tag configure lightSelected -background #000000 -foreground #00ffff $txt tag configure lightSelected -background $cfgVariables(selectLightBg) -foreground #00ffff
set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]] set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]]
if {$fileType eq ""} {set fileType "Unknown"} if {$fileType eq ""} {set fileType "Unknown"}

View File

@ -66,7 +66,7 @@ if [info exists cfgVariables(theme)] {
ttk::style theme use $cfgVariables(theme) ttk::style theme use $cfgVariables(theme)
} }
frame .frmMenu -border 1 -relief raised -highlightthickness 0 ttk::frame .frmMenu -border 1 -relief raised
frame .frmBody -border 1 -relief raised -highlightthickness 0 frame .frmBody -border 1 -relief raised -highlightthickness 0
ttk::frame .frmStatus -border 0 -relief sunken ttk::frame .frmStatus -border 0 -relief sunken
pack .frmMenu -side top -padx 1 -fill x pack .frmMenu -side top -padx 1 -fill x
@ -78,18 +78,18 @@ pack .frmStatus -side top -padx 1 -fill x
#pack [label .frmMenu.lbl -text "ddd"] #pack [label .frmMenu.lbl -text "ddd"]
pack [ttk::label .frmStatus.lblPosition -justify right] -side right pack [ttk::label .frmStatus.lblPosition -justify right] -side right
menubutton .frmMenu.mnuFile -text [::msgcat::mc "File"] -menu .frmMenu.mnuFile.m ttk::menubutton .frmMenu.mnuFile -text [::msgcat::mc "File"] -menu .frmMenu.mnuFile.m
GetFileMenu [menu .frmMenu.mnuFile.m] GetFileMenu [menu .frmMenu.mnuFile.m]
menubutton .frmMenu.mnuEdit -text [::msgcat::mc "Edit"] -menu .frmMenu.mnuEdit.m ttk::menubutton .frmMenu.mnuEdit -text [::msgcat::mc "Edit"] -menu .frmMenu.mnuEdit.m
GetEditMenu [menu .frmMenu.mnuEdit.m] GetEditMenu [menu .frmMenu.mnuEdit.m]
menubutton .frmMenu.mnuView -text [::msgcat::mc "View"] -menu .frmMenu.mnuView.m ttk::menubutton .frmMenu.mnuView -text [::msgcat::mc "View"] -menu .frmMenu.mnuView.m
GetViewMenu [menu .frmMenu.mnuView.m] GetViewMenu [menu .frmMenu.mnuView.m]
pack .frmMenu.mnuFile .frmMenu.mnuEdit .frmMenu.mnuView -side left pack .frmMenu.mnuFile .frmMenu.mnuEdit .frmMenu.mnuView -side left
menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuHelp.m ttk::menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuHelp.m
GetHelpMenu [menu .frmMenu.mnuHelp.m] GetHelpMenu [menu .frmMenu.mnuHelp.m]
pack .frmMenu.mnuHelp -side right pack .frmMenu.mnuHelp -side right
@ -128,9 +128,9 @@ grid $frmTree.v -row 0 -column 1 -sticky nsew
grid columnconfigure $frmTree 0 -weight 1 grid columnconfigure $frmTree 0 -weight 1
grid rowconfigure $frmTree 0 -weight 1 grid rowconfigure $frmTree 0 -weight 1
set frm_work [ttk::frame .frm_work] set frmWork [ttk::frame .frmWork]
set nbEditor [ttk::notebook $frm_work.nbEditor] set nbEditor [ttk::notebook $frmWork.nbEditor]
#grid $nbEditor -row 0 -column 0 -sticky nsew #grid $nbEditor -row 0 -column 0 -sticky nsew
pack $nbEditor -fill both -expand true pack $nbEditor -fill both -expand true
@ -160,11 +160,24 @@ bind TNotebook <Button-1> "NB::CloseTab %W %x %y\;[bind TNotebook <Button-1>]"
# bind $frm_tree.tree <ButtonRelease> "TreePress $frm_tree.tree" # bind $frm_tree.tree <ButtonRelease> "TreePress $frm_tree.tree"
#.panel add $frmTool -weight 1 #.panel add $frmTool -weight 1
if {$cfgVariables(toolBarShow) eq "true"} {
.frmBody.panel add $frmTree -weight 0
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
} }
.frmBody.panel add $frm_work -weight 1
ttk::style configure . \ ttk::style configure . \
-foreground $::cfgVariables(guiFG) \ -foreground $::cfgVariables(guiFG) \
-font $::cfgVariables(guiFont) -font $::cfgVariables(guiFont)

View File

@ -61,7 +61,14 @@ proc GetEditMenu {m} {
} }
proc GetViewMenu {m} { proc GetViewMenu {m} {
$m add command -label [::msgcat::mc "View files tree"] -command ViewFilesTree global cfgVariables
$m add command -label [::msgcat::mc "View panel"] -command ViewFilesTree
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 add command -label [::msgcat::mc "View line numbers"] -command ViewLineNumbers $m add command -label [::msgcat::mc "View line numbers"] -command ViewLineNumbers
} }

View File

@ -186,7 +186,10 @@
::msgcat::mcset ru "Variables" "Переменные" ::msgcat::mcset ru "Variables" "Переменные"
::msgcat::mcset ru "Version" "Версия" ::msgcat::mcset ru "Version" "Версия"
::msgcat::mcset ru "View" "Вид" ::msgcat::mcset ru "View" "Вид"
::msgcat::mcset ru "View files tree" "Показывать дерево файлов" ::msgcat::mcset ru "View panel" "Показывать дополнительную панель"
::msgcat::mcset ru "Panel side" "Расположение дополнительной панели"
::msgcat::mcset ru "Left" "Слева"
::msgcat::mcset ru "Right" "Справа"
::msgcat::mcset ru "View line numbers" "Показывать номера строк" ::msgcat::mcset ru "View line numbers" "Показывать номера строк"
::msgcat::mcset ru "Warning" "Внимание" ::msgcat::mcset ru "Warning" "Внимание"
::msgcat::mcset ru "Was replacement" "Было заменено" ::msgcat::mcset ru "Was replacement" "Было заменено"

View File

@ -21,12 +21,22 @@ proc Quit {} {
proc ViewFilesTree {} { proc ViewFilesTree {} {
global cfgVariables global cfgVariables
if {$cfgVariables(toolBarShow) eq "true"} { if {$cfgVariables(filesPanelShow) eq "true"} {
.frmBody.panel forget .frmBody.frmTree .frmBody.panel forget .frmBody.frmTree
set cfgVariables(toolBarShow) false set cfgVariables(filesPanelShow) false
} else { } else {
.frmBody.panel insert 0 .frmBody.frmTree switch $cfgVariables(filesPanelPlace) {
set cfgVariables(toolBarShow) true "left" {
.frmBody.panel insert 0 .frmBody.frmTree
}
"right" {
.frmBody.panel add .frmBody.frmTree
}
default {
.frmBody.panel insert 0 .frmBody.frmTree
}
}
set cfgVariables(filesPanelShow) true
} }
} }

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha # Release: alpha
# Build: 16082022151910 # Build: 17082022162534
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.
@ -64,7 +64,7 @@ if [info exists env(XDG_CONFIG_HOME)] {
} }
if {[file exists $dir(cfg)] == 0} { if {[file exists $dir(cfg)] == 0} {
file mkdir $dir(cfg) file mkdir $dir(cfg)
} }
# puts "Config dir is $dir(cfg)" # puts "Config dir is $dir(cfg)"
@ -97,7 +97,7 @@ foreach modFile [lsort [glob -nocomplain [file join $dir(theme) *]]] {
# загружаем пользовательский конфиг, если он отсутствует, то копируем дефолтный # загружаем пользовательский конфиг, если он отсутствует, то копируем дефолтный
if {[file exists [file join $dir(cfg) projman.ini]] ==0} { if {[file exists [file join $dir(cfg) projman.ini]] ==0} {
Config::create $dir(cfg) Config::create $dir(cfg)
} }
Config::read $dir(cfg) Config::read $dir(cfg)
::msgcat::mclocale $cfgVariables(locale) ::msgcat::mclocale $cfgVariables(locale)

View File

@ -58,8 +58,7 @@ namespace eval ttk::theme::dark {
# ttk widgets. # ttk widgets.
ttk::style configure TButton \ ttk::style configure TButton \
-width -8 -padding {5 1} -relief link -width -8 -padding {5 1} -relief link
ttk::style configure TMenubutton \ ttk::style configure TMenubutton -relief flat -arrowsize 0
-width -11 -padding {5 1} -relief raised
ttk::style configure TCheckbutton \ ttk::style configure TCheckbutton \
-indicatorbackground "#ffffff" -indicatormargin {1 1 4 1} -indicatorbackground "#ffffff" -indicatormargin {1 1 4 1}
ttk::style configure TRadiobutton \ ttk::style configure TRadiobutton \
@ -69,12 +68,13 @@ namespace eval ttk::theme::dark {
ttk::style configure TEntry -fieldbackground $colors(-lightframe) -foreground #ffffff -padding {2 0} ttk::style configure TEntry -fieldbackground $colors(-lightframe) -foreground #ffffff -padding {2 0}
ttk::style configure TCombobox \ ttk::style configure TCombobox \
-fieldbackground $colors(-lightframe) \ -fieldbackground $colors(-lightframe) \
-foreground #ffffff \ -foreground #ffffff \
-padding {2 0} -padding {2 0}
ttk::style configure TSpinbox \ ttk::style configure TSpinbox \
-fieldbackground $colors(-lightframe) \ -fieldbackground $colors(-lightframe) \
-foreground #ffffff -foreground #ffffff
ttk::style configure TNotebook.Tab \ ttk::style configure TNotebook.Tab \
-padding {6 2 6 2} -padding {6 2 6 2}
@ -88,16 +88,19 @@ namespace eval ttk::theme::dark {
-foreground [list disabled $colors(-disabledfg)] -foreground [list disabled $colors(-disabledfg)]
ttk::style configure Treeview \ ttk::style configure Treeview \
-background $colors(-lightframe) -itembackground {gray60 gray50} \ -background $colors(-lightframe) -itembackground {gray60 gray50} \
-itemfill #ffffff -itemaccentfill yellow \ -itemfill #ffffff -itemaccentfill yellow \
-fieldbackground $colors(-lightframe) -fieldbackground $colors(-lightframe)
# -indicatormargins 0 \
# -indicatorsize -1 \
# -padding 0
ttk::style configure Text \ ttk::style configure Text \
-linemapbg [list active $colors(-lightframe)]\ -linemapbg [list active $colors(-lightframe)]\
-linemapbg [list active $colors(-disabledfg)]\ -linemapbg [list active $colors(-disabledfg)]\
-background [list active $colors(-lighter)] \ -background [list active $colors(-lighter)] \
-foreground [list disabled $colors(-disabledfg)] -foreground [list disabled $colors(-disabledfg)]
ttk::style configure TLabel -foreground $colors(-disabledfg) -padding {2 0} ttk::style configure TLabel -foreground $colors(-disabledfg) -padding {2 0}
# ttk::style configure TreeCtrl \ # ttk::style configure TreeCtrl \