Commit 9bdc5271 authored by Clinton Stimpson's avatar Clinton Stimpson

ENH:  Add ability to add view options to custom views from plugins.
      Addresses #6769.
parent ed0689f9
......@@ -244,45 +244,38 @@ MACRO(ADD_PARAVIEW_VIEW_MODULE OUTIFACES OUTSRCS)
"" ${ARGN} )
IF(NOT ARG_VIEW_TYPE OR NOT ARG_VIEW_XML_GROUP)
MESSAGE(ERROR "ADD_PARAVIEW_VIEW_MODULE called without VIEW_TYPE or VIEW_XML_GROUP")
MESSAGE(ERROR " ADD_PARAVIEW_VIEW_MODULE called without VIEW_TYPE or VIEW_XML_GROUP")
ENDIF(NOT ARG_VIEW_TYPE OR NOT ARG_VIEW_XML_GROUP)
IF(ARG_DISPLAY_PANEL)
IF(NOT ARG_DISPLAY_XML)
MESSAGE(ERROR "ADD_PARAVIEW_VIEW_MODULE called with DISPLAY_PANEL but DISPLAY_XML not specified")
MESSAGE(ERROR " ADD_PARAVIEW_VIEW_MODULE called with DISPLAY_PANEL but DISPLAY_XML not specified")
ENDIF(NOT ARG_DISPLAY_XML)
ENDIF(ARG_DISPLAY_PANEL)
SET(${OUTIFACES} ${ARG_VIEW_TYPE})
SET(VIEW_TYPE ${ARG_VIEW_TYPE})
SET(VIEW_XML_GROUP ${ARG_VIEW_XML_GROUP})
IF(ARG_VIEW_XML_NAME)
SET(VIEW_XML_NAME ${ARG_VIEW_XML_NAME})
ELSE(ARG_VIEW_XML_NAME)
SET(VIEW_XML_NAME ${ARG_VIEW_TYPE})
ENDIF(ARG_VIEW_XML_NAME)
IF(NOT ARG_VIEW_XML_NAME)
SET(ARG_VIEW_XML_NAME ${ARG_VIEW_TYPE})
ENDIF(NOT ARG_VIEW_XML_NAME)
IF(ARG_VIEW_NAME)
SET(VIEW_TYPE_NAME ${ARG_VIEW_NAME})
ELSE(ARG_VIEW_NAME)
SET(VIEW_TYPE_NAME ${ARG_VIEW_TYPE})
ENDIF(ARG_VIEW_NAME)
IF(ARG_DISPLAY_TYPE)
SET(DISPLAY_TYPE ${ARG_DISPLAY_TYPE})
ELSE(ARG_DISPLAY_TYPE)
SET(DISPLAY_TYPE "pqDataRepresentation")
ENDIF(ARG_DISPLAY_TYPE)
IF(NOT ARG_DISPLAY_TYPE)
SET(ARG_DISPLAY_TYPE "pqDataRepresentation")
ENDIF(NOT ARG_DISPLAY_TYPE)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Core/pqViewModuleImplementation.h.in
${CMAKE_CURRENT_BINARY_DIR}/${VIEW_TYPE}Implementation.h @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}Implementation.h @ONLY)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Core/pqViewModuleImplementation.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${VIEW_TYPE}Implementation.cxx @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}Implementation.cxx @ONLY)
GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${QT_INCLUDE_DIRS};${PARAVIEW_GUI_INCLUDE_DIRS}")
SET(VIEW_MOC_SRCS)
QT4_WRAP_CPP(VIEW_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${VIEW_TYPE}Implementation.h)
QT4_WRAP_CPP(VIEW_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}Implementation.h)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
IF(ARG_DISPLAY_PANEL)
......@@ -293,14 +286,70 @@ MACRO(ADD_PARAVIEW_VIEW_MODULE OUTIFACES OUTSRCS)
ENDIF(ARG_DISPLAY_PANEL)
SET(${OUTSRCS}
${CMAKE_CURRENT_BINARY_DIR}/${VIEW_TYPE}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${VIEW_TYPE}Implementation.h
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}Implementation.h
${VIEW_MOC_SRCS}
${PANEL_SRCS}
)
ENDMACRO(ADD_PARAVIEW_VIEW_MODULE)
# create implementation for a custom view options interface
# ADD_PARAVIEW_VIEW_OPTIONS(
# OUTIFACES
# OUTSRCS
# VIEW_TYPE type
# [ACTIVE_VIEW_OPTIONS classname]
# [GLOBAL_VIEW_OPTIONS classname]
#
# VIEW_TYPE: the type of view the options panels are associated with
# ACTIVE_VIEW_OPTIONS: optional name for the class that implements pqActiveViewOptions
# this is to add options that are specific to a view instance
# GLOBAL_VIEW_OPTIONS: optional name for the class that implements pqOptionsContainer
# this is to add options that apply to all view instances
MACRO(ADD_PARAVIEW_VIEW_OPTIONS OUTIFACES OUTSRCS)
PV_PLUGIN_PARSE_ARGUMENTS(ARG "VIEW_TYPE;ACTIVE_VIEW_OPTIONS;GLOBAL_VIEW_OPTIONS" "" ${ARGN} )
IF(NOT ARG_VIEW_TYPE)
MESSAGE(ERROR " ADD_PARAVIEW_VIEW_OPTIONS called without VIEW_TYPE")
ENDIF(NOT ARG_VIEW_TYPE)
IF(NOT ARG_ACTIVE_VIEW_OPTIONS AND NOT ARG_GLOBAL_VIEW_OPTIONS)
MESSAGE(ERROR " ADD_PARAVIEW_VIEW_OPTIONS called without ACTIVE_VIEW_OPTIONS or GLOBAL_VIEW_OPTIONS")
ENDIF(NOT ARG_ACTIVE_VIEW_OPTIONS AND NOT ARG_GLOBAL_VIEW_OPTIONS)
SET(HAVE_ACTIVE_VIEW_OPTIONS 0)
SET(HAVE_GLOBAL_VIEW_OPTIONS 0)
IF(ARG_ACTIVE_VIEW_OPTIONS)
SET(HAVE_ACTIVE_VIEW_OPTIONS 1)
ENDIF(ARG_ACTIVE_VIEW_OPTIONS)
IF(ARG_GLOBAL_VIEW_OPTIONS)
SET(HAVE_GLOBAL_VIEW_OPTIONS 1)
ENDIF(ARG_GLOBAL_VIEW_OPTIONS)
SET(${OUTIFACES} ${ARG_VIEW_TYPE}Options)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqViewOptionsImplementation.h.in
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}OptionsImplementation.h @ONLY)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqViewOptionsImplementation.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}OptionsImplementation.cxx @ONLY)
GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${QT_INCLUDE_DIRS};${PARAVIEW_GUI_INCLUDE_DIRS}")
SET(PANEL_MOC_SRCS)
QT4_WRAP_CPP(PANEL_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}OptionsImplementation.h)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
SET(${OUTSRCS}
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}OptionsImplementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${ARG_VIEW_TYPE}OptionsImplementation.h
${PANEL_MOC_SRCS}
)
ENDMACRO(ADD_PARAVIEW_VIEW_OPTIONS)
# create implementation for a custom display panel interface
# ADD_PARAVIEW_ACTION_GROUP(
......@@ -314,25 +363,23 @@ ENDMACRO(ADD_PARAVIEW_VIEW_MODULE)
MACRO(ADD_PARAVIEW_ACTION_GROUP OUTIFACES OUTSRCS)
PV_PLUGIN_PARSE_ARGUMENTS(ARG "CLASS_NAME;GROUP_NAME" "" ${ARGN} )
SET(CLASS_NAME ${ARG_CLASS_NAME})
SET(GROUP_NAME ${ARG_GROUP_NAME})
SET(${OUTIFACES} ${CLASS_NAME})
SET(${OUTIFACES} ${ARG_CLASS_NAME})
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqActionGroupImplementation.h.in
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h @ONLY)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqActionGroupImplementation.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.cxx @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.cxx @ONLY)
GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${QT_INCLUDE_DIRS};${PARAVIEW_GUI_INCLUDE_DIRS}")
SET(ACTION_MOC_SRCS)
QT4_WRAP_CPP(ACTION_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h)
QT4_WRAP_CPP(ACTION_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
SET(${OUTSRCS}
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h
${ACTION_MOC_SRCS}
)
ENDMACRO(ADD_PARAVIEW_ACTION_GROUP)
......@@ -353,28 +400,25 @@ MACRO(ADD_PARAVIEW_DOCK_WINDOW OUTIFACES OUTSRCS)
PV_PLUGIN_PARSE_ARGUMENTS(ARG "CLASS_NAME;DOCK_AREA" "" ${ARGN} )
IF(ARG_DOCK_AREA)
SET(DOCK_AREA ${ARG_DOCK_AREA})
ELSE(ARG_DOCK_AREA)
SET(DOCK_AREA Left)
ENDIF(ARG_DOCK_AREA)
SET(CLASS_NAME ${ARG_CLASS_NAME})
SET(${OUTIFACES} ${CLASS_NAME})
IF(NOT ARG_DOCK_AREA)
SET(ARG_DOCK_AREA Left)
ENDIF(NOT ARG_DOCK_AREA)
SET(${OUTIFACES} ${ARG_CLASS_NAME})
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqDockWindowImplementation.h.in
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h @ONLY)
CONFIGURE_FILE(${ParaView_SOURCE_DIR}/Qt/Components/pqDockWindowImplementation.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.cxx @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.cxx @ONLY)
GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${QT_INCLUDE_DIRS};${PARAVIEW_GUI_INCLUDE_DIRS}")
SET(ACTION_MOC_SRCS)
QT4_WRAP_CPP(ACTION_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h)
QT4_WRAP_CPP(ACTION_MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
SET(${OUTSRCS}
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}Implementation.h
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.cxx
${CMAKE_CURRENT_BINARY_DIR}/${ARG_CLASS_NAME}Implementation.h
${ACTION_MOC_SRCS}
)
ENDMACRO(ADD_PARAVIEW_DOCK_WINDOW)
......
......@@ -32,26 +32,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "@CLASS_NAME@Implementation.h"
#include "@CLASS_NAME@.h"
#include "@ARG_CLASS_NAME@Implementation.h"
#include "@ARG_CLASS_NAME@.h"
@CLASS_NAME@Implementation::@CLASS_NAME@Implementation(QObject* p)
@ARG_CLASS_NAME@Implementation::@ARG_CLASS_NAME@Implementation(QObject* p)
: QObject(p)
{
this->ActionGroup = new @CLASS_NAME@(this);
this->ActionGroup = new @ARG_CLASS_NAME@(this);
}
@CLASS_NAME@Implementation::~@CLASS_NAME@Implementation()
@ARG_CLASS_NAME@Implementation::~@ARG_CLASS_NAME@Implementation()
{
}
QString @CLASS_NAME@Implementation::groupName()
QString @ARG_CLASS_NAME@Implementation::groupName()
{
return "@GROUP_NAME@";
return "@ARG_GROUP_NAME@";
}
QActionGroup* @CLASS_NAME@Implementation::actionGroup()
QActionGroup* @ARG_CLASS_NAME@Implementation::actionGroup()
{
return this->ActionGroup;
}
......
......@@ -32,21 +32,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _@CLASS_NAME@Implementation_h
#define _@CLASS_NAME@Implementation_h
#ifndef _@ARG_CLASS_NAME@Implementation_h
#define _@ARG_CLASS_NAME@Implementation_h
#include "pqActionGroupInterface.h"
#include <QObject>
/// interface class for plugins that create QActionGroups
/// for adding actions to menus and toolbars
class @CLASS_NAME@Implementation : public QObject, public pqActionGroupInterface
class @ARG_CLASS_NAME@Implementation : public QObject, public pqActionGroupInterface
{
Q_OBJECT
Q_INTERFACES(pqActionGroupInterface)
public:
@CLASS_NAME@Implementation(QObject* p);
~@CLASS_NAME@Implementation();
@ARG_CLASS_NAME@Implementation(QObject* p);
~@ARG_CLASS_NAME@Implementation();
/// the identifier for this action group
/// return "ToolBar/MyTools to put them in a toolbar called MyTools
......
......@@ -32,29 +32,29 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#include "@CLASS_NAME@.h"
#include "@CLASS_NAME@Implementation.h"
#include "@ARG_CLASS_NAME@.h"
#include "@ARG_CLASS_NAME@Implementation.h"
#include <QDockWidget>
#include <QWidget>
@CLASS_NAME@Implementation::@CLASS_NAME@Implementation(QObject* p)
@ARG_CLASS_NAME@Implementation::@CLASS_NAME@Implementation(QObject* p)
: QObject(p)
{
this->MyDock = 0;
}
QString @CLASS_NAME@Implementation::dockArea() const
QString @ARG_CLASS_NAME@Implementation::dockArea() const
{
return "@DOCK_AREA@";
return "@ARG_DOCK_AREA@";
}
QDockWidget* @CLASS_NAME@Implementation::dockWindow(QWidget* p)
QDockWidget* @ARG_CLASS_NAME@Implementation::dockWindow(QWidget* p)
{
if(!this->MyDock)
{
this->MyDock = new @CLASS_NAME@(p);
this->MyDock->setObjectName("@CLASS_NAME@");
this->MyDock = new @ARG_CLASS_NAME@(p);
this->MyDock->setObjectName("@ARG_CLASS_NAME@");
}
return this->MyDock;
}
......
......@@ -32,19 +32,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#ifndef _@CLASS_NAME@Implementation_h
#define _@CLASS_NAME@Implementation_h
#ifndef _@ARG_CLASS_NAME@Implementation_h
#define _@ARG_CLASS_NAME@Implementation_h
#include <QObject>
#include "pqDockWindowInterface.h"
// make this dock window a part of the application
class @CLASS_NAME@Implementation : public QObject, public pqDockWindowInterface
class @ARG_CLASS_NAME@Implementation : public QObject, public pqDockWindowInterface
{
Q_OBJECT
Q_INTERFACES(pqDockWindowInterface)
public:
@CLASS_NAME@Implementation(QObject* p);
@ARG_CLASS_NAME@Implementation(QObject* p);
virtual QString dockArea() const;
virtual QDockWidget* dockWindow(QWidget* p);
......
......@@ -135,6 +135,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqWriterFactory.h"
#include "pqSaveSnapshotDialog.h"
#include "pqQuickLaunchDialog.h"
#include "pqViewOptionsInterface.h"
#include <pqFileDialog.h>
#include <pqObjectNaming.h>
......@@ -3246,6 +3247,7 @@ void pqMainWindowCore::addPluginInterface(QObject* iface)
qobject_cast<pqActionGroupInterface*>(iface);
pqDockWindowInterface* dockWindow =
qobject_cast<pqDockWindowInterface*>(iface);
if(actionGroup)
{
this->addPluginActions(actionGroup);
......@@ -3258,6 +3260,23 @@ void pqMainWindowCore::addPluginInterface(QObject* iface)
// plugins may contain new entries for menus
this->Implementation->FiltersMenuManager->update();
this->Implementation->SourcesMenuManager->update();
pqViewOptionsInterface* viewOptions =
qobject_cast<pqViewOptionsInterface*>(iface);
if(viewOptions)
{
foreach(QString viewtype, viewOptions->viewTypes())
{
pqActiveViewOptions* o =
viewOptions->createActiveViewOptions(viewtype,
this->Implementation->ActiveViewOptions);
if(o)
{
this->Implementation->ActiveViewOptions->registerOptions(
viewtype, o);
}
}
}
}
//-----------------------------------------------------------------------------
......
......@@ -73,3 +73,4 @@ public:
};
#endif
// Generated file. Do not edit.
/*=========================================================================
Program: ParaView
Module: pqViewOptionsImplementation.cxx.in
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "@ARG_VIEW_TYPE@OptionsImplementation.h"
#include "@ARG_VIEW_TYPE@.h"
#if @HAVE_ACTIVE_VIEW_OPTIONS@
#include "@ARG_ACTIVE_VIEW_OPTIONS@.h"
#endif
#if @HAVE_GLOBAL_VIEW_OPTIONS@
#include "@ARG_GLOBAL_VIEW_OPTIONS@.h"
#endif
#include "vtkSMProxyManager.h"
#include "pqDataRepresentation.h"
#include "pqServer.h"
// configured with CMake
// requires: ARG_VIEW_TYPE, HAVE_ACTIVE_VIEW_OPTIONS, ARG_ACTIVE_VIEW_OPTIONS,
// HAVE_GLOBAL_VIEW_OPTIONS, ARG_GLOBAL_VIEW_OPTIONS
@ARG_VIEW_TYPE@OptionsImplementation::@ARG_VIEW_TYPE@OptionsImplementation(QObject* o)
: QObject(o)
{
}
QStringList @ARG_VIEW_TYPE@OptionsImplementation::viewTypes() const
{
return QStringList() << "@ARG_VIEW_TYPE@";
}
pqActiveViewOptions* @ARG_VIEW_TYPE@OptionsImplementation::createActiveViewOptions(
const QString& type, QObject* parent)
{
#if @HAVE_ACTIVE_VIEW_OPTIONS@
if(this->viewTypes().contains(type))
{
return new @ARG_ACTIVE_VIEW_OPTIONS@(parent);
}
#endif
return NULL;
}
pqOptionsContainer* @ARG_VIEW_TYPE@OptionsImplementation::createGlobalViewOptions(
const QString& type, QWidget* parent)
{
#if @HAVE_GLOBAL_VIEW_OPTIONS@
if(this->viewTypes().contains(type))
{
return new @ARG_GLOBAL_VIEW_OPTIONS@(parent);
}
#endif
return NULL;
}
// Generated file. Do not edit.
/*=========================================================================
Program: ParaView
Module: pqViewOptionsImplementation.h.in
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _@ARG_VIEW_TYPE@OptionsImplementation_h
#define _@ARG_VIEW_TYPE@OptionsImplementation_h
#include <QObject>
#include "pqViewOptionsInterface.h"
/// CMake configured implementation of an options interface that
/// support one view type
class @ARG_VIEW_TYPE@OptionsImplementation : public QObject,
public pqViewOptionsInterface
{
Q_OBJECT
Q_INTERFACES(pqViewOptionsInterface)
public:
@ARG_VIEW_TYPE@OptionsImplementation(QObject* o);
QStringList viewTypes() const;
pqActiveViewOptions* createActiveViewOptions(const QString& type, QObject* parent);
pqOptionsContainer* createGlobalViewOptions(const QString& type, QWidget* parent);
};
#endif
/*=========================================================================
Program: ParaView
Module: pqViewOptionsInterface.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _pqViewOptionsInterface_h
#define _pqViewOptionsInterface_h
#include <QtPlugin>
class pqActiveViewOptions;
class pqOptionsContainer;
/// interface class for plugins that create view options pages
class pqViewOptionsInterface
{
public:
/// destructor
virtual ~pqViewOptionsInterface() {}
/// returns a list of view types that this interface provides options for
virtual QStringList viewTypes() const = 0;
/// return an options object for the active view.
/// this is used when there are options that are specific to an instance of a
/// view
virtual pqActiveViewOptions* createActiveViewOptions(const QString& type, QObject* parent) = 0;
/// return an options object for global view options
/// this is used when there are options that apply to all instance of a view
virtual pqOptionsContainer* createGlobalViewOptions(const QString& type, QWidget* parent) = 0;
};
Q_DECLARE_INTERFACE(pqViewOptionsInterface, "com.kitware/paraview/viewoptions")
#endif
......@@ -32,94 +32,94 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "@VIEW_TYPE@Implementation.h"
#include "@VIEW_TYPE@.h"
#include "@ARG_VIEW_TYPE@Implementation.h"
#include "@ARG_VIEW_TYPE@.h"
#include "vtkSMProxyManager.h"
#include "pqDataRepresentation.h"
#include "pqServer.h"
// configured with CMake
// requires: VIEW_TYPE, VIEW_TYPE_NAME, DISPLAY_TYPE, VIEW_XML_GROUP,
// VIEW_XML_NAME
// requires: ARG_VIEW_TYPE, VIEW_TYPE_NAME, ARG_DISPLAY_TYPE, ARG_VIEW_XML_GROUP,
// ARG_VIEW_XML_NAME
@VIEW_TYPE@Implementation::@VIEW_TYPE@Implementation(QObject* o)
@ARG_VIEW_TYPE@Implementation::@ARG_VIEW_TYPE@Implementation(QObject* o)
: QObject(o)
{
}
QStringList @VIEW_TYPE@Implementation::viewTypes() const
QStringList @ARG_VIEW_TYPE@Implementation::viewTypes() const
{
return QStringList() << "@VIEW_TYPE@";
return QStringList() << "@ARG_VIEW_TYPE@";
}
QStringList @VIEW_TYPE@Implementation::displayTypes() const
QStringList @ARG_VIEW_TYPE@Implementation::displayTypes() const
{
return QStringList() << "@DISPLAY_TYPE@";
return QStringList() << "@ARG_DISPLAY_TYPE@";
}
QString @VIEW_TYPE@Implementation::viewTypeName(const QString& /*type*/) const
QString @ARG_VIEW_TYPE@Implementation::viewTypeName(const QString& /*type*/) const
{
return "@VIEW_TYPE_NAME@";
}
bool @VIEW_TYPE@Implementation::canCreateView(const QString& viewtype) const
bool @ARG_VIEW_TYPE@Implementation::canCreateView(const QString& viewtype) const
{
return viewtype == "@VIEW_TYPE@";
return viewtype == "@ARG_VIEW_TYPE@";
}
vtkSMProxy* @VIEW_TYPE@Implementation::createViewProxy(const QString& viewtype,
vtkSMProxy* @ARG_VIEW_TYPE@Implementation::createViewProxy(const QString& viewtype,
pqServer *server)
{
vtkSMProxyManager* pxm = vtkSMProxyManager::GetProxyManager();
if(viewtype == "@VIEW_TYPE@")
if(viewtype == "@ARG_VIEW_TYPE@")
{
// First, see if there is a render view specific to the server
QString xmlname
= QString("@VIEW_XML_NAME@%1").arg(server->getRenderViewXMLName());
if (pxm->ProxyElementExists("@VIEW_XML_GROUP@", xmlname.toAscii().data()))
= QString("@ARG_VIEW_XML_NAME@%1").arg(server->getRenderViewXMLName());
if (pxm->ProxyElementExists("@ARG_VIEW_XML_GROUP@", xmlname.toAscii().data()))
{
return pxm->NewProxy("@VIEW_XML_GROUP@", xmlname.toAscii().data());
return pxm->NewProxy("@ARG_VIEW_XML_GROUP@", xmlname.toAscii().data());
}
// Next, see what happens if we augment the type with View, in case this is
// how it is registered in XML.
if (pxm->ProxyElementExists("@VIEW_XML_GROUP@", "@VIEW_XML_NAME@View"))
if (pxm->ProxyElementExists("@ARG_VIEW_XML_GROUP@", "@ARG_VIEW_XML_NAME@View"))
{
return pxm->NewProxy("@VIEW_XML_GROUP@", "@VIEW_XML_NAME@View");
return pxm->NewProxy("@ARG_VIEW_XML_GROUP@", "@ARG_VIEW_XML_NAME@View");
}
// Last, just return whatever objectis registered under the view name.
return pxm->NewProxy("@VIEW_XML_GROUP@", "@VIEW_XML_NAME@");
return pxm->NewProxy("@ARG_VIEW_XML_GROUP@", "@ARG_VIEW_XML_NAME@");
}
return NULL;
}
pqView* @VIEW_TYPE@Implementation::createView(const QString& viewtype,
pqView* @ARG_VIEW_TYPE@Implementation::createView(const QString& viewtype,
const QString& group,
const QString& viewname,
vtkSMViewProxy* viewmodule,
pqServer* server,
QObject* p)
{
if(viewtype == "@VIEW_TYPE@")
if(viewtype == "@ARG_VIEW_TYPE@")
{
return new @VIEW_TYPE@("@VIEW_TYPE@", group, viewname, viewmodule, server, p);
return new @ARG_VIEW_TYPE@("@ARG_VIEW_TYPE@", group, viewname, viewmodule, server, p);
}
return NULL;
}
pqDataRepresentation* @VIEW_TYPE@Implementation::createDisplay(const QString& display_type,
pqDataRepresentation* @ARG_VIEW_TYPE@Implementation::createDisplay(const QString& display_type,
const QString& group,
const QString& n,
vtkSMProxy* proxy,
pqServer* server,
QObject* p)
{
if(display_type == "@DISPLAY_TYPE@")
if(display_type == "@ARG_DISPLAY_TYPE@")
{
return new @DISPLAY_TYPE@(group, n, proxy, server, p);
return new @ARG_DISPLAY_TYPE@(group, n, proxy, server, p);
}
return NULL;
}
......
......@@ -32,21 +32,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _@VIEW_TYPE@Implementation_h
#define _@VIEW_TYPE@Implementation_h
#ifndef _@ARG_VIEW_TYPE@Implementation_h
#define _@ARG_VIEW_TYPE@Implementation_h
#include <QObject>
#include "pqViewModuleInterface.h"
/// interface class for plugins that create view modules
class @VIEW_TYPE@Implementation : public QObject,
class @ARG_VIEW_TYPE@Implementation : public QObject,
public pqViewModuleInterface
{
Q_OBJECT
Q_INTERFACES(pqViewModuleInterface)
public:
@VIEW_TYPE@Implementation(QObject* o);
@ARG_VIEW_TYPE@Implementation(QObject* o);
QStringList viewTypes() const;
QStringList displayTypes() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment