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>
<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
"machine.h"
@ -8341,7 +8341,7 @@
"sleeplib/profiles.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/dcbuffer.h>
<wx/log.h>
@ -8356,7 +8356,7 @@
<wx/ffile.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>
<wx/colour.h>
<wx/log.h>

View File

@ -297,11 +297,13 @@ void gGraphWindow::OnMouseMove(wxMouseEvent &event)
}
void gGraphWindow::OnMouseRightDown(wxMouseEvent &event)
{
m_mouseRClick.x = event.GetX();
m_mouseRClick.y = event.GetY();
if ( (event.GetY()>=GetTopMargin()) && (event.GetY()<=m_scrY-GetBottomMargin())) {
m_mouseRClick.x = event.GetX();
m_mouseRClick.y = event.GetY();
m_mouseRClick_start=m_mouseRClick;
m_mouseRDown=true;
m_mouseRClick_start=m_mouseRClick;
m_mouseRDown=true;
}
event.Skip();
}
@ -309,13 +311,15 @@ void gGraphWindow::OnMouseRightDown(wxMouseEvent &event)
void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
{
double zoom_fact=2;
if (event.ControlDown()) zoom_fact=5.0;
if (abs(event.GetX()-m_mouseRClick_start.x)<3 && abs(event.GetY()-m_mouseRClick_start.y)<3) {
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 ( (event.GetY()>=GetTopMargin()) && (event.GetY()<=m_scrY-GetBottomMargin())) {
if (event.ControlDown()) zoom_fact=5.0;
if (abs(event.GetX()-m_mouseRClick_start.x)<3 && abs(event.GetY()-m_mouseRClick_start.y)<3) {
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.
}
}
}
m_mouseRDown=false;
@ -324,14 +328,22 @@ void gGraphWindow::OnMouseRightRelease(wxMouseEvent &event)
}
void gGraphWindow::OnMouseLeftDown(wxMouseEvent &event)
{
m_mouseLClick.x = event.GetX();
m_mouseLClick.y = event.GetY();
int 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;
event.Skip();
m_mouseLDown=true;
event.Skip();
}
}
void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event)
{
if ( (event.GetY()<GetTopMargin()) || (event.GetY()>m_scrY-GetBottomMargin())) {
return;
}
wxPoint release(event.GetX(), m_scrY-m_marginBottom);
wxPoint press(m_mouseLClick.x, m_marginTop);
m_mouseLDown=false;

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 7;
static const long BUILD = 3749;
static const long REVISION = 3692;
static const long BUILD = 3756;
static const long REVISION = 3731;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 1636;
#define RC_FILEVERSION 0,7,3749,3692
#define RC_FILEVERSION_STRING "0, 7, 3749, 3692\0"
static const char FULLVERSION_STRING[] = "0.7.3749.3692";
static const long BUILDS_COUNT = 1659;
#define RC_FILEVERSION 0,7,3756,3731
#define RC_FILEVERSION_STRING "0, 7, 3756, 3731\0"
static const char FULLVERSION_STRING[] = "0.7.3756.3731";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 0;