Tk Text Edit

Check-in [df8decbfa6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add rename feature in macromanager
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:df8decbfa63056ddc8cfcf2eb12d6ecbe804e5eb
User & Date: dennis 2000-11-09 23:58:26
Context
2000-11-10
00:17
Prepared for 0_9_9 rlease check-in: ace6fff787 user: dennis tags: trunk
2000-11-09
23:58
Add rename feature in macromanager check-in: df8decbfa6 user: dennis tags: trunk
2000-08-22
01:49
Changed # to slash043 to get rid of generate help file bug check-in: 4d1893ec20 user: dennis tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/cmds.tcl.

73
74
75
76
77
78
79
80

81
82

83
84
85
86
87
88
89
90
set c(recent1) $s
}

updaterecent
}


proc powin {w} {

set y [winfo y .]
#set x [expr [winfo x .] + ([winfo width .]/2)  - ($wid/2) ]

set x [expr [winfo x .] + ([winfo width .]/2)  - (200) ]
wm geometry $w "=+$x+$y" 
c [winfo width $w]
}

proc assigntempfile {win} {
global home  window
set i 0







|
>
|
<
>
|







73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
set c(recent1) $s
}

updaterecent
}


proc powin {w args} {
if {$args==""} {set rw "."} else {set rw $args}
set y [winfo y $rw]

#set x [expr [winfo x $rw] + ([winfo width $rw]/2)  - ($wid/2) ]
set x [expr [winfo x $rw] + ([winfo width $rw]/2)  - (200) ]
wm geometry $w "=+$x+$y" 
c [winfo width $w]
}

proc assigntempfile {win} {
global home  window
set i 0

Changes to lib/macro.tcl.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
275
276
277
278
279
280
281














282
283
284
285
286
287
288
...
346
347
348
349
350
351
352





























353
354
355
356
357
358
359
...
365
366
367
368
369
370
371
372














373
374
375
376
377
378
379
#?
#? 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.
................................................................................
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]
................................................................................
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
................................................................................
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"







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
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
...
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
...
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
#?
#? You can use it to edit/delete/rename and make new macro files.
#?
#? Related topics: %lMACROS% %lMACRO_EDITING%
#?
#?-Macro_Editing
#?
#? There are currently two 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.
................................................................................
if {$file!=""} {file delete -force "$file"}

macro::update
speed::Update
macro::manager_update
}

proc rename {old new} {
macro::rec macro::rename $old $new
c
set o "[macro::get_path $old]"
set n  "[file join [file dirname $o] $new].mac"
c $o to $n

file rename $o $n

macro::update
speed::Update
macro::manager_update
}



proc create {} {
global home
set info [get_macrotype]

set typ [lindex $info 0]
................................................................................
c
set w .mgui.l
$w delete 0 end
foreach n [macro::names] {
	$w insert end "{$n} {[macro::get_type $n]}"
	}
}

proc Rename_DLG {s} {
global r  
set ou .ou
catch {destroy $ou}
toplevel $ou
wm title $ou "Rename macro"
set r "cancel"
frame $ou.f
label $ou.f.label -text "Rename $s to:"
xbutton $ou.f.rename -text "Rename" -command "set r rename" -width 5   
xbutton $ou.f.cancel -text "Cancel" -command "set r cancel" -width 5
xentry $ou.f.e
pack $ou.f.label
pack $ou.f.e
pack $ou.f.rename $ou.f.cancel -side left  -padx 10
bind $ou <Escape> "set r cancel"
bind $ou <Return> "set r rename"
pack $ou.f -side left
$ou.f.e insert end $s
powin $ou
focus $ou.f.e
$ou.f.e selection range 0 end
vwait r
set r "$r {[$ou.f.e get]}"
destroy $ou
return $r
}


proc manager {} {
global c
c "Macro manager"
set w .mgui
catch {destroy $w}
toplevel $w
................................................................................
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 -command {
set sel [.mgui.l curselection]
if {$sel!=""} { 
	set oname "[lindex [macro::names] $sel]"
	set r [macro::Rename_DLG $oname]
	
	if {[lindex $r 0]=="rename"} {
	set nname "[lindex $r 1]"
	macro::rename $oname $nname
	}

	}
}


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"