Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Updates for next release |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7a78922f68faa673ee78a43e69670e1f |
User & Date: | kevin 2019-11-20 03:11:01 |
Context
2019-11-22
| ||
14:18 | Tweak images check-in: d1a9e51320 user: kevin tags: trunk | |
2019-11-20
| ||
03:11 | Updates for next release check-in: 7a78922f68 user: kevin tags: trunk | |
2019-11-18
| ||
02:56 | Tweak icons check-in: fe05cfa61c user: kevin tags: trunk | |
Changes
Changes to scriptlibs/textsweep/textsweep-main.tcl.
1 2 3 4 5 6 7 8 9 | # TextSweep: batch search-replace tool # Copyright (C) 2018 WordTech Communications LLC #MIT license #let's get started #initialize package requirements | < | > > > > > > > < < < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # TextSweep: batch search-replace tool # Copyright (C) 2018 WordTech Communications LLC #MIT license #let's get started #initialize package requirements package require fileutil package require tkdnd package require regproc package require machelp package require softwareupdate package require appname package require xplat package require tooltip image create photo upArrow -data { R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+ py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==} image create photo downArrow -data { R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+ py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=} image create photo noArrow -height 14 -width 14 if {[tk windowingsystem] eq "aqua"} { package require cocoaprint } if {[tk windowingsystem] eq "win32"} { package require dde dde servername TextSweep } |
︙ | ︙ | |||
63 64 65 66 67 68 69 | tk_messageBox -icon warning -title "Error" -message $args } } #make images for buttons et. al from files proc makeImage {} { | < < < | | < | | < < < | < < < < < < < | > > | > > > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | tk_messageBox -icon warning -title "Error" -message $args } } #make images for buttons et. al from files proc makeImage {} { #create the images set imagedir [file join [file dirname [info script]] images] set imagefiles [glob -directory $imagedir *.tcl] foreach item $imagefiles { source $item } softwareupdate::setIcon icon-update } #mac-only commands if {[tk windowingsystem] eq "aqua"} { proc ::tk::mac::OpenDocument {fname} { selectFileSystem $fname } #raise window if closed--dock click proc ::tk::mac::ReopenApplication {} { if { [wm state .] == "withdrawn"} { wm state . normal raise . } else { wm deiconify . raise . } } proc changeImagesDark {} { foreach item [image names] { if {[image type $item] eq "bitmap"} { $item configure -foreground white } } } proc changeImagesLight {} { foreach item [image names] { if {[image type $item] eq "bitmap"} { $item configure -foreground black } } } proc checkDarkMode {} { set mode [catch {exec defaults read -g AppleInterfaceStyle} msg] if {$msg eq "Dark"} { event generate . <<DarkAqua>> } else { event generate . <<LightAqua>> } } #handle program shutdown via command-q proc ::tk::mac::Quit {} { regproc::makePitch } } #"about application" command proc tkAboutDialog {} { aboutWindow } |
︙ | ︙ | |||
170 171 172 173 174 175 176 | menu .mb if {[tk windowingsystem] eq "aqua"} { menu .mb.apple .mb.apple add command -label "About TextSweep" -command tkAboutDialog | < | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | menu .mb if {[tk windowingsystem] eq "aqua"} { menu .mb.apple .mb.apple add command -label "About TextSweep" -command tkAboutDialog .mb.apple add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version" .mb.apple add separator .mb add cascade -label "TextSweep" -menu .mb.apple } menu .mb.search -tearoff -0 .mb.search add command -label "Select Directory" -command setDir .mb.search add command -label "Replace Text" -command batchReplace -accelerator "[xplat::controlkey]-H" .mb.search add command -label "Undo" -command batchUndo -accelerator "[xplat::controlkey]-Z" .mb add cascade -label "Search" -menu .mb.search if {[tk windowingsystem] eq "win32"} { .mb.search add command -label "Exit" -command regproc::makePitch; exit } if {[tk windowingsystem] eq "aqua"} { #window menu menu .mb.window .mb add cascade -label Window -menu .mb.window |
︙ | ︙ | |||
204 205 206 207 208 209 210 | .mb.help add command -label "Help" -command machelp::userhelp } .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail .mb.help add command -label "Web Site" -command machelp::appweb if {[tk windowingsystem] ne "aqua"} { .mb.help add command -label "About TextSweep" -command tkAboutDialog | < | | | | | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | .mb.help add command -label "Help" -command machelp::userhelp } .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail .mb.help add command -label "Web Site" -command machelp::appweb if {[tk windowingsystem] ne "aqua"} { .mb.help add command -label "About TextSweep" -command tkAboutDialog .mb.help add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version" } .mb add cascade -label "Help" -menu .mb.help . configure -menu .mb ttk::frame .f pack .f -fill both -expand yes pack [ttk::frame .f.buttons -padding 5] -side top -fill both -expand no pack [ ttk::separator .f.septop -orient vertical] -side top -fill both -expand no ttk::button .f.buttons.folder -image xbm_folder_sans_edit_32 -style Toolbutton -command setDir -takefocus 0 pack .f.buttons.folder -side left -expand no tooltip::tooltip .f.buttons.folder "Select the directory to search" ttk::button .f.buttons.search -image xbm_search_32 -style Toolbutton -command batchReplace -takefocus 0 pack .f.buttons.search -side left -expand no tooltip::tooltip .f.buttons.search "Replace text" ttk::button .f.buttons.reload -image xbm_refresh_32 -style Toolbutton -command batchUndo -takefocus 0 pack .f.buttons.reload -side left -expand no tooltip::tooltip .f.buttons.reload "Undo replace" ttk::frame .f.foldersearch -padding 5 pack .f.foldersearch -fill both -expand no -side top ttk::label .f.foldersearch.folder -text "Folder:" ttk::entry .f.foldersearch.foldervar -textvar folder |
︙ | ︙ | |||
273 274 275 276 277 278 279 | ttk::panedwindow .f.text -orient horizontal pack .f.text -side top -fill both -expand yes ttk::frame .f.text.list ttk::frame .f.text.display | | > | > > | | | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | ttk::panedwindow .f.text -orient horizontal pack .f.text -side top -fill both -expand yes ttk::frame .f.text.list ttk::frame .f.text.display #main data display ttk::treeview .f.text.list.listbox -columns {"File"} -show headings -yscrollcommand [list .f.text.list.scrollframe.scroll set] -displaycolumns #all .middle.right.upper.frame.listbox heading "File" -text "File" -anchor w pack .f.text.list.listbox -side left -fill both -expand yes bind .f.text.list.listbox <<TreeviewSelect>> highlightText tkdnd::drop_target register [.f.text.list.listbox bodypath] * bind .f.text.list.listbox <<Drop:DND_Files>> {selectFileSystem [join %D]} ttk::frame .f.text.list.scrollframe pack .f.text.list.scrollframe -fill y -expand no -side right ttk::scrollbar .f.text.list.scrollframe.scroll -command [list .f.text.list.listbox yview] pack .f.text.list.scrollframe.scroll -fill y -expand no -side right ttk::frame .f.text.frame pack .f.text.frame -fill both -expand yes text .f.text.frame.t -yscrollcommand [list .f.text.frame.scrollframe.scroll set] -borderwidth 0 -highlightthickness 3 -highlightcolor SlateGray3 -state disabled pack .f.text.frame.t -fill both -side left -expand yes ttk::frame .f.text.frame.scrollframe pack .f.text.frame.scrollframe -fill y -side right -expand no ttk::scrollbar .f.text.frame.scrollframe.scroll -command [list .f.text.frame.t yview] pack .f.text.frame.scrollframe.scroll -side right -fill y -expand no |
︙ | ︙ | |||
346 347 348 349 350 351 352 | global patternvar global searchterm global searchvar global filelist set searchterm $searchvar | | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | global patternvar global searchterm global searchvar global filelist set searchterm $searchvar catch {.f.text.list.listbox delete [.f.text.list.listbox children {}]} catch {clearText} set folder [tk_chooseDirectory -parent . -initialdir $::env(HOME)] if { $folder == ""} { return; # they clicked cancel } else { set filelist [glob -type f -nocomplain -directory [join $folder] $patternvar] foreach item $filelist { if {[checkTextType $item] >= 0} { .f.text.list.listbox insert {} end [list $item] } } return [join $folder] } } |
︙ | ︙ | |||
556 557 558 559 560 561 562 | global patternvar global searchterm global searchvar global filelist set selectedfile [ .f.text.list.listbox get [ .f.text.list.listbox curselection]] | | | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | global patternvar global searchterm global searchvar global filelist set selectedfile [ .f.text.list.listbox get [ .f.text.list.listbox curselection]] .f.text.list.listbox delete [.f.text.list.listbox children {}] clearText set filelist [glob -type f -nocomplain -directory [join $folder] $patternvar] foreach item $filelist { if {[checkTextType $item] >= 0} { .f.text.list.listbox insert {} end [list $item] } } set newselectedfile [ .f.text.list.listbox searchcolumn 0 [join $selectedfile] -start 0 ] .f.text.list.listbox see $newselectedfile .f.text.list.listbox selection set $newselectedfile .f.text.list.listbox selection anchor $newselectedfile |
︙ | ︙ | |||
588 589 590 591 592 593 594 | global filelist global patternvar global searchterm global searchvar set searchterm $searchvar | | | | < < < < < < < < < < < < < < < < < | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | global filelist global patternvar global searchterm global searchvar set searchterm $searchvar catch [.f.text.list.listbox delete [.f.text.list.listbox children {}] ] catch {clearText} if {[file isfile $fname]} { return } if {[file isdir $fname]} { set folder $fname .f.text.list.listbox delete [.f.text.list.listbox children {}] clearText set filelist [glob -type f -nocomplain -directory [join $folder] $patternvar] foreach item $filelist { if {[checkTextType $item] >= 0} { .f.text.list.listbox insert {} end [list $item] } } return [join $folder] } } #proc to determine if filetype is text proc checkTextType {file} { lsearch [fileutil::fileType $file] "text" } #initialize the app proc startUp {} { global appname global appversion global datadir |
︙ | ︙ | |||
694 695 696 697 698 699 700 | global folder global filename global filelist global patternvar global searchterm global searchvar | | | | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | global folder global filename global filelist global patternvar global searchterm global searchvar catch [.f.text.list.listbox delete [.f.text.list.listbox children {}]] catch {clearText} if {[file isfile $folder]} { return } if {[file isdir $folder]} { .f.text.list.listbox delete [.f.text.list.listbox children {}] clearText set filelist [glob -type f -nocomplain -directory [join $folder] $patternvar] foreach item $filelist { if {[checkTextType $item] >= 0} { .f.text.list.listbox insert {} end [list $item] } } } batchReplace } trace add variable searchvar write updateSearchTerm startUp |