Merge branch 'WX_3_0_BRANCH' into wxPy-3.0-branch

This commit is contained in:
Robin Dunn
2016-06-28 15:46:11 -07:00
12 changed files with 137 additions and 57 deletions

View File

@@ -44,7 +44,7 @@ SolidCompression=yes
[Files] [Files]
; source files ; source files
Source: "{#WXW_DIR}\*"; DestDir: "{app}"; Excludes: "cocoa,dfb,gtk,gtk1,motif,msdos,os2,osx,wxWindows.xcod*,x11,distrib"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#WXW_DIR}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[INI] [INI]
Filename: "{app}\wx.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://www.wxwidgets.org" Filename: "{app}\wx.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://www.wxwidgets.org"

View File

@@ -587,6 +587,7 @@ Unix:
- Fix wxIPaddress::Hostname() failing if /etc/hosts contained very long names. - Fix wxIPaddress::Hostname() failing if /etc/hosts contained very long names.
- Fix wxDateTime::ParseRfc822Date() for some TZ/DST combinations. - Fix wxDateTime::ParseRfc822Date() for some TZ/DST combinations.
- Fix bug in wxExecute() if child exited too quickly (Kevin B. McCarty).
All (GUI): All (GUI):
@@ -662,6 +663,7 @@ wxOSX:
- Fix custom paper support (tijsv). - Fix custom paper support (tijsv).
- Return false from wxSound::Create()/IsOk() if the file doesn't exist. - Return false from wxSound::Create()/IsOk() if the file doesn't exist.
- Fix scrolling behaviour of wxSearchCtrl (John Roberts). - Fix scrolling behaviour of wxSearchCtrl (John Roberts).
- Add wxTE_{RIGHT,CENTER} support for multiline wxTextCtrl (Andreas Falkenhahn).
3.0.2: (released 2014-10-06) 3.0.2: (released 2014-10-06)
@@ -713,6 +715,7 @@ wxMSW:
- Fix using Esc as accelerator in the menus. - Fix using Esc as accelerator in the menus.
- Fix wrong initial status bar height in some cases (Artur Wieczorek). - Fix wrong initial status bar height in some cases (Artur Wieczorek).
- Correct wxGetOsDescription() for Windows 10 (Tobias Taschner). - Correct wxGetOsDescription() for Windows 10 (Tobias Taschner).
- Fix appearance of checked disabled wxToolBar tools with custom images.
3.0.1: (released 2014-06-15) 3.0.1: (released 2014-06-15)

View File

