From: <Ven...@us...> - 2009-08-07 05:57:09
|
Revision: 4196 http://planeshift.svn.sourceforge.net/planeshift/?rev=4196&view=rev Author: Vengeance2001 Date: 2009-08-07 05:56:57 +0000 (Fri, 07 Aug 2009) Log Message: ----------- - pawsConfigKeys is now working although it still doesn't look perfect. Whoever wrote the pawsTree code should be taken out and shot. - NB: Very possible that new GUI and new Tree bugs are introduced by this set of "fixes". Please test well. Modified Paths: -------------- trunk/src/client/gui/pawsconfigkeys.cpp trunk/src/client/gui/pawsconfigkeys.h trunk/src/common/paws/pawstree.cpp trunk/src/common/paws/pawstree.h trunk/src/common/paws/pawswidget.cpp trunk/src/common/paws/pawswidget.h Modified: trunk/src/client/gui/pawsconfigkeys.cpp =================================================================== --- trunk/src/client/gui/pawsconfigkeys.cpp 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/client/gui/pawsconfigkeys.cpp 2009-08-07 05:56:57 UTC (rev 4196) @@ -97,13 +97,12 @@ bool pawsConfigKeys::CreateTree() { - /*********** pawsTreeNode * root; + /**************** CS_ASSERT(tree == NULL); tree = new pawsTree(); - tree->MoveTo(screenFrame.xmin, screenFrame.ymin); - tree->SetSize(screenFrame.Width(), screenFrame.Height()); + tree->SetRelativeFrame(0, 0,parent->DefaultFrame().Width(),parent->DefaultFrame().Height()); tree->SetScrollBars(false, true); tree->SetTreeLayout(new pawsStdTreeLayout(tree, 5, 20)); tree->SetTreeDecorator(new pawsStdTreeDecorator(tree, graphics2D, 0x0000ff, 0x00ffff, 13)); @@ -111,14 +110,18 @@ if ( !tree->LoadFromFile("configkeys.xml") ) return false; + *********************/ + if (!LoadFromFile("configkeys.xml") ) + return false; + + tree = dynamic_cast<pawsTree *>(children[0]); + tree->SetRelativeFrameSize(parent->ScreenFrame().Width(), parent->ScreenFrame().Height()); + root = tree->GetRoot(); if (root != NULL) CreateTreeWidgets(root); - ****************/ - if (!LoadFromFile("configkeys.xml") ) - return false; return true; } @@ -180,7 +183,7 @@ if (rootAsSeq != NULL && rootAsSeq != tree->GetRoot()) { label = new pawsTextBox(); - label->SetSize(GetActualWidth(COMMAND_WIDTH), 20); + label->SetRelativeFrameSize(GetActualWidth(COMMAND_WIDTH), 20); label->SetColour(0xffffff); label->Show(); label->SetParent( this ); @@ -188,7 +191,7 @@ rootAsSeq->AddSeqWidget(label, GetActualWidth(COMMAND_WIDTH) + GetActualWidth(COLUMN_SPACING)); key = new pawsTextBox(); - key->SetSize(GetActualWidth(TRIGGER_WIDTH), 20); + key->SetRelativeFrameSize(GetActualWidth(TRIGGER_WIDTH), 20); key->SetColour(0xffffff); key->Show(); key->SetParent( this ); @@ -198,7 +201,7 @@ button = new pawsButton(); button->SetParent( this ); button->SetNotify(this); - button->SetSize(30, 20); + button->SetRelativeFrameSize(30, 20); button->SetUpImage("Blue Title"); button->SetDownImage("Blue Title"); button->SetText("Set"); @@ -216,6 +219,11 @@ } } +void pawsConfigKeys::Draw() +{ + pawsWidget::Draw(); +} + void pawsConfigKeys::UpdateNicks(pawsTreeNode * subtreeRoot) { if (subtreeRoot == NULL) Modified: trunk/src/client/gui/pawsconfigkeys.h =================================================================== --- trunk/src/client/gui/pawsconfigkeys.h 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/client/gui/pawsconfigkeys.h 2009-08-07 05:56:57 UTC (rev 4196) @@ -76,6 +76,8 @@ /// from pawsWidget: virtual bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget ); + virtual void Draw(); + /// from FingeringWindow virtual bool OnFingering(csString string, psControl::Device device, uint button, uint32 mods); Modified: trunk/src/common/paws/pawstree.cpp =================================================================== --- trunk/src/common/paws/pawstree.cpp 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/common/paws/pawstree.cpp 2009-08-07 05:56:57 UTC (rev 4196) @@ -212,7 +212,8 @@ tree->NewNode(node); - if (tree != NULL) tree->NodeChanged(); + if (tree != NULL) + tree->NodeChanged(); } void pawsTreeNode::MoveChild(pawsTreeNode * node, pawsTreeNode * nextSibling) @@ -1091,6 +1092,11 @@ return true; } +bool pawsTree::PostSetup() +{ + return true; +} + void pawsTree::Draw() { csRect oldClip; @@ -1315,10 +1321,10 @@ w->MoveTo(screenFrame.xmax+1, screenFrame.ymin); w->Show(); - Resize(width, 0, RESIZE_RIGHT); - widgetFrame = w->ScreenFrame(); - if (widgetFrame.ymax > screenFrame.ymax) - Resize(0, widgetFrame.ymax - screenFrame.ymax, RESIZE_BOTTOM); + int newWidth = width + defaultFrame.Width(); + int newHeight = MAX(w->DefaultFrame().Height(),defaultFrame.Height()); + + SetRelativeFrameSize(newWidth, newHeight); } void pawsSeqTreeNode::AddSeqWidget(pawsWidget * widget) @@ -1349,6 +1355,11 @@ return pawsTreeNode::Load(node); } +void pawsSeqTreeNode::Draw() +{ + pawsWidget::Draw(); +} + ////////////////////////////////////////////////////////////////////// // // pawsCheckTreeNode @@ -1409,7 +1420,7 @@ widget = _widget; widget->MoveTo(screenFrame.xmin, screenFrame.ymin); widgetFrame = widget->ScreenFrame(); - SetSize(widgetFrame.Width(), widgetFrame.Height()); + SetRelativeFrameSize(widgetFrame.Width(), widgetFrame.Height()); AddChild(widget); } Modified: trunk/src/common/paws/pawstree.h =================================================================== --- trunk/src/common/paws/pawstree.h 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/common/paws/pawstree.h 2009-08-07 05:56:57 UTC (rev 4196) @@ -220,6 +220,8 @@ // from pawsWidget: virtual bool Setup(iDocumentNode * node); + virtual bool PostSetup(); + virtual void Draw(); virtual bool OnMouseDown(int button, int modifiers, int x, int y); virtual bool OnKeyDown( int keyCode, int keyChar, int modifiers ); @@ -433,6 +435,9 @@ // calls AddWidget() with width of widget // OWNERSHIP of widget goes to pawsSeqTreeNode virtual pawsWidget * GetSeqWidget(int index); + + virtual void Draw(); + protected: csList<pawsSeqTreeNode_widget> widgets; }; Modified: trunk/src/common/paws/pawswidget.cpp =================================================================== --- trunk/src/common/paws/pawswidget.cpp 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/common/paws/pawswidget.cpp 2009-08-07 05:56:57 UTC (rev 4196) @@ -707,8 +707,8 @@ return false; } - if (name=="ChatWindow") - printf("Chat found."); + //if (name=="ChatWindow") + // printf("Chat found."); if ( ! LoadChildren(node) ) return false; Modified: trunk/src/common/paws/pawswidget.h =================================================================== --- trunk/src/common/paws/pawswidget.h 2009-08-06 21:46:39 UTC (rev 4195) +++ trunk/src/common/paws/pawswidget.h 2009-08-07 05:56:57 UTC (rev 4196) @@ -118,11 +118,6 @@ /// factory name csString factory; - pawsTitle * titleBar; - - /// filename to load from or save to. - csString filename; - /// The id of the widget. int id; @@ -132,12 +127,21 @@ /// The 2D graphics interface. csRef<iGraphics2D> graphics2D; + /// The default frame for the widget. + csRect defaultFrame; + /// The screen area of the widget. csRect screenFrame; /// Current clipping rectangle. csRect clipRect; + /// reference to titleBar object, if any + pawsTitle *titleBar; + + /// filename to load from or save to. + csString filename; + /// Used in SetTitle() for the new close button. pawsButton* close_widget; @@ -205,9 +209,6 @@ /// Old name of the widget with "_close" appended by SetName(). csString closeName; - /// The default frame for the widget. - csRect defaultFrame; - /// The variable that this widget is subscribed to csString subscribedVar; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |