avoid shadowed variable warnings with VS2015

This commit is contained in:
Paul Cornett
2015-07-24 20:56:11 -07:00
parent 64308117e8
commit 36e31e515e
18 changed files with 88 additions and 90 deletions

View File

@@ -4111,23 +4111,23 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
wxDataViewItem itemDragged = GetItemByRow( drag_item_row );
// Notify cell about drag
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() );
event.SetEventObject( m_owner );
event.SetItem( itemDragged );
event.SetModel( model );
if (!m_owner->HandleWindowEvent( event ))
wxDataViewEvent evt( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() );
evt.SetEventObject( m_owner );
evt.SetItem( itemDragged );
evt.SetModel( model );
if (!m_owner->HandleWindowEvent( evt ))
return;
if (!event.IsAllowed())
if (!evt.IsAllowed())
return;
wxDataObject *obj = event.GetDataObject();
wxDataObject *obj = evt.GetDataObject();
if (!obj)
return;
wxDataViewDropSource drag( this, drag_item_row );
drag.SetData( *obj );
/* wxDragResult res = */ drag.DoDragDrop(event.GetDragFlags());
/* wxDragResult res = */ drag.DoDragDrop(evt.GetDragFlags());
delete obj;
}
return;

View File

@@ -197,7 +197,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id,
wxIcon icon;
icon.CreateFromHICON( (WXHICON)sii.hIcon );
wxBitmap bitmap( icon );
bitmap = wxBitmap(icon);
::DestroyIcon(sii.hIcon);
if ( bitmap.IsOk() )

View File

@@ -685,7 +685,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
unsigned char val = *src++;
unsigned char reversed = 0;
for ( int bits = 0; bits < 8; bits++)
for ( int bit = 0; bit < 8; bit++)
{
reversed <<= 1;
reversed |= (unsigned char)(val & 0x01);

View File

@@ -663,7 +663,7 @@ int wxFileDialog::ShowModal()
const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension
for( int j = 0; j < maxFilter; j++ ) // get extension
extension = extension + wxStrlen( extension ) + 1;
// use dummy name a to avoid assert in AppendExtension
@@ -725,11 +725,11 @@ int wxFileDialog::ShowModal()
m_fileNames.Add(toke.GetNextToken());
#endif // OFN_EXPLORER
wxString dir(m_dir);
m_path = m_dir;
if ( m_dir.Last() != wxT('\\') )
dir += wxT('\\');
m_path += wxT('\\');
m_path = dir + m_fileName;
m_path += m_fileName;
m_filterIndex = (int)of.nFilterIndex - 1;
}
else
@@ -745,7 +745,7 @@ int wxFileDialog::ShowModal()
const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension
for( int j = 0; j < maxFilter; j++ ) // get extension
extension = extension + wxStrlen( extension ) + 1;
m_fileName = AppendExtension(fileNameBuffer, extension);

View File

@@ -1761,11 +1761,11 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD
interim.GetPixelFormat(),&data);
bool hasAlpha = false;
for ( size_t y = 0 ; y < height && !hasAlpha ; ++y)
for ( size_t yy = 0 ; yy < height && !hasAlpha ; ++yy)
{
for( size_t x = 0 ; x < width && !hasAlpha; ++x)
for( size_t xx = 0 ; xx < width && !hasAlpha; ++xx)
{
ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*y + x*4);
ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*yy + xx*4);
if ( ( *dest & Color::AlphaMask ) != 0 )
hasAlpha = true;
}

View File

@@ -688,7 +688,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
{
// we must use position in SetOwnerDrawnMenuItem because
// all separators have the same id
int pos = 0;
int position = 0;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
while (node)
{
@@ -697,14 +697,14 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
if ( !item->IsOwnerDrawn())
{
item->SetOwnerDrawn(true);
SetOwnerDrawnMenuItem(GetHmenu(), pos,
SetOwnerDrawnMenuItem(GetHmenu(), position,
reinterpret_cast<ULONG_PTR>(item), TRUE);
}
item->SetMarginWidth(m_maxBitmapWidth);
node = node->GetNext();
pos++;
position++;
}
// set menu as ownerdrawn

View File

@@ -1074,13 +1074,13 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
SIZE accelSize;
::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize);
int flags = DST_TEXT;
flags = DST_TEXT;
// themes menu is using specified color for disabled labels
if ( data->MenuLayout() == MenuDrawData::Classic &&
(stat & wxODDisabled) && !(stat & wxODSelected) )
flags |= DSS_DISABLED;
int x = rcText.right - data->ArrowMargin.GetTotalX()
x = rcText.right - data->ArrowMargin.GetTotalX()
- data->ArrowSize.cx
- data->ArrowBorder;
@@ -1090,7 +1090,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
else
x -= m_parentMenu->GetMaxAccelWidth();
int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;
y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;
::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel),
accel.length(), x, y, 0, 0, flags);

View File

