Skip to content

Commit

Permalink
Shell|libdeng2: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 23, 2013
1 parent c92d630 commit f2c9de7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
11 changes: 7 additions & 4 deletions doomsday/libdeng2/include/de/data/counted.h
Expand Up @@ -97,10 +97,13 @@ class DENG2_PUBLIC Counted
};

/**
* Reduces a reference count by one without deleting the object. This should be
* used when allocating reference-counted objects (with new) in a situation
* where a reference will immediately be taken by someone else. It avoids one
* having to call release() on the newly allocated object.
* Reduces the reference count by one without deleting the object. This should
* be used when allocating reference-counted objects (with new) in a situation
* where a reference to the new object is not kept and a reference will
* immediately be taken by someone else. It avoids one having to call release()
* on the newly allocated object.
*
* @param counted Reference-counted object.
*/
template <typename Type>
inline Type *refless(Type *counted) {
Expand Down
24 changes: 11 additions & 13 deletions doomsday/tools/shell/shell-text/src/shellapp.cpp
Expand Up @@ -28,29 +28,27 @@ struct ShellApp::Instance

Instance(ShellApp &a) : self(a)
{
RootWidget &root = self.rootWidget();

logWidget = new LogWidget;

ScalarRule *anim = de::refless(new ScalarRule(0));
anim->set(de::refless(new de::OperatorRule(de::OperatorRule::Divide,
self.rootWidget().viewWidth(),
de::refless(new ConstantRule(2)))), 2);
/*anim->set(de::refless(new de::ConstantRule(10)), 2);*/
ScalarRule *anim = refless(new ScalarRule(0));
anim->set(refless(new OperatorRule(
OperatorRule::Divide, root.viewWidth(), refless(new ConstantRule(2)))));
/*anim->set(refless(new ConstantRule(10)), 2);*/

logWidget->rule()
.setInput(RectangleRule::Left, anim)
.setInput(RectangleRule::Top, de::refless(new ConstantRule(0)))
.setInput(RectangleRule::Width, self.rootWidget().viewWidth())
.setInput(RectangleRule::Height, self.rootWidget().viewHeight());

self.rootWidget().add(logWidget);
.setInput(RectangleRule::Top, refless(new ConstantRule(0)))
.setInput(RectangleRule::Width, root.viewWidth())
.setInput(RectangleRule::Height, root.viewHeight());

self.rootWidget().draw();
root.add(logWidget); // takes ownership
}
};

ShellApp::ShellApp(int &argc, char **argv) : CursesApp(argc, argv), d(new Instance(*this))
{
}
{}

ShellApp::~ShellApp()
{
Expand Down

0 comments on commit f2c9de7

Please sign in to comment.