From: <mg...@us...> - 2008-06-26 18:55:44
|
Revision: 1804 http://planeshift.svn.sourceforge.net/planeshift/?rev=1804&view=rev Author: mgist Date: 2008-06-26 11:55:53 -0700 (Thu, 26 Jun 2008) Log Message: ----------- - pslaunch improvements. Modified Paths: -------------- trunk/data/gui/pslaunch.xml trunk/src/common/paws/pawstextbox.cpp trunk/src/common/paws/pawstextbox.h trunk/src/pslaunch/pawslauncherwindow.cpp trunk/src/pslaunch/updaterengine.cpp trunk/src/pslaunch/updaterengine.h Modified: trunk/data/gui/pslaunch.xml =================================================================== --- trunk/data/gui/pslaunch.xml 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/data/gui/pslaunch.xml 2008-06-26 18:55:53 UTC (rev 1804) @@ -15,8 +15,8 @@ <widget name="NewsWindow" factory="pawsButton" id="111" alwaysontop="true"> <bgimage resource="News Window" alpha="255" fade="false"/> <frame x="60" y="50" width="300" height="470" /> - <widget name="ServerNews" factory="pawsMultiLineTextBox" id="1111"> - <frame x="60" y="50" width="400" height="120" /> + <widget name="ServerNews" factory="pawsMessageTextBox" id="1111"> + <frame x="20" y="40" width="280" height="220" /> </widget> </widget> Modified: trunk/src/common/paws/pawstextbox.cpp =================================================================== --- trunk/src/common/paws/pawstextbox.cpp 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/src/common/paws/pawstextbox.cpp 2008-06-26 18:55:53 UTC (rev 1804) @@ -384,7 +384,7 @@ adjusted.Empty(); for ( size_t x = 0; x < messages.GetSize(); x++ ) { - SplitMessage( messages[x]->text, messages[x]->colour ); + SplitMessage( messages[x]->text, messages[x]->colour, messages[x]->size ); } } @@ -436,12 +436,19 @@ { if ( x < adjusted.GetSize() ) { + int oldSize = GetFont()->GetSize(); + if(adjusted[x]->size) + { + ChangeFontSize(adjusted[x]->size); + } + graphics2D->Write( GetFont(), screenFrame.xmin, screenFrame.ymin + yPos*lineHeight, adjusted[x]->colour, -1, - (const char*)adjusted[x]->text ); + (const char*)adjusted[x]->text ); + ChangeFontSize(oldSize); yPos++; } } @@ -500,19 +507,43 @@ // Add it to the main message buffer. MessageLine * msg = new MessageLine; - int colour; - msg->text = messageText; - if ( msgColour != -1 ) - colour = msgColour; - else + // Find font info embedded in the data. + int colour = msgColour; + int size = 0; + + size_t pos = messageText.Find("<f"); + if(pos != (size_t)-1) + { + csString fontData = messageText.Slice(pos, messageText.FindFirst('>')+1); + csRef<iDocumentSystem> xml; + xml.AttachNew(new csTinyDocumentSystem); + csRef<iDocument> doc = xml->CreateDocument(); + doc->Parse(fontData); + + if(msgColour == -1) + { + int r = doc->GetRoot()->GetNode("f")->GetAttributeValueAsInt("r"); + int g = doc->GetRoot()->GetNode("f")->GetAttributeValueAsInt("g"); + int b = doc->GetRoot()->GetNode("f")->GetAttributeValueAsInt("b"); + colour = graphics2D->FindRGB(r, g, b); + } + + size = doc->GetRoot()->GetNode("f")->GetAttributeValueAsInt("s"); + messageText = messageText.Slice(messageText.Find(">", pos)+1); + } + else if(msgColour == -1) + { colour = GetFontColour(); + } + + msg->size = size; msg->colour = colour; - + msg->text = messageText; messages.Push(msg); - SplitMessage( messageText, colour ); + SplitMessage( messageText, colour, size ); if (scrollBar) { @@ -572,13 +603,18 @@ } -void pawsMessageTextBox::SplitMessage( const char* newText, int colour ) +void pawsMessageTextBox::SplitMessage( const char* newText, int colour, int size ) { if ( newText != NULL ) { int maxWidth; int maxHeight; + int oldSize = GetFont()->GetSize(); + if(size) + { + ChangeFontSize(size); + } GetFont()->GetMaxSize( maxWidth, maxHeight ); char* dummy = new char[strlen( newText ) + 1]; @@ -598,7 +634,8 @@ { csString temp( dummy ); MessageLine* msgLine = new MessageLine; - msgLine->text = temp; + msgLine->size = size; + msgLine->text = temp; msgLine->colour = colour; adjusted.Push( msgLine ); break; @@ -619,17 +656,18 @@ } // Index now points to the whitespace line so we can break it here. - csString test; test.Append( dummy, index ); dummy+=index; MessageLine* msgLine = new MessageLine; - msgLine->text = test; + msgLine->size = size; + msgLine->text = test; msgLine->colour = colour; adjusted.Push( msgLine ); } } - + + ChangeFontSize(oldSize); delete [] head; } } Modified: trunk/src/common/paws/pawstextbox.h =================================================================== --- trunk/src/common/paws/pawstextbox.h 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/src/common/paws/pawstextbox.h 2008-06-26 18:55:53 UTC (rev 1804) @@ -135,6 +135,14 @@ { csString text; int colour; + int size; + + MessageLine() + { + text = ""; + colour = 0; + size = 0; + } }; pawsMessageTextBox( ); @@ -186,7 +194,7 @@ //void AdjustMessages(); - void SplitMessage( const char* text, int colour ); + void SplitMessage( const char* text, int colour, int size ); /// Calculates value of the lineHeight attribute void CalcLineHeight(); Modified: trunk/src/pslaunch/pawslauncherwindow.cpp =================================================================== --- trunk/src/pslaunch/pawslauncherwindow.cpp 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/src/pslaunch/pawslauncherwindow.cpp 2008-06-26 18:55:53 UTC (rev 1804) @@ -66,7 +66,7 @@ void pawsLauncherWindow::UpdateNews() { - pawsMultiLineTextBox* serverNews = (pawsMultiLineTextBox*)FindWidget("ServerNews"); + pawsMessageTextBox* serverNews = (pawsMessageTextBox*)FindWidget("ServerNews"); psLaunchGUI->GetDownloader()->DownloadFile(configFile->GetStr("Launcher.News.URL", ""), "servernews", true, false); ifstream newsFile("servernews", ifstream::in); @@ -76,7 +76,7 @@ buffer.Append((char)newsFile.get()); } buffer.Truncate(buffer.Length()-1); - serverNews->SetText(buffer.GetDataSafe()); + serverNews->AddMessage(buffer.GetDataSafe()); newsFile.close(); psLaunchGUI->GetFileUtil()->RemoveFile("servernews"); } @@ -160,6 +160,7 @@ launcherMain->Show(); launcherMain->OnGainFocus(); SaveSettings(); + LoadSettings(); } else if(ID == SETTINGS_AUDIO_BUTTON) { @@ -226,6 +227,7 @@ // Graphics Preset pawsComboBox* graphicsPreset = (pawsComboBox*)FindWidget("GraphicsPreset"); + graphicsPreset->Clear(); graphicsPreset->NewOption("Highest"); graphicsPreset->NewOption("High"); graphicsPreset->NewOption("Medium"); @@ -242,6 +244,7 @@ // Screen Resolution pawsComboBox* resolution = (pawsComboBox*)FindWidget("ScreenResolution"); + resolution->Clear(); resolution->NewOption("1920x1200"); resolution->NewOption("1680x1050"); resolution->NewOption("1600x1200"); @@ -308,6 +311,7 @@ // AA pawsComboBox* antiAliasing = (pawsComboBox*)FindWidget("AntiAiasing"); + antiAliasing->Clear(); antiAliasing->NewOption("0x"); antiAliasing->NewOption("2x"); antiAliasing->NewOption("2xQ"); @@ -344,6 +348,7 @@ // Anistropic pawsComboBox* anistopicFiltering = (pawsComboBox*)FindWidget("AnisotropicFiltering"); + anistopicFiltering->Clear(); anistopicFiltering->NewOption("0x"); anistopicFiltering->NewOption("1x"); anistopicFiltering->NewOption("2x"); @@ -361,6 +366,7 @@ // Texture Quality pawsComboBox* textureQuality = (pawsComboBox*)FindWidget("TextureQuality"); + textureQuality->Clear(); textureQuality->NewOption("High"); textureQuality->NewOption("Medium"); textureQuality->NewOption("Low"); @@ -397,6 +403,7 @@ textureQuality->Select(setting); pawsComboBox* shaders = (pawsComboBox*)FindWidget("Shaders"); + shaders->Clear(); shaders->NewOption("Basic"); shaders->NewOption("Advanced"); @@ -469,6 +476,7 @@ // Fill the skins pawsComboBox* skins = (pawsComboBox*)FindWidget("Skins"); + skins->Clear(); csString skinPath = configPSC.GetStr("PlaneShift.GUI.Skin.Dir"); csRef<iStringArray> files = psLaunchGUI->GetVFS()->FindFiles(skinPath); for (size_t i = 0; i < files->GetSize(); i++) Modified: trunk/src/pslaunch/updaterengine.cpp =================================================================== --- trunk/src/pslaunch/updaterengine.cpp 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/src/pslaunch/updaterengine.cpp 2008-06-26 18:55:53 UTC (rev 1804) @@ -322,7 +322,7 @@ } // Compare Versions. - return(config->UpdatePlatform() && config->GetNewConfig()->GetUpdaterVersionLatest() != UPDATER_VERSION); + return(config->UpdatePlatform() && config->GetNewConfig()->GetUpdaterVersionLatest() > UPDATER_VERSION); } bool UpdaterEngine::CheckGeneral() Modified: trunk/src/pslaunch/updaterengine.h =================================================================== --- trunk/src/pslaunch/updaterengine.h 2008-06-26 18:21:15 UTC (rev 1803) +++ trunk/src/pslaunch/updaterengine.h 2008-06-26 18:55:53 UTC (rev 1804) @@ -34,7 +34,7 @@ #include "util/singleton.h" /* To be incremented every time we want to make an update. */ -#define UPDATER_VERSION 5 +#define UPDATER_VERSION 1.0 struct iConfigManager; struct iVFS; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |