Commit Graph

64480 Commits

Author SHA1 Message Date
Vadim Zeitlin
c5bb583cdf Replace wxList used in wxHtmlPrintout with wxVector<> too
Prefer the use of the standard-like template class to macro-based list.

It also makes more sense to use a vector rather than a linked list here,
as the elements are never removed from or inserted into m_Filters, so
there is no reason to prefer the list structure.
2018-05-25 01:22:29 +02:00
Vadim Zeitlin
edeca4d9d6 Use wxVector<int> instead of wxArrayInt in wxHtmlDCRenderer
No real changes, just prefer standard-like template class to the legacy
wx one.
2018-05-25 01:19:01 +02:00
Vadim Zeitlin
b9b6ccb804 Remove "known_pagebreaks" from wxHtmlCell::AdjustPagebreak()
This parameter is not actually needed for any reasonable page breaking
algorithm, as it shouldn't care about any previous page breaks except
for the last one, which is already known as "*pagebreak - pageHeight" in
this function.

Removing it will allow to stop using wxArrayInt in the code using this
method and switch to an std::vector<int> instead.

This is not a backwards compatible change, but it seems that there is
very little code actually overriding this function (none could be found
in any open source repositories) and updating it should be as simple as
removing the now unneeded argument.
2018-05-24 18:12:40 +02:00
Vadim Zeitlin
c58d81d32d Simplify wxHtmlPageBreakCell::AdjustPagebreak()
There is no need to look in the known page breaks array for a page break
at the position of this cell, all we care about is whether this cell is
on the current page or not: we must insert a page break if, and only if,
it is.

No real changes in behaviour, but the code is now much simpler to
understand and this change paves way for removing "known_pagebreaks"
entirely, as it was only added for the use in this function (see
f2034f1b6e from 15 years ago), which
doesn't even actually need it.

It should also make pagination code somewhat faster.
2018-05-24 18:12:41 +02:00
Vadim Zeitlin
71948018f4 Add a sanity check for AdjustPagebreak() implementation
Verify that this function never adjusts page break so far back that it
comes before the previous one (or even at the same position).

This avoids infinite loops in CountPages() even if a custom cell class
implements its overridden AdjustPagebreak() incorrectly.
2018-05-24 17:53:26 +02:00
Vadim Zeitlin
63add2cd19 Don't call AdjustPagebreak() in a loop, this seems useless
There doesn't seem to be any reason to call this function more than once
on the same cell as the existing implementations are idempotent and it's
difficult to see why this should ever not be the case.
2018-05-24 17:53:26 +02:00
Vadim Zeitlin
e01892c669 Split and simplify wxHtmlDCRenderer::Render()
This function was difficult to understand as it did two quite different
things depending on the value of its "dont_render" argument and using it
also made CountPages() logic more complicated than necessary.

Simplify the code by splitting Render() into FindNextPageBreak(), which
is used by CountPages(), and Render() itself, which doesn't need to deal
with pagination at all as it's either already provided the page start
and end positions or can just assume that everything fits on a single
page (the latter is the case for the headers and footers renderer).

This is a notionally backwards-incompatible change, but no code using
wxHtmlDCRenderer could be found in the wild and the new API is so much
simpler that it seems to be worth switching to it.
2018-05-24 17:53:26 +02:00
Vadim Zeitlin
0ada873c45 Slightly simplify wxHtmlDCRenderer::Render()
Use "totalHeight" variable to make it more clear that
m_Cells->GetHeight() and GetTotalHeight() are the same value.
2018-05-24 17:53:26 +02:00
Vadim Zeitlin
b0ae6681be Add a test of explicit page breaks in wxHtmlPrintout too
Check that using the style forcing a page break does work.
2018-05-24 17:53:26 +02:00
Jouk
81750e5b88 Add libxinerama to the link option files for OpenVMS 2018-05-24 08:19:27 +02:00
Jouk
896e2d472c set wxUSE_DISPLAY=1 for OpenVMS 2018-05-24 08:11:46 +02:00
Vadim Zeitlin
dd92a269c3 Add a simple unit test for wxHtmlPrintout pagination logic
Verify that the number of pages to be printed is as expected.
2018-05-23 18:14:07 +02:00
Vadim Zeitlin
048b7f44ec Add wxPrintout::SetUp() to reuse the same code in all ports
MSW, GTK, OSX and Postscript implementations all did almost exactly the
same thing to initialize wxPrintout, so extract this common code into a
new wxPrintout method and just call it instead.

There should be no changes in behaviour.
2018-05-23 17:52:31 +02:00
Vadim Zeitlin
b6f0693a41 Use wxDCClipper in wxHtmlDCRenderer code
Use wxDCClipper instead of manually calling DestroyClippingRegion().
This is simpler and safer and also potentially more correct as
wxDCClipper restores the previous clipping region, if any, unlike the
old code -- even though this probably doesn't matter here as the
printing DC seems unlikely to be clipped.
2018-05-23 17:22:54 +02:00
Vadim Zeitlin
935d6f939b Fix compilation of generic wxNotebook used by wxMotif
This should have been part of bee28c2730
2018-05-23 17:20:39 +02:00
Vadim Zeitlin
6121b08b67 Compilation fix for wxGUIEventLoop in wxDFB
Rename YieldFor() to DoYieldFor() in the header too.

