Check-in [9f3f36f9d7]
Overview
Comment:Updated to compute width based on what has been icon-ized
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9f3f36f9d7cfcbf8e6d49eaefa1019b859e49dc7e6e7653a39e217972d3124af
User & Date: rkeene on 2017-10-26 18:14:43.029
Other Links: manifest | tags
Context
2017-10-26
20:06
Stubbed out more functionality check-in: 0c6ea4c365 user: rkeene tags: trunk
18:14
Updated to compute width based on what has been icon-ized check-in: 9f3f36f9d7 user: rkeene tags: trunk
18:14
Updated to use smaller CSS icons check-in: 7484ed667c user: rkeene tags: trunk
Changes
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33







-
+







	proc icon {type name {x 5px} {y 2px} {width 16px} {height 16px}} {
		set file [iconfile $type $name]

		set fd [open $file]
		set data [read $fd]
		close $fd

		puts -nonewline [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
		return [string map [list @@XPOS@@ $x @@YPOS@@ $y @@WIDTH@@ $width @@HEIGHT@@ $height] $data]
	}

	proc textColorFromBackground {color} {
		return "#fff"
	}

	set args(background_color) "#eee"
77
78
79
80
81
82
83


























84
85

86
87
88
89
90

91
92
93





94
95
96
97
98
99
100








101
102
103


104
105
106
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
113
114
115

116
117


118
119
120
121
122
123
124
125




126
127
128
129
130
131
132
133
134


135
136
137
138
139







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+




-
+

-
-
+
+
+
+
+



-
-
-
-
+
+
+
+
+
+
+
+

-
-
+
+




	headers type image/svg+xml
	headers add Last-Modified $timestamp
	headers add ETag $etag

	set q [format %c 63]
	puts -nonewline "<${q}xml version=\"1.0\"${q}>"

	if {![info exists args(no_action_icon)]} {
		catch {
			set actionIcon [icon action $args(action) 24]
		}
	}
	if {[info exists actionIcon]} {
		set actionAreaWidth 18
	} else {
		set actionAreaWidth 45
	}

	if {![info exists args(no_status_icon)]} {
		catch {
			set statusIcon [icon status $args(status) [expr {20 + $actionAreaWidth}]]
		}
	}
	if {[info exists statusIcon]} {
		set statusAreaWidth 18
	} else {
		set statusAreaWidth 55
	}

	set osAreaWidth 20

	set totalWidth [expr {$osAreaWidth + $actionAreaWidth + $statusAreaWidth}]
?>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20">
<svg xmlns="http://www.w3.org/2000/svg" width="<? puts -nonewline $totalWidth ?>" height="20">
<linearGradient id="a" x2="0" y2="100%">
    <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
    <stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(background_color) ?>"/>
<rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="<? puts -nonewline $args(background_color) ?>"/>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<? if {[info exists args(no_action_icon)] || [catch {icon action $args(action) 36}]} { ?>
    <rect rx="3" width="120" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
<? if {[info exists actionIcon]} {
       puts -nonewline $actionIcon
   } else {
?>
    <rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="<? puts -nonewline $args(action_color) ?>"/>
    <text x="44" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(action) ?></text>
    <text x="44" y="14" fill="<? puts -nonewline $actionTextColor ?>"><? puts -nonewline $args(action) ?></text>
<? } ?>
<? if {[info exists args(no_status_icon)] || [catch {icon status $args(status) 84}]} { ?>
    <rect rx="3" x="65" width="55" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
    <text x="92" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
    <text x="92" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>
<? if {[info exists statusIcon]} {
      puts -nonewline $statusIcon
   } else {
      set statusTextLocation [expr {$osAreaWidth + $actionAreaWidth + ($statusAreaWidth / 2)}]
?>
    <rect rx="3" x="<? puts -nonewline [expr {$totalWidth - $statusAreaWidth}] ?>" width="<? puts -nonewline $statusAreaWidth ?>" height="20" fill="<? puts -nonewline $args(status_color) ?>"/>
    <text x="<? puts -nonewline $statusTextLocation ?>" y="15" fill="#010101" fill-opacity=".3"><? puts -nonewline $args(status) ?></text>
    <text x="<? puts -nonewline $statusTextLocation ?>" y="14" fill="<? puts -nonewline $statusTextColor ?>"><? puts -nonewline $args(status) ?></text>
<? } ?>
<rect rx="3" width="120" height="20" fill="url(#a)"/>
<? catch {icon os $args(os)} ?>
<rect rx="3" width="<? puts -nonewline $totalWidth ?>" height="20" fill="url(#a)"/>
<? catch {puts -nonewline [icon os $args(os)]} ?>
</g>
<!-- <? #puts $errList ?> -->
</svg>