summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Lancaster <rlancaste@gmail.com>2016-10-23 07:11:10 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-23 07:11:10 (GMT)
commit9e0e602c56e7d0fdd5ca787b505ce679ebc0e71c (patch)
treeb23e66702b3cc3913629e504e90266b18cb4aa19
parent09e751f6f7415dc0281d612284975b4601760a48 (diff)
Adding context menu to FITSViewer just like SkyMap. Label fixes. New center telescope icon
-rw-r--r--kstars/auxiliary/colorscheme.cpp1
-rw-r--r--kstars/data/chart.colors1
-rw-r--r--kstars/data/classic.colors1
-rw-r--r--kstars/data/icons/center_telescope.svg11
-rw-r--r--kstars/data/moonless-night.colors1
-rw-r--r--kstars/data/night.colors1
-rw-r--r--kstars/fitsviewer/fitsview.cpp38
-rw-r--r--kstars/fitsviewer/fitsviewer.cpp2
-rw-r--r--kstars/options/opscolors.cpp10
9 files changed, 43 insertions, 23 deletions
diff --git a/kstars/auxiliary/colorscheme.cpp b/kstars/auxiliary/colorscheme.cpp
index c20a574..acdd3ca 100644
--- a/kstars/auxiliary/colorscheme.cpp
+++ b/kstars/auxiliary/colorscheme.cpp
@@ -93,6 +93,7 @@ ColorScheme::ColorScheme() : FileName() {
appendItem("RAGuideError", i18n("RA Guide Error"), "#00FF00");
appendItem("DEGuideError", i18n("DEC Guide Error"), "#00A5FF");
appendItem("SolverFOVColor", i18n("Solver FOV"), "#FFFFFF");
+ appendItem("FITSObjectLabelColor", i18n("FITS Image Object Label"), "#00FF00");
//Load colors from config object
loadFromConfig();
diff --git a/kstars/data/chart.colors b/kstars/data/chart.colors
index d06a694..6e4616a 100644
--- a/kstars/data/chart.colors
+++ b/kstars/data/chart.colors
@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
+#00FF00 :FITSObjectLabelColor
diff --git a/kstars/data/classic.colors b/kstars/data/classic.colors
index 91699fe..c327ddc 100644
--- a/kstars/data/classic.colors
+++ b/kstars/data/classic.colors
@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
+#00FF00 :FITSObjectLabelColor
diff --git a/kstars/data/icons/center_telescope.svg b/kstars/data/icons/center_telescope.svg
index ef134f7..cd9be79 100644
--- a/kstars/data/icons/center_telescope.svg
+++ b/kstars/data/icons/center_telescope.svg
@@ -1,10 +1 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100" id="svg2" version="1.0">
- <g id="layer" >
- <path style="stroke: #ff0000; stroke-width:10;" d="M 50,1 L 50,35 z " id="up"/>
- <path style="stroke: #ff0000; stroke-width:10;" d="M 50,65 L 50,100 z " id="down"/>
- <path style="stroke: #ff0000; stroke-width:10;" d="M 35,50 L 0,50 z " id="left"/>
- <path style="stroke: #ff0000; stroke-width:10;" d="M 100,50 L 65,50 z " id="right"/>
- <circle style="stroke:#ff0000; stroke-width:10;" cx="50" cy="50" r="33" fill="none"/>
- </g>
-</svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 11h-2.051c-.469-4.725-4.224-8.48-8.949-8.95v-2.05h-2v2.05c-4.725.47-8.48 4.225-8.949 8.95h-2.051v2h2.051c.469 4.725 4.224 8.48 8.949 8.95v2.05h2v-2.05c4.725-.469 8.48-4.225 8.949-8.95h2.051v-2zm-11 8.931v-3.931h-2v3.931c-3.611-.454-6.478-3.32-6.931-6.931h3.931v-2h-3.931c.453-3.611 3.32-6.477 6.931-6.931v3.931h2v-3.931c3.611.454 6.478 3.319 6.931 6.931h-3.931v2h3.931c-.453 3.611-3.32 6.477-6.931 6.931zm1-7.931c0 1.104-.896 2-2 2s-2-.896-2-2 .896-2 2-2 2 .896 2 2z"/></svg> \ No newline at end of file
diff --git a/kstars/data/moonless-night.colors b/kstars/data/moonless-night.colors
index 009043a..ddf919a 100644
--- a/kstars/data/moonless-night.colors
+++ b/kstars/data/moonless-night.colors
@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
+#00FF00 :FITSObjectLabelColor
diff --git a/kstars/data/night.colors b/kstars/data/night.colors
index ade380c..85cf938 100644
--- a/kstars/data/night.colors
+++ b/kstars/data/night.colors
@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
+#950000 :FITSObjectLabelColor
diff --git a/kstars/fitsviewer/fitsview.cpp b/kstars/fitsviewer/fitsview.cpp
index f3fb5e4..875d344 100644
--- a/kstars/fitsviewer/fitsview.cpp
+++ b/kstars/fitsviewer/fitsview.cpp
@@ -18,7 +18,6 @@
***************************************************************************/
#include <config-kstars.h>
-
#include "fitsview.h"
#include "kspopupmenu.h"
#include "skymap.h"
@@ -154,6 +153,7 @@ Then it stores the current point so next time it can do it again.
*/
void FITSLabel::mouseMoveEvent(QMouseEvent *e)
{
+ float scale=(image->getCurrentZoom() / ZOOM_DEFAULT);
if(image->getMouseMode()==FITSView::dragMouse&&mouseButtonDown){
QPoint newPoint=e->globalPos();
@@ -173,8 +173,8 @@ void FITSLabel::mouseMoveEvent(QMouseEvent *e)
if (buffer == NULL)
return;
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
+ x = round(e->x() / scale);
+ y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
@@ -210,8 +210,8 @@ void FITSLabel::mouseMoveEvent(QMouseEvent *e)
bool objFound=false;
foreach(FITSSkyObject *listObject, image_data->objList){
- if((abs(listObject->x()-x)<20)&&(abs(listObject->y()-y)<20)){
- QToolTip::showText(e->globalPos(), listObject->skyObject()->name(), this);
+ if((abs(listObject->x()-x)<5/scale)&&(abs(listObject->y()-y)<5/scale)){
+ QToolTip::showText(e->globalPos(), listObject->skyObject()->name() +"\n"+listObject->skyObject()->longname() , this);
objFound=true;
break;
}
@@ -235,6 +235,8 @@ do want to slew to the WCS coordinates associated with the click location. If s
void FITSLabel::mousePressEvent(QMouseEvent *e)
{
+ float scale=(image->getCurrentZoom() / ZOOM_DEFAULT);
+
if(image->getMouseMode()==FITSView::dragMouse)
{
mouseButtonDown=true;
@@ -249,8 +251,8 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
wcs_point * wcs_coord = image_data->getWCSCoord();
double x,y;
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
+ x = round(e->x() / scale);
+ y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
@@ -265,8 +267,8 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
double x,y;
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
+ x = round(e->x() / scale);
+ y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
@@ -280,11 +282,22 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
if (image_data->hasWCS())
{
foreach(FITSSkyObject *listObject, image_data->objList){
- if((abs(listObject->x()-x)<20)&&(abs(listObject->y()-y)<20)){
+ if((abs(listObject->x()-x)<5/scale)&&(abs(listObject->y()-y)<5/scale)){
SkyObject *object=listObject->skyObject();
KSPopupMenu *pmenu;
pmenu=new KSPopupMenu();
object->showPopupMenu(pmenu,e->globalPos());
+ QList<QAction *> actions= pmenu->actions();
+ foreach(QAction *action,actions){
+ if(action->text().left(7)=="Starhop")
+ pmenu->removeAction(action);
+ if(action->text().left(7)=="Angular")
+ pmenu->removeAction(action);
+ if(action->text().left(8)=="Add flag")
+ pmenu->removeAction(action);
+ if(action->text().left(12)=="Attach Label")
+ pmenu->removeAction(action);
+ }
KStars::Instance()->map()->setClickedObject(object);
break;
}
@@ -1011,11 +1024,12 @@ bool FITSView::imageHasWCS(){
void FITSView::drawObjectNames(QPainter *painter)
{
- painter->setPen( QPen( Qt::green) );
+ painter->setPen( QPen( QColor( KStarsData::Instance()->colorScheme()->colorNamed("FITSObjectLabelColor" ) ) ) );
float scale=(currentZoom / ZOOM_DEFAULT);
foreach(FITSSkyObject *listObject, image_data->getSkyObjects())
{
- painter->drawText(listObject->x()*scale+10,listObject->y()*scale+10,listObject->skyObject()->name());
+ painter->drawRect(listObject->x()*scale-5,listObject->y()*scale-5,10,10);
+ painter->drawText(listObject->x()*scale+10,listObject->y()*scale+10,listObject->skyObject()->name());
}
}
diff --git a/kstars/fitsviewer/fitsviewer.cpp b/kstars/fitsviewer/fitsviewer.cpp
index b90d860..34b336c 100644
--- a/kstars/fitsviewer/fitsviewer.cpp
+++ b/kstars/fitsviewer/fitsviewer.cpp
@@ -864,7 +864,7 @@ void FITSViewer::updateWCSFunctions()
actionCollection()->action("view_eq_grid")->setText( i18n( "Show Equatorial Gridlines\n*No WCS Info*" ));
actionCollection()->action("center_telescope")->setDisabled(true);
actionCollection()->action("center_telescope")->setText( i18n( "Center Telescope\n*No WCS Info*" ));
- actionCollection()->action("view_objects")->setDisabled(false);
+ actionCollection()->action("view_objects")->setDisabled(true);
actionCollection()->action("view_objects")->setText( i18n( "Show Objects in Image\n*No WCS Info*" ));
}
diff --git a/kstars/options/opscolors.cpp b/kstars/options/opscolors.cpp
index 4e6885f..8f68584 100644
--- a/kstars/options/opscolors.cpp
+++ b/kstars/options/opscolors.cpp
@@ -36,6 +36,8 @@
#include "kstarsdata.h"
#include "skymap.h"
#include "colorscheme.h"
+#include "fitsviewer/fitsviewer.h"
+#include "fitsviewer/fitsview.h"
#include "skyobjects/starobject.h"
static int ItemColorData = Qt::UserRole + 1;
@@ -127,6 +129,10 @@ void OpsColors::newColor( QListWidgetItem *item ) {
}
KStars::Instance()->map()->forceUpdate();
+ QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
+ foreach(FITSViewer *viewer, viewers){
+ viewer->getCurrentView()->updateFrame();
+ }
}
void OpsColors::slotPreset( int index ) {
@@ -160,6 +166,10 @@ bool OpsColors::setColors( const QString &filename ) {
}
KStars::Instance()->map()->forceUpdate();
+ QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
+ foreach(FITSViewer *viewer, viewers){
+ viewer->getCurrentView()->updateFrame();
+ }
return true;
}