aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-31 13:59:55 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-31 13:59:55 +0100
commit91d764ba59a478aa08c294d0cc1a18bf0ad848b6 (patch)
tree908035703940e3c6670259ee920da4a8d9d48423 /src
parentb8b73bb9ed5678434d82b573bf677785ee57fc69 (diff)
Improve UI
Diffstat (limited to 'src')
-rw-r--r--src/game_tab/GameTab.cpp9
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.cpp3
-rw-r--r--src/game_tab/right_panel/GameTabRightPanel.cpp8
-rw-r--r--src/game_tab/right_panel/editor/EditorCanvas.cpp5
4 files changed, 23 insertions, 2 deletions
diff --git a/src/game_tab/GameTab.cpp b/src/game_tab/GameTab.cpp
index 3326f12..743346b 100644
--- a/src/game_tab/GameTab.cpp
+++ b/src/game_tab/GameTab.cpp
@@ -45,6 +45,15 @@ GameTab::GameTab(wxFrame *parent, std::shared_ptr<Game> game)
}
ed->Notify();
});
+ Bind(wxEVT_MOUSEWHEEL, [p=this,bp=board_panel,ed=editor_panel](wxMouseEvent& event){
+ if(event.GetWheelRotation()<0){
+ bp->NextMove(true);
+ }else {
+ bp->PreviousMove(true);
+ }
+ ed->Notify();
+ });
+
}
void GameTab::OnToolClick(wxCommandEvent &event){
diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp
index 42bf517..3e1744c 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.cpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.cpp
@@ -383,6 +383,9 @@ void BoardCanvas::MouseEvent(wxMouseEvent &event) {
}
}
}
+ if (event.GetWheelRotation() != 0) {
+ event.ResumePropagation(1);event.Skip();
+ }
}
void BoardCanvas::Zoom(std::int32_t zoom) {
diff --git a/src/game_tab/right_panel/GameTabRightPanel.cpp b/src/game_tab/right_panel/GameTabRightPanel.cpp
index f2694e5..9bdc29c 100644
--- a/src/game_tab/right_panel/GameTabRightPanel.cpp
+++ b/src/game_tab/right_panel/GameTabRightPanel.cpp
@@ -48,6 +48,14 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
}
});
+ // Propagate key events of the game editor
+ editor_page->Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ editor_page->Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ notebook->Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ notebook->Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+
ApplyPreferences();
}
diff --git a/src/game_tab/right_panel/editor/EditorCanvas.cpp b/src/game_tab/right_panel/editor/EditorCanvas.cpp
index 0a32589..b65ece8 100644
--- a/src/game_tab/right_panel/editor/EditorCanvas.cpp
+++ b/src/game_tab/right_panel/editor/EditorCanvas.cpp
@@ -6,6 +6,8 @@ EditorCanvas::EditorCanvas(wxFrame *parent)
CGEditor::status.MoveIconWidth));
t.ResizePieces(CGEditor::status.MoveIconWidth);
default_font=wxFont(*wxNORMAL_FONT).MakeBold();
+ Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
+ Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
}
void EditorCanvas::OnPaint(wxPaintEvent &event) {
@@ -236,5 +238,4 @@ void EditorCanvas::OnKeyEvent(wxKeyEvent &event) {
}
wxBEGIN_EVENT_TABLE(EditorCanvas, wxPanel) EVT_PAINT(EditorCanvas::OnPaint)
- EVT_MOUSE_EVENTS(EditorCanvas::MouseEvent)
- EVT_CHAR_HOOK(EditorCanvas::OnKeyEvent) wxEND_EVENT_TABLE()
+ EVT_MOUSE_EVENTS(EditorCanvas::MouseEvent) wxEND_EVENT_TABLE()