From: Andrew C. <ac...@us...> - 2002-10-15 01:58:15
|
Update of /cvsroot/planeshift/planeshift/src/client/aws In directory usw-pr-cvs1:/tmp/cvs-serv22793/src/client/aws Modified Files: pscomp.cpp pscomp.h psinventorywindow.cpp Log Message: Added stack count to slots in inventory screen. Index: pscomp.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/pscomp.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pscomp.cpp 16 Sep 2002 21:46:32 -0000 1.21 --- pscomp.cpp 15 Oct 2002 01:58:11 -0000 1.22 *************** *** 1,3 **** ! /* * pscomp.cpp by Andrew Craig <ac...@gd...> * --- 1,3 ---- ! /* * pscomp.cpp by Andrew Craig <ac...@gd...> * *************** *** 110,114 **** lineHeight = 0; options = 0; ! backAlpha = 0; } --- 110,114 ---- lineHeight = 0; options = 0; ! useScrollBar = false; backAlpha = 0; } *************** *** 173,177 **** pm->GetInt(settings, "BackAlpha", backAlpha); ! return true; } --- 173,182 ---- pm->GetInt(settings, "BackAlpha", backAlpha); ! iAwsComponent* sb = FindChild("ScrollBar"); ! if ( sb ) ! { ! useScrollBar = true; ! } ! return true; } *************** *** 224,228 **** { size_t len = strcspn(newText, "\n"); ! unsigned int maxlen = font->GetLength(newText, Frame().Width()-16 ); // Only break line after a word --- 229,237 ---- { size_t len = strcspn(newText, "\n"); ! int offset = 0; ! if ( useScrollBar ) ! offset = 16; ! ! unsigned int maxlen = font->GetLength(newText, Frame().Width()-offset); // Only break line after a word *************** *** 698,702 **** slotImage->Setup( wmgr, siInfo->GetThisNode() ); - // Create the item graphics for the slot. itemImage = (psComponentImage*)fact->Create(); --- 707,710 ---- *************** *** 712,715 **** --- 720,736 ---- itemImage->Hide(); + /// The stack label + iAwsComponentFactory* labelfact = wmgr->FindComponentFactory("PS TextBox"); + stackLabel = (psComponentTextBox*)labelfact->Create(); + iAwsKeyFactory * labelInfo = awsPrefMgr->CreateKeyFactory(); + labelInfo->Initialize("StackCount", "PS TextBox"); + labelInfo->AddRectKey("Frame", csRect(8,8,31,31)); + labelInfo->AddIntKey("BackAlpha", 255); + labelInfo->AddStringKey("Text", "0"); + + stackLabel->SetParent( this ); + stackLabel->Setup( wmgr, labelInfo->GetThisNode() ); + stackLabel->Hide(); + return true; } *************** *** 724,731 **** --- 745,760 ---- } + void psComponentItemSlot::SetStackCount(const char* count) + { + CS_ASSERT( stackLabel != NULL ); + + stackLabel->SetText(count); + } + void psComponentItemSlot::OnAdded() { AddChild(slotImage); AddChild(itemImage); + AddChild(stackLabel); } *************** *** 734,737 **** --- 763,767 ---- itemImage->ChangeImage( item ); itemImage->Show(); + stackLabel->Show(); occupied = true; } *************** *** 741,744 **** --- 771,775 ---- { itemImage->Show(); + stackLabel->Show(); occupied = true; } *************** *** 748,751 **** --- 779,783 ---- { itemImage->Hide(); + stackLabel->Hide(); occupied = false; } Index: pscomp.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/pscomp.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pscomp.h 28 Aug 2002 22:14:56 -0000 1.15 --- pscomp.h 15 Oct 2002 01:58:11 -0000 1.16 *************** *** 140,144 **** int backAlpha; ! }; --- 140,144 ---- int backAlpha; ! bool useScrollBar; }; *************** *** 290,293 **** --- 290,294 ---- virtual void RemoveItem(); virtual void ReplaceItem(); + virtual void SetStackCount(const char* count); virtual iTextureHandle* GetItemImage(); *************** *** 296,299 **** --- 297,301 ---- protected: bool occupied; + psComponentTextBox* stackLabel; psComponentImage* slotImage; psComponentImage* itemImage; Index: psinventorywindow.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/psinventorywindow.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** psinventorywindow.cpp 18 Sep 2002 02:53:00 -0000 1.12 --- psinventorywindow.cpp 15 Oct 2002 01:58:11 -0000 1.13 *************** *** 98,103 **** bool psInventoryWindow::SendCommand( const char* cmd, void* ) { - printf("[psInventoryWindow::SendCommand(%s)\n", cmd); - /* When the inventory window is opened it has to send a request to the * server to ask to get the inventory. --- 98,101 ---- *************** *** 110,114 **** if ( msgHandler == NULL ) { ! csRef<iPSEngine> psengine = CS_QUERY_REGISTRY (object_reg, iPSEngine); msgHandler = psengine->GetMsgHandler(); --- 108,114 ---- if ( msgHandler == NULL ) { ! csRef<iPSEngine> psengine = ! CS_QUERY_REGISTRY (object_reg, iPSEngine); ! msgHandler = psengine->GetMsgHandler(); *************** *** 150,153 **** --- 150,154 ---- csString imageName; csString weight; + csString count; slotName.Clear(); *************** *** 158,167 **** tag.GetTagParm("IMG", imageName); tag.GetTagParm("WT", weight); if ( imageName.Length() != 0 ) { psComponentItemSlot* itemSlot = ! (psComponentItemSlot*)mainWindow->FindChild(slotName); if ( itemSlot != NULL ) itemSlot->PlaceItem(imageName); } weightTotal += atoi(weight.GetData()); --- 159,173 ---- tag.GetTagParm("IMG", imageName); tag.GetTagParm("WT", weight); + tag.GetTagParm("C", count); if ( imageName.Length() != 0 ) { psComponentItemSlot* itemSlot = ! (psComponentItemSlot*)mainWindow->FindChild(slotName); ! if ( itemSlot != NULL ) + { itemSlot->PlaceItem(imageName); + itemSlot->SetStackCount(count); + } } weightTotal += atoi(weight.GetData()); |