mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-22 05:30:44 +00:00
LineChart bugs fixed and unused variable cleanup
This commit is contained in:
parent
26b20656f5
commit
3c807ab98e
@ -8309,7 +8309,7 @@
|
|||||||
|
|
||||||
1308026543 D
|
1308026543 D
|
||||||
|
|
||||||
1308218980 /home/mark/projects/git/sleepyhead/src/version.h
|
1308221530 /home/mark/projects/git/sleepyhead/src/version.h
|
||||||
|
|
||||||
1308003040 ent of cb2ab33... Linux wx2.8 & wx2.9 builds fixed
|
1308003040 ent of cb2ab33... Linux wx2.8 & wx2.9 builds fixed
|
||||||
<wx/dcbuffer.h>
|
<wx/dcbuffer.h>
|
||||||
@ -8362,7 +8362,7 @@
|
|||||||
"sleeplib/profiles.h"
|
"sleeplib/profiles.h"
|
||||||
"sleeplib/machine_loader.h"
|
"sleeplib/machine_loader.h"
|
||||||
|
|
||||||
1308218737 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
1308221527 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
||||||
"freetype-gl/font-manager.h"
|
"freetype-gl/font-manager.h"
|
||||||
"freetype-gl/texture-font.h"
|
"freetype-gl/texture-font.h"
|
||||||
"graph.h"
|
"graph.h"
|
||||||
|
@ -59,33 +59,37 @@ wxColor *wxDARK_GREY=&zwxDARK_GREY;
|
|||||||
bool gfont_init=false;
|
bool gfont_init=false;
|
||||||
|
|
||||||
FontManager *font_manager;
|
FontManager *font_manager;
|
||||||
TextureFont *zfont=NULL;
|
TextureFont *bigfont=NULL,*zfont=NULL;
|
||||||
VertexBuffer *vbuffer=NULL;
|
VertexBuffer *vbuffer=NULL;
|
||||||
TextMarkup *markup=NULL;
|
TextMarkup *markup=NULL;
|
||||||
|
|
||||||
// Must be called from a thread inside the application.
|
// Must be called from a thread inside the application.
|
||||||
void GraphInit()
|
void GraphInit()
|
||||||
{
|
{
|
||||||
|
#if defined(__WXMSW__)
|
||||||
static bool glewinit_called=false;
|
static bool glewinit_called=false;
|
||||||
|
if (!glewinit_called) {
|
||||||
|
glewInit(); // Dont forget this nasty little sucker.. :)
|
||||||
|
glewinit_called=true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gfont_init) {
|
if (!gfont_init) {
|
||||||
#if defined(__WXMSW__)
|
|
||||||
if (!glewinit_called) {
|
|
||||||
glewInit(); // Dont forget this nasty little sucker.. :)
|
|
||||||
glewinit_called=true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
wxString glvendor=wxString((char *)glGetString(GL_VENDOR),wxConvUTF8);
|
wxString glvendor=wxString((char *)glGetString(GL_VENDOR),wxConvUTF8);
|
||||||
wxString glrenderer=wxString((char *)glGetString(GL_RENDERER),wxConvUTF8);
|
wxString glrenderer=wxString((char *)glGetString(GL_RENDERER),wxConvUTF8);
|
||||||
wxString glversion=wxString((char *)glGetString(GL_VERSION),wxConvUTF8);
|
wxString glversion=wxString((char *)glGetString(GL_VERSION),wxConvUTF8);
|
||||||
wxLogDebug(wxT("GLInfo: ")+glvendor+wxT(" ")+glrenderer+wxT(" ")+glversion);
|
wxLogDebug(wxT("GLInfo: ")+glvendor+wxT(" ")+glrenderer+wxT(" ")+glversion);
|
||||||
|
|
||||||
|
// Despite the stupid warning, this does NOT always evaluate as true. Too lazy to put it in #ifdefs
|
||||||
if (!glGenBuffers) {
|
if (!glGenBuffers) {
|
||||||
wxLogError(wxT("Sorry, your computers graphics card drivers are too old to run this program.\n")+glvendor+wxT(" may have an update"));
|
wxLogError(wxT("Sorry, your computers graphics card drivers are too old to run this program.\n")+glvendor+wxT(" may have an update."));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
font_manager=new FontManager();
|
font_manager=new FontManager();
|
||||||
vbuffer=new VertexBuffer((char *)"v3i:t2f:c4f");
|
vbuffer=new VertexBuffer((char *)"v3i:t2f:c4f");
|
||||||
zfont=font_manager->GetFromFilename(pref.Get("{home}{sep}FreeSans.ttf"),12);
|
zfont=font_manager->GetFromFilename(pref.Get("{home}{sep}FreeSans.ttf"),12);
|
||||||
|
bigfont=font_manager->GetFromFilename(pref.Get("{home}{sep}FreeSans.ttf"),32);
|
||||||
markup=new TextMarkup();
|
markup=new TextMarkup();
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, font_manager->m_atlas->m_texid );
|
glBindTexture( GL_TEXTURE_2D, font_manager->m_atlas->m_texid );
|
||||||
@ -134,7 +138,7 @@ void GetTextExtent(wxString text, float & width, float & height, TextureFont *fo
|
|||||||
width+=glyph->m_advance_x;
|
width+=glyph->m_advance_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DrawText2(wxString text, float x, float y,TextureFont *font)
|
void DrawText2(wxString text, float x, float y,TextureFont *font=zfont) // The actual raw font drawing routine..
|
||||||
{
|
{
|
||||||
Pen pen;
|
Pen pen;
|
||||||
pen.x=x;
|
pen.x=x;
|
||||||
@ -592,9 +596,9 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int y=event.GetY();
|
||||||
|
int x=event.GetX();
|
||||||
if (foobar && m_drag_foobar) {
|
if (foobar && m_drag_foobar) {
|
||||||
int y=event.GetY();
|
|
||||||
int x=event.GetX();
|
|
||||||
if (x<GetLeftMargin()) return;
|
if (x<GetLeftMargin()) return;
|
||||||
int x1=x-GetLeftMargin();
|
int x1=x-GetLeftMargin();
|
||||||
|
|
||||||
@ -644,8 +648,8 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (event.m_rightDown) {
|
if (event.m_rightDown) {
|
||||||
MoveX(event.GetX() - m_mouseRClick.x);
|
MoveX(x - m_mouseRClick.x);
|
||||||
m_mouseRClick.x=event.GetX();
|
m_mouseRClick.x=x;
|
||||||
double min=MinX();
|
double min=MinX();
|
||||||
double max=MaxX();
|
double max=MaxX();
|
||||||
if (pref["LinkGraphMovement"]) {
|
if (pref["LinkGraphMovement"]) {
|
||||||
@ -657,7 +661,7 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event)
|
|||||||
if (event.m_leftDown) {
|
if (event.m_leftDown) {
|
||||||
|
|
||||||
int x1=m_mouseLClick.x;
|
int x1=m_mouseLClick.x;
|
||||||
int x2=event.GetX();
|
int x2=x;
|
||||||
int t1=MIN(x1,x2);
|
int t1=MIN(x1,x2);
|
||||||
int t2=MAX(x1,x2);
|
int t2=MAX(x1,x2);
|
||||||
if (t1<=m_marginLeft) t1=m_marginLeft+1;
|
if (t1<=m_marginLeft) t1=m_marginLeft+1;
|
||||||
@ -762,7 +766,7 @@ void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
|
|||||||
if (m_block_zoom) { // && hot1.Contains(x,y)) {
|
if (m_block_zoom) { // && hot1.Contains(x,y)) {
|
||||||
|
|
||||||
|
|
||||||
bool zoom_in=false;
|
//bool zoom_in=false;
|
||||||
bool did_draw=false;
|
bool did_draw=false;
|
||||||
|
|
||||||
// Finished Dragging the FooBar?
|
// Finished Dragging the FooBar?
|
||||||
@ -792,14 +796,14 @@ void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
double zoom_fact=2;
|
double zoom_fact=2;
|
||||||
if (event.GetY()<GetTopMargin()) {
|
if (y<GetTopMargin()) {
|
||||||
return;
|
return;
|
||||||
} else if (event.GetY()>m_scrY-GetBottomMargin()) {
|
} else if (y>m_scrY-GetBottomMargin()) {
|
||||||
if (!foobar) return;
|
if (!foobar) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.ControlDown()) zoom_fact=5.0;
|
if (event.ControlDown()) zoom_fact=5.0;
|
||||||
if (abs(event.GetX()-m_mouseRClick_start.x)<3 && abs(event.GetY()-m_mouseRClick_start.y)<3) {
|
if (abs(x-m_mouseRClick_start.x)<3 && abs(y-m_mouseRClick_start.y)<3) {
|
||||||
// for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) {
|
// for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) {
|
||||||
//(*g)->ZoomX(zoom_fact,0);
|
//(*g)->ZoomX(zoom_fact,0);
|
||||||
//}
|
//}
|
||||||
@ -1345,7 +1349,7 @@ void gGraphWindow::DataChanged(gLayer *layer)
|
|||||||
max_x=min_x=0;
|
max_x=min_x=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long l=t.GetMilliseconds().GetLo();
|
//long l=t.GetMilliseconds().GetLo();
|
||||||
//wxLogMessage(wxString::Format(wxT("%li"),l));
|
//wxLogMessage(wxString::Format(wxT("%li"),l));
|
||||||
if ((t==wxTimeSpan::Milliseconds(0)) && (layer!=lastlayer)) {
|
if ((t==wxTimeSpan::Milliseconds(0)) && (layer!=lastlayer)) {
|
||||||
lastlayer=layer;
|
lastlayer=layer;
|
||||||
@ -1797,7 +1801,7 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
t1=floor(px);
|
t1=floor(px);
|
||||||
t2=data->point[0][i].m_y*pxr;
|
t2=data->point[0][i].m_y*pxr;
|
||||||
px+=t2;
|
px+=t2;
|
||||||
t2=ceil(t2)+1;
|
t2=ceil(t2);
|
||||||
if (m_direction==wxVERTICAL) {
|
if (m_direction==wxVERTICAL) {
|
||||||
rect=wxRect(start_px,t1,barwidth,t2);
|
rect=wxRect(start_px,t1,barwidth,t2);
|
||||||
dir=wxEAST;
|
dir=wxEAST;
|
||||||
@ -1826,8 +1830,8 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
}
|
}
|
||||||
str+=wxString::Format(wxT("%0.1f"),data->point[0][i].m_x);
|
str+=wxString::Format(wxT("%0.1f"),data->point[0][i].m_x);
|
||||||
GetTextExtent(str, x, y);
|
GetTextExtent(str, x, y);
|
||||||
x+=5;
|
//x+=5;
|
||||||
if (t2>x) {
|
if (t2>x+5) {
|
||||||
int j=t1+((t2/2)-(x/2));
|
int j=t1+((t2/2)-(x/2));
|
||||||
if (m_direction==wxVERTICAL) {
|
if (m_direction==wxVERTICAL) {
|
||||||
DrawText(str,start_px+barwidth+2+y,j,270.0,*wxBLACK);
|
DrawText(str,start_px+barwidth+2+y,j,270.0,*wxBLACK);
|
||||||
@ -2013,8 +2017,8 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
if (m_report_empty) {
|
if (m_report_empty) {
|
||||||
wxString msg=_("No Waveform Available");
|
wxString msg=_("No Waveform Available");
|
||||||
float x,y;
|
float x,y;
|
||||||
GetTextExtent(msg,x,y);
|
GetTextExtent(msg,x,y,bigfont);
|
||||||
DrawText(msg,start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),0,*wxDARK_GREY); //,largefont);
|
DrawText(msg,start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),0,*wxDARK_GREY,bigfont);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2035,7 +2039,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
//glEnable(GL_LINE_SMOOTH);
|
//glEnable(GL_LINE_SMOOTH);
|
||||||
//glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
//glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
|
||||||
const int maxverts=65536; // Resolution dependant..
|
const int maxverts=65536*2; // Resolution dependant..
|
||||||
int vertcnt=0;
|
int vertcnt=0;
|
||||||
static GLshort vertarray[maxverts+8];
|
static GLshort vertarray[maxverts+8];
|
||||||
|
|
||||||
@ -2053,7 +2057,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
bool first=true;
|
bool first=true;
|
||||||
wxPoint2DDouble * point=data->point[n];
|
wxPoint2DDouble * point=data->point[n];
|
||||||
|
|
||||||
double sr=point[1].m_x-point[0].m_x;// Time distance between points
|
sr=point[1].m_x-point[0].m_x;// Time distance between points
|
||||||
|
|
||||||
// Calculate the number of points to skip when too much data.
|
// Calculate the number of points to skip when too much data.
|
||||||
if (accel) {
|
if (accel) {
|
||||||
@ -2086,30 +2090,37 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
double x1=point[0].m_x;
|
double x1=point[0].m_x;
|
||||||
double x2=point[siz-1].m_x;
|
double x2=point[siz-1].m_x;
|
||||||
assert(x1<x2);
|
assert(x1<x2);
|
||||||
int idx=0;
|
|
||||||
|
|
||||||
if (minx>x2) continue; // don't even bother this round (segments could be out of order)
|
if (minx>x2) continue; // don't even bother this round (segments could be out of order)
|
||||||
if (maxx<x1) continue;
|
if (maxx<x1) continue;
|
||||||
|
|
||||||
if (minx>x1) {
|
int idx=0;
|
||||||
double j=minx-x1; // == starting min of first sample in this segment
|
|
||||||
idx=floor(j/sr);
|
|
||||||
} // else just start from the beginning
|
|
||||||
|
|
||||||
int idxend=0;
|
int idxend=0;
|
||||||
idxend=floor(xx/sr);
|
int np=0;
|
||||||
idxend/=sam; // devide by number of samples skips
|
if (m_accelerate) {
|
||||||
int np=(idxend-idx)+sam;
|
if (minx>x1) {
|
||||||
|
double j=minx-x1; // == starting min of first sample in this segment
|
||||||
|
idx=floor(j/sr);
|
||||||
|
} // else just start from the beginning
|
||||||
|
|
||||||
// better to do it here than in the main loop.
|
idxend=floor(xx/sr);
|
||||||
if (!accel) {
|
idxend/=sam; // devide by number of samples skips
|
||||||
np<<=2;
|
np=(idxend-idx)+sam;
|
||||||
if (m_square_plot) np<<=1; // double it again
|
np /= sam;
|
||||||
assert(np<maxverts);
|
|
||||||
} else {
|
} else {
|
||||||
np/=sam;
|
np=siz;
|
||||||
np <<=2;
|
}
|
||||||
assert(np<maxverts);
|
|
||||||
|
bool watch_verts_carefully=false;
|
||||||
|
// better to do it here than in the main loop.
|
||||||
|
np <<= 2;
|
||||||
|
|
||||||
|
if (!accel && m_square_plot)
|
||||||
|
np <<= 1; // double it again
|
||||||
|
|
||||||
|
if (np>=maxverts) {
|
||||||
|
watch_verts_carefully=true;
|
||||||
|
//assert(np<maxverts);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool firstpx=true;
|
bool firstpx=true;
|
||||||
@ -2276,7 +2287,6 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
for (int n=0;n<data->VC();n++) {
|
for (int n=0;n<data->VC();n++) {
|
||||||
|
|
||||||
// bool done=false;
|
// bool done=false;
|
||||||
bool first=true;
|
|
||||||
for (int i=0;i<data->np[n];i++) {
|
for (int i=0;i<data->np[n];i++) {
|
||||||
wxPoint2DDouble & rp=data->point[n][i];
|
wxPoint2DDouble & rp=data->point[n][i];
|
||||||
if (rp.m_y < w.min_x) continue;
|
if (rp.m_y < w.min_x) continue;
|
||||||
@ -2426,7 +2436,7 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
GetTextExtent(label,x,y);
|
GetTextExtent(label,x,y);
|
||||||
DrawText(label,start_px-x-6,line_top+(line_h/2)-(y/2));
|
DrawText(label,start_px-x-6,line_top+(line_h/2)-(y/2));
|
||||||
|
|
||||||
float x1,x2,w1;
|
float x1,x2;
|
||||||
|
|
||||||
wxColor & col=color[0];
|
wxColor & col=color[0];
|
||||||
|
|
||||||
@ -2435,8 +2445,6 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
|
|
||||||
for (int n=0;n<data->VC();n++) {
|
for (int n=0;n<data->VC();n++) {
|
||||||
if (!data->np[n]) continue;
|
if (!data->np[n]) continue;
|
||||||
//bool done=false;
|
|
||||||
bool first=true;
|
|
||||||
|
|
||||||
for (int i=0;i<data->np[n];i++) {
|
for (int i=0;i<data->np[n];i++) {
|
||||||
wxPoint2DDouble & rp=data->point[n][i];
|
wxPoint2DDouble & rp=data->point[n][i];
|
||||||
|
@ -16,14 +16,14 @@ namespace AutoVersion{
|
|||||||
//Standard Version Type
|
//Standard Version Type
|
||||||
static const long _MAJOR = 0;
|
static const long _MAJOR = 0;
|
||||||
static const long _MINOR = 7;
|
static const long _MINOR = 7;
|
||||||
static const long _BUILD = 6280;
|
static const long _BUILD = 6296;
|
||||||
static const long _REVISION = 17605;
|
static const long _REVISION = 17689;
|
||||||
|
|
||||||
//Miscellaneous Version Types
|
//Miscellaneous Version Types
|
||||||
static const long _BUILDS_COUNT = 7188;
|
static const long _BUILDS_COUNT = 7222;
|
||||||
#define _RC_FILEVERSION 0,7,6280,17605
|
#define _RC_FILEVERSION 0,7,6296,17689
|
||||||
#define _RC_FILEVERSION_STRING "0, 7, 6280, 17605\0"
|
#define _RC_FILEVERSION_STRING "0, 7, 6296, 17689\0"
|
||||||
static const char _FULLVERSION_STRING[] = "0.7.6280.17605";
|
static const char _FULLVERSION_STRING[] = "0.7.6296.17689";
|
||||||
|
|
||||||
//These values are to keep track of your versioning state, don't modify them.
|
//These values are to keep track of your versioning state, don't modify them.
|
||||||
static const long _BUILD_HISTORY = 0;
|
static const long _BUILD_HISTORY = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user