PointerCoordinates.cpp   PointerCoordinates.cpp 
skipping to change at line 25 skipping to change at line 25
* 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, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#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 "StelMainView.hpp"
#include "SkyGui.hpp" #include "SkyGui.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "PointerCoordinates.hpp" #include "PointerCoordinates.hpp"
skipping to change at line 57 skipping to change at line 58
} }
StelPluginInfo PointerCoordinatesStelPluginInterface::getPluginInfo() const StelPluginInfo PointerCoordinatesStelPluginInterface::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(PointerCoordinates); Q_INIT_RESOURCE(PointerCoordinates);
StelPluginInfo info; StelPluginInfo info;
info.id = "PointerCoordinates"; info.id = "PointerCoordinates";
info.displayedName = N_("Pointer Coordinates"); info.displayedName = N_("Pointer Coordinates");
info.authors = "Alexander Wolf, Georg Zotti"; info.authors = "Alexander Wolf";
info.contact = "http://stellarium.org"; info.contact = "http://stellarium.org";
info.description = N_("This plugin shows the coordinates of the mous e pointer."); info.description = N_("This plugin shows the coordinates of the mous e pointer.");
info.version = POINTERCOORDINATES_PLUGIN_VERSION; info.version = POINTERCOORDINATES_PLUGIN_VERSION;
info.license = POINTERCOORDINATES_PLUGIN_LICENSE;
return info; return info;
} }
PointerCoordinates::PointerCoordinates() PointerCoordinates::PointerCoordinates()
: currentPlace(TopRight) : currentPlace(TopRight)
, currentCoordinateSystem(RaDecJ2000) , currentCoordinateSystem(RaDecJ2000)
, flagShowCoordinates(false) , flagShowCoordinates(false)
, flagEnableAtStartup(false) , flagEnableAtStartup(false)
, flagShowCoordinatesButton(false) , flagShowCoordinatesButton(false)
, flagShowConstellation(false) , flagShowConstellation(false)
, flagShowCrossedLines(false)
, textColor(Vec3f(1,0.5,0)) , textColor(Vec3f(1,0.5,0))
, coordinatesPoint(Vec3d(0,0,0)) , coordinatesPoint(Vec3d(0,0,0))
, fontSize(14) , fontSize(14)
, toolbarButton(Q_NULLPTR) , toolbarButton(Q_NULLPTR)
{ {
setObjectName("PointerCoordinates"); setObjectName("PointerCoordinates");
mainWindow = new PointerCoordinatesWindow(); mainWindow = new PointerCoordinatesWindow();
StelApp &app = StelApp::getInstance(); StelApp &app = StelApp::getInstance();
conf = app.getSettings(); conf = app.getSettings();
gui = dynamic_cast<StelGui*>(app.getGui()); gui = dynamic_cast<StelGui*>(app.getGui());
skipping to change at line 104 skipping to change at line 107
} }
// populate settings from main config file. // populate settings from main config file.
loadConfiguration(); loadConfiguration();
addAction("actionShow_MousePointer_Coordinates", N_("Pointer Coordin ates"), N_("Show coordinates of the mouse pointer"), "enabled", ""); addAction("actionShow_MousePointer_Coordinates", N_("Pointer Coordin ates"), N_("Show coordinates of the mouse pointer"), "enabled", "");
enableCoordinates(getFlagEnableAtStartup()); enableCoordinates(getFlagEnableAtStartup());
setFlagShowCoordinatesButton(flagShowCoordinatesButton); setFlagShowCoordinatesButton(flagShowCoordinatesButton);
setFlagShowConstellation(flagShowConstellation); setFlagShowConstellation(flagShowConstellation);
setFlagShowCrossedLines(flagShowCrossedLines);
} }
void PointerCoordinates::deinit() void PointerCoordinates::deinit()
{ {
// //
} }
void PointerCoordinates::draw(StelCore *core) void PointerCoordinates::draw(StelCore *core)
{ {
if (!isEnabled()) if (!isEnabled())
skipping to change at line 287 skipping to change at line 291
} }
} }
QString constel; QString constel;
if (flagShowConstellation) if (flagShowConstellation)
{ {
constel=QString(" (%1)").arg(core->getIAUConstellation(core- >j2000ToEquinoxEqu(mousePosition))); constel=QString(" (%1)").arg(core->getIAUConstellation(core- >j2000ToEquinoxEqu(mousePosition)));
} }
QString coordsText = QString("%1: %2/%3%4").arg(coordsSystem).arg(cx t).arg(cyt).arg(constel); QString coordsText = QString("%1: %2/%3%4").arg(coordsSystem).arg(cx t).arg(cyt).arg(constel);
sPainter.drawText(getCoordinatesPlace(coordsText).first, getCoordina tesPlace(coordsText).second, coordsText); sPainter.drawText(getCoordinatesPlace(coordsText).first, getCoordina tesPlace(coordsText).second, coordsText);
if (flagShowCrossedLines)
{
StelProjector::StelProjectorParams params = core->getCurrent
StelProjectorParams();
QPoint m = StelMainView::getInstance().getMousePos();
sPainter.drawLine2d(m.x(), 0, m.x(), params.viewportXywh[3])
;
sPainter.drawLine2d(0, params.viewportXywh[3]-m.y(), params.
viewportXywh[2], params.viewportXywh[3]-m.y());
}
} }
void PointerCoordinates::enableCoordinates(bool b) void PointerCoordinates::enableCoordinates(bool b)
{ {
if (b!=flagShowCoordinates) if (b!=flagShowCoordinates)
{ {
flagShowCoordinates = b; flagShowCoordinates = b;
emit flagCoordinatesVisibilityChanged(b); emit flagCoordinatesVisibilityChanged(b);
} }
} }
skipping to change at line 342 skipping to change at line 354
setFlagEnableAtStartup(conf->value("enable_at_startup", false).toBoo l()); setFlagEnableAtStartup(conf->value("enable_at_startup", false).toBoo l());
textColor = StelUtils::strToVec3f(conf->value("text_color", "1,0.5,0 ").toString()); textColor = StelUtils::strToVec3f(conf->value("text_color", "1,0.5,0 ").toString());
setFontSize(conf->value("font_size", 14).toInt()); setFontSize(conf->value("font_size", 14).toInt());
flagShowCoordinatesButton = conf->value("flag_show_button", true).to Bool(); flagShowCoordinatesButton = conf->value("flag_show_button", true).to Bool();
setCurrentCoordinatesPlaceKey(conf->value("current_displaying_place" , "TopRight").toString()); setCurrentCoordinatesPlaceKey(conf->value("current_displaying_place" , "TopRight").toString());
setCurrentCoordinateSystemKey(conf->value("current_coordinate_system ", "RaDecJ2000").toString()); setCurrentCoordinateSystemKey(conf->value("current_coordinate_system ", "RaDecJ2000").toString());
QStringList cc = conf->value("custom_coordinates", "1,1").toString() .split(","); QStringList cc = conf->value("custom_coordinates", "1,1").toString() .split(",");
setCustomCoordinatesPlace(cc[0].toInt(), cc[1].toInt()); setCustomCoordinatesPlace(cc[0].toInt(), cc[1].toInt());
flagShowConstellation = conf->value("flag_show_constellation", false ).toBool(); flagShowConstellation = conf->value("flag_show_constellation", false ).toBool();
flagShowCrossedLines = conf->value("flag_show_crossed_lines", false) .toBool();
conf->endGroup(); conf->endGroup();
} }
void PointerCoordinates::saveConfiguration(void) void PointerCoordinates::saveConfiguration(void)
{ {
conf->beginGroup("PointerCoordinates"); conf->beginGroup("PointerCoordinates");
conf->setValue("enable_at_startup", getFlagEnableAtStartup()); conf->setValue("enable_at_startup", getFlagEnableAtStartup());
conf->setValue("flag_show_button", getFlagShowCoordinatesButton()); conf->setValue("flag_show_button", getFlagShowCoordinatesButton());
conf->setValue("current_displaying_place", getCurrentCoordinatesPlac eKey()); conf->setValue("current_displaying_place", getCurrentCoordinatesPlac eKey());
conf->setValue("current_coordinate_system", getCurrentCoordinateSyst emKey()); conf->setValue("current_coordinate_system", getCurrentCoordinateSyst emKey());
QPair<int, int> cc = getCustomCoordinatesPlace(); QPair<int, int> cc = getCustomCoordinatesPlace();
conf->setValue("custom_coordinates", QString("%1,%2").arg(cc.first). arg(cc.second)); conf->setValue("custom_coordinates", QString("%1,%2").arg(cc.first). arg(cc.second));
//conf->setValue("text_color", "1,0.5,0"); //conf->setValue("text_color", "1,0.5,0");
conf->setValue("font_size", getFontSize()); conf->setValue("font_size", getFontSize());
conf->setValue("flag_show_constellation", getFlagShowConstellation() ); conf->setValue("flag_show_constellation", getFlagShowConstellation() );
conf->setValue("flag_show_crossed_lines", getFlagShowCrossedLines()) ;
conf->endGroup(); conf->endGroup();
} }
void PointerCoordinates::setFlagShowCoordinatesButton(bool b) void PointerCoordinates::setFlagShowCoordinatesButton(bool b)
{ {
if (gui!=Q_NULLPTR) if (gui!=Q_NULLPTR)
{ {
if (b==true) { if (b==true) {
if (toolbarButton==Q_NULLPTR) { if (toolbarButton==Q_NULLPTR) {
skipping to change at line 446 skipping to change at line 460
x = 3*gui->getSkyGui()->getSkyGuiWidth()/4 - fs.widt h()/2; x = 3*gui->getSkyGui()->getSkyGuiWidth()/4 - fs.widt h()/2;
y = gui->getSkyGui()->getSkyGuiHeight() - fs.height( )*coeff; y = gui->getSkyGui()->getSkyGuiHeight() - fs.height( )*coeff;
break; break;
} }
case RightBottomCorner: case RightBottomCorner:
{ {
x = gui->getSkyGui()->getSkyGuiWidth() - fs.width() - 10*coeff; x = gui->getSkyGui()->getSkyGuiWidth() - fs.width() - 10*coeff;
y = fs.height(); y = fs.height();
break; break;
} }
case NearMouseCursor:
{
QPoint m = StelMainView::getInstance().getMousePos()
;
x = m.x() + 3;
y = gui->getSkyGui()->getSkyGuiHeight() - m.y() + 5;
break;
}
case Custom: case Custom:
{ {
QPair<int, int> xy = getCustomCoordinatesPlace(); QPair<int, int> xy = getCustomCoordinatesPlace();
x = xy.first; x = xy.first;
y = gui->getSkyGui()->getSkyGuiHeight() - xy.second - fs.height(); y = gui->getSkyGui()->getSkyGuiHeight() - xy.second - fs.height();
break; break;
} }
} }
return qMakePair(x, y); return qMakePair(x, y);
} }
 End of changes. 9 change blocks. 
1 lines changed or deleted 26 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/