From 2b635d111c82f84b422de71df17bd034e04e3784 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 9 Jun 2011 00:35:56 +1000 Subject: [PATCH] Neaten up foobars movement when dragged from different spots --- Projects/CodeBlocks/SleepyHead.depend | 6 ++-- src/graphs/graph.cpp | 49 +++++++++------------------ src/graphs/graph.h | 1 + src/version.h | 12 +++---- 4 files changed, 26 insertions(+), 42 deletions(-) diff --git a/Projects/CodeBlocks/SleepyHead.depend b/Projects/CodeBlocks/SleepyHead.depend index 15c8f2ae..2cc7362d 100644 --- a/Projects/CodeBlocks/SleepyHead.depend +++ b/Projects/CodeBlocks/SleepyHead.depend @@ -8300,11 +8300,11 @@ "tinyxml/tinyxml.h" -1307539764 /home/mark/projects/git/sleepyhead/src/graphs/graph.h +1307543245 /home/mark/projects/git/sleepyhead/src/graphs/graph.h -1307541836 /home/mark/projects/git/sleepyhead/src/version.h +1307543626 /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" -1307541170 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp +1307543431 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp diff --git a/src/graphs/graph.cpp b/src/graphs/graph.cpp index cbfbe437..a4478770 100644 --- a/src/graphs/graph.cpp +++ b/src/graphs/graph.cpp @@ -140,7 +140,7 @@ gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & titl m_block_move=false; m_block_zoom=false; m_drag_foobar=false; - + m_foobar_pos=0; } gGraphWindow::~gGraphWindow() { @@ -295,7 +295,10 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event) // qx is centerpoint of new zoom area. double dx=MaxX()-MinX(); // zoom rect width; - double gx=dx/2.0; + + // Could smarten this up by remembering where the mouse was clicked on the foobar + + double gx=dx*m_foobar_pos; qx-=gx; if (qx(m_scrY-GetBottomMargin())+5) && (y<(m_scrY-GetBottomMargin())+15)) { + } else if ((y>(m_scrY-GetBottomMargin())+5) && (y<(m_scrY-GetBottomMargin())+20)) { double rx=RealMaxX()-RealMinX(); double qx=double(width)/rx; double minx=MinX()-RealMinX(); @@ -398,11 +400,13 @@ void gGraphWindow::OnMouseLeftDown(wxMouseEvent &event) int x1=(qx*minx); int x2=(qx*maxx); // length in pixels + int xw=x2-x1; x1+=GetLeftMargin(); x2+=GetLeftMargin(); - if ((x>x1) && (xx1) && (x3) { ZoomXPixels(t1,t2); } else { @@ -470,11 +456,8 @@ void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event) } } - r=wxRect(0, 0, 0, 0); - - - m_mouseRBrect=r; } + event.Skip(); } diff --git a/src/graphs/graph.h b/src/graphs/graph.h index 59e985ae..bc6ddc12 100644 --- a/src/graphs/graph.h +++ b/src/graphs/graph.h @@ -218,6 +218,7 @@ class gGraphWindow:public wxWindow // rename to gGraphWindow bool m_block_move; bool m_block_zoom; bool m_drag_foobar; + double m_foobar_pos; std::list layers; wxColour m_bgColour; //!< Background Colour wxColour m_fgColour; //!< Foreground Colour diff --git a/src/version.h b/src/version.h index 82eded03..f21a6003 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 = 3797; - static const long REVISION = 3939; + static const long BUILD = 3815; + static const long REVISION = 4044; //Miscellaneous Version Types - static const long BUILDS_COUNT = 1739; - #define RC_FILEVERSION 0,7,3797,3939 - #define RC_FILEVERSION_STRING "0, 7, 3797, 3939\0" - static const char FULLVERSION_STRING[] = "0.7.3797.3939"; + static const long BUILDS_COUNT = 1780; + #define RC_FILEVERSION 0,7,3815,4044 + #define RC_FILEVERSION_STRING "0, 7, 3815, 4044\0" + static const char FULLVERSION_STRING[] = "0.7.3815.4044"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 0;