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

View File

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

View File

@@ -122,20 +122,16 @@ wxChar wxNumberFormatter::GetDecimalSeparator()
{
const wxString
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
// back to the C locale default.
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;
@@ -154,11 +150,8 @@ bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
{
const wxString
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];
}
//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() )
return wxEmptyString;
size_t found = trans->find(header);
size_t found = trans->find(header + wxS(": "));
if ( found == wxString::npos )
return wxEmptyString;

View File

@@ -2441,7 +2441,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
evtCtx.SetEventObject(GetParent());
GetParent()->GetEventHandler()->ProcessEvent(evtCtx);
}
else
else if (event.LeftDown())
{
// reset the selection and bail out
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;
// 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 )
::SetLayout(hdc, oldLayout | LAYOUT_BITMAPORIENTATIONPRESERVED);
wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState);

View File

@@ -321,25 +321,28 @@ bool wxGLCanvas::Create(wxWindow *parent,
glVersionMinor = 0;
// Check for a core profile request
for ( int i = 0; attribList[i]; )
if ( attribList )
{
switch ( attribList[i++] )
for ( int i = 0; attribList[i]; )
{
case WX_GL_CORE_PROFILE:
useGLCoreProfile = true;
break;
switch ( attribList[i++] )
{
case WX_GL_CORE_PROFILE:
useGLCoreProfile = true;
break;
case WX_GL_MAJOR_VERSION:
glVersionMajor = attribList[i++];
break;
case WX_GL_MAJOR_VERSION:
glVersionMajor = attribList[i++];
break;
case WX_GL_MINOR_VERSION:
glVersionMinor = attribList[i++];
break;
case WX_GL_MINOR_VERSION:
glVersionMinor = attribList[i++];
break;
default:
// ignore all other flags for now
break;
default:
// ignore all other flags for now
break;
}
}
}

View File

@@ -620,7 +620,15 @@ bool wxListCtrl::SetColumnWidth(int col, int width)
else if ( width == wxLIST_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;
}
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
// ============================================================================
@@ -1011,7 +1028,7 @@ bool wxToolBar::Realize()
if ( tool->IsEnabled() )
button.fsState |= TBSTATE_ENABLED;
if ( tool->IsToggled() )
if ( MSWShouldBeChecked(tool) )
button.fsState |= TBSTATE_CHECKED;
switch ( tool->GetKind() )
@@ -1415,7 +1432,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
state |= TBSTATE_ENABLED;
else
state &= ~TBSTATE_ENABLED;
if (tool->IsToggled())
if ( MSWShouldBeChecked(tool) )
state |= TBSTATE_CHECKED;
else
state &= ~TBSTATE_CHECKED;
@@ -1428,7 +1445,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
// revert back
tool->Toggle(!toggled);
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0));
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id,
MAKELONG(MSWShouldBeChecked(tool), 0));
}
return true;
@@ -1670,14 +1688,34 @@ void wxToolBar::SetWindowStyleFlag(long style)
void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
{
::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0));
if ( tool->IsButton() )
{
::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
(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,
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0));
(WPARAM)tool->GetId(),
(LPARAM)MAKELONG(MSWShouldBeChecked(tool), 0));
}
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))

View File

@@ -561,26 +561,44 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
// wxNSTextViewControl
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w )
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style )
: wxWidgetCocoaImpl(wxPeer, w),
wxTextWidgetImpl(wxPeer)
{
wxNSTextScrollView* sv = (wxNSTextScrollView*) w;
m_scrollView = sv;
[m_scrollView setHasVerticalScroller:YES];
[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];
const bool hasHScroll = (style & wxHSCROLL) != 0;
wxNSTextView* tv = [[wxNSTextView alloc] initWithFrame: NSMakeRect(0, 0,
contentSize.width, contentSize.height)];
[m_scrollView setHasVerticalScroller:YES];
[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;
[tv setVerticallyResizable:YES];
[tv setHorizontallyResizable:NO];
[tv setHorizontallyResizable:hasHScroll];
[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) )
{
[tv setRichText:NO];
@@ -1055,7 +1073,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
{
wxNSTextScrollView* v = nil;
v = [[wxNSTextScrollView alloc] initWithFrame:r];
c = new wxNSTextViewControl( wxpeer, v );
c = new wxNSTextViewControl( wxpeer, v, style );
c->SetNeedsFocusRect( true );
}
else

View File

@@ -781,8 +781,6 @@ long wxExecute(char **argv, int flags, wxProcess *process,
}
else // we're in parent
{
execData.OnStart(pid);
// prepare for IO redirection
#if HAS_PIPE_STREAMS
@@ -834,17 +832,24 @@ long wxExecute(char **argv, int flags, wxProcess *process,
pipeErr.Close();
}
// For the asynchronous case we don't have to do anything else, just
// let the process run.
if ( !(flags & wxEXEC_SYNC) )
{
// Ensure that the housekeeping data is kept alive, it will be
// destroyed only when the child terminates.
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
// simple and we don't need to delegate to wxAppTraits.
@@ -1628,9 +1633,21 @@ void wxExecuteData::OnStart(int pid_)
if ( process )
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.
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_)