diff --git a/Projects/CodeBlocks/SleepyHead.depend b/Projects/CodeBlocks/SleepyHead.depend index 4cbd4bdb..efdf41cd 100644 --- a/Projects/CodeBlocks/SleepyHead.depend +++ b/Projects/CodeBlocks/SleepyHead.depend @@ -8306,7 +8306,7 @@ -1307850405 /home/mark/projects/git/sleepyhead/src/version.h +1307857376 /home/mark/projects/git/sleepyhead/src/version.h 1307627540 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h "machine.h" @@ -8324,7 +8324,7 @@ "preferences.h" "tinyxml/tinyxml.h" -1307789411 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp +1307855899 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -8344,7 +8344,7 @@ "sleeplib/profiles.h" "sleeplib/machine_loader.h" -1307848441 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp +1307856797 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp @@ -8352,6 +8352,8 @@ + + "graph.h" "sleeplib/profiles.h" "freesans.c" diff --git a/src/SleepyHeadMain.cpp b/src/SleepyHeadMain.cpp index aafa7145..e3f38a4b 100644 --- a/src/SleepyHeadMain.cpp +++ b/src/SleepyHeadMain.cpp @@ -76,7 +76,8 @@ const long profile_version=0; SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame) : GUIFrame(frame) { - GraphInit(); + //GraphInit(); // Don't do this here: The first gGraphWindow must do it. + wxString title=wxTheApp->GetAppName()+wxT(" v")+wxString(AutoVersion::FULLVERSION_STRING,wxConvUTF8); SetTitle(title); diff --git a/src/graphs/graph.cpp b/src/graphs/graph.cpp index fed4c2e0..70d94027 100644 --- a/src/graphs/graph.cpp +++ b/src/graphs/graph.cpp @@ -53,9 +53,9 @@ wxColor *wxDARK_GREY=&zwxDARK_GREY; wxFont *smallfont=NULL,*bigfont=NULL,*boldfont=NULL; bool gfont_init=false; -FTGLPixmapFont *normalfont=NULL; -FTGLPixmapFont *largefont=NULL; -FTGLTextureFont *rotfont=NULL; +FTFont *normalfont=NULL; +FTFont *largefont=NULL; +FTFont *rotfont=NULL; list font_paths; @@ -90,9 +90,9 @@ void GraphInit() delete rotfont; rotfont=NULL; } - rotfont->FaceSize(14); largefont->FaceSize(30); normalfont->FaceSize(14); + rotfont->FaceSize(14); bigfont=new wxFont(32,wxFONTFAMILY_ROMAN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL); boldfont=new wxFont(12,wxFONTFAMILY_ROMAN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD); smallfont=new wxFont(10,wxFONTFAMILY_ROMAN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL); @@ -111,54 +111,56 @@ void GraphDone() } } -void GetTextExtent(wxString text, float & width, float & height,float pointsize=14) +void GetTextExtent(wxString text, float & width, float & height, FTFont *font=normalfont) { - FTBBox box=normalfont->BBox(text.mb_str(),-1); + FTBBox box=font->BBox(text.mb_str(),-1); width = box.Upper().X() - box.Lower().X(); - height = normalfont->Ascender(); -} -void GetTextExtentB(wxString text, float & width, float & height,float pointsize=14) -{ - FTBBox box=rotfont->BBox(text.mb_str(),-1); - width = box.Upper().X() - box.Lower().X(); - height = rotfont->Ascender(); + height = font->Ascender(); } -void DrawText(wxString text, float x, float y, float angle=0, float pointsize=14, const wxColor & color=*wxBLACK) +void DrawText(wxString text, float x, float y, float angle=0, const wxColor & color=*wxBLACK,FTFont *font=normalfont) { - if (angle==0) { - if (!normalfont) { - wxLogError(wxT("Font Problem. Forgot to call GraphInit() ?")); - abort(); - return; - } - glPixelTransferf(GL_RED_BIAS, -1.0f); - glPixelTransferf(GL_GREEN_BIAS, -1.0f); - glPixelTransferf(GL_BLUE_BIAS, -1.0f); - //Dark red textglPixelTransferf(GL_RED_BIAS, -0.5f);glPixelTransferf(GL_GREEN_BIAS, -1.0f);glPixelTransferf(GL_BLUE_BIAS, -1.0f); - - //normalfont->FaceSize(pointsize); - normalfont->Render(text.mb_str(),-1,FTPoint(x,y)); //,x,y); - return; - } - if (!rotfont) { + if (!font) { wxLogError(wxT("Font Problem. Forgot to call GraphInit() ?")); abort(); return; } + if (angle==0) { + glPixelTransferf(GL_RED_BIAS, -1.0f); + glPixelTransferf(GL_GREEN_BIAS, -1.0f); + glPixelTransferf(GL_BLUE_BIAS, -1.0f); + glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha()); + //Dark red textglPixelTransferf(GL_RED_BIAS, -0.5f);glPixelTransferf(GL_GREEN_BIAS, -1.0f);glPixelTransferf(GL_BLUE_BIAS, -1.0f); - glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha()); + //normalfont->FaceSize(pointsize); + font->Render(text.mb_str(),-1,FTPoint(x,y)); //,x,y); + return; + } - //normalfont->FaceSize(pointsize); + + // Damn this crap.. Shouldn't have to do this each draw.. + //font->FaceSize(14); float w,h; - GetTextExtentB(text, w, h,pointsize); + GetTextExtent(text, w, h, font); + glPushMatrix(); -// glLoadIdentity(); + //glEnable(GL_BLEND); +// glPixelTransferf(GL_RED_BIAS, -1.0f); + //glPixelTransferf(GL_GREEN_BIAS, -1.0f); + //glPixelTransferf(GL_BLUE_BIAS, -1.0f); + + glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha()); + //glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ZERO); + // glBlendFunc(GL_ONE, GL_ZERO); + //glLoadIdentity(); glTranslatef(x,y,0); glRotatef(90.0, 0.0f, 0.0f, 1.0f); - rotfont->Render(text.mb_str(),-1,FTPoint(-w/2.0,-h/2.0)); + glEnable(GL_TEXTURE_2D); + font->Render(text.mb_str(),-1,FTPoint(-w/2.0,-h/2.0)); glTranslatef(-x,-y,0); + //glDisable(GL_BLEND); + //glEnable(GL_TEXTURE_2D); glPopMatrix(); } @@ -276,7 +278,6 @@ gGraphWindow::gGraphWindow() gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & title,const wxPoint &pos,const wxSize &size,long flags) : wxGLCanvas( parent, (wxGLContext *)NULL, id, pos, size, flags, title, (int *)wx_gl_attribs, wxNullPalette ) { - //GraphInit(); m_scrX = m_scrY = 64; m_title=title; m_mouseRDown=m_mouseLDown=false; @@ -293,12 +294,16 @@ gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & titl #if defined(__DARWIN__) // Screw you apple.. - AGLPixelFormat aglpf=ChoosePixelFormat(NULL); + int *attribList = (int*) NULL; + AGLPixelFormat aglpf=aglChoosePixelFormat(attribList); gl_context=new wxGLContext(aglpf,this,wxNullPalette,NULL); + // Mmmmm.. Platform incosistency with wx.. + #else gl_context=new wxGLContext(this,NULL); #endif - rotfont->FaceSize(14); + GraphInit(); // Font +//rotfont->FaceSize(14); AddLayer(new gGraphTitle(title,wxVERTICAL,boldfont)); @@ -862,6 +867,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& event) glVertex2f(m_scrX, m_scrY); glEnd(); + glEnable(GL_TEXTURE_2D); //glMatrixMode(GL_PROJECTION); //glPopMatrix(); //glMatrixMode(GL_MODELVIEW); @@ -1480,14 +1486,13 @@ void gGraphTitle::Plot(wxDC & dc, gGraphWindow & w) float width,height; if (m_orientation==wxHORIZONTAL) { - GetTextExtent(m_title,width,height,15); - DrawText(m_title,4,scrx-height,0,15); + GetTextExtent(m_title,width,height); + DrawText(m_title,4,scrx-height,0); } else { - GetTextExtentB(m_title,width,height,18); + GetTextExtent(m_title,width,height,rotfont); int xp=(height/2)+5; if (m_alignment==wxALIGN_RIGHT) xp=scrx-4-height; - DrawText(m_title,xp,w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)+(height/2),90.0,18); - //DrawText(m_title,scrx/2.0,scry/2.0,90.0,18); + DrawText(m_title,xp,w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)+(height/2),90.0,*wxBLACK,rotfont); } } @@ -1746,7 +1751,7 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w) if (m_direction==wxVERTICAL) { DrawText(str,start_px-textX-8,j); } else { - DrawText(str,j,start_py-16-(textX/2),90); + DrawText(str,j,start_py-16-(textX/2),90,*wxBLACK,rotfont); } } else draw_xticks_instead=true; @@ -1835,8 +1840,8 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) if (m_report_empty) { wxString msg=_("No Waveform Available"); float x,y; //,descent,leading; - GetTextExtent(msg,x,y,40);//,&descent,&leading); - DrawText(msg,start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),0,40,*wxDARK_GREY); + GetTextExtent(msg,x,y,largefont);//,&descent,&leading); + DrawText(msg,start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),0,*wxDARK_GREY,largefont); } return; } @@ -2254,7 +2259,7 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) } RoundedRectangle(start_px,line_top,width-1,line_h+1,0,*barcol); float x,y; - GetTextExtent(label,x,y,12); + GetTextExtent(label,x,y); DrawText(label,start_px-x-6,line_top+(line_h/2)-(y/2)); int x1,x2; diff --git a/src/version.h b/src/version.h index 5d827bec..03ba9fe1 100644 --- a/src/version.h +++ b/src/version.h @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 5015; - static const long REVISION = 10677; + static const long BUILD = 5067; + static const long REVISION = 10967; //Miscellaneous Version Types - static const long BUILDS_COUNT = 4428; - #define RC_FILEVERSION 0,7,5015,10677 - #define RC_FILEVERSION_STRING "0, 7, 5015, 10677\0" - static const char FULLVERSION_STRING[] = "0.7.5015.10677"; + static const long BUILDS_COUNT = 4555; + #define RC_FILEVERSION 0,7,5067,10967 + #define RC_FILEVERSION_STRING "0, 7, 5067, 10967\0" + static const char FULLVERSION_STRING[] = "0.7.5067.10967"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 0;