]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Patches from Paul for Debian V2_2_4b1
authormpv <mpv@opencascade.com>
Tue, 14 Jun 2005 05:45:33 +0000 (05:45 +0000)
committermpv <mpv@opencascade.com>
Tue, 14 Jun 2005 05:45:33 +0000 (05:45 +0000)
src/SUPERVGUI/SUPERVGUI_Main.cxx

index 0f8e787648b3c8271d61bf84e0dac112cf400628..7d4856922f80cae84cab9a4534bd287a620c01c5 100644 (file)
@@ -59,6 +59,23 @@ using namespace std;
 #include <qcombobox.h>
 #include <qlabel.h>
 
+// PAL8065: san -- Safe access to widgets from secondary thread
+typedef TVoidMemFunEvent<SUPERVGUI_CanvasArray> TCanvasArrayEvent;
+typedef TVoidMemFunEvent<SUPERVGUI_Canvas> TCanvasEvent;
+
+class UpdateEvent : public SALOME_Event
+{
+ public:
+  UpdateEvent( QAD_Study* study, bool updSel = true ) : myStudy( study ), myUpdateSel( updSel ) {}
+  virtual void Execute(){
+    if ( myStudy ) myStudy->updateObjBrowser( myUpdateSel );
+  }
+
+ private:
+  QAD_Study* myStudy;
+  bool       myUpdateSel;
+};
+// PAL8065: san
 
 SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* theDesktop, SUPERV_Graph theDataFlow )
      : SUPERVGraph_View(theParent),
@@ -283,14 +300,22 @@ void SUPERVGUI_Main::sync() {
   
   t += dataflow->Name();
   setCaption(t);
+  
+  // PAL8065: san
+  MESSAGE("WANTED - ProcessVoidEvent( new UpdateEvent( study )) ;");
 
-  study->updateObjBrowser();
   if (myCurrentView == CANVASTABLE) {
-    myArray->sync();
-    myArray->update();
+    // PAL8065: san
+    MESSAGE("EXECUTED - ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::sync ) ); ");
+    ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::sync ) );
+    MESSAGE("EXECUTED - ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::update ) ); ");
+    ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::update ) );
   } else {
-    myCanvas->sync();
-    myCanvas->update();
+    // PAL8065: san
+    MESSAGE("EXECUTED - ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::sync ) ); ");
+    ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::sync ) );
+    MESSAGE("EXECUTED - ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::update ) ); ");
+    ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::update ) );
   }
 }
 
@@ -893,7 +918,7 @@ void SUPERVGUI_Main::addDataflowToStudy() {
     Supervision.registerGraph(dataflow->getIOR(), this);
 
     if ( !myThread->running() )
-      study->updateObjBrowser();
+      MESSAGE("WANTED - study->updateObjBrowser(); ");
   }
   else {
     MESSAGE( "ERROR: failed to find or create dataflow SObject" );
@@ -1022,7 +1047,7 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
     aBuilder->AbortCommand();
   
   if ( !myThread->running() )
-    study->updateObjBrowser();
+    MESSAGE("WANTED - study->updateObjBrowser(); ");
 
   isIn = false;
   return true;
@@ -1151,6 +1176,7 @@ void SUPERVGUI_Main::startTimer() {
 }
 
 void SUPERVGUI_Main::executionFinished() {
+  MESSAGE("EXECUTED - getStudy()->updateObjBrowser(); ");
   getStudy()->updateObjBrowser();
   myCanvas->update();
   myArray->update();