diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index 3da107cd..d9f18b43 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -110,12 +110,13 @@ void GetTextExtent(QString text, int & width, int & height, QFont *font) #endif } -GLBuffer::GLBuffer(int max,int type) - :m_max(max), m_type(type) +GLBuffer::GLBuffer(int max,int type, bool stippled) + :m_max(max), m_type(type), m_stippled(stippled) { m_scissor=false; m_antialias=true; m_forceantialias=false; + m_cnt=0; m_colcnt=0; m_size=1; @@ -179,8 +180,8 @@ void GLShortBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x } } -GLShortBuffer::GLShortBuffer(int max,int type) - :GLBuffer(max,type) +GLShortBuffer::GLShortBuffer(int max,int type, bool stippled) + :GLBuffer(max,type,stippled) { buffer=new GLshort [max+8]; colors=new GLubyte[max*4+(8*4)]; @@ -291,7 +292,14 @@ void GLShortBuffer::draw() } } if (m_type==GL_LINES || m_type==GL_LINE_LOOP) { + if (m_stippled) { + glLineStipple(1, 0xAAAA); + glEnable(GL_LINE_STIPPLE); + } else { + glLineStipple(1, 0xFFFF); + } glLineWidth(size); + } else if (m_type==GL_POINTS) { glPointSize(size); } else if (m_type==GL_POLYGON) { @@ -328,6 +336,11 @@ void GLShortBuffer::draw() if (m_type==GL_POLYGON) { glPolygonMode(GL_BACK,GL_FILL); } + if (m_stippled) { + glDisable(GL_LINE_STIPPLE); + glLineStipple(1, 0xFFFF); + } + if (antialias) { if (m_type==GL_LINES || m_type==GL_LINE_LOOP) { glDisable(GL_LINE_SMOOTH); @@ -342,8 +355,8 @@ void GLShortBuffer::draw() ///////////////////////////////////////////////////////////////////// // GLFloatBuffer -GLFloatBuffer::GLFloatBuffer(int max,int type) - :GLBuffer(max,type) +GLFloatBuffer::GLFloatBuffer(int max,int type,bool stippled) + :GLBuffer(max,type,stippled) { buffer=new GLfloat [max+8]; colors=new GLubyte[max*4+(8*4)]; @@ -533,6 +546,10 @@ void GLFloatBuffer::draw() } if (m_type==GL_LINES || m_type==GL_LINE_LOOP) { glLineWidth(size); + if (m_stippled) { + glLineStipple(1, 0xAAAA); + glEnable(GL_LINE_STIPPLE); + } } else if (m_type==GL_POINTS) { glPointSize(size); } else if (m_type==GL_POLYGON) { @@ -567,6 +584,7 @@ void GLFloatBuffer::draw() } if (antialias) { if (m_type==GL_LINES || m_type==GL_LINE_LOOP) { + if (m_stippled) glDisable(GL_LINE_STIPPLE); glDisable(GL_LINE_SMOOTH); } else if (m_type==GL_POLYGON) { glDisable(GL_POLYGON_SMOOTH); @@ -1624,6 +1642,10 @@ GLShortBuffer * gGraph::quads() { return m_graphview->quads; } +GLShortBuffer * gGraph::stippled() +{ + return m_graphview->stippled; +} short gGraph::marginLeft() { return m_marginleft*m_graphview->printScaleX(); } short gGraph::marginRight() { return m_marginright*m_graphview->printScaleX(); } short gGraph::marginTop() { return m_margintop*m_graphview->printScaleY(); } @@ -1789,6 +1811,10 @@ gGraphView::gGraphView(QWidget *parent, gGraphView * shared) : backlines=new GLShortBuffer(10000,GL_LINES); // big fat shared line list quads=new GLShortBuffer(1024,GL_QUADS); // big fat shared line list quads->forceAntiAlias(true); + stippled=new GLShortBuffer(20000,GL_LINES,true); + stippled->setSize(1); + stippled->forceAntiAlias(false); + setFocusPolicy(Qt::StrongFocus); m_showsplitter=true; timer=new QTimer(this); @@ -1808,6 +1834,7 @@ gGraphView::~gGraphView() } delete m_tooltip; m_graphs.clear(); + delete stippled; delete lines; delete backlines; delete quads; @@ -2214,6 +2241,7 @@ void gGraphView::paintGL() //((QGLContext*)context())->makeCurrent(); backlines->draw(); + stippled->draw(); for (int i=0;idrawGLBuf(); } diff --git a/Graphs/gGraphView.h b/Graphs/gGraphView.h index 99e9fcbb..fcab8427 100644 --- a/Graphs/gGraphView.h +++ b/Graphs/gGraphView.h @@ -42,7 +42,7 @@ const int textque_max=512; class GLBuffer { public: - GLBuffer(int max=2048,int type=GL_LINES); + GLBuffer(int max=2048,int type=GL_LINES,bool stippled=false); virtual ~GLBuffer(); void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { s1=x1; s2=y1; s3=x2; s4=y2; m_scissor=true; } virtual void draw(){} @@ -66,12 +66,13 @@ protected: bool m_antialias; bool m_forceantialias; QMutex mutex; + bool m_stippled; }; class GLShortBuffer:public GLBuffer { public: - GLShortBuffer(int max=2048,int type=GL_LINES); + GLShortBuffer(int max=2048,int type=GL_LINES, bool stippled=false); virtual ~GLShortBuffer(); // use one or the other.. can't use both @@ -96,7 +97,7 @@ protected: class GLFloatBuffer:public GLBuffer { public: - GLFloatBuffer(int max=2048,int type=GL_LINES); + GLFloatBuffer(int max=2048,int type=GL_LINES, bool stippled=false); virtual ~GLFloatBuffer(); void add(GLfloat x, GLfloat y,QColor & col); // add with vertex color @@ -358,6 +359,7 @@ public: GLShortBuffer * lines(); GLShortBuffer * backlines(); GLShortBuffer * quads(); + GLShortBuffer * stippled(); short left,right,top,bottom; // dirty magin hacks.. QRect m_lastbounds; @@ -467,7 +469,7 @@ public: QMutex dl_mutex; #endif void setDay(Day * day); - GLShortBuffer * lines, * backlines, *quads; + GLShortBuffer * lines, * backlines, *quads, * stippled; gGraph * popGraph(); // exposed for multithreaded drawing void hideSplitter() { m_showsplitter=false; } diff --git a/Graphs/gYAxis.cpp b/Graphs/gYAxis.cpp index 37f52990..e7a297a0 100644 --- a/Graphs/gYAxis.cpp +++ b/Graphs/gYAxis.cpp @@ -19,7 +19,9 @@ gXGrid::gXGrid(QColor col) :Layer("") { Q_UNUSED(col) - m_major_color=QColor(180,180,180,128); + + m_major_color=QColor(100,100,100,128); +// m_major_color=QColor(180,180,180,128); m_minor_color=QColor(220,220,220,128); m_show_major_lines=true; m_show_minor_lines=true; @@ -29,6 +31,8 @@ gXGrid::~gXGrid() } void gXGrid::paint(gGraph & w,int left,int top, int width, int height) { + GLShortBuffer * stippled, * lines; + int x,y; EventDataType miny=w.min_y; @@ -87,12 +91,13 @@ void gXGrid::paint(gGraph & w,int left,int top, int width, int height) } + stippled=w.stippled(); lines=w.backlines(); for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) { ty=(i - miny) * ymult; h=top+height-ty; if (m_show_major_lines && (i > miny)) { - lines->add(left,h,left+width,h,m_major_color); + stippled->add(left,h,left+width,h,m_major_color); } double z=(min_ytick/4)*ymult; double g=h; @@ -104,13 +109,13 @@ void gXGrid::paint(gGraph & w,int left,int top, int width, int height) // break; // } if (m_show_minor_lines) {// && (i > miny)) { - lines->add(left,g,left+width,g,m_minor_color); + stippled->add(left,g,left+width,g,m_minor_color); } - if (lines->full()) { + if (stippled->full()) { break; } } - if (lines->full()) { + if (lines->full() || stippled->full()) { qWarning() << "vertarray bounds exceeded in gYAxis for " << w.title() << "graph" << "MinY =" <exit(); @@ -1031,7 +1032,9 @@ void MainWindow::on_actionChange_User_triggered() //if (QDesktopServices::openUrl(apppath)) { // QApplication::instance()->exit(); //} else - if (QProcess::startDetached(apppath)) { + QStringList args; + args << "-p"; + if (QProcess::startDetached(apppath,args)) { QApplication::instance()->exit(); } else QMessageBox::warning(this,"Gah!","If you can read this, the restart command didn't work. Your going to have to do it yourself manually.",QMessageBox::Ok); #endif