Move editor_type() -> Editor::Type()

This commit is contained in:
David Capello 2019-09-23 20:02:19 -03:00
parent 636531c6da
commit 8d5133fe09
4 changed files with 7 additions and 6 deletions

View File

@ -185,7 +185,7 @@ void EyedropperCommand::onExecute(Context* context)
{
gfx::Point mousePos = ui::get_mouse_position();
Widget* widget = ui::Manager::getDefault()->pick(mousePos);
if (!widget || widget->type() != editor_type())
if (!widget || widget->type() != Editor::Type())
return;
Editor* editor = static_cast<Editor*>(widget);

View File

@ -84,7 +84,7 @@ void ZoomCommand::onExecute(Context* context)
// Try to use the editor above the mouse.
ui::Widget* pick = ui::Manager::getDefault()->pick(mousePos);
if (pick && pick->type() == editor_type())
if (pick && pick->type() == Editor::Type())
editor = static_cast<Editor*>(pick);
render::Zoom zoom = editor->zoom();

View File

@ -134,7 +134,7 @@ private:
EditorRender* Editor::m_renderEngine = nullptr;
Editor::Editor(Doc* document, EditorFlags flags)
: Widget(editor_type())
: Widget(Editor::Type())
, m_state(new StandbyState())
, m_decorator(NULL)
, m_document(document)
@ -237,7 +237,8 @@ bool Editor::isActive() const
return (current_editor == this);
}
WidgetType editor_type()
// static
WidgetType Editor::Type()
{
static WidgetType type = kGenericWidget;
if (type == kGenericWidget)

View File

@ -100,6 +100,8 @@ namespace app {
MOUSE, // Zoom from cursor
};
static ui::WidgetType Type();
Editor(Doc* document, EditorFlags flags = kDefaultEditorFlags);
~Editor();
@ -456,8 +458,6 @@ namespace app {
static EditorRender* m_renderEngine;
};
ui::WidgetType editor_type();
} // namespace app
#endif