mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-13 09:10:45 +00:00
Split humongous gGraphView.cpp into class-specific files.
Signed-off-by: Mark Watkins <jedimark@users.sourceforge.net>
This commit is contained in:
parent
3a7ce34b1c
commit
0899b39175
289
sleepyhead/Graphs/GLBuffer.cpp
Normal file
289
sleepyhead/Graphs/GLBuffer.cpp
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#include "Graphs/GLBuffer.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "SleepLib/profiles.h"
|
||||||
|
|
||||||
|
extern int lines_drawn_this_frame;
|
||||||
|
extern int quads_drawn_this_frame;
|
||||||
|
|
||||||
|
GLFloatBuffer::GLFloatBuffer(int max, int type, bool stippled)
|
||||||
|
: GLBuffer(max, type, stippled)
|
||||||
|
{
|
||||||
|
buffer = new GLfloat[max + 8];
|
||||||
|
colors = new GLubyte[max * 4 + (8 * 4)];
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFloatBuffer::~GLFloatBuffer()
|
||||||
|
{
|
||||||
|
if (colors) {
|
||||||
|
delete [] colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
delete [] buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFloatBuffer::add(GLfloat x, GLfloat y, QColor &color)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.lock();
|
||||||
|
#endif
|
||||||
|
if (m_cnt < m_max + 2) {
|
||||||
|
buffer[m_cnt++] = x;
|
||||||
|
buffer[m_cnt++] = y;
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
qDebug() << "GLBuffer overflow";
|
||||||
|
}
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.unlock();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFloatBuffer::add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, QColor &color)
|
||||||
|
{
|
||||||
|
if (m_cnt < m_max + 4) {
|
||||||
|
qDebug() << "GLFloatBuffer overflow";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.lock();
|
||||||
|
#endif
|
||||||
|
buffer[m_cnt++] = x1;
|
||||||
|
buffer[m_cnt++] = y1;
|
||||||
|
buffer[m_cnt++] = x2;
|
||||||
|
buffer[m_cnt++] = y2;
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.unlock();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFloatBuffer::add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3,
|
||||||
|
GLfloat x4, GLfloat y4, QColor &color) // add with vertex colors
|
||||||
|
{
|
||||||
|
if (m_cnt >= m_max + 8) {
|
||||||
|
qDebug() << "GLFloatBuffer overflow";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.lock();
|
||||||
|
#endif
|
||||||
|
buffer[m_cnt++] = x1;
|
||||||
|
buffer[m_cnt++] = y1;
|
||||||
|
buffer[m_cnt++] = x2;
|
||||||
|
buffer[m_cnt++] = y2;
|
||||||
|
buffer[m_cnt++] = x3;
|
||||||
|
buffer[m_cnt++] = y3;
|
||||||
|
buffer[m_cnt++] = x4;
|
||||||
|
buffer[m_cnt++] = y4;
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.unlock();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFloatBuffer::quadGrLR(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3,
|
||||||
|
GLfloat y3, GLfloat x4, GLfloat y4, QColor &color, QColor &color2) // add with vertex colors
|
||||||
|
{
|
||||||
|
if (m_cnt >= m_max + 8) {
|
||||||
|
qDebug() << "GLFloatBuffer overflow";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.lock();
|
||||||
|
#endif
|
||||||
|
buffer[m_cnt++] = x1;
|
||||||
|
buffer[m_cnt++] = y1;
|
||||||
|
buffer[m_cnt++] = x2;
|
||||||
|
buffer[m_cnt++] = y2;
|
||||||
|
buffer[m_cnt++] = x3;
|
||||||
|
buffer[m_cnt++] = y3;
|
||||||
|
buffer[m_cnt++] = x4;
|
||||||
|
buffer[m_cnt++] = y4;
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
|
||||||
|
colors[m_colcnt++] = color2.red();
|
||||||
|
colors[m_colcnt++] = color2.green();
|
||||||
|
colors[m_colcnt++] = color2.blue();
|
||||||
|
colors[m_colcnt++] = color2.alpha();
|
||||||
|
colors[m_colcnt++] = color2.red();
|
||||||
|
colors[m_colcnt++] = color2.green();
|
||||||
|
colors[m_colcnt++] = color2.blue();
|
||||||
|
colors[m_colcnt++] = color2.alpha();
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.unlock();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
void GLFloatBuffer::quadGrTB(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3,
|
||||||
|
GLfloat y3, GLfloat x4, GLfloat y4, QColor &color, QColor &color2)
|
||||||
|
{
|
||||||
|
if (m_cnt >= m_max + 8) {
|
||||||
|
qDebug() << "GLFloatBuffer overflow";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.lock();
|
||||||
|
#endif
|
||||||
|
buffer[m_cnt++] = x1;
|
||||||
|
buffer[m_cnt++] = y1;
|
||||||
|
buffer[m_cnt++] = x3;
|
||||||
|
buffer[m_cnt++] = y3;
|
||||||
|
buffer[m_cnt++] = x2;
|
||||||
|
buffer[m_cnt++] = y2;
|
||||||
|
buffer[m_cnt++] = x4;
|
||||||
|
buffer[m_cnt++] = y4;
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
colors[m_colcnt++] = color.red();
|
||||||
|
colors[m_colcnt++] = color.green();
|
||||||
|
colors[m_colcnt++] = color.blue();
|
||||||
|
colors[m_colcnt++] = color.alpha();
|
||||||
|
|
||||||
|
colors[m_colcnt++] = color2.red();
|
||||||
|
colors[m_colcnt++] = color2.green();
|
||||||
|
colors[m_colcnt++] = color2.blue();
|
||||||
|
colors[m_colcnt++] = color2.alpha();
|
||||||
|
colors[m_colcnt++] = color2.red();
|
||||||
|
colors[m_colcnt++] = color2.green();
|
||||||
|
colors[m_colcnt++] = color2.blue();
|
||||||
|
colors[m_colcnt++] = color2.alpha();
|
||||||
|
#ifdef ENABLE_THREADED_DRAWING
|
||||||
|
mutex.unlock();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFloatBuffer::draw()
|
||||||
|
{
|
||||||
|
if (m_cnt <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool antialias = m_forceantialias || (PROFILE.appearance->antiAliasing() && m_antialias);
|
||||||
|
float size = m_size;
|
||||||
|
|
||||||
|
if (antialias) {
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(m_blendfunc1, m_blendfunc2);
|
||||||
|
|
||||||
|
if (m_type == GL_LINES || m_type == GL_LINE_LOOP) {
|
||||||
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
size += 0.5;
|
||||||
|
} else if (m_type == GL_POLYGON) {
|
||||||
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_type == GL_LINES || m_type == GL_LINE_LOOP) {
|
||||||
|
glLineWidth(size);
|
||||||
|
|
||||||
|
if (m_stippled) {
|
||||||
|
glLineStipple(1, 0xAAAA);
|
||||||
|
glEnable(GL_LINE_STIPPLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
lines_drawn_this_frame += m_cnt / 2;
|
||||||
|
} else if (m_type == GL_POINTS) {
|
||||||
|
glPointSize(size);
|
||||||
|
} else if (m_type == GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK, GL_FILL);
|
||||||
|
lines_drawn_this_frame += m_cnt / 2;
|
||||||
|
} else if (m_type == GL_QUADS) {
|
||||||
|
quads_drawn_this_frame += m_cnt / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_scissor) {
|
||||||
|
glScissor(s1, s2, s3, s4);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
glVertexPointer(2, GL_FLOAT, 0, buffer);
|
||||||
|
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
|
||||||
|
|
||||||
|
//glColor4ub(200,128,95,200);
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
|
||||||
|
glDrawArrays(m_type, 0, m_cnt >> 1);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
|
//qDebug() << "I Drew" << m_cnt << "vertices";
|
||||||
|
m_cnt = 0;
|
||||||
|
m_colcnt = 0;
|
||||||
|
|
||||||
|
if (m_scissor) {
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
m_scissor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_type == GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK, GL_FILL);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
}
|
100
sleepyhead/Graphs/GLBuffer.h
Normal file
100
sleepyhead/Graphs/GLBuffer.h
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#ifndef graphs_glbuffer_h
|
||||||
|
#define graphs_glbuffer_h
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QGLWidget>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
|
/*! \class GLBuffer
|
||||||
|
\brief Base Object to hold an OpenGL draw list
|
||||||
|
*/
|
||||||
|
class GLBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLBuffer(int max = 2048, int type = GL_LINES, bool stippled = false)
|
||||||
|
: m_max(max), m_type(type), m_cnt(0), m_colcnt(0), m_size(1),
|
||||||
|
s1(0), s2(0), s3(0), s4(0),
|
||||||
|
m_scissor(false),
|
||||||
|
m_antialias(true),
|
||||||
|
m_forceantialias(false),
|
||||||
|
m_stippled(stippled),
|
||||||
|
m_blendfunc1(GL_SRC_ALPHA),
|
||||||
|
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA)
|
||||||
|
{ }
|
||||||
|
virtual ~GLBuffer() {}
|
||||||
|
|
||||||
|
void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) {
|
||||||
|
s1 = x1;
|
||||||
|
s2 = y1;
|
||||||
|
s3 = x2;
|
||||||
|
s4 = y2;
|
||||||
|
m_scissor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Max() const { return m_max; }
|
||||||
|
int cnt() const { return m_cnt; }
|
||||||
|
bool full() const { return m_cnt >= m_max; }
|
||||||
|
float size() const { return m_size; }
|
||||||
|
int type() const { return m_type; }
|
||||||
|
|
||||||
|
void reset() { m_cnt = 0; }
|
||||||
|
void setSize(float f) { m_size = f; }
|
||||||
|
void setAntiAlias(bool b) { m_antialias = b; }
|
||||||
|
void forceAntiAlias(bool b) { m_forceantialias = b; }
|
||||||
|
void setColor(QColor col) { m_color = col; }
|
||||||
|
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
|
||||||
|
|
||||||
|
virtual void draw() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_max;
|
||||||
|
int m_type; // type (GL_LINES, GL_QUADS, etc)
|
||||||
|
int m_cnt; // cnt
|
||||||
|
int m_colcnt;
|
||||||
|
QColor m_color;
|
||||||
|
float m_size;
|
||||||
|
int s1, s2, s3, s4;
|
||||||
|
bool m_scissor;
|
||||||
|
bool m_antialias;
|
||||||
|
bool m_forceantialias;
|
||||||
|
QMutex mutex;
|
||||||
|
bool m_stippled;
|
||||||
|
GLuint m_blendfunc1, m_blendfunc2;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! \class GLFloatBuffer
|
||||||
|
\brief Holds an OpenGL draw list composed of 32bit GLfloat objects and vertex colors
|
||||||
|
*/
|
||||||
|
class GLFloatBuffer : public GLBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLFloatBuffer(int max = 2048, int type = GL_LINES, bool stippled = false);
|
||||||
|
virtual ~GLFloatBuffer();
|
||||||
|
|
||||||
|
// Add with vertex color(s).
|
||||||
|
void add(GLfloat x, GLfloat y, QColor &col);
|
||||||
|
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, QColor &col);
|
||||||
|
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
||||||
|
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col);
|
||||||
|
void quadGrTB(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
||||||
|
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
|
||||||
|
void quadGrLR(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
||||||
|
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
|
||||||
|
|
||||||
|
virtual void draw();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GLfloat *buffer;
|
||||||
|
GLubyte *colors;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // graphs_glbuffer_h
|
@ -9,9 +9,13 @@
|
|||||||
* License. See the file COPYING in the main directory of the Linux
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
* distribution for more details. */
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#include "Graphs/gFooBar.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "gFooBar.h"
|
|
||||||
#include "gYAxis.h"
|
#include "Graphs/gGraph.h"
|
||||||
|
#include "Graphs/gVertexBuffer.h"
|
||||||
|
#include "Graphs/gYAxis.h"
|
||||||
|
|
||||||
gShadowArea::gShadowArea(QColor shadow_color, QColor line_color)
|
gShadowArea::gShadowArea(QColor shadow_color, QColor line_color)
|
||||||
: Layer(NoChannel), m_shadow_color(shadow_color), m_line_color(line_color)
|
: Layer(NoChannel), m_shadow_color(shadow_color), m_line_color(line_color)
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
#ifndef GFOOBAR_H
|
#ifndef GFOOBAR_H
|
||||||
#define GFOOBAR_H
|
#define GFOOBAR_H
|
||||||
|
|
||||||
#include "gGraphView.h"
|
#include "Graphs/gVertexBuffer.h"
|
||||||
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
/*! \class gShadowArea
|
/*! \class gShadowArea
|
||||||
\brief Displays a Shadow for all graph areas not highlighted (used in Event Flags)
|
\brief Displays a Shadow for all graph areas not highlighted (used in Event Flags)
|
||||||
|
1426
sleepyhead/Graphs/gGraph.cpp
Normal file
1426
sleepyhead/Graphs/gGraph.cpp
Normal file
File diff suppressed because it is too large
Load Diff
371
sleepyhead/Graphs/gGraph.h
Normal file
371
sleepyhead/Graphs/gGraph.h
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#ifndef graphs_ggraph_h
|
||||||
|
#define graphs_ggraph_h
|
||||||
|
|
||||||
|
#include <QFont>
|
||||||
|
#include <QGLFramebufferObject>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
|
class gGraphView;
|
||||||
|
|
||||||
|
// Graph globals.
|
||||||
|
extern QFont *defaultfont;
|
||||||
|
extern QFont *mediumfont;
|
||||||
|
extern QFont *bigfont;
|
||||||
|
extern QHash<QString, QImage *> images;
|
||||||
|
extern bool fbo_unsupported;
|
||||||
|
extern QGLFramebufferObject *fbo;
|
||||||
|
|
||||||
|
bool InitGraphGlobals();
|
||||||
|
void DestroyGraphGlobals();
|
||||||
|
|
||||||
|
const int max_fbo_width = 2048;
|
||||||
|
const int max_fbo_height = 2048;
|
||||||
|
const int mouse_movement_threshold = 6;
|
||||||
|
|
||||||
|
/*! \class gGraph
|
||||||
|
\brief Single Graph object, containing multiple layers and Layer layout code
|
||||||
|
*/
|
||||||
|
class gGraph : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
public:
|
||||||
|
friend class gGraphView;
|
||||||
|
|
||||||
|
/*! \brief Creates a new graph object
|
||||||
|
\param gGraphView * graphview if not null, links the graph to that object
|
||||||
|
\param QString title containing the graph Title which is rendered vertically
|
||||||
|
\param int height containing the opening height for this graph
|
||||||
|
\param short group containing which graph-link group this graph belongs to
|
||||||
|
*/
|
||||||
|
gGraph(gGraphView *graphview = nullptr, QString title = "", QString units = "",
|
||||||
|
int height = 100, short group = 0);
|
||||||
|
virtual ~gGraph();
|
||||||
|
|
||||||
|
//! \brief Tells all Layers to deselect any highlighting
|
||||||
|
void deselect();
|
||||||
|
|
||||||
|
//! \brief Returns true if any Layers have anything highlighted
|
||||||
|
bool isSelected();
|
||||||
|
|
||||||
|
//! \brief Starts the singleshot Timer running, for ms milliseconds
|
||||||
|
void Trigger(int ms);
|
||||||
|
|
||||||
|
/*! \fn QPixmap renderPixmap(int width, int height, float fontscale=1.0);
|
||||||
|
\brief Returns a QPixmap containing a snapshot of the graph rendered at size widthxheight
|
||||||
|
\param int width Width of graph 'screenshot'
|
||||||
|
\param int height Height of graph 'screenshot'
|
||||||
|
\param float fontscale Scaling value to adjust DPI (when used for HighRes printing)
|
||||||
|
|
||||||
|
Note if width or height is more than the OpenGL system allows, it could result in a crash
|
||||||
|
Keeping them under 2048 is a reasonably safe value.
|
||||||
|
*/
|
||||||
|
QPixmap renderPixmap(int width, int height, bool printing = false);
|
||||||
|
|
||||||
|
//! \brief Set Graph visibility status
|
||||||
|
void setVisible(bool b) { m_visible = b; }
|
||||||
|
|
||||||
|
//! \brief Return Graph visibility status
|
||||||
|
bool visible() { return m_visible; }
|
||||||
|
|
||||||
|
//! \brief Return height element. This is used by the scaler in gGraphView.
|
||||||
|
float height() { return m_height; }
|
||||||
|
|
||||||
|
//! \brief Set the height element. (relative to the total of all heights)
|
||||||
|
void setHeight(float height) { m_height = height; invalidate_yAxisImage = true; }
|
||||||
|
|
||||||
|
int minHeight() { return m_min_height; }
|
||||||
|
void setMinHeight(int height) { m_min_height = height; }
|
||||||
|
|
||||||
|
int maxHeight() { return m_max_height; }
|
||||||
|
void setMaxHeight(int height) { m_max_height = height; }
|
||||||
|
|
||||||
|
//! \brief Returns true if the vertical graph title is shown
|
||||||
|
bool showTitle() { return m_showTitle; }
|
||||||
|
|
||||||
|
//! \brief Set whether or not to render the vertical graph title
|
||||||
|
void setShowTitle(bool b) { m_showTitle = b; }
|
||||||
|
|
||||||
|
//! \brief Returns printScaleX, used for DPI scaling in report printing
|
||||||
|
float printScaleX();
|
||||||
|
|
||||||
|
//! \brief Returns printScaleY, used for DPI scaling in report printing
|
||||||
|
float printScaleY();
|
||||||
|
|
||||||
|
//! \brief Returns true if none of the included layers have data attached
|
||||||
|
bool isEmpty();
|
||||||
|
|
||||||
|
//! \brief Add Layer l to graph object, allowing you to specify position,
|
||||||
|
// margin sizes, order, movability status and offsets
|
||||||
|
void AddLayer(Layer *l, LayerPosition position = LayerCenter,
|
||||||
|
short pixelsX = 0, short pixelsY = 0, short order = 0,
|
||||||
|
bool movable = false, short x = 0, short y = 0);
|
||||||
|
|
||||||
|
void qglColor(QColor col);
|
||||||
|
|
||||||
|
//! \brief Queues text for gGraphView object to draw it.
|
||||||
|
void renderText(QString text, int x, int y, float angle = 0.0,
|
||||||
|
QColor color = Qt::black, QFont *font = defaultfont, bool antialias = true);
|
||||||
|
|
||||||
|
//! \brief Rounds Y scale values to make them look nice..
|
||||||
|
// Applies the Graph Preference min/max settings.
|
||||||
|
void roundY(EventDataType &miny, EventDataType &maxy);
|
||||||
|
|
||||||
|
//! \brief Process all Layers GLBuffer (Vertex) objects, drawing the actual OpenGL stuff.
|
||||||
|
void drawGLBuf();
|
||||||
|
|
||||||
|
//! \brief Returns the Graph's (vertical) title
|
||||||
|
QString title() { return m_title; }
|
||||||
|
|
||||||
|
//! \brief Sets the Graph's (vertical) title
|
||||||
|
void setTitle(const QString title) { m_title = title; }
|
||||||
|
|
||||||
|
//! \brief Returns the measurement Units the Y scale is referring to
|
||||||
|
QString units() { return m_units; }
|
||||||
|
|
||||||
|
//! \brief Sets the measurement Units the Y scale is referring to
|
||||||
|
void setUnits(const QString units) { m_units = units; }
|
||||||
|
|
||||||
|
//virtual void repaint(); // Repaint individual graph..
|
||||||
|
|
||||||
|
//! \brief Resets the graphs X & Y dimensions based on the Layer data
|
||||||
|
virtual void ResetBounds();
|
||||||
|
|
||||||
|
//! \brief Sets the time range selected for this graph (in milliseconds since 1970 epoch)
|
||||||
|
virtual void SetXBounds(qint64 minx, qint64 maxx);
|
||||||
|
|
||||||
|
//! \brief Returns the physical Minimum time for all layers contained (in milliseconds since epoch)
|
||||||
|
virtual qint64 MinX();
|
||||||
|
|
||||||
|
//! \brief Returns the physical Maximum time for all layers contained (in milliseconds since epoch)
|
||||||
|
virtual qint64 MaxX();
|
||||||
|
|
||||||
|
//! \brief Returns the physical Minimum Y scale value for all layers contained
|
||||||
|
virtual EventDataType MinY();
|
||||||
|
|
||||||
|
//! \brief Returns the physical Maximum Y scale value for all layers contained
|
||||||
|
virtual EventDataType MaxY();
|
||||||
|
|
||||||
|
//! \brief Returns the physical Minimum Y scale value for all layers contained
|
||||||
|
virtual EventDataType physMinY();
|
||||||
|
|
||||||
|
//! \brief Returns the physical Maximum Y scale value for all layers contained
|
||||||
|
virtual EventDataType physMaxY();
|
||||||
|
|
||||||
|
//! \brief Sets the physical start of this graphs time range (in milliseconds since epoch)
|
||||||
|
virtual void SetMinX(qint64 v);
|
||||||
|
|
||||||
|
//! \brief Sets the physical end of this graphs time range (in milliseconds since epoch)
|
||||||
|
virtual void SetMaxX(qint64 v);
|
||||||
|
|
||||||
|
//! \brief Sets the physical Minimum Y scale value used while drawing this graph
|
||||||
|
virtual void SetMinY(EventDataType v);
|
||||||
|
|
||||||
|
//! \brief Sets the physical Maximum Y scale value used while drawing this graph
|
||||||
|
virtual void SetMaxY(EventDataType v);
|
||||||
|
|
||||||
|
//! \brief Forces Y Minimum to always select this value
|
||||||
|
virtual void setForceMinY(EventDataType v) { f_miny = v; m_enforceMinY = true; }
|
||||||
|
//! \brief Forces Y Maximum to always select this value
|
||||||
|
virtual void setForceMaxY(EventDataType v) { f_maxy = v; m_enforceMaxY = true; }
|
||||||
|
|
||||||
|
|
||||||
|
virtual EventDataType forceMinY() { return rec_miny; }
|
||||||
|
virtual EventDataType forceMaxY() { return rec_maxy; }
|
||||||
|
|
||||||
|
//! \brief Set recommended Y minimum.. It won't go under this unless the data does.
|
||||||
|
// It won't go above this.
|
||||||
|
virtual void setRecMinY(EventDataType v) { rec_miny = v; }
|
||||||
|
//! \brief Set recommended Y minimum.. It won't go above this unless the data does.
|
||||||
|
// It won't go under this.
|
||||||
|
virtual void setRecMaxY(EventDataType v) { rec_maxy = v; }
|
||||||
|
|
||||||
|
//! \brief Returns the recommended Y minimum.. It won't go under this unless the data does.
|
||||||
|
// It won't go above this.
|
||||||
|
virtual EventDataType RecMinY() { return rec_miny; }
|
||||||
|
//! \brief Returns the recommended Y maximum.. It won't go under this unless the data does.
|
||||||
|
// It won't go above this.
|
||||||
|
virtual EventDataType RecMaxY() { return rec_maxy; }
|
||||||
|
|
||||||
|
//! \brief Called when main graph area is resized
|
||||||
|
void resize(int width, int height); // margin recalcs..
|
||||||
|
|
||||||
|
qint64 max_x, min_x, rmax_x, rmin_x;
|
||||||
|
EventDataType max_y, min_y, rmax_y, rmin_y, f_miny, f_maxy, rec_miny, rec_maxy;
|
||||||
|
EventDataType rphysmin_y, rphysmax_y;
|
||||||
|
|
||||||
|
// not sure why there's two.. I can't remember
|
||||||
|
void setEnforceMinY(bool b) { m_enforceMinY = b; }
|
||||||
|
void setEnforceMaxY(bool b) { m_enforceMaxY = b; }
|
||||||
|
|
||||||
|
//! \brief Returns whether this graph shows overall timescale, or a zoomed area
|
||||||
|
bool blockZoom() { return m_blockzoom; }
|
||||||
|
//! \brief Sets whether this graph shows an overall timescale, or a zoomed area.
|
||||||
|
void setBlockZoom(bool b) { m_blockzoom = b; }
|
||||||
|
|
||||||
|
//! \brief Flips the GL coordinates from the graphs perspective.. Used in Scissor calculations
|
||||||
|
int flipY(int y); // flip GL coordinates
|
||||||
|
|
||||||
|
//! \brief Returns the graph-linking group this Graph belongs in
|
||||||
|
short group() { return m_group; }
|
||||||
|
|
||||||
|
//! \brief Sets the graph-linking group this Graph belongs in
|
||||||
|
void setGroup(short group) { m_group = group; }
|
||||||
|
|
||||||
|
//! \brief Forces the main gGraphView object to draw all Text Components
|
||||||
|
void DrawTextQue();
|
||||||
|
|
||||||
|
//! \brief Sends supplied day object to all Graph layers so they can precalculate stuff
|
||||||
|
void setDay(Day *day);
|
||||||
|
|
||||||
|
//! \brief Returns the current day object
|
||||||
|
Day *day() { return m_day; }
|
||||||
|
|
||||||
|
//! \brief The Layer, layout and title drawing code
|
||||||
|
virtual void paint(int originX, int originY, int width, int height);
|
||||||
|
|
||||||
|
//! \brief Gives the supplied data to the main ToolTip object for display
|
||||||
|
void ToolTip(QString text, int x, int y, int timeout = 0);
|
||||||
|
|
||||||
|
//! \brief Public version of updateGL(), to redraw all graphs.. Not for normal use
|
||||||
|
void redraw();
|
||||||
|
|
||||||
|
//! \brief Asks the main gGraphView to redraw after ms milliseconds
|
||||||
|
void timedRedraw(int ms);
|
||||||
|
|
||||||
|
//! \brief Sets the margins for the four sides of this graph.
|
||||||
|
void setMargins(short left, short right, short top, short bottom) {
|
||||||
|
m_marginleft = left;
|
||||||
|
m_marginright = right;
|
||||||
|
m_margintop = top;
|
||||||
|
m_marginbottom = bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Returns this graphs left margin
|
||||||
|
short marginLeft();
|
||||||
|
//! \brief Returns this graphs right margin
|
||||||
|
short marginRight();
|
||||||
|
//! \brief Returns this graphs top margin
|
||||||
|
short marginTop();
|
||||||
|
//! \brief Returns this graphs bottom margin
|
||||||
|
short marginBottom();
|
||||||
|
|
||||||
|
//! \brief Returns the main gGraphView objects gVertexBuffer line list.
|
||||||
|
gVertexBuffer *lines();
|
||||||
|
//! \brief Returns the main gGraphView objects gVertexBuffer background line list.
|
||||||
|
gVertexBuffer *backlines();
|
||||||
|
//! \brief Returns the main gGraphView objects gVertexBuffer front line list.
|
||||||
|
gVertexBuffer *frontlines();
|
||||||
|
//! \brief Returns the main gGraphView objects gVertexBuffer quads list.
|
||||||
|
gVertexBuffer *quads();
|
||||||
|
|
||||||
|
const inline QRect &rect() const { return m_rect; }
|
||||||
|
|
||||||
|
bool isPinned() { return m_pinned; }
|
||||||
|
void setPinned(bool b) { m_pinned = b; }
|
||||||
|
|
||||||
|
// //! \brief Returns the main gGraphView objects gVertexBuffer stippled line list.
|
||||||
|
//GLShortBuffer * stippled();
|
||||||
|
|
||||||
|
//gVertexBuffer * vlines(); // testing new vertexbuffer
|
||||||
|
|
||||||
|
short left, right, top, bottom; // dirty magin hacks..
|
||||||
|
|
||||||
|
Layer *getLineChart();
|
||||||
|
QTimer *timer;
|
||||||
|
|
||||||
|
// This gets set to true to force a redraw of the yAxis tickers when graphs are resized.
|
||||||
|
bool invalidate_yAxisImage;
|
||||||
|
bool invalidate_xAxisImage;
|
||||||
|
|
||||||
|
//! \brief Returns a Vector reference containing all this graphs layers
|
||||||
|
QVector<Layer *> &layers() { return m_layers; }
|
||||||
|
|
||||||
|
gGraphView *graphView() { return m_graphview; }
|
||||||
|
short m_marginleft, m_marginright, m_margintop, m_marginbottom;
|
||||||
|
|
||||||
|
short zoomY() { return m_zoomY; }
|
||||||
|
void setZoomY(short zoom);
|
||||||
|
|
||||||
|
static const short maxZoomY = 2;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \brief Mouse Wheel events
|
||||||
|
virtual void wheelEvent(QWheelEvent *event);
|
||||||
|
|
||||||
|
//! \brief Mouse Movement events
|
||||||
|
virtual void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
//! \brief Mouse Button Pressed events
|
||||||
|
virtual void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
//! \brief Mouse Button Released events
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
//! \brief Mouse Button Double Clicked events
|
||||||
|
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
//! \brief Key Pressed event
|
||||||
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
//! \brief Change the current selected time boundaries by mult, from origin position origin_px
|
||||||
|
void ZoomX(double mult, int origin_px);
|
||||||
|
|
||||||
|
//! \brief The Main gGraphView object holding this graph
|
||||||
|
// (this can be pinched temporarily by print code)
|
||||||
|
gGraphView *m_graphview;
|
||||||
|
QString m_title;
|
||||||
|
QString m_units;
|
||||||
|
|
||||||
|
//! \brief Vector containing all this graphs Layers
|
||||||
|
QVector<Layer *> m_layers;
|
||||||
|
float m_height, m_width;
|
||||||
|
|
||||||
|
int m_min_height;
|
||||||
|
int m_max_height;
|
||||||
|
bool m_visible;
|
||||||
|
bool m_blockzoom;
|
||||||
|
QRect m_selection;
|
||||||
|
bool m_selecting_area;
|
||||||
|
QPoint m_current;
|
||||||
|
short m_group;
|
||||||
|
short m_lastx23;
|
||||||
|
Day *m_day;
|
||||||
|
gVertexBuffer *m_quad;
|
||||||
|
bool m_enforceMinY, m_enforceMaxY;
|
||||||
|
bool m_showTitle;
|
||||||
|
bool m_printing;
|
||||||
|
bool m_pinned;
|
||||||
|
short m_zoomY;
|
||||||
|
QRect m_rect;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
//! \brief Deselects any highlights, and schedules a main gGraphView redraw
|
||||||
|
void Timeout();
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! \brief Gets the width and height parameters for supplied text
|
||||||
|
\param QString text - The text string in question
|
||||||
|
\param int & width
|
||||||
|
\param int & height
|
||||||
|
\param QFont * font - The selected font used in the size calculations
|
||||||
|
*/
|
||||||
|
void GetTextExtent(QString text, int &width, int &height, QFont *font = defaultfont);
|
||||||
|
|
||||||
|
//! \brief Return the height of the letter x for the selected font.
|
||||||
|
int GetXHeight(QFont *font = defaultfont);
|
||||||
|
|
||||||
|
#endif // graphs_ggraph_h
|
File diff suppressed because it is too large
Load Diff
@ -22,270 +22,16 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
|
#include <Graphs/gGraph.h>
|
||||||
#include <Graphs/glcommon.h>
|
#include <Graphs/glcommon.h>
|
||||||
#include <SleepLib/day.h>
|
#include <SleepLib/day.h>
|
||||||
|
|
||||||
#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
|
||||||
#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
|
||||||
|
|
||||||
enum FlagType { FT_Bar, FT_Dot, FT_Span };
|
enum FlagType { FT_Bar, FT_Dot, FT_Span };
|
||||||
|
|
||||||
//! \brief Initialize the Graph Fonts
|
|
||||||
void InitGraphs();
|
|
||||||
//! \brief Destroy the Graph Fonts
|
|
||||||
void DoneGraphs();
|
|
||||||
|
|
||||||
extern QFont *defaultfont;
|
|
||||||
extern QFont *mediumfont;
|
|
||||||
extern QFont *bigfont;
|
|
||||||
|
|
||||||
extern QHash<QString, QImage *> images;
|
|
||||||
|
|
||||||
/*! \brief Gets the width and height parameters for supplied text
|
|
||||||
\param QString text - The text string in question
|
|
||||||
\param int & width
|
|
||||||
\param int & height
|
|
||||||
\param QFont * font - The selected font used in the size calculations
|
|
||||||
*/
|
|
||||||
void GetTextExtent(QString text, int &width, int &height, QFont *font = defaultfont);
|
|
||||||
|
|
||||||
//! \brief Return the height of the letter x for the selected font.
|
|
||||||
int GetXHeight(QFont *font = defaultfont);
|
|
||||||
|
|
||||||
class gGraphView;
|
class gGraphView;
|
||||||
class gGraph;
|
|
||||||
|
|
||||||
const int textque_max = 512;
|
const int textque_max = 512;
|
||||||
|
|
||||||
typedef quint32 RGBA;
|
|
||||||
/*union RGBA {
|
|
||||||
struct {
|
|
||||||
GLubyte red;
|
|
||||||
GLubyte green;
|
|
||||||
GLubyte blue;
|
|
||||||
GLubyte alpha;
|
|
||||||
} bytes;
|
|
||||||
quint32 value;
|
|
||||||
}; */
|
|
||||||
|
|
||||||
#ifdef BUILD_WITH_MSVC
|
|
||||||
__declspec(align(1))
|
|
||||||
#endif
|
|
||||||
struct gVertex {
|
|
||||||
gVertex(GLshort _x, GLshort _y, GLuint _c) { x = _x; y = _y; color = _c; }
|
|
||||||
GLshort x;
|
|
||||||
GLshort y;
|
|
||||||
RGBA color;
|
|
||||||
}
|
|
||||||
#ifndef BUILD_WITH_MSVC
|
|
||||||
__attribute__((packed))
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
class gVertexBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
gVertexBuffer(int max = 2048, int type = GL_LINES)
|
|
||||||
: m_max(max), m_type(type), m_cnt(0), m_size(1),
|
|
||||||
m_scissor(false), m_antialias(false), m_forceantialias(false), m_stippled(false),
|
|
||||||
buffer(nullptr),
|
|
||||||
s_x(0), s_y(0), s_width(0), s_height(0),
|
|
||||||
m_color(0),
|
|
||||||
m_stipple(0xffff),
|
|
||||||
m_blendfunc1(GL_SRC_ALPHA),
|
|
||||||
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA) {
|
|
||||||
// FIXME: Really should not allocate in constructor.
|
|
||||||
buffer = (gVertex *)calloc(max, sizeof(gVertex));
|
|
||||||
}
|
|
||||||
|
|
||||||
~gVertexBuffer() {
|
|
||||||
if (buffer) {
|
|
||||||
free(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void add(GLshort x1, GLshort y1, RGBA color);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
|
||||||
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
|
||||||
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color, RGBA color2);
|
|
||||||
|
|
||||||
void add(GLshort x1, GLshort y1);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
|
||||||
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
|
||||||
|
|
||||||
void unsafe_add(GLshort x1, GLshort y1);
|
|
||||||
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
|
||||||
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
|
||||||
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
|
||||||
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
void scissor(GLshort x, GLshort y, GLshort width, GLshort height) {
|
|
||||||
s_x = x;
|
|
||||||
s_y = y;
|
|
||||||
s_width = width;
|
|
||||||
s_height = height;
|
|
||||||
m_scissor = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Max() const { return m_max; }
|
|
||||||
int cnt() const { return m_cnt; }
|
|
||||||
GLuint type() const { return m_type; }
|
|
||||||
float size() const { return m_size; }
|
|
||||||
bool full() const { return m_cnt >= m_max; }
|
|
||||||
|
|
||||||
void reset() { m_cnt = 0; }
|
|
||||||
void forceAntiAlias(bool b) { m_forceantialias = b; }
|
|
||||||
void setSize(float f) { m_size = f; }
|
|
||||||
void setAntiAlias(bool b) { m_antialias = b; }
|
|
||||||
void setStipple(GLshort stipple) { m_stipple = stipple; }
|
|
||||||
void setStippleOn(bool b) { m_stippled = b; }
|
|
||||||
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
|
|
||||||
void setColor(QColor col);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! \brief Maximum number of gVertex points contained in buffer
|
|
||||||
int m_max;
|
|
||||||
//! \brief Indicates type of GL vertex information (GL_LINES, GL_QUADS, etc)
|
|
||||||
GLuint m_type;
|
|
||||||
//! \brief Count of Vertex points used this draw cycle.
|
|
||||||
int m_cnt;
|
|
||||||
//! \brief Line/Point thickness
|
|
||||||
float m_size;
|
|
||||||
|
|
||||||
bool m_scissor;
|
|
||||||
bool m_antialias;
|
|
||||||
bool m_forceantialias;
|
|
||||||
bool m_stippled;
|
|
||||||
|
|
||||||
//! \brief Contains list of Vertex & Color points
|
|
||||||
gVertex *buffer;
|
|
||||||
//! \brief GL Scissor parameters
|
|
||||||
GLshort s_x, s_y, s_width, s_height;
|
|
||||||
//! \brief Current drawing color
|
|
||||||
GLuint m_color;
|
|
||||||
//! \brief Stipple bitfield
|
|
||||||
GLshort m_stipple;
|
|
||||||
//! \brief Source GL Blend Function
|
|
||||||
GLuint m_blendfunc1;
|
|
||||||
//! \brief Destination GL Blend Function
|
|
||||||
GLuint m_blendfunc2;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! \class GLBuffer
|
|
||||||
\brief Base Object to hold an OpenGL draw list
|
|
||||||
*/
|
|
||||||
class GLBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GLBuffer(int max = 2048, int type = GL_LINES, bool stippled = false)
|
|
||||||
: m_max(max), m_type(type), m_cnt(0), m_colcnt(0), m_size(1),
|
|
||||||
s1(0), s2(0), s3(0), s4(0),
|
|
||||||
m_scissor(false),
|
|
||||||
m_antialias(true),
|
|
||||||
m_forceantialias(false),
|
|
||||||
m_stippled(stippled),
|
|
||||||
m_blendfunc1(GL_SRC_ALPHA),
|
|
||||||
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA)
|
|
||||||
{ }
|
|
||||||
virtual ~GLBuffer() {}
|
|
||||||
|
|
||||||
void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) {
|
|
||||||
s1 = x1;
|
|
||||||
s2 = y1;
|
|
||||||
s3 = x2;
|
|
||||||
s4 = y2;
|
|
||||||
m_scissor = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Max() const { return m_max; }
|
|
||||||
int cnt() const { return m_cnt; }
|
|
||||||
bool full() const { return m_cnt >= m_max; }
|
|
||||||
float size() const { return m_size; }
|
|
||||||
int type() const { return m_type; }
|
|
||||||
|
|
||||||
void reset() { m_cnt = 0; }
|
|
||||||
void setSize(float f) { m_size = f; }
|
|
||||||
void setAntiAlias(bool b) { m_antialias = b; }
|
|
||||||
void forceAntiAlias(bool b) { m_forceantialias = b; }
|
|
||||||
void setColor(QColor col) { m_color = col; }
|
|
||||||
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
|
|
||||||
|
|
||||||
virtual void draw() {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_max;
|
|
||||||
int m_type; // type (GL_LINES, GL_QUADS, etc)
|
|
||||||
int m_cnt; // cnt
|
|
||||||
int m_colcnt;
|
|
||||||
QColor m_color;
|
|
||||||
float m_size;
|
|
||||||
int s1, s2, s3, s4;
|
|
||||||
bool m_scissor;
|
|
||||||
bool m_antialias;
|
|
||||||
bool m_forceantialias;
|
|
||||||
QMutex mutex;
|
|
||||||
bool m_stippled;
|
|
||||||
GLuint m_blendfunc1, m_blendfunc2;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ! \class GLShortBuffer
|
|
||||||
\brief Holds an OpenGL draw list composed of 16bit integers and vertex colors
|
|
||||||
class GLShortBuffer:public GLBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GLShortBuffer(int max=2048,int type=GL_LINES, bool stippled=false);
|
|
||||||
virtual ~GLShortBuffer();
|
|
||||||
|
|
||||||
// use one or the other.. can't use both
|
|
||||||
// color free version is faster
|
|
||||||
void add(GLshort x, GLshort y);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
|
||||||
|
|
||||||
// color per vertex version
|
|
||||||
void add(GLshort x, GLshort y,QColor & col); // add with vertex color
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,QColor & col); // add with vertex colors
|
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x3, GLshort y3, GLshort x4, GLshort y4,QColor & col); // add with vertex colors
|
|
||||||
|
|
||||||
virtual void draw();
|
|
||||||
|
|
||||||
//inline GLshort & operator [](int i) { return buffer[i]; }
|
|
||||||
protected:
|
|
||||||
GLshort * buffer;
|
|
||||||
GLubyte * colors;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \class GLFloatBuffer
|
|
||||||
\brief Holds an OpenGL draw list composed of 32bit GLfloat objects and vertex colors
|
|
||||||
*/
|
|
||||||
class GLFloatBuffer : public GLBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GLFloatBuffer(int max = 2048, int type = GL_LINES, bool stippled = false);
|
|
||||||
virtual ~GLFloatBuffer();
|
|
||||||
|
|
||||||
// Add with vertex color(s).
|
|
||||||
void add(GLfloat x, GLfloat y, QColor &col);
|
|
||||||
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, QColor &col);
|
|
||||||
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
|
||||||
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col);
|
|
||||||
void quadGrTB(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
|
||||||
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
|
|
||||||
void quadGrLR(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
|
||||||
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
|
|
||||||
|
|
||||||
virtual void draw();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
GLfloat *buffer;
|
|
||||||
GLubyte *colors;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! \struct TextQue
|
/*! \struct TextQue
|
||||||
\brief Holds a single item of text for the drawing queue
|
\brief Holds a single item of text for the drawing queue
|
||||||
*/
|
*/
|
||||||
@ -321,253 +67,6 @@ class MyScrollBar : public QScrollBar
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LayerPosition { LayerLeft, LayerRight, LayerTop, LayerBottom, LayerCenter, LayerOverlay };
|
|
||||||
|
|
||||||
/*! \class Layer
|
|
||||||
\brief The base component for all individual Graph layers
|
|
||||||
*/
|
|
||||||
class Layer
|
|
||||||
{
|
|
||||||
friend class gGraph;
|
|
||||||
friend class LayerGroup;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Layer(ChannelID code)
|
|
||||||
: m_refcount(0),
|
|
||||||
m_day(nullptr),
|
|
||||||
m_visible(true),
|
|
||||||
m_movable(false),
|
|
||||||
m_minx(0), m_maxx(0),
|
|
||||||
m_miny(0), m_maxy(0),
|
|
||||||
m_physminy(0), m_physmaxy(0),
|
|
||||||
m_code(code),
|
|
||||||
m_width(0), m_height(0),
|
|
||||||
m_X(0), m_Y(0),
|
|
||||||
m_order(0),
|
|
||||||
m_position(LayerCenter)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual ~Layer();
|
|
||||||
|
|
||||||
//! \brief This gets called on day selection, allowing this layer to precalculate any drawing data
|
|
||||||
virtual void SetDay(Day *d);
|
|
||||||
|
|
||||||
//! \brief Set the ChannelID used in this layer
|
|
||||||
virtual void SetCode(ChannelID c) { m_code = c; }
|
|
||||||
//! \brief Return the ChannelID used in this layer
|
|
||||||
const ChannelID &code() { return m_code; }
|
|
||||||
|
|
||||||
//! \brief returns true if this layer contains no data.
|
|
||||||
virtual bool isEmpty();
|
|
||||||
|
|
||||||
//! \brief Override and returns true if there are any highlighted components
|
|
||||||
virtual bool isSelected() { return false; }
|
|
||||||
|
|
||||||
//! \brief Deselect any highlighted components
|
|
||||||
virtual void deselect() { }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical minimum date boundary
|
|
||||||
virtual qint64 Minx() { return m_day ? m_day->first() : m_minx; }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical maximum date boundary
|
|
||||||
virtual qint64 Maxx() { return m_day ? m_day->last() : m_maxx; }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical minimum Yaxis value
|
|
||||||
virtual EventDataType Miny() { return m_miny; }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical maximum Yaxis value
|
|
||||||
virtual EventDataType Maxy() { return m_maxy; }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical minimum Yaxis value
|
|
||||||
virtual EventDataType physMiny() { return m_physminy; }
|
|
||||||
|
|
||||||
//! \brief Return this layers physical maximum Yaxis value
|
|
||||||
virtual EventDataType physMaxy() { return m_physmaxy; }
|
|
||||||
|
|
||||||
//! \brief Set this layers physical minimum date boundary
|
|
||||||
virtual void setMinX(qint64 val) { m_minx = val; }
|
|
||||||
|
|
||||||
//! \brief Set this layers physical maximum date boundary
|
|
||||||
virtual void setMaxX(qint64 val) { m_maxx = val; }
|
|
||||||
|
|
||||||
//! \brief Set this layers physical minimum Yaxis value
|
|
||||||
virtual void setMinY(EventDataType val) { m_miny = val; }
|
|
||||||
|
|
||||||
//! \brief Set this layers physical maximum Yaxis value
|
|
||||||
virtual void setMaxY(EventDataType val) { m_maxy = val; }
|
|
||||||
|
|
||||||
//! \brief Set this layers Visibility status
|
|
||||||
void setVisible(bool b) { m_visible = b; }
|
|
||||||
|
|
||||||
//! \brief Return this layers Visibility status
|
|
||||||
bool visible() const { return m_visible; }
|
|
||||||
|
|
||||||
//! \brief Set this layers Moveability status (not really used yet)
|
|
||||||
void setMovable(bool b) { m_movable = b; }
|
|
||||||
|
|
||||||
//! \brief Return this layers Moveability status (not really used yet)
|
|
||||||
bool movable() const { return m_movable; }
|
|
||||||
|
|
||||||
/*! \brief Override this for the drawing code, using GLBuffer components for drawing
|
|
||||||
\param gGraph & gv Graph Object that holds this layer
|
|
||||||
\param int left
|
|
||||||
\param int top
|
|
||||||
\param int width
|
|
||||||
\param int height
|
|
||||||
*/
|
|
||||||
virtual void paint(gGraph &gv, int left, int top, int width, int height) = 0;
|
|
||||||
|
|
||||||
//! \brief Set the layout position and order for this layer.
|
|
||||||
void setLayout(LayerPosition position, short width, short height, short order);
|
|
||||||
|
|
||||||
void setPos(short x, short y) { m_X = x; m_Y = y; }
|
|
||||||
|
|
||||||
int Width() { return m_width; }
|
|
||||||
int Height() { return m_height; }
|
|
||||||
|
|
||||||
//! \brief Return this Layers Layout Position.
|
|
||||||
LayerPosition position() { return m_position; }
|
|
||||||
//void X() { return m_X; }
|
|
||||||
//void Y() { return m_Y; }
|
|
||||||
|
|
||||||
//! \brief Draw all this layers custom GLBuffers (ie. the actual OpenGL Vertices)
|
|
||||||
virtual void drawGLBuf(float linesize);
|
|
||||||
|
|
||||||
//! \brief not sure why I needed the reference counting stuff.
|
|
||||||
short m_refcount;
|
|
||||||
void addref() { m_refcount++; }
|
|
||||||
bool unref() {
|
|
||||||
m_refcount--;
|
|
||||||
return (m_refcount <= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! \brief Add a GLBuffer (vertex) object customized to this layer
|
|
||||||
void addGLBuf(GLBuffer *buf) { mgl_buffers.push_back(buf); }
|
|
||||||
void addVertexBuffer(gVertexBuffer *buf) { mv_buffers.push_back(buf); }
|
|
||||||
|
|
||||||
//QRect bounds; // bounds, relative to top of individual graph.
|
|
||||||
Day *m_day;
|
|
||||||
bool m_visible;
|
|
||||||
bool m_movable;
|
|
||||||
qint64 m_minx, m_maxx;
|
|
||||||
EventDataType m_miny, m_maxy;
|
|
||||||
EventDataType m_physminy, m_physmaxy;
|
|
||||||
ChannelID m_code;
|
|
||||||
short m_width; // reserved x pixels needed for this layer. 0==Depends on position..
|
|
||||||
short m_height; // reserved y pixels needed for this layer. both 0 == expand to all free area.
|
|
||||||
short m_X; // offset for repositionable layers..
|
|
||||||
short m_Y;
|
|
||||||
short m_order; // order for positioning..
|
|
||||||
LayerPosition m_position;
|
|
||||||
QRect m_rect;
|
|
||||||
|
|
||||||
//! \brief A vector containing all this layers custom drawing buffers
|
|
||||||
QVector<GLBuffer *> mgl_buffers;
|
|
||||||
QVector<gVertexBuffer *> mv_buffers;
|
|
||||||
|
|
||||||
//! \brief Mouse wheel moved somewhere over this layer
|
|
||||||
virtual bool wheelEvent(QWheelEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//! \brief Mouse moved somewhere over this layer
|
|
||||||
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//! \brief Mouse left or right button pressed somewhere on this layer
|
|
||||||
virtual bool mousePressEvent(QMouseEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//! \brief Mouse button released that was originally pressed somewhere on this layer
|
|
||||||
virtual bool mouseReleaseEvent(QMouseEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//! \brief Mouse button double clicked somewhere on this layer
|
|
||||||
virtual bool mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//! \brief A key was pressed on the keyboard while the graph area was focused.
|
|
||||||
virtual bool keyPressEvent(QKeyEvent *event, gGraph *graph) {
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(graph);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! \class LayerGroup
|
|
||||||
\brief Contains a list of graph Layer obejcts
|
|
||||||
*/
|
|
||||||
class LayerGroup : public Layer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LayerGroup()
|
|
||||||
: Layer(NoChannel)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual ~LayerGroup();
|
|
||||||
|
|
||||||
//! \brief Add Layer to this Layer Group
|
|
||||||
virtual void AddLayer(Layer *l);
|
|
||||||
|
|
||||||
//! \brief Returns the minimum time value for all Layers contained in this group (milliseconds since epoch)
|
|
||||||
virtual qint64 Minx();
|
|
||||||
|
|
||||||
//! \brief Returns the maximum time value for all Layers contained in this group (milliseconds since epoch)
|
|
||||||
virtual qint64 Maxx();
|
|
||||||
|
|
||||||
//! \brief Returns the minimum Y-axis value for all Layers contained in this group
|
|
||||||
virtual EventDataType Miny();
|
|
||||||
|
|
||||||
//! \brief Returns the maximum Y-axis value for all Layers contained in this group
|
|
||||||
virtual EventDataType Maxy();
|
|
||||||
|
|
||||||
//! \brief Check all layers contained and return true if none contain data
|
|
||||||
virtual bool isEmpty();
|
|
||||||
|
|
||||||
//! \brief Calls SetDay for all Layers contained in this object
|
|
||||||
virtual void SetDay(Day *d);
|
|
||||||
|
|
||||||
//! \brief Calls drawGLBuf for all Layers contained in this object
|
|
||||||
virtual void drawGLBuf(float linesize);
|
|
||||||
|
|
||||||
//! \brief Return the list of Layers this object holds
|
|
||||||
QVector<Layer *> &getLayers() { return layers; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! \brief Contains all Layer objects in this group
|
|
||||||
QVector<Layer *> layers;
|
|
||||||
|
|
||||||
//! \brief Mouse wheel moved somewhere over this LayerGroup
|
|
||||||
virtual bool wheelEvent(QWheelEvent *event, gGraph *graph);
|
|
||||||
|
|
||||||
//! \brief Mouse moved somewhere over this LayerGroup
|
|
||||||
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph);
|
|
||||||
|
|
||||||
//! \brief Mouse left or right button pressed somewhere on this LayerGroup
|
|
||||||
virtual bool mousePressEvent(QMouseEvent *event, gGraph *graph);
|
|
||||||
|
|
||||||
//! \brief Mouse button released that was originally pressed somewhere on this LayerGroup
|
|
||||||
virtual bool mouseReleaseEvent(QMouseEvent *event, gGraph *graph);
|
|
||||||
|
|
||||||
//! \brief Mouse button double clicked somewhere on this layerGroup
|
|
||||||
virtual bool mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph);
|
|
||||||
|
|
||||||
//! \brief A key was pressed on the keyboard while the graph area was focused.
|
|
||||||
virtual bool keyPressEvent(QKeyEvent *event, gGraph *graph);
|
|
||||||
};
|
|
||||||
|
|
||||||
class gGraph;
|
|
||||||
|
|
||||||
/*! \class gThread
|
/*! \class gThread
|
||||||
\brief Part of the Threaded drawing code
|
\brief Part of the Threaded drawing code
|
||||||
|
|
||||||
@ -634,330 +133,6 @@ class gToolTip : public QObject
|
|||||||
void timerDone();
|
void timerDone();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class gGraph
|
|
||||||
\brief Single Graph object, containing multiple layers and Layer layout code
|
|
||||||
*/
|
|
||||||
class gGraph : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
friend class gGraphView;
|
|
||||||
|
|
||||||
/*! \brief Creates a new graph object
|
|
||||||
\param gGraphView * graphview if not null, links the graph to that object
|
|
||||||
\param QString title containing the graph Title which is rendered vertically
|
|
||||||
\param int height containing the opening height for this graph
|
|
||||||
\param short group containing which graph-link group this graph belongs to
|
|
||||||
*/
|
|
||||||
gGraph(gGraphView *graphview = nullptr, QString title = "", QString units = "",
|
|
||||||
int height = 100, short group = 0);
|
|
||||||
virtual ~gGraph();
|
|
||||||
|
|
||||||
//! \brief Tells all Layers to deselect any highlighting
|
|
||||||
void deselect();
|
|
||||||
|
|
||||||
//! \brief Returns true if any Layers have anything highlighted
|
|
||||||
bool isSelected();
|
|
||||||
|
|
||||||
//! \brief Starts the singleshot Timer running, for ms milliseconds
|
|
||||||
void Trigger(int ms);
|
|
||||||
|
|
||||||
/*! \fn QPixmap renderPixmap(int width, int height, float fontscale=1.0);
|
|
||||||
\brief Returns a QPixmap containing a snapshot of the graph rendered at size widthxheight
|
|
||||||
\param int width Width of graph 'screenshot'
|
|
||||||
\param int height Height of graph 'screenshot'
|
|
||||||
\param float fontscale Scaling value to adjust DPI (when used for HighRes printing)
|
|
||||||
|
|
||||||
Note if width or height is more than the OpenGL system allows, it could result in a crash
|
|
||||||
Keeping them under 2048 is a reasonably safe value.
|
|
||||||
*/
|
|
||||||
QPixmap renderPixmap(int width, int height, bool printing = false);
|
|
||||||
|
|
||||||
//! \brief Set Graph visibility status
|
|
||||||
void setVisible(bool b) { m_visible = b; }
|
|
||||||
|
|
||||||
//! \brief Return Graph visibility status
|
|
||||||
bool visible() { return m_visible; }
|
|
||||||
|
|
||||||
//! \brief Return height element. This is used by the scaler in gGraphView.
|
|
||||||
float height() { return m_height; }
|
|
||||||
|
|
||||||
//! \brief Set the height element. (relative to the total of all heights)
|
|
||||||
void setHeight(float height) { m_height = height; invalidate_yAxisImage = true; }
|
|
||||||
|
|
||||||
int minHeight() { return m_min_height; }
|
|
||||||
void setMinHeight(int height) { m_min_height = height; }
|
|
||||||
|
|
||||||
int maxHeight() { return m_max_height; }
|
|
||||||
void setMaxHeight(int height) { m_max_height = height; }
|
|
||||||
|
|
||||||
//! \brief Returns true if the vertical graph title is shown
|
|
||||||
bool showTitle() { return m_showTitle; }
|
|
||||||
|
|
||||||
//! \brief Set whether or not to render the vertical graph title
|
|
||||||
void setShowTitle(bool b) { m_showTitle = b; }
|
|
||||||
|
|
||||||
//! \brief Returns printScaleX, used for DPI scaling in report printing
|
|
||||||
float printScaleX();
|
|
||||||
|
|
||||||
//! \brief Returns printScaleY, used for DPI scaling in report printing
|
|
||||||
float printScaleY();
|
|
||||||
|
|
||||||
//! \brief Returns true if none of the included layers have data attached
|
|
||||||
bool isEmpty();
|
|
||||||
|
|
||||||
//! \brief Add Layer l to graph object, allowing you to specify position,
|
|
||||||
// margin sizes, order, movability status and offsets
|
|
||||||
void AddLayer(Layer *l, LayerPosition position = LayerCenter,
|
|
||||||
short pixelsX = 0, short pixelsY = 0, short order = 0,
|
|
||||||
bool movable = false, short x = 0, short y = 0);
|
|
||||||
|
|
||||||
|
|
||||||
void qglColor(QColor col);
|
|
||||||
|
|
||||||
//! \brief Queues text for gGraphView object to draw it.
|
|
||||||
void renderText(QString text, int x, int y, float angle = 0.0,
|
|
||||||
QColor color = Qt::black, QFont *font = defaultfont, bool antialias = true);
|
|
||||||
|
|
||||||
//! \brief Rounds Y scale values to make them look nice..
|
|
||||||
// Applies the Graph Preference min/max settings.
|
|
||||||
void roundY(EventDataType &miny, EventDataType &maxy);
|
|
||||||
|
|
||||||
//! \brief Process all Layers GLBuffer (Vertex) objects, drawing the actual OpenGL stuff.
|
|
||||||
void drawGLBuf();
|
|
||||||
|
|
||||||
//! \brief Returns the Graph's (vertical) title
|
|
||||||
QString title() { return m_title; }
|
|
||||||
|
|
||||||
//! \brief Sets the Graph's (vertical) title
|
|
||||||
void setTitle(const QString title) { m_title = title; }
|
|
||||||
|
|
||||||
//! \brief Returns the measurement Units the Y scale is referring to
|
|
||||||
QString units() { return m_units; }
|
|
||||||
|
|
||||||
//! \brief Sets the measurement Units the Y scale is referring to
|
|
||||||
void setUnits(const QString units) { m_units = units; }
|
|
||||||
|
|
||||||
//virtual void repaint(); // Repaint individual graph..
|
|
||||||
|
|
||||||
//! \brief Resets the graphs X & Y dimensions based on the Layer data
|
|
||||||
virtual void ResetBounds();
|
|
||||||
|
|
||||||
//! \brief Sets the time range selected for this graph (in milliseconds since 1970 epoch)
|
|
||||||
virtual void SetXBounds(qint64 minx, qint64 maxx);
|
|
||||||
|
|
||||||
//! \brief Returns the physical Minimum time for all layers contained (in milliseconds since epoch)
|
|
||||||
virtual qint64 MinX();
|
|
||||||
|
|
||||||
//! \brief Returns the physical Maximum time for all layers contained (in milliseconds since epoch)
|
|
||||||
virtual qint64 MaxX();
|
|
||||||
|
|
||||||
//! \brief Returns the physical Minimum Y scale value for all layers contained
|
|
||||||
virtual EventDataType MinY();
|
|
||||||
|
|
||||||
//! \brief Returns the physical Maximum Y scale value for all layers contained
|
|
||||||
virtual EventDataType MaxY();
|
|
||||||
|
|
||||||
//! \brief Returns the physical Minimum Y scale value for all layers contained
|
|
||||||
virtual EventDataType physMinY();
|
|
||||||
|
|
||||||
//! \brief Returns the physical Maximum Y scale value for all layers contained
|
|
||||||
virtual EventDataType physMaxY();
|
|
||||||
|
|
||||||
//! \brief Sets the physical start of this graphs time range (in milliseconds since epoch)
|
|
||||||
virtual void SetMinX(qint64 v);
|
|
||||||
|
|
||||||
//! \brief Sets the physical end of this graphs time range (in milliseconds since epoch)
|
|
||||||
virtual void SetMaxX(qint64 v);
|
|
||||||
|
|
||||||
//! \brief Sets the physical Minimum Y scale value used while drawing this graph
|
|
||||||
virtual void SetMinY(EventDataType v);
|
|
||||||
|
|
||||||
//! \brief Sets the physical Maximum Y scale value used while drawing this graph
|
|
||||||
virtual void SetMaxY(EventDataType v);
|
|
||||||
|
|
||||||
//! \brief Forces Y Minimum to always select this value
|
|
||||||
virtual void setForceMinY(EventDataType v) { f_miny = v; m_enforceMinY = true; }
|
|
||||||
//! \brief Forces Y Maximum to always select this value
|
|
||||||
virtual void setForceMaxY(EventDataType v) { f_maxy = v; m_enforceMaxY = true; }
|
|
||||||
|
|
||||||
|
|
||||||
virtual EventDataType forceMinY() { return rec_miny; }
|
|
||||||
virtual EventDataType forceMaxY() { return rec_maxy; }
|
|
||||||
|
|
||||||
//! \brief Set recommended Y minimum.. It won't go under this unless the data does.
|
|
||||||
// It won't go above this.
|
|
||||||
virtual void setRecMinY(EventDataType v) { rec_miny = v; }
|
|
||||||
//! \brief Set recommended Y minimum.. It won't go above this unless the data does.
|
|
||||||
// It won't go under this.
|
|
||||||
virtual void setRecMaxY(EventDataType v) { rec_maxy = v; }
|
|
||||||
|
|
||||||
//! \brief Returns the recommended Y minimum.. It won't go under this unless the data does.
|
|
||||||
// It won't go above this.
|
|
||||||
virtual EventDataType RecMinY() { return rec_miny; }
|
|
||||||
//! \brief Returns the recommended Y maximum.. It won't go under this unless the data does.
|
|
||||||
// It won't go above this.
|
|
||||||
virtual EventDataType RecMaxY() { return rec_maxy; }
|
|
||||||
|
|
||||||
//! \brief Called when main graph area is resized
|
|
||||||
void resize(int width, int height); // margin recalcs..
|
|
||||||
|
|
||||||
qint64 max_x, min_x, rmax_x, rmin_x;
|
|
||||||
EventDataType max_y, min_y, rmax_y, rmin_y, f_miny, f_maxy, rec_miny, rec_maxy;
|
|
||||||
EventDataType rphysmin_y, rphysmax_y;
|
|
||||||
|
|
||||||
// not sure why there's two.. I can't remember
|
|
||||||
void setEnforceMinY(bool b) { m_enforceMinY = b; }
|
|
||||||
void setEnforceMaxY(bool b) { m_enforceMaxY = b; }
|
|
||||||
|
|
||||||
//! \brief Returns whether this graph shows overall timescale, or a zoomed area
|
|
||||||
bool blockZoom() { return m_blockzoom; }
|
|
||||||
//! \brief Sets whether this graph shows an overall timescale, or a zoomed area.
|
|
||||||
void setBlockZoom(bool b) { m_blockzoom = b; }
|
|
||||||
|
|
||||||
//! \brief Flips the GL coordinates from the graphs perspective.. Used in Scissor calculations
|
|
||||||
int flipY(int y); // flip GL coordinates
|
|
||||||
|
|
||||||
//! \brief Returns the graph-linking group this Graph belongs in
|
|
||||||
short group() { return m_group; }
|
|
||||||
|
|
||||||
//! \brief Sets the graph-linking group this Graph belongs in
|
|
||||||
void setGroup(short group) { m_group = group; }
|
|
||||||
|
|
||||||
//! \brief Forces the main gGraphView object to draw all Text Components
|
|
||||||
void DrawTextQue();
|
|
||||||
|
|
||||||
//! \brief Sends supplied day object to all Graph layers so they can precalculate stuff
|
|
||||||
void setDay(Day *day);
|
|
||||||
|
|
||||||
//! \brief Returns the current day object
|
|
||||||
Day *day() { return m_day; }
|
|
||||||
|
|
||||||
//! \brief The Layer, layout and title drawing code
|
|
||||||
virtual void paint(int originX, int originY, int width, int height);
|
|
||||||
|
|
||||||
//! \brief Gives the supplied data to the main ToolTip object for display
|
|
||||||
void ToolTip(QString text, int x, int y, int timeout = 0);
|
|
||||||
|
|
||||||
//! \brief Public version of updateGL(), to redraw all graphs.. Not for normal use
|
|
||||||
void redraw();
|
|
||||||
|
|
||||||
//! \brief Asks the main gGraphView to redraw after ms milliseconds
|
|
||||||
void timedRedraw(int ms);
|
|
||||||
|
|
||||||
//! \brief Sets the margins for the four sides of this graph.
|
|
||||||
void setMargins(short left, short right, short top, short bottom) {
|
|
||||||
m_marginleft = left;
|
|
||||||
m_marginright = right;
|
|
||||||
m_margintop = top;
|
|
||||||
m_marginbottom = bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \brief Returns this graphs left margin
|
|
||||||
short marginLeft();
|
|
||||||
//! \brief Returns this graphs right margin
|
|
||||||
short marginRight();
|
|
||||||
//! \brief Returns this graphs top margin
|
|
||||||
short marginTop();
|
|
||||||
//! \brief Returns this graphs bottom margin
|
|
||||||
short marginBottom();
|
|
||||||
|
|
||||||
//! \brief Returns the main gGraphView objects gVertexBuffer line list.
|
|
||||||
gVertexBuffer *lines();
|
|
||||||
//! \brief Returns the main gGraphView objects gVertexBuffer background line list.
|
|
||||||
gVertexBuffer *backlines();
|
|
||||||
//! \brief Returns the main gGraphView objects gVertexBuffer front line list.
|
|
||||||
gVertexBuffer *frontlines();
|
|
||||||
//! \brief Returns the main gGraphView objects gVertexBuffer quads list.
|
|
||||||
gVertexBuffer *quads();
|
|
||||||
|
|
||||||
const inline QRect &rect() const { return m_rect; }
|
|
||||||
|
|
||||||
bool isPinned() { return m_pinned; }
|
|
||||||
void setPinned(bool b) { m_pinned = b; }
|
|
||||||
|
|
||||||
// //! \brief Returns the main gGraphView objects gVertexBuffer stippled line list.
|
|
||||||
//GLShortBuffer * stippled();
|
|
||||||
|
|
||||||
//gVertexBuffer * vlines(); // testing new vertexbuffer
|
|
||||||
|
|
||||||
short left, right, top, bottom; // dirty magin hacks..
|
|
||||||
|
|
||||||
Layer *getLineChart();
|
|
||||||
QTimer *timer;
|
|
||||||
|
|
||||||
// This gets set to true to force a redraw of the yAxis tickers when graphs are resized.
|
|
||||||
bool invalidate_yAxisImage;
|
|
||||||
bool invalidate_xAxisImage;
|
|
||||||
|
|
||||||
//! \brief Returns a Vector reference containing all this graphs layers
|
|
||||||
QVector<Layer *> &layers() { return m_layers; }
|
|
||||||
|
|
||||||
gGraphView *graphView() { return m_graphview; }
|
|
||||||
short m_marginleft, m_marginright, m_margintop, m_marginbottom;
|
|
||||||
|
|
||||||
short zoomY() { return m_zoomY; }
|
|
||||||
void setZoomY(short zoom);
|
|
||||||
|
|
||||||
static const short maxZoomY = 2;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//void invalidate();
|
|
||||||
|
|
||||||
//! \brief Mouse Wheel events
|
|
||||||
virtual void wheelEvent(QWheelEvent *event);
|
|
||||||
|
|
||||||
//! \brief Mouse Movement events
|
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
//! \brief Mouse Button Pressed events
|
|
||||||
virtual void mousePressEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
//! \brief Mouse Button Released events
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
//! \brief Mouse Button Double Clicked events
|
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
//! \brief Key Pressed event
|
|
||||||
virtual void keyPressEvent(QKeyEvent *event);
|
|
||||||
|
|
||||||
//! \brief Change the current selected time boundaries by mult, from origin position origin_px
|
|
||||||
void ZoomX(double mult, int origin_px);
|
|
||||||
|
|
||||||
//! \brief The Main gGraphView object holding this graph
|
|
||||||
// (this can be pinched temporarily by print code)
|
|
||||||
gGraphView *m_graphview;
|
|
||||||
QString m_title;
|
|
||||||
QString m_units;
|
|
||||||
|
|
||||||
//! \brief Vector containing all this graphs Layers
|
|
||||||
QVector<Layer *> m_layers;
|
|
||||||
float m_height, m_width;
|
|
||||||
|
|
||||||
int m_min_height;
|
|
||||||
int m_max_height;
|
|
||||||
bool m_visible;
|
|
||||||
bool m_blockzoom;
|
|
||||||
QRect m_selection;
|
|
||||||
bool m_selecting_area;
|
|
||||||
QPoint m_current;
|
|
||||||
short m_group;
|
|
||||||
short m_lastx23;
|
|
||||||
Day *m_day;
|
|
||||||
gVertexBuffer *m_quad;
|
|
||||||
bool m_enforceMinY, m_enforceMaxY;
|
|
||||||
bool m_showTitle;
|
|
||||||
bool m_printing;
|
|
||||||
bool m_pinned;
|
|
||||||
short m_zoomY;
|
|
||||||
QRect m_rect;
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
//! \brief Deselects any highlights, and schedules a main gGraphView redraw
|
|
||||||
void Timeout();
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! \struct myPixmapCache
|
/*! \struct myPixmapCache
|
||||||
\brief My version of Pixmap cache with texture binding support
|
\brief My version of Pixmap cache with texture binding support
|
||||||
|
|
||||||
|
@ -9,12 +9,17 @@
|
|||||||
* License. See the file COPYING in the main directory of the Linux
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
* distribution for more details. */
|
* distribution for more details. */
|
||||||
|
|
||||||
#include <math.h>
|
#include "Graphs/gLineChart.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <SleepLib/profiles.h>
|
|
||||||
#include "gLineChart.h"
|
#include <math.h>
|
||||||
#include "glcommon.h"
|
|
||||||
|
#include "Graphs/glcommon.h"
|
||||||
|
#include "Graphs/gGraph.h"
|
||||||
|
#include "Graphs/gGraphView.h"
|
||||||
|
#include "SleepLib/profiles.h"
|
||||||
|
|
||||||
#define EXTRA_ASSERTS 1
|
#define EXTRA_ASSERTS 1
|
||||||
gLineChart::gLineChart(ChannelID code, QColor col, bool square_plot, bool disable_accel)
|
gLineChart::gLineChart(ChannelID code, QColor col, bool square_plot, bool disable_accel)
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
#define GLINECHART_H
|
#define GLINECHART_H
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "Graphs/gVertexBuffer.h"
|
||||||
|
#include "Graphs/layer.h"
|
||||||
#include "SleepLib/event.h"
|
#include "SleepLib/event.h"
|
||||||
#include "SleepLib/day.h"
|
#include "SleepLib/day.h"
|
||||||
#include "gGraphView.h"
|
|
||||||
//#include "graphlayer.h"
|
|
||||||
|
|
||||||
/*! \class AHIChart
|
/*! \class AHIChart
|
||||||
\brief Another graph calculating the AHI/hour, this one looks at all the sessions for a day. Currently Unused.
|
\brief Another graph calculating the AHI/hour, this one looks at all the sessions for a day. Currently Unused.
|
||||||
|
304
sleepyhead/Graphs/gVertexBuffer.cpp
Normal file
304
sleepyhead/Graphs/gVertexBuffer.cpp
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#include "Graphs/gVertexBuffer.h"
|
||||||
|
|
||||||
|
#include "SleepLib/profiles.h"
|
||||||
|
|
||||||
|
extern int lines_drawn_this_frame;
|
||||||
|
extern int quads_drawn_this_frame;
|
||||||
|
|
||||||
|
inline quint32 swaporder(quint32 color)
|
||||||
|
{
|
||||||
|
return ((color & 0xFF00FF00) |
|
||||||
|
((color & 0xFF0000) >> 16) |
|
||||||
|
((color & 0xFF) << 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::setColor(QColor col)
|
||||||
|
{
|
||||||
|
m_color = swaporder(col.rgba());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::draw()
|
||||||
|
{
|
||||||
|
bool antialias = m_forceantialias || (PROFILE.appearance->antiAliasing() && m_antialias);
|
||||||
|
|
||||||
|
if (m_stippled) { antialias = false; }
|
||||||
|
|
||||||
|
float size = m_size;
|
||||||
|
|
||||||
|
if (antialias) {
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(m_blendfunc1, m_blendfunc2);
|
||||||
|
|
||||||
|
if (m_type == GL_LINES || m_type == GL_LINE_LOOP) {
|
||||||
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
size += 0.5;
|
||||||
|
} else if (m_type == GL_POLYGON) {
|
||||||
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_type == GL_LINES || m_type == GL_LINE_LOOP) {
|
||||||
|
if (m_stippled) {
|
||||||
|
glLineStipple(1, m_stipple);
|
||||||
|
//size=1;
|
||||||
|
glEnable(GL_LINE_STIPPLE);
|
||||||
|
} else {
|
||||||
|
//glLineStipple(1, 0xFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
glLineWidth(size);
|
||||||
|
|
||||||
|
lines_drawn_this_frame += m_cnt / 2;
|
||||||
|
} else if (m_type == GL_POINTS) {
|
||||||
|
glPointSize(size);
|
||||||
|
} else if (m_type == GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK, GL_FILL);
|
||||||
|
lines_drawn_this_frame += m_cnt / 2;
|
||||||
|
} else if (m_type == GL_QUADS) {
|
||||||
|
quads_drawn_this_frame += m_cnt / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_scissor) {
|
||||||
|
glScissor(s_x, s_y, s_width, s_height);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glVertexPointer(2, GL_SHORT, 8, (GLvoid *)buffer);
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, 8, ((char *)buffer) + 4);
|
||||||
|
|
||||||
|
glDrawArrays(m_type, 0, m_cnt);
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
m_cnt = 0;
|
||||||
|
|
||||||
|
if (m_scissor) {
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
m_scissor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_type == GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK, GL_FILL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_type == GL_LINES || m_type == GL_LINE_LOOP) {
|
||||||
|
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);
|
||||||
|
} else if (m_type == GL_POLYGON) {
|
||||||
|
glDisable(GL_POLYGON_SMOOTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt < m_max) {
|
||||||
|
gVertex &v = buffer[m_cnt];
|
||||||
|
|
||||||
|
v.color = swaporder(color);
|
||||||
|
v.x = x1;
|
||||||
|
v.y = y1;
|
||||||
|
|
||||||
|
m_cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max - 1)) {
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v->color = swaporder(color);
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
v->color = swaporder(color);
|
||||||
|
|
||||||
|
m_cnt += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3,
|
||||||
|
GLshort x4, GLshort y4, RGBA color)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max - 3)) {
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color = swaporder(color);
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color = swaporder(color);
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = swaporder(color);
|
||||||
|
v->x = x3;
|
||||||
|
v->y = y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = swaporder(color);
|
||||||
|
v->x = x4;
|
||||||
|
v->y = y4;
|
||||||
|
|
||||||
|
m_cnt += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3,
|
||||||
|
GLshort x4, GLshort y4, RGBA color1, RGBA color2)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max - 3)) {
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color = swaporder(color1);
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color = swaporder(color1);
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = swaporder(color2);
|
||||||
|
v->x = x3;
|
||||||
|
v->y = y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = swaporder(color2);
|
||||||
|
v->x = x4;
|
||||||
|
v->y = y4;
|
||||||
|
|
||||||
|
m_cnt += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::unsafe_add(GLshort x1, GLshort y1)
|
||||||
|
{
|
||||||
|
gVertex &v = buffer[m_cnt++];
|
||||||
|
|
||||||
|
v.color = m_color;
|
||||||
|
v.x = x1;
|
||||||
|
v.y = y1;
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1)
|
||||||
|
{
|
||||||
|
if (m_cnt < m_max) {
|
||||||
|
gVertex &v = buffer[m_cnt++];
|
||||||
|
|
||||||
|
v.color = m_color;
|
||||||
|
v.x = x1;
|
||||||
|
v.y = y1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
|
||||||
|
{
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v->color = m_color;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
v->color = m_color;
|
||||||
|
|
||||||
|
m_cnt += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max - 1)) {
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v->color = m_color;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
v->color = m_color;
|
||||||
|
|
||||||
|
m_cnt += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3, GLshort y3,
|
||||||
|
GLshort x4, GLshort y4)
|
||||||
|
{
|
||||||
|
if (m_cnt < (m_max - 3)) {
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x3;
|
||||||
|
v->y = y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x4;
|
||||||
|
v->y = y4;
|
||||||
|
|
||||||
|
m_cnt += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gVertexBuffer::unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, GLshort x3,
|
||||||
|
GLshort y3, GLshort x4, GLshort y4)
|
||||||
|
{
|
||||||
|
gVertex *v = &buffer[m_cnt];
|
||||||
|
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x1;
|
||||||
|
v->y = y1;
|
||||||
|
v++;
|
||||||
|
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x2;
|
||||||
|
v->y = y2;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x3;
|
||||||
|
v->y = y3;
|
||||||
|
|
||||||
|
v++;
|
||||||
|
v->color = m_color;
|
||||||
|
v->x = x4;
|
||||||
|
v->y = y4;
|
||||||
|
|
||||||
|
m_cnt += 4;
|
||||||
|
}
|
128
sleepyhead/Graphs/gVertexBuffer.h
Normal file
128
sleepyhead/Graphs/gVertexBuffer.h
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#ifndef graphs_gvertexbuffer_h
|
||||||
|
#define graphs_gvertexbuffer_h
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include "Graphs/glcommon.h"
|
||||||
|
|
||||||
|
typedef quint32 RGBA;
|
||||||
|
|
||||||
|
#ifdef BUILD_WITH_MSVC
|
||||||
|
__declspec(align(1))
|
||||||
|
#endif
|
||||||
|
struct gVertex {
|
||||||
|
gVertex(GLshort _x, GLshort _y, GLuint _c) { x = _x; y = _y; color = _c; }
|
||||||
|
GLshort x;
|
||||||
|
GLshort y;
|
||||||
|
RGBA color;
|
||||||
|
}
|
||||||
|
#ifndef BUILD_WITH_MSVC
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
class gVertexBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gVertexBuffer(int max = 2048, int type = GL_LINES)
|
||||||
|
: m_max(max), m_type(type), m_cnt(0), m_size(1),
|
||||||
|
m_scissor(false), m_antialias(false), m_forceantialias(false), m_stippled(false),
|
||||||
|
buffer(nullptr),
|
||||||
|
s_x(0), s_y(0), s_width(0), s_height(0),
|
||||||
|
m_color(0),
|
||||||
|
m_stipple(0xffff),
|
||||||
|
m_blendfunc1(GL_SRC_ALPHA),
|
||||||
|
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA)
|
||||||
|
{
|
||||||
|
// FIXME: sstangl: Really should not allocate in constructor.
|
||||||
|
buffer = (gVertex *)calloc(max, sizeof(gVertex));
|
||||||
|
}
|
||||||
|
|
||||||
|
~gVertexBuffer() {
|
||||||
|
if (buffer) {
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(GLshort x1, GLshort y1, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
||||||
|
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
||||||
|
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color, RGBA color2);
|
||||||
|
|
||||||
|
void add(GLshort x1, GLshort y1);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
||||||
|
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
||||||
|
|
||||||
|
void unsafe_add(GLshort x1, GLshort y1);
|
||||||
|
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
||||||
|
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
|
||||||
|
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
|
||||||
|
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
void scissor(GLshort x, GLshort y, GLshort width, GLshort height) {
|
||||||
|
s_x = x;
|
||||||
|
s_y = y;
|
||||||
|
s_width = width;
|
||||||
|
s_height = height;
|
||||||
|
m_scissor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Max() const { return m_max; }
|
||||||
|
int cnt() const { return m_cnt; }
|
||||||
|
GLuint type() const { return m_type; }
|
||||||
|
float size() const { return m_size; }
|
||||||
|
bool full() const { return m_cnt >= m_max; }
|
||||||
|
|
||||||
|
void reset() { m_cnt = 0; }
|
||||||
|
void forceAntiAlias(bool b) { m_forceantialias = b; }
|
||||||
|
void setSize(float f) { m_size = f; }
|
||||||
|
void setAntiAlias(bool b) { m_antialias = b; }
|
||||||
|
void setStipple(GLshort stipple) { m_stipple = stipple; }
|
||||||
|
void setStippleOn(bool b) { m_stippled = b; }
|
||||||
|
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
|
||||||
|
void setColor(QColor col);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \brief Maximum number of gVertex points contained in buffer
|
||||||
|
int m_max;
|
||||||
|
//! \brief Indicates type of GL vertex information (GL_LINES, GL_QUADS, etc)
|
||||||
|
GLuint m_type;
|
||||||
|
//! \brief Count of Vertex points used this draw cycle.
|
||||||
|
int m_cnt;
|
||||||
|
//! \brief Line/Point thickness
|
||||||
|
float m_size;
|
||||||
|
|
||||||
|
bool m_scissor;
|
||||||
|
bool m_antialias;
|
||||||
|
bool m_forceantialias;
|
||||||
|
bool m_stippled;
|
||||||
|
|
||||||
|
//! \brief Contains list of Vertex & Color points
|
||||||
|
gVertex *buffer;
|
||||||
|
//! \brief GL Scissor parameters
|
||||||
|
GLshort s_x, s_y, s_width, s_height;
|
||||||
|
//! \brief Current drawing color
|
||||||
|
GLuint m_color;
|
||||||
|
//! \brief Stipple bitfield
|
||||||
|
GLshort m_stipple;
|
||||||
|
//! \brief Source GL Blend Function
|
||||||
|
GLuint m_blendfunc1;
|
||||||
|
//! \brief Destination GL Blend Function
|
||||||
|
GLuint m_blendfunc2;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // graphs_gvertexbuffer_h
|
@ -9,10 +9,15 @@
|
|||||||
* License. See the file COPYING in the main directory of the Linux
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
* distribution for more details. */
|
* distribution for more details. */
|
||||||
|
|
||||||
#include <math.h>
|
#include "Graphs/gXAxis.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "gXAxis.h"
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "Graphs/glcommon.h"
|
||||||
|
#include "Graphs/gGraph.h"
|
||||||
|
#include "Graphs/gGraphView.h"
|
||||||
|
|
||||||
const quint64 divisors[] = {
|
const quint64 divisors[] = {
|
||||||
15552000000ULL, 7776000000ULL, 5184000000ULL, 2419200000ULL, 1814400000ULL, 1209600000L, 604800000L, 259200000L,
|
15552000000ULL, 7776000000ULL, 5184000000ULL, 2419200000ULL, 1814400000ULL, 1209600000L, 604800000L, 259200000L,
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
#ifndef GXAXIS_H
|
#ifndef GXAXIS_H
|
||||||
#define GXAXIS_H
|
#define GXAXIS_H
|
||||||
#include "gGraphView.h"
|
|
||||||
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
/*! \class gXAxis
|
/*! \class gXAxis
|
||||||
\brief Draws the XTicker timescales underneath graphs */
|
\brief Draws the XTicker timescales underneath graphs */
|
||||||
|
@ -9,9 +9,15 @@
|
|||||||
* License. See the file COPYING in the main directory of the Linux
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
* distribution for more details. */
|
* distribution for more details. */
|
||||||
|
|
||||||
#include <math.h>
|
#include "Graphs/gYAxis.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "gYAxis.h"
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "Graphs/glcommon.h"
|
||||||
|
#include "Graphs/gGraph.h"
|
||||||
|
#include "Graphs/gGraphView.h"
|
||||||
#include "SleepLib/profiles.h"
|
#include "SleepLib/profiles.h"
|
||||||
|
|
||||||
gXGrid::gXGrid(QColor col)
|
gXGrid::gXGrid(QColor col)
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#ifndef GYAXIS_H
|
#ifndef GYAXIS_H
|
||||||
#define GYAXIS_H
|
#define GYAXIS_H
|
||||||
|
|
||||||
#include "gGraphView.h"
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
|
|
||||||
/*! \class gXGrid
|
/*! \class gXGrid
|
||||||
\brief Draws the horizintal major/minor grids over graphs
|
\brief Draws the horizintal major/minor grids over graphs
|
||||||
|
@ -15,6 +15,16 @@
|
|||||||
#include <QtOpenGL/qgl.h>
|
#include <QtOpenGL/qgl.h>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
# define USE_RENDERTEXT
|
||||||
|
# include "OpenGL/glu.h"
|
||||||
|
#else
|
||||||
|
# include "GL/glu.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
||||||
|
#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
||||||
|
|
||||||
const QColor COLOR_Black = Qt::black;
|
const QColor COLOR_Black = Qt::black;
|
||||||
const QColor COLOR_LightGreen = QColor("light green");
|
const QColor COLOR_LightGreen = QColor("light green");
|
||||||
const QColor COLOR_DarkGreen = Qt::darkGreen;
|
const QColor COLOR_DarkGreen = Qt::darkGreen;
|
||||||
|
268
sleepyhead/Graphs/layer.cpp
Normal file
268
sleepyhead/Graphs/layer.cpp
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
|
Layer::~Layer()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mgl_buffers.size(); i++) {
|
||||||
|
delete mgl_buffers[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < mv_buffers.size(); i++) {
|
||||||
|
delete mv_buffers[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Layer::drawGLBuf(float linesize)
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
float size;
|
||||||
|
|
||||||
|
if (!m_visible) { return; }
|
||||||
|
|
||||||
|
GLBuffer *buf;
|
||||||
|
gVertexBuffer *vb;
|
||||||
|
|
||||||
|
for (int i = 0; i < mv_buffers.size(); i++) {
|
||||||
|
vb = mv_buffers[i];
|
||||||
|
size = vb->size();
|
||||||
|
type = vb->type();
|
||||||
|
|
||||||
|
if ((linesize > size) && ((type == GL_LINES) || (type == GL_LINE_LOOP))) {
|
||||||
|
vb->setSize(linesize);
|
||||||
|
}
|
||||||
|
|
||||||
|
vb->draw();
|
||||||
|
vb->setSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < mgl_buffers.size(); i++) {
|
||||||
|
buf = mgl_buffers[i];
|
||||||
|
size = buf->size();
|
||||||
|
type = buf->type();
|
||||||
|
|
||||||
|
if ((linesize > size) && ((type == GL_LINES) || (type == GL_LINE_LOOP))) {
|
||||||
|
buf->setSize(linesize);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf->draw();
|
||||||
|
//if ((linesize>size) && ((type==GL_LINES) || (type==GL_LINE_LOOP))) {
|
||||||
|
buf->setSize(size);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layer::SetDay(Day *d)
|
||||||
|
{
|
||||||
|
if (d) {
|
||||||
|
m_day = d;
|
||||||
|
m_minx = d->first(m_code);
|
||||||
|
m_maxx = d->last(m_code);
|
||||||
|
m_miny = d->Min(m_code);
|
||||||
|
m_maxy = d->Max(m_code);
|
||||||
|
} else { m_day = nullptr; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Layer::isEmpty()
|
||||||
|
{
|
||||||
|
//if (m_day && (m_day->count(m_code)>0))
|
||||||
|
if (m_day && (m_day->channelExists(m_code))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void Layer::setLayout(LayerPosition position, short width, short height, short order)
|
||||||
|
{
|
||||||
|
m_position = position;
|
||||||
|
m_width = width;
|
||||||
|
m_height = height;
|
||||||
|
m_order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerGroup::~LayerGroup()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
delete layers[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool LayerGroup::isEmpty()
|
||||||
|
{
|
||||||
|
if (!m_day) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
if (layers[i]->isEmpty()) {
|
||||||
|
empty = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
void LayerGroup::drawGLBuf(float linesize)
|
||||||
|
{
|
||||||
|
Layer::drawGLBuf(linesize);
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
layers[i]->drawGLBuf(linesize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerGroup::SetDay(Day *d)
|
||||||
|
{
|
||||||
|
m_day = d;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
layers[i]->SetDay(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerGroup::AddLayer(Layer *l)
|
||||||
|
{
|
||||||
|
layers.push_back(l);
|
||||||
|
l->addref();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 LayerGroup::Minx()
|
||||||
|
{
|
||||||
|
bool first = true;
|
||||||
|
qint64 m = 0, t;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
t = layers[i]->Minx();
|
||||||
|
|
||||||
|
if (!t) { continue; }
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
m = t;
|
||||||
|
first = false;
|
||||||
|
} else if (m > t) { m = t; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
qint64 LayerGroup::Maxx()
|
||||||
|
{
|
||||||
|
bool first = true;
|
||||||
|
qint64 m = 0, t;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
t = layers[i]->Maxx();
|
||||||
|
|
||||||
|
if (!t) { continue; }
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
m = t;
|
||||||
|
first = false;
|
||||||
|
} else if (m < t) { m = t; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventDataType LayerGroup::Miny()
|
||||||
|
{
|
||||||
|
bool first = true;
|
||||||
|
EventDataType m = 0, t;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
t = layers[i]->Miny();
|
||||||
|
|
||||||
|
if (t == layers[i]->Maxy()) { continue; }
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
m = t;
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
if (m > t) { m = t; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventDataType LayerGroup::Maxy()
|
||||||
|
{
|
||||||
|
bool first = true;
|
||||||
|
EventDataType m = 0, t;
|
||||||
|
|
||||||
|
for (int i = 0; i < layers.size(); i++) {
|
||||||
|
t = layers[i]->Maxy();
|
||||||
|
|
||||||
|
if (t == layers[i]->Miny()) { continue; }
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
m = t;
|
||||||
|
first = false;
|
||||||
|
} else if (m < t) { m = t; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Mouse wheel moved somewhere over this layer
|
||||||
|
bool LayerGroup::wheelEvent(QWheelEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->wheelEvent(event, graph)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Mouse moved somewhere over this layer
|
||||||
|
bool LayerGroup::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->mouseMoveEvent(event, graph)) { return true; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Mouse left or right button pressed somewhere on this layer
|
||||||
|
bool LayerGroup::mousePressEvent(QMouseEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->mousePressEvent(event, graph)) { return true; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Mouse button released that was originally pressed somewhere on this layer
|
||||||
|
bool LayerGroup::mouseReleaseEvent(QMouseEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->mouseReleaseEvent(event, graph)) { return true; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief Mouse button double clicked somewhere on this layer
|
||||||
|
bool LayerGroup::mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->mouseDoubleClickEvent(event, graph)) { return true; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \brief A key was pressed on the keyboard while the graph area was focused.
|
||||||
|
bool LayerGroup::keyPressEvent(QKeyEvent *event, gGraph *graph)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < layers.size(); i++)
|
||||||
|
if (layers[i]->keyPressEvent(event, graph)) { return true; }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
273
sleepyhead/Graphs/layer.h
Normal file
273
sleepyhead/Graphs/layer.h
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the Linux
|
||||||
|
* distribution for more details. */
|
||||||
|
|
||||||
|
#ifndef graphs_layer_h
|
||||||
|
#define graphs_layer_h
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QRect>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
|
#include "Graphs/GLBuffer.h"
|
||||||
|
#include "Graphs/gVertexBuffer.h"
|
||||||
|
#include "SleepLib/common.h"
|
||||||
|
#include "SleepLib/day.h"
|
||||||
|
#include "SleepLib/machine_common.h"
|
||||||
|
|
||||||
|
class gGraph;
|
||||||
|
class LayerGroup;
|
||||||
|
|
||||||
|
enum LayerPosition { LayerLeft, LayerRight, LayerTop, LayerBottom, LayerCenter, LayerOverlay };
|
||||||
|
|
||||||
|
/*! \class Layer
|
||||||
|
\brief The base component for all individual Graph layers
|
||||||
|
*/
|
||||||
|
class Layer
|
||||||
|
{
|
||||||
|
friend class gGraph;
|
||||||
|
friend class LayerGroup;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Layer(ChannelID code)
|
||||||
|
: m_refcount(0),
|
||||||
|
m_day(nullptr),
|
||||||
|
m_visible(true),
|
||||||
|
m_movable(false),
|
||||||
|
m_minx(0), m_maxx(0),
|
||||||
|
m_miny(0), m_maxy(0),
|
||||||
|
m_physminy(0), m_physmaxy(0),
|
||||||
|
m_code(code),
|
||||||
|
m_width(0), m_height(0),
|
||||||
|
m_X(0), m_Y(0),
|
||||||
|
m_order(0),
|
||||||
|
m_position(LayerCenter)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual ~Layer();
|
||||||
|
|
||||||
|
//! \brief This gets called on day selection, allowing this layer to precalculate any drawing data
|
||||||
|
virtual void SetDay(Day *d);
|
||||||
|
|
||||||
|
//! \brief Set the ChannelID used in this layer
|
||||||
|
virtual void SetCode(ChannelID c) { m_code = c; }
|
||||||
|
//! \brief Return the ChannelID used in this layer
|
||||||
|
const ChannelID &code() { return m_code; }
|
||||||
|
|
||||||
|
//! \brief returns true if this layer contains no data.
|
||||||
|
virtual bool isEmpty();
|
||||||
|
|
||||||
|
//! \brief Override and returns true if there are any highlighted components
|
||||||
|
virtual bool isSelected() { return false; }
|
||||||
|
|
||||||
|
//! \brief Deselect any highlighted components
|
||||||
|
virtual void deselect() { }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical minimum date boundary
|
||||||
|
virtual qint64 Minx() { return m_day ? m_day->first() : m_minx; }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical maximum date boundary
|
||||||
|
virtual qint64 Maxx() { return m_day ? m_day->last() : m_maxx; }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical minimum Yaxis value
|
||||||
|
virtual EventDataType Miny() { return m_miny; }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical maximum Yaxis value
|
||||||
|
virtual EventDataType Maxy() { return m_maxy; }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical minimum Yaxis value
|
||||||
|
virtual EventDataType physMiny() { return m_physminy; }
|
||||||
|
|
||||||
|
//! \brief Return this layers physical maximum Yaxis value
|
||||||
|
virtual EventDataType physMaxy() { return m_physmaxy; }
|
||||||
|
|
||||||
|
//! \brief Set this layers physical minimum date boundary
|
||||||
|
virtual void setMinX(qint64 val) { m_minx = val; }
|
||||||
|
|
||||||
|
//! \brief Set this layers physical maximum date boundary
|
||||||
|
virtual void setMaxX(qint64 val) { m_maxx = val; }
|
||||||
|
|
||||||
|
//! \brief Set this layers physical minimum Yaxis value
|
||||||
|
virtual void setMinY(EventDataType val) { m_miny = val; }
|
||||||
|
|
||||||
|
//! \brief Set this layers physical maximum Yaxis value
|
||||||
|
virtual void setMaxY(EventDataType val) { m_maxy = val; }
|
||||||
|
|
||||||
|
//! \brief Set this layers Visibility status
|
||||||
|
void setVisible(bool b) { m_visible = b; }
|
||||||
|
|
||||||
|
//! \brief Return this layers Visibility status
|
||||||
|
bool visible() const { return m_visible; }
|
||||||
|
|
||||||
|
//! \brief Set this layers Moveability status (not really used yet)
|
||||||
|
void setMovable(bool b) { m_movable = b; }
|
||||||
|
|
||||||
|
//! \brief Return this layers Moveability status (not really used yet)
|
||||||
|
bool movable() const { return m_movable; }
|
||||||
|
|
||||||
|
/*! \brief Override this for the drawing code, using GLBuffer components for drawing
|
||||||
|
\param gGraph & gv Graph Object that holds this layer
|
||||||
|
\param int left
|
||||||
|
\param int top
|
||||||
|
\param int width
|
||||||
|
\param int height
|
||||||
|
*/
|
||||||
|
virtual void paint(gGraph &gv, int left, int top, int width, int height) = 0;
|
||||||
|
|
||||||
|
//! \brief Set the layout position and order for this layer.
|
||||||
|
void setLayout(LayerPosition position, short width, short height, short order);
|
||||||
|
|
||||||
|
void setPos(short x, short y) { m_X = x; m_Y = y; }
|
||||||
|
|
||||||
|
int Width() { return m_width; }
|
||||||
|
int Height() { return m_height; }
|
||||||
|
|
||||||
|
//! \brief Return this Layers Layout Position.
|
||||||
|
LayerPosition position() { return m_position; }
|
||||||
|
//void X() { return m_X; }
|
||||||
|
//void Y() { return m_Y; }
|
||||||
|
|
||||||
|
//! \brief Draw all this layers custom GLBuffers (ie. the actual OpenGL Vertices)
|
||||||
|
virtual void drawGLBuf(float linesize);
|
||||||
|
|
||||||
|
//! \brief not sure why I needed the reference counting stuff.
|
||||||
|
short m_refcount;
|
||||||
|
void addref() { m_refcount++; }
|
||||||
|
bool unref() {
|
||||||
|
m_refcount--;
|
||||||
|
return (m_refcount <= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \brief Add a GLBuffer (vertex) object customized to this layer
|
||||||
|
void addGLBuf(GLBuffer *buf) { mgl_buffers.push_back(buf); }
|
||||||
|
void addVertexBuffer(gVertexBuffer *buf) { mv_buffers.push_back(buf); }
|
||||||
|
|
||||||
|
//QRect bounds; // bounds, relative to top of individual graph.
|
||||||
|
Day *m_day;
|
||||||
|
bool m_visible;
|
||||||
|
bool m_movable;
|
||||||
|
qint64 m_minx, m_maxx;
|
||||||
|
EventDataType m_miny, m_maxy;
|
||||||
|
EventDataType m_physminy, m_physmaxy;
|
||||||
|
ChannelID m_code;
|
||||||
|
short m_width; // reserved x pixels needed for this layer. 0==Depends on position..
|
||||||
|
short m_height; // reserved y pixels needed for this layer. both 0 == expand to all free area.
|
||||||
|
short m_X; // offset for repositionable layers..
|
||||||
|
short m_Y;
|
||||||
|
short m_order; // order for positioning..
|
||||||
|
LayerPosition m_position;
|
||||||
|
QRect m_rect;
|
||||||
|
|
||||||
|
//! \brief A vector containing all this layers custom drawing buffers
|
||||||
|
QVector<GLBuffer *> mgl_buffers;
|
||||||
|
QVector<gVertexBuffer *> mv_buffers;
|
||||||
|
|
||||||
|
//! \brief Mouse wheel moved somewhere over this layer
|
||||||
|
virtual bool wheelEvent(QWheelEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! \brief Mouse moved somewhere over this layer
|
||||||
|
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! \brief Mouse left or right button pressed somewhere on this layer
|
||||||
|
virtual bool mousePressEvent(QMouseEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! \brief Mouse button released that was originally pressed somewhere on this layer
|
||||||
|
virtual bool mouseReleaseEvent(QMouseEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! \brief Mouse button double clicked somewhere on this layer
|
||||||
|
virtual bool mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! \brief A key was pressed on the keyboard while the graph area was focused.
|
||||||
|
virtual bool keyPressEvent(QKeyEvent *event, gGraph *graph) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
Q_UNUSED(graph);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! \class LayerGroup
|
||||||
|
\brief Contains a list of graph Layer objects
|
||||||
|
*/
|
||||||
|
class LayerGroup : public Layer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LayerGroup()
|
||||||
|
: Layer(NoChannel)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual ~LayerGroup();
|
||||||
|
|
||||||
|
//! \brief Add Layer to this Layer Group
|
||||||
|
virtual void AddLayer(Layer *l);
|
||||||
|
|
||||||
|
//! \brief Returns the minimum time value for all Layers contained in this group (milliseconds since epoch)
|
||||||
|
virtual qint64 Minx();
|
||||||
|
|
||||||
|
//! \brief Returns the maximum time value for all Layers contained in this group (milliseconds since epoch)
|
||||||
|
virtual qint64 Maxx();
|
||||||
|
|
||||||
|
//! \brief Returns the minimum Y-axis value for all Layers contained in this group
|
||||||
|
virtual EventDataType Miny();
|
||||||
|
|
||||||
|
//! \brief Returns the maximum Y-axis value for all Layers contained in this group
|
||||||
|
virtual EventDataType Maxy();
|
||||||
|
|
||||||
|
//! \brief Check all layers contained and return true if none contain data
|
||||||
|
virtual bool isEmpty();
|
||||||
|
|
||||||
|
//! \brief Calls SetDay for all Layers contained in this object
|
||||||
|
virtual void SetDay(Day *d);
|
||||||
|
|
||||||
|
//! \brief Calls drawGLBuf for all Layers contained in this object
|
||||||
|
virtual void drawGLBuf(float linesize);
|
||||||
|
|
||||||
|
//! \brief Return the list of Layers this object holds
|
||||||
|
QVector<Layer *> &getLayers() { return layers; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \brief Contains all Layer objects in this group
|
||||||
|
QVector<Layer *> layers;
|
||||||
|
|
||||||
|
//! \brief Mouse wheel moved somewhere over this LayerGroup
|
||||||
|
virtual bool wheelEvent(QWheelEvent *event, gGraph *graph);
|
||||||
|
|
||||||
|
//! \brief Mouse moved somewhere over this LayerGroup
|
||||||
|
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph);
|
||||||
|
|
||||||
|
//! \brief Mouse left or right button pressed somewhere on this LayerGroup
|
||||||
|
virtual bool mousePressEvent(QMouseEvent *event, gGraph *graph);
|
||||||
|
|
||||||
|
//! \brief Mouse button released that was originally pressed somewhere on this LayerGroup
|
||||||
|
virtual bool mouseReleaseEvent(QMouseEvent *event, gGraph *graph);
|
||||||
|
|
||||||
|
//! \brief Mouse button double clicked somewhere on this layerGroup
|
||||||
|
virtual bool mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph);
|
||||||
|
|
||||||
|
//! \brief A key was pressed on the keyboard while the graph area was focused.
|
||||||
|
virtual bool keyPressEvent(QKeyEvent *event, gGraph *graph);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // graphs_layer_h
|
@ -234,7 +234,7 @@ MainWindow::~MainWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trash anything allocated by the Graph objects
|
// Trash anything allocated by the Graph objects
|
||||||
DoneGraphs();
|
DestroyGraphGlobals();
|
||||||
|
|
||||||
// Shutdown and Save the current User profile
|
// Shutdown and Save the current User profile
|
||||||
Profiles::Done();
|
Profiles::Done();
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "SleepLib/loader_plugins/cms50_loader.h"
|
#include "SleepLib/loader_plugins/cms50_loader.h"
|
||||||
#include "SleepLib/event.h"
|
#include "SleepLib/event.h"
|
||||||
#include "SleepLib/calcs.h"
|
#include "SleepLib/calcs.h"
|
||||||
|
#include "Graphs/gFooBar.h"
|
||||||
#include "Graphs/gXAxis.h"
|
#include "Graphs/gXAxis.h"
|
||||||
#include "Graphs/gSummaryChart.h"
|
#include "Graphs/gSummaryChart.h"
|
||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "SleepLib/session.h"
|
#include "SleepLib/session.h"
|
||||||
|
|
||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
#include "Graphs/gFooBar.h"
|
#include "Graphs/gGraphView.h"
|
||||||
|
|
||||||
//! \brief Oximeters current mode
|
//! \brief Oximeters current mode
|
||||||
enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT };
|
enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT };
|
||||||
|
@ -73,102 +73,110 @@ if (win32-msvc2008|win32-msvc2010|win32-msvc2012):!equals(TEMPLATE_PREFIX, "vc")
|
|||||||
|
|
||||||
#include(SleepLib2/sleeplib.pri)
|
#include(SleepLib2/sleeplib.pri)
|
||||||
|
|
||||||
SOURCES += main.cpp\
|
SOURCES += \
|
||||||
|
common_gui.cpp \
|
||||||
|
daily.cpp \
|
||||||
|
exportcsv.cpp \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
newprofile.cpp \
|
||||||
|
oximetry.cpp \
|
||||||
|
overview.cpp \
|
||||||
|
preferencesdialog.cpp \
|
||||||
|
profileselect.cpp \
|
||||||
|
reports.cpp \
|
||||||
|
sessionbar.cpp \
|
||||||
|
summary.cpp \
|
||||||
|
updateparser.cpp \
|
||||||
|
UpdaterWindow.cpp \
|
||||||
|
Graphs/gFlagsLine.cpp \
|
||||||
|
Graphs/gFooBar.cpp \
|
||||||
|
Graphs/gGraph.cpp \
|
||||||
|
Graphs/gGraphView.cpp \
|
||||||
|
Graphs/GLBuffer.cpp \
|
||||||
|
Graphs/glcommon.cpp \
|
||||||
|
Graphs/gLineChart.cpp \
|
||||||
|
Graphs/gLineOverlay.cpp \
|
||||||
|
Graphs/gSegmentChart.cpp \
|
||||||
|
Graphs/gspacer.cpp \
|
||||||
|
Graphs/gStatsLine.cpp \
|
||||||
|
Graphs/gSummaryChart.cpp \
|
||||||
|
Graphs/gVertexBuffer.cpp \
|
||||||
|
Graphs/gXAxis.cpp \
|
||||||
|
Graphs/gYAxis.cpp \
|
||||||
|
Graphs/layer.cpp \
|
||||||
|
SleepLib/calcs.cpp \
|
||||||
|
SleepLib/common.cpp \
|
||||||
|
SleepLib/day.cpp \
|
||||||
|
SleepLib/event.cpp \
|
||||||
SleepLib/machine.cpp \
|
SleepLib/machine.cpp \
|
||||||
SleepLib/machine_loader.cpp \
|
SleepLib/machine_loader.cpp \
|
||||||
SleepLib/preferences.cpp \
|
SleepLib/preferences.cpp \
|
||||||
SleepLib/profiles.cpp \
|
SleepLib/profiles.cpp \
|
||||||
SleepLib/loader_plugins/cms50_loader.cpp \
|
|
||||||
SleepLib/loader_plugins/prs1_loader.cpp \
|
|
||||||
SleepLib/loader_plugins/zeo_loader.cpp \
|
|
||||||
SleepLib/loader_plugins/resmed_loader.cpp \
|
|
||||||
daily.cpp \
|
|
||||||
oximetry.cpp \
|
|
||||||
overview.cpp \
|
|
||||||
mainwindow.cpp \
|
|
||||||
SleepLib/event.cpp \
|
|
||||||
SleepLib/session.cpp \
|
|
||||||
SleepLib/day.cpp \
|
|
||||||
Graphs/gLineChart.cpp \
|
|
||||||
Graphs/gLineOverlay.cpp \
|
|
||||||
Graphs/gFooBar.cpp \
|
|
||||||
Graphs/gXAxis.cpp \
|
|
||||||
Graphs/gYAxis.cpp \
|
|
||||||
Graphs/gFlagsLine.cpp \
|
|
||||||
Graphs/glcommon.cpp \
|
|
||||||
Graphs/gSegmentChart.cpp \
|
|
||||||
preferencesdialog.cpp \
|
|
||||||
Graphs/gGraphView.cpp \
|
|
||||||
Graphs/gStatsLine.cpp \
|
|
||||||
Graphs/gSummaryChart.cpp \
|
|
||||||
SleepLib/schema.cpp \
|
SleepLib/schema.cpp \
|
||||||
profileselect.cpp \
|
SleepLib/session.cpp \
|
||||||
newprofile.cpp \
|
SleepLib/loader_plugins/cms50_loader.cpp \
|
||||||
exportcsv.cpp \
|
|
||||||
common_gui.cpp \
|
|
||||||
SleepLib/loader_plugins/intellipap_loader.cpp \
|
|
||||||
SleepLib/calcs.cpp \
|
|
||||||
updateparser.cpp \
|
|
||||||
UpdaterWindow.cpp \
|
|
||||||
SleepLib/common.cpp \
|
|
||||||
SleepLib/loader_plugins/icon_loader.cpp \
|
SleepLib/loader_plugins/icon_loader.cpp \
|
||||||
|
SleepLib/loader_plugins/intellipap_loader.cpp \
|
||||||
SleepLib/loader_plugins/mseries_loader.cpp \
|
SleepLib/loader_plugins/mseries_loader.cpp \
|
||||||
reports.cpp \
|
SleepLib/loader_plugins/prs1_loader.cpp \
|
||||||
summary.cpp \
|
SleepLib/loader_plugins/resmed_loader.cpp \
|
||||||
sessionbar.cpp \
|
SleepLib/loader_plugins/somnopose_loader.cpp \
|
||||||
Graphs/gspacer.cpp \
|
SleepLib/loader_plugins/zeo_loader.cpp
|
||||||
SleepLib/loader_plugins/somnopose_loader.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
common_gui.h \
|
||||||
|
daily.h \
|
||||||
|
exportcsv.h \
|
||||||
|
mainwindow.h \
|
||||||
|
newprofile.h \
|
||||||
|
oximetry.h \
|
||||||
|
overview.h \
|
||||||
|
preferencesdialog.h \
|
||||||
|
profileselect.h \
|
||||||
|
reports.h \
|
||||||
|
sessionbar.h \
|
||||||
|
summary.h \
|
||||||
|
updateparser.h \
|
||||||
|
UpdaterWindow.h \
|
||||||
|
version.h \
|
||||||
|
Graphs/gFlagsLine.h \
|
||||||
|
Graphs/gFooBar.h \
|
||||||
|
Graphs/gGraph.h \
|
||||||
|
Graphs/gGraphView.h \
|
||||||
|
Graphs/GLBuffer.h \
|
||||||
|
Graphs/glcommon.h \
|
||||||
|
Graphs/gLineChart.h \
|
||||||
|
Graphs/gLineOverlay.h \
|
||||||
|
Graphs/gSegmentChart.h\
|
||||||
|
Graphs/gspacer.h \
|
||||||
|
Graphs/gStatsLine.h \
|
||||||
|
Graphs/gSummaryChart.h \
|
||||||
|
Graphs/gVertexBuffer.h \
|
||||||
|
Graphs/gXAxis.h \
|
||||||
|
Graphs/gYAxis.h \
|
||||||
|
Graphs/layer.h \
|
||||||
|
SleepLib/calcs.h \
|
||||||
|
SleepLib/common.h \
|
||||||
|
SleepLib/day.h \
|
||||||
|
SleepLib/event.h \
|
||||||
SleepLib/machine.h \
|
SleepLib/machine.h \
|
||||||
|
SleepLib/machine_common.h \
|
||||||
SleepLib/machine_loader.h \
|
SleepLib/machine_loader.h \
|
||||||
SleepLib/preferences.h \
|
SleepLib/preferences.h \
|
||||||
SleepLib/profiles.h \
|
SleepLib/profiles.h \
|
||||||
SleepLib/loader_plugins/cms50_loader.h \
|
|
||||||
SleepLib/loader_plugins/prs1_loader.h \
|
|
||||||
SleepLib/loader_plugins/zeo_loader.h \
|
|
||||||
oximetry.h \
|
|
||||||
daily.h \
|
|
||||||
overview.h \
|
|
||||||
mainwindow.h \
|
|
||||||
SleepLib/event.h \
|
|
||||||
SleepLib/machine_common.h \
|
|
||||||
SleepLib/session.h \
|
|
||||||
SleepLib/day.h \
|
|
||||||
Graphs/gLineChart.h \
|
|
||||||
Graphs/gLineOverlay.h \
|
|
||||||
Graphs/gFooBar.h \
|
|
||||||
Graphs/gXAxis.h \
|
|
||||||
Graphs/gYAxis.h \
|
|
||||||
Graphs/gFlagsLine.h \
|
|
||||||
Graphs/glcommon.h \
|
|
||||||
Graphs/gSegmentChart.h\
|
|
||||||
SleepLib/loader_plugins/resmed_loader.h \
|
|
||||||
preferencesdialog.h \
|
|
||||||
Graphs/gGraphView.h \
|
|
||||||
Graphs/gStatsLine.h \
|
|
||||||
Graphs/gSummaryChart.h \
|
|
||||||
SleepLib/schema.h \
|
SleepLib/schema.h \
|
||||||
profileselect.h \
|
SleepLib/session.h \
|
||||||
newprofile.h \
|
SleepLib/loader_plugins/cms50_loader.h \
|
||||||
exportcsv.h \
|
|
||||||
common_gui.h \
|
|
||||||
SleepLib/loader_plugins/intellipap_loader.h \
|
|
||||||
SleepLib/calcs.h \
|
|
||||||
version.h \
|
|
||||||
updateparser.h \
|
|
||||||
UpdaterWindow.h \
|
|
||||||
SleepLib/common.h \
|
|
||||||
SleepLib/loader_plugins/icon_loader.h \
|
SleepLib/loader_plugins/icon_loader.h \
|
||||||
|
SleepLib/loader_plugins/intellipap_loader.h \
|
||||||
SleepLib/loader_plugins/mseries_loader.h \
|
SleepLib/loader_plugins/mseries_loader.h \
|
||||||
reports.h \
|
SleepLib/loader_plugins/prs1_loader.h \
|
||||||
summary.h \
|
SleepLib/loader_plugins/resmed_loader.h \
|
||||||
sessionbar.h \
|
SleepLib/loader_plugins/somnopose_loader.h \
|
||||||
Graphs/gspacer.h \
|
SleepLib/loader_plugins/zeo_loader.h
|
||||||
SleepLib/loader_plugins/somnopose_loader.h
|
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
FORMS += \
|
|
||||||
daily.ui \
|
daily.ui \
|
||||||
overview.ui \
|
overview.ui \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
|
Loading…
Reference in New Issue
Block a user