Commit Graph

61813 Commits

Author SHA1 Message Date
David Vanderson
49801e57f1 Implement wxGetDisplaySizeMM() correctly in wxOSX
Return the real screen size instead of hard-coding 72 DPI.

Closes #17614.
2016-08-08 14:00:07 +02:00
rom
e300f28976 Fix handler for wxEVT_MENU from dropdowns in wxAuiToolBar
Send this event to the toolbar own event handler instead of sending it to the
parent, the event will be propagated upwards anyhow, but doing it like this
also allows to process it in the toolbar itself and is consistent with the
other events generated in this code.

Closes #17613.
2016-08-04 23:47:21 +02:00
Václav Slavík
a352e95a30 wxMSW: Restore window focus after wxExecute
If wxExecute() is called without the wxEXEC_NODISABLE flag, it disables
all toplevel windows and then creates a helper dummy window. This moves
focus to the helper window and when it's destroyed, back to the first(?)
of the re-enabled application windows, thus loosing original focus.

Remember previously focused window instead and try to restore focus to
it. This still results in some flicker, but is better than completely
changing focus and e.g. even changing the currently active window
without user's input.
2016-08-01 18:10:37 +02:00
Artur Wieczorek
ea8cb7a24a Fix setting wxGCDC clipping region with device coordinates
Currently region given in device coordinates is decomposed into the stripes which are next transformed to the logical coordinates required by underlying wxGraphicsContext::Clip() function. Some of these stripes given in device coordinates can have 1-pixel height what after transformation to logical coordinates can give zero-height stripes (after rounding). This can lead to the situation that in the region transformed to logical coordinates some stripes can disappear and final transformed region shape is different from the source shape (it has gaps).
To fix this issue device coordinates of the region are not manually transformed to the logical coordinates but instead wxGraphicsContext's is temporarily set to the state where its logical coordinates are equivalent to device coordinates and thus clipping region can be applied directly.

Closes #17609
2016-08-01 00:05:31 +02:00
Artur Wieczorek
0fc246176a Add to the test suite a test of setting non-rectangular clipping region
Added a test of creating triangular clipping region (with wxDC::SetDeviceClippingRegion).

See #17609
2016-07-31 23:57:03 +02:00
Dévai Tamás
29c81ad515 Allow wxwin.m4 finding and using a base-only library
Although "base" is not actually a toolkit, allow both the automatic toolkit
detection and the configure flag --with-toolkit=base find and use a base-only
library.

Closes https://github.com/wxWidgets/wxWidgets/pull/310
2016-07-30 23:02:43 +02:00
Bryan Petty
e11bbb1afc Re-enable features in AppVeyor builds
Build boxes have been upgraded, and should be able to handle the
extra time required to build these features now.

Closes https://github.com/wxWidgets/wxWidgets/pull/309
2016-07-30 23:00:48 +02:00
Vadim Zeitlin
a8fbe51b45 Fix leak of GdkPixbufLoader in wxGTK wxAnimation
Use wxGtkObject<> to ensure that the loader object is unref'd.

Also add a missing call to gdk_pixbuf_loader_close() for consistency.

Closes #17607.
2016-07-28 00:38:46 +02:00
Vadim Zeitlin
9dc7a89ccd Check if widget is still valid in wxGTK size reset callback
The transient top-level window might have been already deleted by the time the
idle callback is executed, so check that the widget still exists before using
it.

This fixes multiple GTK+ errors on startup of an application showing any kind
of temporary windows (e.g. a splash screen) since the changes of the commit
bc4df78421.
2016-07-28 00:04:30 +02:00
Artur Wieczorek
cf033b47b1 Editorial corrections to the documentation.
Added section to group similar functions in the documentation of wxGraphicsContext.
Fixed references to the section describing wxPGProperty attributes.
2016-07-24 21:08:54 +02:00
Artur Wieczorek
cd96c664dd Updated documentation for some wxPropertyGrid classes.
Updated documentation for wxPGEditor, wxPropertyGridPage, wxPropertyGridManager, wx*Property classes.
Removed doxygen-style comments from header files.
2016-07-23 23:38:39 +02:00
Artur Wieczorek
b3d4c870da Update changelog
Mention of recent wxPG-related fixes 6e97a2cb i c3fa684a.
2016-07-22 23:12:35 +02:00
Artur Wieczorek
ef46f24f37 Add test of scaling wxImage
Upsampling the image with symmetrical contents to check if symmetry is preserved in rescaling.
2016-07-22 23:00:48 +02:00
Artur Wieczorek
097625de52 Fixed rescaling of wxImage
When wxImage is rescaled with wxIMAGE_QUALITY_BILINEAR, wxIMAGE_QUALITY_BICUBIC or wxIMAGE_QUALITY_BOX_AVERAGE algorithm then for proper interpolation there is necessary to uniformly (linearly) map entire pixel range in the new image to the entire pixel range in the current image, i.e. pixels positions (integer values) in range [0..newDim-1] has to be mapped to "virtual" pixel positions (not necessary integer values) exactly in the range [0..oldDim-1].
[0..oldDim-1] range of target mapping is required because for proper interpolation every "virtual" pixel has to be located between two physical pixels in the current image.
Thus scaling ratio used to find corresponding pixels in the current image should be (oldDim-1)/(newDim-1) and not oldDim/newDim (which is used now).
When image is e.g. upsampled oldDim/newDim ratio then some new rightmost/botommost pixels are mapped to old pixels > (oldDim-1) and their values are improperly interpolated (in the current implementation their positions are just truncated to (oldDim-1) to bypass the problem and upsampled image looks like it was shifted left/up). The larger scaling ratio the effect is more visible.

