mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-03 02:37:39 +00:00
Improve UI
This commit is contained in:
parent
d23718225a
commit
2fd237a78f
8 changed files with 883 additions and 755 deletions
|
@ -40,6 +40,13 @@ GameTabRightPanel::GameTabRightPanel(wxFrame *parent, std::shared_ptr<Game> game
|
|||
this->Bind(wxEVT_BUTTON, &GameTabRightPanel::OnDelete, this, DELETE_BTN);
|
||||
this->Bind(wxEVT_BUTTON, &GameTabRightPanel::OnLiveAnalysis, this,
|
||||
LIVE_ANALYSIS_GAME_BUTTON);
|
||||
nag_panel->Bind(wxEVT_BUTTON, [p=this](wxCommandEvent &e){
|
||||
HalfMove *m = p->game->GetCurrentMove();
|
||||
if (m != NULL) {
|
||||
m->nag=p->GetNagFromStr(((wxButton*)e.GetEventObject())->GetLabel().ToStdString());
|
||||
p->editor_canvas->Refresh();
|
||||
}
|
||||
});
|
||||
|
||||
ApplyPreferences();
|
||||
}
|
||||
|
@ -204,4 +211,13 @@ void GameTabRightPanel::OnNextMove(wxCommandEvent &event) {
|
|||
game->Next();
|
||||
Notify();
|
||||
NotifyBoard();
|
||||
}
|
||||
|
||||
std::string GameTabRightPanel::GetNagFromStr(std::string str){
|
||||
// TODO: Bind more NAG!
|
||||
if(str=="!")
|
||||
return "$1";
|
||||
if(str=="?")
|
||||
return "$2";
|
||||
return "";
|
||||
}
|
|
@ -40,4 +40,5 @@ public:
|
|||
void OnLiveAnalysis(wxCommandEvent &event);
|
||||
void ApplyPreferences();
|
||||
void OnLiveEngineClose(wxCloseEvent &e);
|
||||
std::string GetNagFromStr(std::string str);
|
||||
};
|
|
@ -5,6 +5,7 @@ EditorCanvas::EditorCanvas(wxFrame *parent)
|
|||
hide_icon = LoadPNG("hide", wxSize(CGEditor::status.MoveIconWidth,
|
||||
CGEditor::status.MoveIconWidth));
|
||||
t.ResizePieces(CGEditor::status.MoveIconWidth);
|
||||
default_font=wxFont(*wxNORMAL_FONT).MakeBold();
|
||||
}
|
||||
|
||||
void EditorCanvas::OnPaint(wxPaintEvent &event) {
|
||||
|
@ -40,6 +41,7 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) {
|
|||
// TODO: Optimize brush!!!! Always instanciated at each call
|
||||
dc->SetPen(wxNullPen);
|
||||
dc->SetBrush(*wxRED_BRUSH);
|
||||
dc->SetFont(default_font);
|
||||
if (e.prop & cgeditor::Property::Rectangle) {
|
||||
if (e.prop & cgeditor::Property::Scrollbarbg) {
|
||||
dc->SetBrush(*wxCYAN_BRUSH);
|
||||
|
@ -93,19 +95,69 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) {
|
|||
dc->DrawRectangle(recToDraw);
|
||||
dc->DrawText(wxString(e.text), wxPoint(e.x, Middle(e).y));
|
||||
} else {
|
||||
std::string text=e.text;
|
||||
if (e.prop & cgeditor::Property::Move) {
|
||||
if (e.prop & cgeditor::Property::Current) {
|
||||
wxRect recToDraw(e.x, e.y, e.width, e.height);
|
||||
dc->SetBrush(wxBrush(wxColour(216, 216, 216)));
|
||||
dc->DrawRectangle(recToDraw);
|
||||
}
|
||||
if(e.prop & cgeditor::Property::Nag){
|
||||
if(text=="$0")
|
||||
text="";
|
||||
else if(text=="$1")
|
||||
text="!";
|
||||
else if(text=="$2")
|
||||
text="?";
|
||||
else if(text=="$3")
|
||||
text="!!";
|
||||
else if(text=="$4")
|
||||
text="??";
|
||||
else if(text=="$5")
|
||||
text="!?";
|
||||
else if(text=="$6")
|
||||
text="?!";
|
||||
else if(text=="$10")
|
||||
text="=";
|
||||
else if(text=="$13")
|
||||
text="∞";
|
||||
else if(text=="$14")
|
||||
text="⩲ ";
|
||||
else if(text=="$15")
|
||||
text="⩱";
|
||||
else if(text=="$16")
|
||||
text="±";
|
||||
else if(text=="$17")
|
||||
text="∓";
|
||||
else if(text=="$18")
|
||||
text="+-";
|
||||
else if(text=="$19")
|
||||
text="-+";
|
||||
else if(text=="$22"||text=="$23")
|
||||
text="⨀";
|
||||
else if(text=="$26"||text=="$27")
|
||||
text="○";
|
||||
else if(text=="$32"||text=="$33")
|
||||
text="⟳";
|
||||
else if(text=="$36"||text=="$37")
|
||||
text="↑";
|
||||
else if(text=="$40"||text=="$41")
|
||||
text="→";
|
||||
else if(text=="$44" || text=="$45")
|
||||
text="⯹";
|
||||
else if(text=="$138" || text=="$139")
|
||||
text="⨁";
|
||||
else
|
||||
text="NA";
|
||||
}
|
||||
// Draw move text
|
||||
if (CGEditor::status.UseMoveIcons) {
|
||||
dc->DrawText(wxString(e.text), wxPoint(e.x, Middle(e).y));
|
||||
dc->DrawText(wxString(text), wxPoint(e.x, Middle(e).y));
|
||||
} else {
|
||||
dc->DrawText(wxString(e.text), Middle(e));
|
||||
dc->DrawText(wxString(text), Middle(e));
|
||||
}
|
||||
} else {
|
||||
dc->DrawText(wxString(e.text), Middle(e));
|
||||
dc->DrawText(wxString(text), Middle(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ class EditorCanvas : public wxPanel, public cgeditor::CGEditor {
|
|||
wxPoint Middle(cgeditor::Element e);
|
||||
wxBitmap hide_icon;
|
||||
Theme t;
|
||||
wxFont default_font;
|
||||
|
||||
public:
|
||||
EditorCanvas(wxFrame *parent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue