moved non-interactive tests for wxDynamicLibrary, wxGet/SetEnv, wxTempFile, wxCopyFile to appropriate CppUnit test suites;
removed wxFile and wxTextFile tests (complete testsuites already exist for them)
Vadim Zeitlin [Sat, 12 Jun 2010 21:26:41 +0000 (21:26 +0000)]
Fix scrolling to the bottom in wxTextCtrl::AppendText().
The old code used EM_LINESCROLL which could scroll too far if the caret wasn't
in the first line of the control. Instead of trying to compute the correct
number of the lines to scroll, just use WM_VSCROLL with SB_BOTTOM parameter
instead.
Vadim Zeitlin [Sat, 12 Jun 2010 18:21:42 +0000 (18:21 +0000)]
Fix processing of events for MRU entries #10 and more in docview.
We only handled events for wxID_FILE1..wxID_FILE9 range but there can be more
than 9 entries in the MRU list. Handle events for as many of them as there are
correctly.
This required adding a fallback handler for all menu events and checking if
the id of the menu item is in the MRU range inside it. Also move this to
wxDocManager itself from wxDocParentFrameAnyBase as it's common for all kinds
of frames anyhow.
Vadim Zeitlin [Sat, 12 Jun 2010 11:28:20 +0000 (11:28 +0000)]
Stop the timer in console IPC client sample once we don't need it any more.
Under MSW the timer appeared to be flooding the message queue with timer
events faster than we could process them (which seems incredible for the timer
interval of 1 second but still seems to happen), so the idle events were never
generated and the sample didn't work at all.
Now stop the timer once we get a last notification from it to let the program
become idle and run the test function scheduled from the timer handler.
Vadim Zeitlin [Sat, 12 Jun 2010 11:28:15 +0000 (11:28 +0000)]
Avoid sending spurious socket read notifications in wxMSW.
If a read notification is generated for a socket, it should be possible to
read something from it without blocking but this doesn't seem to be always the
case under MSW for some reason. And this results in all sorts of problems in
wxSocket and wxIPC code, so check for this at wxSocketImpl level and not send
the notification at all if there is no data to read.
Jaakko Salli [Sat, 12 Jun 2010 09:30:57 +0000 (09:30 +0000)]
Added wxPropertyGrid::DedicateKey(), which prevents specific key presses from being eaten by editor controls. This is useful for customizing keyboard navigation. Also added utility function wxPGFindInVector<>(), which is used in the new code, and also in some other places.
Robert Roebling [Thu, 10 Jun 2010 11:47:18 +0000 (11:47 +0000)]
Make wxDataViewCtrl::GetColumnPosition() return the index under MSW as per GTK and the docs (fixes #12129), give immediate visual feedback after calling e.g. wxDataViewColumn::SetHidden(true) under MSW, also per GTK+ and as I'd expect. Make GTK+ control emit header click events also for non-reorderable columns. Add a few tests for wxDataViewColumn::SetHidden() and wxDataViewCtrl::GetColumnPosition()
Implement wx-prefixed macros versions of DECLARE_EVENT_TABLE, BEGIN_EVENT_TABLE* and END_EVENT_TABLE macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Implement wx-prefixed macros versions of DECLARE/IMPLEMENT*CLASS macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Correct a recurring error in the docs: IMPLEMENT/DECLARE_CLASS are alias to the DYNAMIC macros, not to the ABSTRACT macros.
Implement wx-prefixed macros versions of DECLARE/IMPLEMENT_APP_* macros.
Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.
Vadim Zeitlin [Wed, 9 Jun 2010 11:13:20 +0000 (11:13 +0000)]
Don't use -kAddToPopUp() gettext hack with Scintilla.
Instead, create a dummy file containing the user-visible strings defined in
Scintilla sources. For now it's manually managed but it might make sense to
automatically generate it in the future.
Move a couple of wxFileName tests from the console sample to the existing FileNameTestCase.
Fix FileNameTestCase::TestGetHumanReadable to check the result against expected strings using the correct decimal point for the locale used on the test machine.
remove some tests from the console sample:
- wxLog already has a better cppunit test class
- wxLocale test in the console sample didn't work on Windows and wasn't very useful
move some tests from the console sample to CppUnit tests:
- wxPathList => PathListTestCase
- wxModule => ModuleTestCase
remove some tests about removed functions of wxMimeTypesManager
Vadim Zeitlin [Sun, 6 Jun 2010 12:41:51 +0000 (12:41 +0000)]
Don't post process events twice but return correct value from ProcessEvent().
This is a further complication to the event handling code which aims to handle
correctly the case of wxScrollHelperEvtHandler which doesn't respect the
request to process events only in it but always passes it to the next handler
in the chain itself while still returning the correct value from
ProcessEvent() itself to avoid breaking code that relies on it, like the
background painting code in wxHtmlWindow.
This replaces the change of r64495 and does return true from DoTryChain() in
wxScrollHelperEvtHandler case but sets the "skipped" flag in the event itself
to indicate that it wasn't really processed and ProcessEvent() now checks it
after calling ProcessEventLocally() and returns the correct value
appropriately.
Jaakko Salli [Sun, 6 Jun 2010 09:35:06 +0000 (09:35 +0000)]
In wxComboCtrlBase::DoShowPopup(), if the popup window is a generic TLW or a 'perfect' wxPopupWindow, then try to set focus to the popup control at the end of show
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:13 +0000 (22:58 +0000)]
Don't send selection events for an already selected item in wxMSW wxListBox.
Remember the last item for which a listbox notification event had been sent
and don't send it again if the user clicks on an already selected item. This
is consistent with wxGTK behaviour and generally makes more sense: why should
we send an event if the selection didn't really change?
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:09 +0000 (22:58 +0000)]
Don't send listbox selection events when mouse wasn't clicked on an item.
Windows sends events even if the mouse is clicked in the area below the items,
filter them out by checking the item under the mouse ourselves.
Also use synchronous GetMessagePos() function to get the mouse position
instead of the asynchronous GetCursorPos() which was wrongly used by the old
code.
Vadim Zeitlin [Sat, 5 Jun 2010 22:58:05 +0000 (22:58 +0000)]
Use mouse position to find the item for selection events in wxMSW listbox.
Using LB_GETCARETINDEX doesn't work when the mouse is used to make selection
because it always returns the index of the last item, even if the mouse is
clicked below it, on an area without any listbox items. So use the mouse
position to find the item in this case but still use LB_GETCARETINDEX to find
the item when the keyboard is used.
This required adding a flag to wxListBox storing the kind of the last input
message that it received as there doesn't seem to be any way to determine how
the message was generated otherwise.
This code will be refactored/improved further in the next two commits.
Vadim Zeitlin [Sat, 5 Jun 2010 22:57:53 +0000 (22:57 +0000)]
Refactor listbox event sending code to avoid duplication.
wxMSW wxListBox implementation contained the same code as the private
LBSendEvent() function in lboxcmn.cpp, so make this function a (protected)
member of wxListBoxBase and reuse it instead.
Also change its and CalcAndSendEvent() return type to bool to be able to
return whether the event was processed or not.
As the result of this refactoring, the "is selected" flag is now set correctly
for the selection events under MSW (it was always off before).
Vadim Zeitlin [Sat, 5 Jun 2010 22:57:48 +0000 (22:57 +0000)]
Don't return true from DoTryChain() if the event wasn't really processed.
Correct the return value when an event handler didn't honour "process only in
this handler" flag: we shouldn't pass the event to the further handlers in
this case but we shouldn't return true neither as the event wasn't really
processed.
This corrects background painting of wxHtmlWindow broken by previous changes.
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:53 +0000 (10:35 +0000)]
Drop the column being dragged at the correct position in wxGrid.
The column was being always dropped after the column at drop position but this
was incorrect and didn't correspond to the visual feedback drawn by
wxHeaderCtrl: if the drop position is over the "near" part of the column, the
column should be dropped before it instead.
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:49 +0000 (10:35 +0000)]
Test for wxPen validity before testing for its style in wxGTK wxDC.
Calling wxPen::GetStyle() on an invalid pen resulted in an assert, breaking
the grid column drawing while reordering them, for example, because the code
in wxGrid uses wxDC::DrawRectangle() after calling SetPen(wxNullPen).
Vadim Zeitlin [Thu, 3 Jun 2010 10:35:41 +0000 (10:35 +0000)]
Assert if an invalid column index is specified when inserting wxListCtrl item.
This also catches the case of inserting an item in a report mode wxListCtrl
without adding any columns to it first. Previously this did result in an
assert but with a less clear error message and, most importantly, still a
crash afterwards. Assert only now, don't crash.
The message could still be improved but hopefully people will be able to
understand that inserting items when no columns are defined is not the right
thing to do.
Move some wxPrintf() tests (taken from glibc) to VsnprintfTestCase. Other tests are more difficult to convert in CppUnit style and not worth the effort (since now we don't use wx's own vsnprintf implementation anymore typically).
Move wxRegConfig tests from console sample to a new wxRegConfigTestCase class.
Remove wxRegKey tests from console sample: on newer Windows they only work when run with admin privileges; also we can expect wx[Reg]ConfigTestCase to already check a good number of wxRegKey features.
Vadim Zeitlin [Wed, 2 Jun 2010 11:58:31 +0000 (11:58 +0000)]
Fix recently broken forwarding of events between event handlers.
After the recent changes to the event processing logic, forwarding an event
from one event handler to another one stopped working correctly because the
per-event "process here only" flag prevented it from following the event
handler chain after forwarding. This notably broke keyboard navigation in
wxComboCtrl under MSW in wx itself and probably quite a few of other things in
user code.
Fix this by replacing the boolean flag with a pointer to the handler to which
the processing of this event should be restricted. This allows the full
processing to still take place if an event is forwarded to another handler.
So wxEvent::ShouldProcessHereOnly() is now called ShouldProcessOnlyIn() and
takes a wxEvtHandler parameter.
This made appear a problem in wxScrollHelperEvtHandler code that was hidden by
the bug above: the events were still processed multiple times in it. To fix
this, also add wxEvent::DidntHonourProcessOnlyIn() and take it into account in
the base class code. Did I mention that wxScrollHelperEvtHandler must die?
Add another unit test checking that forwarding works correctly.
Vadim Zeitlin [Wed, 2 Jun 2010 11:58:21 +0000 (11:58 +0000)]
Don't hard code position of the drawing sample window and increase its size.
Hardcoding position to 50,50 is inconvenient, let the window manager position
the window as configured by user. Also, the vertical size of the sample was
too small to see the contents of most pages, increase it.
disable FTPTestCase by default.
Add a warning for the user when running --list without arguments: not all tests are listed, only those enabled by default (e.g. FTPTestCase doesn't appear there)!
Jaakko Salli [Tue, 1 Jun 2010 15:01:59 +0000 (15:01 +0000)]
In wxComboPopupEvtHandler::OnMouseEvent(), when need to relay event to drop-down button, call HandleButtonMouseEvent() directly, if possible. This is less confusing for the platform-specific wxComboCtrl implementations, and fixes issue where the drop-down button could remain in pressed state after the mouse button was lifted.
Jaakko Salli [Tue, 1 Jun 2010 13:46:14 +0000 (13:46 +0000)]
Refactored wxComboPopupExtraEventHandler::OnMouseEvent(). Now block mouse events from the popup control until mouse button has been seen in 'up' state (ignoring first mouse up). This matches Windows native combo box behavior (fixes #12115).
Vadim Zeitlin [Mon, 31 May 2010 11:55:53 +0000 (11:55 +0000)]
Use C locale for numbers in wx(File)Config.
Using the current locale decimal point in config files results in problems
when moving the files to another machine or even using a different locale on
the same one, so don't do it.
Always write the numbers using C locale and try to read them in C locale too
first, but also try the current locale if we failed for backwards
compatibility and to be tolerant with users who edit their config files by
hand.
Vadim Zeitlin [Mon, 31 May 2010 11:55:48 +0000 (11:55 +0000)]
Add wxString::FromDouble() and FromCDouble().
wxString::FromCDouble() is needed inside wxWidgets itself to format numbers
independently of the current locale. FromDouble() was added for symmetry with
ToDouble/ToCDouble() functions.
Use std::locale for the implementation if available and manual wxLocale-based
fallback otherwise.
Vadim Zeitlin [Mon, 31 May 2010 11:55:41 +0000 (11:55 +0000)]
Make wxString::ToCXXX() methods always available.
We use these methods inside wxWidgets itself and so want to always have them,
even when wxUSE_XLOCALE==0. Provide replacement manual implementations for
this case.
Vadim Zeitlin [Mon, 31 May 2010 11:55:37 +0000 (11:55 +0000)]
No real changes, just avoid an unnecessary heap allocation in a test.
We don't need to allocate the locale object in StringTestCase::ToDouble() on
the heap (and then delete it -- or not, if an assertion fails before the
function end), it's enough and simpler to just create it as a local variable.
Vadim Zeitlin [Sun, 30 May 2010 23:28:59 +0000 (23:28 +0000)]
Fix wxFont::IsFixedWidth() under MSW to always return correct result.
This function worked erratically, returning the correct result or not
depending on the way it was created. Reimplement it using GetTextMetrics() to
get the correct result in any case.
implement * and / operators for wxPoint, not only wxSize.
Add to their documentation a note about the fact that the real operators are not class members but rather global functions.
Vadim Zeitlin [Sun, 30 May 2010 20:05:56 +0000 (20:05 +0000)]
No changes, just rebaked and reran autoconf.
It seems that autoconf_inc.m4 hadn't been regenerated by a previous change as
rerunning bakefile_gen resulted in a lot of changes in it, do it now without
any other changes to ensure that the next commit only contains the changes due
to its modification of files.bkl.
Václav Slavík [Sun, 30 May 2010 12:21:49 +0000 (12:21 +0000)]
Fix Shift+TAB navigation from wxNotebook.
When the focus was on a tab label, Shift+TAB didn't move it out of the
notebook to the preceding control, as it should. Instead, focus moved to
the last control in the current notebook page.
This change fixes it, TAB and Shift-TAB cycling through controls now
behaves identically modulo direction.
Paul Cornett [Sun, 30 May 2010 06:38:28 +0000 (06:38 +0000)]
Remove pizza backing window.
When it is present, no-window widgets sometimes don't get expose events for
reasons I could not determine. And it is dubious that it improved scrolling
performance on modern hardware anyway, and almost certainly doesn't help now
that GTK+ is using "client side windows".