[Kstars-devel] [kstars] kstars: Display grid according to active coordinate system system.

Jérôme SONRIER jsid at emor3j.fr.eu.org
Wed Mar 7 00:35:59 UTC 2012


Git commit a1b84b762b80f3c09023b79b53206b3422b0edd0 by Jérôme SONRIER.
Committed on 07/03/2012 at 01:28.
Pushed by jsonrier into branch 'master'.

Display grid according to active coordinate system system.
CCBUG: 119542
CCMAIL: kstars-devel at kde.org

M  +5    -0    kstars/kstars.kcfg
M  +2    -0    kstars/kstarsdcop.cpp
M  +8    -0    kstars/options/opsguides.cpp
M  +2    -1    kstars/options/opsguides.h
M  +14   -1    kstars/options/opsguides.ui
M  +5    -2    kstars/skycomponents/equatorialcoordinategrid.cpp
M  +5    -2    kstars/skycomponents/horizontalcoordinategrid.cpp

http://commits.kde.org/kstars/a1b84b762b80f3c09023b79b53206b3422b0edd0

diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index a8ac000..395bd94 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -398,6 +398,11 @@
 			<whatsthis>Toggle whether the equator line is drawn in the sky map.</whatsthis>
 			<default>false</default>
 		</entry>
+        <entry name="AutoSelectGrid" type="Bool">
+            <label>Draw grids according to active coordinate system system?</label>
+            <whatsthis>Coordinate grids will automatically change according to active coordinate system system.</whatsthis>
+            <default>true</default>
+        </entry>
 		<entry name="ShowEquatorialGrid" type="Bool">
 			<label>Draw equatorial coordinate grid in the sky map?</label>
 			<whatsthis>Toggle whether the equatorial coordinate grid is drawn in the sky map.</whatsthis>
