diff --git a/Core/Code/Interactions/mitkMouseModeSwitcher.cpp b/Core/Code/Interactions/mitkMouseModeSwitcher.cpp index 8f9a101cda..dce4c2d907 100644 --- a/Core/Code/Interactions/mitkMouseModeSwitcher.cpp +++ b/Core/Code/Interactions/mitkMouseModeSwitcher.cpp @@ -1,205 +1,210 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkMouseModeSwitcher.h" #include "mitkDisplayInteractor.h" #include "mitkDisplayVectorInteractor.h" #include "mitkDisplayVectorInteractorLevelWindow.h" #include "mitkDisplayVectorInteractorScroll.h" mitk::MouseModeSwitcher::MouseModeSwitcher( mitk::GlobalInteraction* gi ) : m_GlobalInteraction( gi ) , m_ActiveInteractionScheme( MITK ) , m_ActiveMouseMode( MousePointer ) , m_LeftMouseButtonHandler( NULL ) { assert(gi); this->InitializeListeners(); this->SetInteractionScheme( m_ActiveInteractionScheme ); } mitk::MouseModeSwitcher::~MouseModeSwitcher() { } void mitk::MouseModeSwitcher::InitializeListeners() { mitk::DisplayVectorInteractor::Pointer moveAndZoomInteractor = mitk::DisplayVectorInteractor::New( "moveNzoom", new mitk::DisplayInteractor() ); mitk::StateMachine::Pointer listener = moveAndZoomInteractor.GetPointer(); m_ListenersForMITK.push_back( listener ); /* Trac 1366 - temporarily turn these off mitk::DisplayVectorInteractorScroll::Pointer scrollInteractor = mitk::DisplayVectorInteractorScroll::New( "alternativeScroll", new mitk::DisplayInteractor() ); listener = scrollInteractor; m_ListenersForPACS.push_back( listener ); mitk::DisplayVectorInteractorLevelWindow::Pointer lwInteractor = mitk::DisplayVectorInteractorLevelWindow::New("alternativeLevelWindow"); listener = lwInteractor; m_ListenersForPACS.push_back( listener ); mitk::DisplayVectorInteractor::Pointer panInteractor = mitk::DisplayVectorInteractor::New( "alternativePan", new mitk::DisplayInteractor() ); listener = panInteractor; m_ListenersForPACS.push_back( listener ); mitk::DisplayVectorInteractor::Pointer crtlZoomInteractor = mitk::DisplayVectorInteractor::New( "alternativeZoom", new mitk::DisplayInteractor() ); listener = crtlZoomInteractor; m_ListenersForPACS.push_back( listener ); **** Trac 1366 - temporarily turn these off. */ } void mitk::MouseModeSwitcher::SetInteractionScheme( InteractionScheme scheme ) { switch ( scheme ) { case MITK : { ListenerList::iterator iter; for ( iter=m_ListenersForPACS.begin(); iter!=m_ListenersForPACS.end(); iter++ ) { m_GlobalInteraction->RemoveListener( (*iter) ); } for ( iter=m_ListenersForMITK.begin(); iter!=m_ListenersForMITK.end(); iter++ ) { m_GlobalInteraction->AddListener( (*iter) ); } break; } // case MITK case PACS : { ListenerList::iterator iter; for ( iter=m_ListenersForMITK.begin(); iter!=m_ListenersForMITK.end(); iter++ ) { m_GlobalInteraction->RemoveListener( (*iter) ); } for ( iter=m_ListenersForPACS.begin(); iter!=m_ListenersForPACS.end(); iter++ ) { m_GlobalInteraction->AddListener( (*iter) ); } this->SelectMouseMode( MousePointer ); break; } // case PACS case OFF: { ListenerList::iterator iter; for ( iter=m_ListenersForMITK.begin(); iter!=m_ListenersForMITK.end(); iter++ ) { m_GlobalInteraction->RemoveListener( (*iter) ); } for ( iter=m_ListenersForPACS.begin(); iter!=m_ListenersForPACS.end(); iter++ ) { m_GlobalInteraction->RemoveListener( (*iter) ); } break; } // case OFF } // switch m_ActiveInteractionScheme = scheme; } +mitk::MouseModeSwitcher::InteractionScheme mitk::MouseModeSwitcher::GetInteractionScheme() const +{ + return m_ActiveInteractionScheme; +} + void mitk::MouseModeSwitcher::SelectMouseMode( MouseMode mode ) { if ( m_ActiveInteractionScheme != PACS ) return; switch ( mode ) { case MousePointer : { m_GlobalInteraction->RemoveListener( m_LeftMouseButtonHandler ); break; } // case 0 case Scroll : { m_GlobalInteraction->RemoveListener( m_LeftMouseButtonHandler ); mitk::DisplayVectorInteractorScroll::Pointer scrollInteractor = mitk::DisplayVectorInteractorScroll::New( "Scroll", new mitk::DisplayInteractor() ); m_LeftMouseButtonHandler = scrollInteractor; m_GlobalInteraction->AddListener( m_LeftMouseButtonHandler ); break; } // case 1 case LevelWindow : { m_GlobalInteraction->RemoveListener( m_LeftMouseButtonHandler ); mitk::DisplayVectorInteractorLevelWindow::Pointer lwInteractor = mitk::DisplayVectorInteractorLevelWindow::New( "LevelWindow" ); m_LeftMouseButtonHandler = lwInteractor; m_GlobalInteraction->AddListener( m_LeftMouseButtonHandler ); break; } // case 2 case Zoom : { m_GlobalInteraction->RemoveListener( m_LeftMouseButtonHandler ); mitk::DisplayVectorInteractor::Pointer zoomInteractor = mitk::DisplayVectorInteractor::New( "Zoom", new mitk::DisplayInteractor() ); m_LeftMouseButtonHandler = zoomInteractor; m_GlobalInteraction->AddListener( m_LeftMouseButtonHandler ); break; } // case 3 case Pan : { m_GlobalInteraction->RemoveListener( m_LeftMouseButtonHandler ); mitk::DisplayVectorInteractor::Pointer panInteractor = mitk::DisplayVectorInteractor::New( "Pan", new mitk::DisplayInteractor() ); m_LeftMouseButtonHandler = panInteractor; m_GlobalInteraction->AddListener( m_LeftMouseButtonHandler ); break; } // case 4 } // switch (mode) m_ActiveMouseMode = mode; this->InvokeEvent( MouseModeChangedEvent() ); } mitk::MouseModeSwitcher::MouseMode mitk::MouseModeSwitcher::GetCurrentMouseMode() const { return m_ActiveMouseMode; } diff --git a/Core/Code/Interactions/mitkMouseModeSwitcher.h b/Core/Code/Interactions/mitkMouseModeSwitcher.h index 93938e007a..32fcfb9b2e 100644 --- a/Core/Code/Interactions/mitkMouseModeSwitcher.h +++ b/Core/Code/Interactions/mitkMouseModeSwitcher.h @@ -1,149 +1,156 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB #define MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB #include "MitkExports.h" #include "mitkGlobalInteraction.h" #include namespace mitk { /*********************************************************************** * * \brief Class that offers a convenient way to switch between different * interaction schemes * * This class offers the possibility to swtch between the two different * interaction schemes that are available: * - MITK : The original interaction scheme * - left mouse button : setting the cross position in the MPR view * - middle mouse button : panning * - right mouse button : zooming * * * - PACS : an alternative interaction scheme that behaves more like a * PACS workstation * - left mouse button : behaviour depends on current MouseMode * - middle mouse button : fast scrolling * - right mouse button : level-window * - ctrl + right button : zooming * - shift+ right button : panning * +* - OFF : Turns all interactors for MITK mode and PACS mode off. +* * There are 5 different MouseModes that are available in the PACS scheme. * Each MouseMode defines the interaction that is performed on a left * mouse button click: * - Pointer : sets the cross position for the MPR * - Scroll * - Level-Window * - Zoom * - Pan * * When the interaction scheme or the MouseMode is changed, this class * manages the adding and removing of the relevant listeners offering * a convenient way to modify the interaction behaviour. * ***********************************************************************/ class MITK_CORE_EXPORT MouseModeSwitcher : public itk::Object { public: #pragma GCC visibility push(default) /** \brief Can be observed by GUI class to update button states when mode is changed programatically. */ itkEventMacro( MouseModeChangedEvent, itk::AnyEvent ); #pragma GCC visibility pop mitkClassMacro( MouseModeSwitcher, itk::Object ); mitkNewMacro1Param( Self, GlobalInteraction* ); // enum of the different interaction schemes that are available enum InteractionScheme { PACS = 0, MITK = 1, OFF = 2 }; // enum of available mouse modes for PACS interaction scheme enum MouseMode { MousePointer = 0, Scroll, LevelWindow, Zoom, Pan }; /** * \brief Setter for interaction scheme */ void SetInteractionScheme( InteractionScheme ); + /** + * \brief Getter for InteractionScheme. + */ + InteractionScheme GetInteractionScheme() const; + /** * \brief Setter for mouse mode */ void SelectMouseMode( MouseMode mode ); /** * \brief Returns the current mouse mode */ MouseMode GetCurrentMouseMode() const; protected: /** * \brief Constructor takes GlobalInteraction, MUST NOT be NULL. **/ MouseModeSwitcher( GlobalInteraction* ); virtual ~MouseModeSwitcher(); private: /** * \brief Initializes the listeners for the different interaction schemes * * This method creates all listeners that are required for the different * interaction schemes. These are stored in two lists. */ void InitializeListeners(); GlobalInteraction::Pointer m_GlobalInteraction; InteractionScheme m_ActiveInteractionScheme; MouseMode m_ActiveMouseMode; typedef std::vector ListenerList; ListenerList m_ListenersForMITK; ListenerList m_ListenersForPACS; StateMachine::Pointer m_LeftMouseButtonHandler; }; } // namespace mitk #endif /* MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB */ diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp index 2ab25e871d..f4fa1716d8 100644 --- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp +++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.cpp @@ -1,28 +1,32 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkIRenderWindowPart.h" namespace mitk { const QString IRenderWindowPart::DECORATION_BORDER = "border"; const QString IRenderWindowPart::DECORATION_LOGO = "logo"; const QString IRenderWindowPart::DECORATION_MENU = "menu"; const QString IRenderWindowPart::DECORATION_BACKGROUND = "background"; +const QString IRenderWindowPart::INTERACTOR_OFF = "off"; +const QString IRenderWindowPart::INTERACTOR_MITK = "mitk"; +const QString IRenderWindowPart::INTERACTOR_PACS = "pacs"; + IRenderWindowPart::~IRenderWindowPart() {} } diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h index 57cb329506..f2097ee5e3 100644 --- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h +++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPart.h @@ -1,190 +1,230 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKIRENDERWINDOWPART_H #define MITKIRENDERWINDOWPART_H #include #include #include #include #include #include #include class QmitkRenderWindow; namespace mitk { struct IRenderingManager; class SliceNavigationController; /** * \ingroup org_mitk_gui_common * * \brief Interface for a MITK Workbench Part providing a render window. * * This interface allows generic access to Workbench parts which provide some * kind of render window. The interface is intended to be implemented by * subclasses of berry::IWorkbenchPart. Usually, the interface is implemented * by a Workbench editor. * * A IRenderWindowPart provides zero or more QmitkRenderWindow instances which can * be controlled via this interface. QmitkRenderWindow instances have an associated * \e id, which is implementation specific. However, implementations should consider * to use one of the following ids for certain QmitkRenderWindow instances to maximize * reusability (they are free to map multiple ids to one QmitkRenderWindow internally): *
    *
  • transversal
  • *
  • sagittal
  • *
  • coronal
  • *
  • 3d
  • *
