Changed mouse zoom hotspot behaviour

Note:
Now you must click within the X/Y axis margins (the main drawing area) to zoom.
I did this so we can add controls buttons outside of margins and stuff
This commit is contained in:
Mark Watkins 2011-06-08 21:46:24 +10:00
parent 5d857e16b3
commit c457d47ebe
3 changed files with 36 additions and 24 deletions

View File

@ -8304,7 +8304,7 @@
<sleeplib/machine.h> <sleeplib/machine.h>
<list> <list>
1307529367 /home/mark/projects/git/sleepyhead/src/version.h 1307533474 /home/mark/projects/git/sleepyhead/src/version.h
1307418393 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h 1307418393 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h
"machine.h" "machine.h"
@ -8341,7 +8341,7 @@
"sleeplib/profiles.h" "sleeplib/profiles.h"
"sleeplib/machine_loader.h" "sleeplib/machine_loader.h"
1307528077 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp 1307533395 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
<wx/settings.h> <wx/settings.h>
<wx/dcbuffer.h> <wx/dcbuffer.h>
<wx/log.h> <wx/log.h>
@ -8356,7 +8356,7 @@
<wx/ffile.h> <wx/ffile.h>
<wx/utils.h> <wx/utils.h>
1307527853 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/machine.cpp 1307529366 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/machine.cpp
<tr1/random> <tr1/random>
<wx/colour.h> <wx/colour.h>
<wx/log.h> <wx/log.h>

View File

@ -297,11 +297,13 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event)
} }
void gGraphWindow::OnMouseRightDown(wxMouseEvent &event) void gGraphWindow::OnMouseRightDown(wxMouseEvent &event)
{ {
m_mouseRClick.x = event.GetX(); if ( (event.GetY()>=GetTopMargin()) && (event.GetY()<=m_scrY-GetBottomMargin())) {
m_mouseRClick.y = event.GetY(); m_mouseRClick.x = event.GetX();
m_mouseRClick.y = event.GetY();
m_mouseRClick_start=m_mouseRClick; m_mouseRClick_start=m_mouseRClick;
m_mouseRDown=true; m_mouseRDown=true;
}
event.Skip(); event.Skip();
} }
@ -309,13 +311,15 @@ void gGraphWindow::OnMouseRightDown(wxMouseEvent &event)
void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event) void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
{ {
double zoom_fact=2; double zoom_fact=2;
if (event.ControlDown()) zoom_fact=5.0; if ( (event.GetY()>=GetTopMargin()) && (event.GetY()<=m_scrY-GetBottomMargin())) {
if (abs(event.GetX()-m_mouseRClick_start.x)<3 && abs(event.GetY()-m_mouseRClick_start.y)<3) { if (event.ControlDown()) zoom_fact=5.0;
for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) { if (abs(event.GetX()-m_mouseRClick_start.x)<3 && abs(event.GetY()-m_mouseRClick_start.y)<3) {
(*g)->ZoomX(zoom_fact,0); for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) {
} (*g)->ZoomX(zoom_fact,0);
if (!m_block_zoom) { }
ZoomX(zoom_fact,0); //event.GetX()); // adds origin to zoom out.. Doesn't look that cool. if (!m_block_zoom) {
ZoomX(zoom_fact,0); //event.GetX()); // adds origin to zoom out.. Doesn't look that cool.
}
} }
} }
m_mouseRDown=false; m_mouseRDown=false;
@ -324,14 +328,22 @@ void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
} }
void gGraphWindow::OnMouseLeftDown(wxMouseEvent &event) void gGraphWindow::OnMouseLeftDown(wxMouseEvent &event)
{ {
m_mouseLClick.x = event.GetX(); int y=event.GetY();
m_mouseLClick.y = event.GetY(); int top=GetTopMargin();
if ((y>=top) && (y<=m_scrY-GetBottomMargin())) {
m_mouseLClick.x = event.GetX();
m_mouseLClick.y = y;
m_mouseLDown=true; m_mouseLDown=true;
event.Skip(); event.Skip();
}
} }
void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event) void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event)
{ {
if ( (event.GetY()<GetTopMargin()) || (event.GetY()>m_scrY-GetBottomMargin())) {
return;
}
wxPoint release(event.GetX(), m_scrY-m_marginBottom); wxPoint release(event.GetX(), m_scrY-m_marginBottom);
wxPoint press(m_mouseLClick.x, m_marginTop); wxPoint press(m_mouseLClick.x, m_marginTop);
m_mouseLDown=false; m_mouseLDown=false;

View File

@ -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 = 3749; static const long BUILD = 3756;
static const long REVISION = 3692; static const long REVISION = 3731;
//Miscellaneous Version Types //Miscellaneous Version Types
static const long BUILDS_COUNT = 1636; static const long BUILDS_COUNT = 1659;
#define RC_FILEVERSION 0,7,3749,3692 #define RC_FILEVERSION 0,7,3756,3731
#define RC_FILEVERSION_STRING "0, 7, 3749, 3692\0" #define RC_FILEVERSION_STRING "0, 7, 3756, 3731\0"
static const char FULLVERSION_STRING[] = "0.7.3749.3692"; static const char FULLVERSION_STRING[] = "0.7.3756.3731";
//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;