1. fixed typo ('&' instead of '|') in wxNotebook
2. changed wxTC_MULTILINE to be equal to wxNB_MULTILINE and != 0 3. much more efficient selection handling in virtual wxListCtrl, we can now select 1000000 items without problems 4. kbd/mouse selection (ctrl/shift handling) fixed in wxListCtrl 5. added wxSortedArray::IndexForInsert() and AddAt(), remove Remove(size_t), use RemoveAt() instead git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -182,37 +182,8 @@ int wxBaseArray::Index(long lItem, bool bFromEnd) const
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
// search for an item in a sorted array (binary search)
|
||||
int wxBaseArray::Index(long lItem, CMPFUNC fnCompare) const
|
||||
{
|
||||
size_t i,
|
||||
lo = 0,
|
||||
hi = m_nCount;
|
||||
int res;
|
||||
|
||||
while ( lo < hi ) {
|
||||
i = (lo + hi)/2;
|
||||
|
||||
res = (*fnCompare)((const void *)lItem, (const void *)m_pItems[i]);
|
||||
if ( res < 0 )
|
||||
hi = i;
|
||||
else if ( res > 0 )
|
||||
lo = i + 1;
|
||||
else
|
||||
return i;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
// add item at the end
|
||||
void wxBaseArray::Add(long lItem)
|
||||
{
|
||||
Grow();
|
||||
m_pItems[m_nCount++] = lItem;
|
||||
}
|
||||
|
||||
// add item assuming the array is sorted with fnCompare function
|
||||
void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
|
||||
// search for a place to insert an item into a sorted array (binary search)
|
||||
size_t wxBaseArray::IndexForInsert(long lItem, CMPFUNC fnCompare) const
|
||||
{
|
||||
size_t i,
|
||||
lo = 0,
|
||||
@@ -228,14 +199,33 @@ void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
|
||||
else if ( res > 0 )
|
||||
lo = i + 1;
|
||||
else {
|
||||
lo = hi = i;
|
||||
lo = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
wxASSERT( lo == hi ); // I hope I got binary search right :-)
|
||||
return lo;
|
||||
}
|
||||
|
||||
Insert(lItem, lo);
|
||||
// search for an item in a sorted array (binary search)
|
||||
int wxBaseArray::Index(long lItem, CMPFUNC fnCompare) const
|
||||
{
|
||||
size_t n = IndexForInsert(lItem, fnCompare);
|
||||
|
||||
return n < m_nCount && m_pItems[n] == lItem ? n : wxNOT_FOUND;
|
||||
}
|
||||
|
||||
// add item at the end
|
||||
void wxBaseArray::Add(long lItem)
|
||||
{
|
||||
Grow();
|
||||
m_pItems[m_nCount++] = lItem;
|
||||
}
|
||||
|
||||
// add item assuming the array is sorted with fnCompare function
|
||||
void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
|
||||
{
|
||||
Insert(lItem, IndexForInsert(lItem, fnCompare));
|
||||
}
|
||||
|
||||
// add item at the given position
|
||||
|
||||
@@ -120,7 +120,7 @@ wxNotebookPage *wxNotebookBase::DoRemovePage(int nPage)
|
||||
_T("invalid page index in wxNotebookBase::DoRemovePage()") );
|
||||
|
||||
wxNotebookPage *pageRemoved = m_pages[nPage];
|
||||
m_pages.Remove(nPage);
|
||||
m_pages.RemoveAt(nPage);
|
||||
|
||||
return pageRemoved;
|
||||
}
|
||||
|
||||
@@ -3022,7 +3022,7 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
|
||||
{
|
||||
for ( n = 0; n < numRows; n++ )
|
||||
{
|
||||
m_data.Remove( pos );
|
||||
m_data.RemoveAt( pos );
|
||||
}
|
||||
}
|
||||
if ( GetView() )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -315,7 +315,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
||||
{
|
||||
m_HistoryPos++;
|
||||
for (int i = 0; i < c; i++)
|
||||
m_History->Remove(m_HistoryPos);
|
||||
m_History->RemoveAt(m_HistoryPos);
|
||||
m_History->Add(new wxHtmlHistoryItem(m_OpenedPage, m_OpenedAnchor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ void wxCheckListBox::Delete(int N)
|
||||
// free memory
|
||||
delete m_aItems[N];
|
||||
|
||||
m_aItems.Remove(N);
|
||||
m_aItems.RemoveAt(N);
|
||||
}
|
||||
|
||||
void wxCheckListBox::InsertItems(int nItems, const wxString items[], int pos)
|
||||
|
||||
@@ -237,7 +237,7 @@ wxPaintDC::~wxPaintDC()
|
||||
{
|
||||
::EndPaint(GetHwndOf(m_canvas), &g_paintStruct);
|
||||
|
||||
ms_cache.Remove(index);
|
||||
ms_cache.RemoveAt(index);
|
||||
|
||||
// Reduce the number of bogus reports of non-freed memory
|
||||
// at app exit
|
||||
|
||||
@@ -172,7 +172,7 @@ void wxMenu::UpdateAccel(wxMenuItem *item)
|
||||
if ( accel )
|
||||
m_accels[n] = accel;
|
||||
else
|
||||
m_accels.Remove(n);
|
||||
m_accels.RemoveAt(n);
|
||||
}
|
||||
|
||||
if ( IsAttached() )
|
||||
@@ -317,7 +317,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
{
|
||||
delete m_accels[n];
|
||||
|
||||
m_accels.Remove(n);
|
||||
m_accels.RemoveAt(n);
|
||||
}
|
||||
//else: this item doesn't have an accel, nothing to do
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
@@ -161,7 +161,7 @@ bool wxNotebook::Create(wxWindow *parent,
|
||||
if ( m_windowStyle & wxTC_MULTILINE )
|
||||
tabStyle |= TCS_MULTILINE;
|
||||
if ( m_windowStyle & wxBORDER )
|
||||
tabStyle &= WS_BORDER;
|
||||
tabStyle |= WS_BORDER;
|
||||
if (m_windowStyle & wxNB_FIXEDWIDTH)
|
||||
tabStyle |= TCS_FIXEDWIDTH ;
|
||||
if (m_windowStyle & wxNB_BOTTOM)
|
||||
@@ -326,7 +326,7 @@ bool wxNotebook::DeletePage(int nPage)
|
||||
TabCtrl_DeleteItem(m_hwnd, nPage);
|
||||
|
||||
delete m_pages[nPage];
|
||||
m_pages.Remove(nPage);
|
||||
m_pages.RemoveAt(nPage);
|
||||
|
||||
if ( m_pages.IsEmpty() ) {
|
||||
// no selection if the notebook became empty
|
||||
|
||||
Reference in New Issue
Block a user