File: paneset6.tcl

package info (click to toggle)
blt 3.0~1%2B08570046%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 45,556 kB
  • sloc: ansic: 278,852; tcl: 96,434; sh: 3,410; makefile: 2,026; cpp: 374
file content (94 lines) | stat: -rw-r--r-- 1,918 bytes parent folder | download
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
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
90
91
92
93
94

package require BLT

set autocolors {
#0000cd
#cd0000
#00cd00
#3a5fcd
#cdcd00
#cd1076
#009acd
#00c5cd
#a2b5cd
#7ac5cd
#66cdaa
#a2cd5a
#cd9b9b
#cdba96
#cd3333
#cd6600
#cd8c95
#cd00cd
#9a32cd
#6ca6cd
#9ac0cd
#9bcd9b
#00cd66
#cdc673
#cdad00
#cd5555
#cd853f
#cd7054
#cd5b45
#cd6889
#cd69c9
#551a8b
}

proc Move { w pane } {
    .ps see $pane
}

blt::filmstrip .ps  -bg grey -width 600 -scrollcommand { .s set } \
    -gripthickness 3 -grippad 1 -gripborderwidth 2 \
    -activegriprelief raised -griprelief flat 

for { set i 0 } { $i < 32 } { incr i } {
    set color [lindex $autocolors $i]
    blt::graph .ps.g$i -bg $color -width 500
    set pane [.ps add -window .ps.g$i -fill both -showgrip yes]
    bind .ps.g$i <ButtonPress-1>  [list Move %W $pane]
    bind .ps.g$i <ButtonPress-2>  [list Move %W pane0]
    bind .ps.g$i <ButtonPress-3>  [list Move %W pane35]
}
blt::tk::scrollbar .s -command { .ps view } -orient horizontal

set pressed 0
bind BltPaneset <Enter> { %W activate } 
bind BltPaneset <Leave> { 
    if { !$pressed } { %W deactivate } 
}
bind BltPaneset <KeyPress-Left> { %W move -10 0 }
bind BltPaneset <KeyPress-Right> { %W move 10  0 }
bind BltPaneset <KeyPress-Up> { %W move 0 -10 }
bind BltPaneset <KeyPress-Down> { %W move 0 10 }
bind BltPaneset <Shift-KeyPress-Left> { %W move -100 0 }
bind BltPaneset <Shift-KeyPress-Right> { %W move 100  0 }
bind BltPaneset <Shift-KeyPress-Up> { %W move 0 -100 }
bind BltPaneset <Shift-KeyPress-Down> { %W move 0 100 }
bind BltPaneset <ButtonPress-1> { 
    set pressed 1
    %W anchor %X %Y 
    focus %W
}
bind BltPaneset <B1-Motion> { %W mark %X %Y }
bind BltPaneset <ButtonRelease-1> { 
    set pressed 0
    %W set %X %Y 
}

blt::table . \
    0,0 .ps -fill both \
    1,0 .s -fill x 

blt::table configure . r1 -resize none

focus .ps
after 5000 {
    #.ps pane configure 1 -size { 0 10000 10 }
    focus .
    #.ps see pane2
    #.ps size pane2 1i
}