Исправлено закерытие вкладки по щелчку мыши.
Добавлена настройка переноса строк в редакторе. Добавлены сочетания клавиш ctrl+pgup cntrl+pgdown для переключения между вкладками редактора. Добавлен диалог закрытия папки (каталога)
This commit is contained in:
parent
1142324008
commit
ec3e4ac12e
|
@ -99,3 +99,9 @@
|
|||
- Alt+e - delete text between cursor and line End
|
||||
- Fix close braces indent
|
||||
|
||||
30/08/2022
|
||||
- Fix the clicked by the close button on a tab
|
||||
- Added "View"->"Editors word wrap" menu and procedure
|
||||
- Added bindings "Ctrl+PgUp" and "Ctrl+PgDown" for next or prior tab selecting
|
||||
- Added "Close file" dialog
|
||||
|
||||
|
|
|
@ -9,26 +9,23 @@
|
|||
|
||||
namespace eval Editor {
|
||||
variable selectionTex
|
||||
# Set the editor option
|
||||
proc SetOption {optionName value} {
|
||||
global cfgVariables nbEditor
|
||||
# apply changes for opened tabs
|
||||
foreach node [$nbEditor tabs] {
|
||||
$node.frmText.t configure -$optionName $value
|
||||
}
|
||||
}
|
||||
|
||||
# Comment one string or selected string
|
||||
proc Comment {txt fileType} {
|
||||
global lexers
|
||||
set selIndex [$txt tag ranges sel]
|
||||
set pos [$txt index insert]
|
||||
set lineNum [lindex [split $pos "."] 0]
|
||||
set PosNum [lindex [split $pos "."] 1]
|
||||
# switch $fileType {
|
||||
# TCL {
|
||||
# set symbol "#"
|
||||
# }
|
||||
# GO {
|
||||
# set symbol "//"
|
||||
# }
|
||||
# Unknown {
|
||||
# set symbol "#"
|
||||
# }
|
||||
# default {
|
||||
# set symbol "#"
|
||||
# }
|
||||
# }
|
||||
|
||||
if [dict exists $lexers $fileType commentSymbol] {
|
||||
set symbol [dict get $lexers $fileType commentSymbol]
|
||||
} else {
|
||||
|
@ -57,6 +54,8 @@ namespace eval Editor {
|
|||
$txt tag raise comments
|
||||
}
|
||||
}
|
||||
|
||||
# Uncomment one string selected strings
|
||||
proc Uncomment {txt fileType} {
|
||||
set selIndex [$txt tag ranges sel]
|
||||
set pos [$txt index insert]
|
||||
|
@ -456,8 +455,8 @@ namespace eval Editor {
|
|||
# bind $txt <Control-j> ""
|
||||
bind $txt <Control-i> "ImageBase64Encode $txt"
|
||||
|
||||
# bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
||||
# bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
||||
bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
||||
bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
||||
|
||||
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
|
||||
bind $txt <Control-period> "Editor::Uncomment $txt $fileType"
|
||||
|
@ -785,13 +784,15 @@ namespace eval Editor {
|
|||
set txt $frmText.t
|
||||
|
||||
pack $frmText -side top -expand true -fill both
|
||||
pack [ttk::scrollbar $frmText.s -command "$frmText.t yview"] -side right -fill y
|
||||
ctext $txt -yscrollcommand "$frmText.s set" -font $cfgVariables(font) \
|
||||
pack [ttk::scrollbar $frmText.v -command "$frmText.t yview"] -side right -fill y
|
||||
ttk::scrollbar $frmText.h -orient horizontal -command "$frmText.t xview"
|
||||
ctext $txt -xscrollcommand "$frmText.h set" -yscrollcommand "$frmText.v set" \
|
||||
-font $cfgVariables(font) -relief flat -wrap $cfgVariables(editorWrap) \
|
||||
-linemapfg $cfgVariables(lineNumberFG) -linemapbg $cfgVariables(lineNumberBG) \
|
||||
-tabs "[expr {4 * [font measure $cfgVariables(font) 0]}] left" -tabstyle tabular -undo true \
|
||||
-relief flat
|
||||
-tabs "[expr {4 * [font measure $cfgVariables(font) 0]}] left" -tabstyle tabular -undo true
|
||||
|
||||
pack $txt -fill both -expand 1
|
||||
pack $frmText.h -side bottom -fill x
|
||||
# puts ">>>>>>> [bindtags $txt]"
|
||||
if {$cfgVariables(lineNumberShow) eq "false"} {
|
||||
$txt configure -linemap 0
|
||||
|
|
|
@ -48,6 +48,28 @@ namespace eval FileOper {
|
|||
return $fullPath
|
||||
}
|
||||
|
||||
proc CloseFolder {} {
|
||||
global tree nbEditor
|
||||
set treeItem [$tree selection]
|
||||
set parent [$tree parent $treeItem]
|
||||
while {$parent ne ""} {
|
||||
set treeItem $parent
|
||||
set parent [$tree parent $treeItem]
|
||||
}
|
||||
if {$parent eq "" && [string match "directory::*" $treeItem] == 1} {
|
||||
# puts "tree root item: $treeItem"
|
||||
foreach nbItem [$nbEditor tabs] {
|
||||
set item [string trimleft [file extension $nbItem] "."]
|
||||
# puts $item
|
||||
if [$tree exists "file::$item"] {
|
||||
$nbEditor select $nbItem
|
||||
Close
|
||||
}
|
||||
}
|
||||
$tree delete $treeItem
|
||||
}
|
||||
}
|
||||
|
||||
proc CloseAll {} {
|
||||
global nbEditor modified
|
||||
foreach nbItem [array names modified] {
|
||||
|
@ -150,6 +172,7 @@ namespace eval FileOper {
|
|||
return ""
|
||||
}
|
||||
set parent [Tree::InsertItem $tree {} $directory "directory" [file tail $directory]]
|
||||
$tree selection set $parent
|
||||
# if {[ $tree item $parent -open] eq "false"} {
|
||||
# $tree item $parent -open true
|
||||
# } else {
|
||||
|
|
11
lib/gui.tcl
11
lib/gui.tcl
|
@ -56,7 +56,9 @@ bind . <Control-K> {
|
|||
}
|
||||
bind . <Control-s> {FileOper::Save}
|
||||
bind . <Control-S> {FileOper::Save}
|
||||
bind . <Alt-t> ViewFilesTree
|
||||
bind . <Alt-p> ViewFilesTree
|
||||
|
||||
|
||||
#ttk::style configure TPanedwindow -background blue
|
||||
#ttk::style configure Sash -sashthickness 5
|
||||
#ttk::style configure TButton -padding 60 -relief flat -bg black
|
||||
|
@ -149,9 +151,12 @@ ttk::style layout TNotebook.Tab {
|
|||
}
|
||||
}
|
||||
}
|
||||
bind TNotebook <Button-1> "catch {NB::PressTab %W %x %y}\;[bind TNotebook <Button-1>];break"
|
||||
# bind <<NotebookTabChanged>> "NB::PressTab %W %x %y"
|
||||
|
||||
bind TNotebook <Button-1> "NB::CloseTab %W %x %y\;[bind TNotebook <Button-1>]"
|
||||
|
||||
# bind . <Control-Tab> "NB::NextTab $nbEditor"
|
||||
bind . <Control-Next> "NB::NextTab $nbEditor 1"
|
||||
bind . <Control-Prior> "NB::NextTab $nbEditor -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 \
|
||||
|
|
20
lib/menu.tcl
20
lib/menu.tcl
|
@ -17,14 +17,18 @@ proc GetFileMenu {m} {
|
|||
FileOper::Edit $filePath
|
||||
}
|
||||
}
|
||||
$m add command -label [::msgcat::mc "Save file"] -command {FileOper::Save}\
|
||||
-accelerator "Ctrl+S"
|
||||
$m add command -label [::msgcat::mc "Close file"] -command {FileOper::Close}\
|
||||
-accelerator "Ctrl+w"
|
||||
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
||||
set folderPath [FileOper::OpenFolderDialog]
|
||||
if {$folderPath != ""} {
|
||||
FileOper::ReadFolder $folderPath
|
||||
}
|
||||
}
|
||||
$m add command -label [::msgcat::mc "Save file"] -command {FileOper::Save}\
|
||||
-accelerator "Ctrl+S"
|
||||
$m add command -label [::msgcat::mc "Close folder"] -command {FileOper::CloseFolder}
|
||||
|
||||
#$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\
|
||||
#-font $fontNormal -accelerator "Ctrl+O" -state disable
|
||||
$m add separator
|
||||
|
@ -68,8 +72,18 @@ proc GetViewMenu {m} {
|
|||
|
||||
$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 separator
|
||||
$m add command -label [::msgcat::mc "View line numbers"] -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) -value none \
|
||||
-command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
||||
$m.editorWrap add radiobutton -label [::msgcat::mc "Char"] -variable cfgVariables(editorWrap) -value char \
|
||||
-command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
||||
$m.editorWrap add radiobutton -label [::msgcat::mc "Word"] -variable cfgVariables(editorWrap) -value word \
|
||||
-command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
||||
}
|
||||
|
||||
proc GetHelpMenu {m} {
|
||||
|
|
|
@ -19,8 +19,11 @@
|
|||
::msgcat::mcset ru "Braces foreground" "Цвет скобки"
|
||||
::msgcat::mcset ru "Cancel" "Отмена"
|
||||
::msgcat::mcset ru "Can't found file:" "Не найден файл:"
|
||||
::msgcat::mcset ru "Char" "Символ"
|
||||
::msgcat::mcset ru "Close" "Закрыть"
|
||||
::msgcat::mcset ru "Close all" "Закрыть все"
|
||||
::msgcat::mcset ru "Close file" "Закрыть файл"
|
||||
::msgcat::mcset ru "Close folder" "Закрыть папку"
|
||||
::msgcat::mcset ru "Close Project Manager?" "Выйти из программы?"
|
||||
::msgcat::mcset ru "Comments" "Коментарии"
|
||||
::msgcat::mcset ru "Comment selected" "Закоментировать"
|
||||
|
@ -113,6 +116,7 @@
|
|||
::msgcat::mcset ru "New project" "Новый проект"
|
||||
::msgcat::mcset ru "Not implemented yet" "Данная функция пока не реализована"
|
||||
::msgcat::mcset ru "Not found active project" "Не определен активный проект"
|
||||
::msgcat::mcset ru "None" "Нет"
|
||||
::msgcat::mcset ru "No" "Нет"
|
||||
::msgcat::mcset ru "Open" "Открыть"
|
||||
::msgcat::mcset ru "Open file" "Открыть файл"
|
||||
|
@ -193,6 +197,7 @@
|
|||
::msgcat::mcset ru "View line numbers" "Показывать номера строк"
|
||||
::msgcat::mcset ru "Warning" "Внимание"
|
||||
::msgcat::mcset ru "Was replacement" "Было заменено"
|
||||
::msgcat::mcset ru "Word wrapping" "Перенос слов"
|
||||
::msgcat::mcset ru "Word" "Слово"
|
||||
::msgcat::mcset ru "Editors word wrapping" "Перенос слов в редакторе"
|
||||
::msgcat::mcset ru "Work dir" "Рабочий каталог"
|
||||
::msgcat::mcset ru "Yes" "Да"
|
||||
|
|
|
@ -24,13 +24,31 @@ namespace eval NB {
|
|||
}
|
||||
}
|
||||
}
|
||||
puts "NB item - $fm"
|
||||
# puts "NB item - $fm"
|
||||
return $fm
|
||||
}
|
||||
|
||||
proc CloseTab {w x y} {
|
||||
proc PressTab {w x y} {
|
||||
$w select [$w identify tab $x $y]
|
||||
if {[$w identify $x $y] == "close_button"} {
|
||||
FileOper::Close
|
||||
} else {
|
||||
set txt [$w select].frmText.t
|
||||
focus -force $txt.t
|
||||
}
|
||||
}
|
||||
|
||||
proc NextTab {w step} {
|
||||
set i [expr [$w index end] - 1]
|
||||
set nbItemIndex [$w index [$w select]]
|
||||
if {$nbItemIndex eq 0 && $step eq "-1"} {
|
||||
$w select $i
|
||||
} elseif {$nbItemIndex eq $i && $step eq "1"} {
|
||||
$w select 0
|
||||
} else {
|
||||
$w select [expr $nbItemIndex + $step]
|
||||
}
|
||||
set txt [$w select].frmText.t
|
||||
focus -force $txt.t
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
|||
######################################################
|
||||
# Version: 2.0.0
|
||||
# Release: alpha
|
||||
# Build: 26082022165531
|
||||
# Build: 30082022164258
|
||||
######################################################
|
||||
|
||||
# определим текущую версию, релиз и т.д.
|
||||
|
|
Loading…
Reference in New Issue
Block a user