1 // panel_io.cxx - I/O for 2D panel.
3 // Written by David Megginson, started January 2000.
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <string.h> // for strcmp()
31 #include <simgear/compiler.h>
32 #include <simgear/misc/exception.hxx>
34 #include <simgear/misc/sg_path.hxx>
35 #include <simgear/debug/logstream.hxx>
36 #include <simgear/misc/props.hxx>
42 #include <Main/globals.hxx>
43 #include <Main/fg_props.hxx>
49 #include "panel_io.hxx"
51 #if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
52 SG_USING_STD(istream);
53 SG_USING_STD(ifstream);
59 ////////////////////////////////////////////////////////////////////////
60 // Built-in layer for the magnetic compass ribbon layer.
62 // TODO: move this out into a special directory for built-in
63 // layers of various sorts.
64 ////////////////////////////////////////////////////////////////////////
66 class FGMagRibbon : public FGTexturedLayer
69 FGMagRibbon (int w, int h);
70 virtual ~FGMagRibbon () {}
75 FGMagRibbon::FGMagRibbon (int w, int h)
76 : FGTexturedLayer(w, h)
78 FGCroppedTexture texture("Aircraft/Instruments/Textures/compass-ribbon.rgb");
85 double heading = FGSteam::get_MH_deg();
86 double xoffset, yoffset;
88 while (heading >= 360.0) {
91 while (heading < 0.0) {
95 if (heading >= 60.0 && heading <= 180.0) {
96 xoffset = heading / 240.0;
98 } else if (heading >= 150.0 && heading <= 270.0) {
99 xoffset = (heading - 90.0) / 240.0;
101 } else if (heading >= 240.0 && heading <= 360.0) {
102 xoffset = (heading - 180.0) / 240.0;
107 xoffset = (heading - 270.0) / 240.0;
111 xoffset = 1.0 - xoffset;
112 // Adjust to put the number in the centre
115 FGCroppedTexture &t = getTexture();
116 t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
117 FGTexturedLayer::draw();
122 ////////////////////////////////////////////////////////////////////////
123 // Read and construct a panel.
125 // The panel is specified as a regular property list, and each of the
126 // instruments is its own, separate property list (and thus, a separate
127 // XML document). The functions in this section read in the files
128 // as property lists, then extract properties to set up the panel
131 // A panel contains zero or more instruments.
133 // An instrument contains one or more layers and zero or more actions.
135 // A layer contains zero or more transformations.
137 // Some special types of layers also contain other objects, such as
138 // chunks of text or other layers.
140 // There are currently four types of layers:
142 // 1. Textured Layer (type="texture"), the default
143 // 2. Text Layer (type="text")
144 // 3. Switch Layer (type="switch")
145 // 4. Built-in Layer (type="built-in", must also specify class)
147 // The only built-in layer so far is the ribbon for the magnetic compass
148 // (class="compass-ribbon").
150 // There are three types of actions:
152 // 1. Adjust (type="adjust"), the default
153 // 2. Swap (type="swap")
154 // 3. Toggle (type="toggle")
156 // There are three types of transformations:
158 // 1. X shift (type="x-shift"), the default
159 // 2. Y shift (type="y-shift")
160 // 3. Rotation (type="rotation")
162 // Each of these may be associated with a property, so that a needle
163 // will rotate with the airspeed, for example, or may have a fixed
164 // floating-point value.
165 ////////////////////////////////////////////////////////////////////////
169 * Read a cropped texture from the instrument's property list.
171 * The x1 and y1 properties give the starting position of the texture
172 * (between 0.0 and 1.0), and the the x2 and y2 properties give the
173 * ending position. For example, to use the bottom-left quarter of a
174 * texture, x1=0.0, y1=0.0, x2=0.5, y2=0.5.
176 static FGCroppedTexture
177 readTexture (const SGPropertyNode * node)
179 FGCroppedTexture texture(node->getStringValue("path"),
180 node->getFloatValue("x1"),
181 node->getFloatValue("y1"),
182 node->getFloatValue("x2", 1.0),
183 node->getFloatValue("y2", 1.0));
184 SG_LOG(SG_COCKPIT, SG_DEBUG, "Read texture " << node->getName());
190 * Test for a condition in the current node.
193 ////////////////////////////////////////////////////////////////////////
194 // Read a condition and use it if necessary.
195 ////////////////////////////////////////////////////////////////////////
198 readConditions (FGConditional * component, const SGPropertyNode * node)
200 const SGPropertyNode * conditionNode = node->getChild("condition");
201 if (conditionNode != 0)
202 // The top level is implicitly AND
203 component->setCondition(fgReadCondition(conditionNode));
208 * Read an action from the instrument's property list.
210 * The action will be performed when the user clicks a mouse button
211 * within the specified region of the instrument. Actions always work
212 * by modifying the value of a property (see the SGPropertyNode
215 * The following action types are defined:
217 * "adjust" - modify the value of a floating-point property by
218 * the increment specified. This is the default.
220 * "swap" - swap the values of two-floating-point properties.
222 * "toggle" - toggle the value of a boolean property between true and
225 * For the adjust action, it is possible to specify an increment
226 * (use a negative number for a decrement), a minimum allowed value,
227 * a maximum allowed value, and a flag to indicate whether the value
228 * should freeze or wrap-around when it reachs the minimum or maximum.
230 * The action will be scaled automatically if the instrument is not
231 * being drawn at its regular size.
233 static FGPanelAction *
234 readAction (const SGPropertyNode * node, float w_scale, float h_scale)
236 string name = node->getStringValue("name");
238 int button = node->getIntValue("button");
239 int x = int(node->getIntValue("x") * w_scale);
240 int y = int(node->getIntValue("y") * h_scale);
241 int w = int(node->getIntValue("w") * w_scale);
242 int h = int(node->getIntValue("h") * h_scale);
244 FGPanelAction * action = new FGPanelAction(button, x, y, w, h);
246 vector<const SGPropertyNode *>bindings = node->getChildren("binding");
247 for (unsigned int i = 0; i < bindings.size(); i++) {
248 SG_LOG(SG_INPUT, SG_INFO, "Reading binding "
249 << bindings[i]->getStringValue("command"));
250 action->addBinding(new FGBinding(bindings[i])); // TODO: allow modifiers
253 readConditions(action, node);
259 * Read a transformation from the instrument's property list.
261 * The panel module uses the transformations to slide or spin needles,
262 * knobs, and other indicators, and to place layers in the correct
263 * positions. Every layer starts centered exactly on the x,y co-ordinate,
264 * and many layers need to be moved or rotated simply to display the
265 * instrument correctly.
267 * There are three types of transformations:
269 * "x-shift" - move the layer horizontally.
271 * "y-shift" - move the layer vertically.
273 * "rotation" - rotate the layer.
275 * Each transformation may have a fixed offset, and may also have
276 * a floating-point property value to add to the offset. The
277 * floating-point property may be clamped to a minimum and/or
278 * maximum range and scaled (after clamping).
280 * Note that because of the way OpenGL works, transformations will
281 * appear to be applied backwards.
283 static FGPanelTransformation *
284 readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
286 FGPanelTransformation * t = new FGPanelTransformation;
288 string name = node->getName();
289 string type = node->getStringValue("type");
290 string propName = node->getStringValue("property", "");
291 SGPropertyNode * target = 0;
294 SG_LOG( SG_COCKPIT, SG_ALERT,
295 "No type supplied for transformation " << name
296 << " assuming \"rotation\"" );
300 if (!propName.empty()) {
301 target = fgGetNode(propName.c_str(), true);
305 t->min = node->getFloatValue("min", -9999999);
306 t->max = node->getFloatValue("max", 99999999);
307 t->factor = node->getFloatValue("scale", 1.0);
308 t->offset = node->getFloatValue("offset", 0.0);
310 // Check for an interpolation table
311 const SGPropertyNode * trans_table = node->getNode("interpolation");
312 if (trans_table != 0) {
313 SG_LOG( SG_COCKPIT, SG_INFO, "Found interpolation table with "
314 << trans_table->nChildren() << "children" );
315 t->table = new SGInterpTable();
316 for(int i = 0; i < trans_table->nChildren(); i++) {
317 const SGPropertyNode * node = trans_table->getChild(i);
318 if (!strcmp(node->getName(), "entry")) {
319 double ind = node->getDoubleValue("ind", 0.0);
320 double dep = node->getDoubleValue("dep", 0.0);
321 SG_LOG( SG_COCKPIT, SG_INFO, "Adding interpolation entry "
322 << ind << "==>" << dep );
323 t->table->addEntry(ind, dep);
325 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
326 << " in interpolation" );
333 // Move the layer horizontally.
334 if (type == "x-shift") {
335 t->type = FGPanelTransformation::XSHIFT;
336 // t->min *= w_scale; //removed by Martin Dressler
337 // t->max *= w_scale; //removed by Martin Dressler
338 t->offset *= w_scale;
339 t->factor *= w_scale; //Added by Martin Dressler
342 // Move the layer vertically.
343 else if (type == "y-shift") {
344 t->type = FGPanelTransformation::YSHIFT;
345 //t->min *= h_scale; //removed
346 //t->max *= h_scale; //removed
347 t->offset *= h_scale;
348 t->factor *= h_scale; //Added
351 // Rotate the layer. The rotation
352 // is in degrees, and does not need
353 // to scale with the instrument size.
354 else if (type == "rotation") {
355 t->type = FGPanelTransformation::ROTATION;
359 SG_LOG( SG_COCKPIT, SG_ALERT, "Unrecognized transformation type " << type );
364 readConditions(t, node);
365 SG_LOG( SG_COCKPIT, SG_DEBUG, "Read transformation " << name );
371 * Read a chunk of text from the instrument's property list.
373 * A text layer consists of one or more chunks of text. All chunks
374 * share the same font size and color (and eventually, font), but
375 * each can come from a different source. There are three types of
378 * "literal" - a literal text string (the default)
380 * "text-value" - the current value of a string property
382 * "number-value" - the current value of a floating-point property.
384 * All three may also include a printf-style format string.
387 readTextChunk (const SGPropertyNode * node)
389 FGTextLayer::Chunk * chunk;
390 string name = node->getStringValue("name");
391 string type = node->getStringValue("type");
392 string format = node->getStringValue("format");
394 // Default to literal text.
396 SG_LOG( SG_COCKPIT, SG_INFO, "No type provided for text chunk " << name
397 << " assuming \"literal\"");
401 // A literal text string.
402 if (type == "literal") {
403 string text = node->getStringValue("text");
404 chunk = new FGTextLayer::Chunk(text, format);
407 // The value of a string property.
408 else if (type == "text-value") {
409 SGPropertyNode * target =
410 fgGetNode(node->getStringValue("property"), true);
411 chunk = new FGTextLayer::Chunk(FGTextLayer::TEXT_VALUE, target, format);
414 // The value of a float property.
415 else if (type == "number-value") {
416 string propName = node->getStringValue("property");
417 float scale = node->getFloatValue("scale", 1.0);
418 SGPropertyNode * target = fgGetNode(propName.c_str(), true);
419 chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, target,
425 SG_LOG( SG_COCKPIT, SG_ALERT, "Unrecognized type " << type
426 << " for text chunk " << name );
430 readConditions(chunk, node);
436 * Read a single layer from an instrument's property list.
438 * Each instrument consists of one or more layers stacked on top
439 * of each other; the lower layers show through only where the upper
440 * layers contain an alpha component. Each layer can be moved
441 * horizontally and vertically and rotated using transformations.
443 * This module currently recognizes four kinds of layers:
445 * "texture" - a layer containing a texture (the default)
447 * "text" - a layer containing text
449 * "switch" - a layer that switches between two other layers
450 * based on the current value of a boolean property.
452 * "built-in" - a hard-coded layer supported by C++ code in FlightGear.
454 * Currently, the only built-in layer class is "compass-ribbon".
456 static FGInstrumentLayer *
457 readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
459 FGInstrumentLayer * layer = NULL;
460 string name = node->getStringValue("name");
461 string type = node->getStringValue("type");
462 int w = node->getIntValue("w", -1);
463 int h = node->getIntValue("h", -1);
465 w = int(w * w_scale);
467 h = int(h * h_scale);
471 SG_LOG( SG_COCKPIT, SG_ALERT,
472 "No type supplied for layer " << name
473 << " assuming \"texture\"" );
478 // A textured instrument layer.
479 if (type == "texture") {
480 FGCroppedTexture texture = readTexture(node->getNode("texture"));
481 layer = new FGTexturedLayer(texture, w, h);
484 // A group of sublayers.
485 else if (type == "group") {
486 layer = new FGGroupLayer();
487 for (int i = 0; i < node->nChildren(); i++) {
488 const SGPropertyNode * child = node->getChild(i);
489 cerr << "Trying child " << child->getName() << endl;
490 if (!strcmp(child->getName(), "layer")) {
491 cerr << "succeeded!" << endl;
492 ((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
498 // A textual instrument layer.
499 else if (type == "text") {
500 FGTextLayer * tlayer = new FGTextLayer(w, h); // FIXME
502 // Set the text color.
503 float red = node->getFloatValue("color/red", 0.0);
504 float green = node->getFloatValue("color/green", 0.0);
505 float blue = node->getFloatValue("color/blue", 0.0);
506 tlayer->setColor(red, green, blue);
508 // Set the point size.
509 float pointSize = node->getFloatValue("point-size", 10.0) * w_scale;
510 tlayer->setPointSize(pointSize);
513 string fontName = node->getStringValue("font", "default");
514 tlayer->setFontName(fontName);
516 const SGPropertyNode * chunk_group = node->getNode("chunks");
517 if (chunk_group != 0) {
518 int nChunks = chunk_group->nChildren();
519 for (int i = 0; i < nChunks; i++) {
520 const SGPropertyNode * node = chunk_group->getChild(i);
521 if (!strcmp(node->getName(), "chunk")) {
522 FGTextLayer::Chunk * chunk = readTextChunk(node);
524 tlayer->addChunk(chunk);
526 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
534 // A switch instrument layer.
535 else if (type == "switch") {
536 SGPropertyNode * target =
537 fgGetNode(node->getStringValue("property"), true);
538 FGInstrumentLayer * layer1 =
539 readLayer(node->getNode("layer[0]"), w_scale, h_scale);
540 FGInstrumentLayer * layer2 =
541 readLayer(node->getNode("layer[1]"), w_scale, h_scale);
542 layer = new FGSwitchLayer(w, h, target, layer1, layer2);
545 // A built-in instrument layer.
546 else if (type == "built-in") {
547 string layerclass = node->getStringValue("class");
549 if (layerclass == "mag-ribbon") {
550 layer = new FGMagRibbon(w, h);
553 else if (layerclass.empty()) {
554 SG_LOG( SG_COCKPIT, SG_ALERT, "No class provided for built-in layer "
560 SG_LOG( SG_COCKPIT, SG_ALERT, "Unknown built-in layer class "
568 SG_LOG( SG_COCKPIT, SG_ALERT, "Unrecognized layer type " << type );
574 // Get the transformations for each layer.
576 const SGPropertyNode * trans_group = node->getNode("transformations");
577 if (trans_group != 0) {
578 int nTransformations = trans_group->nChildren();
579 for (int i = 0; i < nTransformations; i++) {
580 const SGPropertyNode * node = trans_group->getChild(i);
581 if (!strcmp(node->getName(), "transformation")) {
582 FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
584 layer->addTransformation(t);
586 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
587 << " in transformations" );
592 readConditions(layer, node);
593 SG_LOG( SG_COCKPIT, SG_DEBUG, "Read layer " << name );
599 * Read an instrument from a property list.
601 * The instrument consists of a preferred width and height
602 * (the panel may override these), together with a list of layers
603 * and a list of actions to be performed when the user clicks
604 * the mouse over the instrument. All co-ordinates are relative
605 * to the instrument's position, so instruments are fully relocatable;
606 * likewise, co-ordinates for actions and transformations will be
607 * scaled automatically if the instrument is not at its preferred size.
609 static FGPanelInstrument *
610 readInstrument (const SGPropertyNode * node)
612 const string &name = node->getStringValue("name");
613 int x = node->getIntValue("x", -1);
614 int y = node->getIntValue("y", -1);
615 int real_w = node->getIntValue("w", -1);
616 int real_h = node->getIntValue("h", -1);
617 int w = node->getIntValue("w-base", -1);
618 int h = node->getIntValue("h-base", -1);
620 if (x == -1 || y == -1) {
621 SG_LOG( SG_COCKPIT, SG_ALERT,
622 "x and y positions must be specified and > 0" );
629 w_scale = float(real_w) / float(w);
633 h_scale = float(real_h) / float(h);
637 SG_LOG( SG_COCKPIT, SG_DEBUG, "Reading instrument " << name );
639 FGLayeredInstrument * instrument =
640 new FGLayeredInstrument(x, y, w, h);
643 // Get the actions for the instrument.
645 const SGPropertyNode * action_group = node->getNode("actions");
646 if (action_group != 0) {
647 int nActions = action_group->nChildren();
648 for (int i = 0; i < nActions; i++) {
649 const SGPropertyNode * node = action_group->getChild(i);
650 if (!strcmp(node->getName(), "action")) {
651 FGPanelAction * action = readAction(node, w_scale, h_scale);
653 instrument->addAction(action);
655 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
662 // Get the layers for the instrument.
664 const SGPropertyNode * layer_group = node->getNode("layers");
665 if (layer_group != 0) {
666 int nLayers = layer_group->nChildren();
667 for (int i = 0; i < nLayers; i++) {
668 const SGPropertyNode * node = layer_group->getChild(i);
669 if (!strcmp(node->getName(), "layer")) {
670 FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
672 instrument->addLayer(layer);
674 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
680 readConditions(instrument, node);
681 SG_LOG( SG_COCKPIT, SG_DEBUG, "Done reading instrument " << name );
687 * Construct the panel from a property tree.
690 readPanel (const SGPropertyNode * root)
692 SG_LOG( SG_COCKPIT, SG_INFO, "Reading properties for panel " <<
693 root->getStringValue("name", "[Unnamed Panel]") );
695 FGPanel * panel = new FGPanel();
696 panel->setWidth(root->getIntValue("w", 1024));
697 panel->setHeight(root->getIntValue("h", 443));
700 // Grab the visible external viewing area, default to
702 panel->setViewHeight(root->getIntValue("view-height",
703 768 - panel->getHeight() + 2));
706 // Grab the panel's initial offsets, default to 0, 0.
708 if (!fgHasNode("/sim/panel/x-offset"))
709 fgSetInt("/sim/panel/x-offset", root->getIntValue("x-offset", 0));
711 // conditional removed by jim wilson to allow panel xml code
712 // with y-offset defined to work...
713 if (!fgHasNode("/sim/panel/y-offset"))
714 fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0));
717 // Assign the background texture, if any, or a bogus chequerboard.
719 string bgTexture = root->getStringValue("background");
720 if (bgTexture.empty())
722 panel->setBackground(FGTextureManager::createTexture(bgTexture.c_str()));
723 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << bgTexture );
726 // Get multibackground if any...
728 string mbgTexture = root->getStringValue("multibackground[0]");
729 if (!mbgTexture.empty()) {
730 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 0);
731 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
733 mbgTexture = root->getStringValue("multibackground[1]");
734 if (mbgTexture.empty())
736 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 1);
737 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
739 mbgTexture = root->getStringValue("multibackground[2]");
740 if (mbgTexture.empty())
742 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 2);
743 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
745 mbgTexture = root->getStringValue("multibackground[3]");
746 if (mbgTexture.empty())
748 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 3);
749 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
751 mbgTexture = root->getStringValue("multibackground[4]");
752 if (mbgTexture.empty())
754 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 4);
755 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
757 mbgTexture = root->getStringValue("multibackground[5]");
758 if (mbgTexture.empty())
760 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 5);
761 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
763 mbgTexture = root->getStringValue("multibackground[6]");
764 if (mbgTexture.empty())
766 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 6);
767 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
769 mbgTexture = root->getStringValue("multibackground[7]");
770 if (mbgTexture.empty())
772 panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 7);
773 SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
780 // Create each instrument.
782 SG_LOG( SG_COCKPIT, SG_INFO, "Reading panel instruments" );
783 const SGPropertyNode * instrument_group = root->getChild("instruments");
784 if (instrument_group != 0) {
785 int nInstruments = instrument_group->nChildren();
786 for (int i = 0; i < nInstruments; i++) {
787 const SGPropertyNode * node = instrument_group->getChild(i);
788 if (!strcmp(node->getName(), "instrument")) {
789 FGPanelInstrument * instrument = readInstrument(node);
791 panel->addInstrument(instrument);
793 SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
794 << " in instruments section" );
798 SG_LOG( SG_COCKPIT, SG_INFO, "Done reading panel instruments" );
802 // Return the new panel.
809 * Read a panel from a property list.
811 * Each panel instrument will appear in its own, separate
812 * property list. The top level simply names the panel and
813 * places the instruments in their appropriate locations (and
814 * optionally resizes them if necessary).
816 * Returns 0 if the read fails for any reason.
819 fgReadPanel (istream &input)
824 readProperties(input, &root);
825 } catch (const sg_exception &e) {
826 guiErrorMessage("Error reading panel: ", e);
829 return readPanel(&root);
834 * Read a panel from a property list.
836 * This function opens a stream to a file, then invokes the
837 * main fgReadPanel() function.
840 fgReadPanel (const string &relative_path)
842 SGPath path(globals->get_fg_root());
843 path.append(relative_path);
847 readProperties(path.str(), &root);
848 } catch (const sg_exception &e) {
849 guiErrorMessage("Error reading panel: ", e);
852 return readPanel(&root);
857 // end of panel_io.cxx