* * \see ILinkedRenderWindowPart * \see IRenderWindowPartListener * \see QmitkAbstractRenderEditor */ struct MITK_GUI_COMMON_PLUGIN IRenderWindowPart { static const QString DECORATION_BORDER; // = "border" static const QString DECORATION_LOGO; // = "logo" static const QString DECORATION_MENU; // = "menu" static const QString DECORATION_BACKGROUND; // = "background; + static const QString INTERACTOR_OFF; // - "off" + static const QString INTERACTOR_MITK; // = "mitk" + static const QString INTERACTOR_PACS; // = "pacs" + virtual ~IRenderWindowPart(); /** * Get the currently active (focused) render window. * Focus handling is implementation specific. * * \return The active QmitkRenderWindow instance; NULL * if no render window is active. */ virtual QmitkRenderWindow* GetActiveRenderWindow() const = 0; /** * Get all render windows with their ids. * * \return A hash map mapping the render window id to the QmitkRenderWindow instance. */ virtual QHash GetRenderWindows() const = 0; /** * Get a render window with a specific id. * * \param id The render window id. * \return The QmitkRenderWindow instance for id */ virtual QmitkRenderWindow* GetRenderWindow(const QString& id) const = 0; /** * Get the rendering manager used by this render window part. * * \return The current IRenderingManager instance or NULL * if no rendering manager is used. */ virtual mitk::IRenderingManager* GetRenderingManager() const = 0; /** * Request an update of all render windows. * * \param requestType Specifies the type of render windows for which an update * will be requested. */ virtual void RequestUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL) = 0; /** * Force an immediate update of all render windows. * * \param requestType Specifies the type of render windows for which an immediate update * will be requested. */ virtual void ForceImmediateUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL) = 0; /** * Get the SliceNavigationController for controlling time positions. * * \return A SliceNavigationController if the render window supports this * operation; otherwise returns NULL. */ virtual mitk::SliceNavigationController* GetTimeNavigationController() const = 0; /** * Get the selected position in the render window with id id * or in the active render window if id is NULL. * * \param id The render window id. * \return The currently selected position in world coordinates. */ virtual mitk::Point3D GetSelectedPosition(const QString& id = QString()) const = 0; /** * Set the selected position in the render window with id id * or in the active render window if id is NULL. * * \param pos The position in world coordinates which should be selected. * \param id The render window id in which the selection should take place. */ virtual void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()) = 0; /** * Enable \e decorations like colored borders, menu widgets, logos, text annotations, etc. * * Decorations are implementation specific. A set of standardized decoration names is listed * in GetDecorations(). * * \param enable If true enable the decorations specified in decorations, * otherwise disable them. * \param decorations A list of decoration names. If empty, all supported decorations are affected. * * \see GetDecorations() */ virtual void EnableDecorations(bool enable, const QStringList& decorations = QStringList()) = 0; /** * Return if a specific decoration is enabled. * * \return true if the decoration is enabled, false if it is disabled * or unknown. * * \see GetDecorations() */ virtual bool IsDecorationEnabled(const QString& decoration) const = 0; /** * Get a list of supported decorations. * * The following decoration names are standardized and should not be used for other decoration types: *
    *
  • \e DECORATION_BORDER Any border decorations like colored rectangles, etc. *
  • \e DECORATION_MENU Menus associated with render windows *
  • \e DECORATION_BACKGROUND All kinds of backgrounds (patterns, gradients, etc.) except for solid colored backgrounds *
  • \e DECORATION_LOGO Any kind of logo overlayed on the rendered scene *
* * \return A list of supported decoration names. */ virtual QStringList GetDecorations() const = 0; + + /** + * Enable \e interactors like mouse interactors, keyboard interactors, etc. + * + * Interactors are implementation specific. A set of standardized interactor names is listed in + * GetInteractors(); + * + * \param enable If true enable the interactors specified in interactors, + * otherwise disable them. + * \param interactors A list of interactor names. If empty, all supported interactors are affected. + * + * \see GetInteractors() + */ + virtual void EnableInteractors(bool enable, const QStringList& interactors = QStringList()) = 0; + + /** + * Return if a specific interactor is enabled. + * + * \return true if the interactor is enabled, false if it is disabled or unknown. + * + * \see GetInteractors() + */ + virtual bool IsInteractorEnabled(const QString& interactor) const = 0; + + /** + * Get a list of supported interactors. + * + * The following interactor names are standardized and should not be used for other interactor types: + *
    + *
  • \e INTERACTOR_MITK + *
  • \e INTERACTOR_PACS + *
+ * + * \return A list of supported decoration names. + */ + virtual QStringList GetInteractors() const = 0; }; } Q_DECLARE_INTERFACE(mitk::IRenderWindowPart, "org.mitk.ui.IRenderWindowPart") #endif // MITKIRENDERWINDOWPART_H diff --git a/Plugins/org.mitk.gui.qt.common/CMakeLists.txt b/Plugins/org.mitk.gui.qt.common/CMakeLists.txt index a87e750b5c..460af35bad 100755 --- a/Plugins/org.mitk.gui.qt.common/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.common/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_common) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_COMMON EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDENCIES Qmitk CTK SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.cpp b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.cpp index fff46ace90..b1f06234bb 100644 --- a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.cpp +++ b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.cpp @@ -1,146 +1,201 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkAbstractRenderEditor.h" #include "internal/QmitkCommonActivator.h" #include #include #include #include #include +#include +#include +#include class QmitkAbstractRenderEditorPrivate { public: QmitkAbstractRenderEditorPrivate() : m_RenderingManagerInterface(mitk::MakeRenderingManagerInterface(mitk::RenderingManager::GetInstance())) , m_PrefServiceTracker(QmitkCommonActivator::GetContext()) + , m_Context(0) + , m_EventAdmin(0) { m_PrefServiceTracker.open(); } ~QmitkAbstractRenderEditorPrivate() { delete m_RenderingManagerInterface; } mitk::IRenderingManager* m_RenderingManagerInterface; ctkServiceTracker m_PrefServiceTracker; berry::IBerryPreferences::Pointer m_Prefs; + + ctkPluginContext* m_Context; + ctkServiceReference m_EventAdminRef; + ctkEventAdmin* m_EventAdmin; }; QmitkAbstractRenderEditor::QmitkAbstractRenderEditor() : d(new QmitkAbstractRenderEditorPrivate) { } QmitkAbstractRenderEditor::~QmitkAbstractRenderEditor() { if (d->m_Prefs.IsNotNull()) { d->m_Prefs->OnChanged.RemoveListener(berry::MessageDelegate1 (this, &QmitkAbstractRenderEditor::OnPreferencesChanged ) ); } } void QmitkAbstractRenderEditor::Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input) { if (input.Cast().IsNull()) throw berry::PartInitException("Invalid Input: Must be mitk::DataStorageEditorInput"); this->SetSite(site); this->SetInput(input); d->m_Prefs = this->GetPreferences().Cast(); if (d->m_Prefs.IsNotNull()) { d->m_Prefs->OnChanged.AddListener(berry::MessageDelegate1 (this, &QmitkAbstractRenderEditor::OnPreferencesChanged ) ); } + + d->m_Context = QmitkCommonActivator::GetContext(); + d->m_EventAdminRef = d->m_Context->getServiceReference(); + d->m_EventAdmin = d->m_Context->getService(d->m_EventAdminRef); + + ctkDictionary propsForSlot; + propsForSlot[ctkEventConstants::EVENT_TOPIC] = "org/mitk/gui/qt/INTERACTOR_REQUEST"; + d->m_EventAdmin->subscribeSlot(this, SLOT(handleEvent(ctkEvent)), propsForSlot); } mitk::IDataStorageReference::Pointer QmitkAbstractRenderEditor::GetDataStorageReference() const { mitk::DataStorageEditorInput::Pointer input = this->GetEditorInput().Cast(); if (input.IsNotNull()) { return input->GetDataStorageReference(); } return mitk::IDataStorageReference::Pointer(0); } mitk::DataStorage::Pointer QmitkAbstractRenderEditor::GetDataStorage() const { mitk::IDataStorageReference::Pointer ref = this->GetDataStorageReference(); if (ref.IsNotNull()) return ref->GetDataStorage(); return mitk::DataStorage::Pointer(0); } berry::IPreferences::Pointer QmitkAbstractRenderEditor::GetPreferences() const { berry::IPreferencesService* prefService = d->m_PrefServiceTracker.getService(); if (prefService != 0) { return prefService->GetSystemPreferences()->Node(this->GetSite()->GetId()); } return berry::IPreferences::Pointer(0); } mitk::IRenderingManager* QmitkAbstractRenderEditor::GetRenderingManager() const { // we use the global rendering manager here. This should maybe replaced // by a local one, managing only the render windows specific for the editor return d->m_RenderingManagerInterface; } void QmitkAbstractRenderEditor::RequestUpdate(mitk::RenderingManager::RequestType requestType) { if (GetRenderingManager()) GetRenderingManager()->RequestUpdateAll(requestType); } void QmitkAbstractRenderEditor::ForceImmediateUpdate(mitk::RenderingManager::RequestType requestType) { if (GetRenderingManager()) GetRenderingManager()->ForceImmediateUpdateAll(requestType); } mitk::SliceNavigationController* QmitkAbstractRenderEditor::GetTimeNavigationController() const { if (GetRenderingManager()) return GetRenderingManager()->GetTimeNavigationController(); return 0; } void QmitkAbstractRenderEditor::OnPreferencesChanged(const berry::IBerryPreferences *) {} void QmitkAbstractRenderEditor::DoSave() {} void QmitkAbstractRenderEditor::DoSaveAs() {} bool QmitkAbstractRenderEditor::IsDirty() const { return false; } bool QmitkAbstractRenderEditor::IsSaveAsAllowed() const { return false; } + +void QmitkAbstractRenderEditor::EnableInteractors(bool enable, const QStringList& interactors) +{ + Q_UNUSED(enable); + Q_UNUSED(interactors); +} + +bool QmitkAbstractRenderEditor::IsInteractorEnabled(const QString& interactor) const +{ + Q_UNUSED(interactor); + return false; +} + +QStringList QmitkAbstractRenderEditor::GetInteractors() const +{ + return QStringList(); +} + +void QmitkAbstractRenderEditor::handleEvent(const ctkEvent& event) +{ + try + { + QString topic = event.getProperty(ctkEventConstants::EVENT_TOPIC).toString(); + if (topic == "org/mitk/gui/qt/INTERACTOR_REQUEST") + { + bool enabled = event.getProperty("enabled").toBool(); + QStringList interactors = event.getProperty("interactors").toStringList(); + + this->EnableInteractors(enabled, interactors); + } + } + catch (const ctkRuntimeException& e) + { + MITK_ERROR << "QmitkAbstractRenderEditor::handleEvent, failed with:" << e.what() \ + << ", caused by " << e.getCause().toLocal8Bit().constData() \ + << std::endl; + } +} diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.h b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.h index 74a1168caa..880681c360 100644 --- a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.h +++ b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractRenderEditor.h @@ -1,157 +1,184 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKABSTRACTRENDEREDITOR_H #define QMITKABSTRACTRENDEREDITOR_H #include #include #include "mitkIRenderWindowPart.h" #include #include #include +// CTK for event handling +#include "service/event/ctkEventHandler.h" +#include "service/event/ctkEventAdmin.h" + class QmitkAbstractRenderEditorPrivate; +class ctkPluginContext; +struct ctkEventAdmin; /** * \ingroup org_mitk_gui_qt_common * * \brief A convenient base class for MITK render window BlueBerry Editors. * * QmitkAbstractRenderEditor provides several convenience methods that ease the introduction of * a new editor for rendering a MITK DataStorage: * *
    *
  1. Access to the DataStorage (~ the shared data repository) *
  2. Access to and update notification for the editor's preferences *
  3. Default implementation of some mitk::IRenderWindowPart methods *
