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().
Robin Dunn [Tue, 26 Apr 2011 17:39:53 +0000 (17:39 +0000)]
Remove lipo options, that hack is no longer needed since we are not supporting OSX 10.3 any more. Also some work to get framework builds working properly.
Fixed filename in wxOSX-Cocoa's file dialog using extension of wrong file type.
When using SetFilterIndex to indicate a different initial file type the dialog would still use the extension of the first file type (if the filename had no extension then unchecking "Hide extension" would append the first file type's extension). Fixed this by calling code, that formerly got called only from OnFilterSelected, to notify OS X of the file type change.
Václav Slavík [Sun, 24 Apr 2011 13:14:47 +0000 (13:14 +0000)]
Don't rely on RVO in wxON_BLOCK_EXIT_SET().
MakeVarSetter() relies on the compiler always using RVO, as
VariableSetterImpl<> doesn't have correct copy ctor; worse yet, its use
wasn't detected at compile time. With some compilers (e.g. VC++ 2008
with non-trivial variable types), this resulted in the variable being
reset too soon, immediately in the place where the macro was used.
Fixed by using the same technique already used in wxScopeGuardImpl. In
fact, VariableSetterImpl is just another special case of
wxScopeGuardImpl, so just derive from the latter.
Don't generate wxEVT_COMMAND_DATAVIEW_CACHE_HINT for empty control.
Don't send any cache hint events for empty wxDataViewCtrl. Sending them was
unnecessary, inconsistent with wxListCtrl (which doesn't send them when it's
empty) and the events also had incorrect range. Just don't create them at all
to avoid all these problems at once.
Change wxNotebook selection before sending page changed event in wxMSW.
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED handler should see the new page selected
in the control, not the old one as was the case if the page was changed using
the mouse in wxMSW.
This should have been done together with the other changes of r66224, see its
commit message for more details.
Add wxDC::SetTransformMatrix() and related methods and implement them in wxMSW.
Add support for world transformations to wxDC too. Currently this is
implemented in wxMSW only but could be easily provided in the ports that use
wxGraphicsContext for wxDC implementation later.
Add a simple unit test for wxParseCommonDialogsFilter().
Verify that this function (which is used for parsing the wildcard strings used
with file-related dialogs) works as expected and also asserts when given
invalid input.
The valid pages range was set too early before, we need to postpone it until
after the OnPreparePrinting() call of the user-defined wxPrintout object as
only it can determine the number of pages (after running the pagination
algorithm) in general.
Set the pages range during the first call to RenderPageIntoDC() to fix this.
Also add wxPrintPageMaxCtrl class for symmetry with the existing
wxPrintPageTextCtrl and use a shared constant MAX_PAGE_NUMBER instead of hard
coded 99999. Slightly improve the layout of wxPrintPageMaxCtrl too.
Václav Slavík [Fri, 22 Apr 2011 18:25:32 +0000 (18:25 +0000)]
Return wxWindow* from wxDataViewCustomRenderer::CreateEditorCtrl().
There's no reason to limit custom editor controls to wxControl, which
would rule out e.g. composite controls or any custom widgets.
Make appropriate changes to related functions and code too.
With at least MSVC9 numformatter.cpp wouldn't compile because of unknown identifiers related to locales. Include <locale.h> in case wxUSE_STD_STRING is set to 0.
Use "wx" prefix for the GUIDs we (re)define in wxMSW code.
CLSID_AutoComplete became ambiguous with MinGW because it does define it in
its shlguid.h header (although MSVC/Platform SDK does not define this one) so
use a "wx" prefix for it to avoid ambiguity. Also use the same prefix for the
IID_IAutoCompleteDropDown value we define for consistency.
Redefine IAutoCompleteDropDown in our code as it's not always available.
MinGW doesn't have shobjidl.h header file which is normally part of the
Platform SDK and doesn't have IAutoCompleteDropDown interface definition in
any of its headers at all, so define this interface and its IID ourselves to
make the code compile with it.
Notice that MinGW-64 does have the interface declaration but still doesn't
define IID_IAutoCompleteDropDown.
So to be on the safe side just always define everything ourselves, as long as
we need to do it for one of the compilers, it's not more difficult to do it
for all of them.
Make use of SetFilterIndex in wxOSX-Cocoa's file dialog.
Previously the file type would solely be based on the extension of the passed filename. This is still done, but any valid filter index as set by the user will now take precedence.
Fixed saving dialog's filter index always being -1 with wxOSX-Cocoa.
This problem was reproducable using the Save file dialog in the dialogs sample.
The member m_filterIndex was only initialised to -1 and never set at another point. Set it to the filter's selection during ModalFinishedCallback.
Failing to send wxEVT_UPDATE_UI to hidden windows made it impossible to show
them from their update UI handler which was totally unexpected as the
documented wxUpdateUIEvent::Show() method could never be used.
Do send these events to the hidden windows themselves but avoid sending the
update UI events to the children of hidden windows as this is really useless
because any change of their state wouldn't be seen by the user anyhow (even if
the child is shown, it would still remain hidden until its parent is) and
would just waste time processing a lot of needless events.
Don't send wxWindowDestroyEvent if we hadn't sent wxWindowCreateEvent.
Don't generate wxWindowDestroyEvent when destroying the windows that had been
never created for symmetry with wxWindowCreateEvent which wasn't sent for this
window neither.
Don't assert when destroying a never created window in wxGTK.
The other ports don't assert if a default-constructed wxWindow object for
which Create() had never been called is Destroy()d and wxGTK shouldn't do this
neither.
The new behaviour is more logical but also fixes a problem with an assert in
wxOwnerDrawnComboBox that can currently be seen in wxGTK unit tests.
Jaakko Salli [Mon, 18 Apr 2011 10:06:08 +0000 (10:06 +0000)]
Use Connect() to bind embedded wxTextCtrl events instead of event table. This seems to be more reliable approach here, and fixes a bug with wxPropertyGrid's wxEditEnumProperty.
Implement auto-completion support for wxTextEntry in wxOSX/Cocoa.
Both completing a set of fixed strings and dynamic completion using a custom
completer are supported, although completing the file names remains MSW-only
for now.
Note that, unlike under MSW, auto-completion under Mac is not automatic and
has to be triggered manually by calling complete: method. This is done by
pressing F5 key by default. In the future we should call it automatically on a
timer event to make it more obviously discoverable.
Refactor: extract wxTextCompleterFixed from wxMSW to a header.
This class will be used in other ports too so don't make it private to wxMSW
(although it still remains private to wxWidgets for now as it doesn't make
much sense to use it in user code).
Removed invalid use of sizeFlags parameter for SetSize call in generic calendar control.
In r39715 the height parameter of a call to SetSize was changed to -1, however the previous coordinate value remained and became the fifth parameter which represents bit flags. Simply removed the fifth parameter.
Split wxTextCompleter into a base class and wxTextCompleterSimple.
Allow overriding either the iterator-like methods of the base class or the
single and possibly more convenient, albeit slightly less efficient, method of
the derived wxTextCompleterSimple class.
This makes it possible to completely delegate to wxTextCompleter from wxMSW
IEnumString implementation and actually makes the code there easier, even if
it it still not quite trivial because of multi-threading concerns.
It also would make it possible to show the completions progressively, as they
are retrieved, in a future generic implementation of auto-completion (MSW
native implementation doesn't do this unfortunately and waits until all of the
completions become available before showing them).
Don't block the main UI thread while generating completions in wxMSW.
The native IAutoComplete implementation takes care to retrieve the completions
from a background thread to prevent the UI from freezing while they're being
generated, but we worked against it by always generating all the completions
from the main thread and just enumerating them from the background one.
Change this now and call wxTextCompleter::GetCompletions() method from the
background thread itself to never block the main one.
Use ACO_AUTOAPPEND option for text completion in wxMSW.
This option appends the first candidate completion value to the text control
itself making it more user-friendly as it reduces the amount of typing needed
to enter it.
Added private wxEVT_AFTER_CHAR event for wxMSW implementation needs.
This event is sent by wxMSW after the default handling of WM_CHAR has taken
place. It can be used to define an event handler triggered by key presses and
having access to the new value of the control, updated to take the last key
press into account.
This event will be used by auto-completion implementation for wxMSW only for
now.
Add support for dynamic auto-completion in wxTextEntry.
Add wxTextCompleter class which allows to return the possible completions
dynamically and wxTextCompleter::AutoComplete() overload using it. So far this
is only implemented for wxMSW.
Also fix calling wxTextEntry::AutoComplete(wxArrayString) multiple times under
MSW, this didn't correctly update the list of shown completions before.
No changes, just simplify preprocessor checks in wxMSW wxTextEntry.
Separate !HAS_AUTOCOMPLETE stub versions from the real one as the code was
too difficult to read otherwise and would become even more so after the
addition of the upcoming custom auto-completer support.
Refactor wxTextEntry::AutoComplete() to simply call DoAutoCompleteXXX().
No real changes, just make the public AutoComplete() non-virtual and add
virtual DoAutoCompleteXXX() methods to make it easier to add new public
AutoComplete() overloads in the upcoming commits.
Jaakko Salli [Fri, 15 Apr 2011 09:23:23 +0000 (09:23 +0000)]
Removed wxPG_DOUBLE_BUFFER constant. Now all wxPG rendering is done double-buffered, regardless of the platform. Code path with wxPG_DOUBLE_BUFFER = 0 did not render correctly (fixes #13140). In future should probably use wxAutoBufferedPaintDC or something similar, but this will require non-trivial code changes and testing.
Jaakko Salli [Wed, 13 Apr 2011 16:39:06 +0000 (16:39 +0000)]
wxEVT_COMMAND_TEXT_UPDATED events from wxComboCtrl's embedded wxTextCtrl kept confusing wxPropertyGrid::HandleCustomEditorEvent(). We need to ignore them.
Re-define push_back() in wxSortedArrayString to behave correctly.
Adding items to wxSortedArrayString should always keep them sorted but while
Add() did this, push_back() didn't breaking the class invariant.
Redefine push_back() in _WX_DEFINE_SORTED_TYPEARRAY_2 macro to fix this and
add a unit test checking that wxSortedArrayString::push_back() does work now.
Add wxAuiTabArt::SetColour() and SetActiveColour() methods and provide trivial
default implementation of them in wxAuiDefaultTabArt to allow customizing the
tab colours.
Fix vararg function in wxXml unit test broken by recent changes.
The changes in r67345 changed CheckXml() vararg function to take a reference
as the first argument but this doesn't work with va_start(), so revert to
using a pointer here.
This fixes the current unit test failures in the XML tests.
Correctly restore the old locale in wxXLocale functions.
In non-wxHAS_XLOCALE_SUPPORT case we didn't restore the original locale
correctly in wxStrtoxxx_l() functions as the return value of wxSetlocale() was
incorrectly assumed to be the old locale instead of the new one.
Fix this and also replace the macros used by the old code with a small helper
class, this simplifies the code and is less ugly.
Finally add a unit test which failed before these changes when the program ran
in any non-C locale but passes now.
Fix incorrect use of setlocale() in wxLocale::IsAvailable().
The return value of setlocale() was used incorrectly in this code: it
represents the newly set locale and not the previously active one so we didn't
actually restore the original locale before.
Fix the code and check that we do actually restore the locale in a new unit
test for it.
Fix VarArgTestCase compilation when type traits are unavailable.
When type traits are unavailable we can't check whether a type can be passed
to a vararg function but we still need to pass a copyable object to
wxString::Format() for the code to compile, even if we just want to check that
it will fail with the assert at run-time.