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 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
|
<object name="element_list" default-lang="javascript">
<!-- Create a few instances of various tags to make sure the modules
load so we get proper documentation for them -->
<window name="fake" visible="false">
<vwrapalign/>
<glarea/>
<system-args/>
<c-code/>
<perl/>
<tcl/>
</window>
<!-- The main window -->
<window name="main" width="700" height="600" ondelete="entity:exit"
title="Supported Element List" border="5">
<valign spacing="5" expand="true">
<menubar>
<menu label="Export">
<menuitem label="To HTML" onselect="open_export_to_html_filesel"/>
</menu>
</menubar>
<scrollwindow expand="true" y-scrollbar-policy="always">
<ctree expand="true" name="top" onselect="row_selected"
line-style="none" expander-style="none" spacing="0">
<ctree-column title="Element" width="180"/>
<ctree-column title="Description" width="400"/>
</ctree>
</scrollwindow>
</valign>
</window>
<window title="Supported Attributes" name="element_details" width="900" height="400" dialog="true"
ondelete="hide_window" border="5" visible="false">
<valign spacing="5" expand="true">
<halign>
<label text="Description" width="100" xalign="0"/>
<label name="description" text=""/>
</halign>
<scrollwindow expand="true" y-scrollbar-policy="always">
<ctree name="details" expand="true" line-style="none" expander-style="none"
spacing="0">
<ctree-column title="Attribute" width="150"/>
<ctree-column title="Description" width="500"/>
<ctree-column title="Value Type" width="75"/>
<ctree-column title="Possible Values" width="75"/>
</ctree>
</scrollwindow>
</valign>
</window>
<window name="generating_files" title="Generating Files..."
border="8" position="center" dialog="true" visible="false"
ondelete="hide_window">
<valign spacing="12" expand="true">
<halign>
<label name="filename" text="foo.html" expand="true"/>
</halign>
<progress name="generating" value="0"/>
</valign>
</window>
<window name="generating_complete" dialog="true" position="center"
border="11" title="File Generation Complete" visible="false"
ondelete="hide_window">
<valign expand="true" spacing="19">
<halign>
<label text="Generation of HTML documentation complete."
expand="true"/>
</halign>
<halign>
<button label="OK" width="80" expand="true" fill="false"
onclick="hide_window" arg="window.generating_complete"/>
</halign>
</valign>
</window>
<window name="generating_error" dialog="true" position="center"
border="8" title="Error!" visible="false" ondelete="hide_window">
<valign expand="true" spacing="10">
<halign>
<label text="Error generating files!" expand="true"/>
</halign>
<halign>
<label text="" expand="true" name="error_message"/>
</halign>
<halign>
<button label="OK" width="80" expand="true" fill="false"
onclick="hide_window" arg="window.generating_error"/>
</halign>
</valign>
</window>
<filesel title="Save HTML to Directory.." visible="false" onselect="export_to_html"/>
<norender/>
<system-elements/>
<?javascript
supported = enode ("system-elements").list_set_attribs ();
supported.sort ();
ctree = enode ("ctree.top");
ctree.attrib.frozen = "true";
for (element in supported) {
// The only erroneously set attribute will be the nodes name.
if (element == "name")
continue;
row = ctree.new_child ("ctree-row");
row.attrib.element = element;
cell = row.new_child ("ctree-cell");
cell.attrib.text = element;
node = enode ("norender").new_child (element);
cell = row.new_child ("ctree-cell");
cell.attrib.text = node.description;
node.destroy ();
}
ctree.attrib.frozen = "false";
function attribute_descriptions (node, attribute)
{
ret = new Object;
// Description
try {
description = node.attrib_description (attrib);
} catch (e) {
description = "";
}
ret.description = description;
// Value Type
try {
value_type = node.attrib_value_type (attrib);
} catch (e) {
value_type = "";
}
ret.value_type = value_type;
// value description
try {
value_desc = node.attrib_possible_values (attrib);
} catch (e) {
value_desc = "";
}
ret.value_desc = value_desc;
return (ret);
}
function row_selected (ctree, ctree_row)
{
element = ctree_row.attrib.element;
enode ("window.element_details").attrib.title = element;
ctree = enode ("ctree.details");
ctree.attrib.frozen="true";
children = ctree.children ("ctree-row");
try {
for (child in children) {
child.destroy ();
}
} catch (e) {}
node = enode ("norender").new_child (element);
enode ("label.description").attrib.text = node.description;
try {
attributes = node.supported_attribs ();
attributes.sort ();
for (attrib in attributes) {
row = ctree.new_child ("ctree-row");
cell = row.new_child ("ctree-cell");
cell.attrib.text = attrib;
info = attribute_descriptions (node, attrib);
cell = row.new_child ("ctree-cell");
cell.attrib.text = info.description;
cell = row.new_child ("ctree-cell");
cell.attrib.text = info.value_type;
cell = row.new_child ("ctree-cell");
cell.attrib.text = info.value_desc;
}
} catch (e) {}
ctree.attrib.frozen="false"
node.destroy ();
enode ("window.element_details").attrib.visible = "true";
}
function open_export_to_html_filesel (menuitem)
{
enode ("filesel").attrib.visible = "true";
}
function export_to_html (filesel, output_dir)
{
f = new File (output_dir);
info = f.stat (output_dir);
if (!(info[2] & 0040000)) {
enode ("label.error_message").attrib.text = "Selected file is not a directory!";
enode ("window.generating_error").attrib.visible = "true";
return;
}
f.close ();
index = new File (output_dir + "/index.html");
if (!index.open ("w")) {
enode ("label.error_message").attrib.text = "Error opening index.html for writing: " +
System.strerror (System.errno);
enode ("window.generating_error").attrib.visible = "true";
return;
}
index.write ("<html><body><table>\n");
supported = enode ("system-elements").list_set_attribs ();
supported.sort ();
enode ("window.generating_files").attrib.visible = "true";
num_elements = supported.length;
current_element = 0;
for (element in supported) {
// The only erroneously set attribute will be the nodes name.
if (element == "name")
continue;
node = enode ("norender").new_child (element);
index.write ('<tr><td><a href="' + element + '.html">' + element + '</a></td><td>' +
node.description + '</td></tr>\n');
f = new File (output_dir + "/" + element + ".html");
if (!f.open ("w")) {
enode ("label.error_message").attrib.text = "Error opening " + element + ".html for writing: " +
System.strerror (System.errno);
enode ("window.generating_error").attrib.visible = "true";
enode ("window.generating_files").attrib.visible = "false";
return;
}
enode ("label.filename").attrib.text = element + ".html";
f.write ('<html><body><table width="100%" border="3"><tr><td bgcolor="#a0a0ff">Tag: <b>' +
element + '</b></td><td colspan="3">' + node.description + '</td></tr> <tr><td></td></tr>\n');
f.write ('<tr><td bgcolor="#d0d0ff">Attrib Name</td>\n');
f.write ('<td bgcolor="#d0d0ff">Type</td>\n');
f.write ('<td bgcolor="#d0d0ff">Possible Values</td>\n');
f.write ('<td bgcolor="#d0d0ff">Description</td></tr>\n');
try {
attributes = node.supported_attribs ();
attributes.sort ();
for (attrib in attributes) {
info = attribute_descriptions (node, attrib);
f.write ('<tr><td bgcolor="#bbffaa">' + attrib + '</td>\n');
f.write ('<td bgcolor="#ffddaa">' + info.value_type + '</td>\n');
f.write ('<td bgcolor="#dddddd">' + info.value_desc + '</td>\n');
f.write ('<td bgcolor="#88ddff">' + info.description + '</td></tr>\n');
}
} catch (e) {}
f.write ('</table></body></html>\n\n');
f.close ();
node.destroy ();
enode ("progress.generating").attrib.value = current_element / num_elements * 100;
current_element++;
}
index.write ('</table></body></html>\n');
index.close ();
enode ("window.generating_files").attrib.visible = "false";
enode ("window.generating_complete").attrib.visible = "true";
}
function hide_window (node)
{
if (node.type == "window") {
node.attrib.visible = "false";
} else {
window = node.attrib.arg;
enode (window).attrib.visible = "false";
}
}
?>
</object>
|