yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #00602
[svn] r1499 - trunk/gui/qt3
Author: cosurgi
Date: 2008-09-02 05:23:06 +0200 (Tue, 02 Sep 2008)
New Revision: 1499
Modified:
trunk/gui/qt3/SimulationController.cpp
trunk/gui/qt3/SimulationController.hpp
Log:
don't refresh display when there's nothing to refresh
Modified: trunk/gui/qt3/SimulationController.cpp
===================================================================
--- trunk/gui/qt3/SimulationController.cpp 2008-08-29 21:23:56 UTC (rev 1498)
+++ trunk/gui/qt3/SimulationController.cpp 2008-09-02 03:23:06 UTC (rev 1499)
@@ -84,7 +84,11 @@
}
/* restart timer with SimulationController::refreshTime */
-void SimulationController::restartTimer(){ killTimer(updateTimerId); updateTimerId=startTimer(refreshTime); }
+void SimulationController::restartTimer()
+{
+ killTimer(updateTimerId);
+ updateTimerId=startTimer(refreshTime);
+}
void SimulationController::pbApplyClicked()
@@ -225,12 +229,24 @@
else Omega::instance().startSimulationLoop();
}
-void SimulationController::cbSyncToggled(bool b){ sync=b; if(sync && refreshTime<20) refreshTime=20; pbStopClicked(); pbStartClicked(); }
-void SimulationController::timerEvent( QTimerEvent* ){
+void SimulationController::cbSyncToggled(bool b)
+{
+ sync=b;
+ if(sync && refreshTime<20)
+ refreshTime=20;
+ pbStopClicked();
+ pbStartClicked();
+}
+
+void SimulationController::timerEvent( QTimerEvent* )
+{
doUpdate(); /* update the controller, like iteration number etc */
- /* update GLViews */
- YadeQtMainWindow::self->redrawAll(true);
- if(sync && syncRunning){ Omega::instance().spawnSingleSimulationLoop(); }
+ if(hasSimulation && (Omega::instance().isRunning() || syncRunning))
+ {
+ /* update GLViews */
+ YadeQtMainWindow::self->redrawAll(true);
+ if(sync && syncRunning){ Omega::instance().spawnSingleSimulationLoop(); }
+ }
}
void SimulationController::pbResetClicked()
@@ -386,8 +402,8 @@
//cerr<<"dt="<<dt<<",exp10="<<exp10<<",10^exp10="<<pow((float)10,exp10)<<endl;
/* enable/disable controls here, dynamically */
- bool hasSimulation=(Omega::instance().getRootBody() ? Omega::instance().getRootBody()->bodies->size()>0 : false ),
- isRunning=Omega::instance().isRunning() || syncRunning,
+ hasSimulation=(Omega::instance().getRootBody() ? Omega::instance().getRootBody()->bodies->size()>0 : false );
+ bool isRunning=Omega::instance().isRunning() || syncRunning,
hasTimeStepper=Omega::instance().containTimeStepper(),
usesTimeStepper=Omega::instance().timeStepperActive(),
hasFileName=(Omega::instance().getSimulationFileName()!="");
Modified: trunk/gui/qt3/SimulationController.hpp
===================================================================
--- trunk/gui/qt3/SimulationController.hpp 2008-08-29 21:23:56 UTC (rev 1498)
+++ trunk/gui/qt3/SimulationController.hpp 2008-09-02 03:23:06 UTC (rev 1499)
@@ -33,6 +33,7 @@
int updateTimerId;
bool sync;
bool syncRunning;
+ bool hasSimulation;
const int iterPerSec_TTL_ms;
long iterPerSec_LastIter;