This was broken by f740cc3881
2018-05-23 17:20:39 +02:00
Vadim Zeitlin
9b4855ea5e Fix compilation of wxDFB wxApp::Initialize()
Use wxCmdLineArgsArray::Init() instead of assignment operator in Unicode
build.

This was broken by 70a499f635.
2018-05-23 17:20:39 +02:00
Maarten Bent
802c77b964 Fix building without precompiled headers on Windows 2018-05-22 17:04:42 +02:00
Vadim Zeitlin
7eef4a4549 Fix build with GTK+ < 2.20 due to undefined key code constants
Include gdk/gdkkeysyms.h from wx/gtk/private/gtk2-compat.h as it must be
included before it for the compatibility header to define the new names
for the key constants even when using old GTK+ versions.
2018-05-22 17:01:07 +02:00
Frédéric Bron
a195bf86a2 Make compilation with mingw-w64 possible with -std=c++17.
The definition of macros min and max in include/wx/msw/wrapgdip.h
b/include/wx/msw/wrapgdip.h was clashing with the new bessel functions
that use std::numeric_limits<T>::min/max.

So #include <cmath> before #include <gdiplus.h> and use using
declarations of std::min and max instead of macros.
2018-05-22 16:10:11 +02:00
Vadim Zeitlin
9fa9880f97 Pass known page breaks as const ref to wxHtmlDCRenderer::Render()
This method doesn't modify the known page breaks, it only uses them to
find the next one, so make it more clear by using const reference in the
function signature.
2018-05-21 19:06:21 +02:00
Vadim Zeitlin
a56b993c55 Use "for" loop in wxHtmlContainerCell::AdjustPagebreak()
Use a simpler form for iterating over all children.

No real changes.
2018-05-21 17:14:29 +02:00
Vadim Zeitlin
9544d102dd Remove unnecessary wxHtmlPrintout members initialization
Don't initialize strings to their default (empty) value, this is just
useless.
2018-05-21 16:43:49 +02:00
Vadim Zeitlin
f1ea4afdbe Make wxHtmlPrintout::m_Renderer{,Hdr} objects instead of pointers
There is no need to allocate these objects on the heap and delete them
later when we can just make them members of wxHtmlPrintout object
itself.

No real changes.
2018-05-21 16:39:02 +02:00
Vadim Zeitlin
c0b0562533 Avoid many -Wparentheses warnings from gtk/gtk.h with gcc8
Add wx/gtk/private/wrapgtk.h wrapping gtk/gtk.h in pragmas disabling
these warnings and include it everywhere instead of directly including
gtk/gtk.h.

Also include wx/gtk/private/gtk2-compat.h from this wrapper header as it
was included by 90% of the files including gtk/gtk.h itself and it seems
to be better and simpler to just always include it.
2018-05-21 12:34:04 +02:00
Vadim Zeitlin
e54ec6c191 Add wxTarHeaderBlock::Clear() method encapsulating memset()
Using memset() with objects of (non-trivial) class type results in a
-Wclass-memaccess warning with g++ 8, so avoid doing this.

Add a Clear() method allowing to do the same thing without breaking
encapsulation.
2018-05-21 12:27:26 +02:00
Vadim Zeitlin
d8200f1096 Remove unused wxTarHeaderBlock copy ctor
These objects are never copied, and if they were, the default
(compiler-generated) copy ctor would do the same thing this explicitly
defined copy ctor did, so just remove it.
2018-05-20 17:59:20 +02:00
Vadim Zeitlin
58e6355695 Rename wxTarEntryPtr_ to wxTarEntryPtr
Remove the unusual underscore at the end of the type and use a single
wxDEFINE_SCOPED_PTR_TYPE() macro instead of 2 of them to simplify code.
2018-05-20 17:58:09 +02:00
Vadim Zeitlin
d9d5e1d5f7 Remove unused wxDEFINE_SCOPED_PTR_TYPE(wxTarHeaderBlock)
wxTarHeaderBlockPtr defined by this macro was never used, so just remove
it.
2018-05-20 17:57:17 +02:00
Vadim Zeitlin
8401d3fec9 Fix coordinates adjustment for wxGenericListCtrl mouse events
wxListHeaderWindow event coordinates don't need to be adjusted, as it's
positioned at (0, 0) of its parent window anyhow, but wxListMainWindow
events do need to be adjusted to use the parent window coordinates, as
it's the only window that should be seen by the outside code -- and also
for consistency with the native MSW version.

This corrects the changes originally done in
651d7a1ff8

See #18133.
2018-05-19 15:06:35 +02:00
VZ
57f620e7e1
Merge pull request #811 from MaartenBent/cmake-and-more
CMake and sample improvements: notably, allow more samples to find their
files.
2018-05-19 15:02:22 +02:00
VZ
d48a9baf6c
Merge pull request #812 from jbfove/master
Build fixes for CMake monolithic build.

