Don't use StringFormat::GenericTypographic() in MSW wxGraphicsContext.
Using this string format results in very condensed strings when using small
fonts. The results of GDI+ font rendering are still pretty bad even without it
but they are at least slightly better.
Use a single global StringFormat in all wxMSW wxGraphicsContext code.
Instead of creating StringFormat in DrawText() and Get[Partial]TextExtent[s],
create it once and simply use it from both functions.
This might be slightly more efficient as we don't waste time recreating it but
the main advantage is that it ensures that these functions use the same string
format and no discrepancies between them are possible.
Output the values of all USE_XXX options to build.cfg file in MSW builds.
USE_RTTI, USE_AUI, USE_PROPGRID, USE_RIBBON, USE_RICHTEXT, USE_STC and USE_XRC
options were not output to the build configuration file, unlike the rest of
them.
Do output those ones as well now for consistency.
Also sort the options corresponding to different wx libraries alphabetically.
Document wxWindow InheritsBackgroundColour() and UseBgCol() methods.
These functions were present in the interface header but didn't have their own
documentation and somehow inherited the documentation of the first function in
the same section which didn't make any sense for them. Do document them now.
Without it, the hidden faces are shown resulting in wrong display of both the
cube and the penguin, at least with Mesa (but it also seems to be the correct
thing to do according to OpenGL documentation).
Václav Slavík [Sat, 8 Sep 2012 08:58:38 +0000 (08:58 +0000)]
Add wxTranslations::GetBestTranslation().
Implement preferred language selection on modern systems (OS X, Windows
Vista+). User settings for locale (aka "regional settings") and UI
language are independent there and the UI language shouldn't be
determined from the locale.
Moreover, the OS provides a list of preferred languages, not a single
value (as with locale), so we should use the best language given user's
preferences and available translations. A Czech user may prefer Slovak
UI over English, for example, and we should use Slovak translation in
absence of Czech one in that case instead of falling back to English.
On Unix, locale is language and so things remain as before.
Notice that calling wxLocale::Init(wxLANGUAGE_DEFAULT) does the right
thing now: it sets the locale to whatever the user has configured in
regional settings and loads translations corresponding to default
wxTranslations language, which is determined as described above.
Previously, UI would be translated using a language corresponding to the
regional settings.
A newer version of XML Tools has been released (2.9.4) which supports OS X 10.6 and later. As such a link to the beta version of 2.9.4 is not needed anymore.
Václav Slavík [Fri, 7 Sep 2012 09:51:10 +0000 (09:51 +0000)]
wxMSW: Fix incorrect subitem rect calculation in wxListCtrl.
HandleSubItemPrepaint() calls wxGetListCtrlSubItemRect() (a thin
replacement of ListView_GetSubItemRect) with subitem argument
corresponding to MSDN documentation: it should be 0 for the whole item
and 1-based for subitems.
Unfortunately, as pointed out in an explanatory comment for
wxGetListCtrlSubItemRect(), MSDN lies and the index actually is 0-based.
The bug causes wxListCtrl's content to be shifted by one column and
rendered with additional artifacts as soon as custom drawing is used,
e.g. when a custom font is used.
This bug was introduced in r55378; the code correctly accounted for this
before that. This change partially reverts that commit.
This macro can be used with 2 arguments (format and argptr) or 3 (the frame
pointer as an additional first argument), so don't define it as taking 2
arguments but as a macro without arguments, as we already do for
wxVLogSysErrorfor the same reasons.
Vadim Zeitlin [Thu, 30 Aug 2012 20:25:46 +0000 (20:25 +0000)]
Fix opening URLs in new window with recent Firefox under Windows.
Don't fail if we can't replace "-1" in the WWW_OpenURL topic value stored in
the registry with "0", it can be already "0" for the recent Firefox versions.
Vadim Zeitlin [Thu, 30 Aug 2012 20:25:24 +0000 (20:25 +0000)]
Explicitly reject the use of wxTE_PASSWORD in generic wxSpinCtrl.
wxTE_PASSWORD has the same value as wxALIGN_CENTRE_VERTICAL which could be
implicitly specified as part of wxALIGN_CENTRE, but should never be used with
wxSpinCtrl, so explicitly filter it out when creating the associated
wxTextCtrl.
Vadim Zeitlin [Thu, 30 Aug 2012 20:25:01 +0000 (20:25 +0000)]
Generate wxEVT_COMMAND_TEXT_ENTER events for generic wxSpinCtrl.
Pass wxTE_PROCESS_ENTER to wxSpinCtrlTextGeneric if it's specified for
wxSpinCtrl itself and also forward wxEVT_COMMAND_TEXT_ENTER events from it to
wxSpinCtrl itself.
This fixes lack of these events for wxSpinCtrlDouble under MSW and also lack
of them for any kind of wxSpinCtrl in the ports using generic version (notably
wxOSX).
Vadim Zeitlin [Thu, 30 Aug 2012 20:24:38 +0000 (20:24 +0000)]
Add wxSpinCtrl::SetBase() to allow entering hexadecimal numbers.
Add a generic SetBase() API even though right now only bases 10 and 16 are
supported as we might support other ones (e.g. 8?) in the future. Implement it
for MSW, GTK and generic versions.
Add controls allowing to test this feature to the widgets sample.
Add "base" property support to the XRC handler for wxSpinCtrl, document it and
test it in the xrc sample.
Vadim Zeitlin [Thu, 30 Aug 2012 20:24:12 +0000 (20:24 +0000)]
Remove wxOSX implementation of wxSpinCtrl and use the generic one.
wxOSX doesn't provide a native spinner+text control so it used a generic
implementation of wxSpinCtrl but a different one to the version found in
src/generic/spinctlg.cpp.
Just use the real generic version instead, it doesn't make sense to have two
different versions of the same generic control.
Vadim Zeitlin [Thu, 30 Aug 2012 20:23:49 +0000 (20:23 +0000)]
Refactor text to/from double conversion in wxSpinCtrlGenericBase.
The code always used ToDouble() and Format("%g") which was a bit strange for
integer-valued wxSpinCtrl. Move the conversions to their own virtual functions
for clarity, perhaps correctness and, especially, flexibility as they will be
overridden in wxSpinCtrl soon.
Also move wxSpinCtrlGenericBase::m_format to wxSpinCtrlDouble as the base
class really doesn't need it at all.
Vadim Zeitlin [Thu, 30 Aug 2012 20:23:03 +0000 (20:23 +0000)]
Fix position carried in wxSpin{Button,Ctrl} events for 32 bit values in wxMSW.
Don't use WM_VSCROLL message parameter as the position because it's a 16 bit
value and is not enough for the spin controls using 32 bit range. Just use the
current value available from the control itself instead.
This fixes assert failures in the spin page of the widgets sample when
changing the value of a control when it is > SHRT_MAX.
Vadim Zeitlin [Thu, 30 Aug 2012 20:22:40 +0000 (20:22 +0000)]
Use wxSOCKET_WAITALL in wxHTTP to ensure that all data is sent.
POST-ing sufficiently big amounts of data in wxHTTP didn't work because it
couldn't be sent all at once to the server. Use wxSOCKET_WAITALL to ensure
that we do send all of the data.
Vadim Zeitlin [Thu, 30 Aug 2012 20:22:17 +0000 (20:22 +0000)]
Fix bugs in parsing wxLongLong values starting with zeroes.
wxCRT_StrtoullBase(), used by wxString::To[U]LongLong(), didn't handle leading
zeroes nor leading 0x correctly: it never auto-detected base 8; didn't ignore
the leading 0 even if base 8 was specified explicitly; didn't recognize "0X"
prefix at all (only "0x").
Fix all these bugs and add test cases for parsing numbers in other bases to
the unit tests.
Vadim Zeitlin [Thu, 30 Aug 2012 20:21:54 +0000 (20:21 +0000)]
Added wxSimplebook class: a wxBookCtrl without controller.
This new control allows the program to show one of the several pages without
allowing the user to change them (or even see that there are several of them)
himself.
This class is fully inline, so it doesn't add anything to the library and
hence doesn't need neither wxUSE_SIMPLEBOOK nor the corresponding configure
option.
Vadim Zeitlin [Thu, 30 Aug 2012 20:21:29 +0000 (20:21 +0000)]
Virtualize showing/hiding the pages in wxBookCtrlBase.
No real changes, just make it possible to change how the pages are hidden and
shown in the derived classes. This is not used by any of them yet, but will be
used by wxSimplebook soon.
Vadim Zeitlin [Thu, 30 Aug 2012 20:19:57 +0000 (20:19 +0000)]
Use wmain() if supported by the compiler/CRT instead of main().
This avoids a needless conversion from (originally Unicode) command line to
ANSI by the CRT and conversion back by wxWidgets and, especially, ensures that
there is no data loss if the Unicode command line arguments can't be converted
into the current charset.
Vadim Zeitlin [Sun, 26 Aug 2012 16:35:02 +0000 (16:35 +0000)]
Avoid crashes when creating initially hidden MDI child under Unity.
Ignore "hide" signals for the menus without associated shown window. Ubuntu
Unity sends them and we crashed because of a recursive assert in the
corresponding signal handler before.
Now the code doesn't crash any more but the menus still don't behave correctly
when the last MDI child is destroyed.
Václav Slavík [Sat, 25 Aug 2012 11:14:44 +0000 (11:14 +0000)]
Make sure wchar_t CRT functions work on OS X.
In OS X and iOS, wchar_t CRT functions convert to char* and fail under
some locales. The safest fix is to set LC_CTYPE to UTF-8 to ensure that
they can handle any input.
Note that this must be done for any app, Cocoa or console, whether or
not it uses wxLocale.
See http://stackoverflow.com/questions/11713745/why-does-the-printf-family-of-functions-care-about-locale
Vadim Zeitlin [Wed, 15 Aug 2012 23:34:31 +0000 (23:34 +0000)]
Fix AUI appearance when a maximized pane becomes floating.
The other panes were not previously restored, resulting in bad appearance and
behaviour. Do restore them now before making the previous maximized pane
floating.
Vadim Zeitlin [Wed, 15 Aug 2012 23:34:18 +0000 (23:34 +0000)]
Honour window min and max sizes in wxWindow::GetBestSize().
The best size of the window should be at least as large as its min size and
less than its max size. This allows to override the windows own best size
determination with an explicit SetMinSize() or SetMaxSize() call.
Vadim Zeitlin [Wed, 15 Aug 2012 23:34:10 +0000 (23:34 +0000)]
Don't generate events from wxSpinCtrl::SetRange() in wxMSW.
Other ports don't send wxEVT_COMMAND_SPINCTRL_UPDATED from SetRange() even if
the value changed because it was adjusted to fit into the new range and this
makes sense as this change is not due to a user action, so don't send this
event under wxMSW neither.
Vadim Zeitlin [Wed, 15 Aug 2012 11:34:46 +0000 (11:34 +0000)]
Restore the use of wxListCtrl in report view in wxListbook.
This reverts r71965 for wxMSW as the list mode there doesn't work correctly if
there are sufficiently many items: the native control insists on laying them
out in multiple columns which is inappropriate for wxListbook, so use report
mode for horizontal wxListbooks. Do use the list mode in the vertical case as
we do want to have multiple columns -- and not rows -- then.
Vadim Zeitlin [Wed, 15 Aug 2012 11:34:43 +0000 (11:34 +0000)]
Fixes for forwarding events to parent in wxGenericListCtrl.
Set the event object and the event ID correctly, i.e. to the values
corresponding to the main wxListCtrl itself, when forwarding mouse and
keyboard events from wxListMainWindow to wxListCtrl.
Vadim Zeitlin [Sat, 11 Aug 2012 23:09:33 +0000 (23:09 +0000)]
Update the icon of a parent item without children in wxDataViewCtrl.
Ensure that a parent item that doesn't have any children any more isn't left
with a "-" expander icon, it can't be collapsed any more but only expanded
again (possibly adding children under it dynamically). This results in better
behaviour in e.g. the last page of the dataview sample where the container
item remained with a "+" icon even after its both children were deleted.
Vadim Zeitlin [Sat, 11 Aug 2012 23:09:29 +0000 (23:09 +0000)]
Really delete the item in wxDataViewTreeStore::DeleteItem().
For some incomprehensible reason only child branches were ever deleted from
the list of parents children in DeleteItem(), not simple tree items. This
meant that reexpanding a node after deleting all its children showed the
previously "deleted" children again.
Václav Slavík [Thu, 9 Aug 2012 15:52:15 +0000 (15:52 +0000)]
Show progress of printing in wxMSW.
Add the number of the page being printed as well as the total to the
wxMSW printing progress window. Improved the layout and fixed some i18n
issues in the process.