CompassMarks.cpp   CompassMarks.cpp 
skipping to change at line 16 skipping to change at line 16
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
skipping to change at line 57 skipping to change at line 57
return new CompassMarks(); return new CompassMarks();
} }
StelPluginInfo CompassMarksStelPluginInterface::getPluginInfo() const StelPluginInfo CompassMarksStelPluginInterface::getPluginInfo() const
{ {
// Allow to load the resources when used as a static plugin // Allow to load the resources when used as a static plugin
Q_INIT_RESOURCE(CompassMarks); Q_INIT_RESOURCE(CompassMarks);
StelPluginInfo info; StelPluginInfo info;
info.id = "CompassMarks"; info.id = "CompassMarks";
info.displayedName = q_("Compass Marks"); info.displayedName = N_("Compass Marks");
info.authors = "Matthew Gates"; info.authors = "Matthew Gates";
info.contact = "http://porpoisehead.net/"; info.contact = "http://porpoisehead.net/";
info.description = q_("Displays compass bearing marks along the hori zon"); info.description = N_("Displays compass bearing marks along the hori zon");
return info; return info;
} }
Q_EXPORT_PLUGIN2(CompassMarks, CompassMarksStelPluginInterface) Q_EXPORT_PLUGIN2(CompassMarks, CompassMarksStelPluginInterface)
CompassMarks::CompassMarks() CompassMarks::CompassMarks()
: markColor(1,1,1), pxmapGlow(NULL), pxmapOnIcon(NULL), pxmapOffIcon (NULL), toolbarButton(NULL) : markColor(1,1,1), pxmapGlow(NULL), pxmapOnIcon(NULL), pxmapOffIcon (NULL), toolbarButton(NULL)
{ {
setObjectName("CompassMarks"); setObjectName("CompassMarks");
skipping to change at line 86 skipping to change at line 86
if (!conf->contains("CompassMarks/font_size")) if (!conf->contains("CompassMarks/font_size"))
conf->setValue("CompassMarks/font_size", 10); conf->setValue("CompassMarks/font_size", 10);
// 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)
delete pxmapGlow;
if (pxmapOnIcon!=NULL)
delete pxmapOnIcon;
if (pxmapOffIcon!=NULL)
delete pxmapOffIcon;
// TODO (requires work in core API) // TODO (requires work in core API)
// 1. Remove button from toolbar // 1. Remove button from toolbar
// 2. Remove action from GUI // 2. Remove action from GUI
// 3. Delete GUI objects. I'll leave this commented right now becau se // 3. Delete GUI objects. I'll leave this commented right now becau se
// unloading (when implemented) might cause problems if we do it bef ore we // unloading (when implemented) might cause problems if we do it bef ore we
// can do parts 1 and 2. // can do parts 1 and 2.
//if (pxmapGlow!=NULL)
// delete pxmapGlow;
//if (pxmapOnIcon!=NULL)
// delete pxmapOnIcon;
//if (pxmapOffIcon!=NULL)
// delete pxmapOffIcon;
//if (toolbarButton!=NULL) //if (toolbarButton!=NULL)
// delete toolbarButton; // delete toolbarButton;
// BTW, the above remark is from 2009 --BM
// See http://stellarium.svn.sourceforge.net/viewvc/stellarium/trunk
/extmodules/CompassMarks/src/CompassMarks.cpp?r1=4333&r2=4332&pathrev=4333
} }
//! Determine which "layer" the plugin's drawing will happen on. //! Determine which "layer" the plugin's drawing will happen on.
double CompassMarks::getCallOrder(StelModuleActionName actionName) const double CompassMarks::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+10.; return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+10.;
return 0; return 0;
} }
void CompassMarks::init() void CompassMarks::init()
{ {
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"), "Ctrl+C", 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(m arkFader);
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;
} }
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); 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 state()); glColor4f(markColor[0],markColor[1],markColor[2], markFader.getInter state());
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++)
 End of changes. 8 change blocks. 
11 lines changed or deleted 15 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/