From 049873d9ec5f05f30968f4b2ef19245faa958114 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 11 Nov 2022 12:41:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B3=D0=BB=D1=8E=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor.tcl | 138 ++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 82 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index 675ae17..2425eb4 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -429,6 +429,10 @@ namespace eval Editor { variable txt variable win # set txt $w.frmText.t + # блокировка открытия диалога если запущен другой + if [winfo exists .findVariables] { + return + } set txt $w set win .varhelper puts "$x $y $w $word $wordType" @@ -587,7 +591,7 @@ namespace eval Editor { $txt tag remove lightSelected 1.0 end if { [winfo exists .varhelper] } { destroy .varhelper } - + puts $k switch $k { Return { regexp {^(\s*)} [$txt get [expr $lineNum - 1].0 [expr $lineNum - 1].end] -> spaceStart @@ -607,13 +611,22 @@ namespace eval Editor { Right { return } - Shift { + # Shift_L { + # return + # } + # Shift_R { + # return + # } + Control_L { return } - Controll { + Control_R { return } - Meta { + Alt_L { + return + } + Alt_R { return } } @@ -714,59 +727,19 @@ namespace eval Editor { # set txt $w.frmText.t bind $txt "catch {Editor::ReleaseKey %K $txt $fileType}" bind $txt "Editor::PressKey %K $txt" - # bind $txt.t "Editor::ReleaseKey %K $txt.t $fileType" - # bind $txt.t "Editor::PressKey %K $txt.t" - # bind $txt "Editor::Key %k %K" - #$txt tag bind Sel {puts ">>>>>>>>>>>>>>>>>>>"} - #bind $txt {puts "/////////////////"} - # #bind $txt GoToLine - bind $txt "Editor::GoToLineNumberDialog $txt" - bind $txt "Editor::FindDialog $w" - bind $txt "Editor::FindDialog $txt" - bind $txt "Editor::FindDialog $txt" - # bind $txt {FindNext $w.text 1} - # bind $txt ReplaceDialog - # bind $txt ReplaceDialog - # bind $txt {ReplaceCommand $w.text 1} - # bind $txt {FileDialog [$noteBookFiles raise] save} - # bind $txt {FileDialog [$noteBookFiles raise] save} - # bind $txt {FileDialog [$noteBookFiles raise] save_as} - # bind $txt {FileDialog [$noteBookFiles raise] save_as} - bind $txt FileOper::Close - bind $txt FileOper::Close - # bind $txt "tk_textCut $w.text;break" - # bind $txt "tk_textCut $w.text;break" - # bind $txt "tk_textCopy $txt" - # bind $txt "tk_textCopy $txt" bind $txt "Editor::SelectionPaste $txt" bind $txt "Editor::SelectionPaste $txt" - - #bind $txt "auto_completition $txt" - bind $txt "SearchVariable $txt" - # bind $txt "" - # bind $txt "" + bind $txt "SearchVariable $txt; break" bind $txt "ImageBase64Encode $txt" - bind $txt "Editor::InsertTabular $txt" bind $txt "Editor::DeleteTabular $txt" - bind $txt "Editor::Comment $txt $fileType" bind $txt "Editor::Uncomment $txt $fileType" bind $txt Find - #bind . PageTab - #bind . PageTab bind $txt {OverWrite} bind $txt "Editor::SearchBrackets $txt" - # bind [bind sysAfter ] - # bind $txt {catch [PopupMenuEditor %X %Y]} - # bind $txt "%W yview scroll -3 units" - # bind $txt "%W yview scroll 3 units" - #bind $txt "%W xview scroll -2 units" - #bind $txt "%W xview scroll 2 units" bind $txt "Editor::SelectionHighlight $txt" - # bind $txt <> "Editor::SelectionHighlight $txt" bind $txt <> "SetModifiedFlag $w" - # bind $txt <> "Editor::SelectionGet $txt" bind $txt ImageBase64Encode bind $txt "Editor::SearchBrackets %W" bind $txt "catch {Editor::GoToFunction $txt}" @@ -776,6 +749,12 @@ namespace eval Editor { bind $txt "$txt delete {insert linestart} insert" bind $txt "$txt delete insert {insert lineend}" bind $txt "Editor::SplitEditorH $w $fileType" + bind $txt "Editor::GoToLineNumberDialog $txt" + bind $txt "Editor::FindDialog $w" + bind $txt "Editor::FindDialog $txt" + bind $txt "Editor::FindDialog $txt" + bind $txt FileOper::Close + bind $txt FileOper::Close bind $txt { set filePath [FileOper::OpenDialog] if {$filePath != ""} { @@ -790,6 +769,38 @@ namespace eval Editor { } break } + # bind $txt.t "Editor::ReleaseKey %K $txt.t $fileType" + # bind $txt.t "Editor::PressKey %K $txt.t" + # bind $txt "Editor::Key %k %K" + #$txt tag bind Sel {puts ">>>>>>>>>>>>>>>>>>>"} + #bind $txt {puts "/////////////////"} + # #bind $txt GoToLine + # bind $txt {FindNext $w.text 1} + # bind $txt ReplaceDialog + # bind $txt ReplaceDialog + # bind $txt {ReplaceCommand $w.text 1} + # bind $txt {FileDialog [$noteBookFiles raise] save} + # bind $txt {FileDialog [$noteBookFiles raise] save} + # bind $txt {FileDialog [$noteBookFiles raise] save_as} + # bind $txt {FileDialog [$noteBookFiles raise] save_as} + # bind $txt "tk_textCut $w.text;break" + # bind $txt "tk_textCut $w.text;break" + # bind $txt "tk_textCopy $txt" + # bind $txt "tk_textCopy $txt" + + #bind $txt "auto_completition $txt" + # bind $txt "" + # bind $txt "" + #bind . PageTab + #bind . PageTab + # bind [bind sysAfter ] + # bind $txt {catch [PopupMenuEditor %X %Y]} + # bind $txt "%W yview scroll -3 units" + # bind $txt "%W yview scroll 3 units" + #bind $txt "%W xview scroll -2 units" + #bind $txt "%W xview scroll 2 units" + # bind $txt <> "Editor::SelectionHighlight $txt" + # bind $txt <> "Editor::SelectionGet $txt" } proc SearchBrackets {txt} { @@ -1458,40 +1469,3 @@ namespace eval Editor { return $fr } } - -# ctextBindings.tcl -# -# Copyright (C) 2012 Sedat Serper -# A similar script and functionality is implemented in tG² as of v1.06.01.41 -# -# proc ctext_binding4Tag {w tags} { - # # foreach tag $tags { - # $w tag bind $tag {%W config -cursor hand2} - # $w tag bind $tag {%W config -cursor xterm} - # $w tag bind $tag { - # set cur [::tk::TextClosestGap %W %x %y] - # if {[catch {%W index anchor}]} {%W mark set anchor $cur} - # set anchor [%W index anchor] - # set last [::tk::TextNextPos %W "$cur - 1c" tcl_wordBreakAfter] - # set first [::tk::TextPrevPos %W anchor tcl_wordBreakBefore] - # if {![catch {set tmp [%W get $first $last]}]} { - # ctext_execTagCmd $tmp - # } - # } - # } -# } -# -# -# THE DEMO -# -# # ----------------------- demo ------------------------------------------- -# # Open a new wish console and copy/paste the following complete script. -# # Clicking on parts that are highlighted and observe the console output... -# # Adjust procedure 'ctext_execTagCmd' to customize the handling 4 your application. -# package require ctext -# pack [ctext .t] -fill both -expand 1 -# ctext::addHighlightClass .t bindings purple [list ] -# ctext::addHighlightClass .t commands orange [list foreach proc if set catch] -# .t fastinsert end [info body ctext_binding4Tag] -# .t highlight 1.0 end -# ctext_binding4Tag .t {bindings commands}