mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
FooBar Play #2
This commit is contained in:
parent
edcda37c5e
commit
c7924fcebe
@ -72,12 +72,12 @@ void gFooBar::paint(gGraph & w,int left, int top, int width, int height)
|
||||
|
||||
float h=top;
|
||||
|
||||
glLineWidth(1);
|
||||
/* glLineWidth(1);
|
||||
glBegin(GL_LINES);
|
||||
w.qglColor(m_line_color);
|
||||
glVertex2f(start_px, h);
|
||||
glVertex2f(start_px+width, h);
|
||||
glEnd();
|
||||
glEnd(); */
|
||||
|
||||
double rmx=w.rmax_x-w.rmin_x;
|
||||
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
|
||||
@ -86,23 +86,24 @@ void gFooBar::paint(gGraph & w,int left, int top, int width, int height)
|
||||
int extra=0;
|
||||
if (abs(px-py)<2) extra=2;
|
||||
|
||||
int hh=40;
|
||||
int hh=25;
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glColor4ub(255,255,255,128);
|
||||
w.qglColor(m_handle_color);
|
||||
glVertex2f(start_px+px-extra,top-hh);
|
||||
glVertex2f(start_px+py+extra,top-hh);
|
||||
//glColor4ub(255,255,255,128);
|
||||
w.qglColor(m_handle_color);
|
||||
glColor4ub(255,255,255,128);
|
||||
glVertex2f(start_px+py+extra,top-hh/2.0);
|
||||
glVertex2f(start_px+px-extra,top-hh/2.0);
|
||||
// glColor4ub(255,255,255,128);
|
||||
w.qglColor(m_handle_color);
|
||||
glColor4ub(255,255,255,128);
|
||||
glVertex2f(start_px+px-extra,top-hh/2.0);
|
||||
glVertex2f(start_px+py+extra,top-hh/2.0);
|
||||
glColor4ub(192,192,192,128);
|
||||
w.qglColor(m_handle_color);
|
||||
// glColor4ub(192,192,192,128);
|
||||
glVertex2f(start_px+py+extra,h);
|
||||
glVertex2f(start_px+px-extra,h);
|
||||
glEnd();
|
||||
|
@ -547,6 +547,10 @@ void gGraph::ZoomX(double mult,int origin_px)
|
||||
//updateSelectionTime(max-min);
|
||||
}
|
||||
|
||||
void gGraph::DrawTextQue()
|
||||
{
|
||||
m_graphview->DrawTextQue();
|
||||
}
|
||||
|
||||
// margin recalcs..
|
||||
void gGraph::resize(int width, int height)
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
|
||||
short group() { return m_group; }
|
||||
void setGroup(short group) { m_group=group; }
|
||||
void DrawTextQue();
|
||||
|
||||
protected:
|
||||
virtual void paint(int originX, int originY, int width, int height);
|
||||
@ -227,9 +228,9 @@ public:
|
||||
|
||||
void AddTextQue(QString & text, short x, short y, float angle, QColor & color, QFont * font);
|
||||
int horizTravel() { return m_horiz_travel; }
|
||||
void DrawTextQue();
|
||||
protected:
|
||||
|
||||
void DrawTextQue();
|
||||
|
||||
float totalHeight();
|
||||
float scaleHeight();
|
||||
|
@ -11,7 +11,7 @@
|
||||
const int divisors[]={86400000,2880000,14400000,7200000,3600000,2700000,1800000,1200000,900000,600000,300000,120000,60000,45000,30000,20000,15000,10000,5000,2000,1000,100,50,10};
|
||||
const int divcnt=sizeof(divisors)/sizeof(int);
|
||||
|
||||
gXAxis::gXAxis(QColor col)
|
||||
gXAxis::gXAxis(QColor col,bool fadeout)
|
||||
:Layer(EmptyChannel)
|
||||
{
|
||||
m_line_color=col;
|
||||
@ -22,6 +22,7 @@ gXAxis::gXAxis(QColor col)
|
||||
m_show_minor_lines=false;
|
||||
m_show_minor_ticks=true;
|
||||
m_show_major_ticks=true;
|
||||
m_fadeout=fadeout;
|
||||
QDateTime d=QDateTime::currentDateTime();
|
||||
QTime t1=d.time();
|
||||
QTime t2=d.toUTC().time();
|
||||
@ -194,6 +195,31 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height)
|
||||
glDrawArrays(GL_LINES, 0, vertcnt>>1);
|
||||
glDisableClientState(GL_VERTEX_ARRAY); // deactivate vertex arrays after drawing
|
||||
|
||||
|
||||
if (m_fadeout) {
|
||||
|
||||
glFlush();
|
||||
w.DrawTextQue();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glBegin(GL_QUADS);
|
||||
glColor4ub(255,255,255,255);
|
||||
glVertex2f(left-20,top+5);
|
||||
glVertex2f(left-20,top+height);
|
||||
glColor4ub(255,255,255,0);
|
||||
glVertex2f(left+40,top+height);
|
||||
glVertex2f(left+40,top+5);
|
||||
|
||||
glColor4ub(255,255,255,0);
|
||||
glVertex2f(left+width-40,top+5);
|
||||
glVertex2f(left+width-40,top+height);
|
||||
glColor4ub(255,255,255,255);
|
||||
glVertex2f(left+width+20,top+height);
|
||||
glVertex2f(left+width+20,top+5);
|
||||
glEnd();
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
// glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
class gXAxis:public Layer
|
||||
{
|
||||
public:
|
||||
gXAxis(QColor col=QColor("black"));
|
||||
gXAxis(QColor col=QColor("black"),bool fadeout=true);
|
||||
virtual ~gXAxis();
|
||||
virtual void paint(gGraph & w,int left,int top, int width, int height);
|
||||
static const int Margin=25; // How much room does this take up. (Bottom margin)
|
||||
@ -31,10 +31,12 @@ class gXAxis:public Layer
|
||||
bool m_show_minor_ticks;
|
||||
bool m_show_major_ticks;
|
||||
|
||||
|
||||
QColor m_line_color;
|
||||
QColor m_text_color;
|
||||
QColor m_major_color;
|
||||
QColor m_minor_color;
|
||||
bool m_fadeout;
|
||||
qint64 tz_offset;
|
||||
};
|
||||
#endif // GXAXIS_H
|
||||
|
@ -97,7 +97,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
||||
SF->AddLayer(new gShadowArea());
|
||||
SF->AddLayer(new gYSpacer(),LayerLeft,gYAxis::Margin);
|
||||
SF->AddLayer(new gFooBar(),LayerBottom,0,10);
|
||||
SF->AddLayer(new gXAxis(),LayerBottom,0,gXAxis::Margin);
|
||||
SF->AddLayer(new gXAxis(Qt::black,false),LayerBottom,0,gXAxis::Margin);
|
||||
|
||||
PRD->AddLayer(new gXGrid());
|
||||
PRD->AddLayer(AddCPAP(new gLineChart(CPAP_Pressure,QColor("dark green"),true)));
|
||||
|
Loading…
Reference in New Issue
Block a user