From 654819d192ce3ff8c27d88a910a607afd09c3bf9 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Thu, 3 Nov 2022 15:58:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=B8=D0=BB=D0=B4=D0=B8?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5?= =?UTF-8?q?=D0=B4=D1=83=D1=80=D1=8B=20=D0=B0=D0=B2=D1=82=D0=BE=D0=B2=D0=B2?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20=D0=B8=D0=BC=D0=B5=D0=BD=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor.tcl | 124 +++++++++++++++++++++++++--------------------- lib/menu.tcl | 24 ++++++--- lib/msgs/ru.msg | 4 +- lib/procedure.tcl | 9 ++++ projman.tcl | 2 +- 5 files changed, 99 insertions(+), 64 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index e48e18a..a7114f2 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -366,6 +366,51 @@ namespace eval Editor { } } + proc VarHelperKey { widget K A } { + set win .varhelper + set ind [$win.lBox curselection] + puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + + switch -- $K { + Prior { + set up [expr [$win.lBox index active] - [$win.lBox cget -height]] + if { $up < 0 } { set up 0 } + $win.lBox activate $up + $win.lBox selection clear 0 end + $win.lBox selection set $up $up + } + Next { + set down [expr [$win.lBox index active] + [$win.lBox cget -height]] + if { $down >= [$win.lBox index end] } { set down end } + $win.lBox activate $down + $win.lBox selection clear 0 end + $win.lBox selection set $down $down + } + Up { + set up [expr [$win.lBox index active] - 1] + if { $up < 0 } { set up 0 } + $win.lBox activate $up + $win.lBox selection clear 0 end + $win.lBox selection set $up $up + } + Down { + set down [expr [$win.lBox index active] + 1] + if { $down >= [$win.lBox index end] } { set down end } + $win.lBox activate $down + $win.lBox selection clear 0 end + $win.lBox selection set $down $down + } + Return { + $widget delete "insert - 1 chars wordstart" "insert wordend - 1 chars" + $widget insert "insert" [$win.lBox get [$win.lBox curselection]] + eval [bind VarHelperBind ] + } + default { + $widget insert "insert" $A + eval [bind VarHelperBind ] + } + } + } ;# proc auto_completition_key proc VarHelper {x y w word} { global editors lexers variables @@ -375,7 +420,16 @@ namespace eval Editor { set txt $w set win .varhelper # puts "$x $y $w $word" - set varList [dict get $editors $txt variableList] + if {[dict exists $editors $txt variableList] != 0} { + set varList [dict get $editors $txt variableList] + } + if {[dict exists $editors $txt procedureList] != 0} { + set procList [dict get $editors $txt procedureList] + } + if {[dict exists $editors $txt variableList] == 0 && [dict exists $editors $txt procedureList] == 0} { + return + } + set findedVars "" foreach i [lsearch -all $varList $word*] { # puts [lindex $varList $i] @@ -385,6 +439,11 @@ namespace eval Editor { lappend findedVars $item } } + + bindtags $txt [list VarHelperBind [winfo toplevel $txt] $txt Text sysAfter all] + bind VarHelperBind "bindtags $txt {[list [winfo toplevel $txt] $txt Text sysAfter all]}; catch { destroy .varhelper }" + bind VarHelperBind {Editor::VarHelperKey %W %K %A ; break} + if { [winfo exists $win] } { destroy $win } if {$findedVars eq ""} { return @@ -394,11 +453,8 @@ namespace eval Editor { wm transient $win . wm overrideredirect $win 1 - # listbox $win.lBox -width 30 -border 2 -yscrollcommand "$win.yscroll set" -border 1 - # ttk::scrollbar $win.yscroll -orient vertical -command "$win.lBox yview" listbox $win.lBox -width 30 -border 2 -border 1 pack $win.lBox -expand true -fill y -side left - # pack $win.yscroll -side left -expand false -fill y foreach { word } $findedVars { $win.lBox insert end $word @@ -408,16 +464,8 @@ namespace eval Editor { if { [set height [llength $findedVars]] > 10 } { set height 10 } $win.lBox configure -height $height - # bindtags $win.lBox [list VarHelperBind [winfo toplevel $win.lBox] $win.lBox Text sysAfter all] - # bind VarHelperBind "bindtags $win.lBox {[list [winfo toplevel $win.lBox] $win.lBox Text sysAfter all]}; catch { destroy .varhelper }" - bind $txt { - bind $Editor::txt {} - destroy $Editor::win - focus -force $Editor::txt.t - break - } + bind $win { - bind $txt {} destroy $Editor::win focus -force $Editor::txt.t break @@ -427,51 +475,15 @@ namespace eval Editor { focus -force $Editor::txt.t break } - bind $win.lBox { - set findString [dict get $lexers [dict get $editors $Editor::txt fileType] procFindString] - set values [.varhelper.lBox get [.varhelper.lBox curselection]] - regsub -all {PROCNAME} $findString $values str - Editor::FindFunction $Editor::txt "$str" - destroy .varhelper.lBox - # focus $Editor::txt.t - # bind $Editor::txt "Editor::ReleaseKey %K $txt" - # bind $Editor::txt "Editor::PressKey %K $txt" - # bind $Editor::txt "" - # bind $Editor::txt "" - break - } - - # bind $txt "" - # bind $txt "" - # bind $txt { - # set index [.varhelper.lBox index active] - # .varhelper.lBox selection clear $index $index - # set index [expr $index + 1] - # puts $index - # .varhelper.lBox activate $index - # .varhelper.lBox selection set $index $index + # bind $win.lBox { + # set findString [dict get $lexers [dict get $editors $Editor::txt fileType] procFindString] + # set values [.varhelper.lBox get [.varhelper.lBox curselection]] + # regsub -all {PROCNAME} $findString $values str + # Editor::FindFunction $Editor::txt "$str" + # destroy .varhelper.lBox + # # focus $Editor::txt.t # break # } - # bind $txt { - # set index [.varhelper.lBox index active] - # .varhelper.lBox selection clear $index $index - # if {$index eq "0" } { - # set index [.varhelper.lBox size] - # } else { - # set index [expr $index - 1] - # } - # puts $index - # .varhelper.lBox activate $index - # .varhelper.lBox selection set $index $index - # break - # } - # bind $win.lBox { - # set index [.varhelper.lBox curselection] - # puts $index - # # .varhelper.lBox selection set [incr index] 0 - # .varhelper.lBox activate $index - # } - # # bind $win.lBox {Editor::ListBoxSearch %W %A} # Определям расстояние до края экрана (основного окна) и если # оно меньше размера окна со списком то сдвигаем его вверх diff --git a/lib/menu.tcl b/lib/menu.tcl index 9e7504c..f7c2e9a 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -81,12 +81,24 @@ proc GetViewMenu {m} { 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)" + $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)" + + $m add separator + menu $m.editorHelper + $m add cascade -label [::msgcat::mc "Editor helpers"] -menu $m.editorHelper + $m.editorHelper add checkbutton -label [::msgcat::mc "Variables"] \ + -variable cfgVariables(variableHelper) -onvalue true -offvalue false + # -command "ViewHelper variableHelper" + + $m.editorHelper add checkbutton -label [::msgcat::mc "Procedures"] \ + -variable cfgVariables(procedureHelper) -onvalue true -offvalue false + # -command "ViewHelper procedureHelper" + } proc GetHelpMenu {m} { diff --git a/lib/msgs/ru.msg b/lib/msgs/ru.msg index 0410b14..cde8f9d 100644 --- a/lib/msgs/ru.msg +++ b/lib/msgs/ru.msg @@ -74,6 +74,7 @@ ::msgcat::mcset ru "Editor font" "Шрифт редактора" ::msgcat::mcset ru "Editor font bold" "Шрифт редактора жирный" ::msgcat::mcset ru "Editor settings" "Настройки редактора" +::msgcat::mcset ru "Editor helpers" "Подсказки при вводе" ::msgcat::mcset ru "Encode" "Перекодировка" ::msgcat::mcset ru "Authorisation required" "Требуется авторизация" ::msgcat::mcset ru "Error open URL" "Ошибка открытия URL" @@ -140,7 +141,6 @@ ::msgcat::mcset ru "Operators" "Операторы" ::msgcat::mcset ru "Overwrite" "Замена" ::msgcat::mcset ru "Parameters" "Параметры" -::msgcat::mcset ru "Subparameters" "Субпараметры" ::msgcat::mcset ru "Password" "Пароль" ::msgcat::mcset ru "Paste" "Вставить" ::msgcat::mcset ru "Paste from clipboard" "Вставить из буфера" @@ -149,6 +149,7 @@ ::msgcat::mcset ru "Print" "Печать" ::msgcat::mcset ru "Print command" "Команда печати" ::msgcat::mcset ru "Print selected text" "Печатать выделенный текст" +::msgcat::mcset ru "Procedures" "Процедуры" ::msgcat::mcset ru "Procedure name" "Имя процедуры" ::msgcat::mcset ru "Procedure name complit" "Автодобивка процедуры" ::msgcat::mcset ru "Program finished successfully" "Выполнение завершено" @@ -198,6 +199,7 @@ ::msgcat::mcset ru "Specify the absolute path to the directory or file" "Укажите полный путь к каталогу или файлу" ::msgcat::mcset ru "Split edit window" "Разделить окно редактора" ::msgcat::mcset ru "SQL commands" "SQL команды" +::msgcat::mcset ru "Subparameters" "Субпараметры" ::msgcat::mcset ru "Text autoformat" "Автоформат текста" ::msgcat::mcset ru "Thanks" "Благодарности" ::msgcat::mcset ru "Title normal" "Файл нормальный" diff --git a/lib/procedure.tcl b/lib/procedure.tcl index c658ed2..300537a 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -55,6 +55,15 @@ proc ViewLineNumbers {} { } } +proc ViewHelper {helper} { + global cfgVariables + # Changed global settigs + if {$cfgVariables($helper) eq "true"} { + set cfgVariables($helper) false + } else { + set cfgVariables($helper) true + } +} proc Del {} { return } diff --git a/projman.tcl b/projman.tcl index 609e419..2d403e7 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 02112022161805 +# Build: 03112022103747 ###################################################### # определим текущую версию, релиз и т.д.