@@ -62,7 +62,7 @@ private:
class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
{ {
public: public:
wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style );
virtual ~wxNSTextViewControl(); virtual ~wxNSTextViewControl();
virtual wxString GetStringValue() const ; virtual wxString GetStringValue() const ;

View File

@@ -122,20 +122,16 @@ wxChar wxNumberFormatter::GetDecimalSeparator()
{ {
const wxString const wxString
s = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER); s = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
if ( s.empty() ) if ( s.length() == 1 )
{
s_decimalSeparator = s[0];
}
else
{ {
// We really must have something for decimal separator, so fall // We really must have something for decimal separator, so fall
// back to the C locale default. // back to the C locale default.
s_decimalSeparator = '.'; s_decimalSeparator = '.';
} }
else
{
// To the best of my knowledge there are no locales like this.
wxASSERT_MSG( s.length() == 1,
"Multi-character decimal separator?" );
s_decimalSeparator = s[0];
}
} }
return s_decimalSeparator; return s_decimalSeparator;
@@ -154,11 +150,8 @@ bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
{ {
const wxString const wxString
s = wxLocale::GetInfo(wxLOCALE_THOUSANDS_SEP, wxLOCALE_CAT_NUMBER); s = wxLocale::GetInfo(wxLOCALE_THOUSANDS_SEP, wxLOCALE_CAT_NUMBER);
if ( !s.empty() ) if ( s.length() == 1 )
{ {
wxASSERT_MSG( s.length() == 1,
"Multi-character thousands separator?" );
s_thousandsSeparator = s[0]; s_thousandsSeparator = s[0];
} }
//else: Unlike above it's perfectly fine for the thousands separator to //else: Unlike above it's perfectly fine for the thousands separator to

View File

@@ -1719,7 +1719,7 @@ wxString wxTranslations::GetHeaderValue(const wxString& header,
if ( !trans || trans->empty() ) if ( !trans || trans->empty() )
return wxEmptyString; return wxEmptyString;
size_t found = trans->find(header); size_t found = trans->find(header + wxS(": "));
if ( found == wxString::npos ) if ( found == wxString::npos )
return wxEmptyString; return wxEmptyString;

View File

@@ -2441,7 +2441,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
evtCtx.SetEventObject(GetParent()); evtCtx.SetEventObject(GetParent());
GetParent()->GetEventHandler()->ProcessEvent(evtCtx); GetParent()->GetEventHandler()->ProcessEvent(evtCtx);
} }
else else if (event.LeftDown())
{ {
// reset the selection and bail out // reset the selection and bail out
HighlightAll(false); HighlightAll(false);

View File

@@ -159,7 +159,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
UINT uState = stat & wxOwnerDrawn::wxODSelected ? wxDSB_SELECTED : wxDSB_NORMAL; UINT uState = stat & wxOwnerDrawn::wxODSelected ? wxDSB_SELECTED : wxDSB_NORMAL;
// checkmarks should not be mirrored in RTL layout // checkmarks should not be mirrored in RTL layout
DWORD oldLayout = ::GetLayout(hdc); DWORD oldLayout = impl->GetLayoutDirection() == wxLayout_RightToLeft ? LAYOUT_RTL : 0;
if ( oldLayout & LAYOUT_RTL ) if ( oldLayout & LAYOUT_RTL )
::SetLayout(hdc, oldLayout | LAYOUT_BITMAPORIENTATIONPRESERVED); ::SetLayout(hdc, oldLayout | LAYOUT_BITMAPORIENTATIONPRESERVED);
wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState); wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState);

View File

@@ -321,6 +321,8 @@ bool wxGLCanvas::Create(wxWindow *parent,
glVersionMinor = 0; glVersionMinor = 0;
// Check for a core profile request // Check for a core profile request
if ( attribList )
{
for ( int i = 0; attribList[i]; ) for ( int i = 0; attribList[i]; )
{ {
switch ( attribList[i++] ) switch ( attribList[i++] )
@@ -342,6 +344,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
break; break;
} }
} }
}
if ( useGLCoreProfile ) if ( useGLCoreProfile )
{ {

View File

@@ -620,7 +620,15 @@ bool wxListCtrl::SetColumnWidth(int col, int width)
else if ( width == wxLIST_AUTOSIZE_USEHEADER) else if ( width == wxLIST_AUTOSIZE_USEHEADER)
width = LVSCW_AUTOSIZE_USEHEADER; width = LVSCW_AUTOSIZE_USEHEADER;
return ListView_SetColumnWidth(GetHwnd(), col, width) != 0; if ( !ListView_SetColumnWidth(GetHwnd(), col, width) )
return false;
// Failure to explicitly refresh the control with horizontal rules results
// in corrupted rules display.
if ( HasFlag(wxLC_HRULES) )
Refresh();
return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -296,6 +296,23 @@ static RECT wxGetTBItemRect(HWND hwnd, int index, int id = wxID_NONE)
return r; return r;
} }
static bool MSWShouldBeChecked(const wxToolBarToolBase *tool)
{
// Apparently, "checked" state image overrides the "disabled" image
// so we need to enforce our custom "disabled" image (if there is any)
// to be drawn for checked and disabled button tool.
// Note: We believe this erroneous overriding is fixed in MSW 8.
if ( wxGetWinVersion() <= wxWinVersion_7 &&
tool->GetKind() == wxITEM_CHECK &&
tool->GetDisabledBitmap().IsOk() &&
!tool->IsEnabled() )
{
return false;
}
return tool->IsToggled();
}
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -1011,7 +1028,7 @@ bool wxToolBar::Realize()
if ( tool->IsEnabled() ) if ( tool->IsEnabled() )
button.fsState |= TBSTATE_ENABLED; button.fsState |= TBSTATE_ENABLED;
if ( tool->IsToggled() ) if ( MSWShouldBeChecked(tool) )
button.fsState |= TBSTATE_CHECKED; button.fsState |= TBSTATE_CHECKED;
switch ( tool->GetKind() ) switch ( tool->GetKind() )
@@ -1415,7 +1432,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
state |= TBSTATE_ENABLED; state |= TBSTATE_ENABLED;
else else
state &= ~TBSTATE_ENABLED; state &= ~TBSTATE_ENABLED;
if (tool->IsToggled()) if ( MSWShouldBeChecked(tool) )
state |= TBSTATE_CHECKED; state |= TBSTATE_CHECKED;
else else
state &= ~TBSTATE_CHECKED; state &= ~TBSTATE_CHECKED;
@@ -1428,7 +1445,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
// revert back // revert back
tool->Toggle(!toggled); tool->Toggle(!toggled);
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0)); ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id,
MAKELONG(MSWShouldBeChecked(tool), 0));
} }
return true; return true;
@@ -1669,15 +1687,35 @@ void wxToolBar::SetWindowStyleFlag(long style)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable) void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
{
if ( tool->IsButton() )
{ {
::SendMessage(GetHwnd(), TB_ENABLEBUTTON, ::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0));
// Adjust displayed checked state -- it could have changed if the tool is
// disabled and has a custom "disabled state" bitmap.
DoToggleTool(tool, tool->IsToggled());
}
else if ( tool->IsControl() )
{
wxToolBarTool* tbTool = static_cast<wxToolBarTool*>(tool);
tbTool->GetControl()->Enable(enable);
wxStaticText* text = tbTool->GetStaticText();
if ( text )
text->Enable(enable);
}
} }
void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle) void wxToolBar::DoToggleTool(wxToolBarToolBase *tool,
bool WXUNUSED_UNLESS_DEBUG(toggle))
{ {
wxASSERT_MSG( tool->IsToggled() == toggle, wxT("Inconsistent tool state") );
::SendMessage(GetHwnd(), TB_CHECKBUTTON, ::SendMessage(GetHwnd(), TB_CHECKBUTTON,
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0)); (WPARAM)tool->GetId(),
(LPARAM)MAKELONG(MSWShouldBeChecked(tool), 0));
} }
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))

