Vadim Zeitlin [Fri, 20 May 2011 14:29:07 +0000 (14:29 +0000)]
Avoid conversion from wxString to wxChar* and back in wxListBase::DoCopy().
Don't use temporary wxChar* variable to store the node string. This is not
only inefficient because we need to convert wxString to it only to convert it
back to wxString on the next line but also breaks compilation when
wxUSE_STD_STRING==1 and wxUSE_STD_CONTAINERS==0 as there is no implicit
conversion between wxString and wxChar* in this case.
Also modify the code for long keys in the same way just for consistency.
Vadim Zeitlin [Thu, 19 May 2011 14:14:58 +0000 (14:14 +0000)]
Make picker control at least as high as the associated text and square.
Ensure that the height of the picker control is at least as big as the height
of the associated text control and that it's at least as wide as it is high as
it looks bad otherwise.
Vadim Zeitlin [Tue, 17 May 2011 22:12:39 +0000 (22:12 +0000)]
Allow passing wxLongLong values directly to wx pseudo-vararg functions.
Allow passing wxLongLong objects when a "%lld" format specifier (or
equivalent) is used just as we already do for wxString objects when "%s" is
used. This is more convenient and makes wxLongLong closes to the native type.
Vadim Zeitlin [Tue, 17 May 2011 22:12:35 +0000 (22:12 +0000)]
Don't construct invalid wxDateTime in GTK calendar control callbacks.
GTK+ may momentarily return invalid date when switching the month in the
calendar control. Check for this and adjust the date ourselves to make it
valid if necessary in order to avoid the asserts from wxDateTime ctor.
Vadim Zeitlin [Tue, 17 May 2011 13:35:04 +0000 (13:35 +0000)]
Fix client to screen translation in wxWindowMSW::PopupMenu().
Use wxWidgets ClientToScreen() function for computing the screen coordinates
of the popup menu instead of Windows ::ClientToScreen() as the latter doesn't
know about the toolbar which may be present in wxFrame and excluded from the
client area.
Vadim Zeitlin [Mon, 16 May 2011 10:01:12 +0000 (10:01 +0000)]
No changes, just refactor the code in MSW wxGetOsDescription() slightly.
Construct the description string from several pieces: the OS name, its build
number and any extra information about it, instead of duplicating the code
appending the build number to the name in several places.
Vadim Zeitlin [Sun, 15 May 2011 16:16:11 +0000 (16:16 +0000)]
Allow dragging floating AUI frames by the gripper.
Previously starting to drag a pane by its gripper worked but once it undocked
it was impossible to drag it by the gripper any more which was annoying for
the user and unexpected.
Fix this by ensuring that we move the correct top level window and not the
child window when dragging floating panes.
Vadim Zeitlin [Sat, 14 May 2011 14:18:20 +0000 (14:18 +0000)]
Fix small error in floating AUI frames client size under wxMSW.
The client size of the floating frames ended up being wrong because we changed
the wxRESIZE_BORDER flag after setting it and this changed it (at least under
MSW).
Reset wxRESIZE_BORDER first now and set the client size correctly afterwards.
Vadim Zeitlin [Sat, 14 May 2011 14:18:17 +0000 (14:18 +0000)]
Fix restoring of wxAuiManager::m_has_maximized when restoring perspective.
If the perspective being loaded contains a maximized pane, set the
m_has_maximized flag to true. Otherwise the flag and the effective pane state
was out of sync resulting in several problems in the UI behaviour.
Vadim Zeitlin [Sat, 14 May 2011 14:18:09 +0000 (14:18 +0000)]
Reset the checked state of the first radio item in wxAuiToolBar too.
Fix the condition of the loop in wxAuiToolBar::ToggleTool() to also uncheck
the item with index 0 that was always excluded before because of "i > 0" check
in the loop.
Also exclude the item being turned on itself from the loops, it's useless to
reset its checked state only to turn it on again below.
Vadim Zeitlin [Sat, 14 May 2011 14:18:02 +0000 (14:18 +0000)]
Improve checking for the landing point when docking windows in wxAUI.
This is especially important for multiple monitor setups in which the old code
could result in false positives and suggest docking a window on a wrong
display.
Vadim Zeitlin [Sat, 14 May 2011 14:17:55 +0000 (14:17 +0000)]
Take the AUI floating title bar height into account when dragging it.
The cursor wasn't positioned correctly when a floating toolbar was dragged by
pressing the mouse over its gripper because its position didn't take into
account the difference between the client and window coordinates of the
floating window (which is basically the height of the window title bar).
Notice that the same problem still remains when starting to drag a docked
toolbar as it doesn't have the title bar initially but does have it later
so the same fix should probably be applied when we reparent the toolbar.
Vadim Zeitlin [Sat, 14 May 2011 14:17:52 +0000 (14:17 +0000)]
Cancel dragging in wxAuiNotebook on capture loss.
Don't leave the display and internal variables in inconsistent state when the
mouse capture is lost while a notebook page is being dragged (as can happen
if Alt-Tab is pressed under Windows, for example).
Vadim Zeitlin [Fri, 13 May 2011 13:30:12 +0000 (13:30 +0000)]
Don't use the standard containers by default.
Revert the change of wxUSE_STD_CONTAINERS to 1 by default as this introduces
more incompatibilities which risk hamper upgrading to 3.0 unnecessarily.
Update the documentation to better explain why do the non-standard container
classes exist in wxWidgets and, especially, that they shouldn't be used when
possible. Also document the differences between the normal and STL containers
build in the manual.
Vadim Zeitlin [Fri, 13 May 2011 13:30:03 +0000 (13:30 +0000)]
Make wxListCtrl sort function take wxIntPtr, not long, arguments.
As the arguments to the sort function contain the client data associated with
the items, they may be pointers and hence of greater size than long in Win64
builds. Use wxIntPtr instead of long everywhere to fix this.
Notice that this doesn't break compatibility for 32 bit code where long can
still be used as it is the same as wxIntPtr there after the previous commit.
Vadim Zeitlin [Fri, 13 May 2011 13:29:59 +0000 (13:29 +0000)]
Define wx[U]IntPtr as long, not [s]size_t, in 32 bit builds.
Defining wxIntPtr as ssize_t or long in 32 bit builds doesn't really change
anything but using long means that we can replace longs in the existing API
with wxIntPtr without breaking compatibility, like in wxListCtrl::SortItems().
It is also more compatible with 64 bit builds where wxIntPtr is long already.
So it has some minor advantages and no apparent drawbacks.
ScintillaWX.cpp didn't compile because std::string is unknown. Include <string> in case the defines that (by default) are set to wxUSE_STD_DEFAULT are 0.
Vadim Zeitlin [Tue, 10 May 2011 08:54:20 +0000 (08:54 +0000)]
Attempt to work around Mac g++ 4.0 bug in fswatcher unit test.
Don't define the class overriding a virtual base class method inside the test
function as g++ 4.0 under OS X 10.5 fails to compile this for some mysterious
reason.
Vadim Zeitlin [Tue, 10 May 2011 08:50:47 +0000 (08:50 +0000)]
Fix inserting radio menu items in wxGTK too.
After fixing the insertion of radio menu items in wxMSW, also do it for wxGTK
to make the newly added unit test pass there as well.
Remove the unneeded wxMenu::m_prevRadio which doesn't make any sense neither
(just as the "current radio group" pointer removed from wxMSW code before) and
simply use the radio group of the existing item this radio item is being
inserted before or after instead.
Vadim Zeitlin [Tue, 10 May 2011 08:50:38 +0000 (08:50 +0000)]
Rewrote wxMSW radio menu items code to support not only appending them.
Previously the radio menu items could only be appended to a menu in wxMSW,
inserting them (either in an existing radio group or to start a new one) not
only didn't work but could even result in crashes because invalid iterators in
the menu items list could be used.
Fix this by storing the ranges of all radio groups in wxMenu itself instead of
storing the information about the radio group an item belongs to in the item
itself and by updating this data whenever a new radio item is inserted. Also
get rid of the notion of "current radio group" in wxMenu which doesn't really
make any sense.
Finally add a unit test checking that inserting radio items works as expected.
Vadim Zeitlin [Mon, 9 May 2011 09:21:14 +0000 (09:21 +0000)]
No changes, just sort richtext files in files.bkl.
Sort RICHTEXT_{SRC,HDR} contents in alphabetical order, just as it's done for
all the other files list and to make it easier to check if a file already
occurs in these lists or not.
Robin Dunn [Thu, 5 May 2011 17:56:18 +0000 (17:56 +0000)]
When we're using GDI+, the DC might have transforms applied to it, but the renderer APIs don't respect them. So we need to apply the transforms to the rect ourselves.
Vadim Zeitlin [Tue, 3 May 2011 23:31:39 +0000 (23:31 +0000)]
Implement watching directory correctly in MSW wxFileSystemWatcher.
The directories used to be always monitored recursively, even when this wasn't
requested, in wxMSW implementation. Change this but also implement efficient
support for monitoring the entire hierarchies using the native support for
this.
Also update the sample to allow monitoring directories recursively as well.
Vadim Zeitlin [Tue, 3 May 2011 23:31:29 +0000 (23:31 +0000)]
Fix wxFileSystemWatcher::Remove() in wxMSW.
Removing the path watched by wxFileSystemWatcher didn't do anything in wxMSW
implementation so we still continued getting events for the changes to this
path even after calling Remove().
Fix this by really implementing Remove() properly. Also add a unit test
checking that we don't get any events after calling Remove().
Vadim Zeitlin [Tue, 3 May 2011 23:31:24 +0000 (23:31 +0000)]
No changes, just slightly simplify wxFileSystemWatcher unit test.
CheckResult() method of the test event handler doesn't need to return
anything, it uses CPPUNIT_ASSERTs and related macros inside it to check that
everything is expected.
Vadim Zeitlin [Tue, 3 May 2011 23:31:15 +0000 (23:31 +0000)]
Fix assert when creating wxBitmapButton without a valid bitmap in wxMSW.
wxBitmapButton can be created without a valid bitmap if SetBitmapLabel() is
called later, so don't call SetBitmapLabel() from the constructor if no bitmap
was provided.
Replaced Ok() occurrences with IsOk() throughout trunk.
Additionally renamed wxOSX' private wxNativePrinterDC::Ok() function to IsOk().
Didn't deprecate the various Ok() functions: given the amount of changes already introduced in 3.0 a trivial one like this seems more suitable for after 3.0.
Since the copying of src/osx/carbon/notebmac.cpp to src/osx/notebook_osx.cpp in r55202 the code in wxNotebook::HitTest has been disabled. Enabled it again for at least the Carbon build.
Vadim Zeitlin [Tue, 3 May 2011 10:40:31 +0000 (10:40 +0000)]
Don't crash on startup of console programs in monolithic wxX11 build.
When using monolithic build, GUI-specific wxWinModule is still linked in but
its initialization crashes because there is no global display. Simply don't do
anything in this module OnInit() in this case to avoid the problem (which
affected e.g. wxrc in this build configuration).
Vadim Zeitlin [Tue, 3 May 2011 10:40:28 +0000 (10:40 +0000)]
Correct wxDirExists() check in OS X wxFileSystemWatcher implementation.
Pass the full path to wxDirExists, not the relative path from the watched
directory as this won't work unless the watched directory is the same as the
current one.
Fixed reading multiple images from ANI and ICO image files.
In r60852 various 'unneeded' SeekI(0) calls were removed. Examined the changes in that revision and restored all SeekI(0) calls after finding out their removal caused problems with reading more than one image from ICO and ANI files. The image handling code for these formats expects to read from the start of a stream for reading its images (as well as for DoCanRead and DoGetImageCount), regardless of the index of the requested image.
Václav Slavík [Sun, 1 May 2011 18:44:35 +0000 (18:44 +0000)]
Make wxSpinCtrlGeneric usable as wxDVC editor control.
wxDVC installs temporary event handler that watches for focus changes
and some key events. Make wxSpinCtrlGeneric look like a native
wxControl in this respect even though it's actually a composite control.
Rebaked test GUI projects with toplevel.cpp included.
Added toplevel.cpp to GUI test projects and removed the test suite from the unnamed registry so that by default its tests don't run (some regarding ShowWithoutActivating are failing). This way at least the source file has more of a chance to be in a compilable state (compilation was broken). toplevel.cpp has never been included in a project since its addition in r62508 ("[...] until the mainloop issues are resolved [...]").
Robin Dunn [Fri, 29 Apr 2011 20:03:45 +0000 (20:03 +0000)]
Fix popen2 deprecation warning.
Fix binary name inside the framework to be the same as the framework name.
Inject a bit of info about the framework into wx-config, so it can output framework flags/names instead of lib flags/names.
Remove fixed size of gs_encodingNames array in font mapper code.
Specifying the size explicitly made wxCOMPILE_TIME_ASSERT() checking that the
array sizes were synchronized useless as the array always had the correct
size, independently of the real number of elements in it.
Correct wxFontMapper tables for Big-5, Shift-JIS and GB2312 encodings.
As wxFONTENCODING_{BIG5,SHIFT_JIS,GB2312} are only synonyms for the other
encoding constants, we must append the corresponding names to the array of
names for the real encoding value instead of having the (never used) separate
entries for them in the names array.
Fix wxULongLongNative::ToDouble() compilation with VC6.
The problem alluded to by the commit message of r40658 arose only in the DLL
build using VC6 so reintroduce the workaround for it removed by r67634 but
make it VC6-specific and, arguably even more importantly, also make it work
correctly for wxULongLongNative values greater than LONGLONG_MAX.
Don't specialize std::numeric_limits<> for wxLongLong when using VC6.
This doesn't work with VC6 anyhow as it doesn't provide numeric_limits<>
specialization for __int64 and results in many warnings C4663 as the standard
header itself uses obsolete template specialization syntax.
The conversion of wxULongLong to double was broken for MSVC by r40658 which
was supposed to correct some unspecified compilation problem but this code
seems to compile fine with at least recent versions of MSVC and, in any case,
correcting compilation only for the code to work incorrectly during run-time
doesn't look like a good idea.
Change VIEWPORT_EXTENT constant in wxMSW wxDC code to be a power of two.
Notice that this commit doesn't really change anything, in particular it
doesn't correct zooming for zoom factors that are power of 2 (which was broken
before as ticket #11669 showed), this was already done by the previous commit.
This one simply makes multiplying by VIEWPORT_EXTENT a tiny bit more efficient.
Multiply by scale factor when it's > 1 and divide by it when it's < 1 to avoid
rounding errors. By choosing whether to increase the viewport or window
extents we increase precisions without any apparent negative effects (at least
under Windows NT where the coordinates in 2^27 range are supported, but even
under Windows 9x it's not clear if the old code was better as while we never
overflowed the viewport extents, we could overflow the window ones easily for
small zoom factors).
Ensure that message boxes with only "OK" can be closed with Escape in wxMSW.
The native task dialog doesn't allow using Escape (nor Alt-F4 but this is less
annoying) to close it unless it has a Cancel button, so by default the dialogs
with only "OK" couldn't be closed with Escape.
Work around this by creating a Cancel button with "OK" label instead. This is
not ideal but there doesn't seem to be any other way to make this work.
Allow showing the print preview frame non modally.
Still show the print preview app modally by default, i.e. disabling all the
other windows, but also allow disabling only the preview parent or nothing at
all.
Make it easier to compare wxImages in the unit tests.
Instead of forcing the tests to manually use memcmp(), specialize
CppUnit::assertion_traits<> for wxImage. This allows to simply use
CPPUNIT_ASSERT_EQUAL() and related macros with wxImage objects.
No changes, just simplify the mask checks in wxImage::Paste().
Replace the test of the form "(!a && b) || (a && b)" with a simple test for
"b" and then also replace the test for "b || (c && !b)" with just "b || c".
The end result is much easier to read and understand.
Optimize alpha handling in wxImage::Rotate90() too.
The changes of r66309 optimized the rotation of the pixel data by doing it in
entire strips instead of pixel by pixel, apply the same technique now to the
rotation of alpha data as well.
Fix assert when destroying wxDataViewCtrl being edited in wxGTK.
If wxDataViewCtrl was destroyed while showing a generic editor, an assert
occurred in wxWindowBase dtor as the event handler pushed on it by the editor.
Fix this by calling CancelEditing() when the control is destroyed and also fix
the crash in CancelEditing() in wxGTK due to recursive calls to FinishEditing().
No changes, just get rid of wxDataViewColumn::GetConstGtkHandle().
If both const and non-const accessors are needed, it's custom to use the same
name for both but in this case we don't even need them as the const version
can always be used, so simply remove the weird and badly named (because the
returned handle is not const at all) GetConstGtkHandle().