Oculars.cpp   Oculars.cpp 
skipping to change at line 40 skipping to change at line 40
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QAction> #include <QAction>
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QtNetwork> #include <QtNetwork>
#include <QPixmap> #include <QPixmap>
#include <QSignalMapper>
#include <cmath> #include <cmath>
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/glu.h> /* Header File For The GLU Library */ #include <OpenGL/glu.h> /* Header File For The GLU Library */
#else #else
#include <GL/glu.h> /* Header File For The GLU Library */ #include <GL/glu.h> /* Header File For The GLU Library */
#endif #endif
static QSettings *settings; //!< The settings as read in from the ini file. static QSettings *settings; //!< The settings as read in from the ini file.
skipping to change at line 91 skipping to change at line 93
Q_EXPORT_PLUGIN2(Oculars, OcularsStelPluginInterface) Q_EXPORT_PLUGIN2(Oculars, OcularsStelPluginInterface)
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Instance Methods #pragma mark Instance Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
Oculars::Oculars() : pxmapGlow(NULL), pxmapOnIcon(NULL), pxmapOffIcon(NULL) , toolbarButton(NULL) Oculars::Oculars() : pxmapGlow(NULL), pxmapOnIcon(NULL), pxmapOffIcon(NULL) , toolbarButton(NULL)
{ {
flagShowCCD = false;
flagShowOculars = false; flagShowOculars = false;
flagShowCrosshairs = false; flagShowCrosshairs = false;
flagShowTelrad = false; flagShowTelrad = false;
ready = false; ready = false;
requireSelection = true;
useMaxEyepieceAngle = true; useMaxEyepieceAngle = true;
visible = false;
font.setPixelSize(14); font.setPixelSize(14);
maxEyepieceAngle = 0.0; maxEyepieceAngle = 0.0;
ccds = QList<CCD *>(); ccds = QList<CCD *>();
oculars = QList<Ocular *>(); oculars = QList<Ocular *>();
telescopes = QList<Telescope *>(); telescopes = QList<Telescope *>();
ccdRotationSignalMapper = new QSignalMapper(this);
ccdsSignalMapper = new QSignalMapper(this);
ocularsSignalMapper = new QSignalMapper(this);
telescopesSignalMapper = new QSignalMapper(this);
selectedCCDIndex = -1; selectedCCDIndex = -1;
selectedOcularIndex = -1; selectedOcularIndex = -1;
selectedTelescopeIndex = -1; selectedTelescopeIndex = -1;
noEntitiesLabelID = -1;
usageMessageLabelID = -1; usageMessageLabelID = -1;
setObjectName("Oculars"); setObjectName("Oculars");
} }
Oculars::~Oculars() Oculars::~Oculars()
{ {
delete ocularDialog; delete ocularDialog;
ocularDialog = NULL; ocularDialog = NULL;
} }
QSettings* Oculars::appSettings()
{
return settings;
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark StelModule Methods #pragma mark StelModule Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
bool Oculars::configureGui(bool show) bool Oculars::configureGui(bool show)
{ {
if (show) if (show) {
{ ocularDialog->setVisible(true);
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance()
.getGui());
Q_ASSERT(gui);
gui->getGuiActions("actionShow_Ocular_Window")->setChecked(t
rue);
} }
return ready; return ready;
} }
void Oculars::deinit() void Oculars::deinit()
{ {
// update the ini file. // update the ini file.
settings->remove("ccd"); settings->remove("ccd");
settings->remove("ocular"); settings->remove("ocular");
skipping to change at line 165 skipping to change at line 173
settings->setValue(prefix + "pixel_height", ccd->pixelWidth( )); settings->setValue(prefix + "pixel_height", ccd->pixelWidth( ));
index++; index++;
} }
index = 0; index = 0;
foreach(Ocular* ocular, oculars) { foreach(Ocular* ocular, oculars) {
QString prefix = "ocular/" + QVariant(index).toString() + "/ "; QString prefix = "ocular/" + QVariant(index).toString() + "/ ";
settings->setValue(prefix + "name", ocular->name()); settings->setValue(prefix + "name", ocular->name());
settings->setValue(prefix + "afov", ocular->appearentFOV()); settings->setValue(prefix + "afov", ocular->appearentFOV());
settings->setValue(prefix + "efl", ocular->effectiveFocalLen gth()); settings->setValue(prefix + "efl", ocular->effectiveFocalLen gth());
settings->setValue(prefix + "fieldStop", ocular->fieldStop() ); settings->setValue(prefix + "fieldStop", ocular->fieldStop() );
settings->setValue(prefix + "binoculars", ocular->isBinocula rs());
index++; index++;
} }
index = 0; index = 0;
foreach(Telescope* telescope, telescopes){ foreach(Telescope* telescope, telescopes){
QString prefix = "telescope/" + QVariant(index).toString() + "/"; QString prefix = "telescope/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", telescope->name()); settings->setValue(prefix + "name", telescope->name());
settings->setValue(prefix + "focalLength", telescope->focalL ength()); settings->setValue(prefix + "focalLength", telescope->focalL ength());
settings->setValue(prefix + "diameter", telescope->diameter( )); settings->setValue(prefix + "diameter", telescope->diameter( ));
settings->setValue(prefix + "hFlip", telescope->isHFlipped() ); settings->setValue(prefix + "hFlip", telescope->isHFlipped() );
settings->setValue(prefix + "vFlip", telescope->isVFlipped() ); settings->setValue(prefix + "vFlip", telescope->isVFlipped() );
skipping to change at line 187 skipping to change at line 196
settings->setValue("ocular_count", oculars.count()); settings->setValue("ocular_count", oculars.count());
settings->setValue("telescope_count", telescopes.count()); settings->setValue("telescope_count", telescopes.count());
settings->setValue("ccd_count", ccds.count()); settings->setValue("ccd_count", ccds.count());
settings->sync(); settings->sync();
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void Oculars::draw(StelCore* core) void Oculars::draw(StelCore* core)
{ {
if (flagShowTelrad) { if (flagShowTelrad) {
drawTelrad(); paintTelrad();
} } else if (flagShowOculars){
if (flagShowOculars){
// Insure there is a selected ocular & telescope // Insure there is a selected ocular & telescope
if (selectedCCDIndex > ccds.count()) { if (selectedCCDIndex > ccds.count()) {
qWarning() << "Oculars: the selected sensor index of qWarning() << "Oculars: the selected sensor index of
" << selectedCCDIndex << " is greater than the sensor count of " "
<< selectedCCDIndex << " i
s greater than the sensor count of "
<< ccds.count() << ". Module disabled!"; << ccds.count() << ". Module disabled!";
ready = false; ready = false;
} }
if (selectedOcularIndex > oculars.count()) { if (selectedOcularIndex > oculars.count()) {
qWarning() << "Oculars: the selected ocular index of qWarning() << "Oculars: the selected ocular index of
" << selectedOcularIndex << " is greater than the ocular count of " "
<< selectedOcularIndex <<
" is greater than the ocular count of "
<< oculars.count() << ". Module disabled!"; << oculars.count() << ". Module disabled!";
ready = false; ready = false;
} }
else if (selectedTelescopeIndex > telescopes.count()) { else if (selectedTelescopeIndex > telescopes.count()) {
qWarning() << "Oculars: the selected telescope index qWarning() << "Oculars: the selected telescope index
of " << selectedTelescopeIndex << " is greater than the telescope count of of "
" << selectedTelescopeIndex
<< " is greater than the telescope count of "
<< telescopes.count() << ". Module disabled!"; << telescopes.count() << ". Module disabled!";
ready = false; ready = false;
} }
if (ready) { if (ready) {
paintMask(); if (selectedOcularIndex > -1) {
if (flagShowCrosshairs) { paintOcularMask();
drawCrosshairs(); if (flagShowCrosshairs) {
paintCrosshairs();
}
} }
// Paint the information in the upper-right hand cor ner // Paint the information in the upper-right hand cor ner
paintText(core); paintText(core);
} }
newInstrument = false; // Now that it's been drawn once } else if (flagShowCCD) {
paintCCDBounds();
// Paint the information in the upper-right hand corner
paintText(core);
} }
} }
//! Determine which "layer" the plagin's drawing will happen on. //! Determine which "layer" the plagin's drawing will happen on.
double Oculars::getCallOrder(StelModuleActionName actionName) const double Oculars::getCallOrder(StelModuleActionName actionName) const
{ {
// TODO; this really doesn't seem to have any effect. I've tried ev erything from -100 to +100, // TODO; this really doesn't seem to have any effect. I've tried ev erything from -100 to +100,
// and a calculated value. It all seems to work the sa me regardless. // and a calculated value. It all seems to work the sa me regardless.
double order = 1000.0; double order = 1000.0;
if (actionName==StelModule::ActionHandleKeys || actionName==StelModu le::ActionHandleMouseMoves) if (actionName==StelModule::ActionHandleKeys || actionName==StelModu le::ActionHandleMouseMoves)
{ {
skipping to change at line 254 skipping to change at line 269
pluginStyle.qtStyleSheet.append(nightStyleSheet); pluginStyle.qtStyleSheet.append(nightStyleSheet);
} }
return pluginStyle; return pluginStyle;
} }
void Oculars::handleMouseClicks(class QMouseEvent* event) void Oculars::handleMouseClicks(class QMouseEvent* event)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()){ if (StelApp::getInstance().getStelObjectMgr().getWasSelected()){
LabelMgr *labelManager = GETSTELMODULE(LabelMgr); if (flagShowOculars) {
if (flagShowOculars)
{
// center the selected object in the ocular, and tra ck. // center the selected object in the ocular, and tra ck.
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
} } else {
else
{
// remove the usage label if it is being displayed. // remove the usage label if it is being displayed.
if (usageMessageLabelID > -1) if (usageMessageLabelID > -1) {
{ LabelMgr *labelManager = GETSTELMODULE(Label
Mgr);
labelManager->setLabelShow(usageMessageLabel ID, false); labelManager->setLabelShow(usageMessageLabel ID, false);
labelManager->deleteLabel(usageMessageLabelI D); labelManager->deleteLabel(usageMessageLabelI D);
usageMessageLabelID = -1; usageMessageLabelID = -1;
} }
} }
} } else if(flagShowOculars) {
else if(flagShowOculars) //TODO: this is broke in Stellarium.
{ // The ocular is displayed, but no object is selected. So d
// The ocular is displayed, but no object is selected. So d on't track the stars. We may have locked
on't track the stars. // the position of the screen if the movement keys were used
. so call this to be on the safe side.
movementManager->setFlagLockEquPos(false); movementManager->setFlagLockEquPos(false);
// Do we need to set this?
// movementManager->setFlagTracking(false);
} }
event->setAccepted(false); event->setAccepted(false);
} }
void Oculars::handleKeys(QKeyEvent* event)
{
if (!flagShowOculars && !flagShowCCD) {
return;
}
// We onle care about the arrow keys. This flag tracks that.
bool consumeEvent = false;
StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr();
if (event->type() == QEvent::KeyPress) {
// Direction and zoom replacements
switch (event->key()) {
case Qt::Key_Left:
movementManager->turnLeft(true);
consumeEvent = true;
break;
case Qt::Key_Right:
movementManager->turnRight(true);
consumeEvent = true;
break;
case Qt::Key_Up:
if (!event->modifiers().testFlag(Qt::Control
Modifier)) {
movementManager->turnUp(true);
}
consumeEvent = true;
break;
case Qt::Key_Down:
if (!event->modifiers().testFlag(Qt::Control
Modifier)) {
movementManager->turnDown(true);
}
consumeEvent = true;
break;
case Qt::Key_PageUp:
movementManager->zoomIn(true);
consumeEvent = true;
break;
case Qt::Key_PageDown:
movementManager->zoomOut(true);
consumeEvent = true;
break;
case Qt::Key_Shift:
movementManager->moveSlow(true);
consumeEvent = true;
break;
}
} else {
// When a deplacement key is released stop mooving
switch (event->key()) {
case Qt::Key_Left:
movementManager->turnLeft(false);
consumeEvent = true;
break;
case Qt::Key_Right:
movementManager->turnRight(false);
consumeEvent = true;
break;
case Qt::Key_Up:
movementManager->turnUp(false);
consumeEvent = true;
break;
case Qt::Key_Down:
movementManager->turnDown(false);
consumeEvent = true;
break;
case Qt::Key_PageUp:
movementManager->zoomIn(false);
consumeEvent = true;
break;
case Qt::Key_PageDown:
movementManager->zoomOut(false);
consumeEvent = true;
break;
case Qt::Key_Shift:
movementManager->moveSlow(false);
consumeEvent = true;
break;
}
if (consumeEvent) {
// We don't want to re-center the object; just hold
the current position.
movementManager->setFlagLockEquPos(true);
}
}
if (consumeEvent) {
event->accept();
} else {
event->setAccepted(false);
}
}
void Oculars::init() void Oculars::init()
{ {
qDebug() << "Ocular plugin - press Command-O to toggle eyepiece view mode. Press ALT-o for configuration."; qDebug() << "Ocular plugin - press Command-O to toggle eyepiece view mode. Press ALT-o for configuration.";
// Load settings from ocular.ini // Load settings from ocular.ini
try { try {
validateAndLoadIniFile(); validateAndLoadIniFile();
// assume all is well // assume all is well
ready = true; ready = true;
requireSelection = settings->value("require_selection_to_zoo m", 1.0).toBool();
useMaxEyepieceAngle = settings->value("use_max_exit_circle", 0.0).toBool(); useMaxEyepieceAngle = settings->value("use_max_exit_circle", 0.0).toBool();
int ocularCount = settings->value("ocular_count", 0).toInt() ; int ocularCount = settings->value("ocular_count", 0).toInt() ;
int actualOcularCount = ocularCount; int actualOcularCount = ocularCount;
for (int index = 0; index < ocularCount; index++) { for (int index = 0; index < ocularCount; index++) {
Ocular *newOcular = Ocular::ocularFromSettings(setti ngs, index); Ocular *newOcular = Ocular::ocularFromSettings(setti ngs, index);
if (newOcular != NULL) { if (newOcular != NULL) {
oculars.append(newOcular); oculars.append(newOcular);
} else { } else {
actualOcularCount--; actualOcularCount--;
} }
skipping to change at line 359 skipping to change at line 463
initializeActivationActions(); initializeActivationActions();
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what(); qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what();
ready = false; ready = false;
} }
//Load the module's custom style sheets //Load the module's custom style sheets
QFile styleSheetFile; QFile styleSheetFile;
styleSheetFile.setFileName(":/ocular/normalStyle.css"); styleSheetFile.setFileName(":/ocular/normalStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) {
{
normalStyleSheet = styleSheetFile.readAll(); normalStyleSheet = styleSheetFile.readAll();
} }
styleSheetFile.close(); styleSheetFile.close();
styleSheetFile.setFileName(":/ocular/nightStyle.css"); styleSheetFile.setFileName(":/ocular/nightStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) {
{
nightStyleSheet = styleSheetFile.readAll(); nightStyleSheet = styleSheetFile.readAll();
} }
styleSheetFile.close(); styleSheetFile.close();
connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QSt
ring&)),
this, SLOT(setStelStyle(const QString&)));
} }
void Oculars::setStelStyle(const QString&) void Oculars::setStelStyle(const QString&)
{ {
if(ocularDialog) { if(ocularDialog) {
ocularDialog->updateStyle(); ocularDialog->updateStyle();
} }
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Private slots Methods #pragma mark Private slots Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void Oculars::determineMaxEyepieceAngle() void Oculars::determineMaxEyepieceAngle()
{ {
if (ready) { if (ready) {
QListIterator<Ocular *> ocularIterator(oculars); foreach (Ocular* ocular, oculars) {
while (ocularIterator.hasNext()) {
Ocular *ocular = ocularIterator.next();
if (ocular->appearentFOV() > maxEyepieceAngle) { if (ocular->appearentFOV() > maxEyepieceAngle) {
maxEyepieceAngle = ocular->appearentFOV(); maxEyepieceAngle = ocular->appearentFOV();
} }
} }
} }
// insure it is not zero // insure it is not zero
if (maxEyepieceAngle == 0.0) { if (maxEyepieceAngle == 0.0) {
maxEyepieceAngle = 1.0; maxEyepieceAngle = 1.0;
} }
} }
void Oculars::instrumentChanged() void Oculars::instrumentChanged()
{ {
newInstrument = true; // We only zoom if in ocular mode.
zoom(true); if (flagShowOculars) {
zoom(true);
}
}
void Oculars::setRequireSelection(bool state)
{
requireSelection = state;
} }
void Oculars::setScaleImageCircle(bool state) void Oculars::setScaleImageCircle(bool state)
{ {
if (state) { if (state) {
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
} }
useMaxEyepieceAngle = state; useMaxEyepieceAngle = state;
} }
void Oculars::setScreenFOVForCCD()
{
if (selectedCCDIndex > -1 && selectedTelescopeIndex > -1) {
StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr();
double actualFOVx = ccds[selectedCCDIndex]->getActualFOVx(te
lescopes[selectedTelescopeIndex]);
double actualFOVy = ccds[selectedCCDIndex]->getActualFOVy(te
lescopes[selectedTelescopeIndex]);
if (actualFOVx < actualFOVy) {
actualFOVx = actualFOVy;
}
movementManager->setFlagTracking(true);
movementManager->zoomTo(actualFOVx * 3.0, 0.0);
}
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Slots Methods #pragma mark Slots Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void Oculars::ccdRotationReset()
{
ccdRotationAngle = 0.0;
}
void Oculars::enableOcular(bool enableOcularMode) void Oculars::enableOcular(bool enableOcularMode)
{ {
// If showing a CCD, cancel it.
if (flagShowCCD) {
flagShowCCD = false;
selectedCCDIndex = -1;
}
if (enableOcularMode) { if (enableOcularMode) {
// Check to insure that we have enough oculars & telescopes, as they may have been edited in the config dialog // Check to insure that we have enough oculars & telescopes, as they may have been edited in the config dialog
if (oculars.count() == 0) { if (oculars.count() == 0) {
selectedOcularIndex = -1; selectedOcularIndex = -1;
qDebug() << "No oculars found"; qWarning() << "No oculars found";
} else if (oculars.count() > 0 && selectedOcularIndex == -1) { } else if (oculars.count() > 0 && selectedOcularIndex == -1) {
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
if (telescopes.count() == 0) { if (telescopes.count() == 0) {
selectedTelescopeIndex = -1; selectedTelescopeIndex = -1;
qDebug() << "No telescopes found"; qWarning() << "No telescopes found";
} else if (telescopes.count() > 0 && selectedTelescopeIndex == -1) { } else if (telescopes.count() > 0 && selectedTelescopeIndex == -1) {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
} }
if (!ready || selectedOcularIndex == -1 || selectedTelescopeIndex if (!ready || selectedOcularIndex == -1 || (selectedTelescopeIndex
== -1) { == -1 && !isBinocularDefined())) {
qDebug() << "The Oculars module has been disabled."; qWarning() << "The Oculars module has been disabled.";
return; return;
} }
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
LabelMgr* labelManager = GETSTELMODULE(LabelMgr); LabelMgr* labelManager = GETSTELMODULE(LabelMgr);
// Toggle the plugin on & off. To toggle on, we want to ensure ther e is a selected object. // Toggle the plugin on & off. To toggle on, we want to ensure ther e is a selected object.
if (!flagShowOculars && !StelApp::getInstance().getStelObjectMgr().g etWasSelected()) { if (!flagShowOculars && requireSelection && !StelApp::getInstance(). getStelObjectMgr().getWasSelected() ) {
if (usageMessageLabelID == -1) { if (usageMessageLabelID == -1) {
QFontMetrics metrics(font); QFontMetrics metrics(font);
QString labelText = "Please select an object before enabling Ocular."; QString labelText = "Please select an object before enabling Ocular.";
StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams();
int xPosition = projectorParams.viewportCenter[0]; int xPosition = projectorParams.viewportCenter[0];
xPosition = xPosition - 0.5 * (metrics.width(labelTe xt)); xPosition = xPosition - 0.5 * (metrics.width(labelTe xt));
int yPosition = projectorParams.viewportCenter[1]; int yPosition = projectorParams.viewportCenter[1];
yPosition = yPosition - 0.5 * (metrics.height()); yPosition = yPosition - 0.5 * (metrics.height());
usageMessageLabelID = labelManager->labelScreen(labe usageMessageLabelID = labelManager->labelScreen(labe
lText, xPosition, yPosition, true, font.pixelSize(), "#99FF99"); lText, xPosition, yPosition,
true, font.pixelSize(), "#99FF99");
} }
// we didn't accept the new status - make sure the toolbar b utton reflects this // we didn't accept the new status - make sure the toolbar b utton reflects this
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui()); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui());
Q_ASSERT(gui); Q_ASSERT(gui);
disconnect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(t oggled(bool)), this, SLOT(enableOcular(bool))); disconnect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(t oggled(bool)), this, SLOT(enableOcular(bool)));
gui->getGuiActions("actionShow_Ocular")->setChecked(false); gui->getGuiActions("actionShow_Ocular")->setChecked(false);
connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(togg led(bool)), this, SLOT(enableOcular(bool))); connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(togg led(bool)), this, SLOT(enableOcular(bool)));
} else { } else {
if (selectedOcularIndex != -1) { if (selectedOcularIndex != -1) {
// remove the usage label if it is being displayed. // remove the usage label if it is being displayed.
if (usageMessageLabelID > -1) { if (usageMessageLabelID > -1) {
labelManager->setLabelShow(usageMessageLabel ID, false); labelManager->setLabelShow(usageMessageLabel ID, false);
labelManager->deleteLabel(usageMessageLabelI D); labelManager->deleteLabel(usageMessageLabelI D);
usageMessageLabelID = -1; usageMessageLabelID = -1;
} }
flagShowOculars = enableOcularMode; flagShowOculars = enableOcularMode;
zoom(false); zoom(false);
} }
} }
if (flagShowOculars) {
// Initialize those actions that should only be enabled when
in ocular mode.
initializeActions();
}
} }
void Oculars::decrementCCDIndex() void Oculars::decrementCCDIndex()
{ {
selectedCCDIndex--; selectedCCDIndex--;
if (selectedCCDIndex == -2) { if (selectedCCDIndex == -2) {
selectedCCDIndex = ccds.count() - 1; selectedCCDIndex = ccds.count() - 1;
} }
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
void Oculars::decrementOcularIndex() void Oculars::decrementOcularIndex()
{ {
selectedOcularIndex--; selectedOcularIndex--;
if (selectedOcularIndex == -1) { if (selectedOcularIndex == -1) {
selectedOcularIndex = oculars.count() - 1; selectedOcularIndex = oculars.count() - 1;
} }
emit(selectedOcularChanged()); // validate the new selection
if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin
oculars()) {
if ( selectedTelescopeIndex == -1 && telescopes.count() == 0
) {
// reject the change
selectedOcularIndex++;
} else if (selectedTelescopeIndex == -1) {
selectedTelescopeIndex = 0;
emit(selectedOcularChanged());
} else {
emit(selectedOcularChanged());
}
} else {
emit(selectedOcularChanged());
}
} }
void Oculars::decrementTelescopeIndex() void Oculars::decrementTelescopeIndex()
{ {
selectedTelescopeIndex--; selectedTelescopeIndex--;
if (selectedTelescopeIndex == -1) { if (selectedTelescopeIndex == -1) {
selectedTelescopeIndex = telescopes.count() - 1; selectedTelescopeIndex = telescopes.count() - 1;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::displayPopupMenu()
{
QMenu* popup = new QMenu();
if (flagShowOculars) {
// We are in Oculars mode
// We want to show all of the Oculars, and if the current oc
ular is not a binocular,
// we will also show the telescopes.
if (oculars.count() > 0) {
popup->addAction("previous ocular", this, SLOT(decre
mentOcularIndex()), Qt::Key_1);
popup->addAction("next ocular", this, SLOT(increment
OcularIndex()), Qt::Key_2);
QMenu* submenu = new QMenu("select ocular", popup);
int availableOcularCount = 0;
for (int index = 0; index < oculars.count(); ++index
) {
if (selectedTelescopeIndex == -1) {
if (oculars[index]->isBinoculars())
{
QAction* action = submenu->a
ddAction(oculars[index]->name(), ocularsSignalMapper, SLOT(map()),
QKeySe
quence(QString("%1").arg(availableOcularCount++)));
ocularsSignalMapper->setMapp
ing(action, QString("%1").arg(index));
}
} else {
QAction* action = submenu->addAction
(oculars[index]->name(), ocularsSignalMapper, SLOT(map()),
QKeySequence(Q
String("%1").arg(availableOcularCount++)));
ocularsSignalMapper->setMapping(acti
on, QString("%1").arg(index));
}
}
popup->addMenu(submenu);
popup->addSeparator();
}
if (telescopes.count() > 0 && (selectedOcularIndex > -1 && !
oculars[selectedOcularIndex]->isBinoculars())) {
popup->addAction("previous telescope", this, SLOT(de
crementTelescopeIndex()), Qt::Key_3);
popup->addAction("next telescope", this, SLOT(increm
entTelescopeIndex()), Qt::Key_4);
QMenu* submenu = new QMenu("select telescope", popup
);
for (int index = 0; index < telescopes.count(); ++in
dex) {
QAction* action = submenu->addAction(telesco
pes[index]->name(), telescopesSignalMapper, SLOT(map()),
QKeySequence(QString("
%1").arg(index)));
telescopesSignalMapper->setMapping(action, Q
String("%1").arg(index));
}
popup->addMenu(submenu);
popup->addSeparator();
}
popup->addAction("toggle crosshair", this, SLOT(toggleCrossh
air()), Qt::Key_5);
} else {
int outerMenuLevel = 1;
// We are not in Oculars mode
// We want to show the CCD's, and if a CCD is selected, the
Telescopes (as a CCD requires a telescope),
// and the general menu items.
QAction* action = new QAction("Configure Oculars", popup);
action->setCheckable(TRUE);
action->setShortcut(QString("%1").arg(outerMenuLevel++));
connect(action, SIGNAL(toggled(bool)), ocularDialog, SLOT(se
tVisible(bool)));
connect(ocularDialog, SIGNAL(visibleChanged(bool)), action,
SLOT(setChecked(bool)));
popup->addAction(action);
popup->addSeparator();
if (!flagShowTelrad) {
popup->addAction("Toggle CCD", this, SLOT(toggleCCD(
)), QKeySequence(QString("%1").arg(outerMenuLevel++)));
}
if (!flagShowCCD) {
popup->addAction("Toggle Telrad", this,
SLOT(toggl
eTelrad()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
}
popup->addSeparator();
if (selectedCCDIndex > -1 && selectedTelescopeIndex > -1) {
popup->addAction("previous CCD", this,
SLOT(decre
mentCCDIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
popup->addAction("next CCD", this,
SLOT(incre
mentCCDIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
QMenu* submenu = new QMenu("select CCD", popup);
for (int index = 0; index < ccds.count(); ++index) {
QAction* action = submenu->addAction(ccds[in
dex]->name(), ccdsSignalMapper, SLOT(map()),
QKeySequence(QString("
%1").arg(index)));
ccdsSignalMapper->setMapping(action, QString
("%1").arg(index));
}
popup->addMenu(submenu);
submenu = new QMenu("Rotate CCD", popup);
QAction* rotateAction = NULL;
rotateAction = submenu->addAction(QString("-90") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_1);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("-90"));
rotateAction = submenu->addAction(QString("-45") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_2);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("-45"));
rotateAction = submenu->addAction(QString("-15") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_3);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("-15"));
rotateAction = submenu->addAction(QString("-5") + QC
har(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_4);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("-5"));
rotateAction = submenu->addAction(QString("-1") + QC
har(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_5);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("-1"));
rotateAction = submenu->addAction(QString("+1") + QC
har(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_6);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("1"));
rotateAction = submenu->addAction(QString("+5") + QC
har(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_7);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("5"));
rotateAction = submenu->addAction(QString("+15") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_8);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("15"));
rotateAction = submenu->addAction(QString("+45") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_9);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("45"));
rotateAction = submenu->addAction(QString("+90") + Q
Char(0x00B0),
ccdRotationSignalMapper, SLOT(map()),
Qt::Key_0);
ccdRotationSignalMapper->setMapping(rotateAction, QS
tring("90"));
rotateAction = submenu->addAction("Reset", this, SLO
T(ccdRotationReset()), Qt::Key_R);
popup->addMenu(submenu);
popup->addSeparator();
}
if (selectedCCDIndex > -1 && telescopes.count() > 0) {
popup->addAction("previous telescope", this,
SLOT(decre
mentTelescopeIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
popup->addAction("next telescope", this,
SLOT(incre
mentTelescopeIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
QMenu* submenu = new QMenu("select telescope", popup
);
for (int index = 0; index < telescopes.count(); ++in
dex) {
QAction* action = submenu->addAction(telesco
pes[index]->name(), telescopesSignalMapper, SLOT(map()),
QKeySequence(QString("
%1").arg(index)));
telescopesSignalMapper->setMapping(action, Q
String("%1").arg(index));
}
popup->addMenu(submenu);
popup->addSeparator();
}
}
popup->exec(QCursor::pos());
delete popup;
}
void Oculars::incrementCCDIndex() void Oculars::incrementCCDIndex()
{ {
selectedCCDIndex++; selectedCCDIndex++;
if (selectedCCDIndex == ccds.count()) { if (selectedCCDIndex == ccds.count()) {
selectedCCDIndex = -1; selectedCCDIndex = -1;
} }
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
void Oculars::incrementOcularIndex() void Oculars::incrementOcularIndex()
{ {
selectedOcularIndex++; selectedOcularIndex++;
if (selectedOcularIndex == oculars.count()) { if (selectedOcularIndex == oculars.count()) {
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
emit(selectedOcularChanged()); // validate the new selection
if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin
oculars()) {
if ( selectedTelescopeIndex == -1 && telescopes.count() == 0
) {
// reject the change
selectedOcularIndex++;
} else if (selectedTelescopeIndex == -1) {
selectedTelescopeIndex = 0;
emit(selectedOcularChanged());
} else {
emit(selectedOcularChanged());
}
} else {
emit(selectedOcularChanged());
}
} }
void Oculars::incrementTelescopeIndex() void Oculars::incrementTelescopeIndex()
{ {
selectedTelescopeIndex++; selectedTelescopeIndex++;
if (selectedTelescopeIndex == telescopes.count()) { if (selectedTelescopeIndex == telescopes.count()) {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::toggleCrosshair() void Oculars::rotateCCD(QString amount)
{ {
flagShowCrosshairs = !flagShowCrosshairs; ccdRotationAngle += amount.toInt();
} }
void Oculars::toggleTelrad() void Oculars::selectCCDAtIndex(QString indexString)
{ {
flagShowTelrad = !flagShowTelrad; int index = indexString.toInt();
if (index > -2 && index < ccds.count()) {
selectedCCDIndex = index;
emit(selectedCCDChanged());
}
} }
/* ********************************************************************* */ void Oculars::selectOcularAtIndex(QString indexString)
#if 0
#pragma mark -
#pragma mark Private Methods
#endif
/* ********************************************************************* */
void Oculars::drawCrosshairs()
{ {
const StelProjectorP projector = StelApp::getInstance().getCore()->g int index = indexString.toInt();
etProjection(StelCore::FrameEquinoxEqu);
StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrentStelProj
ectorParams();
// Center of screen
Vec2i centerScreen(projector->getViewportPosX()+projector->getViewpo
rtWidth()/2,
projector->getViewportPosY()+proj
ector->getViewportHeight()/2);
GLdouble length = 0.5 * params.viewportFovDiameter;
// See if we need to scale the length
if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO
V() > 0.0) {
length = oculars[selectedOcularIndex]->appearentFOV() * leng
th / maxEyepieceAngle;
}
// Draw the lines // validate the new selection
StelPainter painter(projector); if (oculars[index]->isBinoculars()) {
painter.setColor(0.77, 0.14, 0.16, 1); selectedOcularIndex = index;
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] emit(selectedOcularChanged());
, centerScreen[1] + length); } else {
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] if ( selectedTelescopeIndex == -1 && telescopes.count() == 0
, centerScreen[1] - length); ) {
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] // reject the change
+ length, centerScreen[1]); } else {
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] if (selectedTelescopeIndex == -1) {
- length, centerScreen[1]); selectedTelescopeIndex = 0;
}
selectedOcularIndex = index;
emit(selectedOcularChanged());
}
}
} }
void Oculars::drawTelrad() void Oculars::selectTelescopeAtIndex(QString indexString)
{ {
if (!flagShowOculars) { int index = indexString.toInt();
const StelProjectorP projector = StelApp::getInstance().getC if (index > -2 && index < telescopes.count()) {
ore()->getProjection(StelCore::FrameEquinoxEqu); selectedTelescopeIndex = index;
emit(selectedTelescopeChanged());
}
}
StelCore *core = StelApp::getInstance().getCore(); void Oculars::toggleCCD()
StelProjector::StelProjectorParams params = core->getCurrent {
StelProjectorParams(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr();
if (flagShowCCD) {
flagShowCCD = false;
selectedCCDIndex = -1;
movementManager->zoomTo(movementManager->getInitFov());
movementManager->setFlagTracking(false);
} else {
// Check to insure that we have enough CCDs & telescopes, as
they may have been edited in the config dialog
if (ccds.count() == 0) {
selectedCCDIndex = -1;
qDebug() << "No CCDs found";
} else if (ccds.count() > 0 && selectedCCDIndex == -1) {
selectedCCDIndex = 0;
}
if (telescopes.count() == 0) {
selectedTelescopeIndex = -1;
qDebug() << "No telescopes found";
} else if (telescopes.count() > 0 && selectedTelescopeIndex
== -1) {
selectedTelescopeIndex = 0;
}
if (!ready || selectedCCDIndex == -1 || selectedTelescopeIn
dex == -1 ) {
qDebug() << "The Oculars module has been disabled.";
return;
}
flagShowCCD = true;
setScreenFOVForCCD();
}
}
// StelPainter drawing void Oculars::toggleCrosshair()
StelPainter painter(projector); {
painter.setColor(0.77, 0.14, 0.16, 1.0); flagShowCrosshairs = !flagShowCrosshairs;
Vec2i centerScreen(projector->getViewportPosX()+projector->g }
etViewportWidth()/2,
projector->getViewportPos
Y()+projector->getViewportHeight()/2);
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (0.5));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (2.0));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (4.0));
// // Direct drawing void Oculars::toggleTelrad()
// glDisable(GL_BLEND); {
// glColor3f(0.f,0.f,0.f); flagShowTelrad = !flagShowTelrad;
// glPushMatrix();
// glTranslated(params.viewportCenter[0], params.viewportCenter
[1], 0.0);
// GLUquadricObj *quadric = gluNewQuadric();
// // the gray circle
// glColor4f(0.77, 0.14, 0.16, 0.5);
// float radius = 0.5 * projector->getPixelPerRadAtCenter() * (
M_PI/180) * (0.5);
// gluDisk(quadric, radius - 1.0, radius, 256, 1);
// radius = 0.5 * projector->getPixelPerRadAtCenter() * (M_PI/1
80) * (2.0);
// gluDisk(quadric, radius - 1.0, radius, 256, 1);
// radius = 0.5 * projector->getPixelPerRadAtCenter() * (M_PI/1
80) * (4.0);
// gluDisk(quadric, radius - 1.0, radius, 256, 1);
// gluDeleteQuadric(quadric);
// glPopMatrix();
}
} }
/* ********************************************************************* */
#if 0
#pragma mark -
#pragma mark Private Methods
#endif
/* ********************************************************************* */
void Oculars::initializeActivationActions() void Oculars::initializeActivationActions()
{ {
// TRANSLATORS: Title of a group of key bindings in the Help window // TRANSLATORS: Title of a group of key bindings in the Help window
QString group = N_("Plugin Key Bindings"); QString group = N_("Plugin Key Bindings");
//Bogdan: Temporary, for consistency and to avoid confusing the tran slators //Bogdan: Temporary, for consistency and to avoid confusing the tran slators
//TODO: Fix this when the key bindings feature is implemented //TODO: Fix this when the key bindings feature is implemented
//QString group = N_("Oculars Plugin"); //QString group = N_("Oculars Plugin");
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); Q_ASSERT(gui);
//This action needs to be connected to the enableOcular() slot after
//the necessary button is created to prevent the button from being c
hecked
//the first time this action is checked. See:
//http://doc.qt.nokia.com/4.7/signalsandslots.html#signals
gui->addGuiActions("actionShow_Ocular", gui->addGuiActions("actionShow_Ocular",
N_("Ocular view"), N_("Ocular view"),
settings->value("bi ndings/toggle_oculars", "Ctrl+O").toString(), settings->value("bi ndings/toggle_oculars", "Ctrl+O").toString(),
N_("Plugin Key Bind ings"), N_("Plugin Key Bind ings"),
true); true);
gui->getGuiActions("actionShow_Ocular")->setChecked(flagShowOculars) ; gui->getGuiActions("actionShow_Ocular")->setChecked(flagShowOculars) ;
//This action needs to be connected to the enableOcular() slot after
//the necessary button is created to prevent the button from being c
hecked
//the first time this action is checked. See:
//http://doc.qt.nokia.com/4.7/signalsandslots.html#signals
gui->addGuiActions("actionShow_Ocular_Window",
N_("Oculars configu
ration window"),
settings->value("bi
ndings/toggle_config_dialog", "ALT+O").toString(),
group,
true);
connect(gui->getGuiActions("actionShow_Ocular_Window"), SIGNAL(toggl
ed(bool)), ocularDialog, SLOT(setVisible(bool)));
connect(ocularDialog, SIGNAL(visibleChanged(bool)), gui->getGuiActio
ns("actionShow_Ocular_Window"), SLOT(setChecked(bool)));
gui->addGuiActions("actionShow_Ocular_Telrad",
N_("Telrad circles"
),
settings->value("bi
ndings/toggle_telrad", "Ctrl+B").toString(),
group,
true);
gui->getGuiActions("actionShow_Ocular_Telrad")->setChecked(flagShowT
elrad);
connect(gui->getGuiActions("actionShow_Ocular_Telrad"), SIGNAL(toggl
ed(bool)), this, SLOT(toggleTelrad()));
// Make a toolbar button // Make a toolbar button
try { try {
pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png"); pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png");
pxmapOnIcon = new QPixmap(":/ocular/bt_ocular_on.png"); pxmapOnIcon = new QPixmap(":/ocular/bt_ocular_on.png");
pxmapOffIcon = new QPixmap(":/ocular/bt_ocular_off.png"); pxmapOffIcon = new QPixmap(":/ocular/bt_ocular_off.png");
toolbarButton = new StelButton(NULL, toolbarButton = new StelButton(NULL,
*
pxmapOnIcon, *pxmapOnIcon,
*
pxmapOffIcon, *pxmapOffIcon,
*
pxmapGlow, *pxmapGlow,
g
ui->getGuiActions("actionShow_Ocular")); gui->getGuiActions("actionShow_Ocular"));
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup");
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
qWarning() << "WARNING: unable create toolbar button for Ocu lars plugin: " << e.what(); qWarning() << "WARNING: unable create toolbar button for Ocu lars plugin: " << e.what();
} }
connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(toggled(bool )), this, SLOT(enableOcular(bool))); connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(toggled(bool )), this, SLOT(enableOcular(bool)));
}
void Oculars::initializeActions() gui->addGuiActions("actionShow_Ocular_Menu",
{ N_("Oculars popup m
static bool actions_initialized; enu"),
if (actions_initialized) settings->value("bi
return; ndings/popup_navigator", "Alt+O").toString(),
actions_initialized = true; group,
QString group = "Oculars Plugin"; true);
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( connect(gui->getGuiActions("actionShow_Ocular_Menu"), SIGNAL(toggled
)); (bool)), this, SLOT(displayPopupMenu()));
Q_ASSERT(gui);
//Bogdan: In the moment, these are not displayed in the Help dialog
or
//anywhere, so I've removed the N_() to avoid confusing the translat
ors
//TODO: Fix this when the key bindings feature is implemented
gui->addGuiActions("actionShow_Ocular_Crosshair",
("Toggle Crosshair"
),
settings->value("bi
ndings/toggle_crosshair", "ALT+C").toString(),
group, true);
gui->addGuiActions("actionShow_CCD_increment",
("Select next senso
r"),
settings->value("bi
ndings/next_ccd", "Shift+Ctrl+]").toString(),
group, false);
gui->addGuiActions("actionShow_CCD_decrement",
("Select previous s
ensor"),
settings->value("bi
ndings/prev_ccd", "Shift+Ctrl+[").toString(),
group, false);
gui->addGuiActions("actionShow_Ocular_increment",
("Select next ocula
r"),
settings->value("bi
ndings/next_ocular", "Ctrl+]").toString(),
group, false);
gui->addGuiActions("actionShow_Ocular_decrement",
("Select previous o
cular"),
settings->value("bi
ndings/prev_ocular", "Ctrl+[").toString(),
group, false);
gui->addGuiActions("actionShow_Telescope_increment",
("Select next teles
cope"),
settings->value("bi
ndings/next_telescope", "Shift+]").toString(),
group, false);
gui->addGuiActions("actionShow_Telescope_decrement",
("Select previous t
elescope"),
settings->value("bi
ndings/prev_telescope", "Shift+[").toString(),
group, false);
connect(gui->getGuiActions("actionShow_Ocular_Crosshair"), SIGNAL(to
ggled(bool)), this, SLOT(toggleCrosshair()));
connect(gui->getGuiActions("actionShow_CCD_increment"), SIGNAL(trigg
ered()), this, SLOT(incrementCCDIndex()));
connect(gui->getGuiActions("actionShow_CCD_decrement"), SIGNAL(trigg
ered()), this, SLOT(decrementCCDIndex()));
connect(gui->getGuiActions("actionShow_Ocular_increment"), SIGNAL(tr
iggered()), this, SLOT(incrementOcularIndex()));
connect(gui->getGuiActions("actionShow_Ocular_decrement"), SIGNAL(tr
iggered()), this, SLOT(decrementOcularIndex()));
connect(gui->getGuiActions("actionShow_Telescope_increment"), SIGNAL
(triggered()), this, SLOT(incrementTelescopeIndex()));
connect(gui->getGuiActions("actionShow_Telescope_decrement"), SIGNAL
(triggered()), this, SLOT(decrementTelescopeIndex()));
/*
connect(telescopesTableModel, SIGNAL(dataChanged(const QModelIndex
&, const QModelIndex &)), this, SLOT(dataChanged()));
connect(telescopesTableModel, SIGNAL(rowsInserted(const QModelIndex
&, int, int)), this, SLOT(rowsInserted()));
connect(telescopesTableModel, SIGNAL(rowsRemoved(const QModelIndex
&, int, int)), this, SLOT(rowsRemoved()));
*/
connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(instrumentCha nged())); connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(instrumentCha nged()));
connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(setScreenFOVF orCCD()));
connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(instrument Changed())); connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(instrument Changed()));
connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(instrum entChanged())); connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(instrum entChanged()));
connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(setScre
enFOVForCCD()));
connect(ocularDialog, SIGNAL(requireSelectionChanged(bool)), this, S
LOT(setRequireSelection(bool)));
connect(ocularDialog, SIGNAL(scaleImageCircleChanged(bool)), this, S LOT(setScaleImageCircle(bool))); connect(ocularDialog, SIGNAL(scaleImageCircleChanged(bool)), this, S LOT(setScaleImageCircle(bool)));
connect(ccdRotationSignalMapper, SIGNAL(mapped(QString)), this, SLOT
(rotateCCD(QString)));
connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(select
CCDAtIndex(QString)));
connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(setScr
eenFOVForCCD()));
connect(ocularsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(sel
ectOcularAtIndex(QString)));
connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT(
selectTelescopeAtIndex(QString)));
connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT(
setScreenFOVForCCD()));
} }
void Oculars::interceptMovementKey(QKeyEvent* event) bool Oculars::isBinocularDefined()
{ {
// We onle care about the arrow keys. This flag tracks that. bool binocularFound = false;
bool consumeEvent = false; foreach (Ocular* ocular, oculars) {
if (ocular->isBinoculars()) {
binocularFound = true;
break;
}
}
return binocularFound;
}
void Oculars::paintCCDBounds()
{
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
if (event->type() == QEvent::KeyPress) glDisable(GL_BLEND);
{ glColor3f(0.f,0.f,0.f);
// Direction and zoom replacements glPushMatrix();
switch (event->key()) glTranslated(params.viewportCenter[0], params.viewportCenter[1], 0.0
{ );
case Qt::Key_Left: glRotated(ccdRotationAngle, 0.0, 0.0, 1.0);
movementManager->turnLeft(true); GLdouble screenFOV = params.fov;
consumeEvent = true;
break; // draw sensor rectangle
case Qt::Key_Right: if(selectedCCDIndex != -1) {
movementManager->turnRight(true); CCD *ccd = ccds[selectedCCDIndex];
consumeEvent = true; if (ccd) {
break; glColor4f(0.77, 0.14, 0.16, 0.5);
case Qt::Key_Up: Telescope *telescope = telescopes[selectedTelescopeI
if (!event->modifiers().testFlag(Qt::Control ndex];
Modifier)) double ccdXRatio = ccd->getActualFOVx(telescope) / s
{ creenFOV;
movementManager->turnUp(true); double ccdYRatio = ccd->getActualFOVy(telescope) / s
} creenFOV;
consumeEvent = true; // As the FOV is based on the narrow aspect of the s
break; creen, we need to calculate
case Qt::Key_Down: // height & width based soley off of that dimension.
if (!event->modifiers().testFlag(Qt::Control int aspectIndex = 2;
Modifier)) if (params.viewportXywh[2] > params.viewportXywh[3])
{ {
movementManager->turnDown(true); aspectIndex = 3;
} }
consumeEvent = true; float width = params.viewportXywh[aspectIndex] * ccd
break; YRatio;
case Qt::Key_PageUp: float height = params.viewportXywh[aspectIndex] * cc
movementManager->zoomIn(true); dXRatio;
consumeEvent = true;
break; if (width > 0.0 && height > 0.0) {
case Qt::Key_PageDown: glBegin(GL_LINE_LOOP);
movementManager->zoomOut(true); glVertex2f(-width / 2.0, height / 2.0);
consumeEvent = true; glVertex2f(width / 2.0, height / 2.0);
break; glVertex2f(width / 2.0, -height / 2.0);
case Qt::Key_Shift: glVertex2f(-width / 2.0, -height / 2.0);
movementManager->moveSlow(true); glEnd();
consumeEvent = true; }
break;
}
}
else
{
// When a deplacement key is released stop mooving
switch (event->key())
{
case Qt::Key_Left:
movementManager->turnLeft(false);
consumeEvent = true;
break;
case Qt::Key_Right:
movementManager->turnRight(false);
consumeEvent = true;
break;
case Qt::Key_Up:
movementManager->turnUp(false);
consumeEvent = true;
break;
case Qt::Key_Down:
movementManager->turnDown(false);
consumeEvent = true;
break;
case Qt::Key_PageUp:
movementManager->zoomIn(false);
consumeEvent = true;
break;
case Qt::Key_PageDown:
movementManager->zoomOut(false);
consumeEvent = true;
break;
case Qt::Key_Shift:
movementManager->moveSlow(false);
consumeEvent = true;
break;
}
if (consumeEvent)
{
// We don't want to re-center the object; just hold
the current position.
movementManager->setFlagLockEquPos(true);
} }
} }
if (consumeEvent)
{ glPopMatrix();
event->accept(); }
void Oculars::paintCrosshairs()
{
const StelProjectorP projector = StelApp::getInstance().getCore()->g
etProjection(StelCore::FrameEquinoxEqu);
StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrentStelProj
ectorParams();
// Center of screen
Vec2i centerScreen(projector->getViewportPosX()+projector->getViewpo
rtWidth()/2,
projector->getViewportPosY()+proj
ector->getViewportHeight()/2);
GLdouble length = 0.5 * params.viewportFovDiameter;
// See if we need to scale the length
if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO
V() > 0.0) {
length = oculars[selectedOcularIndex]->appearentFOV() * leng
th / maxEyepieceAngle;
} }
else
{ // Draw the lines
event->setAccepted(false); StelPainter painter(projector);
painter.setColor(0.77, 0.14, 0.16, 1);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0]
, centerScreen[1] + length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0]
, centerScreen[1] - length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0]
+ length, centerScreen[1]);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0]
- length, centerScreen[1]);
}
void Oculars::paintTelrad()
{
if (!flagShowOculars) {
const StelProjectorP projector = StelApp::getInstance().getC
ore()->getProjection(StelCore::FrameEquinoxEqu);
StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrent
StelProjectorParams();
// StelPainter drawing
StelPainter painter(projector);
painter.setColor(0.77, 0.14, 0.16, 1.0);
Vec2i centerScreen(projector->getViewportPosX()+projector->g
etViewportWidth()/2,
projector->getViewportPos
Y()+projector->getViewportHeight()/2);
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (0.5));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (2.0));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p
rojector->getPixelPerRadAtCenter() * (M_PI/180) * (4.0));
} }
} }
void Oculars::paintMask() void Oculars::paintOcularMask()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
glDisable(GL_BLEND); glDisable(GL_BLEND);
glColor3f(0.f,0.f,0.f); glColor3f(0.f,0.f,0.f);
glPushMatrix(); glPushMatrix();
glTranslated(params.viewportCenter[0], params.viewportCenter[1], 0.0 ); glTranslated(params.viewportCenter[0], params.viewportCenter[1], 0.0 );
GLUquadricObj *quadric = gluNewQuadric(); GLUquadricObj *quadric = gluNewQuadric();
GLdouble inner = 0.5 * params.viewportFovDiameter; GLdouble inner = 0.5 * params.viewportFovDiameter;
// See if we need to scale the mask // See if we need to scale the mask
if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0) { if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0 && !oculars[selectedOcularIndex]->isBinoculars()) {
inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle; inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle;
} }
GLdouble outer = params.viewportXywh[2] + params.viewportXywh[3]; GLdouble outer = params.viewportXywh[2] + params.viewportXywh[3];
// Draw the mask // Draw the mask
gluDisk(quadric, inner, outer, 256, 1); gluDisk(quadric, inner, outer, 256, 1);
// the gray circle // the gray circle
glColor3f(0.15f,0.15f,0.15f); glColor3f(0.15f,0.15f,0.15f);
gluDisk(quadric, inner - 1.0, inner, 256, 1); gluDisk(quadric, inner - 1.0, inner, 256, 1);
gluDeleteQuadric(quadric); gluDeleteQuadric(quadric);
// draw sensor rectangle
if(selectedCCDIndex != -1) {
CCD *ccd = ccds[selectedCCDIndex];
if (ccd) {
glColor4f(0.77, 0.14, 0.16, 0.5);
Telescope *telescope = telescopes[selectedTelescopeI
ndex];
float CCDx = ccd->getActualFOVx(telescope);
float CCDy = ccd->getActualFOVy(telescope);
if (CCDx > 0.0 && CCDy > 0.0) {
glBegin(GL_LINE_LOOP);
glVertex2f(-CCDx, CCDy);
glVertex2f(CCDx, CCDy);
glVertex2f(CCDx, -CCDy);
glVertex2f(-CCDx, -CCDy);
glEnd();
}
}
}
glPopMatrix(); glPopMatrix();
} }
void Oculars::paintText(const StelCore* core) void Oculars::paintText(const StelCore* core)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ; const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ;
StelPainter painter(prj); StelPainter painter(prj);
// Get the current instruments // Get the current instruments
CCD *ccd = NULL; CCD *ccd = NULL;
skipping to change at line 905 skipping to change at line 1140
painter.setFont(font); painter.setFont(font);
QString widthString = "MMMMMMMMMMMMMMMMMMM"; QString widthString = "MMMMMMMMMMMMMMMMMMM";
float insetFromRHS = painter.getFontMetrics().width(widthString); float insetFromRHS = painter.getFontMetrics().width(widthString);
StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams();
int xPosition = projectorParams.viewportXywh[2]; int xPosition = projectorParams.viewportXywh[2];
xPosition -= insetFromRHS; xPosition -= insetFromRHS;
int yPosition = projectorParams.viewportXywh[3]; int yPosition = projectorParams.viewportXywh[3];
yPosition -= 40; yPosition -= 40;
const int lineHeight = painter.getFontMetrics().height(); const int lineHeight = painter.getFontMetrics().height();
// The Ocular
if (flagShowOculars) {
QString ocularNumberLabel = "Ocular #" + QVariant(selectedOc
ularIndex).toString();
if (ocular->name() != QString("")) {
ocularNumberLabel.append(" : ").append(ocular->name(
));
}
// The name of the ocular could be really long.
if (ocular->name().length() > widthString.length()) {
xPosition -= (insetFromRHS / 2.0);
}
painter.drawText(xPosition, yPosition, ocularNumberLabel);
yPosition-=lineHeight;
if (!ocular->isBinoculars()) {
QString ocularFLLabel = "Ocular FL: " + QVariant(ocu
lar->effectiveFocalLength()).toString() + "mm";
painter.drawText(xPosition, yPosition, ocularFLLabel
);
yPosition-=lineHeight;
QString ocularFOVLabel = "Ocular aFOV: " + QVariant(
ocular->appearentFOV()).toString() + QChar(0x00B0);
painter.drawText(xPosition, yPosition, ocularFOVLabe
l);
yPosition-=lineHeight;
// The telescope
QString telescopeNumberLabel = "Telescope #" + QVari
ant(selectedTelescopeIndex).toString();
if (telescope->name() != QString("")) {
telescopeNumberLabel.append(" : ").append(te
lescope->name());
}
painter.drawText(xPosition, yPosition, telescopeNumb
erLabel);
yPosition-=lineHeight;
// General info
QString magnificationLabel = "Magnification: " + QVa
riant(((int)(ocular->magnification(telescope) * 10.0)) / 10.0).toString()+
"x";
painter.drawText(xPosition, yPosition, magnification
Label);
yPosition-=lineHeight;
QString fovLabel = "FOV: " + QVariant(((int)(ocular-
>actualFOV(telescope) * 10000.00)) / 10000.0).toString() + QChar(0x00B0);
painter.drawText(xPosition, yPosition, fovLabel);
}
}
// The CCD // The CCD
QString ccdsensorLabel, ccdInfoLabel; if (flagShowCCD) {
if (ccd && ccd->chipWidth() > .0 && ccd->chipHeight() > .0) { QString ccdsensorLabel, ccdInfoLabel;
ccdInfoLabel = "Dimension : " + QVariant(ccd->chipWidth()).t double fovX = ((int)(ccd->getActualFOVx(telescope) * 1000.0)
oString() + "x" + QVariant(ccd->chipHeight()).toString() + " mm"; ) / 1000.0;
double fovY = ((int)(ccd->getActualFOVy(telescope) * 1000.0)
) / 1000.0;
ccdInfoLabel = "Dimension : " + QVariant(fovX).toString() +
QChar(0x00B0) + "x" + QVariant(fovY).toString() + QChar(0x00B0);
if (ccd->name() != QString("")) { if (ccd->name() != QString("")) {
ccdsensorLabel = "Sensor #" + QVariant(selectedCCDIn dex).toString(); ccdsensorLabel = "Sensor #" + QVariant(selectedCCDIn dex).toString();
ccdsensorLabel.append(" : ").append(ccd->name()); ccdsensorLabel.append(" : ").append(ccd->name());
} }
}
if (ccdsensorLabel != QString("")) {
painter.drawText(xPosition, yPosition, ccdsensorLabel); painter.drawText(xPosition, yPosition, ccdsensorLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
painter.drawText(xPosition, yPosition, ccdInfoLabel); painter.drawText(xPosition, yPosition, ccdInfoLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
// The telescope
QString telescopeNumberLabel = "Telescope #" + QVariant(sele
ctedTelescopeIndex).toString();
if (telescope->name() != QString("")) {
telescopeNumberLabel.append(" : ").append(telescope-
>name());
}
painter.drawText(xPosition, yPosition, telescopeNumberLabel)
;
yPosition-=lineHeight;
} }
// The Ocular
QString ocularNumberLabel = "Ocular #" + QVariant(selectedOcularInde
x).toString();
if (ocular->name() != QString("")) {
ocularNumberLabel.append(" : ").append(ocular->name());
}
painter.drawText(xPosition, yPosition, ocularNumberLabel);
yPosition-=lineHeight;
QString ocularFLLabel = "Ocular FL: " + QVariant(ocular->effectiveFo
calLength()).toString() + "mm";
painter.drawText(xPosition, yPosition, ocularFLLabel);
yPosition-=lineHeight;
QString ocularFOVLabel = "Ocular aFOV: " + QVariant(ocular->appearen
tFOV()).toString() + QChar(0x00B0);
painter.drawText(xPosition, yPosition, ocularFOVLabel);
yPosition-=lineHeight;
// The telescope
QString telescopeNumberLabel = "Telescope #" + QVariant(selectedTele
scopeIndex).toString();
if (telescope->name() != QString("")) {
telescopeNumberLabel.append(" : ").append(telescope->name())
;
}
painter.drawText(xPosition, yPosition, telescopeNumberLabel);
yPosition-=lineHeight;
// General info
QString magnificationLabel = "Magnification: "
+ QVariant(((int)(ocular->magnification(telescope) * 10.0)) / 10.0).t
oString()
+ "x";
painter.drawText(xPosition, yPosition, magnificationLabel);
yPosition-=lineHeight;
QString fovLabel = "FOV: "
+ QVariant(((int)(o
cular->actualFOV(telescope) * 10000.00)) / 10000.0).toString()
+ QChar(0x00B0);
painter.drawText(xPosition, yPosition, fovLabel);
} }
void Oculars::validateAndLoadIniFile() void Oculars::validateAndLoadIniFile()
{ {
// Insure the module directory exists // Insure the module directory exists
StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir( )+"/modules/Oculars"); StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir( )+"/modules/Oculars");
StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directo ry|StelFileMgr::Writable); StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directo ry|StelFileMgr::Writable);
QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl ags) + "ocular.ini"; QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl ags) + "ocular.ini";
// If the ini file does not already exist, create it from the resour ce in the QT resource // If the ini file does not already exist, create it from the resour ce in the QT resource
skipping to change at line 1012 skipping to change at line 1260
// is writable by the Stellarium pro cess so that updates can be done. // is writable by the Stellarium pro cess so that updates can be done.
QFile dest(ocularIniPath); QFile dest(ocularIniPath);
dest.setPermissions(dest.permissions () | QFile::WriteOwner); dest.setPermissions(dest.permissions () | QFile::WriteOwner);
} }
} }
} }
} }
settings = new QSettings(ocularIniPath, QSettings::IniFormat, this); settings = new QSettings(ocularIniPath, QSettings::IniFormat, this);
} }
QSettings* Oculars::appSettings()
{
return settings;
}
void Oculars::unzoomOcular() void Oculars::unzoomOcular()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr"); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr");
gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid); gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid);
gridManager->setFlagEquatorGrid(flagEquatorGrid); gridManager->setFlagEquatorGrid(flagEquatorGrid);
gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid); gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid);
gridManager->setFlagEquatorLine(flagEquatorLine); gridManager->setFlagEquatorLine(flagEquatorLine);
skipping to change at line 1041 skipping to change at line 1284
movementManager->setFlagEnableMouseNavigation(true); movementManager->setFlagEnableMouseNavigation(true);
// Set the screen display // Set the screen display
// core->setMaskType(StelProjector::MaskNone); // core->setMaskType(StelProjector::MaskNone);
core->setFlipHorz(false); core->setFlipHorz(false);
core->setFlipVert(false); core->setFlipVert(false);
movementManager->zoomTo(movementManager->getInitFov()); movementManager->zoomTo(movementManager->getInitFov());
} }
void Oculars::zoom(bool rezoom) void Oculars::zoom(bool zoomedIn)
{ {
if (flagShowOculars && selectedOcularIndex == -1) {
// The user cycled out the selected ocular
flagShowOculars = false;
}
if (flagShowOculars) { if (flagShowOculars) {
if (!rezoom) { if (!zoomedIn) {
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp: :getInstance().getModuleMgr().getModule("GridLinesMgr"); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp: :getInstance().getModuleMgr().getModule("GridLinesMgr");
// Current state // Current state
flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d(); flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d();
flagEquatorGrid = gridManager->getFlagEquatorGrid(); flagEquatorGrid = gridManager->getFlagEquatorGrid();
flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid(); flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid();
flagEquatorLine = gridManager->getFlagEquatorLine(); flagEquatorLine = gridManager->getFlagEquatorLine();
flagEclipticLine = gridManager->getFlagEclipticLine( ); flagEclipticLine = gridManager->getFlagEclipticLine( );
flagMeridianLine = gridManager->getFlagMeridianLine( ); flagMeridianLine = gridManager->getFlagMeridianLine( );
} }
skipping to change at line 1083 skipping to change at line 1331
gridManager->setFlagEquatorLine(false); gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticLine(false); gridManager->setFlagEclipticLine(false);
gridManager->setFlagMeridianLine(false); gridManager->setFlagMeridianLine(false);
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
movementManager->setFlagEnableZoomKeys(false); movementManager->setFlagEnableZoomKeys(false);
movementManager->setFlagEnableMouseNavigation(false); movementManager->setFlagEnableMouseNavigation(false);
// We won't always have a selected object // We won't always have a selected object
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) { if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) {
movementManager-> StelObjectP selectedObject = StelApp::getInstance().getStelO
moveToJ2000(StelApp::getInstance().getStelObjectMgr( bjectMgr().getSelectedObject()[0];
).getSelectedObject()[0]->getEquinoxEquatorialPos(core->getNavigator()), movementManager->moveToJ2000(selectedObject->getEquinoxEquat
0.0, orialPos(core), 0.0, 1);
1);
} }
// Set the screen display // Set the screen display
// core->setMaskType(StelProjector::MaskDisk); // core->setMaskType(StelProjector::MaskDisk);
Ocular *ocular = oculars[selectedOcularIndex]; Ocular *ocular = oculars[selectedOcularIndex];
Telescope *telescope = telescopes[selectedTelescopeIndex]; Telescope *telescope = NULL;
core->setFlipHorz(telescope->isHFlipped()); // Only consider flip is we're not binoculars
core->setFlipVert(telescope->isVFlipped()); if (!ocular->isBinoculars()) {
telescope = telescopes[selectedTelescopeIndex];
core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped());
}
double actualFOV = ocular->actualFOV(telescope); double actualFOV = ocular->actualFOV(telescope);
// See if the mask was scaled; if so, correct the actualFOV. // See if the mask was scaled; if so, correct the actualFOV.
if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0) { if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) {
actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV(); actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV();
} }
movementManager->zoomTo(actualFOV, 0.0); movementManager->zoomTo(actualFOV, 0.0);
} }
 End of changes. 86 change blocks. 
443 lines changed or deleted 779 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/