summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-28 10:50:47 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-28 10:50:47 (GMT)
commit22eefeb1cf928919bf9836a9d4279d99a763f47a (patch)
treefce0fa67137b251d9aea662fe24368ecfae0b99f
parentac085a82d59a55054fc5b2919d27bfb805b4d2ae (diff)
More progress in guide module. Load & Save settings now work
-rw-r--r--kstars/ekos/ekosmanager.cpp3
-rw-r--r--kstars/ekos/focus/focus.cpp3
-rw-r--r--kstars/ekos/guide/guide.cpp222
-rw-r--r--kstars/ekos/guide/guide.h24
-rw-r--r--kstars/ekos/guide/guide.ui116
-rw-r--r--kstars/ekos/guide/opsguide.ui9
-rw-r--r--kstars/ekos/guide/scroll_graph.cpp572
-rw-r--r--kstars/ekos/guide/scroll_graph.h95
-rw-r--r--kstars/indi/indiccd.cpp1
9 files changed, 604 insertions, 441 deletions
diff --git a/kstars/ekos/ekosmanager.cpp b/kstars/ekos/ekosmanager.cpp
index 0e5edeb..c1ebae3 100644
--- a/kstars/ekos/ekosmanager.cpp
+++ b/kstars/ekos/ekosmanager.cpp
@@ -1606,9 +1606,6 @@ void EkosManager::setST4(ISD::ST4 * st4Driver)
guideProcess->addST4(st4Driver);
- if (Options::defaultST4Driver().isEmpty() == false)
- guideProcess->setST4(Options::defaultST4Driver());
-
//if (ao && ao->getDeviceName() == st4Driver->getDeviceName())
if (managedDevices.contains(KSTARS_ADAPTIVE_OPTICS) && (st4Driver->getDeviceName() == managedDevices[KSTARS_ADAPTIVE_OPTICS]->getDeviceName()))
guideProcess->setAO(st4Driver);
diff --git a/kstars/ekos/focus/focus.cpp b/kstars/ekos/focus/focus.cpp
index c01179e..5086c4a 100644
--- a/kstars/ekos/focus/focus.cpp
+++ b/kstars/ekos/focus/focus.cpp
@@ -982,7 +982,8 @@ void Focus::setCaptureComplete()
ISD::CCDChip *targetChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD);
// Always reset capture mode to NORMAL
- targetChip->setCaptureMode(FITS_NORMAL);
+ // JM 2016-09-28: Disable setting back to FITS_NORMAL as it might be causing issues. Each module should set capture module separately.
+ //targetChip->setCaptureMode(FITS_NORMAL);
FITSView *targetImage = targetChip->getImage(FITS_FOCUS);
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 15b1cad..f4fb24f 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -38,8 +38,8 @@
#include "guideadaptor.h"
#include "kspaths.h"
-#define driftGraph_WIDTH 300
-#define driftGraph_HEIGHT 300
+#define driftGraph_WIDTH 200
+#define driftGraph_HEIGHT 200
#define MAX_DITHER_RETIRES 20
#define MAX_GUIDE_STARS 10
@@ -61,7 +61,7 @@ Guide::Guide() : QWidget()
AODriver= NULL;
// ST4 Driver
- GuideDriver=NULL;
+ GuideDriver=NULL;
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
guideDeviationRA = guideDeviationDEC = 0;
@@ -69,25 +69,27 @@ Guide::Guide() : QWidget()
useGuideHead = false;
rapidGuideReticleSet = false;
+ // Load all settings
+ loadSettings();
+
// Exposure
- exposureIN->setValue(Options::guideExposure());
connect(exposureIN, SIGNAL(editingFinished()), this, SLOT(saveDefaultGuideExposure()));
// Guiding Box Size
- boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex());
connect(boxSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrackingBoxSize(int)));
// Guider CCD Selection
- connect(guiderCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
+ //connect(guiderCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
+ connect(guiderCombo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, [&](const QString & ccd){Options::setDefaultGuideCCD(ccd);});
connect(guiderCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
// Dark Frame Check
- darkFrameCheck->setChecked(Options::guideDarkFrameEnabled());
connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
// ST4 Selection
connect(ST4Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(newST4(int)));
- connect(ST4Combo, SIGNAL(activated(QString)), this, SLOT(setDefaultST4(QString)));
+ //connect(ST4Combo, SIGNAL(activated(QString)), this, SLOT(setDefaultST4(QString)));
+ //connect(ST4Combo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, [&](const QString & st4){Options::setDefaultST4Driver(st4);});
// Binning Combo Selection
connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
@@ -96,11 +98,6 @@ Guide::Guide() : QWidget()
connect( spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
connect( spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
-
- // MOVE THIS TO GUIDE OPTIONS
- //connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
- //connect( ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
-
// Guiding Rate - Advisory only
connect( spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
@@ -108,6 +105,7 @@ Guide::Guide() : QWidget()
connect( checkBox_DirRA, SIGNAL(toggled(bool)), this, SLOT(onEnableDirRA(bool)) );
connect( checkBox_DirDEC, SIGNAL(toggled(bool)), this, SLOT(onEnableDirDEC(bool)) );
+ // N/W and W/E direction enable
connect( northControlCheck, SIGNAL(toggled(bool)), this, SLOT(onControlDirectionChanged(bool)));
connect( southControlCheck, SIGNAL(toggled(bool)), this, SLOT(onControlDirectionChanged(bool)));
connect( westControlCheck, SIGNAL(toggled(bool)), this, SLOT(onControlDirectionChanged(bool)));
@@ -145,12 +143,14 @@ Guide::Guide() : QWidget()
controlLayout->addWidget(pi, 0, 1, 1, 1);
// Drift Graph
- driftGraph = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
- driftGraph->set_visible_ranges( driftGraph_WIDTH, 60 );
- driftGraph->on_paint();
+ //driftGraph = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
+ //driftGraphics->setSize(driftGraph_WIDTH, driftGraph_HEIGHT);
+ //driftGraphics->setSize(200, 200);
+ //driftGraphics->setVisibleRanges( 200, 60 );
+ //driftGraphics->update();
+ //driftGraphics->on_paint();
//ui.frame_Graph->resize( driftGraph_WIDTH + 2*ui.frame_Graph->frameWidth(), driftGraph_HEIGHT + 2*ui.frame_Graph->frameWidth() );
-
guiderType = static_cast<GuiderType>(Options::guiderType());
switch (guiderType)
@@ -165,16 +165,30 @@ Guide::Guide() : QWidget()
opsGuide = new OpsGuide(dynamic_cast<InternalGuider*>(guider));
dialog->addPage(opsGuide, i18n("Guide Settings"));
connect(guideOptionsB, SIGNAL(clicked()), dialog, SLOT(show()));
+
+ calibrationB->setEnabled(true);
+ captureB->setEnabled(true);
}
break;
case GUIDE_PHD2:
//guider = new PHD2();
+
+ // Do NOT receive BLOBs from the driver
+ //currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
+
+ calibrationB->setEnabled(false);
+ captureB->setEnabled(false);
break;
case GUIDE_LINGUIDER:
//guider = new LINGuider();
+
+ // Do NOT receive BLOBs from the driver
+ //currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
+ calibrationB->setEnabled(false);
+ captureB->setEnabled(false);
break;
}
@@ -182,9 +196,12 @@ Guide::Guide() : QWidget()
state = GUIDE_IDLE;
connect(guider, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
- connect(guider, SIGNAL(newProfilePixmap(QPixmap &)), this, SIGNAL(newProfilePixmap(QPixmap &)));
connect(guider, SIGNAL(newStarPosition(QVector3D,bool)), this, SLOT(setStarPosition(QVector3D,bool)));
+ // FIXME we emit this directly TODO
+ //connect(guider, SIGNAL(newProfilePixmap(QPixmap &)), this, SIGNAL(newProfilePixmap(QPixmap &)));
+
+
guider->Connect();
}
@@ -193,11 +210,6 @@ Guide::~Guide()
delete guider;
}
-void Guide::setDefaultCCD(QString ccd)
-{
- Options::setDefaultGuideCCD(ccd);
-}
-
void Guide::addCCD(ISD::GDInterface *newCCD)
{
ISD::CCD *ccd = static_cast<ISD::CCD*>(newCCD);
@@ -209,6 +221,21 @@ void Guide::addCCD(ISD::GDInterface *newCCD)
guiderCombo->addItem(ccd->getDeviceName());
+ /*
+ *
+ * Check if this is necessary to save bandwidth
+ if (guideType == GUIDE_INTERNAL)
+ {
+ // Receive BLOBs from the driver
+ currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_ALSO, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
+ }
+ else
+ // Do NOT Receive BLOBs from the driver
+ currentCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, currentCCD->getDeviceName(), useGuideHead ? "CCD2" : "CCD1");
+
+ */
+
+
//checkCCD(CCDs.count()-1);
//guiderCombo->setCurrentIndex(CCDs.count()-1);
@@ -241,7 +268,6 @@ void Guide::setTelescope(ISD::GDInterface *newTelescope)
currentTelescope = (ISD::Telescope*) newTelescope;
syncTelescopeInfo();
-
}
bool Guide::setCCD(QString device)
@@ -427,8 +453,6 @@ void Guide::updateGuideParams()
//pmath->setGuiderParameters(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
//phd2->setCCDMountParams(ccd_hor_pixel, ccd_ver_pixel, focal_length);
-
-
emit guideChipUpdated(targetChip);
//guider->setTargetChip(targetChip);
@@ -455,7 +479,14 @@ void Guide::addST4(ISD::ST4 *newST4)
ST4List.append(newST4);
+ ST4Combo->blockSignals(true);
ST4Combo->addItem(newST4->getDeviceName());
+ ST4Combo->blockSignals(false);
+
+ ST4Driver=GuideDriver=newST4;
+
+ if (Options::defaultST4Driver().isEmpty() == false)
+ setST4(Options::defaultST4Driver());
}
bool Guide::setST4(QString device)
@@ -470,11 +501,6 @@ bool Guide::setST4(QString device)
return false;
}
-void Guide::setDefaultST4(QString st4)
-{
- Options::setDefaultST4Driver(st4);
-}
-
void Guide::newST4(int index)
{
if (ST4List.empty() || index >= ST4List.count())
@@ -483,6 +509,8 @@ void Guide::newST4(int index)
ST4Driver = ST4List.at(index);
GuideDriver = ST4Driver;
+
+ Options::setDefaultST4Driver(ST4Driver->getDeviceName());
}
void Guide::setAO(ISD::ST4 *newAO)
@@ -509,22 +537,26 @@ bool Guide::capture()
//If calibrating, reset frame
// FIXME
+
+
+ // TODO Check later, we should reset frame somewhere else
/*
if (calibration->getCalibrationStage() == internalCalibration::CAL_CAPTURE_IMAGE)
{
targetChip->resetFrame();
guider->setSubFramed(false);
- }
+ }*/
targetChip->setCaptureMode(FITS_GUIDE);
targetChip->setFrameType(FRAME_LIGHT);
- if (Options::useGuideDarkFrame())
+ if (darkFrameCheck->isChecked())
targetChip->setCaptureFilter(FITS_NONE);
else
targetChip->setCaptureFilter((FITSScale) filterCombo->currentIndex());
- if (guider->isGuiding())
+
+ /*if (guider->isGuiding())
{
if (guider->isRapidGuide() == false)
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
@@ -534,11 +566,25 @@ bool Guide::capture()
}
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
+ targetChip->capture(seqExpose);*/
+
+ switch (state)
+ {
+ case GUIDE_GUIDING:
+ if (Options::rapidGuideEnabled() == false)
+ connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)), Qt::UniqueConnection);
+ targetChip->capture(seqExpose);
+ return true;
+ break;
+
+ default:
+ break;
+ }
+
+ connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
targetChip->capture(seqExpose);
- */
return true;
-
}
void Guide::newFITS(IBLOB *bp)
@@ -575,7 +621,7 @@ void Guide::newFITS(IBLOB *bp)
else
{
//if (calibration->useAutoStar() == false)
- //KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
+ //KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
}
@@ -588,8 +634,6 @@ void Guide::newFITS(IBLOB *bp)
void Guide::setCaptureComplete()
{
- // FIXME
- /*
DarkLibrary::Instance()->disconnect(this);
@@ -612,6 +656,10 @@ void Guide::setCaptureComplete()
FITSData *image_data = targetImage->getImageData();
Q_ASSERT(image_data);
+ // FIXME
+ /*
+
+
pmath->setImageView(targetImage);
guider->setImageView(targetImage);
@@ -912,6 +960,8 @@ void Guide::updateGuideDriver(double delta_ra, double delta_dec)
bool Guide::startCalibration()
{
+ saveSettings();
+
// FIXME
/*
if (Options::useEkosGuider())
@@ -940,6 +990,9 @@ bool Guide::stopCalibration()
bool Guide::startGuiding()
{
+
+ saveSettings();
+
// FIXME
/*
// This will handle both internal and external guiders
@@ -951,7 +1004,7 @@ bool Guide::startGuiding()
return phd2->startGuiding();
*/
-return true;
+ return true;
}
@@ -1022,7 +1075,7 @@ void Guide::setImageFilter(const QString & value)
void Guide::setCalibrationTwoAxis(bool enable)
{
- // calibration->setCalibrationTwoAxis(enable);
+ // calibration->setCalibrationTwoAxis(enable);
}
void Guide::setCalibrationAutoStar(bool enable)
@@ -1037,7 +1090,7 @@ void Guide::setCalibrationAutoSquareSize(bool enable)
void Guide::setCalibrationPulseDuration(int pulseDuration)
{
- // calibration->setCalibrationPulseDuration(pulseDuration);
+ // calibration->setCalibrationPulseDuration(pulseDuration);
}
void Guide::setGuideBoxSizeIndex(int boxSize)
@@ -1341,24 +1394,19 @@ void Guide::onXscaleChanged( int i )
{
int rx, ry;
- driftGraph->get_visible_ranges( &rx, &ry );
- driftGraph->set_visible_ranges( i*driftGraph->get_grid_N(), ry );
+ driftGraphics->getVisibleRanges( &rx, &ry );
+ driftGraphics->setVisibleRanges( i*driftGraphics->getGridN(), ry );
+ driftGraphics->update();
- // refresh if not started
- if( state != GUIDE_GUIDING )
- driftGraph->on_paint();
}
void Guide::onYscaleChanged( int i )
{
int rx, ry;
- driftGraph->get_visible_ranges( &rx, &ry );
- driftGraph->set_visible_ranges( rx, i*driftGraph->get_grid_N() );
-
- // refresh if not started
- if( state != GUIDE_GUIDING )
- driftGraph->on_paint();
+ driftGraphics->getVisibleRanges( &rx, &ry );
+ driftGraphics->setVisibleRanges( rx, i*driftGraphics->getGridN() );
+ driftGraphics->update();
}
@@ -1481,6 +1529,74 @@ void Guide::onRapidGuideChanged(bool enable)
}
+void Guide::loadSettings()
+{
+ // Exposure
+ exposureIN->setValue(Options::guideExposure());
+ // Box Size
+ boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex());
+ // Dark frame?
+ darkFrameCheck->setChecked(Options::guideDarkFrameEnabled());
+ // RA/DEC enabled?
+ checkBox_DirRA->setChecked(Options::rAGuideEnabled());
+ checkBox_DirDEC->setChecked(Options::dECGuideEnabled());
+ // N/S enabled?
+ northControlCheck->setChecked(Options::northDECGuideEnabled());
+ southControlCheck->setChecked(Options::southDECGuideEnabled());
+ // W/E enabled?
+ westControlCheck->setChecked(Options::westRAGuideEnabled());
+ eastControlCheck->setChecked(Options::eastRAGuideEnabled());
+ // PID Control - Propotional Gain
+ spinBox_PropGainRA->setValue(Options::rAPropotionalGain());
+ spinBox_PropGainDEC->setValue(Options::dECPropotionalGain());
+ // PID Control - Integral Gain
+ spinBox_IntGainRA->setValue(Options::rAIntegralGain());
+ spinBox_IntGainDEC->setValue(Options::dECIntegralGain());
+ // PID Control - Derivative Gain
+ spinBox_DerGainRA->setValue(Options::rADerivativeGain());
+ spinBox_DerGainDEC->setValue(Options::dECDerivativeGain());
+ // Max Pulse Duration (ms)
+ spinBox_MaxPulseRA->setValue(Options::rAMaximumPulse());
+ spinBox_MaxPulseDEC->setValue(Options::dECMaximumPulse());
+ // Min Pulse Duration (ms)
+ spinBox_MinPulseRA->setValue(Options::rAMinimumPulse());
+ spinBox_MinPulseDEC->setValue(Options::dECMinimumPulse());
+}
+
+void Guide::saveSettings()
+{
+ // Exposure
+ Options::setGuideExposure(exposureIN->value());
+ // Box Size
+ Options::setGuideSquareSizeIndex(boxSizeCombo->currentIndex());
+ // Dark frame?
+ Options::setGuideDarkFrameEnabled(darkFrameCheck->isChecked());
+ // RA/DEC enabled?
+ Options::setRAGuideEnabled(checkBox_DirRA->isChecked());
+ Options::setDECGuideEnabled(checkBox_DirDEC->isChecked());
+ // N/S enabled?
+ Options::setNorthDECGuideEnabled(northControlCheck->isChecked());
+ Options::setSouthDECGuideEnabled(southControlCheck->isChecked());
+ // W/E enabled?
+ Options::setWestRAGuideEnabled(westControlCheck->isChecked());
+ Options::setEastRAGuideEnabled(eastControlCheck->isChecked());
+ // PID Control - Propotional Gain
+ Options::setRAPropotionalGain(spinBox_PropGainRA->value());
+ Options::setDECPropotionalGain(spinBox_PropGainDEC->value());
+ // PID Control - Integral Gain
+ Options::setRAIntegralGain(spinBox_IntGainRA->value());
+ Options::setDECIntegralGain(spinBox_IntGainDEC->value());
+ // PID Control - Derivative Gain
+ Options::setRADerivativeGain(spinBox_DerGainRA->value());
+ Options::setDECDerivativeGain(spinBox_DerGainDEC->value());
+ // Max Pulse Duration (ms)
+ Options::setRAMaximumPulse(spinBox_MaxPulseRA->value());
+ Options::setDECMaximumPulse(spinBox_MaxPulseDEC->value());
+ // Min Pulse Duration (ms)
+ Options::setRAMinimumPulse(spinBox_MinPulseRA->value());
+ Options::setDECMinimumPulse(spinBox_MinPulseDEC->value());
+}
+
}
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 9bd909d..77910cf 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -278,10 +278,7 @@ protected slots:
*/
void processCCDNumber(INumberVectorProperty *nvp);
- void saveDefaultGuideExposure();
-
- void setDefaultCCD(QString ccd);
- void setDefaultST4(QString st4);
+ void saveDefaultGuideExposure();
void updateTrackingBoxSize(int currentIndex);
@@ -311,9 +308,26 @@ signals:
void guideChipUpdated(ISD::CCDChip*);
private:
+ /**
+ * @brief updateGuideParams Update the guider and frame parameters due to any changes in the mount and/or ccd frame
+ */
void updateGuideParams();
+
+ /**
+ * @brief syncTrackingBoxPosition Sync the tracking box to the current selected star center
+ */
void syncTrackingBoxPosition();
+ /**
+ * @brief loadSettings Loads and applies all settings from KStars options
+ */
+ void loadSettings();
+
+ /**
+ * @brief saveSettings Saves all current settings into KStars options
+ */
+ void saveSettings();
+
// Devices
ISD::CCD *currentCCD;
ISD::Telescope *currentTelescope;
@@ -342,7 +356,7 @@ private:
GuideState state;
// Drift Graph
- ScrollGraph *driftGraph;
+ //ScrollGraph *driftGraph;
// Log
QStringList logText;
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index 13326b1..03d12a1 100644
--- a/kstars/ekos/guide/guide.ui
+++ b/kstars/ekos/guide/guide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>696</width>
- <height>508</height>
+ <width>702</width>
+ <height>515</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -607,7 +607,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>458</width>
+ <width>462</width>
<height>238</height>
</rect>
</property>
@@ -638,44 +638,62 @@
<number>3</number>
</property>
<item>
- <widget class="QFrame" name="frame_Graph">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>200</width>
- <height>200</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="sizeIncrement">
- <size>
- <width>50</width>
- <height>50</height>
- </size>
- </property>
- <property name="baseSize">
- <size>
- <width>300</width>
- <height>300</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <property name="spacing">
+ <number>0</number>
</property>
- </widget>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>1</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="ScrollGraph" name="driftGraphics" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>1</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
@@ -703,9 +721,15 @@
</item>
<item>
<widget class="QCheckBox" name="RADriftEnableC">
+ <property name="toolTip">
+ <string>Draw RA deviation</string>
+ </property>
<property name="text">
<string>RA</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -729,9 +753,15 @@
</item>
<item>
<widget class="QCheckBox" name="DEDriftEnableC">
+ <property name="toolTip">
+ <string>Draw DEC Deviation</string>
+ </property>
<property name="text">
<string>DE</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -1132,6 +1162,12 @@
<header>fitsviewer/fitsview.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>ScrollGraph</class>
+ <extends>QWidget</extends>
+ <header>ekos/guide/scroll_graph.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/kstars/ekos/guide/opsguide.ui b/kstars/ekos/guide/opsguide.ui
index 35dc8a0..0f319f5 100644
--- a/kstars/ekos/guide/opsguide.ui
+++ b/kstars/ekos/guide/opsguide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>269</width>
- <height>207</height>
+ <width>275</width>
+ <height>223</height>
</rect>
</property>
<property name="windowTitle">
@@ -177,11 +177,6 @@
<string>No Threshold</string>
</property>
</item>
- <item>
- <property name="text">
- <string/>
- </property>
- </item>
</widget>
</item>
<item row="1" column="1">
diff --git a/kstars/ekos/guide/scroll_graph.cpp b/kstars/ekos/guide/scroll_graph.cpp
index 4deba23..a9068a6 100644
--- a/kstars/ekos/guide/scroll_graph.cpp
+++ b/kstars/ekos/guide/scroll_graph.cpp
@@ -28,132 +28,144 @@ const uint8_t DEF_GRID_FONT_COLOR[3] = {0, 255, 128};
const uint8_t DEF_SQR_OVL_COLOR[3] = {0, 255, 0};
-ScrollGraph::ScrollGraph( QWidget *own, int client_width, int client_height )
+ScrollGraph::ScrollGraph(QWidget *parent) : QWidget(parent)
{
- owner = own;
+ grid_N = 6;
- client_rect_wd = client_width;
- client_rect_ht = client_height;
+ RAEnabled=DEEnabled=true;
- buffer = new QImage( client_rect_wd, client_rect_ht, QImage::Format_RGB32 );
+ data_cnt = 10*grid_N*10;
+ data.line[ RA_LINE ] = new double[ data_cnt ];
+ data.line[ DEC_LINE ] = new double[ data_cnt ];
+ resetData();
- vis_range_x = client_rect_wd; // horizontal range in ticks
- vis_range_y = 100; // whole visible vertical range in arcsecs!
-
- grid_N = 6;
-
- data_cnt = 10*grid_N*10;
- data.line[ RA_LINE ] = new double[ data_cnt ];
- data.line[ DEC_LINE ] = new double[ data_cnt ];
- reset_data();
-
- //graphics...
- pen.setStyle( Qt::SolidLine );
- pen.setWidth(1);
- brush.setStyle(Qt::SolidPattern);
+ //graphics...
+ pen.setStyle( Qt::SolidLine );
+ pen.setWidth(1);
+ brush.setStyle(Qt::SolidPattern);
RA_COLOR = QColor(KStars::Instance()->data()->colorScheme()->colorNamed( "RAGuideError" ));
DEC_COLOR = QColor(KStars::Instance()->data()->colorScheme()->colorNamed( "DEGuideError" ));
- GRID_COLOR = QColor( DEF_GRID_COLOR[0], DEF_GRID_COLOR[1], DEF_GRID_COLOR[2] );
- BKGD_COLOR = QColor( DEF_BKGD_COLOR[0], DEF_BKGD_COLOR[1], DEF_BKGD_COLOR[2] );
- WHITE_COLOR = QColor( DEF_WHITE_COLOR[0], DEF_WHITE_COLOR[1], DEF_WHITE_COLOR[2] );
- GRID_FONT_COLOR = QColor( DEF_GRID_FONT_COLOR[0], DEF_GRID_FONT_COLOR[1], DEF_GRID_FONT_COLOR[2] );
- brush.setColor( BKGD_COLOR );
+ GRID_COLOR = QColor( DEF_GRID_COLOR[0], DEF_GRID_COLOR[1], DEF_GRID_COLOR[2] );
+ BKGD_COLOR = QColor( DEF_BKGD_COLOR[0], DEF_BKGD_COLOR[1], DEF_BKGD_COLOR[2] );
+ WHITE_COLOR = QColor( DEF_WHITE_COLOR[0], DEF_WHITE_COLOR[1], DEF_WHITE_COLOR[2] );
+ GRID_FONT_COLOR = QColor( DEF_GRID_FONT_COLOR[0], DEF_GRID_FONT_COLOR[1], DEF_GRID_FONT_COLOR[2] );
+ brush.setColor( BKGD_COLOR );
+
+}
+ScrollGraph::~ScrollGraph()
+{
+ delete [] data.line[ RA_LINE ];
+ delete [] data.line[ DEC_LINE ];
+}
+
+void ScrollGraph::setSize(int w, int h)
+{
+ client_rect_wd = w;
+ client_rect_ht = h;
- // init...
- init_render_vars();
+ //buffer = new QImage( client_rect_wd, client_rect_ht, QImage::Format_RGB32 );
- need_refresh = true;
+ vis_range_x = client_rect_wd; // horizontal range in ticks
+ vis_range_y = 100; // whole visible vertical range in arcsecs!
+ // init...
+ initRenderVariables();
+ need_refresh = true;
}
-ScrollGraph::~ScrollGraph()
+void ScrollGraph::resizeEvent(QResizeEvent *event)
{
- delete buffer;
- delete [] data.line[ RA_LINE ];
- delete [] data.line[ DEC_LINE ];
+ if (event->size().width() >= data_cnt)
+ {
+ event->ignore();
+ return;
+ }
+
+ setSize(event->size().width(), event->size().height());
+ setVisibleRanges(event->size().width(), 60);
+ update();
}
-
-void ScrollGraph::init_render_vars( void )
+void ScrollGraph::initRenderVariables( void )
{
- half_buffer_size_wd = client_rect_wd / 2;
- half_buffer_size_ht = client_rect_ht / 2;
+ half_buffer_size_wd = client_rect_wd / 2;
+ half_buffer_size_ht = client_rect_ht / 2;
- grid_view_step_x = (double)client_rect_wd / (double)grid_N;
- grid_view_step_y = (double)client_rect_ht / (double)grid_N;
+ grid_view_step_x = (double)client_rect_wd / (double)grid_N;
+ grid_view_step_y = (double)client_rect_ht / (double)grid_N;
- grid_step_x = (double)vis_range_x / (double)grid_N;
- grid_step_y = (double)vis_range_y / (double)grid_N;
+ grid_step_x = (double)vis_range_x / (double)grid_N;
+ grid_step_y = (double)vis_range_y / (double)grid_N;
- half_vis_range_x = vis_range_x / 2;
- half_vis_range_y = vis_range_y / 2;
+ half_vis_range_x = vis_range_x / 2;
+ half_vis_range_y = vis_range_y / 2;
}
-void ScrollGraph::set_visible_ranges( int rx, int ry )
+void ScrollGraph::setVisibleRanges( int rx, int ry )
{
- if( rx >= 10*grid_N && rx < (double)data_cnt )
- {
- if( vis_range_x != rx )
- need_refresh = true;
- vis_range_x = rx;
- }
- else
- {
- qWarning() << "set_visible_ranges: must be >= " << 10*grid_N << " and < " << data_cnt;
- return;
- }
-
- if( ry >= 5*grid_N )
- {
- if( vis_range_x != ry )
- need_refresh = true;
- vis_range_y = ry;
- }
- else
- {
- qWarning() << "set_visible_ranges: must be >= " << 5*grid_N << " and < " << data_cnt;
- return;
- }
-
- init_render_vars();
+ if( rx >= 10*grid_N && rx < (double)data_cnt )
+ {
+ if( vis_range_x != rx )
+ need_refresh = true;
+ vis_range_x = rx;
+ }
+ else
+ {
+ qWarning() << "set_visible_ranges: must be >= " << 10*grid_N << " and < " << data_cnt;
+ return;
+ }
+
+ if( ry >= 5*grid_N )
+ {
+ if( vis_range_x != ry )
+ need_refresh = true;
+ vis_range_y = ry;
+ }
+ else
+ {
+ qWarning() << "set_visible_ranges: must be >= " << 5*grid_N << " and < " << data_cnt;
+ return;
+ }
+
+ initRenderVariables();
}
-void ScrollGraph::get_visible_ranges( int *rx, int *ry )
+void ScrollGraph::getVisibleRanges( int *rx, int *ry )
{
- *rx = vis_range_x;
- *ry = vis_range_y;
+ *rx = vis_range_x;
+ *ry = vis_range_y;
}
-int ScrollGraph::get_grid_N( void )
+int ScrollGraph::getGridN( void )
{
- return grid_N;
+ return grid_N;
}
-void ScrollGraph::reset_view( void )
+void ScrollGraph::resetView( void )
{
- set_visible_ranges( client_rect_wd, 100 );
+ setVisibleRanges( client_rect_wd, 100 );
- init_render_vars();
+ initRenderVariables();
need_refresh = true;
}
-void ScrollGraph::reset_data( void )
+void ScrollGraph::resetData( void )
{
- memset( data.line[RA_LINE], 0, sizeof(double)*data_cnt );
- memset( data.line[DEC_LINE], 0, sizeof(double)*data_cnt );
- data_idx = 0;
+ memset( data.line[RA_LINE], 0, sizeof(double)*data_cnt );
+ memset( data.line[DEC_LINE], 0, sizeof(double)*data_cnt );
+ data_idx = 0;
RA_COLOR = QColor(KStars::Instance()->data()->colorScheme()->colorNamed( "RAGuideError" ));
DEC_COLOR = QColor(KStars::Instance()->data()->colorScheme()->colorNamed( "DEGuideError" ));
@@ -161,26 +173,10 @@ void ScrollGraph::reset_data( void )
-QImage *ScrollGraph::get_buffer( void )
-{
- return buffer;
-}
-
-
-void ScrollGraph::get_screen_size( int *sx, int *sy )
-{
- *sx = client_rect_wd;
- *sy = client_rect_ht;
-}
-
-
-void ScrollGraph::on_paint( void )
+void ScrollGraph::getScreenSize( int *sx, int *sy )
{
- canvas.begin( buffer );
-
- refresh();
-
- canvas.end();
+ *sx = client_rect_wd;
+ *sy = client_rect_ht;
}
@@ -189,222 +185,228 @@ void ScrollGraph::on_paint( void )
* Main Drawing function
*
**************/
-void ScrollGraph::refresh( void )
+void ScrollGraph::paintEvent( QPaintEvent * )
{
- int i, j, k;
- double kx, ky, step;
- double *data_ptr;
- int start_idx;
- int /*band1_wd,*/ band1_start, band1_end;
- int band2_wd, band2_start, band2_end;
- int x, y;
- int px, py;
-
- if( !need_refresh )
- return;
-
- font_ht_k = canvas.fontMetrics().ascent();
-
- // fill background
- canvas.fillRect( 0, 0, client_rect_wd, client_rect_ht, brush);
-
- start_idx = (data_idx + data_cnt - vis_range_x) % data_cnt;
- // split visible region in 2 ranges
- if( data_idx > start_idx ) // only 1 band
- {
- //band1_wd = data_idx - start_idx; // = vis_range_x
- band1_start = start_idx;
- band1_end = data_idx; // -1;
- band2_start = band2_end = band2_wd = 0;
- }
- else // 2 bands
- {
- //band1_wd = data_idx;
- band1_start = 0;
- band1_end = data_idx; //-1;
-
- band2_wd = data_cnt - start_idx;
- band2_start = start_idx;
- band2_end = data_cnt-1;
- }
-
- // Rasterizing coefficients
- kx = (double)client_rect_wd / vis_range_x;
- ky = (double)client_rect_ht / vis_range_y;
-
- draw_grid( kx, ky );
-
- // analize kx and select optimal algorithm
- if( client_rect_wd <= vis_range_x )
- {
- step = 1.0 / kx;
-
- for( k = 0;k < 2;k++ )
- {
- data_ptr = data.line[k];
-
- if( k == RA_LINE )
- pen.setColor( RA_COLOR );
- else
- pen.setColor( DEC_COLOR );
-
- canvas.setPen( pen );
-
- // process band 1
- px = client_rect_wd;;
- py = half_buffer_size_ht - (int)(data_ptr[band1_end] * ky);
-
- x = client_rect_wd;
+ QPainter p;
+ p.begin( this );
+ p.setRenderHint( QPainter::Antialiasing, true );
+
+ int i, j, k;
+ double kx, ky, step;
+ double *data_ptr;
+ int start_idx;
+ int /*band1_wd,*/ band1_start, band1_end;
+ int band2_wd, band2_start, band2_end;
+ int x, y;
+ int px, py;
+
+ font_ht_k = p.fontMetrics().ascent();
+
+ // fill background
+ p.fillRect( 0, 0, client_rect_wd, client_rect_ht, brush);
+
+ start_idx = (data_idx + data_cnt - vis_range_x) % data_cnt;
+ // split visible region in 2 ranges
+ if( data_idx > start_idx ) // only 1 band
+ {
+ //band1_wd = data_idx - start_idx; // = vis_range_x
+ band1_start = start_idx;
+ band1_end = data_idx; // -1;
+ band2_start = band2_end = band2_wd = 0;
+ }
+ else // 2 bands
+ {
+ //band1_wd = data_idx;
+ band1_start = 0;
+ band1_end = data_idx; //-1;
+
+ band2_wd = data_cnt - start_idx;
+ band2_start = start_idx;
+ band2_end = data_cnt-1;
+ }
+
+ // Rasterizing coefficients
+ kx = (double)client_rect_wd / vis_range_x;
+ ky = (double)client_rect_ht / vis_range_y;
+
+ drawGrid(&p, kx, ky );
+
+ // analize kx and select optimal algorithm
+ if( client_rect_wd <= vis_range_x )
+ {
+ step = 1.0 / kx;
+
+ for( k = 0;k < 2;k++ )
+ {
+ if (k == 0 && RAEnabled == false)
+ continue;
+ else if (k==1 && DEEnabled == false)
+ continue;
+
+ data_ptr = data.line[k];
+
+ if( k == RA_LINE )
+ pen.setColor( RA_COLOR );
+ else
+ pen.setColor( DEC_COLOR );
+
+ p.setPen( pen );
+
+ // process band 1
+ px = client_rect_wd;;
+ py = half_buffer_size_ht - (int)(data_ptr[band1_end] * ky);
+
+ x = client_rect_wd;
+
+ for( i = band1_end, j = 0;i >= band1_start; )
+ {
+ y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
+ x--;
+
+ p.drawLine( px, py, x, y );
+
+ px = x;
+ py = y;
+
+ //------------------------------------------
+ ++j;
+ i = band1_end - (int)((double)j*step);
+ }
+
+ // process band 2
+ for( i = band2_end, j = 0;i > band2_start; )
+ {
+ y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
+ x--;
+
+ p.drawLine( px, py, x, y );
+
+ px = x;
+ py = y;
+
+ //------------------------------------------
+ ++j;
+ i = band2_end - (int)((double)j*step);
+ }
+ }
+ }
+ else
+ {
+ step = kx;
- for( i = band1_end, j = 0;i >= band1_start; )
- {
- y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
- x--;
+ for( k = 0;k < 2;k++ )
+ {
+ data_ptr = data.line[k];
- canvas.drawLine( px, py, x, y );
+ if( k == RA_LINE )
+ pen.setColor( RA_COLOR );
+ else
+ pen.setColor( DEC_COLOR );
- px = x;
- py = y;
+ p.setPen( pen );
- //------------------------------------------
- ++j;
- i = band1_end - (int)((double)j*step);
- }
+ // process band 1
+ px = client_rect_wd;
+ py = half_buffer_size_ht - (int)(data_ptr[band1_end] * ky);
- // process band 2
- for( i = band2_end, j = 0;i > band2_start; )
- {
- y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
- x--;
+ x = client_rect_wd;
- canvas.drawLine( px, py, x, y );
+ for( i = band1_end, j = 0;i >= band1_start;i--, ++j )
+ {
+ y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
+ x = client_rect_wd - (int)((double)j*step) - 1;
- px = x;
- py = y;
+ p.drawLine( px, py, x, y );
- //------------------------------------------
- ++j;
- i = band2_end - (int)((double)j*step);
- }
- }
- }
- else
- {
- step = kx;
+ px = x;
+ py = y;
- for( k = 0;k < 2;k++ )
- {
- data_ptr = data.line[k];
+ }
- if( k == RA_LINE )
- pen.setColor( RA_COLOR );
- else
- pen.setColor( DEC_COLOR );
- canvas.setPen( pen );
+ // process band 2
+ for( i = band2_end;i > band2_start;i--, ++j )
+ {
+ y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
+ x = client_rect_wd - (int)((double)j*step) - 1;
- // process band 1
- px = client_rect_wd;
- py = half_buffer_size_ht - (int)(data_ptr[band1_end] * ky);
+ p.drawLine( px, py, x, y );
- x = client_rect_wd;
+ px = x;
+ py = y;
+ }
- for( i = band1_end, j = 0;i >= band1_start;i--, ++j )
- {
- y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
- x = client_rect_wd - (int)((double)j*step) - 1;
+ }
+ }
- canvas.drawLine( px, py, x, y );
-
- px = x;
- py = y;
-
- }
-
-
- // process band 2
- for( i = band2_end;i > band2_start;i--, ++j )
- {
- y = half_buffer_size_ht - (int)(data_ptr[i] * ky);
- x = client_rect_wd - (int)((double)j*step) - 1;
-
- canvas.drawLine( px, py, x, y );
-
- px = x;
- py = y;
- }
-
- }
- }
-
- need_refresh = false;
+ need_refresh = false;
}
-void ScrollGraph::draw_grid( double kx, double )
+void ScrollGraph::drawGrid(QPainter *p, double kx, double )
{
- int i, x, sx, y;
- int grid_column, val;
- QString str;
-
- pen.setColor( GRID_COLOR );
- canvas.setPen( pen );
-
- grid_column = data_idx / (int)grid_step_x * (int)grid_step_x;
- sx = client_rect_wd - (double)(data_idx % (int)grid_step_x)*kx;
-
- for( i = 0;i < grid_N;++i )
- {
- x = sx - (double)i*grid_view_step_x;
- y = (double)i*grid_view_step_y;
-
- canvas.drawLine( x, 0, x, client_rect_ht );
-
- if( i == grid_N/2 )
- {
- pen.setColor( WHITE_COLOR );
- canvas.setPen( pen );
- canvas.drawLine( 0, y, client_rect_wd, y );
- pen.setColor( GRID_COLOR );
- canvas.setPen( pen );
- }
- else
- canvas.drawLine( 0, y, client_rect_wd, y );
- }
-
- // draw all digits
- pen.setColor( GRID_FONT_COLOR );
- canvas.setPen( pen );
- for( i = 0;i < grid_N;++i )
- {
- x = sx - (double)i*grid_view_step_x;
- y = (double)i*grid_view_step_y;
-
- if( (val = grid_column - i*(int)grid_step_x) >= 0 )
- {
- str.setNum( val );
- canvas.drawText( x, half_buffer_size_ht + font_ht_k, str );
- }
- str.setNum( (int)(half_vis_range_y - grid_step_y*i) );
- canvas.drawText( 2, y + font_ht_k, str );
- }
+ int i, x, sx, y;
+ int grid_column, val;
+ QString str;
+
+ pen.setColor( GRID_COLOR );
+ p->setPen( pen );
+
+ grid_column = data_idx / (int)grid_step_x * (int)grid_step_x;
+ sx = client_rect_wd - (double)(data_idx % (int)grid_step_x)*kx;
+
+ for( i = 0;i < grid_N;++i )
+ {
+ x = sx - (double)i*grid_view_step_x;
+ y = (double)i*grid_view_step_y;
+
+ p->drawLine( x, 0, x, client_rect_ht );
+
+ if( i == grid_N/2 )
+ {
+ pen.setColor( WHITE_COLOR );
+ p->setPen( pen );
+ p->drawLine( 0, y, client_rect_wd, y );
+ pen.setColor( GRID_COLOR );
+ p->setPen( pen );
+ }
+ else
+ p->drawLine( 0, y, client_rect_wd, y );
+ }
+
+ // draw all digits
+ pen.setColor( GRID_FONT_COLOR );
+ p->setPen( pen );
+ for( i = 0;i < grid_N;++i )
+ {
+ x = sx - (double)i*grid_view_step_x;
+ y = (double)i*grid_view_step_y;
+
+ if( (val = grid_column - i*(int)grid_step_x) >= 0 )
+ {
+ str.setNum( val );
+ p->drawText( x, half_buffer_size_ht + font_ht_k, str );
+ }
+ str.setNum( (int)(half_vis_range_y - grid_step_y*i) );
+ p->drawText( 2, y + font_ht_k, str );
+ }
}
-bool ScrollGraph::add_point( double ra, double dec )
+bool ScrollGraph::addPoint( double ra, double dec )
{
- data_idx++;
+ data_idx++;
- if( data_idx == data_cnt-1 )
- data_idx = 0;
+ if( data_idx == data_cnt-1 )
+ data_idx = 0;
- data.line[ RA_LINE ][ data_idx ] = ra;
- data.line[ DEC_LINE ][ data_idx ] = dec;
+ data.line[ RA_LINE ][ data_idx ] = ra;
+ data.line[ DEC_LINE ][ data_idx ] = dec;
- need_refresh = true;
+ need_refresh = true;
- return true;
+ return true;
}
diff --git a/kstars/ekos/guide/scroll_graph.h b/kstars/ekos/guide/scroll_graph.h
index e1f375c..a1d1c76 100644
--- a/kstars/ekos/guide/scroll_graph.h
+++ b/kstars/ekos/guide/scroll_graph.h
@@ -23,60 +23,63 @@
typedef struct
{
- double *line[2];
+ double *line[2];
}delta_data_t;
-class ScrollGraph
+class ScrollGraph : public QWidget
{
public:
- ScrollGraph( QWidget *own, int client_width, int client_height );
+ ScrollGraph(QWidget *parent);
virtual ~ScrollGraph();
-
- QImage *get_buffer( void );
- bool add_point( double ra, double dec );
- void set_visible_ranges( int rx, int ry );
- void get_visible_ranges( int *rx, int *ry );
- int get_grid_N( void );
- void reset_view( void );
- void reset_data( void );
- void on_paint( void );
- void get_screen_size( int *sx, int *sy );
-
-
+
+ //QImage *get_buffer( void );
+ void setSize(int w, int h);
+ bool addPoint( double ra, double dec );
+ void setVisibleRanges( int rx, int ry );
+ void getVisibleRanges( int *rx, int *ry );
+ int getGridN( void );
+ void resetView( void );
+ void resetData( void );
+ void getScreenSize( int *sx, int *sy );
+ void setRAEnabled(bool enable) { RAEnabled = enable; }
+ void setDEEnabled(bool enable) { DEEnabled = enable; }
+
+protected:
+ void paintEvent( QPaintEvent * );
+ void resizeEvent(QResizeEvent *event);
+
private:
- // view
- QWidget *owner;
- QImage *buffer;
- QPainter canvas;
- QColor BKGD_COLOR, RA_COLOR, DEC_COLOR, GRID_COLOR, WHITE_COLOR, GRID_FONT_COLOR;
- QPen pen;
- QBrush brush;
- int half_buffer_size_wd;
- int half_buffer_size_ht;
- int client_rect_wd;
- int client_rect_ht;
- bool need_refresh;
-
- // data
- delta_data_t data;
- int data_cnt;
- int data_idx;
- int grid_N;
-
- // grid vars...
- double grid_step_x, grid_step_y, grid_view_step_x, grid_view_step_y;
- int font_ht_k;
-
- // control
- int vis_range_x, vis_range_y;
- int half_vis_range_x, half_vis_range_y;
-
- void refresh( void );
- void draw_grid( double kx, double ky );
- void init_render_vars( void );
-
+ QColor BKGD_COLOR, RA_COLOR, DEC_COLOR, GRID_COLOR, WHITE_COLOR, GRID_FONT_COLOR;
+ QPen pen;
+ QBrush brush;
+ int half_buffer_size_wd;
+ int half_buffer_size_ht;
+ int client_rect_wd;
+ int client_rect_ht;
+ bool need_refresh;
+
+ // data
+ delta_data_t data;
+ int data_cnt;
+ int data_idx;
+ int grid_N;
+
+ // grid vars...
+ double grid_step_x, grid_step_y, grid_view_step_x, grid_view_step_y;
+ int font_ht_k;
+
+ // control
+ int vis_range_x, vis_range_y;
+ int half_vis_range_x, half_vis_range_y;
+
+ bool RAEnabled, DEEnabled;
+
+ void refresh( void );
+ void drawGrid(QPainter *p, double kx, double ky );
+ void initRenderVariables( void );
+
};
#endif /*ScrollGraph_H_*/
diff --git a/kstars/indi/indiccd.cpp b/kstars/indi/indiccd.cpp
index ab19458..fb1d658 100644
--- a/kstars/indi/indiccd.cpp
+++ b/kstars/indi/indiccd.cpp
@@ -98,7 +98,6 @@ FITSView * CCDChip::getImage(FITSMode imageType)
void CCDChip::setImage(FITSView *image, FITSMode imageType)
{
-
switch (imageType)
{
case FITS_NORMAL: