From: <Ven...@us...> - 2009-08-07 22:26:11
|
Revision: 4201 http://planeshift.svn.sourceforge.net/planeshift/?rev=4201&view=rev Author: Vengeance2001 Date: 2009-08-07 22:26:03 +0000 (Fri, 07 Aug 2009) Log Message: ----------- - Improved how the tree view renders, so it looks better - Fixed pawsTextBox vertical centering to actually work - Took out hardcoded padding values in text size calculations - Changed how the lines on the pawsTree are rendered to link nodes together. Modified Paths: -------------- trunk/src/client/gui/pawsconfigkeys.cpp trunk/src/client/gui/pawssummary.cpp trunk/src/common/paws/pawsmenu.cpp trunk/src/common/paws/pawspromptwindow.cpp trunk/src/common/paws/pawstextbox.cpp trunk/src/common/paws/pawstextbox.h trunk/src/common/paws/pawstree.cpp Modified: trunk/src/client/gui/pawsconfigkeys.cpp =================================================================== --- trunk/src/client/gui/pawsconfigkeys.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/client/gui/pawsconfigkeys.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -188,6 +188,7 @@ label->Show(); label->SetParent( this ); label->SetRelativeFrame( 0, 0, GetActualWidth(COMMAND_WIDTH), 20 ); + label->VertAdjust(pawsTextBox::vertCENTRE); rootAsSeq->AddSeqWidget(label, GetActualWidth(COMMAND_WIDTH) + GetActualWidth(COLUMN_SPACING)); key = new pawsTextBox(); @@ -196,6 +197,7 @@ key->Show(); key->SetParent( this ); key->SetRelativeFrame( GetActualWidth(COMMAND_WIDTH)+5, 0, GetActualWidth(TRIGGER_WIDTH), 20 ); + key->VertAdjust(pawsTextBox::vertCENTRE); rootAsSeq->AddSeqWidget(key, GetActualWidth(TRIGGER_WIDTH) + GetActualWidth(COLUMN_SPACING)); button = new pawsButton(); Modified: trunk/src/client/gui/pawssummary.cpp =================================================================== --- trunk/src/client/gui/pawssummary.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/client/gui/pawssummary.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -61,7 +61,7 @@ pawsTextBox* label_name = (pawsTextBox*) FindWidget("label_name"); label_name->HorizAdjust(pawsTextBox::horizCENTRE); label_name->SetText(createManager->GetName().GetData()); - label_name->SetSizeByText(); + label_name->SetSizeByText(5,5); csString textString; csString lifeString; Modified: trunk/src/common/paws/pawsmenu.cpp =================================================================== --- trunk/src/common/paws/pawsmenu.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/common/paws/pawsmenu.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -119,7 +119,7 @@ if (attr != NULL) { label->SetText(PawsManager::GetSingleton().Translate(attr->GetValue())); - label->SetSizeByText(); + label->SetSizeByText(5,5); } attr = node->GetAttribute("colour"); @@ -264,7 +264,7 @@ void pawsMenuItem::SetSizes(int labelWidth, int _spacing, int _border) { if (labelWidth == -1) - label->SetSizeByText(); + label->SetSizeByText(5,5); else label->SetRelativeFrameSize(labelWidth, label->DefaultFrame().Height()); spacing = _spacing; @@ -473,7 +473,7 @@ if (node->GetAttributeValue("label")) { label->SetText(PawsManager::GetSingleton().Translate(node->GetAttributeValue("label"))); - label->SetSizeByText(); + label->SetSizeByText(5,5); label->Show(); AddChild(label); } Modified: trunk/src/common/paws/pawspromptwindow.cpp =================================================================== --- trunk/src/common/paws/pawspromptwindow.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/common/paws/pawspromptwindow.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -74,7 +74,7 @@ void pawsPromptWindow::SetLabel(const csString & label) { this->label->SetText(label); - this->label->SetSizeByText(); + this->label->SetSizeByText(5,5); LayoutWindow(); } Modified: trunk/src/common/paws/pawstextbox.cpp =================================================================== --- trunk/src/common/paws/pawstextbox.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/common/paws/pawstextbox.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -108,7 +108,7 @@ int width, height; if (!screenFrame.Height()) - SetSizeByText(); + SetSizeByText(0,0); if (horizAdjust==horizRIGHT || horizAdjust==horizCENTRE || vertAdjust==vertBOTTOM || vertAdjust==vertCENTRE) CalcTextSize(width, height); @@ -216,13 +216,12 @@ else if (text.GetData() != NULL) { GetFont()->GetDimensions( (const char*)text, width, height ); - width+=5; - height+=5; + //width+=5; + //height+=5; } else { - width = 0; - height = 0; + GetFont()->GetDimensions("Sample", width, height); // Example text with full height caps and descenders } } @@ -268,12 +267,13 @@ CalcTextPos(); } -void pawsTextBox::SetSizeByText() +void pawsTextBox::SetSizeByText(int padX, int padY) { int width, height; - + + // These padding parameters used to be hardcoded to 5,5 in all cases inside CalcTextSize. CalcTextSize(width, height); - SetRelativeFrameSize(width, height); + SetRelativeFrameSize(width+padX, height+padY); textX = 0; textY = 0; } Modified: trunk/src/common/paws/pawstextbox.h =================================================================== --- trunk/src/common/paws/pawstextbox.h 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/common/paws/pawstextbox.h 2009-08-07 22:26:03 UTC (rev 4201) @@ -66,7 +66,7 @@ void VertAdjust (pawsVertAdjust horiz); // Sets size of the widget to fit the text that it displays: - void SetSizeByText(); + void SetSizeByText(int padX,int padY); // Normal text boxes should not be focused. virtual bool OnGainFocus( bool notifyParent = true ) {return false;} Modified: trunk/src/common/paws/pawstree.cpp =================================================================== --- trunk/src/common/paws/pawstree.cpp 2009-08-07 14:38:17 UTC (rev 4200) +++ trunk/src/common/paws/pawstree.cpp 2009-08-07 22:26:03 UTC (rev 4201) @@ -828,29 +828,29 @@ { hasCollSign = child->IsCollapsable() && (child->GetFirstChild() != NULL); childFrame = child->ScreenFrame(); + GetCollapseSignFrame(child, collSignFrame); + horizLineY = (childFrame.ymin + childFrame.ymax) / 2; - GetCollapseSignFrame(child, collSignFrame); - if (hasCollSign) - { - horizLineXMin = collSignFrame.xmax; - vertLineYMax = collSignFrame.ymin-1; - } - else - { - horizLineXMin = vertLineX; - vertLineYMax = horizLineY; - } - g2d->DrawLine(vertLineX, vertLineYMin, vertLineX, vertLineYMax, lineColor); + horizLineXMin = (hasCollSign) ? collSignFrame.xmax : vertLineX; + + vertLineYMax = (hasCollSign) ? collSignFrame.ymin-1 : horizLineY; + + if (child != tree->GetRoot() ) + g2d->DrawLine(vertLineX, vertLineYMin, vertLineX, vertLineYMax, lineColor); + g2d->DrawLine(horizLineXMin, horizLineY, childFrame.xmin - 3, horizLineY, lineColor); + + // These draw an outline on the bounding box of the node widget to check bounds + //g2d->DrawLine(childFrame.xmin, childFrame.ymin, childFrame.xmax, childFrame.ymin, lineColor); + //g2d->DrawLine(childFrame.xmin, childFrame.ymin, childFrame.xmin, childFrame.ymax, lineColor); + //g2d->DrawLine(childFrame.xmin, childFrame.ymax, childFrame.xmax, childFrame.ymax, lineColor); + //g2d->DrawLine(childFrame.xmax, childFrame.ymin, childFrame.xmax, childFrame.ymax, lineColor); + DecorateSubtree(child); - // determines vertLineYMin for next sibling: - if (hasCollSign) - vertLineYMin = collSignFrame.ymax+1; - else - vertLineYMin = horizLineY; + // determine vertLineYMin for next sibling + vertLineYMin = (hasCollSign) ? collSignFrame.ymax+1 : horizLineY; - child = child->GetNextSibling(); } while (child != NULL); @@ -1510,7 +1510,8 @@ if (textBox == NULL) return; textBox->SetText(label); - textBox->SetSizeByText(); + textBox->SetSizeByText(5,5); + textBox->VertAdjust(pawsTextBox::vertCENTRE); textBox->MoveTo(lastX+1,0); widget->AddChild(textBox); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |