Revision: 8792
http://playerstage.svn.sourceforge.net/playerstage/?rev=8792&view=rev
Author: hsujohnhsu
Date: 2010-06-25 01:08:44 +0000 (Fri, 25 Jun 2010)
Log Message:
-----------
recovering initial user gui camera position, e.g.
<rendering:gui>
<type>fltk</type>
<size>480 320</size>
<pos>0 0</pos>
<frames>
<row height="100%">
<camera width="100%">
<xyz>0.3 0 3</xyz>
<rpy>0 90 90</rpy>
</camera>
</row>
</frames>
</rendering:gui>
Modified Paths:
--------------
code/gazebo/trunk/server/gui/GLFrameManager.cc
Modified: code/gazebo/trunk/server/gui/GLFrameManager.cc
===================================================================
--- code/gazebo/trunk/server/gui/GLFrameManager.cc 2010-06-25 01:07:33 UTC
(rev 8791)
+++ code/gazebo/trunk/server/gui/GLFrameManager.cc 2010-06-25 01:08:44 UTC
(rev 8792)
@@ -59,14 +59,68 @@
// Load from xml
void GLFrameManager::Load( XMLConfigNode *node )
{
- this->configNode = node;
GLFrame *frame = NULL;
int windowCount = 0;
+ XMLConfigNode *rowNode = NULL;
+ XMLConfigNode *camNode = NULL;
- // First, create one big window
- frame = new GLFrame( this->x(), this->y(), this->w(), this->h(), "" );
- this->frames.push_back( frame );
- this->insert(*frame, windowCount);
+ if (node)
+ {
+ rowNode = node->GetChild("row");
+
+ float frameHeight, frameWidth;
+ int width = this->w();
+ int height = this->h();
+ int x = this->x();
+ int y = this->y();
+
+ // Process each row
+ while (rowNode)
+ {
+ camNode = rowNode->GetChild("camera");
+
+ std::string heightStr = rowNode->GetString("height","",1);
+
+ frameHeight = atof( heightStr.substr(0, heightStr.find( "%", 0 )
).c_str() );
+
+ frameHeight = frameHeight/100.0 * height;
+
+ // Process each camera
+ while (camNode)
+ {
+ std::string widthStr = camNode->GetString("width","",1);
+ frameWidth = atof( widthStr.substr(0, widthStr.find( "%", 0 )
).c_str() );
+
+ frameWidth = frameWidth/100.0 * width;
+
+ windowCount = this->children();
+
+ // Create the frame
+ frame = new GLFrame( x, y, (int)frameWidth, (int)frameHeight, "" );
+ frame->Load(camNode);
+
+ this->frames.push_back( frame );
+ this->insert(*frame, windowCount);
+
+ x += (int)frameWidth;
+
+ camNode = camNode->GetNext();
+ }
+
+ y += (int)frameHeight;
+ x = this->x();
+
+ rowNode = rowNode->GetNext();
+ }
+ }
+
+ // Create a big default window if no frames have been defined
+ if (this->frames.size() == 0)
+ {
+ frame = new GLFrame( this->x(), this->y(), this->w(), this->h(), "" );
+ this->frames.push_back( frame );
+ this->insert(*frame, windowCount);
+ }
}
////////////////////////////////////////////////////////////////////////////////
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit