Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent de9781e commit b737201
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 51 deletions.
51 changes: 0 additions & 51 deletions doomsday/libs/gui/src/flowlayout.cpp
Expand Up @@ -25,40 +25,34 @@ DE_PIMPL(FlowLayout)
GuiWidgetList widgets;
const Rule * maxLength;
const Rule * rightEdge;
const Rule * rowWidth;
const Rule * rowHeight;
const Rule * initialX;
const Rule * initialY;
const Rule * posX;
const Rule * posY;
// const Rule * totalWidth;
const Rule * totalHeight;

Impl(Public *i, const Rule &x, const Rule &y, const Rule &maxLength)
: Base(i)
, maxLength(holdRef(maxLength))
, rightEdge(new OperatorRule(OperatorRule::Sum, x, maxLength))
, rowWidth(nullptr)
, rowHeight(nullptr)
, initialX(holdRef(x))
, initialY(holdRef(y))
, posX(holdRef(x))
, posY(holdRef(y))
// , totalWidth(new ConstantRule(0))
, totalHeight(new ConstantRule(0))
{}

~Impl()
{
releaseRef(maxLength);
releaseRef(rightEdge);
releaseRef(rowWidth);
releaseRef(rowHeight);
releaseRef(initialX);
releaseRef(initialY);
releaseRef(posX);
releaseRef(posY);
// releaseRef(totalWidth);
releaseRef(totalHeight);
}

Expand All @@ -67,18 +61,10 @@ DE_PIMPL(FlowLayout)
widgets.clear();
changeRef(posX, *initialX);
changeRef(posY, *initialY);
releaseRef(rowWidth);
releaseRef(rowHeight);
// changeRef(totalWidth, *refless(new ConstantRule(0)));
changeRef(totalHeight, *refless(new ConstantRule(0)));
}

void advancePos(const Rule &amount)
{
changeRef(posX, *posX + amount);
changeRef(rowWidth, *rowWidth + amount);
}

void append(GuiWidget *widget, const Rule *spaceBefore)
{
if (spaceBefore)
Expand All @@ -97,7 +83,6 @@ DE_PIMPL(FlowLayout)
rule.setLeftTop(*initialX, *initialY);
changeRef(posX, *initialX + w);
changeRef(posY, *initialY);
// changeRef(rowWidth, w);
changeRef(rowHeight, h);
changeRef(totalHeight, h);
}
Expand Down Expand Up @@ -129,42 +114,6 @@ DE_PIMPL(FlowLayout)
}

widgets << widget;

// }
// else if (isVertical(dir) && !fixedWidth)
// {
// changeRef(totalWidth, OperatorRule::maximum(*totalWidth, w));
// }
// }

// Move along the movement direction for the major axis.
// switch (dir)
// {
// case ui::Right:

// rule.setInput(Rule::Left, *posX);
// advancePos(w);

// break;

// case ui::Left:
// rule.setInput(Rule::Right, *posX);
// advancePos(w);
// break;

// case ui::Down:
// rule.setInput(Rule::Top, *posY);
// advancePos(h);
// break;

// case ui::Up:
// rule.setInput(Rule::Bottom, *posY);
// advancePos(h);
// break;

// default:
// break;
// }
}
};

Expand Down
7 changes: 7 additions & 0 deletions doomsday/tests/test_appfw/src/mainwindow.cpp
Expand Up @@ -124,6 +124,9 @@ DE_PIMPL(MainWindow)
compositor->add(button);

// Try some flow.
#if defined (DE_DEBUG)
const int count1 = Counted::totalCount;
#endif
{
FlowLayout flow(Const(0), Const(0), root.viewWidth() / 2);

Expand All @@ -139,6 +142,10 @@ DE_PIMPL(MainWindow)
compositor->add(lw);
}
}
#if defined (DE_DEBUG)
const int count2 = Counted::totalCount;
debug("de::Counted increase during FlowLayout creation: %i", count2 - count1);
#endif

// Mouse cursor.
cursor = new LabelWidget;
Expand Down

0 comments on commit b737201

Please sign in to comment.