mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Improve UI
This commit is contained in:
parent
b8b73bb9ed
commit
91d764ba59
4 changed files with 23 additions and 2 deletions
|
@ -45,6 +45,15 @@ GameTab::GameTab(wxFrame *parent, std::shared_ptr<Game> game)
|
||||||
}
|
}
|
||||||
ed->Notify();
|
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){
|
void GameTab::OnToolClick(wxCommandEvent &event){
|
||||||
|
|
|
@ -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) {
|
void BoardCanvas::Zoom(std::int32_t zoom) {
|
||||||
|
|
|
@ -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();
|
ApplyPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ EditorCanvas::EditorCanvas(wxFrame *parent)
|
||||||
CGEditor::status.MoveIconWidth));
|
CGEditor::status.MoveIconWidth));
|
||||||
t.ResizePieces(CGEditor::status.MoveIconWidth);
|
t.ResizePieces(CGEditor::status.MoveIconWidth);
|
||||||
default_font=wxFont(*wxNORMAL_FONT).MakeBold();
|
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) {
|
void EditorCanvas::OnPaint(wxPaintEvent &event) {
|
||||||
|
@ -236,5 +238,4 @@ void EditorCanvas::OnKeyEvent(wxKeyEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(EditorCanvas, wxPanel) EVT_PAINT(EditorCanvas::OnPaint)
|
wxBEGIN_EVENT_TABLE(EditorCanvas, wxPanel) EVT_PAINT(EditorCanvas::OnPaint)
|
||||||
EVT_MOUSE_EVENTS(EditorCanvas::MouseEvent)
|
EVT_MOUSE_EVENTS(EditorCanvas::MouseEvent) wxEND_EVENT_TABLE()
|
||||||
EVT_CHAR_HOOK(EditorCanvas::OnKeyEvent) wxEND_EVENT_TABLE()
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue