summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-03 17:12:32 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-03 17:12:32 (GMT)
commit299c1da9ae6b79ddb6cc39477ad31fb1d2a3c566 (patch)
treea867e45707c6d819761782c90af00b0f6093cbcc /src
parent838a612026c821c03e663c818d4bc9fe740febd8 (diff)
downloadpowder-299c1da9ae6b79ddb6cc39477ad31fb1d2a3c566.zip
powder-299c1da9ae6b79ddb6cc39477ad31fb1d2a3c566.tar.gz
Search and stamps scolling with mouse wheel, Esc to exit
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp2
-rw-r--r--src/game/GameView.cpp4
-rw-r--r--src/interface/Keys.h1
-rw-r--r--src/search/SearchView.cpp16
-rw-r--r--src/search/SearchView.h3
-rw-r--r--src/stamps/StampsView.cpp15
-rw-r--r--src/stamps/StampsView.h2
7 files changed, 43 insertions, 0 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 3408ec5..7b7ba20 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -97,6 +97,8 @@ public:
{
cc->gameModel->SetStamp(cc->stamps->GetStamp());
}
+ else
+ cc->gameModel->SetStamp(NULL);
}
};
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index c7dc063..4067d5a 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -717,6 +717,10 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo
void GameView::OnTick(float dt)
{
+ if(selectMode==PlaceStamp && !stampThumb)
+ selectMode = SelectNone;
+ if(selectMode==PlaceClipboard&& !clipboardThumb)
+ selectMode = SelectNone;
if(zoomEnabled && !zoomCursorFixed)
c->SetZoomPosition(currentMouse);
if(drawMode == DrawPoints)
diff --git a/src/interface/Keys.h b/src/interface/Keys.h
index 5350b06..71c5928 100644
--- a/src/interface/Keys.h
+++ b/src/interface/Keys.h
@@ -9,6 +9,7 @@
#define KEY_TAB SDLK_TAB
#define KEY_RETURN SDLK_RETURN
#define KEY_ENTER SDLK_KP_ENTER
+#define KEY_ESCAPE SDLK_ESCAPE
#define KEY_CTRL SDLK_LCTRL
#define KEY_ALT SDLK_LALT
diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp
index 5bcbe06..4b9b6b2 100644
--- a/src/search/SearchView.cpp
+++ b/src/search/SearchView.cpp
@@ -241,3 +241,19 @@ void SearchView::OnTick(float dt)
{
c->Update();
}
+
+void SearchView::OnMouseWheel(int x, int y, int d)
+{
+ if(!d)
+ return;
+ if(d<0)
+ c->NextPage();
+ else
+ c->PrevPage();
+}
+void SearchView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
+{
+ if(key==KEY_ESCAPE)
+ c->Exit();
+}
+
diff --git a/src/search/SearchView.h b/src/search/SearchView.h
index 0103419..af43a8c 100644
--- a/src/search/SearchView.h
+++ b/src/search/SearchView.h
@@ -37,6 +37,9 @@ public:
virtual ~SearchView();
void AttachController(SearchController * _c) { c = _c; }
virtual void OnTick(float dt);
+ virtual void OnMouseWheel(int x, int y, int d);
+ virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
+
};
#endif // SEARCHVIEW_H
diff --git a/src/stamps/StampsView.cpp b/src/stamps/StampsView.cpp
index bddfb4f..c0d5981 100644
--- a/src/stamps/StampsView.cpp
+++ b/src/stamps/StampsView.cpp
@@ -133,6 +133,21 @@ void StampsView::NotifyStampsListChanged(StampsModel * sender)
}
}
+void StampsView::OnMouseWheel(int x, int y, int d)
+{
+ if(!d)
+ return;
+ if(d<0)
+ c->NextPage();
+ else
+ c->PrevPage();
+}
+void StampsView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
+{
+ if(key==KEY_ESCAPE)
+ c->Exit();
+}
+
StampsView::~StampsView() {
// TODO Auto-generated destructor stub
}
diff --git a/src/stamps/StampsView.h b/src/stamps/StampsView.h
index a906cdc..02e5569 100644
--- a/src/stamps/StampsView.h
+++ b/src/stamps/StampsView.h
@@ -29,6 +29,8 @@ public:
void AttachController(StampsController * c_) { c = c_; };
void NotifyPageChanged(StampsModel * sender);
void NotifyStampsListChanged(StampsModel * sender);
+ virtual void OnMouseWheel(int x, int y, int d);
+ virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
virtual ~StampsView();
};