Vadim Zeitlin [Tue, 21 May 2013 23:47:20 +0000 (23:47 +0000)]
Use the best instead of current page size in OS X preferences dialog.
The page, which is typically just a wxPanel, is usually not created with the
correct size, so resize it to its best size before showing it in the
preferences dialog.
This makes OS X behaviour consistent with MSW and GTK and is generally more
useful.
Vadim Zeitlin [Tue, 21 May 2013 23:17:29 +0000 (23:17 +0000)]
Fit modeless preferences dialog to its contents too.
When a preferences dialog is shown non-modally, it should still fit to the
contents of its pages, so move the code added for the modal case in r73624
to the base wxGenericPreferencesEditorImplBase class.
Vadim Zeitlin [Mon, 20 May 2013 15:26:22 +0000 (15:26 +0000)]
Fix last count value after ReadAll() and WriteAll().
This corrects the bugs introduced when applying the patch adding these
functions in r74034: we can't simply use m_lastcount directly in them because
it's also modified by each call to Read() and Write(), so do use the temporary
variable.
Vadim Zeitlin [Mon, 20 May 2013 13:15:41 +0000 (13:15 +0000)]
Add a public wxModalDialogHook class for intercepting modal dialogs.
Extract wxModalDialogHook from wx/testing.h into its own wx/modalhook.h,
extend it to allow to be notified not only about showing modal dialogs but
also about dismissing them and document it and show its use in the dialogs
sample.
Also replace all the WX_TESTING_SHOW_MODAL_HOOK macros occurrences with
WX_HOOK_MODAL_DIALOG.
Vadim Zeitlin [Mon, 20 May 2013 13:15:26 +0000 (13:15 +0000)]
Fix return value of wxCountingOutputStream::LastWrite().
Don't reuse m_lastcount in wxCountingOutputStream to store the stream length,
this doesn't make any sense and results in LastWrite() returning completely
wrong results as it expects m_lastcount to be the number of bytes written by
the last operation.
Add m_lastPos member to store the stream length instead.
Also correct wxCountingOutputStream documentation.
Vadim Zeitlin [Mon, 20 May 2013 13:15:21 +0000 (13:15 +0000)]
Make code reading BMP files more robust.
Check that we did correctly read the requested amount of data instead of
blindly assuming that the needed (from the point of view of BMP format
specification) number of bytes are always available -- this doesn't work so
well with corrupted or truncated files.
Vadim Zeitlin [Sun, 19 May 2013 12:47:34 +0000 (12:47 +0000)]
Propagate wxEVT_COMMAND_TEXT_UPDATED renaming to the real stc.cpp.
wxEVT_COMMAND_TEXT_UPDATED was renamed to wxEVT_TEXT in the generated stc.cpp
but not in stc.cpp.in it was generated from. Do it there too to prevent the
correct version in stc.cpp from being overwritten during the next regeneration.
Vadim Zeitlin [Sun, 19 May 2013 12:38:22 +0000 (12:38 +0000)]
Trigger wxLog auto-creation when getting old logger in wxLogChain ctor.
This ensures that a program that uses wxLogChain or one of the classes
deriving from it, such as wxLogWindow, can do it directly without worrying
about the standard logging being completely suppressed if the default log
target hadn't been instantiated yet.
Vadim Zeitlin [Sun, 19 May 2013 12:38:12 +0000 (12:38 +0000)]
Add conversions to/from long long to wxUniChar.
Allow conversions to/from long long and unsigned long long values in wxUniChar
for consistency with the other integral types.
Also make the code shorter by using helper wxDO_FOR_INT_TYPES() and
wxDO_FOR_CHAR_INT_TYPES() macros to avoid duplicating the same code for all of
the integral types and having to handle wchar_t (and wxLongLong_t now)
specially because sometimes we may need to overload on it and sometimes not.
Finally, add more tests to check that all the wxUniChar methods compile and
work with all the different types.
Vadim Zeitlin [Sun, 19 May 2013 12:38:09 +0000 (12:38 +0000)]
Disable menu event test case in wxGTK buildbot slaves.
This test sporadically fails for unknown reason and I don't know what to do
about it, so disable it for now to let the test suite pass consistently and be
notifed about any new failures.
Vadim Zeitlin [Fri, 17 May 2013 11:53:46 +0000 (11:53 +0000)]
Try using wxString::ToCDouble() instead of ToDouble() in wxAny case.
Apparently enabling the call to ToDouble() in the test is enough to corrupt
the heap in wxOSX PPC build. No idea how can this be possible but try to check
if using ToCDouble() helps...
Vadim Zeitlin [Fri, 17 May 2013 11:53:43 +0000 (11:53 +0000)]
Make wxPreferencesEditor dtor virtual.
Mainly just to suppress g++ warnings about a class with virtual functions but
non-virtual dtor, this class isn't really supposed to be used polymorphically.
Vadim Zeitlin [Thu, 16 May 2013 14:43:13 +0000 (14:43 +0000)]
Initialize wxXmlResourceHandler members in its ctor.
Not sure if this results in any real problems but at the very least memory
checking tools give errors about reading uninitialized memory in
wxXmlResourceHandlerImpl::CreateResource() if we leave them uninitialized, so
do initialize all the pointers.
Vadim Zeitlin [Thu, 16 May 2013 14:43:06 +0000 (14:43 +0000)]
Add wxPreferencesEditor::ShownModally().
While this is not necessary to use wxPreferencesEditor in normal scenario, it
can be useful if the program needs to handle modal dialogs in some special way.
Vadim Zeitlin [Thu, 16 May 2013 14:43:02 +0000 (14:43 +0000)]
Make wxPreferencesEditor::Show() virtual.
This allows derived classes to override it to do something before/after
showing the dialog, which can be useful on the platforms where modal dialogs
are used for wxPreferencesEditor implementation.
Vadim Zeitlin [Thu, 16 May 2013 14:42:59 +0000 (14:42 +0000)]
Use "<Application> Preferences" as generic wxPreferencesEditor dialog title.
This is more appropriate than just "Preferences" under MSW and GTK which use
the generic wxPreferencesEditor, OS X has its own native version which
continues to correctly use "Preferences" for the title.
Vadim Zeitlin [Thu, 16 May 2013 14:42:56 +0000 (14:42 +0000)]
Allow to specify the title used by wxPreferencesEditor window.
Customize the title is useful for "Settings"-style windows which are used for
editing the properties of the given object, that should be identified in the
window title, as opposed to the global program preferences.
Vadim Zeitlin [Thu, 16 May 2013 14:42:52 +0000 (14:42 +0000)]
Open generic wxPreferencesEditor at last shown page.
This is very convenient under systems using a modal dialog for the preferences
editor implementation (such as MSW), as it allows to do several changes in the
same page without having to select it manually every time.
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.