Also fix building with wxUSE_{DISPLAY,PALETTE}==0.
2018-05-19 14:56:55 +02:00
Jeff Bland
fbf319641e Fix monolithic build in cmake (wxBUILD_MONOLITHIC)
- Functions that set wxMONO_* vars need to set them in parent scope, from macros instead of functions (functions would need grandparent scope)
- Fix a conflict with xml library linking Mono which made core include the wrong png headers
- Fix setting of NOPCH on windows to go through the wx_lib_compile_definitions instead of target_compile_definitions so it carries to monolithic build
- Allow use of precompiled header in MSVC via calling wx_finalize_lib(mono)
- Introduce wxMONO_NONCOMPILED_CPP_FILES to deal with set_source_files_properties only applying within the current CMakeLists file
- Fix demos building against monolithic library by using wx_exe_link_libraries instead of target_link_libraries (similar to what the tests already do)

Closes #18074
2018-05-18 19:52:42 -06:00
Jeff Bland
ffb44a2f38 Fix use of RECT in wxClientDisplayRect without including windows headers 2018-05-18 18:49:05 -06:00
Jeff Bland
8b18bbb9c7 Fix uses of wxPalette without check for wxUSE_PALETTE 2018-05-18 18:49:05 -06:00
Jeff Bland
26715a1fe0 Fix warning with missing override 2018-05-18 18:49:00 -06:00
Jeff Bland
a3363cbbfb Fix use of wxDateTime without check for wxUSE_DATETIME 2018-05-18 06:51:40 -06:00
Jeff Bland
0445b3eddd Fix extraneous parens warning 2018-05-18 06:50:58 -06:00
Maarten Bent
e99af740d9 Make wxArtProvider icon size hints DPI aware 2018-05-17 20:20:06 +02:00
Maarten Bent
bfe44c719b Do not let wxHeaderCtrl determine the minimum width
The minimum width will always be equal to the current size of the parent window (from wxGetClientRect).
As a result, controls using wxHeaderCtrl can never be shrunk (e.g. using SetSizeHints).
Problem is visible when a wxDataViewCtrl gets a lower DPI. The new minimum size is equal to the current size.
2018-05-17 20:20:05 +02:00
Maarten Bent
c97963fce0 Fix size glitch of WidgetsBookCtrl in widgets sample
The entire control is hidden until the dialog is resized.
This seems to be caused by (recent changes in) the wxPersistentManager.
This is fixed by populating the frame before restoring persistence.
(as is described in docs/doxygen/overviews/persistence.h.)
2018-05-17 20:20:05 +02:00
Maarten Bent
5758832a6e Fix invalid image size in wxBitmapComboBox widgets sample
When the wxBitmapComboBox is empty, GetBitmapSize() returns size -1,-1.
Images can not be scaled to this invalid size. Use the size of the imagelist
instead.
2018-05-17 20:20:05 +02:00
Maarten Bent
e581b72955 Look in multiple paths when searching for resource files of samples
When using an out of source build, the files are not in the default wxWidgets directories.
Also search in the current directory, parent directory and sample sub-directories.

Closes https://trac.wxwidgets.org/ticket/18118
2018-05-17 20:20:04 +02:00
Maarten Bent
de4e20ee93 CMake: copy missing files for widgets sample 2018-05-17 19:34:34 +02:00
Maarten Bent
df6b47bc6d CMake: Correct header for debug builds in MinGW compiler 2018-05-17 19:33:19 +02:00
Maarten Bent
db49de9668 CMake: correctly detect 64bit for MinGW compilers
CMAKE_CL_64 is only defined when using the 64 bit cl compiler from Microsoft.
2018-05-17 19:30:59 +02:00
Vadim Zeitlin
610db240a8 Consider g++ ABI 1011 to be compatible with 1002 too
The changes between 1010 (which was already considered equivalent to
1002) and 1011 don't seem to affect wxWidgets and the library compiled
with g++6 can be used from the application built with g++7 without any
problems.
2018-05-17 04:00:59 +02:00
Vadim Zeitlin
822809ef78 Stop forwarding DoPopupMenu() to wxGenericListCtrl main window
There doesn't seem to be anything wrong with just showing the popup menu
in this window itself and this avoids the need to do any coordinate
adjustments, which didn't work correctly for the menus shown over the
header window after the previous commit (and hadn't worked correctly for
the menus shown over the non-header area before it).

See #18133.
2018-05-17 03:41:53 +02:00
Vadim Zeitlin
0446382e82 Fix position of popup menus in wxGenericListCtrl
The position was off by the header height due to a missing translation
between wxGenericListCtrl and wxListMainWindow, in which the menu is
actually shown, coordinates.

Closes #18133.
2018-05-16 15:23:00 +02:00
Vadim Zeitlin
67cb0ad260 Fix signed/unsigned comparison warning in wxAuiMDIClientWindow
This was introduced in c2fcc14bac, see
https://github.com/wxWidgets/wxWidgets/pull/802
2018-05-15 18:45:37 +02:00