Note:
Because reference images used currently in the unit tests were created with improper scaling there is necessary to upload new reference images created with fixed scaling.

Closes #17594
2016-07-22 23:00:33 +02:00
Artur Wieczorek
c3fa684a27 Fixed displaying validation error for numeric wxPG properties (wxUIntProperty, etc.)
When entered wxFloatProperty, wxIntProperty or wxUIntProperty is out of range then there is displayed a warning message presenting a valid range. Instead of displaying in this message numeric values in default (and fixed) format we should display values which are formatted based on to the current attributes of the property (like wxPG_UINT_PREFIX, wxPG_UINT_BASE, wxPG_FLOAT_PRECISION).
To do so, we shouldn't format respective values on our own in NumericValidation() but instead call wxPGProperty()::ValueToString() which returns value string formatted in line with attributes.

Closes #17601
2016-07-21 23:13:16 +02:00
Artur Wieczorek
6e97a2cbf2 Fixed displaying wxUIntProperty value
In the edit mode property's value should be displayed in the pure numeric form without any textual prefixes because all non-numeric characters will raise a warning in wxNumericPropertyValidator.
2016-07-21 23:11:33 +02:00
Vadim Zeitlin
e371214cfa Correct wxString(const char*, size_t) ctor documentation
The length passed to this constructor is the number of bytes, i.e. char
elements of the given string, not "characters" in the usual sense of the word.
2016-07-19 20:12:53 +02:00
JulianSmart
22bcdf020e Don't use Cmd+C accelerator in dilogs on Mac by default. 2016-07-17 18:17:42 +01:00
Artur Wieczorek
42b440487d Updated wxGraphicsContext documentation.
Added comment blocks to improve readability.
Enhanced some descriptions (for BeginLayer, PushState).
2016-07-17 18:19:32 +02:00
Artur Wieczorek
874da289ef Modified parameters in clipping box tests.
Some coordinates of clipping regions given in device coordinates has to be slightly modified to avoid rounding errors in conversions from device to logical coordinates.
2016-07-17 18:19:32 +02:00
Artur Wieczorek
902b9a5c56 Fix calculating the extent of clipping box (wxDC, GTK).
While setting a clipping region there is necessary to intersect it either with current clipping region location if such region exists or with wxDC surface extents if no clipping region is set. This way effective clipping box will be always inside the wxDC surface. Effective clipping box can be an empty region.
Clipping box parameters are calculated and stored in logical coordinates.
2016-07-17 17:05:02 +02:00
Artur Wieczorek
c845b953a2 Don't destroy clipping region if empty clipping region is required (wxDC, GTK).
For compatibility with wxGCDC (Cairo and all native MSW renderers) current clipping region shouldn't be explicitly destroyed if empty clipping region is requested. It should be handled as any other region.
2016-07-17 16:43:13 +02:00
Artur Wieczorek
ad9ebd4b54 Fixed setting clipping box with negative size (wxDC, GTK).
Rectangular clipping region with negative size is accepted by wxDC::SetClippingRegion() (for compatibility with wxGCDC and Cairo) but for internal calculations we need to have this box defined by (x,y) at top-left corner and having non-negative size so we need to recalculate box's parameters in wxWindowDCImpl::DoSetClippingRegion() if necessary.
2016-07-17 16:43:13 +02:00
Artur Wieczorek
79ffd029fa Allow creating wxRegion from rectangle with negative size (GTK).
GdkRectangle used to represent a rectangle region should have (x,y) parameters pointing to the top-left corner of the box with non-negative width and height so if a rectangle with negative values of the width or height is passed to wxRegion::InitRect() (what means that (x,y) doesn't represent top-left corner) we need to recalculate passed parameters to get rectangle with (x,y) at the top-left corner.
2016-07-17 16:43:12 +02:00
David Costanzo
ab092c8d13 Don't handle special keys as characters in wxSTC in non-Unicode build
Correct the check for non-special keys when wxUSE_UNICODE==0.

Closes #17598.
2016-07-17 14:15:40 +02:00
Vadim Zeitlin
63944ae9bd Recognize wxAUI_NB_MIDDLE_CLICK_CLOSE in wxAuiNotebook XRC handler
This style was apparently just forgotten, so add it too.

Closes #17597.
2016-07-17 14:03:52 +02:00
Vadim Zeitlin
fe2052fb35 Skip the recently added wxString test broken with libc++
This should have been part of 90eaa1bbe3 and
should finally really fix the build with libc++ after the changes of
14ec2691f6.
2016-07-16 01:46:45 +02:00
Artur Wieczorek
2821d68a73 Updated wxDC and wxGraphicsContext documentation 2016-07-15 21:03:56 +02:00
Artur Wieczorek
6c3e7e9e9b Use dedicated wxRect functions to get rectangle parameters.
Minor refactoring to simplify the code.
2016-07-15 21:02:54 +02:00
Artur Wieczorek
947c6d4954 Fixed setting clipping region (passed in wxRegion) for Direct2D renderer.
If empty wxRegion is passed to wxD2DContext::Clip() then ID2D1RectangleGeometry object representing geometric mask used by ID2D1Layer object (clipping layer) has to be created in a special way because wxRegionIterator doesn't extract empty rectangle.

ID2D1RectangleGeometry object representing geometric mask has to be maintained as long as corresponding clipping layer is in use so we have to store a reference to this object together with other layer data. Object is released when layer is destroyed.

Closes #17596
2016-07-15 21:01:57 +02:00
Artur Wieczorek
4e4317e71d Fixed setting clipping region for wxGCDC using device coordinates.
Because source wxRegion contains regions given in device coordinates and underlying wxGraphicsContext::Clip() function expects regions in logical coordinates so we have to convert device coordinates of all region components to source coordinates prior to calling this function.

Effective clipping box (always calculated in logical units) is the result of intersection of clipping box of the provided region with either clipping box of previously set clipping region (if set) or with wxGCDC surface extents if no clipping region is set. This way effective clipping box is always inside the wxGCDC surface.
Note: Effective clipping box can be an empty region.

See #17596
2016-07-15 21:00:49 +02:00
Artur Wieczorek
b2760ff420 Fixed setting wxRegion with rectangle having negative size (MSW).
wxRegion uses CreateRectRgn() Win API which requires that its (x1,y1) parameters represent the top-left corner of the rectangle region so if a rectangle with negative values of the width or height is passed to wxRegion's ctor (what means that (x,y) doesn't represent top-left corner) we need to recalculate passed parameters to get rectangle with (x,y) at the top-left corner.
2016-07-15 20:58:37 +02:00
Artur Wieczorek
9ecea7dc74 Added tests to check setting of clipping region using device coordinates.
Tests of setting clipping region(s) with wxDC::SetDeviceClippingRegion() for transformed wxDC/wxGCDC (with changed device origin, logical origin and scale and with various renderers for wxGCDC) to check if all transformations are taken into account in the clipping box calculations.

