Fix function wxControlBase::DoEllipsizeSingleLine to really make sure that the ellipsized string takes less pixels than maxFinalWidthPx.
Add comments to explain in more details what the function does and in particular the valid ranges of all internal variables; fix in that regard both the code of both wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE and wxELLIPSIZE_END.
Add more asserts to check the valid ranges and turn a couple of time-expensive checks in level-2 asserts.
Add a test unit for the wxControl::Ellipsize function.
Fix minor details in the docs of wxControl::Ellipsize.
Closes #11567.
no real changes, just rename the variables to make the code more readable and to prepare everything for the next commit:
- add postfix "Px" to all variables containing numbers of pixels
- add postfix "ToRemove" to initialChar and nChars vars to make it clear what they are for
Vadim Zeitlin [Mon, 8 Mar 2010 19:37:08 +0000 (19:37 +0000)]
Use correct style for the dialog shown by generic file/dir pickers.
The picker styles don't make sense for the button so we don't use them when
creating the button but we do need to somehow use the style the picker was
created with to create an appropriate dialog when it's clicked.
Fix the problem by simply storing the style in a member variable and using it
instead of wxWindow::m_windowStyle.
Provide more details about the major and minor version numbers returned by wxGetOsVersion() under linux,mac,windows.
Document that wxOS_UNIX, wxOS_MAC and wxOS_WINDOWS enum values are combinations of other values (unfortunately doxygen does not show the definition of those symbols in the HTML docs so we need to explicitely state that).
Vadim Zeitlin [Fri, 5 Mar 2010 23:56:47 +0000 (23:56 +0000)]
Don't stop dragging in the grid when the mouse leaves the window.
Unexpected/unaccounted for mouse leaving and entering events stopped the drag
operation currently in progress in wxGrid. And while it was resumed later,
this resulted in the mouse being captured only twice but released only once.
Fix this by ignoring the leaving and entering events and checking that we
don't capture the mouse again.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:19 +0000 (23:55 +0000)]
Implement wxBookCtrlBase::CalcSizeFromPage() in the base class.
The definition of this method was needlessly duplicated in all of
wx{Choice,List,Tool,Tree}book and in all of them except the first one it
didn't account correctly for the case when the size of the controller was
greater than the size of the page.
Avoid the duplication and fix the best size determination in such case by
providing a single, correct version of the function in the base class itself.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:09 +0000 (23:55 +0000)]
No changes, just remove redundant GetControllerSize() definitions.
For some reasons wxBookCtrlBase::GetControllerSize() was redefined in several
derived classes even though it did exactly the same thing in all of them.
Leave only the base class version and remove the other ones.
Vadim Zeitlin [Fri, 5 Mar 2010 23:55:04 +0000 (23:55 +0000)]
Correct controller size determination in wxToolbook.
The old code used the current toolbar size instead of determining its best
size for some strange reason and this resulted in toolbar remaining of tiny (1
pixel) height at least under wxGTK.
Fix this by simply using the best size of the toolbar.
Vadim Zeitlin [Wed, 3 Mar 2010 14:19:29 +0000 (14:19 +0000)]
Allow using version-specific vc prefix in msvc/wx/setup.h.
We still use just "vc" by default for compatibility but allow the user to
predefine either wxMSVC_VERSION or wxMSVC_VERSION_AUTO to use the specified or
version-dependent prefix instead. This is very convenient when using multiple
MSVC versions.
add 64bit support to those formats which I could test and which support 64bit build modes (msvc, msvs2005prj and msvs2008prj) by adding a TARGET_CPU option similar to what wxWidgets bakefiles do (note the absence of the WX_ prefix since it does not make sense to have a wx-specific architecture); this additional feature allows correct inclusion of the vc_[amd64|ia64]_[lib|dll] path when building a wx-based project on Windows.
Vadim Zeitlin [Tue, 2 Mar 2010 20:46:18 +0000 (20:46 +0000)]
Use user locale with Latin-1 as fallback for command line arguments.
Command line arguments can contain characters outside of 7 bit ASCII range.
Assume that they use the default user encoding but fall back to Latin-1 if
conversion failed.
Vadim Zeitlin [Mon, 1 Mar 2010 23:45:22 +0000 (23:45 +0000)]
Fix crash when accessing clipboard before entering the main loop.
Check that we have an event loop running before yielding to it.
Notice that we really do need an event loop in wxClipboardSync as events must
be dispatched for the clipboard code to work so while not using the event loop
if it doesn't exist would have fixed a crash as well, it wouldn't allow to use
the clipboard in e.g. wxApp-derived class OnInit().
Vadim Zeitlin [Sun, 28 Feb 2010 11:30:55 +0000 (11:30 +0000)]
Simplify and correct bugs in wxMSW wxScrollBar message handling.
For some reason we computed scroll increment from the native message and not
the new position directly which is actually simpler and probably would have
never resulted in a bug which exchanged the meanings of SB_TOP and SB_BOTTOM.
Get rid of nScrollInc and just update the position variable directly.
Vadim Zeitlin [Sun, 28 Feb 2010 11:09:26 +0000 (11:09 +0000)]
Make it possible to use wxCharBuffer during program initialization.
wxCharBuffer might be used during static initialization, even if only
implicitly. E.g. it is used by wxString::Format() which can be used to
initialize a global string. But it uses the global s_untypedNullData variable
might not be initialized yet resulting in mysterious failures.
Fix this in the usual way by wrapping access to the variable via a function.
Vadim Zeitlin [Sun, 28 Feb 2010 11:09:21 +0000 (11:09 +0000)]
Only add -woff 3970 to C[XX]FLAGS when using SGI mipsPro 7.4.4 or later.
Previous mipsPro versions don't give this warning but do warn about "unknown
warning number 3970" if we use this -woff which is even more annoying than
original warning we tried to suppress.
This is a forward port of r45896 which somehow was only applied to 2.8 branch.
Vadim Zeitlin [Sun, 28 Feb 2010 11:09:15 +0000 (11:09 +0000)]
Compilation fixes for wide char functions under IRIX with mipsPro.
Use correct (XPG5, not XPG4) version of wcsftime().
Bring the wide char functions only declared in std namespace into global one
under IRIX.
Declare vswscanf() ourselves as we just don't seem to get its declaration from
C++ code (only from C99).
Add a cast to fix incorrect putws() signature.
All these fixes apply to IRIX 6.5.18 with mipsPro 7.4.2. It doesn't seem to
add configure checks for most of the above fixes as previous versions of both
the OS and the compiler should be completely extinct by now but we may need to
do it if anybody is still found to use them.
Vadim Zeitlin [Sun, 28 Feb 2010 11:09:11 +0000 (11:09 +0000)]
Fix for wxStringCheck compilation under IRIX using mipsPro.
IRIX mipsPro 7.4 refuses to instantiate a template with an inline function as
parameter. Work around this by using a function taking a function pointer
instead of using template wxStringCheck with inline wxIs{alpha,alnum,digit}.
Vadim Zeitlin [Sun, 28 Feb 2010 11:08:54 +0000 (11:08 +0000)]
Support IRIX version of OpenGL multi sampling constants.
Although OpenGL multi sampling extensions originated under IRIX, it doesn't
seem to use the standard names for the constants used and uses "SGI" suffix
for them instead of "ARB".
Add support for IRIX versions of GLX_SAMPLE_BUFFERS_ARB and GLX_SAMPLES_ARB
and also check if these constants are defined at all to avoid compilation
errors if they are not.
Vadim Zeitlin [Sun, 28 Feb 2010 11:08:50 +0000 (11:08 +0000)]
Fix the STC sources generation script to work with ancient Python.
Don't use True, set and join method of string objects which didn't exist in
prehistoric Python versions (such as 1.5 bundled with IRIX) as we can easily
work around their lack by using 1, list and string module join method instead.
Vadim Zeitlin [Sun, 28 Feb 2010 11:08:34 +0000 (11:08 +0000)]
Remove unnecessary comparison of unsigned variable with 0.
m_httpsize is of type size_t and so is always >= 0, no need to check for it.
And removing the check avoids a warning from at least IRIX mipsPro (and
probably others).
Vadim Zeitlin [Sun, 28 Feb 2010 11:08:30 +0000 (11:08 +0000)]
Remove unused static constant.
HOURS_PER_DAY was used only in the part of the code which was moved to
src/common/datetimefmt.cpp and some compilers (e.g. IRIX mipsPro) now warn
about an unused static constant in datetime.cpp, so just remove it from there.
Vadim Zeitlin [Sun, 28 Feb 2010 11:08:26 +0000 (11:08 +0000)]
Include the real iostream header and not just iosfwd from wx/stdstream.h.
We need to include full [io]stream declaration and not just forward declare
them to be able to define classes deriving from them. Surprisingly, including
just <iosfwd> seems to work under most systems but it does not under IRIX.
So include the full <iostream> (or <iostream.h>) to be sure to get what we
need.
Jaakko Salli [Sun, 28 Feb 2010 10:16:49 +0000 (10:16 +0000)]
Sometimes change in varscrollable window's size can result in unused empty space after the last item. Fix it by decrementing first visible item position as long there is available space (fixes #11758).
Kevin Ollivier [Sat, 27 Feb 2010 02:51:45 +0000 (02:51 +0000)]
Override CanFocus because the wxWindow level test will check if the NSTextView's parent scrollview can get keyboard focus, and will return no, meaning that wx won't set the focus to the text ctrl.
Vadim Zeitlin [Fri, 26 Feb 2010 14:10:02 +0000 (14:10 +0000)]
Fix assert when using year or decade view in Windows 7 calendar control.
Windows 7 native calendar control is capable of showing more than 3 months
simultaneously in its year or decade view which is shown when the user zooms
out of the month view by double clicking the control header. This resulted in
an assert failure in the code, update it to simply not do anything in this
view.
Vadim Zeitlin [Fri, 26 Feb 2010 14:09:58 +0000 (14:09 +0000)]
Fix assert on wxCalendarCtrl creation under Windows 7.
Unlike previous versions of Windows, 7 includes the time component in the
return value of MonthCal_GetCurSel() and because of it the comparison with
m_date (which doesn't have any time part) fails.
Fix this by comparing just the date parts of the two wxDateTime objects.
Vadim Zeitlin [Fri, 26 Feb 2010 14:09:43 +0000 (14:09 +0000)]
Add pretty-printers for wxPoint, wxSize and wxRect.
Also replace an if checking for the supported types with an array-based
approach to make it easier to add pretty printers for more types in the
future.
Vadim Zeitlin [Thu, 25 Feb 2010 00:03:44 +0000 (00:03 +0000)]
Fix multiple bugs in non-ownerdrawn wxListBox after recent merge.
Changes done in ownerdraw-refactor branch have broken non-ownerdrawn list
boxes as the code was now using m_aItems array even for them but it's not used
in this case.
Also remove unnecessarily overridden Delete() method which didn't add anything
to the base class implementation but just deleted the same m_aItems pointer
twice.
Also use HasFlag(wxLB_OWNERDRAW) everywhere consistently instead of testing
for it manually.
Vadim Zeitlin [Thu, 25 Feb 2010 00:03:39 +0000 (00:03 +0000)]
Document the use of --disable-gui for building wxBase.
We don't have a special configure version for wxBase where GUI is off by
default and it doesn't seem to be worth the trouble to create one. Instead
just tell people to use --disable-gui themselves.
Vadim Zeitlin [Thu, 25 Feb 2010 00:03:35 +0000 (00:03 +0000)]
Always use UTF-8 for GTK+ strings.
Strings returned and accepted by GTK+ functions always use UTF-8 independently
of the current locale and of the file name encoding we use. So use UTF-8
instead of wxConvFileName everywhere where we deal with GTK+ directly.