Minor renames in SelectBoxState

This commit is contained in:
David Capello 2015-04-27 10:19:53 -03:00
parent dfeff22b2f
commit 215f594273
4 changed files with 18 additions and 18 deletions

View File

@ -53,8 +53,8 @@ public:
: m_editor(current_editor)
, m_rect(0, 0, current_editor->sprite()->width(), current_editor->sprite()->height())
, m_selectBoxState(new SelectBoxState(this, m_rect,
SelectBoxState::PaintRulers |
SelectBoxState::PaintDarkOutside)) {
SelectBoxState::RULERS |
SelectBoxState::DARKOUTSIDE)) {
setWidth(m_rect.w);
setHeight(m_rect.h);
setLeft(0);

View File

@ -192,8 +192,8 @@ private:
m_editor = current_editor;
EditorStatePtr newState(new SelectBoxState(this, m_rect,
SelectBoxState::PaintRulers |
SelectBoxState::PaintGrid));
SelectBoxState::RULERS |
SelectBoxState::GRID));
m_editor->setState(newState);
}
}

View File

@ -23,11 +23,11 @@ namespace app {
using namespace ui;
SelectBoxState::SelectBoxState(SelectBoxDelegate* delegate, const gfx::Rect& rc, PaintFlags paintFlags)
SelectBoxState::SelectBoxState(SelectBoxDelegate* delegate, const gfx::Rect& rc, Flags flags)
: m_delegate(delegate)
, m_rulers(4)
, m_movingRuler(-1)
, m_paintFlags(paintFlags)
, m_flags(flags)
{
setBoxBounds(rc);
}
@ -142,7 +142,7 @@ bool SelectBoxState::onSetCursor(Editor* editor)
void SelectBoxState::preRenderDecorator(EditorPreRender* render)
{
// Without black shadow?
if (!hasPaintFlag(PaintDarkOutside))
if (!hasFlag(DARKOUTSIDE))
return;
gfx::Rect rc = getBoxBounds();
@ -177,7 +177,7 @@ void SelectBoxState::postRenderDecorator(EditorPostRender* render)
vp = editor->screenToEditor(vp);
// Paint a grid generated by the box
if (hasPaintFlag(PaintGrid)) {
if (hasFlag(GRID)) {
gfx::Color gridColor = gfx::rgba(100, 200, 100);
gfx::Rect boxBounds = getBoxBounds();
@ -191,7 +191,7 @@ void SelectBoxState::postRenderDecorator(EditorPostRender* render)
}
// Draw the rulers enclosing the box
if (hasPaintFlag(PaintRulers)) {
if (hasFlag(RULERS)) {
gfx::Color rulerColor = gfx::rgba(0, 0, 255);
for (Rulers::iterator it = m_rulers.begin(), end = m_rulers.end(); it != end; ++it) {
@ -222,9 +222,9 @@ bool SelectBoxState::touchRuler(Editor* editor, Ruler& ruler, int x, int y)
return false;
}
bool SelectBoxState::hasPaintFlag(PaintFlags flag) const
bool SelectBoxState::hasFlag(Flags flag) const
{
return ((m_paintFlags & flag) == flag);
return ((m_flags & flag) == flag);
}
} // namespace app

View File

@ -28,14 +28,14 @@ namespace app {
enum { H1, H2, V1, V2 };
public:
typedef int PaintFlags;
static const int PaintRulers = 1;
static const int PaintDarkOutside = 2;
static const int PaintGrid = 4;
typedef int Flags;
static const int RULERS = 1;
static const int DARKOUTSIDE = 2;
static const int GRID = 4;
SelectBoxState(SelectBoxDelegate* delegate,
const gfx::Rect& rc,
PaintFlags paintFlags);
Flags flags);
// Returns the bounding box arranged by the rulers.
gfx::Rect getBoxBounds() const;
@ -64,12 +64,12 @@ namespace app {
// the given ruler.
bool touchRuler(Editor* editor, Ruler& ruler, int x, int y);
bool hasPaintFlag(PaintFlags flag) const;
bool hasFlag(Flags flag) const;
SelectBoxDelegate* m_delegate;
Rulers m_rulers;
int m_movingRuler;
PaintFlags m_paintFlags;
Flags m_flags;
};
} // namespace app