From d4f11b11de401aa38948eb022c052b83cd7c433a Mon Sep 17 00:00:00 2001 From: svkalinin Date: Wed, 31 Aug 2022 17:00:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83=D1=80=D1=8B=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B0=20=D0=B8=20=D0=B7=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20(=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20=D0=BA=D1=80?= =?UTF-8?q?=D0=B8=D0=B2=D0=BE=20=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=B5=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor.tcl | 153 ++++++++++++++++++++++++++++++++++++++++-- lib/image_library.tcl | 87 ++++++++++++++++++++++++ projman.tcl | 2 +- 3 files changed, 236 insertions(+), 6 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index 7f4ff86..e47007c 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -430,8 +430,9 @@ namespace eval Editor { #bind $txt {puts "/////////////////"} # #bind $txt GoToLine # bind $txt {focus .frmTool.frmGoto.entGoTo; .frmTool.frmGoto.entGoTo delete 0 end} - # bind $txt Find - # bind $txt Find + bind $txt "Editor::FindDialog $w" + bind $txt "Editor::FindDialog $w" + bind $txt "Editor::FindDialog $w" # bind $txt {FindNext $w.text 1} # bind $txt ReplaceDialog # bind $txt ReplaceDialog @@ -476,8 +477,8 @@ namespace eval Editor { bind $txt <> "Editor::SelectionGet $txt" bind $txt ImageBase64Encode bind $txt "Editor::SearchBrackets %W" - bind $txt "Editor::GoToFunction $w" - bind $txt "Editor::GoToFunction $w" + bind $txt "Editor::GoToFunction $w" + bind $txt "Editor::GoToFunction $w" bind $txt "$txt delete {insert wordstart} {insert wordend}" bind $txt "$txt delete {insert linestart} {insert lineend}" bind $txt "$txt delete {insert linestart} insert" @@ -765,7 +766,149 @@ namespace eval Editor { wm geom $win +$x+$y } - + proc FindReplaceText {findString replaceString case regexp} { + global nbEditor + set txt [$nbEditor select].frmText.t + # $txt see $pos + # set pos [$txt search -nocase $findString $line.$x end] + set options "" + # $txt see 1.0 + set pos [$txt index insert] + set allLines [$txt count -lines 1.0 end] + puts "$pos $allLines" + set line [lindex [split $pos "."] 0] + + if [expr $line == $allLines] { + set pos "0.0" + set line [lindex [split $pos "."] 0] + } + set x [lindex [split $pos "."] 1] + # incr x $incr + + puts "$findString -> $replaceString, $case, $regexp, $pos" + + if {$case ne ""} { + lappend options $case + } + if {$regexp ne ""} { + lappend options $regexp + } + + # set pos [$txt search $options $findString $pos end] + set pos [$txt search $options $findString $line.$x end] + + $txt mark set insert $pos + $txt see $pos + puts $pos + # highlight the found word + set line [lindex [split $pos "."] 0] + # set x [lindex [split $pos "."] 1] + # set x [expr {$x + [string length $findString]}] + # $txt tag remove sel 1.0 end + # $txt tag add sel $pos $line.end + # #$text tag configure sel -background $editor(selectbg) -foreground $editor(fg) + # $txt tag raise sel + # focus -force $txt.t + # Position + return 1 + } + + # Find and replace text dialog + proc FindDialog {w} { + global editors lexers nbEditor nocaseSet regexpSet + variable txt + variable win + variable show + + + set findString "" + set replaceString "" + + set txt $w.frmText.t + set win .finddialog + set regexpSet "" + set nocaseSet "-nocase" + + if { [winfo exists $win] } { destroy $win } + toplevel $win + wm transient $win . + wm overrideredirect $win 1 + + ttk::entry $win.entryFind -width 30 -textvariable findString + ttk::entry $win.entryReplace -width 30 -textvariable replaceString + + set show($win.entryReplace) false + + + ttk::button $win.bForward -image forward_20x20 -command "puts $findString" + ttk::button $win.bBackward -image backward_20x20 -command "puts $replaceString" + ttk::button $win.bDone -image done_20x20 -command { + puts "$findString -> $replaceString, $nocaseSet, $regexpSet" + } + ttk::button $win.bDoneAll -image doneall_20x20 + ttk::button $win.bReplace -image replace_20x20 \ + -command { + puts $Editor::show($Editor::win.entryReplace) + if {$Editor::show($Editor::win.entryReplace) eq "false"} { + grid $Editor::win.entryReplace -row 1 -column 0 -columnspan 2 -sticky nsew + grid $Editor::win.bDone -row 1 -column 3 -sticky e + grid $Editor::win.bDoneAll -row 1 -column 4 -sticky e + set Editor::show($Editor::win.entryReplace) "true" + } else { + grid remove $Editor::win.entryReplace $Editor::win.bDone $Editor::win.bDoneAll + set Editor::show($Editor::win.entryReplace) "false" + } + } + ttk::checkbutton $win.chkRegexp -text "Regexp" \ + -variable regexpSet -onvalue "-regexp" -offvalue "" + ttk::checkbutton $win.chkCase -text "Case Sensitive" \ + -variable nocaseSet -onvalue "" -offvalue "-nocase" + + grid $win.entryFind -row 0 -column 0 -columnspan 2 -sticky nsew + grid $win.bForward -row 0 -column 3 -sticky e + grid $win.bBackward -row 0 -column 4 -sticky e + grid $win.bReplace -row 0 -column 5 -sticky e + grid $win.chkRegexp -row 2 -column 0 -sticky w + grid $win.chkCase -row 2 -column 1 -sticky w + + # puts "[grid bbox $win] [grid size $win]" + # pack $win.lBox -expand true -fill y -side left + # pack $win.yscroll -side left -expand false -fill y + + set boxX [expr [winfo rootx $w] + [expr [winfo width $nbEditor] - 350]] + set boxY [expr [winfo rooty $w] + 10] + + bind $win { + destroy $Editor::win + focus -force $Editor::txt.t + break + } + bind $win.entryFind { + destroy $Editor::win + focus -force $Editor::txt.t + break + } + bind $win.entryFind { + # set findString [$win.entryFind get] + Editor::FindReplaceText "$findString" "" $nocaseSet $regexpSet + # destroy .gotofunction + # $Editor::txt tag remove sel 1.0 end + # focus $Editor::txt.t + break + } + bind $win.entryReplace { + # set findString [$win.entryFind get] + Editor::FindReplaceText {$findString} {$replaceString} $nocaseSet $regexpSet + # destroy .gotofunction + # $Editor::txt tag remove sel 1.0 end + # focus $Editor::txt.t + break + } + + wm geom $win +$boxX+$boxY + focus -force $win.entryFind + } + proc Editor {fileFullPath nb itemName} { global cfgVariables editors set fr $itemName diff --git a/lib/image_library.tcl b/lib/image_library.tcl index ff04624..13b4292 100644 --- a/lib/image_library.tcl +++ b/lib/image_library.tcl @@ -661,3 +661,90 @@ image create photo spec_16x12 -data { MSDdKO1goN1wGw7ZTadsy5KsqhgFAevxmNnh8HKPtnFNE9t+/4zW4Nzb3F6Bpzc+uPn0G7+rO3zt PNdb1iTgAAAAAElFTkSuQmCC } +image create photo backward_20x20 -data { + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9 + kT1Iw1AUhU9bpVUqDnYQEcxQnSyIioiTVqEIFUKt0KqDyUv/oElDkuLiKLgWHPxZrDq4OOvq4CoI + gj8gjk5Oii5S4n1JoUWMFx7v47x7Du/dB/jrZaaaHWOAqllGKhEXMtlVIfiKEIbQBR9mJGbqc6KY + hGd93VMf1V2MZ3n3/Vk9Ss5kgE8gnmW6YRFvEE9tWjrnfeIIK0oK8TnxqEEXJH7kuuzyG+eCw36e + GTHSqXniCLFQaGO5jVnRUIkniaOKqlG+P+OywnmLs1qusuY9+QvDOW1lmeu0BpHAIpYgQoCMKkoo + w0KMdo0UEyk6j3v4Bxy/SC6ZXCUwciygAhWS4wf/g9+zNfMT425SOA50vtj2xzAQ3AUaNdv+Prbt + xgkQeAautJa/UgemP0mvtbToEdC7DVxctzR5D7jcAfqfdMmQHClAy5/PA+9n9E1ZoO8W6F5z59Y8 + x+kDkKZZJW+Ag0NgpEDZ6x7vDrXP7d+e5vx+AHqMcqqG+o//AAAABmJLR0QAAAAAAAD5Q7t/AAAA + CXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5ggfDAwnNGZdNAAAABl0RVh0Q29tbWVudABD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E1ZoO8W6F5z59Y8 +x+kDkKZZJW+Ag0NgpEDZ6x7vDrXP7d+e5vx+AHqMcqqG+o//AAAABmJLR0QAAAAAAAD5Q7t/AAAA +CXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH5ggfDAgpt7K1NwAAAZ9JREFUOMtjYBgFgw4wk6Mp +JytrQ3hExNLfv39fePDgwX0GBoa/MDkmUg1Lio8v1tbV9f/18yfj5cuXYxgYGLiR5UkyMDo62lBH +X7/r39+/DJs3bXr65s2bq4yMjF+Q1bAQ7bKkJG4FeflDXFxcTDu3b/947MSJHQwMDEv+////G6cL +01JSpnV3d//1cvfKZ2Bg4EOWExIUPCkuIcFz4fz5n+s3bjzMwMCwjIGB4S66xSgu/Pj5810uLi4m +Owfb/revX/xW09Y+tnjx4hsZaWmTVNXUtJ88fvx3+YoV5xkYGFYwMDDsJxjLV69evSksKGirrqEh +JyIm5r527drt/t7+Vkamxg3fv337v2zJkruPnz5dwsjIOJeBgeEfNgMZsYjJ5eXmntHW0RG9dePm +F3FJCU4eHh7m1atXv9y/f/8SBgaGDgYGhjekpMOPb96+3a2kqJisoKjIycHBwXT44MEvm7ds2c7A +wDCNgYHhPjlpl4mBgcGwtaXlb15u7i8GBoadDAwMXjDJoKAgLnLSMAMDA4M+1FXxWCxkGS1oaAMA +XcmM9siOlSAAAAAASUVORK5CYII= +} diff --git a/projman.tcl b/projman.tcl index 9f2f875..84063fa 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 30082022164258 +# Build: 31082022165947 ###################################################### # определим текущую версию, релиз и т.д.