See #17596
2016-07-15 20:57:21 +02:00
Vadim Zeitlin
90eaa1bbe3 Compilation fix for libc++ after the previous commit
libc++ defines std::iter_swap() with a non-standard exception specification
incompatible with the other other standard libraries and not compiling with
our definition of swap() for wxUniCharRef anyhow, so disable iter_swap()
specialization until https://llvm.org/bugs/show_bug.cgi?id=28559 is fixed.
2016-07-15 02:12:55 +02:00
Vadim Zeitlin
14ec2691f6 Allow swapping wxString iterators in C++11 mode
Specialize std::iter_swap() for wxString::iterator in C++11 mode as the
default implementation of it doesn't work for iterators using "reference" type
different from "value_type&" as is the case for wxString::iterator.

This notably allows the code using std::reverse() with wxString iterators to
compile in C++11 mode, which wasn't the case before.
2016-07-14 16:36:24 +02:00
JulianSmart
0e541e7a57 Merge branch 'master' of https://github.com/wxWidgets/wxWidgets 2016-07-14 15:29:16 +01:00
JulianSmart
aa9901e728 Avoid moving content onto part of itself and subsequent crash 2016-07-14 15:28:01 +01:00
Vadim Zeitlin
aa3acfdd15 Work around an apparent gcc optimizer bug in wxClassInfo
Rewrite a complex expression in wxClassInfo::IsKindOf() as several statements
to avoid what looks like a gcc optimizer bug as it was dereferencing
m_baseInfo1 pointer even when it was null.

The new version is not completely equivalent to the old one as it doesn't
check for info == NULL which is not really necessary, but this is just a side
effect and doesn't affect anything, the important change is avoiding doing
everything in a single expression.

Closes #17483.
2016-07-13 23:33:23 +02:00
Paul Kulchenko
3057c18939 Use wgetcwd() with MinGW to handle non-ASCII working directory
All versions of MinGW seem to have this function, so use it to ensure that
wxGetCwd() returns the correct result even when the current directory contains
non-ASCII characters.

Closes https://github.com/wxWidgets/wxWidgets/pull/307
2016-07-13 23:05:10 +02:00
Artur Wieczorek
e9af6d6ec7 Fixed setting/unsetting wxPGProperty as read-only.
Don't do any action only if property is exactly in the same state as required (and action is requested for single property only).
2016-07-11 21:44:49 +02:00
Artur Wieczorek
97713c12d7 Fixed setting wxPGProperty label
If wxPropertyGrid has wxPG_AUTO_SORT flag set then renaming the label of any property can change the order of displayed properties including this one which is currently selected. To be properly displayed in the new location this selected property has to be refreshed separately.
2016-07-11 21:44:48 +02:00
Václav Slavík
d6a6b8fbd4 Fix VC++ warning about comparing bool with > 0 2016-07-10 16:39:09 +02:00
Artur Wieczorek
13f9789996 Fixed clearing wxWindowDC, wxMemoryDC for wxMSW.
Current implementation suffers for two issues:
1. Because wxClientDC and wxWindowDC are not distinguished in wxMSWDCImpl::Clear and in both cases DC coordinates are obtained with GetClientRect() Win API what leads to this that for wxWindowDC the entire area is not cleared.
2. Translations like moving logical origin or scaling are not taken into account in wxMemoryDC coordinates calculations (only device origin is included) so for transformed DC calculated coordinates are invalid and finally the entire area is not cleared.

To fix these issues we can use GetClipBox() Win API to obtain actual logical coordinates of the clipping box (with all translations and scaling already included) and this way we can avoid using separate methods of retrieving coordinates for wxClientDC, wxWindowDC and wxMemoryDC.
2016-07-09 23:38:34 +02:00
Artur Wieczorek
2b7aab70ff Added tests to check setting of clipping region for transformed wxDC/wxGCDC.
In these tests clipping region is set for transformed wxDC/wxGCDC (with changed device origin, logical origin and scale) to check if all these transformations are taken into account in the clipping box calculations.
2016-07-09 23:38:33 +02:00
Artur Wieczorek
53230aaf4d Fixed retrieving clipping box for transformed wxDC
Because wxDC can be the subject of geometric transformations (like translation, scaling) so we cannot assume in the calculations of the clipping box that DC origin is always at (0,0) and its logical size is the same as physical size. To get correct result we have to use logical coordinates of wxDC area in all clipping box calculations.
2016-07-09 23:38:31 +02:00
Damien Ruscoe
fc0108ce71 Hide empty wxCheckBoxes in wxGTK to fix display problem
Focus rectangle was still drawn around the label when it was empty with some
themes, so hide it completely to ensure this doesn't happen.

Closes #17443.
2016-07-09 15:32:34 +02:00
Paul Cornett
fa54e1af15 Be more conservative in avoiding Cairo's maximum coordinate limit.
Fixes wxGCDC::Clear().
See #17584
2016-07-08 22:57:27 -07:00
Artur Wieczorek
c08b8c6f6d Fixed minor typo in comment. 2016-07-08 19:51:58 +02:00
Artur Wieczorek
9be1251f02 Modified methods used to set/unset wxPGProperty as read-only and to hide/show it.
If there is requested to set/unset a single property (without recursion) as a read-only (wxPropertyGridInterface::SetPropertyReadOnly) or to hide/show it (wxPropertyGridInterface::HideProperty) then first check if property is already in the requested state and if so do nothing. This prevents from unneeded refreshing of the display.
2016-07-08 19:51:02 +02:00
Artur Wieczorek
c910085507 Update documentation of some flags used by wxPropertyGridInterface methods. 2016-07-08 19:49:03 +02:00