* * When inheriting from QmitkAbstractRenderEditor, you must implement the following methods: *
    *
  • void CreateQtPartControl(QWidget* parent) *
  • void SetFocus() *
* * You may reimplement the following private virtual methods to be notified about certain changes: *
    *
  • void OnPreferencesChanged(const berry::IBerryPreferences*) *
* * \see IRenderWindowPart * \see ILinkedRenderWindowPart */ class MITK_QT_COMMON QmitkAbstractRenderEditor : public berry::QtEditorPart, - public virtual mitk::IRenderWindowPart + public virtual mitk::IRenderWindowPart, public ctkEventHandler { Q_OBJECT Q_INTERFACES(mitk::IRenderWindowPart) + Q_INTERFACES(ctkEventHandler) public: QmitkAbstractRenderEditor(); ~QmitkAbstractRenderEditor(); protected: /** * Initializes this editor by checking for a valid mitk::DataStorageEditorInput as input. * * \see berry::IEditorPart::Init */ void Init(berry::IEditorSite::Pointer site, berry::IEditorInput::Pointer input); /** * Get a reference to the DataStorage set by the editor input. */ virtual mitk::IDataStorageReference::Pointer GetDataStorageReference() const; /** * Get the DataStorage set by the editor input. */ virtual mitk::DataStorage::Pointer GetDataStorage() const; /** * Get the preferences for this editor. */ virtual berry::IPreferences::Pointer GetPreferences() const; /** * Get the RenderingManager used by this editor. This default implementation uses the * global MITK RenderingManager provided by mitk::RenderingManager::GetInstance(). * * \see mitk::IRenderWindowPart::GetRenderingManager */ mitk::IRenderingManager* GetRenderingManager() const; /** * Request an update of this editor's render windows. * This implementation calls mitk::IRenderingManager::RequestUpdate on the rendering * manager interface returned by GetRenderingManager(); * * \param requestType The type of render windows for which an update is requested. * * \see mitk::IRenderWindowPart::RequestUpdate */ void RequestUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL); /** * Force an immediate update of this editor's render windows. * This implementation calls mitk::IRenderingManager::ForceImmediateUpdate() on the rendering * manager interface returned by GetRenderingManager(); * * \param requestType The type of render windows for which an immedate update is forced. * * \see mitk::IRenderWindowPart::ForceImmediateUpdate */ void ForceImmediateUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL); /** * Get the time navigation controller for this editor. * This implementation returns the SliceNavigationController returned by the mitk::IRenderingManager::GetTimeNavigationController() * method of the interface implementation returned by GetRenderingManager(). * * \see mitk::IRenderingManager::GetTimeNavigationController */ mitk::SliceNavigationController* GetTimeNavigationController() const; /** \see berry::IEditorPart::DoSave */ void DoSave(); /** \see berry::IEditorPart::DoSaveAs */ void DoSaveAs(); /** \see berry::IEditorPart::IsDirty */ bool IsDirty() const; /** \see berry::IEditorPart::IsSaveAsAllowed */ bool IsSaveAsAllowed() const; + /** + * \see mitk::IRenderWindowPart::EnableInteractors(), providing default implementation in this class to minimise impact. + */ + void EnableInteractors(bool enable, const QStringList& interactors = QStringList()); + + /** + * \see mitk::IRenderWindowPart::IsInteractorEnabled(), providing default implementation in this class to minimise impact. + */ + bool IsInteractorEnabled(const QString& interactor) const; + + /** + * \see mitk::IRenderWindowPart::GetInteractors(), providing default implementation in this class to minimise impact. + */ + QStringList GetInteractors() const; + +public Q_SLOTS: + + /// \brief Handle events coming from the event admin service. + void handleEvent(const ctkEvent& event); + private: virtual void OnPreferencesChanged(const berry::IBerryPreferences*); private: QScopedPointer d; }; #endif // QMITKABSTRACTRENDEREDITOR_H diff --git a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.cpp b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.cpp index a3ed165e5c..b28c5b9c2e 100644 --- a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.cpp +++ b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.cpp @@ -1,432 +1,527 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkStdMultiWidgetEditor.h" #include #include #include #include #include #include #include #include #include #include #include #include #include class QmitkStdMultiWidgetEditorPrivate { public: QmitkStdMultiWidgetEditorPrivate(); ~QmitkStdMultiWidgetEditorPrivate(); QmitkStdMultiWidget* m_StdMultiWidget; QmitkMouseModeSwitcher* m_MouseModeToolbar; std::string m_FirstBackgroundColor; std::string m_SecondBackgroundColor; bool m_MenuWidgetsEnabled; berry::IPartListener::Pointer m_PartListener; QHash m_RenderWindows; + QStringList m_EnabledInteractors; + }; struct QmitkStdMultiWidgetPartListener : public berry::IPartListener { berryObjectMacro(QmitkStdMultiWidgetPartListener) QmitkStdMultiWidgetPartListener(QmitkStdMultiWidgetEditorPrivate* dd) : d(dd) {} Events::Types GetPartEventTypes() const { return Events::CLOSED | Events::HIDDEN | Events::VISIBLE; } void PartClosed (berry::IWorkbenchPartReference::Pointer partRef) { if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID) { QmitkStdMultiWidgetEditor::Pointer stdMultiWidgetEditor = partRef->GetPart(false).Cast(); if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget()) { d->m_StdMultiWidget->RemovePlanesFromDataStorage(); stdMultiWidgetEditor->RequestActivateMenuWidget(false); + stdMultiWidgetEditor->EnableInteractors(false); } } } void PartHidden (berry::IWorkbenchPartReference::Pointer partRef) { if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID) { QmitkStdMultiWidgetEditor::Pointer stdMultiWidgetEditor = partRef->GetPart(false).Cast(); if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget()) { d->m_StdMultiWidget->RemovePlanesFromDataStorage(); stdMultiWidgetEditor->RequestActivateMenuWidget(false); + stdMultiWidgetEditor->EnableInteractors(false); } } } void PartVisible (berry::IWorkbenchPartReference::Pointer partRef) { if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID) { QmitkStdMultiWidgetEditor::Pointer stdMultiWidgetEditor = partRef->GetPart(false).Cast(); if (d->m_StdMultiWidget == stdMultiWidgetEditor->GetStdMultiWidget()) { d->m_StdMultiWidget->AddPlanesToDataStorage(); stdMultiWidgetEditor->RequestActivateMenuWidget(true); + stdMultiWidgetEditor->EnableInteractors(true); } } } private: QmitkStdMultiWidgetEditorPrivate* const d; }; QmitkStdMultiWidgetEditorPrivate::QmitkStdMultiWidgetEditorPrivate() : m_StdMultiWidget(0), m_MouseModeToolbar(0) , m_MenuWidgetsEnabled(false) , m_PartListener(new QmitkStdMultiWidgetPartListener(this)) {} QmitkStdMultiWidgetEditorPrivate::~QmitkStdMultiWidgetEditorPrivate() { } const std::string QmitkStdMultiWidgetEditor::EDITOR_ID = "org.mitk.editors.stdmultiwidget"; QmitkStdMultiWidgetEditor::QmitkStdMultiWidgetEditor() : d(new QmitkStdMultiWidgetEditorPrivate) { } QmitkStdMultiWidgetEditor::~QmitkStdMultiWidgetEditor() { this->GetSite()->GetPage()->RemovePartListener(d->m_PartListener); } QmitkStdMultiWidget* QmitkStdMultiWidgetEditor::GetStdMultiWidget() { return d->m_StdMultiWidget; } QmitkRenderWindow *QmitkStdMultiWidgetEditor::GetActiveRenderWindow() const { if (d->m_StdMultiWidget) return d->m_StdMultiWidget->GetRenderWindow1(); return 0; } QHash QmitkStdMultiWidgetEditor::GetRenderWindows() const { return d->m_RenderWindows; } QmitkRenderWindow *QmitkStdMultiWidgetEditor::GetRenderWindow(const QString &id) const { if (d->m_RenderWindows.contains(id)) return d->m_RenderWindows[id]; return 0; } mitk::Point3D QmitkStdMultiWidgetEditor::GetSelectedPosition(const QString & /*id*/) const { return d->m_StdMultiWidget->GetCrossPosition(); } void QmitkStdMultiWidgetEditor::SetSelectedPosition(const mitk::Point3D &pos, const QString &/*id*/) { d->m_StdMultiWidget->MoveCrossToPosition(pos); } void QmitkStdMultiWidgetEditor::EnableDecorations(bool enable, const QStringList &decorations) { if (decorations.isEmpty() || decorations.contains(DECORATION_BORDER)) { enable ? d->m_StdMultiWidget->EnableColoredRectangles() : d->m_StdMultiWidget->DisableColoredRectangles(); } if (decorations.isEmpty() || decorations.contains(DECORATION_LOGO)) { enable ? d->m_StdMultiWidget->EnableDepartmentLogo() : d->m_StdMultiWidget->DisableDepartmentLogo(); } if (decorations.isEmpty() || decorations.contains(DECORATION_MENU)) { d->m_StdMultiWidget->ActivateMenuWidget(enable); } if (decorations.isEmpty() || decorations.contains(DECORATION_BACKGROUND)) { enable ? d->m_StdMultiWidget->EnableGradientBackground() : d->m_StdMultiWidget->DisableGradientBackground(); } } bool QmitkStdMultiWidgetEditor::IsDecorationEnabled(const QString &decoration) const { if (decoration == DECORATION_BORDER) { return d->m_StdMultiWidget->IsColoredRectanglesEnabled(); } else if (decoration == DECORATION_LOGO) { return d->m_StdMultiWidget->IsColoredRectanglesEnabled(); } else if (decoration == DECORATION_MENU) { return d->m_StdMultiWidget->IsMenuWidgetEnabled(); } else if (decoration == DECORATION_BACKGROUND) { return d->m_StdMultiWidget->GetGradientBackgroundFlag(); } return false; } QStringList QmitkStdMultiWidgetEditor::GetDecorations() const { QStringList decorations; decorations << DECORATION_BORDER << DECORATION_LOGO << DECORATION_MENU << DECORATION_BACKGROUND; return decorations; } mitk::SlicesRotator* QmitkStdMultiWidgetEditor::GetSlicesRotator() const { return d->m_StdMultiWidget->GetSlicesRotator(); } mitk::SlicesSwiveller* QmitkStdMultiWidgetEditor::GetSlicesSwiveller() const { return d->m_StdMultiWidget->GetSlicesSwiveller(); } void QmitkStdMultiWidgetEditor::EnableSlicingPlanes(bool enable) { d->m_StdMultiWidget->SetWidgetPlanesVisibility(enable); } bool QmitkStdMultiWidgetEditor::IsSlicingPlanesEnabled() const { mitk::DataNode::Pointer node = this->d->m_StdMultiWidget->GetWidgetPlane1(); if (node.IsNotNull()) { bool visible = false; node->GetVisibility(visible, 0); return visible; } else { return false; } } void QmitkStdMultiWidgetEditor::EnableLinkedNavigation(bool enable) { enable ? d->m_StdMultiWidget->EnableNavigationControllerEventListening() : d->m_StdMultiWidget->DisableNavigationControllerEventListening(); } bool QmitkStdMultiWidgetEditor::IsLinkedNavigationEnabled() const { return d->m_StdMultiWidget->IsCrosshairNavigationEnabled(); } void QmitkStdMultiWidgetEditor::CreateQtPartControl(QWidget* parent) { if (d->m_StdMultiWidget == 0) { QHBoxLayout* layout = new QHBoxLayout(parent); layout->setContentsMargins(0,0,0,0); if (d->m_MouseModeToolbar == NULL) { d->m_MouseModeToolbar = new QmitkMouseModeSwitcher(parent); // delete by Qt via parent layout->addWidget(d->m_MouseModeToolbar); } d->m_StdMultiWidget = new QmitkStdMultiWidget(parent); d->m_RenderWindows.insert("transversal", d->m_StdMultiWidget->GetRenderWindow1()); d->m_RenderWindows.insert("sagittal", d->m_StdMultiWidget->GetRenderWindow2()); d->m_RenderWindows.insert("coronal", d->m_StdMultiWidget->GetRenderWindow3()); d->m_RenderWindows.insert("3d", d->m_StdMultiWidget->GetRenderWindow4()); d->m_MouseModeToolbar->setMouseModeSwitcher( d->m_StdMultiWidget->GetMouseModeSwitcher() ); connect( d->m_MouseModeToolbar, SIGNAL( MouseModeSelected(mitk::MouseModeSwitcher::MouseMode) ), d->m_StdMultiWidget, SLOT( MouseModeSelected(mitk::MouseModeSwitcher::MouseMode) ) ); layout->addWidget(d->m_StdMultiWidget); mitk::DataStorage::Pointer ds = this->GetDataStorage(); // Tell the multiWidget which (part of) the tree to render d->m_StdMultiWidget->SetDataStorage(ds); // Initialize views as transversal, sagittal, coronar to all data objects in DataStorage // (from top-left to bottom) mitk::TimeSlicedGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll()); mitk::RenderingManager::GetInstance()->InitializeViews(geo); // Initialize bottom-right view as 3D view d->m_StdMultiWidget->GetRenderWindow4()->GetRenderer()->SetMapperID( mitk::BaseRenderer::Standard3D ); // Enable standard handler for levelwindow-slider d->m_StdMultiWidget->EnableStandardLevelWindow(); // Add the displayed views to the tree to see their positions // in 2D and 3D d->m_StdMultiWidget->AddDisplayPlaneSubTree(); d->m_StdMultiWidget->EnableNavigationControllerEventListening(); // Store the initial visibility status of the menu widget. d->m_MenuWidgetsEnabled = d->m_StdMultiWidget->IsMenuWidgetEnabled(); this->GetSite()->GetPage()->AddPartListener(d->m_PartListener); berry::IPreferences::Pointer prefs = this->GetPreferences(); this->OnPreferencesChanged(dynamic_cast(prefs.GetPointer())); + // Store the initial interactor status of the mouse mode. + if (d->m_StdMultiWidget->GetMouseModeSwitcher()->GetInteractionScheme() == mitk::MouseModeSwitcher::MITK ) + { + d->m_EnabledInteractors << INTERACTOR_MITK; + } + else if (d->m_StdMultiWidget->GetMouseModeSwitcher()->GetInteractionScheme() == mitk::MouseModeSwitcher::PACS ) + { + d->m_EnabledInteractors << INTERACTOR_PACS; + } + this->RequestUpdate(); } } void QmitkStdMultiWidgetEditor::OnPreferencesChanged(const berry::IBerryPreferences* prefs) { // enable change of logo std::string departmentLogoLocation = prefs->Get("DepartmentLogo",""); if (departmentLogoLocation.empty()) { d->m_StdMultiWidget->DisableDepartmentLogo(); } else { d->m_StdMultiWidget->SetDepartmentLogoPath(departmentLogoLocation.c_str()); d->m_StdMultiWidget->EnableDepartmentLogo(); } // preferences for gradient background float color = 255.0; QString firstColorName = QString::fromStdString (prefs->GetByteArray("first background color", "")); QColor firstColor(firstColorName); mitk::Color upper; if (firstColorName=="") // default values { upper[0] = 0.1; upper[1] = 0.1; upper[2] = 0.1; } else { upper[0] = firstColor.red() / color; upper[1] = firstColor.green() / color; upper[2] = firstColor.blue() / color; } QString secondColorName = QString::fromStdString (prefs->GetByteArray("second background color", "")); QColor secondColor(secondColorName); mitk::Color lower; if (secondColorName=="") // default values { lower[0] = 0.5; lower[1] = 0.5; lower[2] = 0.5; } else { lower[0] = secondColor.red() / color; lower[1] = secondColor.green() / color; lower[2] = secondColor.blue() / color; } d->m_StdMultiWidget->SetGradientBackgroundColors(upper, lower); d->m_StdMultiWidget->EnableGradientBackground(); // Set preferences respecting zooming and padding bool constrainedZooming = prefs->GetBool("Use constrained zooming and padding", false); mitk::RenderingManager::GetInstance()->SetConstrainedPaddingZooming(constrainedZooming); mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox" , mitk::BoolProperty::New(false))); mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred); // calculate bounding geometry of these nodes mitk::TimeSlicedGeometry::Pointer bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs, "visible"); // initialize the views to the bounding geometry mitk::RenderingManager::GetInstance()->InitializeViews(bounds); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // level window setting bool showLevelWindowWidget = prefs->GetBool("Show level/window widget", true); if (showLevelWindowWidget) { d->m_StdMultiWidget->EnableStandardLevelWindow(); } else { d->m_StdMultiWidget->DisableStandardLevelWindow(); } // mouse modes toolbar bool newMode = prefs->GetBool("PACS like mouse interaction", false); d->m_MouseModeToolbar->setVisible( newMode ); d->m_StdMultiWidget->GetMouseModeSwitcher()->SetInteractionScheme( newMode ? mitk::MouseModeSwitcher::PACS : mitk::MouseModeSwitcher::MITK ); } void QmitkStdMultiWidgetEditor::SetFocus() { if (d->m_StdMultiWidget != 0) d->m_StdMultiWidget->setFocus(); } void QmitkStdMultiWidgetEditor::RequestActivateMenuWidget(bool on) { if (d->m_StdMultiWidget) { if (on) { d->m_StdMultiWidget->ActivateMenuWidget(d->m_MenuWidgetsEnabled); } else { d->m_MenuWidgetsEnabled = d->m_StdMultiWidget->IsMenuWidgetEnabled(); d->m_StdMultiWidget->ActivateMenuWidget(false); } } } +void QmitkStdMultiWidgetEditor::EnableInteractors(bool enable, const QStringList& interactors) +{ + if (d->m_StdMultiWidget) + { + if (interactors.isEmpty()) + { + if (enable) + { + if (!d->m_EnabledInteractors.isEmpty()) + { + // i.e. enable previously stored interactors. + this->EnableInteractors(true, d->m_EnabledInteractors); + } + else + { + // pick a default. + QStringList defaultInteractor; + defaultInteractor << INTERACTOR_MITK; + this->EnableInteractors(true, defaultInteractor); + } + } + else + { + // Requesting de-activation, so we store the state, so that when re-activated we can restore it. + QStringList currentlyEnabledInteractors; + if (this->IsInteractorEnabled(INTERACTOR_MITK)) + { + currentlyEnabledInteractors << INTERACTOR_MITK; + } + if (this->IsInteractorEnabled(INTERACTOR_PACS)) + { + currentlyEnabledInteractors << INTERACTOR_PACS; + } + d->m_EnabledInteractors.clear(); + d->m_EnabledInteractors << currentlyEnabledInteractors; + d->m_StdMultiWidget->GetMouseModeSwitcher()->SetInteractionScheme(mitk::MouseModeSwitcher::OFF); + } + } + else + { + if (enable && interactors.contains(INTERACTOR_MITK)) + { + d->m_StdMultiWidget->GetMouseModeSwitcher()->SetInteractionScheme(mitk::MouseModeSwitcher::MITK); + } + if (enable && interactors.contains(INTERACTOR_PACS)) + { + d->m_StdMultiWidget->GetMouseModeSwitcher()->SetInteractionScheme(mitk::MouseModeSwitcher::PACS); + } + } + } +} + +bool QmitkStdMultiWidgetEditor::IsInteractorEnabled(const QString& interactor) const +{ + bool isEnabled = false; + + if (d->m_StdMultiWidget) + { + if ( (interactor == INTERACTOR_MITK + && d->m_StdMultiWidget->GetMouseModeSwitcher()->GetInteractionScheme() + == mitk::MouseModeSwitcher::MITK) + || (interactor == INTERACTOR_PACS + && d->m_StdMultiWidget->GetMouseModeSwitcher()->GetInteractionScheme() + == mitk::MouseModeSwitcher::PACS) + ) + { + isEnabled = true; + } + } + + return isEnabled; +} + +QStringList QmitkStdMultiWidgetEditor::GetInteractors() const +{ + QStringList interactors; + interactors << INTERACTOR_MITK << INTERACTOR_PACS; + return interactors; +} + diff --git a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h index 8ef9b88c1e..09618f8c3b 100644 --- a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h +++ b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/src/QmitkStdMultiWidgetEditor.h @@ -1,120 +1,141 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKSTDMULTIWIDGETEDITOR_H_ #define QMITKSTDMULTIWIDGETEDITOR_H_ #include #include #include class QmitkStdMultiWidget; class QmitkMouseModeSwitcher; class QmitkStdMultiWidgetEditorPrivate; /** * \ingroup org_mitk_gui_qt_stdmultiwidgeteditor */ class ORG_MITK_GUI_QT_STDMULTIWIDGETEDITOR QmitkStdMultiWidgetEditor : public QmitkAbstractRenderEditor, public mitk::ILinkedRenderWindowPart { Q_OBJECT public: berryObjectMacro(QmitkStdMultiWidgetEditor) static const std::string EDITOR_ID; QmitkStdMultiWidgetEditor(); ~QmitkStdMultiWidgetEditor(); QmitkStdMultiWidget* GetStdMultiWidget(); - /// \brief If on=true will request the QmitkStdMultiWidget set the Menu widget to - /// whatever was the last known enabled state, and if on=false will turn the Menu widget off. + /** + * Request the QmitkRenderWindowMenus to be either off, or whatever was the last known state, which is + * useful when responding to the PartOpened, PartClosed, PartHidden methods. + * + * \param on If true will request the QmitkStdMultiWidget to set the QmitkRenderWindowMenu to + * whatever was the last known state, and if false will turn the QmitkRenderWindowMenu off. + * + */ void RequestActivateMenuWidget(bool on); // ------------------- mitk::IRenderWindowPart ---------------------- /** * \see mitk::IRenderWindowPart::GetActiveRenderWindow() */ QmitkRenderWindow* GetActiveRenderWindow() const; /** * \see mitk::IRenderWindowPart::GetRenderWindows() */ QHash GetRenderWindows() const; /** * \see mitk::IRenderWindowPart::GetRenderWindow(QString) */ QmitkRenderWindow* GetRenderWindow(const QString& id) const; /** * \see mitk::IRenderWindowPart::GetSelectionPosition() */ mitk::Point3D GetSelectedPosition(const QString& id = QString()) const; /** * \see mitk::IRenderWindowPart::SetSelectedPosition() */ void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()); /** * \see mitk::IRenderWindowPart::EnableDecorations() */ void EnableDecorations(bool enable, const QStringList& decorations = QStringList()); /** * \see mitk::IRenderWindowPart::IsDecorationEnabled() */ bool IsDecorationEnabled(const QString& decoration) const; /** * \see mitk::IRenderWindowPart::GetDecorations() */ QStringList GetDecorations() const; + /** + * \see mitk::IRenderWindowPart::EnableInteractors() + */ + void EnableInteractors(bool enable, const QStringList& interactors = QStringList()); + + /** + * \see mitk::IRenderWindowPart::IsInteractorEnabled() + */ + bool IsInteractorEnabled(const QString& interactor) const; + + /** + * \see mitk::IRenderWindowPart::GetInteractors() + */ + QStringList GetInteractors() const; + // ------------------- mitk::ILinkedRenderWindowPart ---------------------- mitk::SlicesRotator* GetSlicesRotator() const; mitk::SlicesSwiveller* GetSlicesSwiveller() const; void EnableSlicingPlanes(bool enable); bool IsSlicingPlanesEnabled() const; void EnableLinkedNavigation(bool enable); bool IsLinkedNavigationEnabled() const; protected: void SetFocus(); void OnPreferencesChanged(const berry::IBerryPreferences*); void CreateQtPartControl(QWidget* parent); private: const QScopedPointer d; }; #endif /*QMITKSTDMULTIWIDGETEDITOR_H_*/