From 0aead6321d46a749667eb93026f5f30d0034b24b Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 9 Jun 2011 13:43:51 +1000 Subject: [PATCH] More mouse control bugs fixed --- Projects/CodeBlocks/SleepyHead.depend | 4 +- src/graphs/graph.cpp | 55 ++++++++++++++++----------- src/version.h | 12 +++--- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Projects/CodeBlocks/SleepyHead.depend b/Projects/CodeBlocks/SleepyHead.depend index 219bfcec..0dbb3144 100644 --- a/Projects/CodeBlocks/SleepyHead.depend +++ b/Projects/CodeBlocks/SleepyHead.depend @@ -8304,7 +8304,7 @@ -1307587520 /home/mark/projects/git/sleepyhead/src/version.h +1307590941 /home/mark/projects/git/sleepyhead/src/version.h 1307418393 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h "machine.h" @@ -8341,7 +8341,7 @@ "sleeplib/profiles.h" "sleeplib/machine_loader.h" -1307586493 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp +1307590711 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp diff --git a/src/graphs/graph.cpp b/src/graphs/graph.cpp index fbfdffc7..2848b246 100644 --- a/src/graphs/graph.cpp +++ b/src/graphs/graph.cpp @@ -530,20 +530,25 @@ void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event) m_mouseLDown=false; m_mouseRBrect=wxRect(0, 0, 0, 0); - if (hot1.Contains(x,y) || zoom_in) { + + if (hot1.Contains(x,y) && !m_drag_foobar) { int t1=MIN(x1,x2); int t2=MAX(x1,x2); + if ((t2-t1)>3) { - ZoomXPixels(t1,t2); // Range Selected - } else { - double zoom_fact=0.5; - if (event.ControlDown()) zoom_fact=0.25; - for (list::iterator g=link_zoom.begin();g!=link_zoom.end();g++) { - (*g)->ZoomX(zoom_fact,event.GetX()); - } - if (!m_block_zoom) { - ZoomX(zoom_fact,event.GetX()); //event.GetX()); // adds origin to zoom out.. Doesn't look that cool. - } + // Range Selected + ZoomXPixels(t1,t2); + } + + } + if (hot1.Contains(x,y) || zoom_in) { + double zoom_fact=0.5; + if (event.ControlDown()) zoom_fact=0.25; + for (list::iterator g=link_zoom.begin();g!=link_zoom.end();g++) { + (*g)->ZoomX(zoom_fact,event.GetX()); + } + if (!m_block_zoom) { + ZoomX(zoom_fact,event.GetX()); //event.GetX()); // adds origin to zoom out.. Doesn't look that cool. } } else { Refresh(); @@ -1416,7 +1421,7 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) int start_px=w.GetLeftMargin(); int start_py=w.GetTopMargin(); int width=scrx-(w.GetLeftMargin()+w.GetRightMargin())-1; - int height=scry-(w.GetTopMargin()+w.GetBottomMargin())-1; + int height=scry-(w.GetTopMargin()+w.GetBottomMargin()); double minx=w.min_x,miny=w.min_y; double maxx=w.max_x,maxy=w.max_y; @@ -1431,10 +1436,10 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) static wxPen pen1(*wxLIGHT_GREY, 1, wxDOT); dc.SetPen( *wxBLACK_PEN ); - dc.DrawLine(start_px,start_py,start_px,start_py+height+1); - dc.DrawLine(start_px,start_py+height+1,start_px+width+1,start_py+height+1); + dc.DrawLine(start_px,start_py,start_px,start_py+height); + dc.DrawLine(start_px,start_py+height,start_px+width+1,start_py+height); // dc.DrawLine(start_px,start_py,start_px+width,start_py); - dc.DrawLine(start_px+width+1,start_py,start_px+width+1,start_py+height+1); + dc.DrawLine(start_px+width+1,start_py,start_px+width+1,start_py+height); //foobar->Plot(dc,w); @@ -1722,11 +1727,18 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) dc.SetFont(*smallfont); - double line_h=(height+1)/double(total_lines); - //int r=int(height) % total_lines; + double line_h=floor(double(height-2)/double(total_lines)); + double r=fmod(height-2,total_lines); + line_h=round(line_h)+1; + double line_top=start_py+line_num*line_h; + + + if ((line_num==total_lines-1) && (r>0)) { // first lines responsibility to draw the title. + //double q=ceil(r); + //if (q>1) q-=2; + line_h-=1; + } //else ceil(line_h); - double line_top=start_py+round(line_num*line_h)-1; - //double line_bottom=line_top+line_h; dc.SetPen(*wxBLACK); if (line_num & 1) { @@ -1734,13 +1746,12 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) } else { dc.SetBrush(linebr2); } - dc.DrawRectangle(start_px,line_top,width+1,round(line_h+1)); + dc.DrawRectangle(start_px,line_top,width+1,line_h+1); int x,y; dc.GetTextExtent(label,&x,&y); dc.DrawText(label,start_px-x-6,line_top+(line_h/2)-(y/2)); - /*if (line_num==0) { // first lines responsibility to draw the title. - int lw=x; + /*int lw=x; dc.GetTextExtent(w.Title(),&x,&y); dc.DrawRotatedText(w.Title(), start_px-8-lw - y, start_py+((height + x)>>1), 90); } */ diff --git a/src/version.h b/src/version.h index bc5f40ce..1fed0212 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 = 3942; - static const long REVISION = 4680; + static const long BUILD = 3989; + static const long REVISION = 4935; //Miscellaneous Version Types - static const long BUILDS_COUNT = 2043; - #define RC_FILEVERSION 0,7,3942,4680 - #define RC_FILEVERSION_STRING "0, 7, 3942, 4680\0" - static const char FULLVERSION_STRING[] = "0.7.3942.4680"; + static const long BUILDS_COUNT = 2169; + #define RC_FILEVERSION 0,7,3989,4935 + #define RC_FILEVERSION_STRING "0, 7, 3989, 4935\0" + static const char FULLVERSION_STRING[] = "0.7.3989.4935"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 0;