File: support.tcl

package info (click to toggle)
linuxcnc 1%3A2.9.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 282,780 kB
  • sloc: python: 201,110; ansic: 106,370; cpp: 99,219; tcl: 16,054; xml: 10,617; sh: 10,258; makefile: 1,251; javascript: 138; sql: 72; asm: 15
file content (65 lines) | stat: -rw-r--r-- 2,449 bytes parent folder | download | duplicates (3)
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
#    This is a component of AXIS, a front-end for emc
#    Copyright 2004 Jeff Epler <jepler@unpythonic.net> and
#    Chris Radek <chris@timeguy.com>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

proc make_color { c d } {
    if {![catch {winfo rgb . $c}]} {
        set d $c
    }
    proc $c {} [list return $d]
}

make_color systemwindowtext      #000000
make_color systembuttonface      #d9d9d9
make_color systemdisabledtext    #a3a3a3
make_color systembuttonhighlight #ececec
make_color systemhighlight       #08246b
make_color systemhighlighttext   #ffffff
make_color systemwindow          #ffffff

proc control {path args} { eval [concat frame $path $args -class Control] }
proc vspace {path args} { eval [concat frame $path $args -class Vspace] }
proc hspace {path args} { eval [concat frame $path $args -class Hspace] }
proc vrule {path args} { eval [concat frame $path $args -class Vrule] }
proc hrule {path args} { eval [concat frame $path $args -class Hrule] }
proc tab {path args} { eval [concat frame $path] }

proc find_image {name} {
    set initial [string index $name 0]
    foreach p $::imagedir {
        set q [file join $p ${name}.png]
        if {[file exists $q]} { return $q }
        set q [file join $p $initial ${name}.png]
        if {[file exists $q]} { return $q }
        set q [file join $p ${name}.gif]
        if {[file exists $q]} { return $q }
        set q [file join $p $initial ${name}.gif]
        if {[file exists $q]} { return $q }
    }
    error "Image $name does not exist"
}


proc load_image { name {img ""}} {
    if {$img == ""} { set img icon_$name }
    if {[lsearch [image names] $img] != -1}  { return $img }
    set file [find_image $name]
    image create photo $img -file $file
    return $img
}