Output something from the console sample even if it's ran without arguments.
Running console sample without parameters didn't do anything by default and
didn't output anything neither which was presumably rather confusing. Do
output a welcome message at least to indicate that something happened.
Immediately update MSW cursor when ::SetCursor(wxNullCursor) is called.
The cursor was previously reverted to the default one only when a next mouse
event was received. Do it immediately now to e.g. avoid showing the busy
cursor when the program is not busy any more.
Fix wxMSW wxSlider best size calculation and label layout.
The best size calculation was wrong as the min/max labels height was
unnecessarily added to the slier total height even if though these labels are
positioned alongside the slider itself in horizontal layout case.
The slider also managed to position its value label completely outside the
space allocated to it (and the bug in DoGetBestSize() might have been an
attempt to work around this), don't do this any more. This also fixes the
wrongly centered vertical position of the min/max labels.
Make coordinates transformations in wxDC really maximally precise.
Use the maximal device space extent supported by Win32 GDI and only decrease
it if the scale is so small that keeping the device space extent maximal would
result in overflowing the int range for the logical space.
This makes coordinate translations exact even for huge coordinates, while they
could be significantly wrong before due to the integer rounding errors.
We finally didn't switch to using the standard containers by default so don't
leave misleading information in the change log (this should have been part of
r67735).
Fix warnings about implicit double to int conversions in propgrid.
Use wxRound() instead of implicit casts to convert double to int. This not
only avoids warnings (e.g. when using g++ with -Wconversion) but also should
be (marginally) more precise.
Fix crash in wxDataViewProgressRenderer in non-Unicode build.
We can't use the column pointer in wxDataViewProgressRenderer ctor as it's not
set yet, so postpone setting the renderer label until later in non-Unicode
build which needs the font used by this column to do the conversion to UTF-8.
Add wxCOMPOSITION_INVALID mode and use it to simplify the code.
Having an invalid element in wxCompositionMode enum allows to directly return
it from TranslateRasterOp() function instead of needing a separate bool
parameter to indicate that a ROP couldn't be translated.
This also incidentally fixes warnings about possibly uninitialized variables
in optimized g++ builds.
Avoid g++ warnings about breaking strict aliasing rules in wxTreeCtrl.
The standard TreeView_GetItemRect() macro resulted in warnings about breaking
strict aliasing rules as it passed a variable of one type via a pointer to
another one. Fix this by using a union and our own custom macro instead.
Vadim Zeitlin [Thu, 30 Jun 2011 12:20:54 +0000 (12:20 +0000)]
Initialize variable in UTF{16,32} conversion code to avoid warnings.
In optimized build g++ warned about the second element of two-element array
passed to encode_utf16() being possibly uninitialized. This wasn't really the
case but change the code just to avoid the warnings.
Vadim Zeitlin [Thu, 30 Jun 2011 12:20:47 +0000 (12:20 +0000)]
Work around bogus g++ warnings about possibly missing return.
OS X g++ warned that "control may reach end of non-void function" in
wxRichTextHelpInfo::ShowHelp(). This wasn't really the case but change the
function logic slightly to (hopefully) suppress the warning.
Vadim Zeitlin [Wed, 29 Jun 2011 17:50:32 +0000 (17:50 +0000)]
Change the loop condition to avoid comparing unsigned value with 0.
This resulted in (useful) g++ warning and didn't make any sense in any case.
Check for the loop variable value being 0 at the end of the loop instead now.
If the old code was correct it shouldn't change its behaviour and if not, this
might fix a bug.
Vadim Zeitlin [Wed, 29 Jun 2011 17:50:30 +0000 (17:50 +0000)]
Always initialize SelectInHDC::m_hgdiobj in wxMSW.
Leaving m_hgdiobj uninitialized probably didn't result in any problems
considering how this class is currently used but it did result in g++ warnings
about uninitialized member with aggressive warning flags and also could easily
become a problem in the future so just ensure that we always initialize it.
Vadim Zeitlin [Wed, 29 Jun 2011 08:37:49 +0000 (08:37 +0000)]
Replace stc.{h,cpp} with the generated versions with all their typos.
Revert the changes of r67280 which fixed several typos in these files as they
were getting modified each time gen_iface.py was rerun and we don't want to
touch the original Scintilla files to fix these typos.
Vadim Zeitlin [Wed, 29 Jun 2011 08:37:46 +0000 (08:37 +0000)]
Generate code using IsOk() instead of Ok() in stc.cpp.
Modify the script generating this file itself to produce IsOk() instead of
Ok(). This replaces the changes of r67681 which only modified the generated
file.
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.