fixed variable shadowing icc warnings

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-09-26 00:29:42 +00:00
parent 8226a05440
commit 4e115ed2c7
18 changed files with 161 additions and 178 deletions

View File

@@ -445,9 +445,9 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
#if wxUSE_CONFIG && wxUSE_FILECONFIG #if wxUSE_CONFIG && wxUSE_FILECONFIG
// remember this in the config // remember this in the config
wxFontMapperPathChanger path(this, wxFontMapperPathChanger path2(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH); FONTMAPPER_FONT_FROM_ENCODING_PATH);
if ( path.IsOk() ) if ( path2.IsOk() )
{ {
GetConfig()->Write(configEntry, info->ToString()); GetConfig()->Write(configEntry, info->ToString());
} }
@@ -464,9 +464,9 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
// //
// remember it to avoid asking the same question again later // remember it to avoid asking the same question again later
#if wxUSE_CONFIG && wxUSE_FILECONFIG #if wxUSE_CONFIG && wxUSE_FILECONFIG
wxFontMapperPathChanger path(this, wxFontMapperPathChanger path2(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH); FONTMAPPER_FONT_FROM_ENCODING_PATH);
if ( path.IsOk() ) if ( path2.IsOk() )
{ {
GetConfig()->Write GetConfig()->Write
( (

View File

@@ -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 p3 = rotated_point (GetWidth(), 0, cos_angle, sin_angle, p0);
wxRealPoint p4 = rotated_point (GetWidth(), GetHeight(), 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 x1a = (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 y1a = (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 x2a = (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 y2a = (int) ceil (wxMax (wxMax(p1.y, p2.y), wxMax(p3.y, p4.y)));
// Create rotated image // Create rotated image
wxImage rotated (x2 - x1 + 1, y2 - y1 + 1, false); wxImage rotated (x2a - x1a + 1, y2a - y1a + 1, false);
// With alpha channel // With alpha channel
if (has_alpha) if (has_alpha)
rotated.SetAlpha(); rotated.SetAlpha();
if (offset_after_rotation != NULL) 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 // 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++) 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 && if (-0.25 < src.x && src.x < GetWidth() - 0.75 &&
-0.25 < src.y && src.y < GetHeight() - 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 // interpolate using the 4 enclosing grid-points. Those
// points can be obtained using floor and ceiling of the // points can be obtained using floor and ceiling of the
// exact coordinates of the point // 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; int x1, y1, x2, y2;
if (0 < src.x && src.x < GetWidth() - 1) 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; *(dst++) = *p;
if (has_alpha) if (has_alpha)
{ *(alpha_dst++) = *(alpha[y1] + x1);
unsigned char *p = alpha[y1] + x1;
*(alpha_dst++) = *p;
}
} }
else if (d2 < gs_Epsilon) else if (d2 < gs_Epsilon)
{ {
@@ -2302,10 +2297,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
*(dst++) = *p; *(dst++) = *p;
if (has_alpha) if (has_alpha)
{ *(alpha_dst++) = *(alpha[y1] + x2);
unsigned char *p = alpha[y1] + x2;
*(alpha_dst++) = *p;
}
} }
else if (d3 < gs_Epsilon) else if (d3 < gs_Epsilon)
{ {
@@ -2315,10 +2307,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
*(dst++) = *p; *(dst++) = *p;
if (has_alpha) if (has_alpha)
{ *(alpha_dst++) = *(alpha[y2] + x2);
unsigned char *p = alpha[y2] + x2;
*(alpha_dst++) = *p;
}
} }
else if (d4 < gs_Epsilon) else if (d4 < gs_Epsilon)
{ {
@@ -2328,10 +2317,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
*(dst++) = *p; *(dst++) = *p;
if (has_alpha) if (has_alpha)
{ *(alpha_dst++) = *(alpha[y2] + x1);
unsigned char *p = alpha[y2] + x1;
*(alpha_dst++) = *p;
}
} }
else else
{ {
@@ -2360,10 +2346,10 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
if (has_alpha) if (has_alpha)
{ {
unsigned char *v1 = alpha[y1] + (x1); v1 = alpha[y1] + (x1);
unsigned char *v2 = alpha[y1] + (x2); v2 = alpha[y1] + (x2);
unsigned char *v3 = alpha[y2] + (x2); v3 = alpha[y2] + (x2);
unsigned char *v4 = alpha[y2] + (x1); v4 = alpha[y2] + (x1);
*(alpha_dst++) = (unsigned char) *(alpha_dst++) = (unsigned char)
( (w1 * *v1 + w2 * *v2 + ( (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++) 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 xs = wxCint (src.x); // wxCint rounds to the
const int ys = wxCint (src.y); // closest integer 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; *(dst++) = *p;
if (has_alpha) if (has_alpha)
{ *(alpha_dst++) = *(alpha[ys] + (xs));
unsigned char *p = alpha[ys] + (xs);
*(alpha_dst++) = *p;
}
} }
else else
{ {

View File

@@ -401,14 +401,14 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
wxToolBarToolsList::compatibility_iterator nodeNext = node->GetNext(); wxToolBarToolsList::compatibility_iterator nodeNext = node->GetNext();
while ( nodeNext ) 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; break;
if ( tool->Toggle(false) ) if ( toolNext->Toggle(false) )
{ {
DoToggleTool(tool, false); DoToggleTool(toolNext, false);
} }
nodeNext = nodeNext->GetNext(); nodeNext = nodeNext->GetNext();
@@ -417,14 +417,14 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious();
while ( nodePrev ) 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; break;
if ( tool->Toggle(false) ) if ( toolNext->Toggle(false) )
{ {
DoToggleTool(tool, false); DoToggleTool(toolNext, false);
} }
nodePrev = nodePrev->GetPrevious(); nodePrev = nodePrev->GetPrevious();

View File

@@ -1414,9 +1414,9 @@ void wxCalendarCtrl::OnClick(wxMouseEvent& event)
case wxCAL_HITTEST_HEADER: case wxCAL_HITTEST_HEADER:
{ {
wxCalendarEvent event(this, wxEVT_CALENDAR_WEEKDAY_CLICKED); wxCalendarEvent eventWd(this, wxEVT_CALENDAR_WEEKDAY_CLICKED);
event.m_wday = wday; eventWd.m_wday = wday;
(void)GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(eventWd);
} }
break; break;

View File

@@ -1075,7 +1075,6 @@ void wxPostScriptDC::SetPen( const wxPen& pen )
double bluePS = (double)(blue) / 255.0; double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0; double greenPS = (double)(green) / 255.0;
char buffer[100];
sprintf( buffer, sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n", "%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS ); redPS, greenPS, bluePS );
@@ -1352,7 +1351,6 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
{ {
wxCoord uy = (wxCoord)(y + size - m_underlinePosition); wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
wxCoord w, h; wxCoord w, h;
char buffer[100];
GetTextExtent(text, &w, &h); GetTextExtent(text, &w, &h);
sprintf( buffer, sprintf( buffer,

View File

@@ -830,8 +830,6 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
// Now do the filenames -- but only if we're allowed to // Now do the filenames -- but only if we're allowed to
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
{ {
wxLogNull log;
d.Open(dirName); d.Open(dirName);
if (d.IsOpened()) if (d.IsOpened())
@@ -865,7 +863,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
size_t i; size_t i;
for (i = 0; i < dirs.Count(); i++) for (i = 0; i < dirs.Count(); i++)
{ {
wxString eachFilename(dirs[i]); eachFilename = dirs[i];
path = dirName; path = dirName;
if (!wxEndsWithPathSeparator(path)) if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH); path += wxString(wxFILE_SEP_PATH);
@@ -894,7 +892,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
{ {
for (i = 0; i < filenames.Count(); i++) for (i = 0; i < filenames.Count(); i++)
{ {
wxString eachFilename(filenames[i]); eachFilename = filenames[i];
path = dirName; path = dirName;
if (!wxEndsWithPathSeparator(path)) if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH); path += wxString(wxFILE_SEP_PATH);
@@ -997,48 +995,46 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
if (id.IsOk()) if (id.IsOk())
lastId = id; lastId = id;
} }
if (lastId.IsOk()) if (!lastId.IsOk())
{ return false;
wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId);
if (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())
{
wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
if (data && data->m_path != wxEmptyString && !data->m_isDir) wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId);
{ if (data->m_isDir)
m_treeCtrl->SelectItem(childId); {
m_treeCtrl->EnsureVisible(childId); m_treeCtrl->Expand(lastId);
selectedChild = true; }
break; if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
} {
childId = m_treeCtrl->GetNextChild(lastId, cookie); // Find the first file in this directory
} wxTreeItemIdValue cookie;
if (!selectedChild) wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
bool selectedChild = false;
while (childId.IsOk())
{
data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
if (data && data->m_path != wxEmptyString && !data->m_isDir)
{ {
m_treeCtrl->SelectItem(lastId); m_treeCtrl->SelectItem(childId);
m_treeCtrl->EnsureVisible(lastId); m_treeCtrl->EnsureVisible(childId);
selectedChild = true;
break;
} }
childId = m_treeCtrl->GetNextChild(lastId, cookie);
} }
else if (!selectedChild)
{ {
m_treeCtrl->SelectItem(lastId); m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId); m_treeCtrl->EnsureVisible(lastId);
} }
return true;
} }
else else
return false; {
m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId);
}
return true;
} }
wxString wxGenericDirCtrl::GetPath() const wxString wxGenericDirCtrl::GetPath() const

View File

@@ -5021,7 +5021,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
// //
else if (event.LeftDClick() ) else if (event.LeftDClick() )
{ {
int row = YToEdgeOfRow(y); row = YToEdgeOfRow(y);
if ( row < 0 ) if ( row < 0 )
{ {
row = YToRow(y); row = YToRow(y);
@@ -5245,7 +5245,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
// //
if ( event.LeftDClick() ) if ( event.LeftDClick() )
{ {
int col = XToEdgeOfCol(x); col = XToEdgeOfCol(x);
if ( col < 0 ) if ( col < 0 )
{ {
col = XToCol(x); col = XToCol(x);

View File

@@ -87,7 +87,7 @@ bool wxGridSelection::IsInSelection ( int row, int col )
// (unless we are in column selection mode). // (unless we are in column selection mode).
if ( m_selectionMode != wxGrid::wxGridSelectColumns ) if ( m_selectionMode != wxGrid::wxGridSelectColumns )
{ {
size_t count = m_rowSelection.GetCount(); count = m_rowSelection.GetCount();
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
if ( row == m_rowSelection[n] ) if ( row == m_rowSelection[n] )
@@ -100,7 +100,7 @@ bool wxGridSelection::IsInSelection ( int row, int col )
// (unless we are in row selection mode). // (unless we are in row selection mode).
if ( m_selectionMode != wxGrid::wxGridSelectRows ) if ( m_selectionMode != wxGrid::wxGridSelectRows )
{ {
size_t count = m_colSelection.GetCount(); count = m_colSelection.GetCount();
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
if ( col == m_colSelection[n] ) if ( col == m_colSelection[n] )
@@ -595,8 +595,8 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
count = m_cellSelection.GetCount(); count = m_cellSelection.GetCount();
for ( n = 0; n < count; n++ ) for ( n = 0; n < count; n++ )
{ {
wxGridCellCoords& coords = m_cellSelection[n]; const wxGridCellCoords& sel = m_cellSelection[n];
if ( row == coords.GetRow() && col == coords.GetCol() ) if ( row == sel.GetRow() && col == sel.GetCol() )
{ {
wxGridCellCoords coords = m_cellSelection[n]; wxGridCellCoords coords = m_cellSelection[n];
m_cellSelection.RemoveAt(n); m_cellSelection.RemoveAt(n);

View File

@@ -276,11 +276,11 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
dragRect = wxRect(x, y, newWidth, newHeight); dragRect = wxRect(x, y, newWidth, newHeight);
wxSashEvent event(GetId(), edge); wxSashEvent eventSash(GetId(), edge);
event.SetEventObject(this); eventSash.SetEventObject(this);
event.SetDragStatus(status); eventSash.SetDragStatus(status);
event.SetDragRect(dragRect); eventSash.SetDragRect(dragRect);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(eventSash);
} }
else if ( event.LeftUp() ) else if ( event.LeftUp() )
{ {

View File

@@ -292,9 +292,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
m_windowOne = m_windowTwo; m_windowOne = m_windowTwo;
m_windowTwo = (wxWindow *) NULL; m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow); OnUnsplit(removedWindow);
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
event.m_data.win = removedWindow; eventUnsplit.m_data.win = removedWindow;
(void)DoSendEvent(event); (void)DoSendEvent(eventUnsplit);
SetSashPositionAndNotify(0); SetSashPositionAndNotify(0);
} }
else if ( posSashNew == GetWindowSize() ) else if ( posSashNew == GetWindowSize() )
@@ -303,9 +303,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
wxWindow *removedWindow = m_windowTwo; wxWindow *removedWindow = m_windowTwo;
m_windowTwo = (wxWindow *) NULL; m_windowTwo = (wxWindow *) NULL;
OnUnsplit(removedWindow); OnUnsplit(removedWindow);
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
event.m_data.win = removedWindow; eventUnsplit.m_data.win = removedWindow;
(void)DoSendEvent(event); (void)DoSendEvent(eventUnsplit);
SetSashPositionAndNotify(0); SetSashPositionAndNotify(0);
} }
else else

View File

@@ -2696,23 +2696,23 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
wxRect ItemRect; wxRect ItemRect;
GetBoundingRect(m_current, ItemRect, true); GetBoundingRect(m_current, ItemRect, true);
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() ); wxTreeEvent eventMenu( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() );
event.m_item = m_current; eventMenu.m_item = m_current;
// Use the left edge, vertical middle // Use the left edge, vertical middle
event.m_pointDrag = wxPoint(ItemRect.GetX(), eventMenu.m_pointDrag = wxPoint(ItemRect.GetX(),
ItemRect.GetY() + ItemRect.GetHeight() / 2); ItemRect.GetY() + ItemRect.GetHeight() / 2);
event.SetEventObject( this ); eventMenu.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( eventMenu );
break; break;
} }
case ' ': case ' ':
case WXK_RETURN: case WXK_RETURN:
if ( !event.HasModifiers() ) if ( !event.HasModifiers() )
{ {
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); wxTreeEvent eventAct( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
event.m_item = m_current; eventAct.m_item = m_current;
event.SetEventObject( this ); eventAct.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( eventAct );
} }
// in any case, also generate the normal key event for this key, // 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 // 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; eventEndDrag.m_item = item;
event.m_pointDrag = pt; eventEndDrag.m_pointDrag = pt;
event.SetEventObject(this); eventEndDrag.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(eventEndDrag);
m_isDragging = false; m_isDragging = false;
m_dropTarget = (wxGenericTreeItem *)NULL; m_dropTarget = (wxGenericTreeItem *)NULL;

View File

@@ -577,7 +577,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event)
void wxVListBox::OnLeftDown(wxMouseEvent& event) void wxVListBox::OnLeftDown(wxMouseEvent& event)
{ {
SetFocus(); SetFocus();
int item = HitTest(event.GetPosition()); int item = HitTest(event.GetPosition());
if ( item != wxNOT_FOUND ) 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 ) if ( item != wxNOT_FOUND )
{ {
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId()); wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId());

View File

@@ -1133,15 +1133,15 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
if (is_mono) if (is_mono)
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 );
GdkGC *gc = gdk_gc_new( bitmap ); GdkGC *gc = gdk_gc_new( bitmap2 );
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
gdk_gc_set_background( gc, m_textBackgroundColour.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 ); gdk_gc_unref( gc );
#else #else
gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 );

View File

@@ -558,20 +558,20 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
wxMenu* menu = node->GetData(); wxMenu* menu = node->GetData();
wxString str( wxReplaceUnderscore( label ) ); const wxString str( wxReplaceUnderscore( label ) );
menu->SetTitle( str ); menu->SetTitle( str );
if (menu->m_owner) 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 */ /* set new text */
gtk_label_set( label, wxGTK_CONV( str ) ); gtk_label_set( glabel, wxGTK_CONV( str ) );
/* reparse key accel */ /* reparse key accel */
(void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( str ) ); (void)gtk_label_parse_uline (GTK_LABEL(glabel), wxGTK_CONV( str ) );
gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); gtk_accel_label_refetch( GTK_ACCEL_LABEL(glabel) );
} }
} }

View File

@@ -29,6 +29,7 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/sizer.h" #include "wx/sizer.h"
#include "wx/math.h"
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#include "wx/gtk/win_gtk.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 (g_blockEventsOnDrag) return;
if (!win->m_hasVMT) return; if (!win->m_hasVMT) return;
win->GtkVScroll( adjust->value, win->GtkVScroll( adjust->value,
GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) );
} }
@@ -316,7 +317,7 @@ bool wxScrolledWindow::Create(wxWindow *parent,
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
} }
@@ -397,7 +398,7 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY,
{ {
int xs, ys; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
int old_x = m_xScrollPixelsPerLine * xs; int old_x = m_xScrollPixelsPerLine * xs;
int old_y = m_yScrollPixelsPerLine * ys; int old_y = m_yScrollPixelsPerLine * ys;
@@ -432,7 +433,7 @@ void wxScrolledWindow::AdjustScrollbars()
m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetClientSize( &w, &h );
m_targetWindow->GetVirtualSize( &vw, &vh ); m_targetWindow->GetVirtualSize( &vw, &vh );
if (m_xScrollPixelsPerLine == 0) if (m_xScrollPixelsPerLine == 0)
{ {
m_hAdjust->upper = 1.0; m_hAdjust->upper = 1.0;
@@ -447,19 +448,20 @@ void wxScrolledWindow::AdjustScrollbars()
// Special case. When client and virtual size are very close but // Special case. When client and virtual size are very close but
// the client is big enough, kill scrollbar. // 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; m_hAdjust->page_size += 1.0;
// If the scrollbar hits the right side, move the window // If the scrollbar hits the right side, move the window
// right to keep it from over extending. // 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; m_hAdjust->value = m_hAdjust->upper - m_hAdjust->page_size;
if (m_hAdjust->value < 0.0) if (m_hAdjust->value < 0.0)
m_hAdjust->value = 0.0; m_hAdjust->value = 0.0;
if (GetChildren().GetCount() == 0) if (GetChildren().GetCount() == 0)
m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows
else else
@@ -478,18 +480,19 @@ void wxScrolledWindow::AdjustScrollbars()
m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine; m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine;
m_vAdjust->page_size = h / m_yScrollPixelsPerLine; m_vAdjust->page_size = h / m_yScrollPixelsPerLine;
m_vAdjust->page_increment = 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; 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; m_vAdjust->value = m_vAdjust->upper - m_vAdjust->page_size;
if (m_vAdjust->value < 0.0) if (m_vAdjust->value < 0.0)
m_vAdjust->value = 0.0; m_vAdjust->value = 0.0;
if (GetChildren().GetCount() == 0) if (GetChildren().GetCount() == 0)
m_yScrollPosition = (int)m_vAdjust->value; m_yScrollPosition = (int)m_vAdjust->value;
else else
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" ); 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; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
if ( xx ) if ( xx )
*xx = x - xs * m_xScrollPixelsPerLine; *xx = x - xs * m_xScrollPixelsPerLine;
if ( yy ) if ( yy )
@@ -725,7 +728,7 @@ void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy)
{ {
int xs, ys; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
if ( xx ) if ( xx )
*xx = x + xs * m_xScrollPixelsPerLine; *xx = x + xs * m_xScrollPixelsPerLine;
if ( yy ) if ( yy )
@@ -916,7 +919,7 @@ void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event))
if ( m_targetWindow->GetAutoLayout() ) if ( m_targetWindow->GetAutoLayout() )
{ {
wxSize size = m_targetWindow->GetBestVirtualSize(); wxSize size = m_targetWindow->GetBestVirtualSize();
// This will call ::Layout() and ::AdjustScrollbars() // This will call ::Layout() and ::AdjustScrollbars()
SetVirtualSize( size ); SetVirtualSize( size );
} }

View File

@@ -1133,15 +1133,15 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
if (is_mono) if (is_mono)
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
GdkPixmap *bitmap = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 ); GdkPixmap *bitmap2 = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, -1 );
GdkGC *gc = gdk_gc_new( bitmap ); GdkGC *gc = gdk_gc_new( bitmap2 );
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() ); gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
gdk_gc_set_background( gc, m_textBackgroundColour.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 ); gdk_gc_unref( gc );
#else #else
gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 );

View File

@@ -558,20 +558,20 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
wxMenu* menu = node->GetData(); wxMenu* menu = node->GetData();
wxString str( wxReplaceUnderscore( label ) ); const wxString str( wxReplaceUnderscore( label ) );
menu->SetTitle( str ); menu->SetTitle( str );
if (menu->m_owner) 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 */ /* set new text */
gtk_label_set( label, wxGTK_CONV( str ) ); gtk_label_set( glabel, wxGTK_CONV( str ) );
/* reparse key accel */ /* reparse key accel */
(void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( str ) ); (void)gtk_label_parse_uline (GTK_LABEL(glabel), wxGTK_CONV( str ) );
gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); gtk_accel_label_refetch( GTK_ACCEL_LABEL(glabel) );
} }
} }

View File

@@ -29,6 +29,7 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/sizer.h" #include "wx/sizer.h"
#include "wx/math.h"
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#include "wx/gtk/win_gtk.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 (g_blockEventsOnDrag) return;
if (!win->m_hasVMT) return; if (!win->m_hasVMT) return;
win->GtkVScroll( adjust->value, win->GtkVScroll( adjust->value,
GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) );
} }
@@ -316,7 +317,7 @@ bool wxScrolledWindow::Create(wxWindow *parent,
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
} }
@@ -397,7 +398,7 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY,
{ {
int xs, ys; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
int old_x = m_xScrollPixelsPerLine * xs; int old_x = m_xScrollPixelsPerLine * xs;
int old_y = m_yScrollPixelsPerLine * ys; int old_y = m_yScrollPixelsPerLine * ys;
@@ -432,7 +433,7 @@ void wxScrolledWindow::AdjustScrollbars()
m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetClientSize( &w, &h );
m_targetWindow->GetVirtualSize( &vw, &vh ); m_targetWindow->GetVirtualSize( &vw, &vh );
if (m_xScrollPixelsPerLine == 0) if (m_xScrollPixelsPerLine == 0)
{ {
m_hAdjust->upper = 1.0; m_hAdjust->upper = 1.0;
@@ -447,19 +448,20 @@ void wxScrolledWindow::AdjustScrollbars()
// Special case. When client and virtual size are very close but // Special case. When client and virtual size are very close but
// the client is big enough, kill scrollbar. // 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; m_hAdjust->page_size += 1.0;
// If the scrollbar hits the right side, move the window // If the scrollbar hits the right side, move the window
// right to keep it from over extending. // 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; m_hAdjust->value = m_hAdjust->upper - m_hAdjust->page_size;
if (m_hAdjust->value < 0.0) if (m_hAdjust->value < 0.0)
m_hAdjust->value = 0.0; m_hAdjust->value = 0.0;
if (GetChildren().GetCount() == 0) if (GetChildren().GetCount() == 0)
m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows m_xScrollPosition = (int)m_hAdjust->value; // This is enough without child windows
else else
@@ -478,18 +480,19 @@ void wxScrolledWindow::AdjustScrollbars()
m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine; m_vAdjust->upper = (vh+m_yScrollPixelsPerLine-1) / m_yScrollPixelsPerLine;
m_vAdjust->page_size = h / m_yScrollPixelsPerLine; m_vAdjust->page_size = h / m_yScrollPixelsPerLine;
m_vAdjust->page_increment = 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; 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; m_vAdjust->value = m_vAdjust->upper - m_vAdjust->page_size;
if (m_vAdjust->value < 0.0) if (m_vAdjust->value < 0.0)
m_vAdjust->value = 0.0; m_vAdjust->value = 0.0;
if (GetChildren().GetCount() == 0) if (GetChildren().GetCount() == 0)
m_yScrollPosition = (int)m_vAdjust->value; m_yScrollPosition = (int)m_vAdjust->value;
else else
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" ); 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; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
if ( xx ) if ( xx )
*xx = x - xs * m_xScrollPixelsPerLine; *xx = x - xs * m_xScrollPixelsPerLine;
if ( yy ) if ( yy )
@@ -725,7 +728,7 @@ void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy)
{ {
int xs, ys; int xs, ys;
GetViewStart (& xs, & ys); GetViewStart (& xs, & ys);
if ( xx ) if ( xx )
*xx = x + xs * m_xScrollPixelsPerLine; *xx = x + xs * m_xScrollPixelsPerLine;
if ( yy ) if ( yy )
@@ -916,7 +919,7 @@ void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event))
if ( m_targetWindow->GetAutoLayout() ) if ( m_targetWindow->GetAutoLayout() )
{ {
wxSize size = m_targetWindow->GetBestVirtualSize(); wxSize size = m_targetWindow->GetBestVirtualSize();
// This will call ::Layout() and ::AdjustScrollbars() // This will call ::Layout() and ::AdjustScrollbars()
SetVirtualSize( size ); SetVirtualSize( size );
} }