diff --git a/src/app/commands/cmd_eyedropper.cpp b/src/app/commands/cmd_eyedropper.cpp index b08854996..f2c311659 100644 --- a/src/app/commands/cmd_eyedropper.cpp +++ b/src/app/commands/cmd_eyedropper.cpp @@ -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(widget); diff --git a/src/app/commands/cmd_zoom.cpp b/src/app/commands/cmd_zoom.cpp index 3366de07b..882871fb2 100644 --- a/src/app/commands/cmd_zoom.cpp +++ b/src/app/commands/cmd_zoom.cpp @@ -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(pick); render::Zoom zoom = editor->zoom(); diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 2f9fe882a..8362f917c 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -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) diff --git a/src/app/ui/editor/editor.h b/src/app/ui/editor/editor.h index 4ee107291..57c10dcff 100644 --- a/src/app/ui/editor/editor.h +++ b/src/app/ui/editor/editor.h @@ -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