FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

3D plots should not update status display of x/y coordinate in respon… · gnuplot/gnuplot@feaa300 · GitHub

Repository navigation

Commit feaa300

Browse files
Ethan A Merritt
committed
3D plots should not update status display of x/y coordinate in response to mouse move event
1 parent 6ff9f6f commit feaa300

4 files changed

Lines changed: 36 additions & 17 deletions

File tree

‎ChangeLog‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
* src/show.c: Clarify the current "set clip" settings in "show clip".
44

5+
* src/term_api.h src/graph3d.c: Send TERM_LAYER_3DPLOT to the terminal
6+
at the start of an splot.
7+
8+
* src/qtterminal/QtGnuplotScene.{cpp|h} src/qtterminal/qt_term.cpp:
9+
If the current plot is 3D, do not update the status dispplay of x/y
10+
coordinates in response to a mouse move event.
11+
Bug #1605
12+
513
2015-06-01 Daniel J Sebald <daniel.sebald@ieee.org>
614

715
* src/mouse.c (event_buttonrelease): Improved bookkeeping for which

‎src/qtterminal/QtGnuplotScene.cpp‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ void QtGnuplotScene::processEvent(QtGnuplotEventType type, QDataStream& in)
470470
{
471471
for (int i = 0; i < 4; i++)
472472
in >> m_axisValid[i] >> m_axisMin[i] >> m_axisLower[i] >> m_axisScale[i] >> m_axisLog[i];
473+
in >> m_axisValid[4];
473474
}
474475
else if (type == GEAfterPlot)
475476
{
@@ -776,21 +777,25 @@ void QtGnuplotScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
776777
// Mousing for inactive widgets
777778
if (!m_widget->isActive())
778779
{
779-
m_lineTo->hide();
780-
QString status;
781-
if (m_axisValid[0])
782-
status += QString("x = ")
783-
+ QString::number(sceneToGraph(0,event->scenePos().x()));
784-
if (m_axisValid[1])
785-
status += QString(" y = ")
786-
+ QString::number(sceneToGraph(1,event->scenePos().y()));
787-
if (m_axisValid[2])
788-
status += QString(" x2 = ")
789-
+ QString::number(sceneToGraph(2,event->scenePos().x()));
790-
if (m_axisValid[3])
791-
status += QString(" y2 = ")
792-
+ QString::number(sceneToGraph(3,event->scenePos().y()));
793-
m_widget->setStatusText(status);
780+
if (m_axisValid[4]) {
781+
; // 3D plot - no mouse coordinate update
782+
} else {
783+
m_lineTo->hide();
784+
QString status;
785+
if (m_axisValid[0])
786+
status += QString("x = ")
787+
+ QString::number(sceneToGraph(0,event->scenePos().x()));
788+
if (m_axisValid[1])
789+
status += QString(" y = ")
790+
+ QString::number(sceneToGraph(1,event->scenePos().y()));
791+
if (m_axisValid[2])
792+
status += QString(" x2 = ")
793+
+ QString::number(sceneToGraph(2,event->scenePos().x()));
794+
if (m_axisValid[3])
795+
status += QString(" y2 = ")
796+
+ QString::number(sceneToGraph(3,event->scenePos().y()));
797+
m_widget->setStatusText(status);
798+
}
794799
QGraphicsScene::mouseMoveEvent(event);
795800
return;
796801
}

‎src/qtterminal/QtGnuplotScene.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Q_OBJECT
130130
QGraphicsPixmapItem* m_hyperimage;
131131

132132
// Axis scales
133-
bool m_axisValid[4];
133+
bool m_axisValid[5]; // x, y, x2, y2, z (indicates 3D plot)
134134
double m_axisMin [4];
135135
double m_axisLower[4];
136136
double m_axisScale[4];

‎src/qtterminal/qt_term.cpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static bool qt_setPosition = false;
188188
static bool qt_setSize = true;
189189
static int qt_setWidth = qt_optionWidth;
190190
static int qt_setHeight = qt_optionHeight;
191+
static bool qt_is_3Dplot = false;
191192

192193
/* ------------------------------------------------------
193194
* Helpers
@@ -537,7 +538,7 @@ void qt_text_wrapper()
537538
if (!qt)
538539
return;
539540

540-
// Remember scale to update the status bar while the plot is inactive
541+
// Remember scale so that we can update the status bar while the plot is inactive
541542
qt->out << GEScale;
542543

543544
const int axis_order[4] = {FIRST_X_AXIS, FIRST_Y_AXIS, SECOND_X_AXIS, SECOND_Y_AXIS};
@@ -557,6 +558,9 @@ void qt_text_wrapper()
557558
qt->out << lower/qt_oversamplingF << scale/qt_oversamplingF;
558559
qt->out << (axis_array[axis_order[i]].log ? axis_array[axis_order[i]].log_base : 0.);
559560
}
561+
// Flag whether this was a 3D plot (not mousable in 'persist' mode)
562+
qt->out << qt_is_3Dplot;
563+
qt_is_3Dplot = false;
560564

561565
qt_text();
562566
}
@@ -1451,6 +1455,8 @@ void qt_layer( t_termlayer syncpoint )
14511455
qt->out << GELayer << QTLAYER_END_KEYSAMPLE; break;
14521456
case TERM_LAYER_BEFORE_ZOOM:
14531457
qt->out << GELayer << QTLAYER_BEFORE_ZOOM; break;
1458+
case TERM_LAYER_3DPLOT:
1459+
qt_is_3Dplot = true; break;
14541460
default:
14551461
break;
14561462
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL