mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Catch all exceptions in onPaint functions, because otherwise we show a message box. Message boxes while in a paint handler lead to a crash on win32.
Made a CATCH_ALL_ERRORS macro containing the common catch statements. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1034 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -985,16 +985,18 @@ size_t GraphControl::getDimensionality() const {
|
||||
|
||||
void GraphControl::onPaint(wxPaintEvent&) {
|
||||
wxBufferedPaintDC dc(this);
|
||||
wxSize cs = GetClientSize();
|
||||
RotatedDC rdc(dc, 0, RealRect(RealPoint(0,0),cs), 1, QUALITY_LOW);
|
||||
rdc.SetPen(*wxTRANSPARENT_PEN);
|
||||
rdc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
rdc.DrawRectangle(rdc.getInternalRect());
|
||||
if (graph) {
|
||||
for (int layer = LAYER_BOTTOM ; layer < LAYER_COUNT ; ++layer) {
|
||||
graph->draw(rdc, current_item, (DrawLayer)layer);
|
||||
try {
|
||||
wxSize cs = GetClientSize();
|
||||
RotatedDC rdc(dc, 0, RealRect(RealPoint(0,0),cs), 1, QUALITY_LOW);
|
||||
rdc.SetPen(*wxTRANSPARENT_PEN);
|
||||
rdc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
rdc.DrawRectangle(rdc.getInternalRect());
|
||||
if (graph) {
|
||||
for (int layer = LAYER_BOTTOM ; layer < LAYER_COUNT ; ++layer) {
|
||||
graph->draw(rdc, current_item, (DrawLayer)layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
} CATCH_ALL_ERRORS(false); // don't show message boxes in onPaint!
|
||||
}
|
||||
|
||||
void GraphControl::onSize(wxSizeEvent&) {
|
||||
|
||||
Reference in New Issue
Block a user