]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Plot2d: clicking in legend on curve name doesn't highlight it in object browser
authordmv <dmv@opencascade.com>
Tue, 21 Oct 2008 11:29:41 +0000 (11:29 +0000)
committerdmv <dmv@opencascade.com>
Tue, 21 Oct 2008 11:29:41 +0000 (11:29 +0000)
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewFrame.h
src/Plot2d/Plot2d_ViewManager.cxx
src/Plot2d/Plot2d_ViewModel.cxx
src/Plot2d/Plot2d_ViewModel.h
src/SPlot2d/Makefile.am
src/SPlot2d/SPlot2d_ViewModel.cxx
src/SPlot2d/SPlot2d_ViewModel.h

index 55b805bfce768b014d076d1f43efe764735aca3c..afa7baa03e6f0a43b95077306397c1410a60dede 100755 (executable)
@@ -168,8 +168,8 @@ Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title )
      this,   SLOT( plotMousePressed( const QMouseEvent& ) ) );
   connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
      this,   SLOT( plotMouseReleased( const QMouseEvent& ) ) );
-  //connect( myPlot, SIGNAL( legendClicked( long ) ),
-  //   this,   SLOT( onLegendClicked( long ) ) );
+  connect( myPlot, SIGNAL( legendClicked( long ) ),
+     this, SIGNAL( legendClicked( long ) ) );
 
   /* Initial Setup - get from the preferences */
   readPreferences();
@@ -1135,6 +1135,7 @@ void Plot2d_ViewFrame::setLegendPos( int pos )
   }
 }
 
+
 /*!
   Sets new marker size
 */
index 108cbd9573cf42cfce02593947365b170cfcc3c1..1ca3f197fbebf16b3c71ff1dfbab5e6f35b6afd8 100755 (executable)
@@ -162,6 +162,7 @@ signals:
   void    vpModeVerChanged();
   void    vpCurveChanged();
   void    contextMenuRequested( QContextMenuEvent *e );
+  void    legendClicked(long key);
 
 protected:
   Plot2d_Plot2d* myPlot;
index a94f5642c01f410ea16e7017796d91f855a1337d..071794bd23fd2594c9e3013613e09d6c08977ac5 100755 (executable)
@@ -19,6 +19,7 @@
 #include "Plot2d_ViewManager.h"
 #include "Plot2d_ViewModel.h"
 #include "Plot2d_ViewWindow.h"
+#include "Plot2d_ViewFrame.h"
 
 /*!
   Constructor
@@ -55,6 +56,10 @@ bool Plot2d_ViewManager::insertView( SUIT_ViewWindow* theView )
   {
     Plot2d_ViewWindow* view = (Plot2d_ViewWindow*)theView;
     connect( view, SIGNAL( cloneView() ), this, SLOT( onCloneView() ) );
+
+    Plot2d_ViewFrame* aViewFrame = view->getViewFrame();
+    Plot2d_Viewer* aViewer = getPlot2dModel();
+    connect( aViewFrame, SIGNAL( legendClicked( long ) ), aViewer, SLOT( onLegendClicked( long ) ) );
   }
   return res;
 }
index 514d04b731361be2262300ac01e191465dddec71..d3a8cb66e2692d0f2d1421a4276c7087f52b334c 100755 (executable)
@@ -204,6 +204,13 @@ void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* n
   }
 }
 
+/*
+  SLOT: called when clicked item in the legend from Plot2d_ViewManager
+ */
+void Plot2d_Viewer::onLegendClicked( long key )
+{
+}
+
 /*!
   Sets view manager
   \param mgr - new view manager
index a61755549b2625abccf9eb4279ed54974e4d1428..cd049698f5a01a407127c9deba8366c4bd1eab1f 100755 (executable)
@@ -57,6 +57,7 @@ protected slots:
   void onDumpView();
   void onShowToolbar();
   virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
+  virtual void onLegendClicked( QwtPlotItem* plotItem );
 
 private:
   Plot2d_Prs* myPrs;
index 17dc25b37d1601d1c1c9698ac9556316157cf2a8..204978dfd52dc2c7bb0711f6a7760f616e4f6e49 100644 (file)
@@ -43,7 +43,7 @@ nodist_salomeres_DATA = SPlot2d_msg_en.qm
 
 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)/../OBJECT -I$(srcdir)/../LightApp -I$(srcdir)/../CAM -I$(srcdir)/../STD
 libSPlot2d_la_LDFLAGS=$(QT_MT_LIBS) $(QWT_LIBS) ../SUIT/libsuit.la ../Plot2d/libPlot2d.la ../Prs/libSalomePrs.la
 
 
index bb17e1c6369a0fd15961c14ed6f572f6b38b557d..b46c9e2c32e9e427cfff4c3d1d13c2388e65ccb8 100644 (file)
 #include "SUIT_Session.h"
 #include "SUIT_Application.h"
 
-//#include "utilities.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_Application.h"
+#include "SALOME_ListIO.hxx"
+
 #include "qapplication.h"
 #include <qtoolbar.h>
 #include <qtoolbutton.h>
@@ -385,6 +388,33 @@ void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame*
   Plot2d_Viewer::onCloneView( clonedVF, newVF );
 }
 
+/*!
+  SLOT: called when action "Legend Clicked" is activated.
+  override "onLegendClicked" method from Plot2d_ViewModel.
+*/
+void SPlot2d_Viewer::onLegendClicked( long key )
+{
+  Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
+  if(aViewFrame == NULL) return;
+
+  QIntDict<Plot2d_Curve> aCurves = aViewFrame->getCurves();
+
+  Plot2d_Curve*  aCurve = aCurves.find( key );
+  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 );
+      }
+    }
+  }
+}
+
 /*!
   create SPlot2d_ViewWindow
 */
index 7182def582893641f2b72880c7e3f65035c49691..0f215921e80c7457a096dc3d9e7c0e54cae9c105 100644 (file)
@@ -78,6 +78,7 @@ public:
 
 protected slots:
   virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
+  virtual void onLegendClicked( long key );
 };