From 4e115ed2c71e11ea37c83ed44f3553523ec16560 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 26 Sep 2005 00:29:42 +0000 Subject: [PATCH] fixed variable shadowing icc warnings git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fontmap.cpp | 12 ++++---- src/common/image.cpp | 51 +++++++++++--------------------- src/common/tbarbase.cpp | 16 +++++----- src/generic/calctrl.cpp | 6 ++-- src/generic/dcpsg.cpp | 2 -- src/generic/dirctrlg.cpp | 64 +++++++++++++++++++--------------------- src/generic/grid.cpp | 4 +-- src/generic/gridsel.cpp | 8 ++--- src/generic/sashwin.cpp | 10 +++---- src/generic/splitter.cpp | 12 ++++---- src/generic/treectlg.cpp | 30 +++++++++---------- src/generic/vlbox.cpp | 6 ++-- src/gtk/dcclient.cpp | 10 +++---- src/gtk/menu.cpp | 10 +++---- src/gtk/scrolwin.cpp | 37 ++++++++++++----------- src/gtk1/dcclient.cpp | 10 +++---- src/gtk1/menu.cpp | 10 +++---- src/gtk1/scrolwin.cpp | 37 ++++++++++++----------- 18 files changed, 159 insertions(+), 176 deletions(-) diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 19d2394762..18114477ff 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -445,9 +445,9 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, #if wxUSE_CONFIG && wxUSE_FILECONFIG // remember this in the config - wxFontMapperPathChanger path(this, - FONTMAPPER_FONT_FROM_ENCODING_PATH); - if ( path.IsOk() ) + wxFontMapperPathChanger path2(this, + FONTMAPPER_FONT_FROM_ENCODING_PATH); + if ( path2.IsOk() ) { GetConfig()->Write(configEntry, info->ToString()); } @@ -464,9 +464,9 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, // // remember it to avoid asking the same question again later #if wxUSE_CONFIG && wxUSE_FILECONFIG - wxFontMapperPathChanger path(this, - FONTMAPPER_FONT_FROM_ENCODING_PATH); - if ( path.IsOk() ) + wxFontMapperPathChanger path2(this, + FONTMAPPER_FONT_FROM_ENCODING_PATH); + if ( path2.IsOk() ) { GetConfig()->Write ( diff --git a/src/common/image.cpp b/src/common/image.cpp index d7e07b0dc0..de70ee86db 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -2175,20 +2175,20 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i wxRealPoint p3 = rotated_point (GetWidth(), 0, cos_angle, sin_angle, p0); wxRealPoint p4 = rotated_point (GetWidth(), GetHeight(), cos_angle, sin_angle, p0); - int x1 = (int) floor (wxMin (wxMin(p1.x, p2.x), wxMin(p3.x, p4.x))); - int y1 = (int) floor (wxMin (wxMin(p1.y, p2.y), wxMin(p3.y, p4.y))); - int x2 = (int) ceil (wxMax (wxMax(p1.x, p2.x), wxMax(p3.x, p4.x))); - int y2 = (int) ceil (wxMax (wxMax(p1.y, p2.y), wxMax(p3.y, p4.y))); + int x1a = (int) floor (wxMin (wxMin(p1.x, p2.x), wxMin(p3.x, p4.x))); + int y1a = (int) floor (wxMin (wxMin(p1.y, p2.y), wxMin(p3.y, p4.y))); + int x2a = (int) ceil (wxMax (wxMax(p1.x, p2.x), wxMax(p3.x, p4.x))); + int y2a = (int) ceil (wxMax (wxMax(p1.y, p2.y), wxMax(p3.y, p4.y))); // Create rotated image - wxImage rotated (x2 - x1 + 1, y2 - y1 + 1, false); + wxImage rotated (x2a - x1a + 1, y2a - y1a + 1, false); // With alpha channel if (has_alpha) rotated.SetAlpha(); if (offset_after_rotation != NULL) { - *offset_after_rotation = wxPoint (x1, y1); + *offset_after_rotation = wxPoint (x1a, y1a); } // GRG: The rotated (destination) image is always accessed @@ -2230,7 +2230,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i { for (x = 0; x < rotated.GetWidth(); x++) { - wxRealPoint src = rotated_point (x + x1, y + y1, cos_angle, -sin_angle, p0); + wxRealPoint src = rotated_point (x + x1a, y + y1a, cos_angle, -sin_angle, p0); if (-0.25 < src.x && src.x < GetWidth() - 0.75 && -0.25 < src.y && src.y < GetHeight() - 0.75) @@ -2238,8 +2238,6 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i // interpolate using the 4 enclosing grid-points. Those // points can be obtained using floor and ceiling of the // exact coordinates of the point - // C.M. 2000-02-17: when the point is near the border, special care is required. - int x1, y1, x2, y2; if (0 < src.x && src.x < GetWidth() - 1) @@ -2289,10 +2287,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i *(dst++) = *p; if (has_alpha) - { - unsigned char *p = alpha[y1] + x1; - *(alpha_dst++) = *p; - } + *(alpha_dst++) = *(alpha[y1] + x1); } else if (d2 < gs_Epsilon) { @@ -2302,10 +2297,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i *(dst++) = *p; if (has_alpha) - { - unsigned char *p = alpha[y1] + x2; - *(alpha_dst++) = *p; - } + *(alpha_dst++) = *(alpha[y1] + x2); } else if (d3 < gs_Epsilon) { @@ -2315,10 +2307,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i *(dst++) = *p; if (has_alpha) - { - unsigned char *p = alpha[y2] + x2; - *(alpha_dst++) = *p; - } + *(alpha_dst++) = *(alpha[y2] + x2); } else if (d4 < gs_Epsilon) { @@ -2328,10 +2317,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i *(dst++) = *p; if (has_alpha) - { - unsigned char *p = alpha[y2] + x1; - *(alpha_dst++) = *p; - } + *(alpha_dst++) = *(alpha[y2] + x1); } else { @@ -2360,10 +2346,10 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i if (has_alpha) { - unsigned char *v1 = alpha[y1] + (x1); - unsigned char *v2 = alpha[y1] + (x2); - unsigned char *v3 = alpha[y2] + (x2); - unsigned char *v4 = alpha[y2] + (x1); + v1 = alpha[y1] + (x1); + v2 = alpha[y1] + (x2); + v3 = alpha[y2] + (x2); + v4 = alpha[y2] + (x1); *(alpha_dst++) = (unsigned char) ( (w1 * *v1 + w2 * *v2 + @@ -2390,7 +2376,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i { for (x = 0; x < rotated.GetWidth(); x++) { - wxRealPoint src = rotated_point (x + x1, y + y1, cos_angle, -sin_angle, p0); + wxRealPoint src = rotated_point (x + x1a, y + y1a, cos_angle, -sin_angle, p0); const int xs = wxCint (src.x); // wxCint rounds to the const int ys = wxCint (src.y); // closest integer @@ -2404,10 +2390,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i *(dst++) = *p; if (has_alpha) - { - unsigned char *p = alpha[ys] + (xs); - *(alpha_dst++) = *p; - } + *(alpha_dst++) = *(alpha[ys] + (xs)); } else { diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index d5d9ef0ff6..47c85a2c61 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -401,14 +401,14 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool) wxToolBarToolsList::compatibility_iterator nodeNext = node->GetNext(); while ( nodeNext ) { - wxToolBarToolBase *tool = nodeNext->GetData(); + wxToolBarToolBase *toolNext = nodeNext->GetData(); - if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) + if ( !toolNext->IsButton() || toolNext->GetKind() != wxITEM_RADIO ) break; - if ( tool->Toggle(false) ) + if ( toolNext->Toggle(false) ) { - DoToggleTool(tool, false); + DoToggleTool(toolNext, false); } nodeNext = nodeNext->GetNext(); @@ -417,14 +417,14 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool) wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); while ( nodePrev ) { - wxToolBarToolBase *tool = nodePrev->GetData(); + wxToolBarToolBase *toolNext = nodePrev->GetData(); - if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) + if ( !toolNext->IsButton() || toolNext->GetKind() != wxITEM_RADIO ) break; - if ( tool->Toggle(false) ) + if ( toolNext->Toggle(false) ) { - DoToggleTool(tool, false); + DoToggleTool(toolNext, false); } nodePrev = nodePrev->GetPrevious(); diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index a5ec950704..7adb122716 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -1414,9 +1414,9 @@ void wxCalendarCtrl::OnClick(wxMouseEvent& event) case wxCAL_HITTEST_HEADER: { - wxCalendarEvent event(this, wxEVT_CALENDAR_WEEKDAY_CLICKED); - event.m_wday = wday; - (void)GetEventHandler()->ProcessEvent(event); + wxCalendarEvent eventWd(this, wxEVT_CALENDAR_WEEKDAY_CLICKED); + eventWd.m_wday = wday; + (void)GetEventHandler()->ProcessEvent(eventWd); } break; diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 63d3c4bbab..d1d7bd66d8 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1075,7 +1075,6 @@ void wxPostScriptDC::SetPen( const wxPen& pen ) double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - char buffer[100]; sprintf( buffer, "%.8f %.8f %.8f setrgbcolor\n", redPS, greenPS, bluePS ); @@ -1352,7 +1351,6 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord { wxCoord uy = (wxCoord)(y + size - m_underlinePosition); wxCoord w, h; - char buffer[100]; GetTextExtent(text, &w, &h); sprintf( buffer, diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index f3cd6416d4..1d77415609 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -830,8 +830,6 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) // Now do the filenames -- but only if we're allowed to if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) { - wxLogNull log; - d.Open(dirName); if (d.IsOpened()) @@ -865,7 +863,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) size_t i; for (i = 0; i < dirs.Count(); i++) { - wxString eachFilename(dirs[i]); + eachFilename = dirs[i]; path = dirName; if (!wxEndsWithPathSeparator(path)) path += wxString(wxFILE_SEP_PATH); @@ -894,7 +892,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId) { for (i = 0; i < filenames.Count(); i++) { - wxString eachFilename(filenames[i]); + eachFilename = filenames[i]; path = dirName; if (!wxEndsWithPathSeparator(path)) path += wxString(wxFILE_SEP_PATH); @@ -997,48 +995,46 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path) if (id.IsOk()) lastId = id; } - if (lastId.IsOk()) + if (!lastId.IsOk()) + return false; + + wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId); + if (data->m_isDir) { - wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId); - if (data->m_isDir) - { - m_treeCtrl->Expand(lastId); - } - if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) + m_treeCtrl->Expand(lastId); + } + if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) + { + // Find the first file in this directory + wxTreeItemIdValue cookie; + wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); + bool selectedChild = false; + while (childId.IsOk()) { - // Find the first file in this directory - wxTreeItemIdValue cookie; - wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); - bool selectedChild = false; - while (childId.IsOk()) - { - wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId); + data = (wxDirItemData*) m_treeCtrl->GetItemData(childId); - if (data && data->m_path != wxEmptyString && !data->m_isDir) - { - m_treeCtrl->SelectItem(childId); - m_treeCtrl->EnsureVisible(childId); - selectedChild = true; - break; - } - childId = m_treeCtrl->GetNextChild(lastId, cookie); - } - if (!selectedChild) + if (data && data->m_path != wxEmptyString && !data->m_isDir) { - m_treeCtrl->SelectItem(lastId); - m_treeCtrl->EnsureVisible(lastId); + m_treeCtrl->SelectItem(childId); + m_treeCtrl->EnsureVisible(childId); + selectedChild = true; + break; } + childId = m_treeCtrl->GetNextChild(lastId, cookie); } - else + if (!selectedChild) { m_treeCtrl->SelectItem(lastId); m_treeCtrl->EnsureVisible(lastId); } - - return true; } else - return false; + { + m_treeCtrl->SelectItem(lastId); + m_treeCtrl->EnsureVisible(lastId); + } + + return true; } wxString wxGenericDirCtrl::GetPath() const diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4a491aae1d..e8c4009b95 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5021,7 +5021,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) // else if (event.LeftDClick() ) { - int row = YToEdgeOfRow(y); + row = YToEdgeOfRow(y); if ( row < 0 ) { row = YToRow(y); @@ -5245,7 +5245,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) // if ( event.LeftDClick() ) { - int col = XToEdgeOfCol(x); + col = XToEdgeOfCol(x); if ( col < 0 ) { col = XToCol(x); diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index 12bcb904b1..f1d62b07f6 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -87,7 +87,7 @@ bool wxGridSelection::IsInSelection ( int row, int col ) // (unless we are in column selection mode). if ( m_selectionMode != wxGrid::wxGridSelectColumns ) { - size_t count = m_rowSelection.GetCount(); + count = m_rowSelection.GetCount(); for ( size_t n = 0; n < count; n++ ) { if ( row == m_rowSelection[n] ) @@ -100,7 +100,7 @@ bool wxGridSelection::IsInSelection ( int row, int col ) // (unless we are in row selection mode). if ( m_selectionMode != wxGrid::wxGridSelectRows ) { - size_t count = m_colSelection.GetCount(); + count = m_colSelection.GetCount(); for ( size_t n = 0; n < count; n++ ) { if ( col == m_colSelection[n] ) @@ -595,8 +595,8 @@ void wxGridSelection::ToggleCellSelection( int row, int col, count = m_cellSelection.GetCount(); for ( n = 0; n < count; n++ ) { - wxGridCellCoords& coords = m_cellSelection[n]; - if ( row == coords.GetRow() && col == coords.GetCol() ) + const wxGridCellCoords& sel = m_cellSelection[n]; + if ( row == sel.GetRow() && col == sel.GetCol() ) { wxGridCellCoords coords = m_cellSelection[n]; m_cellSelection.RemoveAt(n); diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 3581f95e06..945582381a 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -276,11 +276,11 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) dragRect = wxRect(x, y, newWidth, newHeight); - wxSashEvent event(GetId(), edge); - event.SetEventObject(this); - event.SetDragStatus(status); - event.SetDragRect(dragRect); - GetEventHandler()->ProcessEvent(event); + wxSashEvent eventSash(GetId(), edge); + eventSash.SetEventObject(this); + eventSash.SetDragStatus(status); + eventSash.SetDragRect(dragRect); + GetEventHandler()->ProcessEvent(eventSash); } else if ( event.LeftUp() ) { diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index ec68425a1a..5bafc84269 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -292,9 +292,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) m_windowOne = m_windowTwo; m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - event.m_data.win = removedWindow; - (void)DoSendEvent(event); + wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); + eventUnsplit.m_data.win = removedWindow; + (void)DoSendEvent(eventUnsplit); SetSashPositionAndNotify(0); } else if ( posSashNew == GetWindowSize() ) @@ -303,9 +303,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) wxWindow *removedWindow = m_windowTwo; m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - event.m_data.win = removedWindow; - (void)DoSendEvent(event); + wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); + eventUnsplit.m_data.win = removedWindow; + (void)DoSendEvent(eventUnsplit); SetSashPositionAndNotify(0); } else diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 2ce619061b..f9a371eaa6 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2696,23 +2696,23 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) wxRect ItemRect; GetBoundingRect(m_current, ItemRect, true); - wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() ); - event.m_item = m_current; + wxTreeEvent eventMenu( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() ); + eventMenu.m_item = m_current; // Use the left edge, vertical middle - event.m_pointDrag = wxPoint(ItemRect.GetX(), - ItemRect.GetY() + ItemRect.GetHeight() / 2); - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent( event ); + eventMenu.m_pointDrag = wxPoint(ItemRect.GetX(), + ItemRect.GetY() + ItemRect.GetHeight() / 2); + eventMenu.SetEventObject( this ); + GetEventHandler()->ProcessEvent( eventMenu ); break; } case ' ': case WXK_RETURN: if ( !event.HasModifiers() ) { - wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); - event.m_item = m_current; - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent( event ); + wxTreeEvent eventAct( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); + eventAct.m_item = m_current; + eventAct.SetEventObject( this ); + GetEventHandler()->ProcessEvent( eventAct ); } // in any case, also generate the normal key event for this key, @@ -3179,13 +3179,13 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) } // generate the drag end event - wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId()); + wxTreeEvent eventEndDrag(wxEVT_COMMAND_TREE_END_DRAG, GetId()); - event.m_item = item; - event.m_pointDrag = pt; - event.SetEventObject(this); + eventEndDrag.m_item = item; + eventEndDrag.m_pointDrag = pt; + eventEndDrag.SetEventObject(this); - (void)GetEventHandler()->ProcessEvent(event); + (void)GetEventHandler()->ProcessEvent(eventEndDrag); m_isDragging = false; m_dropTarget = (wxGenericTreeItem *)NULL; diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index 89438eaae9..9bb7cde2d0 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -577,7 +577,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) void wxVListBox::OnLeftDown(wxMouseEvent& event) { SetFocus(); - + int item = HitTest(event.GetPosition()); if ( item != wxNOT_FOUND ) @@ -599,9 +599,9 @@ void wxVListBox::OnLeftDown(wxMouseEvent& event) } } -void wxVListBox::OnLeftDClick(wxMouseEvent& event) +void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse) { - int item = HitTest(event.GetPosition()); + int item = HitTest(eventMouse.GetPosition()); if ( item != wxNOT_FOUND ) { wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId()); diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 4a1ead4f1f..bf324de310 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1133,15 +1133,15 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, if (is_mono) { #ifdef __WXGTK20__ - GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); - GdkGC *gc = gdk_gc_new( bitmap ); + GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); + GdkGC *gc = gdk_gc_new( bitmap2 ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() ); - gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 ); + gdk_wx_draw_bitmap( bitmap2, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 ); - gdk_draw_drawable( m_window, m_textGC, bitmap, 0, 0, xx, yy, -1, -1 ); + gdk_draw_drawable( m_window, m_textGC, bitmap2, 0, 0, xx, yy, -1, -1 ); - gdk_bitmap_unref( bitmap ); + gdk_bitmap_unref( bitmap2 ); gdk_gc_unref( gc ); #else gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index d72ee3bd41..1be1da30ef 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -558,20 +558,20 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) wxMenu* menu = node->GetData(); - wxString str( wxReplaceUnderscore( label ) ); + const wxString str( wxReplaceUnderscore( label ) ); menu->SetTitle( str ); if (menu->m_owner) { - GtkLabel *label = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); + GtkLabel *glabel = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); /* set new text */ - gtk_label_set( label, wxGTK_CONV( str ) ); + gtk_label_set( glabel, wxGTK_CONV( str ) ); /* reparse key accel */ - (void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( str ) ); - gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); + (void)gtk_label_parse_uline (GTK_LABEL(glabel), wxGTK_CONV( str ) ); + gtk_accel_label_refetch( GTK_ACCEL_LABEL(glabel) ); } } diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 26b690e4fd..80ba00f515 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -29,6 +29,7 @@ #include "wx/dcclient.h" #include "wx/panel.h" #include "wx/sizer.h" +#include "wx/math.h" #include "wx/gtk/private.h" #include "wx/gtk/win_gtk.h" @@ -79,7 +80,7 @@ static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, if (g_blockEventsOnDrag) return; if (!win->m_hasVMT) return; - + win->GtkVScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); } @@ -316,7 +317,7 @@ bool wxScrolledWindow::Create(wxWindow *parent, PostCreation(); Show( TRUE ); - + return TRUE; } @@ -397,7 +398,7 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY, { int xs, ys; GetViewStart (& xs, & ys); - + int old_x = m_xScrollPixelsPerLine * xs; int old_y = m_yScrollPixelsPerLine * ys; @@ -432,7 +433,7 @@ void wxScrolledWindow::AdjustScrollbars() m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetVirtualSize( &vw, &vh ); - + if (m_xScrollPixelsPerLine == 0) { m_hAdjust->upper = 1.0; @@ -447,19 +448,20 @@ void wxScrolledWindow::AdjustScrollbars() // Special case. When client and virtual size are very close but // the client is big enough, kill scrollbar. - - if ((m_hAdjust->page_size < m_hAdjust->upper) && (w >= vw)) + + if ((m_hAdjust->page_size < m_hAdjust->upper) && (w >= vw)) m_hAdjust->page_size += 1.0; - + // If the scrollbar hits the right side, move the window // right to keep it from over extending. - if ((m_hAdjust->value != 0.0) && (m_hAdjust->value + m_hAdjust->page_size > m_hAdjust->upper)) + if ( !wxIsNullDouble(m_hAdjust->value) && + (m_hAdjust->value + m_hAdjust->page_size > m_hAdjust->upper) ) { m_hAdjust->value = m_hAdjust->upper - m_hAdjust->page_size; if (m_hAdjust->value < 0.0) m_hAdjust->value = 0.0; - + if (GetChildren().GetCount() == 0) m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows else @@ -478,18 +480,19 @@ void wxScrolledWindow::AdjustScrollbars() m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine; m_vAdjust->page_size = h / m_yScrollPixelsPerLine; m_vAdjust->page_increment = h / m_yScrollPixelsPerLine; - - if ((m_vAdjust->page_size < m_vAdjust->upper) && (h >= vh)) + + if ((m_vAdjust->page_size < m_vAdjust->upper) && (h >= vh)) m_vAdjust->page_size += 1.0; - if ((m_vAdjust->value != 0.0) && (m_vAdjust->value + m_vAdjust->page_size > m_vAdjust->upper)) + if ( !wxIsNullDouble(m_vAdjust->value) && + (m_vAdjust->value + m_vAdjust->page_size > m_vAdjust->upper) ) { m_vAdjust->value = m_vAdjust->upper - m_vAdjust->page_size; if (m_vAdjust->value < 0.0) m_vAdjust->value = 0.0; - + if (GetChildren().GetCount() == 0) - m_yScrollPosition = (int)m_vAdjust->value; + m_yScrollPosition = (int)m_vAdjust->value; else gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" ); } @@ -714,7 +717,7 @@ void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) co { int xs, ys; GetViewStart (& xs, & ys); - + if ( xx ) *xx = x - xs * m_xScrollPixelsPerLine; if ( yy ) @@ -725,7 +728,7 @@ void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) { int xs, ys; GetViewStart (& xs, & ys); - + if ( xx ) *xx = x + xs * m_xScrollPixelsPerLine; if ( yy ) @@ -916,7 +919,7 @@ void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) if ( m_targetWindow->GetAutoLayout() ) { wxSize size = m_targetWindow->GetBestVirtualSize(); - + // This will call ::Layout() and ::AdjustScrollbars() SetVirtualSize( size ); } diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 4a1ead4f1f..bf324de310 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1133,15 +1133,15 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, if (is_mono) { #ifdef __WXGTK20__ - GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); - GdkGC *gc = gdk_gc_new( bitmap ); + GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); + GdkGC *gc = gdk_gc_new( bitmap2 ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() ); - gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 ); + gdk_wx_draw_bitmap( bitmap2, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 ); - gdk_draw_drawable( m_window, m_textGC, bitmap, 0, 0, xx, yy, -1, -1 ); + gdk_draw_drawable( m_window, m_textGC, bitmap2, 0, 0, xx, yy, -1, -1 ); - gdk_bitmap_unref( bitmap ); + gdk_bitmap_unref( bitmap2 ); gdk_gc_unref( gc ); #else gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index d72ee3bd41..1be1da30ef 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -558,20 +558,20 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) wxMenu* menu = node->GetData(); - wxString str( wxReplaceUnderscore( label ) ); + const wxString str( wxReplaceUnderscore( label ) ); menu->SetTitle( str ); if (menu->m_owner) { - GtkLabel *label = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); + GtkLabel *glabel = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); /* set new text */ - gtk_label_set( label, wxGTK_CONV( str ) ); + gtk_label_set( glabel, wxGTK_CONV( str ) ); /* reparse key accel */ - (void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( str ) ); - gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); + (void)gtk_label_parse_uline (GTK_LABEL(glabel), wxGTK_CONV( str ) ); + gtk_accel_label_refetch( GTK_ACCEL_LABEL(glabel) ); } } diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 26b690e4fd..80ba00f515 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -29,6 +29,7 @@ #include "wx/dcclient.h" #include "wx/panel.h" #include "wx/sizer.h" +#include "wx/math.h" #include "wx/gtk/private.h" #include "wx/gtk/win_gtk.h" @@ -79,7 +80,7 @@ static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, if (g_blockEventsOnDrag) return; if (!win->m_hasVMT) return; - + win->GtkVScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); } @@ -316,7 +317,7 @@ bool wxScrolledWindow::Create(wxWindow *parent, PostCreation(); Show( TRUE ); - + return TRUE; } @@ -397,7 +398,7 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY, { int xs, ys; GetViewStart (& xs, & ys); - + int old_x = m_xScrollPixelsPerLine * xs; int old_y = m_yScrollPixelsPerLine * ys; @@ -432,7 +433,7 @@ void wxScrolledWindow::AdjustScrollbars() m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetVirtualSize( &vw, &vh ); - + if (m_xScrollPixelsPerLine == 0) { m_hAdjust->upper = 1.0; @@ -447,19 +448,20 @@ void wxScrolledWindow::AdjustScrollbars() // Special case. When client and virtual size are very close but // the client is big enough, kill scrollbar. - - if ((m_hAdjust->page_size < m_hAdjust->upper) && (w >= vw)) + + if ((m_hAdjust->page_size < m_hAdjust->upper) && (w >= vw)) m_hAdjust->page_size += 1.0; - + // If the scrollbar hits the right side, move the window // right to keep it from over extending. - if ((m_hAdjust->value != 0.0) && (m_hAdjust->value + m_hAdjust->page_size > m_hAdjust->upper)) + if ( !wxIsNullDouble(m_hAdjust->value) && + (m_hAdjust->value + m_hAdjust->page_size > m_hAdjust->upper) ) { m_hAdjust->value = m_hAdjust->upper - m_hAdjust->page_size; if (m_hAdjust->value < 0.0) m_hAdjust->value = 0.0; - + if (GetChildren().GetCount() == 0) m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows else @@ -478,18 +480,19 @@ void wxScrolledWindow::AdjustScrollbars() m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine; m_vAdjust->page_size = h / m_yScrollPixelsPerLine; m_vAdjust->page_increment = h / m_yScrollPixelsPerLine; - - if ((m_vAdjust->page_size < m_vAdjust->upper) && (h >= vh)) + + if ((m_vAdjust->page_size < m_vAdjust->upper) && (h >= vh)) m_vAdjust->page_size += 1.0; - if ((m_vAdjust->value != 0.0) && (m_vAdjust->value + m_vAdjust->page_size > m_vAdjust->upper)) + if ( !wxIsNullDouble(m_vAdjust->value) && + (m_vAdjust->value + m_vAdjust->page_size > m_vAdjust->upper) ) { m_vAdjust->value = m_vAdjust->upper - m_vAdjust->page_size; if (m_vAdjust->value < 0.0) m_vAdjust->value = 0.0; - + if (GetChildren().GetCount() == 0) - m_yScrollPosition = (int)m_vAdjust->value; + m_yScrollPosition = (int)m_vAdjust->value; else gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" ); } @@ -714,7 +717,7 @@ void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) co { int xs, ys; GetViewStart (& xs, & ys); - + if ( xx ) *xx = x - xs * m_xScrollPixelsPerLine; if ( yy ) @@ -725,7 +728,7 @@ void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) { int xs, ys; GetViewStart (& xs, & ys); - + if ( xx ) *xx = x + xs * m_xScrollPixelsPerLine; if ( yy ) @@ -916,7 +919,7 @@ void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) if ( m_targetWindow->GetAutoLayout() ) { wxSize size = m_targetWindow->GetBestVirtualSize(); - + // This will call ::Layout() and ::AdjustScrollbars() SetVirtualSize( size ); } -- 2.47.2