Skip to content

Commit

Permalink
Save and load grid bordercolor to/from XML attribute (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo committed Jun 3, 2024
1 parent 6831e0b commit 66590c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ struct Grid {
const int font_size = 14 - indent / 2;
const int grid_border_width =
cell == doc->rootgrid ? root_grid_spacing : user_grid_outer_spacing - 1;
Formatter(r, format, indent, L"<grid>\n",
Formatter(r, format, indent,
wxString::Format(L"<grid bordercolor=\"0x%06X\">\n", bordercolor),
wxString::Format(L"<table style=\"border-width: %dpt; font-size: %dpt;\">\n",
grid_border_width, font_size)
.wc_str(),
Expand Down
4 changes: 4 additions & 0 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,17 @@ struct System {
if (!i) {
desiredxs = xs ? xs : 1;
c->AddGrid(desiredxs, ns.size());
c->grid->bordercolor = std::stoi(
n->GetAttribute(L"bordercolor", L"0xA0A0A0").ToStdString(), nullptr, 0);
}
loop(j, desiredxs) if (ins.size() > j)
FillXML(c->grid->C(j, i), ins[j], attributestoo);
ins.setsize_nd(0);
}
} else {
c->AddGrid(1, numrows);
c->grid->bordercolor = std::stoi(
n->GetAttribute(L"bordercolor", L"0xA0A0A0").ToStdString(), nullptr, 0);
loopv(i, ps) c->grid->C(0, i)->text.t = ps[i]->GetValue();
loopv(i, ns) FillXML(c->grid->C(0, i + ps.size()), ns[i], attributestoo);
}
Expand Down

0 comments on commit 66590c0

Please sign in to comment.