Tcl Library Source Code

Changes On Branch sak-animate-eeol
Login

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

Changes In Branch sak-animate-eeol Excluding Merge-Ins

This is equivalent to a diff from fa09896d4e to a2cb04cec2

2013-02-26
01:07
Merged animation changes to trunk check-in: 1685f1a5d4 user: andreask tags: trunk
2013-02-25
23:38
Reworked the progressbar animation to use Erase(to)EOL for clear output instead of simulating this by padding with spaces to overwrite previous characters. Needs testing. Closed-Leaf check-in: a2cb04cec2 user: andreask tags: sak-animate-eeol
2013-02-23
00:07
Fixed left-over outdated doctools markup. Regenerated embedded, no change there. check-in: fa09896d4e user: andreask tags: trunk
2013-02-22
23:54
Moved dtplite to version 1.0.5 with the split. Updated its documentation. Added missing ChangeLog. Regenerated embedded. check-in: 510d5d2786 user: andreask tags: trunk

Changes to support/devel/sak/util/anim.tcl.

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- tcl -*-
# (C) 2006 Andreas Kupries <[email protected]>
##
# ###

namespace eval ::sak::animate {}









# ###

proc ::sak::animate::init {} {
    variable prefix
    variable n      0
    variable max    [llength $prefix]
    variable extend 0
}

proc ::sak::animate::next {string} {
    variable prefix
    variable n
    variable max
    Extend string

    puts -nonewline stdout \r\[[lindex $prefix $n]\]\ $string
    flush           stdout

    incr n ; if {$n >= $max} {set n 0}
    return
}

proc ::sak::animate::last {string} {
    variable clear
    Extend string

    puts  stdout \r\[$clear\]\ $string
    flush stdout
    return
}

# ###

proc ::sak::animate::Extend {sv} {
    variable extend
    upvar 1 $sv string

    set l [string length $string]
    while {[string length $string] < $extend} {append string " "}
    if {$l > $extend} {set extend $l}
    return
}

# ###

namespace eval ::sak::animate {
    namespace export init next last

    variable  prefix {
	{*   }	{*   }	{*   }	{*   }	{*   }

|



|
>
>
>
>
>
>
>
>







<






|

|








<






<
<
<
<
<
<
<
<
<
<
<
<







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
38

39
40
41
42
43
44












45
46
47
48
49
50
51
# -*- tcl -*-
# (C) 2006-2013 Andreas Kupries <[email protected]>
##
# ###

namespace eval ::sak::animate {
    # EL (Erase Line)
    #    Sequence: ESC [ n K
    # ** Effect: if n is 0 or missing, clear from cursor to end of line
    #    Effect: if n is 1, clear from beginning of line to cursor
    #    Effect: if n is 2, clear entire line

    variable eeol \033\[K
}

# ###

proc ::sak::animate::init {} {
    variable prefix
    variable n      0
    variable max    [llength $prefix]

}

proc ::sak::animate::next {string} {
    variable prefix
    variable n
    variable max
    variable eeol

    puts -nonewline stdout \r\[[lindex $prefix $n]\]\ $string$eeol
    flush           stdout

    incr n ; if {$n >= $max} {set n 0}
    return
}

proc ::sak::animate::last {string} {
    variable clear


    puts  stdout \r\[$clear\]\ $string
    flush stdout
    return
}













# ###

namespace eval ::sak::animate {
    namespace export init next last

    variable  prefix {
	{*   }	{*   }	{*   }	{*   }	{*   }