Václav Slavík [Thu, 16 May 2013 14:15:46 +0000 (14:15 +0000)]
Call wxThread::Create() from Run() automatically.
In the common case, when Run() is called immediately after Create() and
default stack size is used, it's unnecessarily verbose. Just create the
thread in Run() if it wasn't done explicitly yet.
Vadim Zeitlin [Wed, 15 May 2013 13:05:40 +0000 (13:05 +0000)]
Allow shrinking the array with wxArray::resize().
This method did nothing if its argument was less than the current array size,
as it was just a synonym for SetSize() which was documented to behave like
this, but this was inconsistent with std::vector and wxVector resize() which
does shrink the array, so change wxArray version to shrink it too.
Václav Slavík [Tue, 14 May 2013 16:58:20 +0000 (16:58 +0000)]
Move wxTransform2D methods' bodies to geometry.cpp.
They are all virtual and so cannot be inlined anyway and having them in
the header like this confuses the g++ linker into always pulling some of
the methods in merely because geometry.h was included.
Vadim Zeitlin [Sun, 12 May 2013 23:04:08 +0000 (23:04 +0000)]
Fix harmless Clang warning about unreachable code.
Unfortunately Clang intelligent flow analysis prevents us from using different
asserts for invalid parameter value and unhandled one, which could happen if
more elements are added to wxMouseButton enum in the future.
Vadim Zeitlin [Sun, 12 May 2013 20:34:37 +0000 (20:34 +0000)]
Fix spurious g++ warning about possibly uninitialized variable use.
The variables are actually initialized in all cases if the enum has valid
value but the compiler doesn't seem to take this into account, so just
initialize them always to avoid the warnings.
Vadim Zeitlin [Fri, 10 May 2013 13:25:29 +0000 (13:25 +0000)]
Use wxjpeg_boolean in libtiff sources.
This fixes compilation problem when using libtiff with the built-in modified
version of libjpeg that uses wxjpeg_boolean instead of boolean as it doesn't
define boolean at all in its headers, but just wxjpeg_boolean.
Vadim Zeitlin [Thu, 9 May 2013 23:22:09 +0000 (23:22 +0000)]
Disable a sporadically failing check in wxBitmapComboBox unit test.
This check keeps failing in buildbot builds even though it always passes in
local ones (and sometimes in buildbot ones too). Disable it to allow the
entire test suite to pass.
Vadim Zeitlin [Wed, 8 May 2013 11:21:41 +0000 (11:21 +0000)]
Fix duplicate wxContextMenuEvent generation in wxMSW.
Prevent WM_CONTEXTMENU from being propagated upwards the window parent chain
by DefWindowProc(), we already do it ourselves and not marking the message as
processed could result in multiple calls to the same wxEVT_CONTEXT_MENU
handler if it skipped the event.
Robin Dunn [Tue, 7 May 2013 21:09:31 +0000 (21:09 +0000)]
Call InitializeModules instead of just module->Init(). This is needed so the module will have the proper state and not cause an assert when the modules are cleaned up. Since InitializeModules will skip any that are already initialized it doesn't hurt to call it for modules loaded later.
Vadim Zeitlin [Tue, 7 May 2013 15:07:28 +0000 (15:07 +0000)]
Fix for event propagation in "single document" doc/view mode.
Ensure that the events still get to wxDocManager even when we are using the
single document mode in which a view can be directly associated with the
parent frame.
Julian Smart [Mon, 6 May 2013 13:39:01 +0000 (13:39 +0000)]
Applied patches for #15184 (wxRichTextAction fix for when the command identifier is wxRICHTEXT_CHANGE_OBJECT) and #15185 (Make adding/deleting wxRichTextTable rows and columns undoable)
Vadim Zeitlin [Mon, 6 May 2013 00:31:03 +0000 (00:31 +0000)]
Add IEEE 754 single/double precision support to wxDataStream classes.
Allow to optionally raed/write float/double values in IEEE 754 single/double
precision formats, respectively, instead of always using the extended
precision format for both of them.
This makes the code more flexible, allowing for better interoperability with
the other programs, and also allows to implement floating point functions in
these classes even when wxUSE_APPLE_IEEE is turned off (as can be the case
because of the licencing concerns for the code in extended.c).
Vadim Zeitlin [Mon, 6 May 2013 00:30:56 +0000 (00:30 +0000)]
Test wxDataStream floating point methods in big endian format too.
Added a hack to test float/double reading/writing using
wxDataInputStream/wxDataOutputStream to the test case using big endian
extended float format too.
Vadim Zeitlin [Mon, 6 May 2013 00:30:53 +0000 (00:30 +0000)]
No changes, just a small optimization in DataStreamTestCase.
Don't create streams on the heap completely unnecessarily, just allocate them
on the stack. This makes the code shorter, safer and slightly more efficient.
Vadim Zeitlin [Mon, 6 May 2013 00:30:42 +0000 (00:30 +0000)]
Extract common parts of wxData{In,Out}putStream in a common base class.
No real changes, just put BigEndianOrdered() and SetConv() methods and the
corresponding fields in a common wxDataStreamBase class instead of duplicating
them in wxDataInputStream and wxDataOutputStream.
This will make it simpler to add more features common to both classes in the
future, see #10625.
Vadim Zeitlin [Sun, 5 May 2013 16:17:50 +0000 (16:17 +0000)]
Don't use gtk_file_chooser_set_filename() for save file dialogs.
This seems to be broken in old GTK+ versions, so use
gtk_file_chooser_set_current_name() and gtk_file_chooser_set_current_folder()
for save file dialogs which seem to work in all versions.
Vadim Zeitlin [Sun, 5 May 2013 00:00:01 +0000 (00:00 +0000)]
Use wxWindow::Refresh() instead of artificial wxPaintEvent in the test.
This fixes memory leaks under wxMSW: as the test code didn't (and couldn't)
call wxPaintDCImpl::EndPaint(), there was a leak for each wxPaintEvent
generated in it since the changes to wxDC caching in r72938.
It's also preferable because it uses public API instead of feeding events to
the window which is not documented to work.
Unfortunately even using Refresh() still doesn't allow the test to work under
wxOSX.
Do this by forwarding the events from wxDocParentFrame to wxDocChildFrame
first and forward them from there to wxDocManager which -- and this part
remains unchanged -- in turn forwards them to the active wxView which finally
forwards them to wxDocument. This requires another condition in the event
handling code as we still must forward from wxDocParentFrame to wxDocManager
itself if there are no active children at all, but this is the only way to
have the same event order in all cases, whether the event is originally
received by wxDocChildFrame or wxDocParentFrame.
Document this and add a unit test verifying that things indeed work like this.
Vadim Zeitlin [Sat, 4 May 2013 23:59:51 +0000 (23:59 +0000)]
Forward events to active child at MSW, not wx, level in wxMDIParentFrame.
We want to handle menu (and toolbar) events in the active MDI child before
handling them in the parent frame itself and the existing code achieved this
by forwarding wxEVT_MENU events at wx event processing level to the active
child. However this was not enough as the underlying MSW WM_COMMAND message
was still sent to the parent frame only and this could result in wx event not
being generated at all if the parent frame had a disabled menu item with the
same ID as (an enabled) item in the child frame, see #14314.
So forward WM_COMMAND directly to ensure that the correct window gets the
event in the first place. And this makes wxEVT_MENU forwarding in TryBefore()
unnecessary.
Vadim Zeitlin [Sat, 4 May 2013 23:59:43 +0000 (23:59 +0000)]
Add public wxDocManager::GetAnyUsableView().
This method tries to find the current view harder than GetCurrentView() and
always returns a non-NULL view if there are any open documents at all.
This is used by wxDocManager internally to find the view to apply the user
commands to and will also be needed in the upcoming changes outside of
wxDocManager, so just make this method public, as it seems that it could be
useful in user code too, especially if we could use some better fallback than
the first opened document (e.g. the last document the user interacted with
would be better).
This also clarifies the confusion between GetCurrentView() and GetActiveView(),
see #13296.
Vadim Zeitlin [Sat, 4 May 2013 23:59:40 +0000 (23:59 +0000)]
Use correct line numbers in assert failures in event propagation test.
Replace the calls to CheckMenuEvent() helper with ASSERT_MENU_EVENT_RESULT()
macro to allow passing the correct line number to cppunit assertion function,
otherwise the line number of CheckMenuEvent() was always used in case of
failure.
Vadim Zeitlin [Sat, 4 May 2013 23:59:37 +0000 (23:59 +0000)]
Consistently set wxMenuBar parent in all ports.
Previously, wxGTK used the associated frame as wxMenuBar parent, while the
other ports did not. Do set the frame as menu bar parent in all ports now.
Of course, considering that wxMenuBar is not a window at all, this doesn't
necessarily make much sense, but at least it makes the behaviour consistent.
Vadim Zeitlin [Sat, 4 May 2013 23:59:32 +0000 (23:59 +0000)]
Pass menu events to the handler in the associated menu bar.
We handled the menu events in the menu itself and the associated window, but
not in the menu bar that the menu belonged to. This was unexpected, so allow
handling the events in the menu bar itself too.
Vadim Zeitlin [Sat, 4 May 2013 23:59:29 +0000 (23:59 +0000)]
Fix menu event handlers calling order.
Pass the menu event to the window associated with the menu first, before
falling back on wxApp.
This required adding yet another flag to keep state in wxEvent but it seems to
be unavoidable as wxMenuBase::SendEvent() calls ProcessEvent() twice and we
must have some way to distinguish the first call from the second one.
Added a test case verifying that the menu events are indeed processed in the
expected order.
Vadim Zeitlin [Thu, 2 May 2013 22:08:19 +0000 (22:08 +0000)]
Mention using wxString::c_str() with vararg functions in the change log.
This is sufficiently important to be mentioned here in addition to the main
documentation. Especially considering that this results in run-time crashes
instead of (just) compile-time errors with MSVC.
Vadim Zeitlin [Wed, 1 May 2013 20:53:26 +0000 (20:53 +0000)]
Copy max width of wxGridCellTextEditor when cloning it.
Previously the max number of characters that could be entered into the editor
was lost when it was cloned, making it impossible to really limit the user
entry.
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
Using wxDEFAULT as the font size in wxOSX resulted in creating 70pt font,
change this to use the normal font size instead for compatibility with the
other platforms.
Also allow using -1 as wxDEFAULT for compatibility with wxGTK, see #12541.
Fix assert when adding items with bitmaps wxBitmapComboBox.
The change of r73567 resulted in an assert when adding items with bitmaps to
wxBitmapComboBox without object client data. Fix the code added by this commit
to work for all kinds of client data, including wxClientData_None.
Really fix the problem with caret in wxGrid text editor under MSW.
The problem (see #11681) was due to not allowing the native control handle the
focus loss event. This, in turn, was due to the changes of r58969 which tried
to work around a crash which happened if the grid was destroyed from the code
of one of the user-defined event handlers called during the editor dismissal.
Fix both problems at once by calling event.Skip() in OnKillFocus() to let the
native handler have the event too and postponing the editor dismissal a little
by calling DisableCellEditControl() indirectly from a posted event handler
instead of immediately.
As this reverts the now unnecessary changes of r64646, it closes #15162.
wxOSX: store the menu title when inserting it in the menu bar.
We "lost" the menu title if the menu was inserted, and not appended, to the
menu bar, resulting wxMenuBar::GetMenuLabel[Text]() returning empty strings
for it in this case.
Test wxTE_PROCESS_ENTER in the combobox page of the widgets sample.
Remove the unused "File name" checkbox in this page and put "Process Enter"
one in its place to allow toggling wxTE_PROCESS_ENTER interactively to test
whether it works as expected.