diff --git a/kstars/kstarsdcop.cpp b/kstars/kstarsdcop.cpp
index c8f4108..d1887d6 100644
--- a/kstars/kstarsdcop.cpp
+++ b/kstars/kstarsdcop.cpp
@@ -1,3 +1,4 @@
+
 /***************************************************************************
                           kstarsdcop.cpp  -  description
                              -------------------
@@ -313,6 +314,7 @@ void KStars::changeViewOption( const QString &op, const QString &val ) {
     if ( op == "ShowCBounds"     && bOk ) Options::setShowCBounds(  bVal );
     if ( op == "ShowCNames"      && bOk ) Options::setShowCNames(   bVal );
     if ( op == "ShowMilkyWay"    && bOk ) Options::setShowMilkyWay( bVal );
+    if ( op == "AutoSelectGrid"  && bOk ) Options::setAutoSelectGrid( bVal );
     if ( op == "ShowEquatorialGrid" && bOk ) Options::setShowEquatorialGrid( bVal );
     if ( op == "ShowHorizontalGrid" && bOk ) Options::setShowHorizontalGrid( bVal );
     if ( op == "ShowEquator"     && bOk ) Options::setShowEquator(  bVal );
diff --git a/kstars/options/opsguides.cpp b/kstars/options/opsguides.cpp
index 4e52837..d69b419 100644
--- a/kstars/options/opsguides.cpp
+++ b/kstars/options/opsguides.cpp
@@ -31,6 +31,8 @@ OpsGuides::OpsGuides( KStars *_ks )
              this, SLOT( slotToggleMilkyWayOptions( bool ) ) );
     connect( kcfg_ShowGround, SIGNAL( toggled( bool ) ),
              this, SLOT( slotToggleOpaqueGround( bool ) ) );
+    connect( kcfg_AutoSelectGrid, SIGNAL( toggled( bool ) ),
+             this, SLOT( slotToggleAutoSelectGrid( bool ) ) );
 
     foreach( const QString& item,  ksw->data()->skyComposite()->getCultureNames() )
         kcfg_SkyCulture->addItem( i18nc("Sky Culture", item.toUtf8().constData() ) );
@@ -40,6 +42,7 @@ OpsGuides::OpsGuides( KStars *_ks )
     slotToggleOpaqueGround( Options::showGround() ); 
     slotToggleConstellOptions( Options::showCNames() );
     slotToggleMilkyWayOptions( Options::showMilkyWay() );
+    slotToggleAutoSelectGrid( Options::autoSelectGrid() );
 
 }
 
@@ -58,4 +61,9 @@ void OpsGuides::slotToggleOpaqueGround( bool state ) {
     kcfg_ShowHorizon->setEnabled( !state );
 }
 
+void OpsGuides::slotToggleAutoSelectGrid( bool state ) {
+    kcfg_ShowEquatorialGrid->setEnabled( !state );
+    kcfg_ShowHorizontalGrid->setEnabled( !state );
+}
+
 #include "opsguides.moc"
diff --git a/kstars/options/opsguides.h b/kstars/options/opsguides.h
index 2e95b79..0f6b53b 100644
--- a/kstars/options/opsguides.h
+++ b/kstars/options/opsguides.h
@@ -32,7 +32,8 @@ public:
 private slots:
     void slotToggleConstellOptions( bool state );
     void slotToggleMilkyWayOptions( bool state );
-    void slotToggleOpaqueGround( bool state ); 
+    void slotToggleOpaqueGround( bool state );
+    void slotToggleAutoSelectGrid( bool state );
 
 private:
     KStars *ksw;
diff --git a/kstars/options/opsguides.ui b/kstars/options/opsguides.ui
index baec64d..9cf3e0f 100644
--- a/kstars/options/opsguides.ui
+++ b/kstars/options/opsguides.ui
@@ -193,6 +193,19 @@
     </spacer>
    </item>
    <item>
+    <widget class="QCheckBox" name="kcfg_AutoSelectGrid" >
+     <property name="toolTip" >
+      <string>Draw grids according to active coordinate system system?</string>
+     </property>
+     <property name="whatsThis" >
+      <string>If checked, coordinate grids will automatically change according to active coordinate system system.</string>
+     </property>
+     <property name="text" >
+      <string>Automatically select coordinate grid</string>
+     </property>
+    </widget>
+   </item>
+   <item>
     <widget class="QCheckBox" name="kcfg_ShowEquatorialGrid" >
      <property name="toolTip" >
       <string>Draw equatorial coordinate grid?</string>
@@ -201,7 +214,7 @@
       <string>If checked, a grid of lines will be drawn every 2 hours in Right Ascension and every 20 degrees in Declination.</string>
      </property>
      <property name="text" >
-      <string>Equatorial coor&dinate grid</string>
+      <string>Equatorial coordinate grid</string>
      </property>
     </widget>
    </item>
diff --git a/kstars/skycomponents/equatorialcoordinategrid.cpp b/kstars/skycomponents/equatorialcoordinategrid.cpp
index 8bd1e0d..e28b69b 100644
--- a/kstars/skycomponents/equatorialcoordinategrid.cpp
+++ b/kstars/skycomponents/equatorialcoordinategrid.cpp
@@ -91,8 +91,11 @@ EquatorialCoordinateGrid::EquatorialCoordinateGrid( SkyComposite *parent )
 
 bool EquatorialCoordinateGrid::selected()
 {
-    return Options::showEquatorialGrid() &&
-           ! ( Options::hideOnSlew() && Options::hideGrids() && SkyMap::IsSlewing() );
+    if ( Options::autoSelectGrid() )
+        return( ! Options::useAltAz() );
+    else
+        return( Options::showEquatorialGrid() &&
+            ! ( Options::hideOnSlew() && Options::hideGrids() && SkyMap::IsSlewing() ) );
 }
 
 void EquatorialCoordinateGrid::preDraw( SkyPainter* skyp )
diff --git a/kstars/skycomponents/horizontalcoordinategrid.cpp b/kstars/skycomponents/horizontalcoordinategrid.cpp
index 06c57d8..c845224 100644
--- a/kstars/skycomponents/horizontalcoordinategrid.cpp
+++ b/kstars/skycomponents/horizontalcoordinategrid.cpp
@@ -95,8 +95,11 @@ HorizontalCoordinateGrid::HorizontalCoordinateGrid( SkyComposite *parent )
 
 bool HorizontalCoordinateGrid::selected()
 {
-    return Options::showHorizontalGrid() &&
-           ! ( Options::hideOnSlew() && Options::hideGrids() && SkyMap::IsSlewing() );
+    if ( Options::autoSelectGrid() )
+        return( Options::useAltAz() );
+    else
+        return( Options::showHorizontalGrid() &&
+            ! ( Options::hideOnSlew() && Options::hideGrids() && SkyMap::IsSlewing() ) );
 }
 
 void HorizontalCoordinateGrid::preDraw( SkyPainter* skyp )


More information about the Kstars-devel mailing list