From: <wel...@us...> - 2010-08-16 05:31:35
|
Revision: 6160 http://planeshift.svn.sourceforge.net/planeshift/?rev=6160&view=rev Author: weltall2 Date: 2010-08-16 05:31:28 +0000 (Mon, 16 Aug 2010) Log Message: ----------- added support to show a background pic even in books and reworked the function for the sketch window in order to not make the background go over the edit buttons. Additional comment fixes to wrong doxygen statements. Split the draw function of pawswidget in two submethods Modified Paths: -------------- trunk/src/client/gui/pawsbookreadingwindow.cpp trunk/src/client/gui/pawsbookreadingwindow.h trunk/src/client/gui/pawsilluminationwindow.cpp trunk/src/client/gui/pawsilluminationwindow.h trunk/src/common/net/messages.cpp trunk/src/common/net/messages.h trunk/src/common/paws/pawswidget.cpp trunk/src/common/paws/pawswidget.h Modified: trunk/src/client/gui/pawsbookreadingwindow.cpp =================================================================== --- trunk/src/client/gui/pawsbookreadingwindow.cpp 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/client/gui/pawsbookreadingwindow.cpp 2010-08-16 05:31:28 UTC (rev 6160) @@ -99,6 +99,8 @@ descriptionCraft->Hide(); } description->Show(); + //set the background image for the book + bookBgImage = PawsManager::GetSingleton().GetTextureManager()->GetPawsImage(mesg.backgroundImg); break; } case MSGTYPE_CRAFT_INFO: @@ -178,6 +180,17 @@ return true; } +void pawsBookReadingWindow::Draw() +{ + pawsWidget::DrawWindow(); + + //draw background + if(bookBgImage) + bookBgImage->Draw(screenFrame, 0); + + pawsWidget::DrawForeground(); +} + csString pawsBookReadingWindow::filenameSafe(const csString &original) { csString safe; Modified: trunk/src/client/gui/pawsbookreadingwindow.h =================================================================== --- trunk/src/client/gui/pawsbookreadingwindow.h 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/client/gui/pawsbookreadingwindow.h 2010-08-16 05:31:28 UTC (rev 6160) @@ -51,6 +51,11 @@ csString filenameSafe(const csString &original); bool isBadChar(char c); + + /// Background image. + csRef<iPawsImage> bookBgImage; + virtual void Draw(); + }; CREATE_PAWS_FACTORY( pawsBookReadingWindow ); Modified: trunk/src/client/gui/pawsilluminationwindow.cpp =================================================================== --- trunk/src/client/gui/pawsilluminationwindow.cpp 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/client/gui/pawsilluminationwindow.cpp 2010-08-16 05:31:28 UTC (rev 6160) @@ -223,8 +223,14 @@ void pawsSketchWindow::Draw() { - pawsWidget::Draw(); + pawsWidget::DrawWindow(); + //draw background + if(sketchBgImage) + sketchBgImage->Draw(screenFrame, 0); + + pawsWidget::DrawForeground(); + // The close button X overrides the clip region so we have to set it back here ClipToParent(false); @@ -272,10 +278,6 @@ } } - //draw background - if(sketchBgImage) - sketchBgImage->Draw(screenFrame, 0); - DrawSketch(); } void pawsSketchWindow::DrawSketch() Modified: trunk/src/client/gui/pawsilluminationwindow.h =================================================================== --- trunk/src/client/gui/pawsilluminationwindow.h 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/client/gui/pawsilluminationwindow.h 2010-08-16 05:31:28 UTC (rev 6160) @@ -253,13 +253,13 @@ void HandleMessage( MsgEntry* message ); - // inherited from iOnStringEnteredAction + /// inherited from iOnStringEnteredAction void OnStringEntered(const char *name,int param,const char *value); - // inherited from iOnColorEnteredAction + /// inherited from iOnColorEnteredAction void OnColorEntered(const char *name,int param,int color); - // inherited from iScriptableVar from pawsWidget + /// inherited from iScriptableVar from pawsWidget double CalcFunction(const char * functionName, const double * params); Modified: trunk/src/common/net/messages.cpp =================================================================== --- trunk/src/common/net/messages.cpp 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/common/net/messages.cpp 2010-08-16 05:31:28 UTC (rev 6160) @@ -5746,9 +5746,9 @@ PSF_IMPLEMENT_MSG_FACTORY(psReadBookTextMessage,MSGTYPE_READ_BOOK); -psReadBookTextMessage::psReadBookTextMessage(uint32_t clientNum, csString& itemName, csString& bookText, bool canWrite, int slotID, int containerID) +psReadBookTextMessage::psReadBookTextMessage(uint32_t clientNum, csString& itemName, csString& bookText, bool canWrite, int slotID, int containerID, csString backgroundImg) { - msg.AttachNew(new MsgEntry(itemName.Length()+1 + bookText.Length()+1+1+2*sizeof(uint32_t))); + msg.AttachNew(new MsgEntry(itemName.Length()+1 + bookText.Length()+1+1+2*sizeof(uint32_t)+backgroundImg.Length()+1)); msg->SetType(MSGTYPE_READ_BOOK); msg->clientnum = clientNum; msg->Add(itemName); @@ -5756,6 +5756,8 @@ msg->Add((uint8_t) canWrite); msg->Add(slotID); msg->Add(containerID); + msg->Add(backgroundImg); + } psReadBookTextMessage::psReadBookTextMessage(MsgEntry* me ) @@ -5765,6 +5767,7 @@ canWrite = me->GetUInt8() ? true : false; slotID = me->GetUInt32(); containerID = me->GetUInt32(); + backgroundImg = me->GetStr(); } csString psReadBookTextMessage::ToString(AccessPointers * /*access_ptrs*/) Modified: trunk/src/common/net/messages.h =================================================================== --- trunk/src/common/net/messages.h 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/common/net/messages.h 2010-08-16 05:31:28 UTC (rev 6160) @@ -4178,7 +4178,7 @@ class psReadBookTextMessage : public psMessageCracker { public: - psReadBookTextMessage(uint32_t clientNum, csString& itemName, csString& bookText, bool canWrite, int slotID, int containerID); + psReadBookTextMessage(uint32_t clientNum, csString& itemName, csString& bookText, bool canWrite, int slotID, int containerID, csString backgroundImg); /** Crack out the details from the message. * This will look at the packet and figure out if it is a single item or a container. @@ -4198,11 +4198,13 @@ csString name; csString text; - //whether or not to display the 'edit' button + ///whether or not to display the 'edit' button bool canWrite; - //to identify which item this is later + ///to identify which item this is later int slotID; int containerID; + ///The image which will be shown as a background of this book. + csString backgroundImg; }; //-------------------------------------------------------------------------- Modified: trunk/src/common/paws/pawswidget.cpp =================================================================== --- trunk/src/common/paws/pawswidget.cpp 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/common/paws/pawswidget.cpp 2010-08-16 05:31:28 UTC (rev 6160) @@ -805,7 +805,6 @@ bool pawsWidget::LoadChildren( iDocumentNode* node ) { pawsWidget* widget; - // Get an iterator over all the child widgets csRef<iDocumentNodeIterator> childIter = node->GetNodes(); @@ -1167,7 +1166,7 @@ } } -void pawsWidget::Draw() +void pawsWidget::DrawWindow() { // Setup our clipping rect so we know where we can draw ClipToParent(true); @@ -1175,9 +1174,12 @@ // If we can't draw anywhere, then don't try. Our children can't be drawn either. if (clipRect.IsEmpty()) return; - + DrawBackground(); +} +void pawsWidget::DrawForeground() +{ ClipToParent(false); DrawChildren(); DrawMask(); @@ -1186,6 +1188,11 @@ titleBar->Draw(); } +void pawsWidget::Draw() +{ + DrawWindow(); + DrawForeground(); +} void pawsWidget::DrawWidgetText(const char *text, int x, int y, int style) { @@ -1669,6 +1676,18 @@ } } +bool pawsWidget::OnJoypadDown( int button, int modifiers ) +{ + if ( parent ) + { + return parent->OnJoypadDown( button, modifiers); + } + else + { + return false; + } +} + bool pawsWidget::OnKeyDown( utf32_char keyCode, utf32_char key, int modifiers ) { if (key == CSKEY_ENTER) Modified: trunk/src/common/paws/pawswidget.h =================================================================== --- trunk/src/common/paws/pawswidget.h 2010-08-16 05:28:26 UTC (rev 6159) +++ trunk/src/common/paws/pawswidget.h 2010-08-16 05:31:28 UTC (rev 6160) @@ -559,22 +559,27 @@ * @param node The xml data for the widget. * @return bool TRUE if no children, FALSE if there are problems with a * node. - * @remark User should overload this function to populate different types + * @remarks User should overload this function to populate different types * of widgets. Call this base class function to populate children. * This is NOT the same as Setup(), which is defining height, width, * styles, etc. This is data. */ virtual bool SelfPopulate( iDocumentNode *node ); + /// Does the first part of the drawing. It draws the background of the window. + void DrawWindow(); + /// Does the second part of the drawing drawing the background of the window. + void DrawForeground(); + /** Draws the widget and all of it's children. - * @remark Uses clipping rect of it's parent to define drawing area. + * @remarks Uses clipping rect of it's parent to define drawing area. * If the drawing area defined is empty it returns. */ virtual void Draw(); virtual void Draw3D(iGraphics3D*) {} /** Draws the background with a color or an image. - * @remark Uses focus status to apply appropriate fading. + * @remarks Uses focus status to apply appropriate fading. */ virtual void DrawBackground(); @@ -733,6 +738,13 @@ * GetFocusOverridesControls() as returning true */ virtual bool OnKeyDown( utf32_char keyCode, utf32_char keyChar, int modifiers ); + + /** Process joypadDown messages. + * @param key The key pressed. + * @param modifiers Used to modify behavior. + * @return bool TRUE for success FALSE if no action. + */ + virtual bool OnJoypadDown( int key, int modifiers ); /** Process Clipboard content, as a response to RequestClipboardContent * @param content The content of the clipboard This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |