Commit Graph

36151 Commits

Author SHA1 Message Date
Sean D'Epagnier
88e134ef81 improve cursor and color implementation in wxqt 2017-11-06 02:04:23 +01:00
Sean D'Epagnier
9f39eeb5e9 wxqt: improve wxbitmap and wxmask implementation 2017-11-06 02:04:23 +01:00
Sean D'Epagnier
e7ca3220f3 improve wxqt behavior 2017-11-06 02:04:23 +01:00
Sean D'Epagnier
8be71bd900 fix failed assertions in wxqt from newer wx library code 2017-11-06 02:04:23 +01:00
Sean D'Epagnier
4e1ddab3ad add stubs for new opengl formats to wxqt, this fixes opengl for wxqt 2017-11-06 02:04:23 +01:00
Sean D'Epagnier
44c91fedb8 fix build without graphics context 2017-11-06 02:04:23 +01:00
hwiesmann
f9429b7db4 Make wxAuiManager::SavePaneInfo() parameter const
The pane is not modified by saving its details.
2017-11-05 23:45:21 +01:00
Vadim Zeitlin
56323b5aba Merge branch 'log-encoding'
See https://github.com/wxWidgets/wxWidgets/pull/552

Closes #17385.
2017-11-04 18:20:24 +01:00
Vadim Zeitlin
a7dddd9f3b Refactor wxLog and wxMessageOutput classes to avoid duplication
Add wxMessageOutputWithConv mix-in class to avoid duplicating the same
code in wxLogStream and wxMessageOutputStderr.

Also derive wxLogStderr from wxMessageOutputStderr to reuse its code
without having to create a temporary object of this type (which will be
more expensive now that doing it involves creating a heap-allocated
conversion object copy).
2017-11-04 16:19:06 +01:00
Vadim Zeitlin
7872e8f7ef Allow using web extension from tests and sample
Check for web extension in ".." and "../.." to find it when running the
webview test and sample, respectively, even if "make install" hadn't
been done yet.

Also give a warning about the missing extension if we can't find it
anywhere.
2017-11-04 16:07:53 +01:00
Vadim Zeitlin
7e0b6d4d81 Merge branch 'webview-js-retval'
Integrate GSoC 2017 work by Jose Lorenzo on allowing returning values
from JavaScript code via wxWebView::RunScript().
2017-11-04 16:07:51 +01:00
Lauri Nurmi
6b73bd9136 Allow specifying character set for wxLogStderr and wxLogStream.
Until now, a mixture of non-UTF-8 and UTF-8 could be written in some circumstances.
2017-11-04 15:47:18 +02:00
Vadim Zeitlin
1417776d33 Make deleting toolbar from its own event handler work again
While it is not guaranteed in general that destroying a window from an
event handler for an event originating from this window itself works, it
did use to work in the case of wxToolBar and its event handlers. However
this stopped working since faffaaae29 as
it added a test using the now deleted object member fields after the
call to the event handler.

To fix this regression without reintroducing the bug fixed by that
commit (see #16762), add an ugly way to check if the toolbar is still
alive after a call to its event handler and do it explicitly after
OnLeftClick() returns.

Closes #17732.
2017-11-04 14:28:38 +01:00
Vadim Zeitlin
266152b459 Merge branch 'mbconv-len-fix'
Return buffers of correct length from wxMBConv::cWC2MB() and cMB2WC().
2017-11-04 14:20:15 +01:00
Vadim Zeitlin
c47acbeb52 Fix wxMBConv::cWC2MB() and cMB2WC() returned buffer length
This commit refactors the overloads of cMB2WC() and cWC2MB() methods
taking raw pointers and buffers to reuse the same code and fixes the
wrong length of the buffer returned by cWC2MB(wchar_t*) overload for
conversions using multiple bytes to represent the NUL terminator
character (it previously was wrong for UTF-16 and UTF-32 conversions due
to wrongly subtracting 1 from the length when creating it instead of
correctly subtracting GetMBNulLen()) and the wrong length of the buffer
returned from cMB2WC(char*) overload where no adjustment for the
trailing NUL was done at all.

Also return simple default-constructed buffers from these methods in
case of failure instead of using wxScopedCharBuffer::CreateNonOwned()
which is less obvious and less efficient (even if the latter probably
doesn't matter here because it's only done in case of an error).

Finally, add tests checking that using WC2MB() or either of cWC2MB()
overloads returns the buffers of the same length and with the same
contents.
2017-11-03 23:26:39 +01:00
Paul Cornett
d57d9ffaf7 Avoid some GTK+ run-time errors when using wx{File,Dir}PickerCtrl
The wxGTK implementation uses wx{File,Dir}Button, which derives from
wxButton, but is not a GtkButton, so many operations which try to modify
it, such as changing it's style, are likely to result in errors.
See #17984
2017-11-03 11:45:50 -07:00
Vadim Zeitlin
84b2ba40ee Fix wrong wxStringOutputStream optimization for UTF-8 build
We can only use utf8_length() if the conversion used with this object
uses UTF-8 too, otherwise we still need to do the conversion to find out
how many bytes does the string content take in the given encoding.

See #17985.
2017-11-03 18:48:38 +01:00
Vadim Zeitlin
8bf239f8e4 Make wxMBConv dtor inline
The Darwin linking problem mentioned in the comment doesn't exist in any
of the still supported macOS versions, so it doesn't make sense to
continue working around it.
2017-11-03 18:00:04 +01:00
Vadim Zeitlin
e3589af56a Fix wxStringOutputStream position when using external string
Initialize m_pos correctly when using an existing, and hence possibly
not empty, string (and not the internal one which is always empty
initially). The old code was totally wrong as it divided the string
length by the size of wxChar instead of multiplying by it, but doing
this could have been wrong too with UTF-16 and surrogates, so use the
conversion object to compute the real length of the string
representation in the corresponding encoding.

Add a simple unit test checking that this works as intended.

Closes #17985.
2017-11-03 15:25:36 +01:00
Vadim Zeitlin
e09d87f54b Move wxStringOutputStream ctor to the source file
There is no real need for this not quite trivial function to be inline.

No real changes.
2017-11-02 23:36:05 +01:00
Paul Cornett
d76e627341 More use of wxFALLTHROUGH 2017-11-02 08:56:29 -07:00
Vadim Zeitlin
b3fe07942f Remove top level "const" from wxMBConv methods return values
This "const" is useless and doesn't actually do anything, remove it to
avoid confusion.
2017-11-02 01:57:22 +01:00
Adrien Tétar
80e2264373 Fix wxBORDER_NONE handling for wxTextCtrl under GTK+ 3
Remove the border by applying custom CSS, which seems to be the only way
to do it with recent GTK+ versions.

Closes https://github.com/wxWidgets/wxWidgets/pull/576
2017-11-01 22:49:26 +01:00
Artur Wieczorek
1903c9615e TLW pending delete shouldn't be reported as the top window
Because top windows can (and do) act as parents for certain dialogs, a
window already pending delete shouldn't be explicitly reported as the top
window because all dialogs which would use it as a parent
would be destroyed at nearest idle cycle.

Closes #17982.
2017-10-31 20:47:45 +01:00
Vadim Zeitlin
d83b144727 Fix integer overflow in ZIP reading code
Check for the record size before subtracting it from the end position:
the former must be smaller than the latter for all valid ZIP files and
not performing this check could result in an integer overflow error from
the undefined behaviour sanitizer for bad input.

Credit to OSS-Fuzz: this solves its issue 3828.
2017-10-28 15:02:12 +02:00
Tobias Taschner
fe77b2d593
Add support for UTF8 filenames in wxZipOutputStream
Zip filenames containing non ASCII characters will be marked with
bit 11 in the general purpose flags and will use UTF-8 encoding.

By only setting the flag when non ASCII characters are used the
created archives should be binary identical to previous versions.

The old behavior can be achieved by explicitly using wxConvLocal
with the constructor. This should also ensure that
existing code using a custom wxMBConv should work as before.
2017-10-27 20:27:44 +02:00
Tobias Taschner
73a22766ee
Always enable wxMBConv::IsUTF8()
These where previously guarded by wxUSE_UNICODE_UTF8 but
may be useful in other configurations too.
2017-10-27 20:13:04 +02:00
Paul Cornett
0cb55df404 Remove test code accidently committed in 44b30c1a60 2017-10-27 10:10:18 -07:00
Paul Cornett
44b30c1a60 Avoid use of GDBusServer object after it is destroyed 2017-10-27 10:05:43 -07:00
Vadim Zeitlin
677051b6e7 Remove hack with TLW focus reset from wxWindowMSW dtor
This shouldn't be needed any more, after the previous commit which
replaces the raw pointer to the focused child in wxTopLevelWindowMSW
with a safe weak reference.
2017-10-27 18:20:09 +02:00
Vadim Zeitlin
31d51186e2 Fix crash when reparenting the focused window to another TLW
If the window stored as m_winLastFocused in one TLW was reparented to
another one and then destroyed, this pointer to it wasn't updated and
became dangling.

Fix this by using a safe weak reference instead of raw pointer for
m_winLastFocused. This ensures that it can never be used when it becomes
invalid.

Closes #17980.
2017-10-27 18:18:14 +02:00
Vadim Zeitlin
8a4573223e Fix invalid memcpy() call when reading corrupted ZIP files
Skip memcpy() call if its source and destination would overlap: this is
not allowed and is correctly flagged as an error by address sanitizer
and is unnecessary anyhow as we're certainly not going to find the magic
value in fewer than 3 remaining bytes.

Credit to OSS-Fuzz: this solves its issue 3794.
2017-10-25 17:11:36 +02:00
Vadim Zeitlin
b22e361245 Restore explicit conversion to UTF-8 in wxGTK wxWebView code
This was somehow removed by af8f7f33c3 but
is needed: implicit conversion uses the current locale encoding, which
is often, but _not_ always, UTF-8, while we always need to use UTF-8
with WebKit functions.
2017-10-22 23:37:44 +02:00
Vadim Zeitlin
ae88141fa0 Don't define unnecessary constants in public webview_ie.h
There is no need to check that calling MSWSetModernEmulationLevel()
changed the registry key in the test, this is just an implementation
detail of this function.

This makes it unnecessary to define wxIE_EMULATION_LEVEL and
wxREGISTRY_IE_PATH (which are both badly named) in the public header.

Finally, improve the error message in MSWSetModernEmulationLevel() and
add another one for failing to reset the emulation level too.
2017-10-22 23:37:42 +02:00
Vadim Zeitlin
9d6bd9a52d Fix webkit_web_view_run_javascript() callback signature
Don't use wrong types and then cast the function pointer to the right
type, but just use the correct type from the beginning.

Also make the callback extern "C", as it should be, to be called from C
code.
2017-10-22 23:37:36 +02:00
Vadim Zeitlin
1bb8cd860a Improve and harmonize error reporting in RunScript()
Errors were reported in different ways (including not being reported at
all in wxMSW) in different ports. Try to consistently do it in the same
way now and use exactly the same sentences to facilitate translators
life.
2017-10-22 23:37:32 +02:00
Vadim Zeitlin
b3bd9c77af No changes, just declare the variable before its use
Move variable declaration where it's really needed.
2017-10-22 23:37:28 +02:00
Vadim Zeitlin
d047bf2beb Make CallEval() simpler to use by taking a string in it
Don't force the caller to convert the string to wxVariant when we can
perfectly well do it ourselves.
2017-10-22 23:37:26 +02:00
Vadim Zeitlin
8f42fec21a Pass wxAutomationObject by reference to CallEval()
Using pointer here makes no sense: this parameter can never be null and
we don't even have the excuse of making it simpler to call like this as
the caller has an object and not a pointer to it, so this even results
in extra typing.
2017-10-22 23:37:24 +02:00
Vadim Zeitlin
408ee0523c Move RunScriptInternal() out of wxWebViewIE and rename
There is no need for this function to be a class member.
2017-10-22 23:37:22 +02:00
Vadim Zeitlin
70c8979223 Add wxCHECK_MSG() to wxGTK RunScript() implementation too
Don't crash if RunScript() is called on a not yet created object.

This is also consistent with the macOS version of the code.
2017-10-22 23:37:14 +02:00
Vadim Zeitlin
9884b0b4ea Remove redundant check for m_webView in wxOSX code
wxCHECK_MSG() is enough, there is really no need to check for the same
condition twice, this is just confusing.
2017-10-22 23:37:12 +02:00
Vadim Zeitlin
74e60b39f8 No changes, just get rid of gratuitous difference
Don't add an extra line unrelated to JavaScript changes on this branch.
2017-10-22 23:37:10 +02:00
Vadim Zeitlin
ee9615b9ac Consistently capitalize "JavaScript"
This is the proper name of the language, not "Javascript".
2017-10-22 00:26:33 +02:00
Vadim Zeitlin
ec54ddb66b No real changes, just reformat the code a little
Put long function calls on multiple lines.
2017-10-22 00:26:33 +02:00
Vadim Zeitlin
9d9f692024 Get rid of nonsensical "&*" construct in RunScriptSync()
Just pass JS result object directly to the WebKit function, there is
really no need to dereference it and then take its address for this.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
0e2f6e5c52 Fix memory leak in wxGTK RunScriptSync()
We must call g_object_unref() on an object that we called g_object_ref()
before.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
55beb9f7e8 Get rid of unnecessary casts in RunScriptSync()
No real changes, just simplify the code.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
4476bd646d Get rid of separate JSResultToString() function
This function was used only once and didn't really help understanding
the code and just required extra casts when passing arguments to it, for
some reason.

Just merge it into RunScriptSync() itself.
2017-10-22 00:26:30 +02:00
Vadim Zeitlin
b309487ef6 Rename RunScriptInternal() to RunScriptSync() in wxGTK
This helper function runs a JavaScript script and blocks until it
finishes executing, so try to use a name at least hinting at this
instead of being totally generic and useless.
2017-10-22 00:25:57 +02:00
Vadim Zeitlin
8c6ce2cd59 Improve RunScript() error message when using old WebKit
Don't put WebKit in all capitals and, more importantly, make it clear
that this is related to running JavaScript to the user.
2017-10-21 23:10:42 +02:00
Jose Lorenzo
af8f7f33c3 Merge wxWebView JavaScript improvements branch
This is a squashed commit of the SOC2017_WEBVIEW_JS branch from
https://github.com/joseeloren/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/538
2017-10-21 22:42:30 +02:00
Artur Wieczorek
afdfc02a49 Allow changing wxPropertyGridManager wxPG_EX_NO_TOOLBAR_DIVIDER style
Currently this style can be set only at toolbar creation and cannot
be changed afterwards.
2017-10-21 22:17:54 +02:00
Andreas Falkenhahn
eb035485d7 Add wxDataViewCtrl::GetTopItem() and GetCountPerPage()
Add methods doing the same thing for wxDataViewCtrl as the existing wxListBox
methods.

Closes #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
e77cb6f31f Improve wxListBox::GetCountPerPage() in wxGTK and wxOSX
Provide native implementation of this function instead of using the ad hoc one
in common code, which didn't really work -- so remove it completely now.

Closes #17189.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
accf7ab117 Add wxFontPickerCtrl::SetMinPointSize()
Allow setting the minimal, as well as maximal, point size.

Closes #17126.
2017-10-21 22:10:35 +02:00
Vadim Zeitlin
60c93971b3 Merge branch 'dvc-compare-values'
Fix comparing items with checkboxes in wxTreeListCtrl and make it
simpler to correctly implement item comparison in other
wxDataViewCtrl-derived classes.

See https://github.com/wxWidgets/wxWidgets/pull/558
2017-10-21 19:59:12 +02:00
Vadim Zeitlin
6974280ee1 Merge branch 'better-assert-dialog'
Use wxRichMessageDialog for showing asserts if possible.
2017-10-21 19:55:15 +02:00
Vadim Zeitlin
a1a3efe03b Use wxRichMessageDialog for showing assertion failures
This allows to hide the long (and possibly not fitting on the screen)
call stack by default to avoid intimidating people not used to it and
provides a much more clear way to ignore the subsequent asserts, by
clicking a dedicated checkbox instead of having to choose the "Cancel"
button which didn't make much sense.

See #15430.
2017-10-21 18:19:35 +02:00
Paul Cornett
5ba7a1d166 Draw a point instead of a line in wxGCDC::DrawPoint()
See #9674, #4550
2017-10-20 09:40:43 -07:00
Vadim Zeitlin
c52ed1aff3 Make "No" button default in the assert dialog
This makes more sense than the default default (sic) "Yes" button,
pressing which accidentally could kill the program if not running under
the debugger.
2017-10-20 02:40:05 +02:00
Vadim Zeitlin
2e3f0d95dd Open debugger at assert location from the GUI assert handler too
This should have been part of 55fd62c1e3
which only updated the default assert handler, but not the one used by
default in all GUI applications, for some reason, see there for more
explanations.

Do this now to ensure that after pressing "Yes" in the assert failure
dialog, the debugger opens at the assert location and not deep inside
wxWidgets code.

See #11184.
2017-10-20 02:36:01 +02:00
Vadim Zeitlin
1cf41eced6 Use __DARWIN__ for -psn command line argument test
This code should be used in all ports that can be used under macOS, i.e.
also wxGTK and not just wxMac.

Closes #15432.
2017-10-19 19:01:08 +02:00
Artur Wieczorek
892def066c Pass only relevant extra style bits to wxPropertyGrid
When extra style bits are set with the call to
wxPropertyGridManager::SetExtraStyle(), only those which are relevant
to wxPropertyGrid should be passed to the underlying property grid object.
Because it can happen that not all extra style bits of the underlying
wxPropertyGrid have been effectively changed by call to SetExtraStyle()
(e.g. wxPG_EX_NATIVE_DOUBLE_BUFFERING), we have to get the actual style
bits prior to storing them.
2017-10-18 22:58:21 +02:00
Artur Wieczorek
aaf1d505c6 Rely on native double buffering by default in wxPropertyGrid
If the platform has native double-buffering, instruct wxPropertyGrid
to rely on it by default.

Closes #16978.
2017-10-17 21:13:45 +02:00
Artur Wieczorek
cd669aea71 Use GetContentScaleFactor() to obtain the scale of the back buffer
GetContentScaleFactor() is implemented on all platforms and therefore
can be used to obtain the proper scale not only under wxOSX.
2017-10-17 20:32:29 +02:00
Paul Cornett
ed8a541463 Use wxFALLTHROUGH 2017-10-17 09:21:45 -07:00
Artur Wieczorek
cb799483b7 Rely on native double buffering by default in wxSTC
To avoid unnecessary buffering, turn off Scintilla buffered drawing
by default on platforms which have native double-buffering already.
2017-10-16 19:40:01 +02:00
Artur Wieczorek
2c69d27c0d Directly generate EVT_CONTEXT_MENU when Applications (Menu) key is pressed
WM_CONTEXTMENU message is generated directly by the system when the user presses and releases the VK_APPS key so there is no need to do this by emulating right mouse button click.

Closes #17969.
2017-10-09 16:14:50 +02:00
Artur Wieczorek
f34a6253c7 Fix compilation with wxUSE_ACCEL==0 2017-10-08 10:38:54 +02:00
New Pagodi
3a362c64cf Implement EVT_MOUSE_CAPTURE_LOST handler in wxSTC
When mouse is captured somwhere in the application, it's recommended
to have implemented a EVT_MOUSE_CAPTURE_LOST handler.
Resetting in the handler flag signalling captured state seems
to be a sufficient action because something like this is implemented
in the native Scintilla and it works fine in SciTE.

Closes #17961.
2017-10-08 10:22:59 +02:00
New Pagodi
6d0cb403a9 Prevent sending EVT_MOUSE_CAPTURE_LOST while opening a context menu in wxSTC
At least under wxMSW and wxGTK opening a popup menu when mouse is captured
generates EVT_MOUSE_CAPTURE_LOST. We would like to avoid this and
to release capture in a controlled way.

See #17961.
2017-10-08 10:11:47 +02:00
Artur Wieczorek
1ef1f8fda6 Allow setting position of wxProgressDialog (wxMSW)
Position of wxProgressDialog cannot be changed directly because the dialog is created in another thread and may exist when SetPosition() is called. New position has be stored in the data structure used to share data between the main thread and the task dialog runner and the real update is done during the cyclic refresh in the dialog thread.

Closes #13546.
2017-10-05 16:22:15 +02:00
Artur Wieczorek
bff8421ed7 Fix setting icon for wxProgressDialog (wxMSW)
Icon for wxProgressDialog cannot be changed directly because the dialog is created in another thread and may not yet exist when SetIcon() is called. We have to store new icon(s) in the data structure used to share data between the main thread and the task dialog runner and wait for a cyclic update.

Closes #17967.
2017-10-04 16:09:23 +02:00
Artur Wieczorek
718c916c93 Don't overwrite notification flags while setting a title for wxProgressDialog (wxMSW)
In wxProgressDialog::SetTitle(), wxSPDD_TITLE_CHANGED flag signaling a request to update a title should be added to the flags already being set and signaling another data waiting for the update.

Closes #17966.
2017-10-04 16:09:23 +02:00
Vadim Zeitlin
f0de65fb98 Make wxDataViewCheckIconTextRenderer class public
Export this class, which was only used internally by wxTreeListCtrl
before, so that user code can use it for its own columns with custom
wxDataViewCtrl models.
2017-10-02 22:28:28 +02:00
Paul Cornett
9662be097d Fix build error caused by 0b2ec56a 2017-10-01 13:24:07 -07:00
Paul Cornett
0b2ec56ae3 Simplify wxMacConvertNewlines helper functions
One is not used at all, two are only used in one place. Make the remaining
two return a wxString instead of taking a wxString pointer parameter.
2017-10-01 10:44:35 -07:00
Paul Cornett
37e29d3451 Use wx prefix for global names 2017-10-01 10:03:48 -07:00
Paul Cornett
29e1f1e9ce Avoid deleting object of different size than what was allocated 2017-10-01 09:02:11 -07:00
Paul Cornett
591da5dcc4 Fix memory leak of wxClientData when wxChoice is deleted 2017-10-01 08:55:57 -07:00
Paul Cornett
6a75c8f484 Fix invalid memory access beyond end of image data 2017-10-01 08:41:14 -07:00
Artur Wieczorek
c6938e9f97 Fix setting transparency flag for wxBitmap created from wxIcon
wxBitmap should be made transparency-capable before copying wxIcon bits to it. Doing so when wxIcon bits are already copied seems to work fine for OSX 10.8, but not for newer versions. 

Closes #17953.
2017-09-28 19:08:50 +02:00
Stefan Csomor
dfed16a792 Adding intrinsics for ARM 64 bit ios png builds 2017-09-26 20:09:24 +02:00
Vadim Zeitlin
81304fcafd Fix linking console applications with MinGW in monolithic build
Do compile wxEntry(void) overload used in wxIMPLEMENT_WXWIN_MAIN_CONSOLE
expansion by non-MSVC compilers under MSW inside the monolithic library
too by replacing the "#if !wxUSE_GUI" check guarding it with "#if
wxUSE_BASE" one.

It's not really clear how could this have ever worked without this fix
before, although it apparently did, but stopped with gcc 7.
2017-09-25 19:01:12 +02:00
Stefan Csomor
3063ea6ca9 Fixing Creation of wxGLCanvas on iOS 2017-09-25 17:42:11 +02:00
Stefan Csomor
9e88518eb2 Emulating proper Left Down State for Mouse Events on iPhone 2017-09-25 17:40:36 +02:00
Andreas Falkenhahn
ccc513bca9 Allow changing alignment styles after wxTextCtrl creation (wxOSX)
Update NSTextView/NSTextField alignment mode when wxTextCtrl alignment styles are changed with SetWindowStyleFlag().

Closes #17952.
2017-09-25 15:38:24 +02:00
Fabian Cenedese
812224488f Fix wxTreeListCtrl items comparison when using checkboxes
Override DoCompareValues() to handle values of "wxDataViewCheckIconText"
type which is not handled by wxDataViewModel::Compare() itself.

This ensures that the items with checkboxes are sorted by their (text)
contents instead of by the order of their addresses in memory as was
done for them, as for any unknown values type, previously.
2017-09-25 14:47:35 +02:00
Vadim Zeitlin
10e7725246 Add wxDataViewModel::DoCompareValues() useful virtual hook
This new method, called from the default Compare() implementation, is
simpler to override in the derived classes than Compare() itself.
2017-09-25 14:44:24 +02:00
Paul Cornett
cd1c3fab0c Use static linkage for various local names 2017-09-24 09:29:26 -07:00
Paul Cornett
925a1c0734 Avoid assert when deleting last item from wxListCtrl
See #17959
2017-09-24 08:51:48 -07:00
Artur Wieczorek
086793ceef Fix sending SPIN_UP/DOWN events when value wraps around (wxGTK)
SPIN_UP/DOWN events should represent the arrow being pressed,
not a direction in which the value changed (see documentation).

Closes #17957.
2017-09-23 19:08:29 +02:00
Paul Cornett
fd33fcf191 Use static linkage for various local names 2017-09-22 10:45:56 -07:00
Paul Cornett
18edcfab00 Fix memory leak when wxDataViewCtrl is deleted (wxGTK)
Need to delete wxGtkTreeModelNode structure
2017-09-22 10:29:52 -07:00
Artur Wieczorek
3b0a539045 Ensure that new value sent in EVT_SPIN_UP/DOWN is never out the range (wxMSW)
The new value sent in the event cannot be just set to the current value +/- 1. Wrapping and actual limits has to be taken into account.

See #17957.
2017-09-22 15:39:16 +02:00
Artur Wieczorek
a9843a7492 Send EVT_SPIN_UP/DOWN events also when wxSpinButton value wraps around (wxOSX)
EVT_SPIN events should be sent at every value change, not only if it's changed by +/- 1.

See #17957.
2017-09-22 15:28:12 +02:00
Artur Wieczorek
3d5e84b229 Update transparency flag for wxBitmap created from wxIcon
Just created wxBitmap has "hasAlpha" flag set to false so it needs to be modified if source wxIcon contains transparency values.

Closes #17953.
2017-09-22 09:44:10 +02:00
Vadim Zeitlin
4d388e351c Fix Direct2D graphics context after wxPenInfo changes
At least in wxMSW wxPen::GetStipple() returns a non-null (but invalid)
bitmap even when pen style is not wxPENSTYLE_STIPPLE, so don't test for
this bitmap when creating a wxGraphicsPen from a wxPen but for the style
directly.

This avoids using this invalid bitmap later in D2D code, where it
resulted in assert failures.

Also add a similar style test before calling wxPen::GetDashes() for
consistency, even if it doesn't seem to be strictly necessary.

See https://github.com/wxWidgets/wxWidgets/pull/553

Closes #17958.
2017-09-21 18:04:24 +02:00
Václav Slavík
c515c43fd5 Fix wxDataViewCtrl::ClearColumns() crash on macOS 10.13
When replacing m_OutlineView with a new one in ClearColumns(), we must
explicitly remove the old one from its superview to ensure that no more
drawing operations are pending for it. Without this change, Cocoa
drawing code would occasionally crash on attempting to message the
now-zombie m_OutlineView instance. This happened in older macOS
versions too, but became much more frequent in 10.13 High Sierra.
2017-09-21 14:02:41 +02:00
Václav Slavík
03e93b277e Fix wxCommandLinkButton explicit initial size 2017-09-21 14:02:41 +02:00
Artur Wieczorek
e2bfba21fe Fix sending EVT_SPIN_DOWN/UP events in Cocoa implementation of wxSpinButton
To determine which wxSpinButton arrow was clicked, in the action handler there is compared current NSStepper value (after the actual change) with the value before the change. This former value is fetched in the internal mouse click event handler which is invoked before the action handler. This method of determining a delta works fine as long as the current value remains unchanged between the execution of the internal mouse click event handler and the action handler. But if the current value is explicitly changed (by calls to SetValue(), SetRange()) in some handler(s) invoked between these two (like e.g. bound EVT_LEFT_DOWN handler), calculated delta can be invalid and therefore wrong EVT_SPIN_DOWN/UP events can be sent.
To get correct delta value we should to keep track of all explicit changes made to the current value starting from the mouse click and up to the entry to the action handler.

Closes #17955.
2017-09-21 13:45:13 +02:00
Anil Kumar
22a4feea53 Update current item in generic wxDataViewCtrl::SetSelections()
SetSelections was clearing the previous selection, invalidating the
current item, but didn't set it after selecting the new items.

This was causing issues in keyboard selection, e.g. pressing Shift+click
didn't select all the items between the selected and the clicked ones.

Fix this by making the last item of the new selection current, which is
the expected behaviour considering that SetSelections() should be
equivalent to calling SetSelection() with all items one by one.

Signed-off-by: Anil Kumar <anilkumar8753@gmail.com>

Closes https://github.com/wxWidgets/wxWidgets/pull/557
2017-09-19 22:32:21 +02:00
Vadim Zeitlin
5db73ec9b1 Use wxScopedArray<> instead of wxScopeGuard in wxTGAHandler
Using smart array class is better than using ad hoc scope guards for
freeing memory in any case, but in this particular case it also helps to
avoid g++ 7 -Wnoexcept-type warnings due to type of free() changing to
become "void(*)() noexcept" in C++17.
2017-09-17 18:17:58 +02:00
New Pagodi
33ad8063d6 Add Scintilla FineTicker methods to wxSTC
Starting with version 3.5, Scintilla implemented a newer method for
handling timers and used this method in its Windows, GTK+, Cocoa, and Qt
ports. This patch attempts to bring the timer handling for wxSTC in line
with those other ports.

Closes #17949.
2017-09-17 11:12:34 +02:00
Artur Sochirca
6c01707627 Don't use wxTreeCtrl item insertion workaround under modern MSW
Don't refresh the control unnecessarily after inserting the first child
node when using modern (i.e. post-XP) MSW version, this just slows down
inserting of the first child item in big trees.

Closes https://github.com/wxWidgets/wxWidgets/pull/555
2017-09-13 17:32:25 +02:00
Vadim Zeitlin
81d9952dfe Really fix spurious asserts in wxGTK wxDataViewCtrl::EditItem()
This replaces the changes of 24c0401e81
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

Closes #17946.
2017-09-13 17:25:48 +02:00
Vadim Zeitlin
e48676cf4a Fix input buffer overflow in wxZip code
Don't crash when reading malformed ZIP files with incorrect field
lengths for the extra fields.

Closes #17947.
2017-09-13 14:46:11 +02:00
Vadim Zeitlin
d25d2400fc Fix crash in wxGraphicsPen::CreatePen() after wxPenInfo changes
Don't unconditionally dereference the result of wxPen::GetStipple()
which can (and often is) null.

This fixes crash introduced in 40f8403f5d.
2017-09-13 14:02:45 +02:00
Paul Cornett
a357fefaf4 Use const_cast in new code 2017-09-12 09:47:55 -07:00
Vadim Zeitlin
97dcc02db5 Fix wxQt compilation after first week day changes
Fix typo in its version of wxCalendarCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-11 19:48:09 +02:00
Vadim Zeitlin
40f8403f5d Merge branch 'peninfo'
Add wxPenInfo and wxGraphicsPenInfo which allows to specify fractional
pen widths when using wxGraphicsContext.

Closes #17087.

Closes https://github.com/wxWidgets/wxWidgets/pull/472
2017-09-10 21:45:47 +02:00
Vadim Zeitlin
f19012c62c Merge branch 'firstweekday' of https://github.com/lanurmi/wxWidgets
Add API for determining the first day of the week and use it in
wxCalendarCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-10 21:41:36 +02:00
Vadim Zeitlin
2bb6ac7051 Refactor all wxPen ctors to use wxPenRefData(wxPenInfo) ctor
Centralize all pen creation logic in a single place (in each port) in
the new wxPenRefData ctor taking wxPenInfo.
2017-09-10 15:48:31 +02:00
Vadim Zeitlin
8bad0e494f Get rid of wxGraphicsPenInfo::CreateFromPen()
This is a helper method used only in wxWidgets itself and only once, so
just inline it at the point of use to avoid exporting an unnecessary
function in the public API.
2017-09-10 01:53:02 +02:00
Vadim Zeitlin
76fd05b147 Leave only wxGraphicsRenderer::CreatePen(wxGraphicsPenInfo) overload
It doesn't make much sense to require all the graphics backends to
create wxGraphicsPen from either wxPen or wxGraphicsPenInfo when the
former can be handled just once in the common code.

So do just this, leaving CreatePen() overload taking wxGraphicsPenInfo
where the real pen construction takes place and implementing
wxGraphicsPen creation from wxPen in the common wxGraphicsContext code.

This is not 100% backwards-compatible as any code inheriting from
wxGraphicsRenderer and overriding its CreatePen() will now be broken,
however this should be extremely rare (there is no good reason to
inherit from this class in the user code) and result in compile errors
if it does happen.
2017-09-10 01:48:30 +02:00
Vadim Zeitlin
a156d5fa40 Extract wxPenInfoBase in a separate header
This allows to avoid dependency of wx/graphics.h on wx/pen.h.
2017-09-10 01:24:16 +02:00
Vadim Zeitlin
cc91a7d6d4 Minor formatting and style changes in wxPenInfo code
Use more standard formatting, wrap some overlong lines.
2017-09-10 01:11:06 +02:00
Adrien Tétar
999c750ca7 Review feedback 2017-09-10 01:02:21 +02:00
Adrien Tétar
2305604565 Introduce wxGraphicsPenInfo class 2017-09-10 01:02:20 +02:00
Adrien Tétar
bc562289c6 Introduce wxPenInfo class 2017-09-10 01:02:06 +02:00
Stefan Csomor
a0f924191e Fixing vertical mirrored drawing for overlay on macos 2017-09-09 19:32:18 +02:00
Artur Wieczorek
abfd27db91 Fix PCH-less build
Add missing includes for compiling without WX_PRECOMP after 4d8c1fc890.
2017-09-09 16:29:42 +02:00
Stefan Csomor
8ad0039b71 Further implementation of native overlay on Cocoa
Should work for Caret,  still has a problem with the transformation matrix otherwise, too many things have changed there for me to find a quick solutions.
2017-09-09 11:44:43 +02:00
Stefan Csomor
4d8c1fc890 Using another API for popup menus on modal dialogs
Using popupMenuPositioningItem leads to several problems on modal dialogs - the validation and action callbacks are not used, thefore we revert in this situation to using the older API, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-08 14:35:49 +02:00
Stefan Csomor
102edb544d Fixing Popup Menu with Submenus
Submenus have to turn off autoenablind as well, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-07 20:27:49 +02:00
Stefan Csomor
37191f6f16 Only set font color if explicitly set
Otherwise eg the default button doesn't get its white font color.
2017-09-07 19:00:43 +02:00
Artur Wieczorek
627870be90 Restore wxButton's feature to use focus bitmap for hover state (wxMSW)
Prior to 2.9.2, if the focus bitmap was specified but current one wasn't, the focus bitmap was used for hovering as well.
This feature was entirely discarded in b4354db179 (see wxBitmapButton::DoSetBitmap) but it is still described in the documentation of wxButton's states and images. It seems it was removed unintentionally, so let's restore it.
2017-09-06 14:10:46 +02:00
Artur Wieczorek
52d6b0ae85 Don't discard all current input processing flags in response to WM_GETDLGCODE
Some current input processing flags, like DLGC_HASSETSEL, should be retained because they are in use (in wxWindowMSW::SetFocusFromKbd() for instance).

Closes #17945.
2017-09-06 12:34:20 +02:00
Stefan Csomor
51e7994cff Adding Borders and Multi-Line calculations also when native best size is available
Otherwise wxTE_MULTILINE are getting a tiny one-line minimal size, and the border as to be added as well.
2017-09-06 09:54:35 +02:00
Gavin Kinsey
d24ffcf749 Fix wxHTML parse bug in non-unicode, ? characters are not displayed.
GetEntitiesParser()->GetCharForCode(NBSP_UNICODE_VALUE) in the non-unicode
build returns the value '?' as it doesn't find a match for that value.  The
parser then proceeds to replace all '?' characters in the HTML document with
NBSP.

Change the type of the #define to be unsigned int rather than wxChar for
non-unicode to fix this.

Closes #17692.
2017-09-05 21:57:52 +02:00
Roberto Perpuly
361d7b4938 Fix popup menu items being always disabled in Mac OS X (#549)
Menus on Mac use automatic menu enabling, meaning that the system will enable
menu items only if the app responds to the menu item action. If I understand
correctly, the responder chain for menus in popup dialogs stop at the dialog
window, so the system thinks that the app does not handle the menu items.

This fix should not affect existing code since the wxWidgets user-facing API
dictates that apps specifically disable menu items.

Fix #17459

See Apple docs on automatic menu enabling at

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-BAJBFGED
2017-09-05 20:28:45 +02:00
Vadim Zeitlin
406608b31c Remove obsolete wxCHECK_W32API_VERSION() checks
The latest of those checks tested for w32 API 3.3, which is older than
MinGW 3.4 released which is more than 13 years old, so we can safely
drop them (let alone checks for prehistoric 0.5 w32 API).

This incidentally fixes compilation errors due to the use of
wxCHECK_W32API_VERSION() in wx/msw/winundef.h which was now (since
the changes of 8c572c0a77) included before
this macro was defined.
2017-09-04 22:38:23 +02:00
Tim Kosse
808c842edd Unbind events when destroying wxTextEntryHintData
Leaving these event handlers bound resulted in crashes due to
dereferencing the already destroyed wxTextEntryHintData object.

Closes #17944.
2017-09-04 22:28:32 +02:00
Lauri Nurmi
2f2700b2dd Automatically determine the first weekday for a calendar control
If neither wxCAL_SUNDAY_FIRST or wxCAL_MONDAY_FIRST was given, use
wxDateTime::GetFirstWeekDay() to automatically determine the preferred
day.

This changes the earlier default behaviour, which was to use Sunday
if not otherwise specified. However, the wxGTK native calendar control
ignored this behaviour anyway.
2017-09-02 17:02:35 +03:00
Lauri Nurmi
378851a283 Refactor WeekFlags processing into UseEffectiveWeekDayFlags()
Use the new GetFirstWeekDay() function rather than GetCountry() == USA
to determine the first weekday.
2017-09-02 17:02:35 +03:00
Lauri Nurmi
94c35b2cdd Implement new static function wxDateTime::GetFirstWeekDay()
This function tries to determine the preferred first day of week to use in
calendars. The procedure for obtaining this information is highly
platform-dependent, and is not possible on all platforms; in that case
Sunday is used as the fallback value.

Implementations are included for MSW, OSX, and Linux.
2017-09-02 17:02:35 +03:00
Artur Wieczorek
c51dd81db6 Optimize wxTextCtrl::GetLastPosition()
It's better to call one API instead of four.
2017-09-01 11:17:50 +02:00
Artur Wieczorek
ed638371a7 Fix accounting for the last position in wxTextCtrl (wxOSX)
If the text in the control doesn't end with a new line,
last valid position is just past the last character in the
the last line.
But if it ends with new line, last valid position
is located at the beginning of the next virtual (empty) line.
So, this case has to be also taken into account in determining
whether position is valid or not.
2017-08-31 21:34:17 +02:00
Artur Wieczorek
4503c41bd8 Optimize wxTextCtrl::GetLastPosition() in wxOSX
To get the length of the text in the control there is no need to convert NSString to wxString (what is done now by calling to GetStringValue).
2017-08-31 16:28:42 +02:00
Artur Wieczorek
2d464ca576 Account for the last position in wxTextCtrl (wxOSX)
Take into account that last valid position is after the last character of the text.
This applies also to empty controls for which XYToPosition(0, 0) should return 0.
2017-08-31 16:28:14 +02:00
Andreas Falkenhahn
bcfad5b5d0 Show help even for toolbars which aren't direct wxFrame children
Display "long help" text associated with the toolbar items in the status
bar of the parent frame even if the toolbar is not a direct child of the
frame.

Closes #17897.
2017-08-31 00:26:57 +02:00
Paul Cornett
4a71ba820f Avoid delayed destruction if TLW was never created. See #17942 2017-08-28 20:31:47 -07:00
Vadim Zeitlin
2a06ef9bf3 Merge branch 'textctrl-fixes'
Closes https://github.com/wxWidgets/wxWidgets/pull/546
2017-08-28 21:50:35 +02:00
VZ
a582d6162d Merge pull request #542 from vadz/unhandled-except
Improve user-visible message about unhandled exception.
2017-08-28 19:48:02 +02:00
Vadim Zeitlin
9d02d6af2a Merge branch 'gtk-text-simplify'
Closes https://github.com/wxWidgets/wxWidgets/pull/545
2017-08-28 19:44:05 +02:00
Artur Wieczorek
70fe9f3291 Remove inappropriate assertion
New line is not always marked by 2-character (\r\n) sequence. It can be
also 1-character (\r) for RichText controls or even no mark at all (for
wrapped line).
2017-08-28 18:49:50 +02:00
Vadim Zeitlin
49ebac7102 Revert "Simplify wxTextCtrl::GetLastPosition"
This reverts commit c4e1fb4ef9.

Last position is not necessarily the number of characters in the buffer,
rich edit controls still store the text using CR LF between lines, but
GetLastPosition() should return the position as if they used only LF to
be consistent with all the other positions in these controls and
changing this broke existing code passing GetLastPosition() to other
functions taking position.
2017-08-25 01:45:39 +02:00
Vadim Zeitlin
e74fb5effe Account for the last position in wxMSW wxTextCtrl
There is a valid position after the last character of the text in
wxTextCtrl, e.g. position 0 in the empty control, so account for it and,
notably, don't return -1 from XYToPosition(0, 0) when the control is
empty.

This fixes a regression in a69ab2907c.
2017-08-25 01:45:37 +02:00
Vadim Zeitlin
42e9f0cf58 Make wxGTK wxTextCtrl::WriteText() less inefficient
Use wxScopedCharBuffer as we only need the buffer in the current scope.
This avoids a buffer copy done by wxCharBuffer which could be a
significant pessimization for large buffers.

Also don't call strlen() unnecessarily, we already know the buffer
length, so just use it.
2017-08-24 22:31:16 +02:00