CompassMarks.cpp   CompassMarks.cpp 
skipping to change at line 79 skipping to change at line 79
setObjectName("CompassMarks"); setObjectName("CompassMarks");
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
// Setup defaults if not present // Setup defaults if not present
if (!conf->contains("CompassMarks/mark_color")) if (!conf->contains("CompassMarks/mark_color"))
conf->setValue("CompassMarks/mark_color", "1,0,0"); conf->setValue("CompassMarks/mark_color", "1,0,0");
if (!conf->contains("CompassMarks/font_size")) if (!conf->contains("CompassMarks/font_size"))
conf->setValue("CompassMarks/font_size", 10); conf->setValue("CompassMarks/font_size", 10);
if (!conf->contains("CompassMarks/enable_at_startup"))
conf->setValue("CompassMarks/enable_at_startup", false);
// Load settings from main config file // Load settings from main config file
markColor = StelUtils::strToVec3f(conf->value("CompassMarks/mark_col or", "1,0,0").toString()); markColor = StelUtils::strToVec3f(conf->value("CompassMarks/mark_col or", "1,0,0").toString());
font.setPixelSize(conf->value("CompassMarks/font_size", 10).toInt()) ; font.setPixelSize(conf->value("CompassMarks/font_size", 10).toInt()) ;
} }
CompassMarks::~CompassMarks() CompassMarks::~CompassMarks()
{ {
if (pxmapGlow!=NULL) if (pxmapGlow!=NULL)
delete pxmapGlow; delete pxmapGlow;
if (pxmapOnIcon!=NULL) if (pxmapOnIcon!=NULL)
skipping to change at line 124 skipping to change at line 127
{ {
qDebug() << "CompassMarks plugin - press control-C to toggle compass marks"; qDebug() << "CompassMarks plugin - press control-C to toggle compass marks";
try try
{ {
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui()); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui());
pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png"); pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png");
pxmapOnIcon = new QPixmap(":/compassMarks/bt_compass_on.png" ); pxmapOnIcon = new QPixmap(":/compassMarks/bt_compass_on.png" );
pxmapOffIcon = new QPixmap(":/compassMarks/bt_compass_off.pn g"); pxmapOffIcon = new QPixmap(":/compassMarks/bt_compass_off.pn g");
gui->addGuiActions("actionShow_Compass_Marks", N_("Compass m arks"), "", N_("Plugin Key Bindings"), true, false); gui->addGuiActions("actionShow_Compass_Marks", N_("Compass m arks"), "", N_("Plugin Key Bindings"), true, false);
gui->getGuiActions("actionShow_Compass_Marks")->setChecked(m arkFader); //gui->getGuiActions("actionShow_Compass_Marks")->setChecked(markFa der);
toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOff Icon, *pxmapGlow, gui->getGuiActions("actionShow_Compass_Marks")); toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOff Icon, *pxmapGlow, gui->getGuiActions("actionShow_Compass_Marks"));
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup");
connect(gui->getGuiActions("actionShow_Compass_Marks"), SIGN AL(toggled(bool)), this, SLOT(setCompassMarks(bool))); connect(gui->getGuiActions("actionShow_Compass_Marks"), SIGN AL(toggled(bool)), this, SLOT(setCompassMarks(bool)));
connect(gui->getGuiActions("actionShow_Cardinal_Points"), SI GNAL(toggled(bool)), this, SLOT(cardinalPointsChanged(bool))); connect(gui->getGuiActions("actionShow_Cardinal_Points"), SI GNAL(toggled(bool)), this, SLOT(cardinalPointsChanged(bool)));
cardinalPointsState = false; cardinalPointsState = false;
QSettings* conf = StelApp::getInstance().getSettings();
setCompassMarks(conf->value("CompassMarks/enable_at_startup"
, false).toBool());
// GZ: This must go here, else button may show wrong state
gui->getGuiActions("actionShow_Compass_Marks")->setChecked(markFade
r);
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable create toolbar button for Com passMarks plugin: " << e.what(); qWarning() << "WARNING: unable create toolbar button for Com passMarks plugin: " << e.what();
} }
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void CompassMarks::draw(StelCore* core) void CompassMarks::draw(StelCore* core)
{ {
if (markFader.getInterstate() <= 0.0) { return; } if (markFader.getInterstate() <= 0.0) { return; }
Vec3d pos; Vec3d pos;
StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelC ore::RefractionOff); // Maybe conflict with Scenery3d branch. AW20120214 StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelC ore::RefractionOff); // Maybe conflict with Scenery3d branch. AW20120214
StelPainter painter(prj); StelPainter painter(prj);
painter.setFont(font); painter.setFont(font);
glColor4f(markColor[0],markColor[1],markColor[2], markFader.getInter Vec3f mColor;
state()); if (StelApp::getInstance().getVisionModeNight())
mColor = StelUtils::getNightColor(markColor);
else
mColor = markColor;
glColor4f(mColor[0], mColor[1], mColor[2], markFader.getInterstate()
);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
for(int i=0; i<360; i++) for(int i=0; i<360; i++)
{ {
float a = i*M_PI/180; float a = i*M_PI/180;
pos.set(sin(a),cos(a), 0.f); pos.set(sin(a),cos(a), 0.f);
float h = -0.002; float h = -0.002;
 End of changes. 5 change blocks. 
3 lines changed or deleted 20 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/