Vadim Zeitlin [Tue, 10 Nov 2009 00:13:57 +0000 (00:13 +0000)]
Fix discrepancy between different ways of measuring text extents under Mac.
wxGraphicsContext::GetTextExtent() didn't round the returned double result to
int but truncated it instead and so returned different extent than
GetPartialTextExtents() which did round it up.
Moreover, wxGraphicsContext::GetPartialTextExtents() didn't round it up
correctly: it wrongly added 0.5 to the value still stored as double and which
was hence rounded up (correctly, this time) when converted to int in
wxDC::GetPartialTextExtents().
These two errors combined to produce difference of up to 2 pixels between the
last offset returned by wxDC::GetPartialTextExtents() and the total string
extent returned by wxDC::GetTextExtent() which thoroughly confused the code in
wxControlBase::DoEllipsizeSingleLine() (and probably not only there).
Vadim Zeitlin [Mon, 9 Nov 2009 18:20:05 +0000 (18:20 +0000)]
Fix unit test added in r62561 to work under Windows too.
The unit test checking that slashes were allowed in UNCs too didn't work under
Windows because GetPath() returned volume as part of the path there (and also
used backslashes by default), fix it.
Vadim Zeitlin [Mon, 9 Nov 2009 01:57:47 +0000 (01:57 +0000)]
Fix fatal bug when changing wxDataViewCtrl model in wxGTK.
wxDataViewCtrl::AssociateModel() wrongly delete m_notifier itself if the
control already had a model even though the notifier was registered using
AddNotifier() which also scheduled it for deletion when the old model itself
was destroyed. This resulted in double deletion and reproducible crash
whenever the model was changed.
Vadim Zeitlin [Fri, 6 Nov 2009 20:47:52 +0000 (20:47 +0000)]
Change interpretation of font height in wxMSW to mean character height.
Accept both positive and negative height values in wxFont::SetPixelSize() in
wxMSW and map them both to a negative height when passing to MSW API in order
to request mapping against the character height and not the total cell height.
For positive heights this is more consistent with the other ports and also
expectations of people using this function. We keep the possibility to use
the negative heights inly for compatibility with the existing code which
worked around the (incorrect) interpretation of the positive height as cell
heights in the previous wxMSW versions by passing a negative height
explicitly.
Vadim Zeitlin [Fri, 6 Nov 2009 20:47:44 +0000 (20:47 +0000)]
Prefer to use standard selection colour in wxDataViewCustomRenderer.
We currently don't allow customizing the background colour of the selected
items which is always the system standard colour and so we should also use the
system standard selection foreground colour as a combination of a custom
foreground and standard background may be completely unreadable.
Notice that it is still possible to use custom colour if really needed from a
custom renderer by removing wxDATAVIEW_CELL_SELECTED from the flags before
calling the base class version of RenderText().
Vadim Zeitlin [Thu, 5 Nov 2009 14:59:55 +0000 (14:59 +0000)]
Change wxLongLongFmtSpec to be a non-wide string.
As with other ANSI/Unicode unification changes, we choose to preserve
compatibility with the existing code using wxLongLongFmtSpec in ANSI build
and require people using it in Unicode build to change their code.
Vadim Zeitlin [Wed, 4 Nov 2009 16:15:52 +0000 (16:15 +0000)]
Revert "trivial" change of r61772.
The "slight code simplification" of r61772 broke the code as it could now
crash if dangling m_Cell pointer was used during parsing. Revert it and add a
comment explaining why the code is written in the way it is.
Vadim Zeitlin [Tue, 3 Nov 2009 14:12:14 +0000 (14:12 +0000)]
Document wxDocument::SetDocumentSaved().
While this function is usually called by wx itself it may be useful to call it
explicitly in some particular situations, as documented in the function
description, so make it officially public.
Vadim Zeitlin [Sat, 31 Oct 2009 15:57:58 +0000 (15:57 +0000)]
No real changes, just fix a typo in wxDataViewModel::Compare().
Return -1 from the comparison function instead of -11 when comparing
wxDateTime values. It shouldn't matter which value is returned as long as it's
negative but it is definitely tidier.
Vadim Zeitlin [Sat, 31 Oct 2009 15:57:51 +0000 (15:57 +0000)]
Return the real column width from wxOSX wxDataViewColumn::GetWidth().
Code used to return the last programmatically set width value instead of the
real column width which could have been changed by user if the column was
resizeable, fix this by returning the current NSTableColumn:width value.
Kevin Ollivier [Fri, 30 Oct 2009 05:04:47 +0000 (05:04 +0000)]
Initial ShowWithoutActivating implementations for Mac and Windows, and attempt to improve IsActive behavior on Mac. Also adding ShowWithoutActivating() and Show/Hide tests, but until the mainloop issues are resolved, not adding them to tests.bkl.
Vadim Zeitlin [Sat, 24 Oct 2009 21:42:04 +0000 (21:42 +0000)]
Make wxDataViewModel::GetAttr() and GetAttrByRow() const.
This is an incompatible change but having to use a non-const model pointer to
call a clearly logically const version was simply too ugly so change it while
we still can.
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:54 +0000 (21:41 +0000)]
Add wxDataViewListModel base class for list models.
Introduce a base class for wxDataViewIndexListModel and
wxDataViewVirtualListModel instead of duplicating the same code in both of
them making the code difficult to maintain and change.
For now this class is not documented as it is used just to avoid duplication
in the implementation but maybe we should make it public to allow defining
other flat list data models (if this can be made to work in Carbon version).
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:44 +0000 (21:41 +0000)]
Create model and column in wxDataViewTreeCtrl::Create(), not ctor.
Old code created the tree model and its unique built-in column only in
wxDataViewTreeCtrl ctor but not in Create(), meaning that the behaviour was
very different depending on whether you used base class ctor call or Create()
in a derived class. This was confusing and completely inconsistent with wx API
in which using the default ctor and Create() is supposed to always have
exactly the same effect as using non-default ctor so change this to create the
model in Create() so that it's always done.
Slightly update the documentation and also add wxDataViewTreeCtrl::Init() for
consistency.
Vadim Zeitlin [Sat, 24 Oct 2009 21:41:30 +0000 (21:41 +0000)]
No real changes, just make wxDataViewCtrl::Init() private in wxGTK.
The usual convention is for Init() method to be private and to call it from
constructor, follow it in GTK implementation of wxDataViewCtrl too instead of
making it public and calling it from Create().
Vadim Zeitlin [Sat, 24 Oct 2009 01:03:36 +0000 (01:03 +0000)]
Don't show anything in the cells which should be empty in Cocoa wxDVC.
Implement a custom NSTableColumn-derived class to return nil for the cells
which shouldn't show anything at all because they are part of a container row.
This finally fixes the totally wrong display of the first page of the dataview
sample under OS X.
Vadim Zeitlin [Sat, 24 Oct 2009 01:03:24 +0000 (01:03 +0000)]
Add wxDataViewModel::HasValue().
This method allows to simply test whether we have a value at the given row and
column or not (as it happens for container items unless they too have columns).
Currently this method is not virtual and is not used by the implementations
yet but it might make sense to make it virtual and allow overriding it in the
future.
Vadim Zeitlin [Fri, 23 Oct 2009 23:49:26 +0000 (23:49 +0000)]
Use virtual functions to convert NSObject to the correct type in wxDVC.
Instead of trying to determine the type of the value which should be extracted
from the NSObject we receive from NSOutlineView, just pass it to a virtual
method in the renderer which knows which type does it need.
This fixes the problem with editing boolean/checkbox columns and makes the
code more elegant.
Vadim Zeitlin [Fri, 23 Oct 2009 23:49:16 +0000 (23:49 +0000)]
Add wxDataViewModel::ChangeValue() and use it in wxDVC implementation.
ChangeValue() is a trivial wrapper calling both SetValue() and ValueChanged().
It allows to replace many calls to SetValue() immediately followed by
ValueChanged() with a single function call which is significantly shorter and
less error-prone (e.g. most of the existing code didn't test SetValue() return
code at all).
Vadim Zeitlin [Fri, 23 Oct 2009 17:48:21 +0000 (17:48 +0000)]
Rebaked using post-0.2.7 svn version of bakefile.
Unfortunately 0.2.7 release contained a bug in msvc backend which resulted in
warnings generated for each file compiled. Apply the fix from bakefile svn to
fix this (and test if no other problems are found).
Also update all makefile.unx after changes of r62477.
Vadim Zeitlin [Thu, 22 Oct 2009 23:54:55 +0000 (23:54 +0000)]
Give more informative error in wxFSW test.
Output more details when more than one event is unexpectedly received.
Hopefully this will allow to debug the test failure at build bot slaves which
doesn't seem to be happening locally.
Vadim Zeitlin [Thu, 22 Oct 2009 11:36:35 +0000 (11:36 +0000)]
Refactor wxEventLoopSource-related code.
Currently wxEventLoopSource can't be created directly and can only be used to
monitor file descriptors so reduce the API to just wxEventLoop::AddSourceForFD()
and remove AddSource(), RemoveSource() and RemoveAllSources() which couldn't
be implemented for all ports. This makes the code much simpler without any
loss of functionality.
Make wxEventLoopSource responsible for removing itself from the event loop
when it is deleted. This allows to remove IsOk() and Invalidate() methods
making the code simpler and gets rid of various sets/maps which were used
before.
This also allows to support event loop sources in Carbon as well: wxOSX/Carbon
now compiles and works with wxUSE_FSWATCHER==1.
Vadim Zeitlin [Thu, 22 Oct 2009 11:18:02 +0000 (11:18 +0000)]
Fix UseUintMax definition used by wxAny for VC6.
The old code tried to work around the lack of unsigned __int64 to double
conversion in VC6 by casting from UseUintMax to wxAnyBaseIntType but this was
wrong as this value was -1 when cast to wxAnyBaseIntType (__int64) and so
UseUintMaxF was defined as -1.0.
Use a slightly uglier but simpler work around now: just define the constants
as macros instead of (typed) variables and let the compiler deal with literal
values on its own (which it does correctly).
This fixes the unit test failure: conversion from double to unsigned always
failed when using VC6.
Vadim Zeitlin [Thu, 22 Oct 2009 09:40:42 +0000 (09:40 +0000)]
Remove unwanted solution files from the repository.
Remove VC9-only solution files from a couple of tests/utils/demos (there is
no reason at all to have only VC9 solutions: either we have all of [789] or
none of them) and also remove all solutions files for the ribbon sample which
were probably added mistakenly in the first place (as no other sample has
them).
Václav Slavík [Thu, 22 Oct 2009 06:43:52 +0000 (06:43 +0000)]
Post-0.2.6 version of Bakefile is required.
This is because of two recent changes: addition of the 'ribbon'
library (with filenames shared with other libs) and unconditional
enabling of debug info with VC++. Both of these uncovered bugs
in Bakefile's VC++ support that weren't fixed until after 0.2.6.
Vadim Zeitlin [Mon, 19 Oct 2009 13:57:41 +0000 (13:57 +0000)]
Don't include LDFLAGS in `wx-config --libs` output.
Use a separate WXCONFIG_LDFLAGS variable for the flags which should be used
when linking applications using wxWidgets and not wxWidgets itself.
The only intentional effect this change is supposed to have right now is that
-arch options added to LDFLAGS when building wx for multiple architectures
under OS X are not used for building the applications any more.
Vadim Zeitlin [Mon, 19 Oct 2009 08:59:33 +0000 (08:59 +0000)]
Define COMPILER_PREFIX as COMPILER if it's not defined.
Temporary fix after the changes of r62323 which broke generation of makefiles
using wx presets unless they explicitly defined COMPILER_PREFIX: define
COMPILER_PREFIX as COMPILER by default.
Vadim Zeitlin [Mon, 19 Oct 2009 08:59:25 +0000 (08:59 +0000)]
Document wxRendererNative::DrawTitleBarBitmap() and use it properly.
Comment and document the (non obvious) requirement for the PNG image handler
to be enabled when using this function under OS X. In fact, document the
entire function itself which was forgotten previously.
Do enable PNG image handler when using DrawTitleBarBitmap() in the sample.
Vadim Zeitlin [Sat, 17 Oct 2009 22:56:07 +0000 (22:56 +0000)]
Restore --debug wx-config option handling for pre-2.9 builds.
Although 2.9 and later doesn't have debug/release distinction, previous
version of wx may be installed on the system and should be usable via 2.9
wx-config so honour this option for them.
Vadim Zeitlin [Sat, 17 Oct 2009 16:13:37 +0000 (16:13 +0000)]
Update column order in MSW native wxHeaderCtrl after drag.
We must update the internally stored columns order even if the end reorder
event was processed (but not vetoed), otherwise we don't reflect the new order
in the our public functions such as GetColumnsOrder() which broke wxDVC
display under MSW.
Vadim Zeitlin [Sat, 17 Oct 2009 16:13:24 +0000 (16:13 +0000)]
Fix for windres flags used in Win64 mingw build.
We must explicitly define WX_CPU_AMD64 when compiling using mingw64 and
configure as wx/msw/genrcdefs.h is not used in this case and even if it were,
it wouldn't work because g++ doesn't define _M_AMD64 (unlike MSVC).
So just add the flag directly to windres command line in configure.
Vadim Zeitlin [Sat, 17 Oct 2009 01:04:26 +0000 (01:04 +0000)]
Rewrite handling cell value changes in wxOSX/Cocoa wxDVC.
Instead of using a chain of dynamic_cast<>s to find the right type of the
value, construct a wxVariant corresponding to the type of the object we
receive in NSOutlineView:setObjectValue:forTableColumn:byItem and pass it to a
wxDataViewRenderer virtual function.
This fixes assert and allows to edit icon text items under OS X.
Vadim Zeitlin [Sat, 17 Oct 2009 01:04:13 +0000 (01:04 +0000)]
Fix crash when editing wxDVC items in place in wxOSX/Cocoa.
NSOutlineView::editedColumn: and editedRow: return -1 when they are called
from textDidEndEditing so we need to store their values in textDidBeginEditing
and reuse them later.
This fixes the crash in the sample with out-of-range array index exception
which happened whenever a cell was edited.
Vadim Zeitlin [Fri, 16 Oct 2009 21:35:26 +0000 (21:35 +0000)]
Add ellipsization support to wxDataViewCtrl.
Implemented ellipsization in the generic, GTK and both OS X Carbon and Cocoa
versions but it currently doesn't work well in GTK as it changes the item
alignment unconditionally, this will need to be fixed later.
The behaviour for the columns is currently inconsistent between ports too:
under MSW they (natively) use wxELLIPSIZE_END, under GTK -- wxELLIPSIZE_NONE
and under OS X the same ellipsization mode as the column contents, i.e.
wxELLIPSIZE_MIDDLE by default.
Vadim Zeitlin [Fri, 16 Oct 2009 21:32:51 +0000 (21:32 +0000)]
Rename wxEllipsizeFlags elements to avoid confusion with wxEllipsizeMode.
We shouldn't use the same "wxELLIPSIZE_" prefix for two different enums, so
use wxELLIPSIZE_FLAGS one for wxEllipsizeFlags (they should be used less often
than wxEllipsizeMode so it's better to keep the short prefix for the latter).
Vadim Zeitlin [Fri, 16 Oct 2009 16:25:43 +0000 (16:25 +0000)]
Improve wxCollapsiblePane appearance under OS X.
By default, don't use border in wxDisclosureTriangle because the native
applications do not. However do honour wxBORDER_XXX style if specified in case
this becomes useful in the future (this required no effort as the code was
already there for bitmap buttons and just had to be extracted into a reusable
function).
Don't expand the disclosure triangle in wxCollapsiblePane sizer, as this
resulted in the text being centered instead of remaining left-aligned.
Vadim Zeitlin [Fri, 16 Oct 2009 16:25:37 +0000 (16:25 +0000)]
Don't use sunken border for the list control in log dialog.
There doesn't seem to be any reason to use a heavy border here as there is
nothing much to separate the list control from. In particular this looks
rather horrible under OS X.
Vadim Zeitlin [Fri, 16 Oct 2009 14:35:21 +0000 (14:35 +0000)]
Make assert in wxMSW wxListCtrl::InsertItem() more informative.
Assert if inserting an item failed (this is really unexpected and must be a
programmer error) instead of asserting about items number mismatch -- which
might be true but only indirectly helpful.
Vadim Zeitlin [Fri, 16 Oct 2009 01:29:06 +0000 (01:29 +0000)]
Implement icon text column using native GTK renderers in wxDVC.
This has a possible advantage of a more native look and feel (although it's
hard to tell the difference between drawing the icon ourselves and how the
default GTK+ renderer does it to be honest) and a very real advantage of
allowing to edit in place cells with icons. It also reduces code duplication
in GTK implementation.
Modify the sample to make the icon-text column in the list model editable to
show that it works. This required storing the values of the second column as
well, so do it in its own array and to avoid calling it "m_array2", rename the
existing m_array to m_textColValues (which accounts for most of the diff in
the sample) and call the new one m_iconColValues.