Left/Right button in event flags test, foobar test and removed gradient on xtickers

This commit is contained in:
Mark Watkins 2011-08-27 15:06:08 +10:00
parent fe9947e3bc
commit 36ccb49a0d
4 changed files with 52 additions and 15 deletions

View File

@ -21,7 +21,7 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
if (xx==0)
return;
int start_px=left;
int start_px=left-1;
int end_px=left+width;
float h=top;
@ -48,6 +48,17 @@ void gShadowArea::paint(gGraph & w,int left, int top, int width, int height)
glEnd();
glDisable(GL_BLEND);
glLineWidth(2);
w.qglColor(Qt::blue);
glBegin(GL_LINES);
glVertex2f(start_px+px, top);
glVertex2f(start_px+py, top);
glVertex2f(start_px+px, top+height+1);
glVertex2f(start_px+py, top+height+1);
glEnd();
glLineWidth(1);
//glFlush();
}

View File

@ -417,6 +417,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event)
//qDebug() << m_title << "Released" << min_x << max_x << x << y << x2 << y2 << left << right << top << bottom << m_width << m_height;
if ((m_graphview->horizTravel()<4) && (x>left+m_marginleft && x<w+m_marginleft+left && y>top+m_margintop && y<h)) { // normal click in main area
if (!m_blockzoom) {
if (event->button() & Qt::RightButton) {
ZoomX(1.33,x); // Zoon out
return;
@ -424,6 +425,31 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event)
ZoomX(0.75,x); // zoom in.
return;
}
} else {
x-=left+m_marginleft;
y-=top+m_margintop;
//w-=m_marginleft+left;
double qq=rmax_x-rmin_x;
double xmult,j1;
double xx=max_x-min_x;
if (xx==qq) xx=1800000;
xmult=qq/double(w);
j1=(xmult*x);
min_x=rmin_x+j1-(xx/2);
max_x=min_x+xx;
if (min_x<rmin_x) {
min_x=rmin_x;
max_x=rmin_x+xx;
}
if (max_x>rmax_x) {
max_x=rmax_x;
min_x=rmax_x-xx;
}
m_graphview->SetXBounds(min_x,max_x,m_group);
}
}
if (m_selecting_area) {
m_selecting_area=false;

View File

@ -207,14 +207,14 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
glColor4ub(255,255,255,255);
glVertex2f(left-20,top+5);
glVertex2f(left-20,top+height);
glColor4ub(255,255,255,0);
glVertex2f(left+40,top+height);
glVertex2f(left+40,top+5);
//glColor4ub(255,255,255,0);
glVertex2f(left,top+height);
glVertex2f(left,top+5);
glColor4ub(255,255,255,0);
glVertex2f(left+width-40,top+5);
glVertex2f(left+width-40,top+height);
glColor4ub(255,255,255,255);
//glColor4ub(255,255,255,0);
glVertex2f(left+width,top+5);
glVertex2f(left+width,top+height);
//glColor4ub(255,255,255,255);
glVertex2f(left+width+20,top+height);
glVertex2f(left+width+20,top+5);
glEnd();

View File

@ -102,7 +102,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
SF->AddLayer(AddCPAP(fg));
SF->AddLayer(new gShadowArea());
SF->AddLayer(new gYSpacer(),LayerLeft,gYAxis::Margin);
SF->AddLayer(new gFooBar(),LayerBottom,0,1);
//SF->AddLayer(new gFooBar(),LayerBottom,0,1);
SF->AddLayer(new gXAxis(Qt::black,false),LayerBottom,0,gXAxis::Margin);
PRD->AddLayer(new gXGrid());