[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Fri Feb 20 08:02:08 CET 2004


CVS commit by harris: 

Implemented Manual stepping of the clock (wish #65476).

Press the "." / ">" key to advance one step forward; press the "," / "<" 
key to advance one step backward.  The stepsize is set by the TimeStep 
widget in the toolbar.

If the clock is running, it will be automatically stopped when one of the 
manual-step keys is pressed.

On my keyboard, "," and "<" appear together on the same key, and "." and 
">" are on another key; is that generally true for all keyboards?

At this point, there is no GUI way to do the manual-stepping.  It would 
make sense to add these buttons to the TimeStep widget, but it is already 
pretty complicated.  What do you think?

CCMAIL: 65476-done at bugs.kde.org
CCMAIL: kstars-devel at kde.org


  M +2 -2      simclock.cpp   1.14
  M +1 -1      simclock.h   1.10
  M +15 -0     skymapevents.cpp   1.84


--- kdeedu/kstars/kstars/simclock.cpp  #1.13:1.14
@@ -103,6 +103,6 @@ void SimClock::setManualMode( bool on ) 
 }
 
-void SimClock::manualTick() {
-        if ( ManualMode && ManualActive ) {
+void SimClock::manualTick( bool force ) {
+        if ( force || (ManualMode && ManualActive) ) {
                 setUTC( UTC().addSecs( int( Scale ) ) );
                 julian += Scale / ( 24.*3600. );

--- kdeedu/kstars/kstars/simclock.h  #1.9:1.10
@@ -107,5 +107,5 @@ class SimClock : public QObject, public 
                         *year is not constant (leap years), so it is better to increment the
                         *year, instead of adding 31 million seconds. */
-                void manualTick();
+                void manualTick( bool force=false );
 
         signals:

--- kdeedu/kstars/kstars/skymapevents.cpp  #1.83:1.84
@@ -235,4 +235,19 @@ void SkyMap::keyPressEvent( QKeyEvent *e
                         break;
 
+                case Key_Comma:  //advance one step backward in time
+                case Key_Less:
+                        if ( data->clock()->isActive() ) data->clock()->stop();
+                        data->clock()->setScale( -1.0 * data->clock()->scale() ); //temporarily need negative time step
+                        data->clock()->manualTick( true );
+                        data->clock()->setScale( -1.0 * data->clock()->scale() ); //reset original sign of time step
+                        update();
+                        break;
+
+                case Key_Period: //advance one step forward in time
+                        if ( data->clock()->isActive() ) data->clock()->stop();
+                        data->clock()->manualTick( true );
+                        update();
+                        break;
+
 //DUMP_HORIZON
 /*




More information about the Kstars-devel mailing list