diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index a697044bf..a7d5670f1 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -18,6 +18,7 @@ #include "app/commands/params.h" #include "app/console.h" #include "app/ini_file.h" +#include "app/modules/editors.h" #include "app/modules/gfx.h" #include "app/modules/gui.h" #include "app/modules/palettes.h" @@ -190,6 +191,11 @@ Editor::~Editor() m_mask_timer.stop(); } +bool Editor::isActive() const +{ + return (current_editor == this); +} + WidgetType editor_type() { static WidgetType type = kGenericWidget; diff --git a/src/app/ui/editor/editor.h b/src/app/ui/editor/editor.h index 52eabed7e..5e1a6d2b3 100644 --- a/src/app/ui/editor/editor.h +++ b/src/app/ui/editor/editor.h @@ -81,6 +81,8 @@ namespace app { Editor(Document* document, EditorFlags flags = kDefaultEditorFlags); ~Editor(); + bool isActive() const; + DocumentView* getDocumentView() { return m_docView; } void setDocumentView(DocumentView* docView) { m_docView = docView; } diff --git a/src/app/ui/editor/editor_view.cpp b/src/app/ui/editor/editor_view.cpp index d59d94c81..516e7a453 100644 --- a/src/app/ui/editor/editor_view.cpp +++ b/src/app/ui/editor/editor_view.cpp @@ -67,7 +67,7 @@ void EditorView::onPaint(PaintEvent& ev) // Only show the view selected if it is the current editor case CurrentEditorMode: - selected = (editor() == current_editor); + selected = (editor()->isActive()); break; // Always show selected diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 17c28fcd1..2a191e7c4 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -206,7 +206,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) if (clickedInk->isSelection()) { // Transform selected pixels - if (document->isMaskVisible() && m_decorator->getTransformHandles(editor)) { + if (editor->isActive() && document->isMaskVisible() && m_decorator->getTransformHandles(editor)) { TransformHandles* transfHandles = m_decorator->getTransformHandles(editor); // Get the handle covered by the mouse. @@ -485,7 +485,8 @@ TransformHandles* StandbyState::Decorator::getTransformHandles(Editor* editor) bool StandbyState::Decorator::onSetCursor(Editor* editor) { - if (!editor->document()->isMaskVisible()) + if (!editor->isActive() || + !editor->document()->isMaskVisible()) return false; const gfx::Transformation transformation(m_standbyState->getTransformation(editor)); @@ -559,7 +560,8 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render) Editor* editor = render->getEditor(); // Draw transformation handles (if the mask is visible and isn't frozen). - if (editor->editorFlags() & Editor::kShowMask && + if (editor->isActive() && + editor->editorFlags() & Editor::kShowMask && editor->document()->isMaskVisible() && !editor->document()->mask()->isFrozen()) { // And draw only when the user has a selection tool as active tool.