Václav Slavík [Tue, 28 Jun 2011 17:24:37 +0000 (17:24 +0000)]
Move wxThreadEvent into wxBase.
For this, it cannot derive from wxCommandEvent. Extracted the bits
from wxCommandEvent useful for passing data between threads into
wxEventBasicPayloadMixin helper class shared by both.
Vadim Zeitlin [Mon, 27 Jun 2011 00:09:37 +0000 (00:09 +0000)]
Add support for child documents to docview framework.
Child documents are virtual documents corresponding to parts of their parent
document which can't be saved nor loaded independently of their parent and are
closed when the parent is closed.
This finally makes some use of wxDocument::m_documentParent field which was
always present in the docview code but never used before.
Vadim Zeitlin [Wed, 22 Jun 2011 22:58:11 +0000 (22:58 +0000)]
Fix bug with out of range date in wxMSW wxDatePickerCtrl under XP too.
The bug fix of r67990 relied on DateTime_SetSystemtime() returning FALSE if
setting the date failed but, unfortunately, this function doesn't behave
correctly under XP (and presumably earlier systems) and returns TRUE even if
it didn't actually change the date because it was out of range.
Implement an alternative solution not relying on this function return value
but simply checking the range ourselves.
Vadim Zeitlin [Wed, 22 Jun 2011 22:58:07 +0000 (22:58 +0000)]
Restore wxPreviewFrame::Initialize(void) and add InitializeWithModality().
The changes of r67619 changed the signature of the virtual Initialize() method
and in doing so broke the existing code overriding it. Avoid this problem by
restoring the old method signature and adding a function with a different name
providing the new functionality.
Also notice in the documentation that there is no real need to override
Initialize() in any case (but this doesn't change the fact that there is
existing code that does do it).
Vadim Zeitlin [Wed, 22 Jun 2011 22:58:04 +0000 (22:58 +0000)]
Use strdup() even in strict ANSI mode with MinGW.
MinGW headers define MSVC-compatible _strdup() even in strict ANSI mode so we
can always use it with MinGW.
This fixes a linking problem when wx itself was built without strict ANSI but
the program using it does use strict ANSI mode (e.g. due to the use of
-std=c++0x g++ option).
Vadim Zeitlin [Sun, 19 Jun 2011 22:46:45 +0000 (22:46 +0000)]
Fix bug when setting an out of range date in wxMSW wxDatePickerCtrl.
The internally stored date value was getting out of sync with the real date in
the control itself when SetValue() was called with a date out of the currently
set range. This resulted in an assert failure and other unpleasantness later.
Fix the bug and add a unit test checking for it (and also with some other
basic wxDatePickerCtrl checks).
Vadim Zeitlin [Sun, 19 Jun 2011 22:46:39 +0000 (22:46 +0000)]
Document surprising behaviour of wxDatePickerCtrl::GetRange() in wxMSW.
wxMSW native control always has a built-in lower limit as MSW doesn't support
the dates before the year 1601 so wxDatePickerCtrl::GetRange() always returns
a valid range start, even if SetRange() hadn't been called to set it.
As this can be unexpected, document this behaviour clearly.
Vadim Zeitlin [Sun, 19 Jun 2011 22:46:36 +0000 (22:46 +0000)]
Implement wxCalendarCtrl::SetDateRange() in the native GTK version.
While GTK+ doesn't support imposing ranges for dates selection natively, we
can do it ourselves by preventing the user from selecting any date outside of
the currently valid range.
This allows to use ranges under all platforms and not only in wxCalendarCtrl
itself but in wxDatePickerCtrl as well.
Vadim Zeitlin [Fri, 17 Jun 2011 21:53:28 +0000 (21:53 +0000)]
Use GdipStringFormatCachedGenericTypographic hack for MinGW as well.
When using GDI+ with MinGW, the same hack as for Cygwin is needed (see r66787)
as it uses the same w32api headers and libraries for GDI+ support (if it has
them at all).
Vadim Zeitlin [Fri, 17 Jun 2011 21:53:26 +0000 (21:53 +0000)]
Don't use __declspec(dllexport) for MinGW gcc 4.5 and later.
Due to the changes in gcc 4.5, copies of dllexported inline functions are now
generated in all object files including their declarations, increasing their
sizes tenfold, and they are also now instantiated in the DLL itself increasing
its size fourfold. Moreover, linking such a gigantic DLL requires inordinate
amounts of memory and takes a very long time, see some statistics at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601.
To avoid all these problems, don't use dllexport at all any more but rely on
binutils support for auto export/import which seems to work fine and results
in much smaller DLLs which are created much faster.
Vadim Zeitlin [Fri, 17 Jun 2011 21:53:22 +0000 (21:53 +0000)]
Avoid problems with conflicting UINT16 definitions in Cygwin headers.
UINT16 is incorrectly defined inside Gdiplus namespace in w32api gdiplus.h
used by Cygwin and MinGW resulting in compilation errors about ambiguous
symbols.
Fix this by forcefully redefining UINT16 in our own code.
Vadim Zeitlin [Thu, 16 Jun 2011 16:22:15 +0000 (16:22 +0000)]
Fix wxStringOutputStream in wxUSE_UNICODE_UTF8 build.
For some reason the conversion of the bytes written to this stream to Unicode
was only done in wxUSE_UNICODE_WCHAR build but not in wxUSE_UNICODE_UTF8 one.
Do it in any wxUSE_UNICODE build now.
This allows to use wxStringOutputStream under Unix again, in particular it
fixes an assert in samples/html/zip when trying to load the raw contents of a
ZIP file in wxHtmlWindow.
Vadim Zeitlin [Thu, 16 Jun 2011 15:19:55 +0000 (15:19 +0000)]
Disable wxFileSystemWatcher in configure if threads are disabled.
wxFileSystemWatcher requires threads under MSW so disable it automatically in
configure if --disable-threads was used to avoid compilation errors in
wx/msw/chkconf.h later.
Vadim Zeitlin [Thu, 16 Jun 2011 15:13:59 +0000 (15:13 +0000)]
Make wxUIActionSimulator mouse move events marginally more precise.
Round the values instead of truncating them when converting from pixel values
to Win32 ::mouse_event() 0..65535 scale. This probably doesn't make any real
difference in practice but seems more correct and also avoids g++ warnings.
Vadim Zeitlin [Thu, 16 Jun 2011 15:13:52 +0000 (15:13 +0000)]
Round the values in wxDC coordinate calculations.
Make the conversion of logical coordinates to the device ones more precise by
avoiding errors due to truncation of floating point values to integer ones.
Vadim Zeitlin [Thu, 16 Jun 2011 15:13:49 +0000 (15:13 +0000)]
Round font sizes in AdjustToSymbolicSize() instead of truncating.
This was mainly done to suppress g++ warning about implicit float to int
conversion but it also seems to make more sense to round the value here
instead of truncating it to int.
Vadim Zeitlin [Wed, 15 Jun 2011 21:31:48 +0000 (21:31 +0000)]
Fall back to the valid normal bitmap if no state-specific bitmap is set.
After the recent changes we could try to use an invalid bitmap in wxMSW toggle
button code as GetNormalState() could return State_Pressed and then we used
the bitmap for the pressed state unconditionally even if it wasn't set.
It seems more correct to always fall back to the normal bitmap as the pressed
state is already taken into account by GetButtonState().
This fixes unit test failures under MSW after the button classes refactoring.
Vadim Zeitlin [Wed, 15 Jun 2011 13:33:10 +0000 (13:33 +0000)]
Fix keyboard navigation in wxGrid with reordered columns.
Don't mix up column internal indices and display positions in wxGrid keyboard
navigation code.
This ensures that pressing left/right cursor arrows always moves the cursor to
the previous/next column on the display, even if the columns were reordered.
Vadim Zeitlin [Wed, 15 Jun 2011 13:33:07 +0000 (13:33 +0000)]
Rename some parameters in wxGrid code to make them more clear.
No real changes, just call the variables containing display positions "pos"
and not "line" in wxGridOperations to avoid giving the impression that they
contain indices.
Vadim Zeitlin [Tue, 14 Jun 2011 13:00:42 +0000 (13:00 +0000)]
Refactor wxButton and wxToggleButton to derive from wxAnyButton.
Introduce wxAnyButton class, a common base class for wxButton and
wxToggleButton, allowing to reuse the same implementation for them.
This also allows to implement support for bitmaps in wxToggleButton for all
platforms and make wxBitmapToggleButton a trivial subclass of it everywhere,
similarly to wxBitmapButton and wxButton.
Vadim Zeitlin [Tue, 7 Jun 2011 22:49:51 +0000 (22:49 +0000)]
Update status bar fields widths from WM_SIZE handler.
Doing it immediately after calling ::SetWindowPos(), as we used to do, didn't
work correctly (presumably because the status bar fields widths were not
updated yet internally) and resulted in not updating the ellipsized fields
values when "Show window contents while dragging" Windows option was off.
Doing it when we get WM_SIZE works in this case too.
Vadim Zeitlin [Tue, 7 Jun 2011 22:27:35 +0000 (22:27 +0000)]
Handle colours with alpha channel correctly in wxSVGFileDC.
wxColour::GetAsString(wxC2S_HTML_SYNTAX) doesn't accept colours with alpha
channel as alpha is not representable in HTML syntax, so avoid calling this
function with such colours, remove the alpha component in the caller before
using it instead.
Also slightly simplify wxBrushString() and wxPenString() functions code in
wxSVGFileDC implementation.
Vadim Zeitlin [Tue, 7 Jun 2011 14:28:55 +0000 (14:28 +0000)]
Use DECLARE_DYNAMIC_CLASS instead of DECLARE_CLASS.
Correctly use DECLARE_DYNAMIC_CLASS for the classes that are supposed to be
dynamically creatable as using DECLARE_CLASS doesn't work any longer after the
last commit.
Vadim Zeitlin [Tue, 7 Jun 2011 13:06:17 +0000 (13:06 +0000)]
Make wxDECLARE_CLASS synonym of wxDECLARE_ABSTRACT_CLASS.
Previously wxDECLARE_CLASS was a synonym for wxDECLARE_DYNAMIC_CLASS which was
inconsistent with its documentation and wxIMPLEMENT_CLASS that was the same as
wxIMPLEMENT_ABSTRACT_CLASS.
Resolve this in the most backwards compatible and also arguably logical way.