[Gcblue-commits] gcb_wx/src/graphics tcConsoleBox.cpp,1.3,1.4
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:32
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/src/graphics Modified Files: tcConsoleBox.cpp Log Message: Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcConsoleBox.cpp 11 Apr 2004 22:05:44 -0000 1.3 --- tcConsoleBox.cpp 9 May 2004 20:40:22 -0000 1.4 *************** *** 145,148 **** --- 145,191 ---- + void tcConsoleBox::InitFromXml(TiXmlNode* config) + { + if (!config) + { + std::cerr << "Error - bad xml config file for Console Box" << std::endl; + InitGdi(9, 0xFE64FF64); + return; + } + + /* some of code below could be moved to a parent class so it isn't + * repeated so much + */ + TiXmlElement* current = config->ToElement(); + wxASSERT(current); + if (current == NULL) return; + + // read window dimensions from XML + int x; + int y; + int width; + int height; + + current->Attribute("X", &x); + current->Attribute("Y", &y); + current->Attribute("Width", &width); + current->Attribute("Height", &height); + + SetSize(x, y, width, height); // set all size params + nyzero = height - 20; + + double fontSize; + current->Attribute("FontSize", &fontSize); + + if (fontSize == 0) + { + InitGdi(9, 0xFE64FF64); + } + else + { + InitGdi(fontSize, 0xFE64FF64); + } + } + void tcConsoleBox::InitGdi(float afFontSize, UINT32 anColor) { *************** *** 237,240 **** --- 280,287 ---- ////////////////////////////////////////////////////////////////////// + /** + * Shared surface version of constructor. Use this for a console + * box that is within a GUI window + */ tcConsoleBox::tcConsoleBox(tcWindow *parent, TiXmlNode *config) : tcWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLConsoleBox", parent), *************** *** 255,297 **** mpPen = NULL; ! if (!config) ! { ! std::cerr << "Error - bad xml config file for Console Box" << std::endl; ! InitGdi(9, 0xFE64FF64); ! return; ! } ! ! /* some of code below should be moved to a parent class so it isn't ! * repeated so much ! */ ! TiXmlElement* current = config->ToElement(); ! wxASSERT(current); ! if (current == NULL) return; ! ! // read window dimensions from XML ! int x; ! int y; ! int width; ! int height; ! ! current->Attribute("X", &x); ! current->Attribute("Y", &y); ! current->Attribute("Width", &width); ! current->Attribute("Height", &height); ! ! SetSize(x, y, width, height); // set all size params ! nyzero = height - 20; ! ! double fontSize; ! current->Attribute("FontSize", &fontSize); ! ! if (fontSize == 0) ! { ! InitGdi(9, 0xFE64FF64); ! } ! else ! { ! InitGdi(fontSize, 0xFE64FF64); ! } } --- 302,306 ---- mpPen = NULL; ! InitFromXml(config); } |