replace usage of objective-c keyword 'id'
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -49,83 +49,83 @@ wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1] = { 0 };
|
|||||||
wxWindowID gs_nextAutoId = wxID_AUTO_LOWEST;
|
wxWindowID gs_nextAutoId = wxID_AUTO_LOWEST;
|
||||||
|
|
||||||
// Reserve an ID
|
// Reserve an ID
|
||||||
void ReserveIdRefCount(wxWindowID id)
|
void ReserveIdRefCount(wxWindowID winid)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
|
wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST,
|
||||||
wxT("invalid id range"));
|
wxT("invalid id range"));
|
||||||
|
|
||||||
id -= wxID_AUTO_LOWEST;
|
winid -= wxID_AUTO_LOWEST;
|
||||||
|
|
||||||
wxCHECK_RET(gs_autoIdsRefCount[id] == ID_FREE,
|
wxCHECK_RET(gs_autoIdsRefCount[winid] == ID_FREE,
|
||||||
wxT("id already in use or already reserved"));
|
wxT("id already in use or already reserved"));
|
||||||
gs_autoIdsRefCount[id] = ID_RESERVED;
|
gs_autoIdsRefCount[winid] = ID_RESERVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unreserve and id
|
// Unreserve and id
|
||||||
void UnreserveIdRefCount(wxWindowID id)
|
void UnreserveIdRefCount(wxWindowID winid)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
|
wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST,
|
||||||
wxT("invalid id range"));
|
wxT("invalid id range"));
|
||||||
|
|
||||||
id -= wxID_AUTO_LOWEST;
|
winid -= wxID_AUTO_LOWEST;
|
||||||
|
|
||||||
wxCHECK_RET(gs_autoIdsRefCount[id] == ID_RESERVED,
|
wxCHECK_RET(gs_autoIdsRefCount[winid] == ID_RESERVED,
|
||||||
wxT("id already in use or not reserved"));
|
wxT("id already in use or not reserved"));
|
||||||
gs_autoIdsRefCount[id] = ID_FREE;
|
gs_autoIdsRefCount[winid] = ID_FREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the usage count of an id
|
// Get the usage count of an id
|
||||||
int GetIdRefCount(wxWindowID id)
|
int GetIdRefCount(wxWindowID winid)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST, 0,
|
wxCHECK_MSG(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST, 0,
|
||||||
wxT("invalid id range"));
|
wxT("invalid id range"));
|
||||||
|
|
||||||
id -= wxID_AUTO_LOWEST;
|
winid -= wxID_AUTO_LOWEST;
|
||||||
return gs_autoIdsRefCount[id];
|
return gs_autoIdsRefCount[winid];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the count for an id
|
// Increase the count for an id
|
||||||
void IncIdRefCount(wxWindowID id)
|
void IncIdRefCount(wxWindowID winid)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
|
wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST,
|
||||||
wxT("invalid id range"));
|
wxT("invalid id range"));
|
||||||
|
|
||||||
id -= wxID_AUTO_LOWEST;
|
winid -= wxID_AUTO_LOWEST;
|
||||||
|
|
||||||
wxCHECK_RET(gs_autoIdsRefCount[id] != ID_MAXCOUNT, wxT("id count at max"));
|
wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_MAXCOUNT, wxT("id count at max"));
|
||||||
wxCHECK_RET(gs_autoIdsRefCount[id] != ID_FREE, wxT("id should first be reserved"));
|
wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id should first be reserved"));
|
||||||
|
|
||||||
if(gs_autoIdsRefCount[id] == ID_RESERVED)
|
if(gs_autoIdsRefCount[winid] == ID_RESERVED)
|
||||||
gs_autoIdsRefCount[id] = ID_STARTCOUNT;
|
gs_autoIdsRefCount[winid] = ID_STARTCOUNT;
|
||||||
else
|
else
|
||||||
gs_autoIdsRefCount[id]++;
|
gs_autoIdsRefCount[winid]++;
|
||||||
|
|
||||||
wxLogTrace(wxTRACE_WINDOWID, wxT("Increasing ref count of ID %d to %d"),
|
wxLogTrace(wxTRACE_WINDOWID, wxT("Increasing ref count of ID %d to %d"),
|
||||||
id + wxID_AUTO_LOWEST, gs_autoIdsRefCount[id]);
|
winid + wxID_AUTO_LOWEST, gs_autoIdsRefCount[winid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrease the count for an id
|
// Decrease the count for an id
|
||||||
void DecIdRefCount(wxWindowID id)
|
void DecIdRefCount(wxWindowID winid)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
|
wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST,
|
||||||
wxT("invalid id range"));
|
wxT("invalid id range"));
|
||||||
|
|
||||||
id -= wxID_AUTO_LOWEST;
|
winid -= wxID_AUTO_LOWEST;
|
||||||
|
|
||||||
wxCHECK_RET(gs_autoIdsRefCount[id] != ID_FREE, wxT("id count already 0"));
|
wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id count already 0"));
|
||||||
|
|
||||||
// DecIdRefCount is only called on an ID that has been IncIdRefCount'ed'
|
// DecIdRefCount is only called on an ID that has been IncIdRefCount'ed'
|
||||||
// so it should never be reserved, but test anyway
|
// so it should never be reserved, but test anyway
|
||||||
if(gs_autoIdsRefCount[id] == ID_RESERVED)
|
if(gs_autoIdsRefCount[winid] == ID_RESERVED)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("reserve id being decreased"));
|
wxFAIL_MSG(wxT("reserve id being decreased"));
|
||||||
gs_autoIdsRefCount[id] = ID_FREE;
|
gs_autoIdsRefCount[winid] = ID_FREE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gs_autoIdsRefCount[id]--;
|
gs_autoIdsRefCount[winid]--;
|
||||||
|
|
||||||
wxLogTrace(wxTRACE_WINDOWID, wxT("Decreasing ref count of ID %d to %d"),
|
wxLogTrace(wxTRACE_WINDOWID, wxT("Decreasing ref count of ID %d to %d"),
|
||||||
id + wxID_AUTO_LOWEST, gs_autoIdsRefCount[id]);
|
winid + wxID_AUTO_LOWEST, gs_autoIdsRefCount[winid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // wxUSE_AUTOID_MANAGEMENT
|
#else // wxUSE_AUTOID_MANAGEMENT
|
||||||
@@ -139,15 +139,15 @@ static wxWindowID gs_nextAutoId = wxID_AUTO_HIGHEST;
|
|||||||
|
|
||||||
#if wxUSE_AUTOID_MANAGEMENT
|
#if wxUSE_AUTOID_MANAGEMENT
|
||||||
|
|
||||||
void wxWindowIDRef::Assign(wxWindowID id)
|
void wxWindowIDRef::Assign(wxWindowID winid)
|
||||||
{
|
{
|
||||||
if ( id != m_id )
|
if ( winid != m_id )
|
||||||
{
|
{
|
||||||
// decrease count if it is in the managed range
|
// decrease count if it is in the managed range
|
||||||
if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
|
if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
|
||||||
DecIdRefCount(m_id);
|
DecIdRefCount(m_id);
|
||||||
|
|
||||||
m_id = id;
|
m_id = winid;
|
||||||
|
|
||||||
// increase count if it is in the managed range
|
// increase count if it is in the managed range
|
||||||
if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
|
if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
|
||||||
@@ -167,22 +167,22 @@ wxWindowID wxIdManager::ReserveId(int count)
|
|||||||
#if wxUSE_AUTOID_MANAGEMENT
|
#if wxUSE_AUTOID_MANAGEMENT
|
||||||
if ( gs_nextAutoId + count - 1 <= wxID_AUTO_HIGHEST )
|
if ( gs_nextAutoId + count - 1 <= wxID_AUTO_HIGHEST )
|
||||||
{
|
{
|
||||||
wxWindowID id = gs_nextAutoId;
|
wxWindowID winid = gs_nextAutoId;
|
||||||
|
|
||||||
while(count--)
|
while(count--)
|
||||||
{
|
{
|
||||||
ReserveIdRefCount(gs_nextAutoId++);
|
ReserveIdRefCount(gs_nextAutoId++);
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return winid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
for(wxWindowID id = wxID_AUTO_LOWEST; id <= wxID_AUTO_HIGHEST; id++)
|
for(wxWindowID winid = wxID_AUTO_LOWEST; winid <= wxID_AUTO_HIGHEST; winid++)
|
||||||
{
|
{
|
||||||
if(GetIdRefCount(id) == 0)
|
if(GetIdRefCount(winid) == 0)
|
||||||
{
|
{
|
||||||
found++;
|
found++;
|
||||||
if(found == count)
|
if(found == count)
|
||||||
@@ -196,13 +196,13 @@ wxWindowID wxIdManager::ReserveId(int count)
|
|||||||
// called, and accorind to gs_nextAutoId, their are still
|
// called, and accorind to gs_nextAutoId, their are still
|
||||||
// 50 at the end so it returns them without testing the ref
|
// 50 at the end so it returns them without testing the ref
|
||||||
// To fix this, the next ID is also updated here as needed
|
// To fix this, the next ID is also updated here as needed
|
||||||
if(id >= gs_nextAutoId)
|
if(winid >= gs_nextAutoId)
|
||||||
gs_nextAutoId = id + 1;
|
gs_nextAutoId = winid + 1;
|
||||||
|
|
||||||
while(count--)
|
while(count--)
|
||||||
ReserveIdRefCount(id--);
|
ReserveIdRefCount(winid--);
|
||||||
|
|
||||||
return id + 1;
|
return winid + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -216,19 +216,19 @@ wxWindowID wxIdManager::ReserveId(int count)
|
|||||||
return wxID_NONE;
|
return wxID_NONE;
|
||||||
#else // !wxUSE_AUTOID_MANAGEMENT
|
#else // !wxUSE_AUTOID_MANAGEMENT
|
||||||
// Make sure enough in the range
|
// Make sure enough in the range
|
||||||
wxWindowID id;
|
wxWindowID winid;
|
||||||
|
|
||||||
id = gs_nextAutoId - count + 1;
|
winid = gs_nextAutoId - count + 1;
|
||||||
|
|
||||||
if ( id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST )
|
if ( winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST )
|
||||||
{
|
{
|
||||||
// There is enough, but it may be time to wrap
|
// There is enough, but it may be time to wrap
|
||||||
if(id == wxID_AUTO_LOWEST)
|
if(winid == wxID_AUTO_LOWEST)
|
||||||
gs_nextAutoId = wxID_AUTO_HIGHEST;
|
gs_nextAutoId = wxID_AUTO_HIGHEST;
|
||||||
else
|
else
|
||||||
gs_nextAutoId = id - 1;
|
gs_nextAutoId = winid - 1;
|
||||||
|
|
||||||
return id;
|
return winid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -241,15 +241,15 @@ wxWindowID wxIdManager::ReserveId(int count)
|
|||||||
#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
|
#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxIdManager::UnreserveId(wxWindowID id, int count)
|
void wxIdManager::UnreserveId(wxWindowID winid, int count)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(count > 0, wxT("can't unreserve less than 1 id"));
|
wxASSERT_MSG(count > 0, wxT("can't unreserve less than 1 id"));
|
||||||
|
|
||||||
#if wxUSE_AUTOID_MANAGEMENT
|
#if wxUSE_AUTOID_MANAGEMENT
|
||||||
while (count--)
|
while (count--)
|
||||||
UnreserveIdRefCount(id++);
|
UnreserveIdRefCount(winid++);
|
||||||
#else
|
#else
|
||||||
wxUnusedVar(id);
|
wxUnusedVar(winid);
|
||||||
wxUnusedVar(count);
|
wxUnusedVar(count);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -2159,35 +2159,35 @@ void wxPGMultiButton::Finalize( wxPropertyGrid* WXUNUSED(propGrid),
|
|||||||
Move( pos.x + m_fullEditorSize.x - m_buttonsWidth, pos.y );
|
Move( pos.x + m_fullEditorSize.x - m_buttonsWidth, pos.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxPGMultiButton::GenId( int id ) const
|
int wxPGMultiButton::GenId( int itemid ) const
|
||||||
{
|
{
|
||||||
if ( id < -1 )
|
if ( itemid < -1 )
|
||||||
{
|
{
|
||||||
if ( m_buttons.size() )
|
if ( m_buttons.size() )
|
||||||
id = GetButton(m_buttons.size()-1)->GetId() + 1;
|
itemid = GetButton(m_buttons.size()-1)->GetId() + 1;
|
||||||
else
|
else
|
||||||
id = wxPG_SUBID2;
|
itemid = wxPG_SUBID2;
|
||||||
}
|
}
|
||||||
return id;
|
return itemid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_BMPBUTTON
|
#if wxUSE_BMPBUTTON
|
||||||
void wxPGMultiButton::Add( const wxBitmap& bitmap, int id )
|
void wxPGMultiButton::Add( const wxBitmap& bitmap, int itemid )
|
||||||
{
|
{
|
||||||
id = GenId(id);
|
itemid = GenId(itemid);
|
||||||
wxSize sz = GetSize();
|
wxSize sz = GetSize();
|
||||||
wxButton* button = new wxBitmapButton( this, id, bitmap,
|
wxButton* button = new wxBitmapButton( this, itemid, bitmap,
|
||||||
wxPoint(sz.x, 0),
|
wxPoint(sz.x, 0),
|
||||||
wxSize(sz.y, sz.y) );
|
wxSize(sz.y, sz.y) );
|
||||||
DoAddButton( button, sz );
|
DoAddButton( button, sz );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void wxPGMultiButton::Add( const wxString& label, int id )
|
void wxPGMultiButton::Add( const wxString& label, int itemid )
|
||||||
{
|
{
|
||||||
id = GenId(id);
|
itemid = GenId(itemid);
|
||||||
wxSize sz = GetSize();
|
wxSize sz = GetSize();
|
||||||
wxButton* button = new wxButton( this, id, label, wxPoint(sz.x, 0),
|
wxButton* button = new wxButton( this, itemid, label, wxPoint(sz.x, 0),
|
||||||
wxSize(sz.y, sz.y) );
|
wxSize(sz.y, sz.y) );
|
||||||
DoAddButton( button, sz );
|
DoAddButton( button, sz );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user