- if( !canvas_root->getChild("texture", index) )
- {
- int view[2] = {
- // Get canvas viewport size. If not specified use the widget dimensions
- props->getIntValue("view[0]", width),
- props->getIntValue("view[1]", height)
- };
- _canvas = canvas_root->getChild("texture", index, true);
- _canvas->setIntValue("size[0]", view[0] * 2); // use higher resolution
- _canvas->setIntValue("size[1]", view[1] * 2); // for antialias
- _canvas->setIntValue("view[0]", view[0]);
- _canvas->setIntValue("view[1]", view[1]);
- _canvas->setBoolValue("render-always", true);
- _canvas->setStringValue( "name",
- props->getStringValue("name", "gui-anonymous") );
- SGPropertyNode* input = _canvas->getChild("input", 0, true);
- _mouse_x = input->getChild("mouse-x", 0, true);
- _mouse_y = input->getChild("mouse-y", 0, true);
- _mouse_down = input->getChild("mouse-down", 0, true);
- _mouse_drag = input->getChild("mouse-drag", 0, true);
-
- SGPropertyNode *nasal = props->getNode("nasal");
- if( !nasal )
- break;
-
- FGNasalSys *nas =
- dynamic_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
- if( !nas )
- SG_LOG( SG_GENERAL,
- SG_ALERT,
- "CanvasWidget: Failed to get nasal subsystem!" );
-
- const std::string file = std::string("__canvas:")
- + _canvas->getStringValue("name");
-
- SGPropertyNode *load = nasal->getNode("load");
- if( load )
- {
- const char *s = load->getStringValue();
- nas->handleCommand(module.c_str(), file.c_str(), s, _canvas);
- }
- break;
- }