Skip to content

Commit

Permalink
libdeng2: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 23, 2013
1 parent 035f688 commit 4a1e995
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
10 changes: 10 additions & 0 deletions doomsday/libdeng2/include/de/widgets/rootwidget.h
Expand Up @@ -27,6 +27,16 @@ namespace de {

class Rule;

/**
* Widget that represents the root of the widget tree.
*
* Events passed to and draw requests on the root widget propagate to the
* entire tree. Other widgets may query the size of the view from the root
* widget.
*
* The view dimensions are available as Rule instances so that widgets'
* position rules may be defined relative to them.
*/
class RootWidget : public Widget
{
public:
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/widgets/scalarrule.h
Expand Up @@ -57,7 +57,7 @@ protected slots:

private:
Animation _animation;
Rule const *_rule;
Rule const *_targetRule;
};

} // namespace de
Expand Down
14 changes: 7 additions & 7 deletions doomsday/libdeng2/src/widgets/scalarrule.cpp
Expand Up @@ -24,15 +24,15 @@
namespace de {

ScalarRule::ScalarRule(float initialValue)
: Rule(initialValue), _animation(initialValue), _rule(0)
: Rule(initialValue), _animation(initialValue), _targetRule(0)
{}

void ScalarRule::set(float target, de::TimeDelta transition)
{
if(_rule)
if(_targetRule)
{
independentOf(_rule);
_rule = 0;
independentOf(_targetRule);
_targetRule = 0;
}

connect(&_animation.clock(), SIGNAL(timeChanged()), this, SLOT(timeChanged()));
Expand All @@ -47,15 +47,15 @@ void ScalarRule::set(Rule const *target, TimeDelta transition)

// Keep a reference.
dependsOn(target);
_rule = target;
_targetRule = target;
}

void ScalarRule::update()
{
// When using a rule for the target, keep it updated.
if(_rule)
if(_targetRule)
{
_animation.adjustTarget(_rule->value());
_animation.adjustTarget(_targetRule->value());
}

setValue(_animation);
Expand Down

0 comments on commit 4a1e995

Please sign in to comment.