Commit 56dc5eb9 authored by Russ Fish's avatar Russ Fish

Kluge around problems with picking nodes in HyperViewer on Windows.

I will have to fix the bug in PyOpenGL argument passing to get
picking working right.

Meanwhile, I put in a simple work-around hack: when you pick a graph
edge in the spanning tree displayed by HyperViewer, the node it leads
to is picked instead.  (The edge has a negative integer ID, while the
node it leads to is positive.)

This also gives the ability to "zip" along edges of the graph, which
I kind of like.  It's not a very good substitute for picking nodes,
but might be worth keeping even after node picking works.  We can
also define our own semantics for picking edges in the graph...
parent dc30a578
......@@ -40,9 +40,14 @@ NAMESPACEHACK
#include <stdio.h>
#ifdef WIN32
#include <sys/timeb.h>
# include <sys/timeb.h>
# if 0 && defined(_DEBUG)
# include <AFX.H> // For TRACE.
# else
# define TRACE printf
# endif
#else
#include <sys/time.h>
# include <sys/time.h>
#endif
#include <math.h>
......@@ -1248,6 +1253,11 @@ void HypViewer::hiliteFunc(int x, int y, int shift, int control)
{
HypNode *n;
int picked = doPick(x,y);
#ifdef WIN32
//TRACE("hiliteFunc %d\n", picked);
// Kluge around problems with picking nodes on Windows.
if (picked < 0 && picked!= -INT_MAX ) picked = -picked;
#endif
if (picked != hiliteNode) {
n = hg->getNodeFromIndex(hiliteNode);
glDrawBuffer(GL_FRONT);
......@@ -1299,6 +1309,10 @@ void HypViewer::pickFunc(int x, int y, int shift, int control)
// fprintf(stderr, "total trans %g %g\n", sdx, sdy);
if (sdx <= .01 && sdx >= -.01 && sdy <= .01 && sdy >= -.01) {
int picked = doPick(x,y);
#ifdef WIN32
// Kluge around problems with picking nodes on Windows.
if (picked < 0 && picked!= -INT_MAX ) picked = -picked;
#endif
if (picked >= 0) {
// got a node
HypNode *n = hg->getNodeFromIndex(picked);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment