Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added macro manager and ability to exec sh macros |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | e7ac87b7c4afbbf2538bd2ccbbefe8a4402bf6f8 |
User & Date: | dennis 2000-08-18 23:51:41 |
Context
2000-08-22
| ||
01:08 | Added compensation factors for geometry management check-in: bb2981d67e user: dennis tags: trunk | |
2000-08-18
| ||
23:51 | Added macro manager and ability to exec sh macros check-in: e7ac87b7c4 user: dennis tags: trunk | |
2000-08-05
| ||
00:49 | Added textshell + cleaned up gui.tcl check-in: 59de1ec366 user: dennis tags: trunk | |
Changes
Changes to lib/Macro_Dialog.mac.
1 2 3 4 5 |
#-------------------------------------------------------------------------
# Sample macro file for Tcl TextEdit 0.9.7
#-------------------------------------------------------------------------
Dialog TestDlg "Enter your name: "
|
> < |
1 2 3 4 5 |
#-------------------------------------------------------------------------
# Sample macro file for Tcl TextEdit 0.9.7
#-------------------------------------------------------------------------
macro::manager
|
Changes to lib/TCL-Exec.mac.
1 2 3 4 5 6 7 8 9 |
#------------------------------------------------------------------------- # Sample macro file for Tcl TextEdit 0.9.7 #------------------------------------------------------------------------- #This macro execute the current the file in the currently- # visible window global window current_window exec "wish" $window($current_window,name) |
> | | > > |
1 2 3 4 5 6 7 8 9 10 11 12 |
#!/bin/sh #------------------------------------------------------------------------- # Sample macro file for Tcl TextEdit 0.9.7 #------------------------------------------------------------------------- #This macro execute the current the file in the currently- # visible window #global window current_window #exec "wish" $window($current_window,name) ls |
Changes to lib/cfg.tcl.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
{recent4} {} {recent5} {} {recent6} {} {flist} {1} {textshell} {0} {speed} {HelloWorld TCL-Exec} {tearoff} {0} {key-paste} {Shift-Insert} {key-copy} {Control-Insert} {key-copycut} {Control-Delete} {key-delline} {Control-y|Control-Y} {key-texteval} {Control-e|Control-E} {key-deltoeol} {Control-t|Control-T} {key-deleow} {Control-w|Control-W} |
> |
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
{recent4} {}
{recent5} {}
{recent6} {}
{flist} {1}
{textshell} {0}
{speed} {HelloWorld TCL-Exec}
{tearoff} {0}
{key-macromgr} {Control-F11}
{key-paste} {Shift-Insert}
{key-copy} {Control-Insert}
{key-copycut} {Control-Delete}
{key-delline} {Control-y|Control-Y}
{key-texteval} {Control-e|Control-E}
{key-deltoeol} {Control-t|Control-T}
{key-deleow} {Control-w|Control-W}
|
Changes to lib/gui.tcl.
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
$menu add command -label "Replace" -underline 0 -command "Find replace" $menu add command -label "FindNext" -accelerator [gbn key-searchagain ] -underline 4 -command FindIt $menu add command -label "Goto line" -underline 0 -accelerator [gbn key-goto ] -command Goto_line_ask set menu .menu.macromenu xmenu $menu .menu add cascade -label "Macro" -underline 0 -menu $menu set menu .menu.windowmenu xmenu $menu .menu add cascade -label "Windows" -underline 0 -menu $menu set menu .menu.helpmenu xmenu $menu .menu add cascade -label "Help" -underline 0 -menu $menu |
< |
305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
$menu add command -label "Replace" -underline 0 -command "Find replace" $menu add command -label "FindNext" -accelerator [gbn key-searchagain ] -underline 4 -command FindIt $menu add command -label "Goto line" -underline 0 -accelerator [gbn key-goto ] -command Goto_line_ask set menu .menu.macromenu xmenu $menu .menu add cascade -label "Macro" -underline 0 -menu $menu set menu .menu.windowmenu xmenu $menu .menu add cascade -label "Windows" -underline 0 -menu $menu set menu .menu.helpmenu xmenu $menu .menu add cascade -label "Help" -underline 0 -menu $menu |
Changes to lib/helpfile.
326
327
328
329
330
331
332
333
334
335
336
337
338
339
...
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
#? Press INDEX to get to the index page
#? Press BACK to go to the recently accessed page
#? Press FORWARD to go to the page you were on when you pressed the BACK button
#? To exit help choose anoter window in the Windows menu
#?
#? If you want to send me a message here is my mail address %lAbout%
#?
#?-Macros
#?
#? Tcltextedit has the ability to record and play macros.
#? Macros are by default stored in $HOME/.tcltextedit/???.mac
#? where ??? stands for the name of the macro.
#? The macro files are plain tcl scripts, that makes it possible
#? for any person with knowledge of tcl to customize your own macros.
................................................................................
#?
#? The just use the editor as usual and all your actions will be recorded.
#?
#? To stop recording shoose: Macro->Stop recording, and a prompt will
#? appear asking you to shoose a name for your macro.
#? When you hit the Ok button your macro will be stored.
#?
#? Related topics: %lSPEEDBUTTONS%
#?
#?-mclistbox.tcl
#? Copyright (c) 1999, Bryan Oakley
#? All Rights Reservered
#?
#? Bryan Oakley
#? oakley@channelpoint.com
#?
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
#? Press INDEX to get to the index page #? Press BACK to go to the recently accessed page #? Press FORWARD to go to the page you were on when you pressed the BACK button #? To exit help choose anoter window in the Windows menu #? #? If you want to send me a message here is my mail address %lAbout% #? if { [string first "#?-" $s ] == 0 } { set result "$result {%i[string range $s 3 end ]%}" } if { [string first "#?-" $s ] == 0 } { while {![eof $f] && [string first "#?-" $s ] != 0} { if { [string first "#?-" $s ] == 0 } { #?-Macros #? #? Tcltextedit has the ability to record and play macros. #? Macros are by default stored in $HOME/.tcltextedit/???.mac #? where ??? stands for the name of the macro. #? The macro files are plain tcl scripts, that makes it possible #? for any person with knowledge of tcl to customize your own macros. ................................................................................ #? #? The just use the editor as usual and all your actions will be recorded. #? #? To stop recording shoose: Macro->Stop recording, and a prompt will #? appear asking you to shoose a name for your macro. #? When you hit the Ok button your macro will be stored. #? #? Related topics: %lSPEEDBUTTONS% %lMACRO_MANAGER% %lMACRO_EDITING% #? #?-Macro_Manager #? #? The macro manager is a dialog that will help you to manage your macro #? files. #? #? You can use it to edit/delete/rename and make new macro files. #? #? Related topics: %lMACROS% %lMACRO_EDITING% #? #?-Macro_Editing #? #? There are currently tow ways to create macro files from within the #? text editor. #? #? %2 1. Record macro% #? #? %2 2. Create macro files with the% %lMACRO_MANAGER% #? #? There are also two different types of macros. #? #? %2 1. Tk/Tcl macro files.% #? This type is automatically created when a macro is recorded. #? #? %2 2. Shell macro files.% #? This type of macro files must be created from the %lMACRO_MANAGER% #? #? These files must contain "#!/bin/sh" as the first line, otherwise #? the texteditor won't recognise it as a shell macro. #? #? When a shell macro is executed it will either be executed in the #? background, or if the TextShell window is open, it will be executed there. #? #? Related topics: %lMACROS% %lMACRO_MANAGER% #?-mclistbox.tcl #? Copyright (c) 1999, Bryan Oakley #? All Rights Reservered #? #? Bryan Oakley #? oakley@channelpoint.com #? |
Changes to lib/macro.tcl.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 ... 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 ... 198 199 200 201 202 203 204 205 206 207 |
#? #? The just use the editor as usual and all your actions will be recorded. #? #? To stop recording shoose: Macro->Stop recording, and a prompt will #? appear asking you to shoose a name for your macro. #? When you hit the Ok button your macro will be stored. #? #? Related topics: %lSPEEDBUTTONS% #? namespace eval macro { namespace export rec play new buttonconf update names files proc names {} { global home installdir set k [glob -nocomplain "$home/*.mac"] set n "" for {set i 0} {$i <[llength $k] } {incr i } { set n "$n {[file rootname [file tail [lindex $k $i]]]}" } set k [glob -nocomplain "$installdir/*.mac"] for {set i 0} {$i <[llength $k] } {incr i } { set n "$n {[file rootname [file tail [lindex $k $i]]]}" } return $n } proc update {} { global c home .menu.macromenu delete 0 end .menu.macromenu add command -label "Record macro" -underline 0 -accelerator "($c(key-newmacro))" -command macro::new .menu.macromenu add separator set k [macro::names] foreach n $k { .menu.macromenu add command -label $n -command "macro::play {$n}" } ................................................................................ puts $f $macro_data nonewline close $f macro::update speed::Update } proc play {n} { global macro_data cu_macro current_window installdir home last_macro macro::rec macro::play $n if {[file exists "$home/$n.mac"]==1} { set last_macro $n source "$home/$n.mac" return } if {[file exists "$installdir/$n.mac"]==1} { set last_macro $n source "$installdir/$n.mac" return } } proc store {} { global url current_window window c current_macro r c set current_macro "" set ou .ou catch {destroy $ou} ................................................................................ grab $ou powin $ou vwait r destroy $ou return $r } } |
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | > | | | | > | < > < > | | | > > > > > | < | > > > > > > | < | > > | | > > > > > > > > > > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 ... 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 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 228 229 230 231 232 233 234 235 236 ... 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 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 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 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 405 406 407 408 409 410 |
#? #? The just use the editor as usual and all your actions will be recorded. #? #? To stop recording shoose: Macro->Stop recording, and a prompt will #? appear asking you to shoose a name for your macro. #? When you hit the Ok button your macro will be stored. #? #? Related topics: %lSPEEDBUTTONS% %lMACRO_MANAGER% %lMACRO_EDITING% #? #?-Macro_Manager #? #? The macro manager is a dialog that will help you to manage your macro #? files. #? #? You can use it to edit/delete/rename and make new macro files. #? #? Related topics: %lMACROS% %lMACRO_EDITING% #? #?-Macro_Editing #? #? There are currently tow ways to create macro files from within the #? text editor. #? #? %2 1. Record macro% #? #? %2 2. Create macro files with the% %lMACRO_MANAGER% #? #? There are also two different types of macros. #? #? %2 1. Tk/Tcl macro files.% #? This type is automatically created when a macro is recorded. #? #? %2 2. Shell macro files.% #? This type of macro files must be created from the %lMACRO_MANAGER% #? #? These files must contain "#!/bin/sh" as the first line, otherwise #? the texteditor won't recognise it as a shell macro. #? #? When a shell macro is executed it will either be executed in the #? background, or if the TextShell window is open, it will be executed there. #? #? Related topics: %lMACROS% %lMACRO_MANAGER% namespace eval macro { namespace export rec play new buttonconf update names files manager realnames proc realnames {} { global home installdir set k [glob -nocomplain "$home/*.mac"] set n $k set k [glob -nocomplain "$installdir/*.mac"] set n "$n $k" return $n } proc names {} { set n "" foreach k [macro::realnames] { set n "$n {[file rootname [file tail $k]]}" } return $n } proc update {} { global c home .menu.macromenu delete 0 end .menu.macromenu add command -label "Record macro" -underline 0 -accelerator "($c(key-newmacro))" -command macro::new .menu.macromenu add command -label "Macro manager" -underline 7 -accelerator "($c(key-macromgr))" -command macro::manager .menu.macromenu add separator set k [macro::names] foreach n $k { .menu.macromenu add command -label $n -command "macro::play {$n}" } ................................................................................ puts $f $macro_data nonewline close $f macro::update speed::Update } proc play {n} { global c set last_macro $n macro::rec macro::play $n set file [macro::get_path $n] if {[macro::get_type $n]=="sh"} { c "Macro type SH" exec "chmod" "774" "$file" if {$c(textshell)} { textsh::runcmd $file } else { exec "$file" } } else { c "Macro type TCL" source $file } } proc get_path {n} { global home installdir if {[file exists "$home/$n.mac"]==1} { return "$home/$n.mac" } else { if {[file exists "$installdir/$n.mac"]==1} { return "$installdir/$n.mac" } } return "" } proc get_type {n} { set file [macro::get_path $n] if {$file!=""} { set f [open $file r] fconfigure $f -blocking 0 set s [gets $f] close $f if {[string first "#!/bin/sh" $s]!=-1} { return "sh" } else { return "tktcl" } } return "" } proc store {} { global url current_window window c current_macro r c set current_macro "" set ou .ou catch {destroy $ou} ................................................................................ grab $ou powin $ou vwait r destroy $ou return $r } proc edit {n} { c macro::rec macro::edit $n set file [macro::get_path $n] file::Load "file {$file}" -force } proc delete {n} { macro::rec macro::delete $n c set file [macro::get_path $n] if {$file!=""} {file delete -force "$file"} macro::update speed::Update macro::manager_update } proc create {} { global home set info [get_macrotype] set typ [lindex $info 0] set name [lindex $info 1] if {$typ!="cancel"} { set f [open "$home/$name.mac" "CREAT WRONLY" ] if {$typ=="sh"} { puts $f "#!/bin/sh" puts $f "#Shell script macro file\n\n" } else { puts $f "#TK/Tcl script macro file\n\n" } close $f macro::update speed::Update macro::manager_update file::Load "file {$home/$name.mac}" -force } } #Get macro type dialog proc get_macrotype {} { global c set w .mseltype catch {destroy $w} toplevel $w wm title $w "Select macro type" global typ r set typ "tktcl" radiobutton $w.b1 -text "Tk/Tcl Macro file" -variable typ -value "tktcl" radiobutton $w.b2 -text "Shell script" -variable typ -value "sh" xbutton $w.ok -text "Ok" -width 6 -command "set r ok" xbutton $w.cancel -width 6 -text "Cancel" -command "set r cancel" label $w.l -text "Macro name:" entry $w.e -width 30 -background $c(color-editbg) grid $w.l -column 0 -row 0 -sticky w grid $w.e -column 1 -row 0 -sticky w -columnspan 2 grid $w.b1 -column 0 -row 1 -sticky w -columnspan 2 grid $w.b2 -column 2 -row 1 -sticky w grid $w.ok -column 2 -row 2 -sticky e grid $w.cancel -column 0 -row 2 -sticky w powin $w focus $w.e vwait r set typ "$typ {[$w.e get]}" destroy $w if {$r=="ok"} { return $typ } else { return $r} } proc manager_update {} { #BUG! must check if .mgui.l is valid! c set w .mgui.l $w delete 0 end foreach n [macro::names] { $w insert end "{$n} {[macro::get_type $n]}" } } proc manager {} { global c c "Macro manager" set w .mgui catch {destroy $w} toplevel $w wm title $w "Macro manager" scrollbar $w.scroll -command "$w.l yview" mclistbox::mclistbox $w.l -yscrollcommand "$w.scroll set" -width 47 -background $c(color-listbg) frame $w.b xbutton $w.b.new -text "New" -width 6 -command "macro::create" xbutton $w.b.del -text "Delete" -width 6 -command { set sel [.mgui.l curselection] if {$sel!=""} { macro::delete "[lindex [macro::names] $sel]" } } xbutton $w.b.ren -text "Rename" -width 6 xbutton $w.b.ed -text "Edit" -width 6 -command { set sel [.mgui.l curselection] if {$sel!=""} { macro::edit "[lindex [macro::names] $sel]" } } xbutton $w.ok -text "Ok" -width 6 -command "destroy $w" grid $w.l -column 0 -row 0 -rowspan 10 -sticky nsew grid $w.scroll -column 1 -row 0 -rowspan 10 -sticky ns grid $w.b.new -column 0 -row 0 grid $w.b.del -column 0 -row 1 grid $w.b.ren -column 0 -row 2 grid $w.b.ed -column 0 -row 3 grid $w.b -column 2 -row 0 -sticky n grid $w.ok -column 2 -row 9 -sticky s grid columnconfigure $w 0 -weight 1 grid rowconfigure $w 0 -weight 1 $w.l column add macro -label "Macro" -width 40 $w.l column add type -label "Type" -width 7 manager_update bind $w.l <Double-Button-1> { macro::edit "[lindex [macro::names] [.mgui.l curselection]]" } powin $w } } |
Changes to lib/speed.tcl.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
namespace export Update Button Side Assign Remove Edit proc Edit {} { global current_button c home installdir c $current_button macro::rec global current_button macro::rec "set current_button $current_button" macro::rec "speed::Edit" set n "file $home/[lindex $c(speed) [expr $current_button - 1]].mac" if {[file exists $n]==0} { set n "file $installdir/[lindex $c(speed) [expr $current_button - 1]].mac" } c "file $n" file::Load $n -force .mnu unpost } proc Remove {} { global current_button c c $current_button |
< < < < < | < < < < < < < < < |
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
namespace export Update Button Side Assign Remove Edit
proc Edit {} {
global current_button c home installdir
c $current_button
macro::edit "[lindex $c(speed) [expr $current_button - 1]]"
.mnu unpost
}
proc Remove {} {
global current_button c
c $current_button
|