OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tools/] [color.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#! /usr/local/bin/tixwish
2
 
3
proc readfile {w} {
4
    global color
5
 
6
    set file [open /usr/lib/X11/rgb.txt RDONLY]
7
    while {[eof $file] == 0} {
8
        set line [gets $file]
9
 
10
        set name [lrange $line 3 end]
11
        set color($name,r) [lindex $line 0]
12
        set color($name,g) [lindex $line 1]
13
        set color($name,b) [lindex $line 2]
14
        $w insert end $name
15
    }
16
    close $file
17
 
18
    bind $w <ButtonRelease-1> "+setcolor $w %y"
19
}
20
 
21
proc setcolor {w y} {
22
    global color
23
    set name [$w get [$w nearest $y]]
24
 
25
    .f config -bg $name
26
    .g config -bg $name
27
}
28
 
29
proc start {} {
30
    frame .f -relief raised -bd 2 -width 100 -height 10
31
    frame .g -relief sunken -bd 2 -width 100 -height 10
32
    tixScrolledListBox .b
33
    readfile [.b subwidget listbox]
34
 
35
    pack .f .g .b -side left -expand yes -fill both -padx 3 -pady 3
36
    wm minsize . 0 0
37
}
38
 
39
start

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.