@@ -300,7 +300,7 @@ void wxMessageDialog::ReplaceStaticWithEdit()
if ( !hwndBtn )
continue; // it's ok, not all buttons are always present
RECT rc = wxGetWindowRect(hwndBtn);
rc = wxGetWindowRect(hwndBtn);
rc.top -= dh;
rc.bottom -= dh;
rc.left += dw/2;

View File

@@ -1289,8 +1289,8 @@ wxColour wxNotebook::GetThemeBackgroundColour() const
WCHAR szwThemeColor[256];
if (S_OK == wxUxThemeEngine::Get()->GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0))
{
wxString themeFile(szwThemeFile), themeColor(szwThemeColor);
if (themeFile.Find(wxT("Aero")) != -1 && themeColor == wxT("NormalColor"))
wxString themeFile(szwThemeFile);
if (themeFile.Find(wxT("Aero")) != -1 && wxString(szwThemeColor) == wxT("NormalColor"))
s_AeroStatus = 1;
else
s_AeroStatus = 0;

View File

@@ -1007,13 +1007,13 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
// wxAutoOleInterface<> assumes a ref has already been added
// TYPEATTR
TYPEATTR *ta = NULL;
hret = ti->GetTypeAttr(&ta);
TYPEATTR *ta2 = NULL;
hret = ti->GetTypeAttr(&ta2);
CHECK_HR(hret);
if (ta->typekind == TKIND_DISPATCH)
if (ta2->typekind == TKIND_DISPATCH)
{
// WXOLE_TRACEOUT("GUID = " << GetIIDName(ta->guid).c_str());
// WXOLE_TRACEOUT("GUID = " << GetIIDName(ta2->guid).c_str());
if (defEventSink)
{
wxAutoIConnectionPoint cp;
@@ -1022,8 +1022,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
wxAutoIConnectionPointContainer cpContainer(IID_IConnectionPointContainer, m_ActiveX);
wxASSERT( cpContainer.IsOk());
HRESULT hret =
cpContainer->FindConnectionPoint(ta->guid, cp.GetRef());
hret = cpContainer->FindConnectionPoint(ta2->guid, cp.GetRef());
// Notice that the return value of CONNECT_E_NOCONNECTION is
// expected if the interface doesn't support connection points.
@@ -1035,7 +1034,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
if ( cp )
{
wxActiveXEvents * const
events = new wxActiveXEvents(this, ta->guid);
events = new wxActiveXEvents(this, ta2->guid);
hret = cp->Advise(events, &adviseCookie);
// We don't need this object any more and cp will keep a
@@ -1048,7 +1047,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
}
}
ti->ReleaseTypeAttr(ta);
ti->ReleaseTypeAttr(ta2);
}
// free

View File

@@ -356,13 +356,13 @@ void wxWindowsPrintPreview::DetermineScaling()
if ( printerDC.IsOk() )
{
wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl();
HDC dc = GetHdcOf(*impl);
printerWidthMM = ::GetDeviceCaps(dc, HORZSIZE);
printerHeightMM = ::GetDeviceCaps(dc, VERTSIZE);
printerXRes = ::GetDeviceCaps(dc, HORZRES);
printerYRes = ::GetDeviceCaps(dc, VERTRES);
logPPIPrinterX = ::GetDeviceCaps(dc, LOGPIXELSX);
logPPIPrinterY = ::GetDeviceCaps(dc, LOGPIXELSY);
HDC hdc = GetHdcOf(*impl);
printerWidthMM = ::GetDeviceCaps(hdc, HORZSIZE);
printerHeightMM = ::GetDeviceCaps(hdc, VERTSIZE);
printerXRes = ::GetDeviceCaps(hdc, HORZRES);
printerYRes = ::GetDeviceCaps(hdc, VERTRES);
logPPIPrinterX = ::GetDeviceCaps(hdc, LOGPIXELSX);
logPPIPrinterY = ::GetDeviceCaps(hdc, LOGPIXELSY);
paperRect = printerDC.GetPaperRect();

View File

@@ -79,11 +79,11 @@ bool wxSpinButton::Create(wxWindow *parent,
// get the right size for the control
if ( width <= 0 || height <= 0 )
{
wxSize size = DoGetBestSize();
wxSize bestSize = DoGetBestSize();
if ( width <= 0 )
width = size.x;
width = bestSize.x;
if ( height <= 0 )
height = size.y;
height = bestSize.y;
}
if ( x < 0 )

View File

@@ -194,12 +194,12 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
{
case WXK_RETURN:
{
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(event);
wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(evt);
wxString val = wxGetWindowText(m_hwndBuddy);
event.SetString(val);
event.SetInt(GetValue());
if ( HandleWindowEvent(event) )
evt.SetString(val);
evt.SetInt(GetValue());
if ( HandleWindowEvent(evt) )
return;
break;
}

View File

@@ -479,8 +479,7 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&)
// the label: this is consistent with the behaviour under pre-XP
// systems (i.e. without visual themes) and generally makes sense
wxBrush brush = wxBrush(GetBackgroundColour());
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
::FillRect(GetHdcOf(*impl), &dimensions, GetHbrushOf(brush));
::FillRect(hdc, &dimensions, GetHbrushOf(brush));
}
else // paint parent background
{

View File

@@ -1974,10 +1974,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
{
case WXK_RETURN:
{
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(event);
event.SetString(GetValue());
if ( HandleWindowEvent(event) )
wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId);
InitCommandEvent(evt);
evt.SetString(GetValue());
if ( HandleWindowEvent(evt) )
if ( !HasFlag(wxTE_MULTILINE) )
return;
//else: multiline controls need Enter for themselves

View File

@@ -799,10 +799,10 @@ bool wxToolBar::Realize()
// MapBitmap() to work correctly
for ( int y = 0; y < h; y++ )
{
for ( int x = 0; x < w; x++ )
for ( int xx = 0; xx < w; xx++ )
{
if ( imgGreyed.IsTransparent(x, y) )
imgGreyed.SetRGB(x, y,
if ( imgGreyed.IsTransparent(xx, y) )
imgGreyed.SetRGB(xx, y,
wxLIGHT_GREY->Red(),
wxLIGHT_GREY->Green(),
wxLIGHT_GREY->Blue());
@@ -885,11 +885,11 @@ bool wxToolBar::Realize()
if ( addBitmap ) // no old bitmap or we can't replace it
{
TBADDBITMAP addBitmap;
addBitmap.hInst = 0;
addBitmap.nID = (UINT_PTR)hBitmap;
TBADDBITMAP tbAddBitmap;
tbAddBitmap.hInst = 0;
tbAddBitmap.nID = (UINT_PTR)hBitmap;
if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP,
(WPARAM) nButtons, (LPARAM)&addBitmap) == -1 )
(WPARAM) nButtons, (LPARAM)&tbAddBitmap) == -1 )
{
wxFAIL_MSG(wxT("Could not add bitmap to toolbar"));
}
@@ -1025,12 +1025,12 @@ bool wxToolBar::Realize()
while ( nodePrev )
{
TBBUTTON& prevButton = buttons[prevIndex];
wxToolBarToolBase *tool = nodePrev->GetData();
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
wxToolBarToolBase *toolPrev = nodePrev->GetData();
if ( !toolPrev->IsButton() || toolPrev->GetKind() != wxITEM_RADIO )
break;
if ( tool->Toggle(false) )
DoToggleTool(tool, false);
if ( toolPrev->Toggle(false) )
DoToggleTool(toolPrev, false);
prevButton.fsState &= ~TBSTATE_CHECKED;
nodePrev = nodePrev->GetPrevious();

View File

@@ -1525,10 +1525,10 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent,
// need this to make the "[+]" appear
if ( firstChild )
{
TVGetItemRectParam param;
TVGetItemRectParam param2;
wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param, FALSE);
::InvalidateRect(GetHwnd(), &param.rect, FALSE);
wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param2, FALSE);
::InvalidateRect(GetHwnd(), &param2.rect, FALSE);
}
// associate the application tree item with Win32 tree item handle

View File

@@ -2819,17 +2819,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
case WM_MOVING:
{
LPRECT pRect = (LPRECT)lParam;
wxRect rc;
rc.SetLeft(pRect->left);
rc.SetTop(pRect->top);
rc.SetRight(pRect->right);
rc.SetBottom(pRect->bottom);
processed = HandleMoving(rc);
wxRect rect;
rect.SetLeft(pRect->left);
rect.SetTop(pRect->top);
rect.SetRight(pRect->right);
rect.SetBottom(pRect->bottom);
processed = HandleMoving(rect);
if (processed) {
pRect->left = rc.GetLeft();
pRect->top = rc.GetTop();
pRect->right = rc.GetRight();
pRect->bottom = rc.GetBottom();
pRect->left = rect.GetLeft();
pRect->top = rect.GetTop();
pRect->right = rect.GetRight();
pRect->bottom = rect.GetBottom();
}
}
break;
@@ -2849,17 +2849,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
case WM_SIZING:
{
LPRECT pRect = (LPRECT)lParam;
wxRect rc;
rc.SetLeft(pRect->left);
rc.SetTop(pRect->top);
rc.SetRight(pRect->right);
rc.SetBottom(pRect->bottom);
processed = HandleSizing(rc);
wxRect rect;
rect.SetLeft(pRect->left);
rect.SetTop(pRect->top);
rect.SetRight(pRect->right);
rect.SetBottom(pRect->bottom);
processed = HandleSizing(rect);
if (processed) {
pRect->left = rc.GetLeft();
pRect->top = rc.GetTop();
pRect->right = rc.GetRight();
pRect->bottom = rc.GetBottom();
pRect->left = rect.GetLeft();
pRect->top = rect.GetTop();
pRect->right = rect.GetRight();
pRect->bottom = rect.GetBottom();
}
}
break;