Reset negatable switches correctly in wxCmdLineParser::Reset().
The "negated" flag of wxCmdLineOption struct was not reset by Reset() so
parsing a command line with a negatable option once influenced the result of
parsing it the next time because the old value was kept.
Do clear it now to allow calling Parse() several times without side effects.
Don't use template member function in drawing sample to placate VC6.
VC6 can't instantiate member template functions so get rid of it and use ugly
dynamic casts in the non-template function to construct wxGCDC correctly.
Fix harmless gcc warning about uninitialized mask in PNG saving code.
The mask was actually only used when it was initialized (or, conversely, the
mask was always initialized when it was used) but gcc doesn't seem to notice
this and still warns that mask components "may be used uninitialized in this
function".
Suppress the warnings by always initializing the mask, even if we don't use
it.
Refresh the old current row when right clicking in wxDataViewCtrl.
the generic implementation of wxDataViewCtrl left the old current still
focused after selecting another row as current when it was right clicked.
Fix this by refreshing the previously current row after unfocusing it.
Fix deleting columns in wxGridStringTable with custom column labels.
We erroneously removed too many elements from m_colLabels array (basically we
always removed all the elements remaining after this column, irrespectively of
the actual number of columns to delete), fix this by removing at most the
specified number of columns -- or possibly less if the array isn't entirely
filled.
Allow saving the drawing sample canvas to a file or clipboard.
This allows to test wxMemoryDC and, under MSW, wxMetafileDC and also can be
used to compare the output of different versions of the sample (possibly from
different ports, too).
Fix keyboard navigation in wxGrid with hidden columns.
The hidden columns (i.e. those whose size was set to 0) should be skipped when
find the previous/next column to select when the user presses Left/Right
cursor arrow keys in wxGrid, otherwise the focus could completely disappear as
it was invisible when it was set to a hidden column.
Václav Slavík [Wed, 13 Jul 2011 08:32:17 +0000 (08:32 +0000)]
Better sizing in wxDataViewSpinRenderer and wxDataViewChoiceRenderer.
Their GetSize() method used hardcoded size of (80,16). Instead, use
GetTextExtent() to compute the size from content, as should be done. Add
some extra room for editor control's extra parts. The space needed isn't
computed exactly, as that would be quite convoluted (and in the end,
most likely not 100% accurate even then), using a simple approximation
instead.
Use native hint wxTextCtrl support in wxSearchCtrl.
Instead of using broken emulation of the support for hints available in the
text control, use the real wxTextCtrl::SetHint() for SetDescriptiveText()
implementation in the search control.
This looks better and, more importantly, fixes the bug when searching for the
string equal to the current descriptive text searched for an empty string
instead.
No real changes, just make some wxSlider members local variables.
wxMSW wxSlider implementation stored the min and max labels widths as fields
of wxSlider object for some reason even though they were only used in one of
its methods (and can be easily computed anyhow).
Make them simple local variables instead and also rename an existing local
variable which started conflicting with their new names.
Don't handle "Return" key as "TAB" even when the default button is disabled.
wxMSW used to handle VK_RETURN in the same way as VK_TAB if it wasn't consumed
by the default push button but this didn't correspond to the native platform
behaviour which considers pressing Return when the OK button is disabled an
error and audibly notifies the user about it.
Fix this by passing VK_RETURN to IsDialogMessage() if we don't translate it to
a button click.
Also add a possibility to test what happens when the default (or all)
button(s) in the dialog are disabled to the dialogs sample.
Use the correct event handler in wxMenuBase::UpdateUI().
Use GetWindow() instead of GetInvokingWindow() to send the event to the
associated window for the menus that are part of the menu bar and not only the
popup ones. This was broken since r64127 because GetInvokingWindow() is now
only used for the popup menus.
Support float, double and file name values in wxGenericValidator.
Currently these values can only be read from/written to wxTextCtrl but support
for other controls (e.g. wxSpinCtrlDouble for float/double) could be added in
the future.
Check for GTK window parent, not wx one, when reparenting.
A notebook page removed from its notebook can have a non-NULL wx parent but
not have any parent at GTK level any longer, so test for the window parent at
GTK level before removing the widget from it, otherwise we were getting GTK
asserts when trying to remove a window from its no-more-parent.
Refresh the generic wxDataViewCtrl header if it was made too small.
Although normally the control header is not supposed to be resized below its
minimal vertical size, sometimes this can still happen and in this case ugly
artefacts were displayed because it wasn't refreshed properly. Do refresh it
to avoid them.
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).