From 0264b2218c50f45ede87dd6c64fcbdda6bebe51a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 26 Jun 2016 18:51:50 +0200 Subject: [PATCH 1/2] Use equally-sized buttons in wxMSW horizontal toolbars Only use TBSTYLE_AUTOSIZE, adjusting each button to the size it really needs, for the toolbars with wxTB_HORZ_LAYOUT style as they don't have any uniform button size anyhow. (cherry picked from commit 967bdbf9941cf657026f9ecce4801a34863f7e55) --- docs/changes.txt | 6 ++++++ src/msw/toolbar.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index cdc0528b7d..abbadf529d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -127,6 +127,12 @@ Changes in behaviour not resulting in compilation errors, please read this! to check if the changes correspond to your expectations. And if you do need the old behaviour please contact us at wx-dev to let us know about it! +- Revert to using equally-sized buttons in wxToolBar by default: restore the + behaviour of the pre-3.0 versions in which toolbar buttons had the same + width for the toolbars not using wxTB_HORZ_LAYOUT style. Toolbars with this + style still size their buttons appropriately for their contents as they + already did in the previous 3.0.x releases. + - wxWindow::Freeze/Thaw() are not virtual any more, if you overrode them in your code you need to override DoFreeze/DoThaw() instead now. diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 40051962f9..d15066127f 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -1091,11 +1091,12 @@ bool wxToolBar::Realize() // Instead of using fixed widths for all buttons, size them // automatically according to the size of their bitmap and text - // label, if present. This particularly matters for toolbars - // with the wxTB_HORZ_LAYOUT style: they look hideously ugly - // without autosizing when the labels have even slightly - // different lengths. - button.fsStyle |= TBSTYLE_AUTOSIZE; + // label, if present. They look hideously ugly without autosizing + // when the labels have even slightly different lengths. + if ( HasFlag(wxTB_HORZ_LAYOUT) ) + { + button.fsStyle |= TBSTYLE_AUTOSIZE; + } bitmapId++; break; From 3e9bd07e3f9e621200154060a50fff1c6d74fc86 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 8 Jul 2016 22:57:27 -0700 Subject: [PATCH 2/2] Be more conservative in avoiding Cairo's maximum coordinate limit. Fixes wxGCDC::Clear(). See #17584 (cherry picked from commit fa54e1af158e2cbe5014efefddffd6c2704bb9bf) --- src/common/dcgraph.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 1b09719609..6a0d9e0ea9 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -1202,9 +1202,10 @@ void wxGCDCImpl::Clear(void) wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE); // maximum positive coordinate Cairo can handle is 2^23 - 1 + // Use a value slightly less than this to be sure we avoid the limit DoDrawRectangle( DeviceToLogicalX(0), DeviceToLogicalY(0), - DeviceToLogicalXRel(0x007fffff), DeviceToLogicalYRel(0x007fffff)); + DeviceToLogicalXRel(0x800000 - 64), DeviceToLogicalYRel(0x800000 - 64)); m_graphicContext->SetCompositionMode(formerMode); m_graphicContext->SetPen( m_pen ); m_graphicContext->SetBrush( m_brush );