#ifndef DISABLE_PLOT2DVIEWER
#include <Plot2d_ViewManager.h>
#include <Plot2d_ViewModel.h>
+ #include "LightApp_Plot2dSelector.h"
#ifndef DISABLE_SALOMEOBJECT
#include <SPlot2d_ViewModel.h>
#else
viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
Plot2d_Viewer* vm;
#ifndef DISABLE_SALOMEOBJECT
- vm = new SPlot2d_Viewer();
+ SPlot2d_Viewer* v = new SPlot2d_Viewer();
+ vm = v;
+ new LightApp_Plot2dSelector( v, mySelMgr );
#else
vm = new Plot2d_Viewer();
#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "LightApp_Plot2dSelector.h"
+
+#include "LightApp_DataOwner.h"
+#include "LightApp_DataObject.h"
+#include "LightApp_Application.h"
+
+/*!
+ Constructor
+*/
+LightApp_Plot2dSelector::LightApp_Plot2dSelector( SPlot2d_Viewer* v, SUIT_SelectionMgr* mgr )
+: SUIT_Selector( mgr, v )
+{
+ if ( v )
+ connect( v, SIGNAL( legendSelected( const QString& ) ), this, SLOT( onSelectionChanged( const QString& ) ) );
+}
+
+/*!
+ Destructor
+*/
+LightApp_Plot2dSelector::~LightApp_Plot2dSelector()
+{
+}
+
+/*!
+ Gets selection.
+*/
+void LightApp_Plot2dSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
+{
+ if( !myCurEntry.isNull() )
+ theList.append( new LightApp_DataOwner( myCurEntry ) );
+}
+
+/*!Sets selection.*/
+void LightApp_Plot2dSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
+{
+ //////////////////////////
+ // CURRENTLY NOT SUPPORTED
+ //////////////////////////
+ /*
+ if( theList.count()>0 )
+ myCurEntry = theList.first()->getEntry();
+ else
+ myCurEntry = QString::null;
+ */
+}
+
+/*!On selection changed.*/
+void LightApp_Plot2dSelector::onSelectionChanged( const QString& entry )
+{
+ myCurEntry = entry;
+ selectionChanged();
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef LIGHTAPP_PLOT2DSELECTOR_H
+#define LIGHTAPP_PLOT2DSELECTOR_H
+
+#include "LightApp.h"
+
+#include <SUIT_Selector.h>
+#include <SUIT_DataOwner.h>
+#include <SPlot2d_ViewModel.h>
+
+class LightApp_DataObject;
+
+/*!
+ \class LightApp_Plot2dSelector
+ Custom selector to get/set selection from object browser
+*/
+class LIGHTAPP_EXPORT LightApp_Plot2dSelector : public SUIT_Selector
+{
+ Q_OBJECT
+
+public:
+ LightApp_Plot2dSelector( SPlot2d_Viewer*, SUIT_SelectionMgr* );
+ virtual ~LightApp_Plot2dSelector();
+
+ /*!Return "ObjectBrowser"*/
+ virtual QString type() const { return "PLot2dViewer"; }
+
+private slots:
+ void onSelectionChanged( const QString& );
+
+protected:
+ virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
+ virtual void setSelection( const SUIT_DataOwnerPtrList& );
+
+private:
+ QString myCurEntry;
+};
+
+#endif
if ENABLE_GLVIEWER
salomeinclude_HEADERS+= LightApp_GLSelector.h
endif
-
+if ENABLE_PLOT2DVIEWER
+ salomeinclude_HEADERS+= LightApp_Plot2dSelector.h
+endif
dist_libLightApp_la_SOURCES= \
LightApp_AboutDlg.cxx \
LightApp_Application.cxx \
if ENABLE_GLVIEWER
dist_libLightApp_la_SOURCES+= LightApp_GLSelector.cxx
endif
+if ENABLE_PLOT2DVIEWER
+ dist_libLightApp_la_SOURCES+= LightApp_Plot2dSelector.cxx
+endif
MOC_FILES= \
LightApp_AboutDlg_moc.cxx \
if ENABLE_GLVIEWER
MOC_FILES+= LightApp_GLSelector_moc.cxx
endif
+if ENABLE_PLOT2DVIEWER
+ MOC_FILES+= LightApp_Plot2dSelector_moc.cxx
+endif
nodist_libLightApp_la_SOURCES= $(MOC_FILES)
dist_salomeres_DATA= \
class Plot2d_Prs;
class QString;
class QPopupMenu;
-class QwtPlotItem;
class PLOT2D_EXPORT Plot2d_Viewer: public SUIT_ViewModel
{
void onDumpView();
void onShowToolbar();
virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
- virtual void onLegendClicked( long key/*QwtPlotItem* plotItem*/ );
+ virtual void onLegendClicked( long );
private:
Plot2d_Prs* myPrs;
libSPlot2d_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../Plot2d -I$(srcdir)/../Prs \
- -I$(srcdir)/../OBJECT -I$(srcdir)/../LightApp -I$(srcdir)/../CAM -I$(srcdir)/../STD
+ -I$(srcdir)/../OBJECT
libSPlot2d_la_LDFLAGS=$(QT_MT_LIBS) $(QWT_LIBS) ../SUIT/libsuit.la ../Plot2d/libPlot2d.la ../Prs/libSalomePrs.la
#include "SUIT_Session.h"
#include "SUIT_Application.h"
-#include "LightApp_SelectionMgr.h"
-#include "LightApp_Application.h"
#include "SALOME_ListIO.hxx"
#include "qapplication.h"
SPlot2d_Curve* aSCurve = dynamic_cast<SPlot2d_Curve*>(aCurve);
if(aSCurve && aSCurve->hasIO()) {
- LightApp_Application* anApp = dynamic_cast< LightApp_Application* >( SUIT_Session::session()->activeApplication() );
- if ( anApp ) {
- LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- if (aSelectionMgr) {
- SALOME_ListIO aListIO;
- aListIO.Append( aSCurve->getIO() );
- aSelectionMgr->setSelectedObjects( aListIO, false );
- }
- }
+ QString anEntry = aSCurve->getIO()->getEntry();
+ emit legendSelected( anEntry );
}
}
protected slots:
virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
virtual void onLegendClicked( long key );
+
+signals:
+ void legendSelected( const QString& );
};