AngleMeasure.cpp   AngleMeasure.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 "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
skipping to change at line 57 skipping to change at line 57
return new AngleMeasure(); return new AngleMeasure();
} }
StelPluginInfo AngleMeasureStelPluginInterface::getPluginInfo() const StelPluginInfo AngleMeasureStelPluginInterface::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(AngleMeasure); Q_INIT_RESOURCE(AngleMeasure);
StelPluginInfo info; StelPluginInfo info;
info.id = "AngleMeasure"; info.id = "AngleMeasure";
info.displayedName = q_("Angle Measure"); info.displayedName = N_("Angle Measure");
info.authors = "Matthew Gates"; info.authors = "Matthew Gates";
info.contact = "http://porpoisehead.net/"; info.contact = "http://porpoisehead.net/";
info.description = q_("Provides an angle measurement tool"); info.description = N_("Provides an angle measurement tool");
return info; return info;
} }
Q_EXPORT_PLUGIN2(AngleMeasure, AngleMeasureStelPluginInterface) Q_EXPORT_PLUGIN2(AngleMeasure, AngleMeasureStelPluginInterface)
AngleMeasure::AngleMeasure() AngleMeasure::AngleMeasure()
: flagShowAngleMeasure(false), dragging(false), : flagShowAngleMeasure(false), dragging(false),
angleText(""), flagUseDmsFormat(false), toolbarButton(NULL) angleText(""), flagUseDmsFormat(false), toolbarButton(NULL)
{ {
setObjectName("AngleMeasure"); setObjectName("AngleMeasure");
skipping to change at line 117 skipping to change at line 117
void AngleMeasure::init() void AngleMeasure::init()
{ {
qDebug() << "AngleMeasure plugin - press control-A to toggle angle m easure mode"; qDebug() << "AngleMeasure plugin - press control-A to toggle angle m easure mode";
startPoint.set(0.,0.,0.); startPoint.set(0.,0.,0.);
endPoint.set(0.,0.,0.); endPoint.set(0.,0.,0.);
perp1StartPoint.set(0.,0.,0.); perp1StartPoint.set(0.,0.,0.);
perp1EndPoint.set(0.,0.,0.); perp1EndPoint.set(0.,0.,0.);
perp2StartPoint.set(0.,0.,0.); perp2StartPoint.set(0.,0.,0.);
perp2EndPoint.set(0.,0.,0.); perp2EndPoint.set(0.,0.,0.);
// create action for enable/disable & hook up signals StelApp& app = StelApp::getInstance();
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui(
)); // Create action for enable/disable & hook up signals
StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
Q_ASSERT(gui); Q_ASSERT(gui);
gui->addGuiActions("actionShow_Angle_Measure", N_("Angle measure"), QAction* action = gui->addGuiActions("actionShow_Angle_Measure",
"Ctrl+A", N_("Plugin Key Bindings"), true, false); N_("Angle measure"),
gui->getGuiActions("actionShow_Angle_Measure")->setChecked(flagShowA "Ctrl+A",
ngleMeasure); N_("Plugin Key Bindings"),
connect(gui->getGuiActions("actionShow_Angle_Measure"), SIGNAL(toggl true, false);
ed(bool)), this, SLOT(enableAngleMeasure(bool))); action->setChecked(flagShowAngleMeasure);
connect(action, SIGNAL(toggled(bool)), this, SLOT(enableAngleMeasure
(bool)));
// Initialize the message strings and make sure they are translated
when
// the language changes.
updateMessageText();
connect(&app, SIGNAL(languageChanged()), this, SLOT(updateMessageTex
t()));
// Add a toolbar button // Add a toolbar button
try try
{ {
toolbarButton = new StelButton(NULL, QPixmap(":/angleMeasure /bt_anglemeasure_on.png"), QPixmap(":/angleMeasure/bt_anglemeasure_off.png" ), QPixmap(":/graphicGui/glow32x32.png"), gui->getGuiActions("actionShow_An gle_Measure")); toolbarButton = new StelButton(NULL, QPixmap(":/angleMeasure /bt_anglemeasure_on.png"), QPixmap(":/angleMeasure/bt_anglemeasure_off.png" ), QPixmap(":/graphicGui/glow32x32.png"), gui->getGuiActions("actionShow_An gle_Measure"));
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 Ang leMeasure plugin: " << e.what(); qWarning() << "WARNING: unable create toolbar button for Ang leMeasure plugin: " << e.what();
skipping to change at line 181 skipping to change at line 192
painter.drawGreatCircleArc(startPoint, endPoint, NULL); painter.drawGreatCircleArc(startPoint, endPoint, NULL);
// End lines // End lines
painter.drawGreatCircleArc(perp1StartPoint, perp1EndPoint, N ULL); painter.drawGreatCircleArc(perp1StartPoint, perp1EndPoint, N ULL);
painter.drawGreatCircleArc(perp2StartPoint, perp2EndPoint, N ULL); painter.drawGreatCircleArc(perp2StartPoint, perp2EndPoint, N ULL);
} }
if (messageFader.getInterstate() > 0.000001f) if (messageFader.getInterstate() > 0.000001f)
{ {
painter.setColor(textColor[0], textColor[1], textColor[2], m essageFader.getInterstate()); painter.setColor(textColor[0], textColor[1], textColor[2], m essageFader.getInterstate());
painter.drawText(83, 120, "Angle Tool Enabled - left drag to int x = 83;
measure, left click to clear"); int y = 120;
painter.drawText(83, 95, "right click to change end point o int ls = painter.getFontMetrics().lineSpacing();
nly"); painter.drawText(x, y, messageEnabled);
y -= ls;
painter.drawText(x, y, messageLeftButton);
y -= ls;
painter.drawText(x, y, messageRightButton);
} }
} }
void AngleMeasure::handleKeys(QKeyEvent* event) void AngleMeasure::handleKeys(QKeyEvent* event)
{ {
event->setAccepted(false); event->setAccepted(false);
} }
void AngleMeasure::handleMouseClicks(class QMouseEvent* event) void AngleMeasure::handleMouseClicks(class QMouseEvent* event)
{ {
skipping to change at line 282 skipping to change at line 299
angleText = QString("%1%2 %3' %4\"").arg(d).arg(QCha r(0x00B0)).arg(m).arg(s, 0, 'f', 2); angleText = QString("%1%2 %3' %4\"").arg(d).arg(QCha r(0x00B0)).arg(m).arg(s, 0, 'f', 2);
} }
void AngleMeasure::enableAngleMeasure(bool b) void AngleMeasure::enableAngleMeasure(bool b)
{ {
flagShowAngleMeasure = b; flagShowAngleMeasure = b;
lineVisible = b; lineVisible = b;
messageFader = b; messageFader = b;
if (b) if (b)
{ {
qDebug() << "AngleMeasure::enableAngleMeasure starting timer "; //qDebug() << "AngleMeasure::enableAngleMeasure starting tim er";
messageTimer->start(); messageTimer->start();
} }
} }
void AngleMeasure::updateMessageText()
{
// TRANSLATORS: instructions for using the AngleMeasure plugin.
messageEnabled = q_("The Angle Measure is enabled:");
// TRANSLATORS: instructions for using the AngleMeasure plugin.
messageLeftButton = q_("Drag with the left button to measure, left-c
lick to clear.");
// TRANSLATORS: instructions for using the AngleMeasure plugin.
messageRightButton = q_("Right-clicking changes the end point only."
);
}
void AngleMeasure::clearMessage() void AngleMeasure::clearMessage()
{ {
qDebug() << "AngleMeasure::clearMessage"; //qDebug() << "AngleMeasure::clearMessage";
messageFader = false; messageFader = false;
} }
 End of changes. 9 change blocks. 
18 lines changed or deleted 44 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/