View File

@@ -561,26 +561,44 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
// wxNSTextViewControl // wxNSTextViewControl
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ) wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style )
: wxWidgetCocoaImpl(wxPeer, w), : wxWidgetCocoaImpl(wxPeer, w),
wxTextWidgetImpl(wxPeer) wxTextWidgetImpl(wxPeer)
{ {
wxNSTextScrollView* sv = (wxNSTextScrollView*) w; wxNSTextScrollView* sv = (wxNSTextScrollView*) w;
m_scrollView = sv; m_scrollView = sv;
[m_scrollView setHasVerticalScroller:YES]; const bool hasHScroll = (style & wxHSCROLL) != 0;
[m_scrollView setHasHorizontalScroller:NO];
// TODO Remove if no regression, this was causing automatic resizes of multi-line textfields when the tlw changed
// [m_scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
NSSize contentSize = [m_scrollView contentSize];
wxNSTextView* tv = [[wxNSTextView alloc] initWithFrame: NSMakeRect(0, 0, [m_scrollView setHasVerticalScroller:YES];
contentSize.width, contentSize.height)]; [m_scrollView setHasHorizontalScroller:hasHScroll];
NSSize contentSize = [m_scrollView contentSize];
NSRect viewFrame = NSMakeRect(
0, 0,
hasHScroll ? FLT_MAX : contentSize.width, contentSize.height
);
wxNSTextView* const tv = [[wxNSTextView alloc] initWithFrame: viewFrame];
m_textView = tv; m_textView = tv;
[tv setVerticallyResizable:YES]; [tv setVerticallyResizable:YES];
[tv setHorizontallyResizable:NO]; [tv setHorizontallyResizable:hasHScroll];
[tv setAutoresizingMask:NSViewWidthSizable]; [tv setAutoresizingMask:NSViewWidthSizable];
if ( hasHScroll )
{
[[tv textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[[tv textContainer] setWidthTracksTextView:NO];
}
if ( style & wxTE_RIGHT)
{
[tv setAlignment:NSRightTextAlignment];
}
else if ( style & wxTE_CENTRE)
{
[tv setAlignment:NSCenterTextAlignment];
}
if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) ) if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) )
{ {
[tv setRichText:NO]; [tv setRichText:NO];
@@ -1055,7 +1073,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
{ {
wxNSTextScrollView* v = nil; wxNSTextScrollView* v = nil;
v = [[wxNSTextScrollView alloc] initWithFrame:r]; v = [[wxNSTextScrollView alloc] initWithFrame:r];
c = new wxNSTextViewControl( wxpeer, v ); c = new wxNSTextViewControl( wxpeer, v, style );
c->SetNeedsFocusRect( true ); c->SetNeedsFocusRect( true );
} }
else else

View File

@@ -781,8 +781,6 @@ long wxExecute(char **argv, int flags, wxProcess *process,
} }
else // we're in parent else // we're in parent
{ {
execData.OnStart(pid);
// prepare for IO redirection // prepare for IO redirection
#if HAS_PIPE_STREAMS #if HAS_PIPE_STREAMS
@@ -834,17 +832,24 @@ long wxExecute(char **argv, int flags, wxProcess *process,
pipeErr.Close(); pipeErr.Close();
} }
// For the asynchronous case we don't have to do anything else, just
// let the process run.
if ( !(flags & wxEXEC_SYNC) ) if ( !(flags & wxEXEC_SYNC) )
{ {
// Ensure that the housekeeping data is kept alive, it will be // Ensure that the housekeeping data is kept alive, it will be
// destroyed only when the child terminates. // destroyed only when the child terminates.
execDataPtr.release(); execDataPtr.release();
return execData.pid;
} }
// Put the housekeeping data into the child process lookup table.
// Note that when running asynchronously, if the child has already
// finished this call will delete the execData and call any
// wxProcess's OnTerminate() handler immediately.
execData.OnStart(pid);
// For the asynchronous case we don't have to do anything else, just
// let the process run (if not already finished).
if ( !(flags & wxEXEC_SYNC) )
return pid;
// If we don't need to dispatch any events, things are relatively // If we don't need to dispatch any events, things are relatively
// simple and we don't need to delegate to wxAppTraits. // simple and we don't need to delegate to wxAppTraits.
@@ -1628,9 +1633,21 @@ void wxExecuteData::OnStart(int pid_)
if ( process ) if ( process )
process->SetPid(pid); process->SetPid(pid);
// Finally, add this object itself to the list of child processes so that // Add this object itself to the list of child processes so that
// we can check for its termination the next time we get SIGCHLD. // we can check for its termination the next time we get SIGCHLD.
ms_childProcesses[pid] = this; ms_childProcesses[pid] = this;
// However, if the child exited before we finished setting up above,
// we may have already missed its SIGCHLD. So we also do an explicit
// check here before returning.
int exitcode;
if ( CheckForChildExit(pid, &exitcode) )
{
// Handle its termination if it did.
// This call will implicitly remove it from ms_childProcesses
// and, if running asynchronously, it will delete itself.
OnExit(exitcode);
}
} }
void wxExecuteData::OnExit(int exitcode_) void wxExecuteData::OnExit(int exitcode_)