This commit is contained in:
Loic Guegan 2022-12-31 09:40:39 +01:00
parent f1f638100f
commit 2bb6730df8
7 changed files with 62 additions and 51 deletions

View file

@ -128,7 +128,7 @@ MyHalfMove *BuildExampleGame() {
m2 = new MyHalfMove("Bc4");
m->SetMainline(m2);
m->SetComment("Italian Opening");
m->comment="Italian Opening";
m = m2;
m2 = new MyHalfMove("Bc5");
@ -136,7 +136,7 @@ MyHalfMove *BuildExampleGame() {
m = m2;
m2 = new MyHalfMove("c3");
m2->SetComment("Giuoco Pianissimo");
m2->comment="Giuoco Pianissimo";
m->SetMainline(m2);
m = m2;
@ -158,7 +158,7 @@ MyHalfMove *BuildExampleGame() {
{
MyHalfMove *var = new MyHalfMove("Re1");
var->SetComment("Also possible");
var->comment="Also possible";
m->AddVariation(var);
MyHalfMove *var2 = new MyHalfMove("a6");
@ -185,6 +185,8 @@ MyHalfMove *BuildExampleGame() {
m2 = new MyHalfMove("a6");
m->SetMainline(m2);
m->comment="Test for a very long comment, to see how line breaks are handle by the framework.";
m->comment+="Test for a very long comment, to see how line breaks are handle by the framework.";
m = m2;
m2 = new MyHalfMove("Bb3");

View file

@ -29,6 +29,9 @@ private:
void OnPaint(wxPaintEvent &event) {
wxPaintDC current_dc(this);
dc = &current_dc;
wxSize fontsize=dc->GetTextExtent("a");
wxLogDebug("width=%d, height=%d",fontsize.x,fontsize.y);
// Refresh canvas size
wxSize sz = GetClientSize();
@ -105,6 +108,8 @@ private:
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
} else if (e.prop & cgeditor::Property::Button) {
dc->SetBrush(*wxBLACK_BRUSH);
} else if (e.prop & cgeditor::Property::Comment) {
dc->SetBrush(*wxYELLOW_BRUSH);
}
wxRect recToDraw(e.x, e.y, e.width, e.height);
dc->DrawRectangle(recToDraw);
@ -118,7 +123,7 @@ private:
dc->DrawText(wxString(e.text), Middle(e));
} else if (e.prop & cgeditor::Property::Comment) {
wxRect recToDraw(e.x, e.y, e.width, e.height);
dc->SetBrush(*wxYELLOW_BRUSH);
dc->SetBrush(*wxBLUE_BRUSH);
dc->DrawRectangle(recToDraw);
dc->DrawText(wxString(e.text), wxPoint(e.x, e.y));
} else if (e.prop & cgeditor::Property::Menuitem) {