]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxListCtrl::Insert() bug reported by Riccardo Cohen
authorRobert Roebling <robert@roebling.de>
Mon, 20 Oct 2008 11:33:58 +0000 (11:33 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 20 Oct 2008 11:33:58 +0000 (11:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/listctrl_mac.cpp
src/osx/carbon/utils.cpp

index a933d4ad0e9e0ee23a8be49609d73277b6156d8f..fb89dc344ca029e082afda45e820346fc95f051e 100644 (file)
@@ -3107,11 +3107,12 @@ Boolean wxMacDataBrowserListCtrlControl::CompareItems(DataBrowserItemID itemOneI
             wxMacListCtrlItem* otherItem = (wxMacListCtrlItem*)itemTwoID;
 
             itemOrder = item->GetOrder();
-            otherItemOrder = item->GetOrder();
+            otherItemOrder = otherItem->GetOrder();
 
             wxListCtrlCompare func = list->GetCompareFunc();
             if (func != NULL)
             {
+
                 long item1 = -1;
                 long item2 = -1;
                 if (item && item->HasColumnInfo(0))
index e1dd4bcf7d27a4830cb83646c5a6d519a3e71fde..e22569821c2700c5b05183fbff66ad47e9a969f7 100644 (file)
@@ -1038,10 +1038,9 @@ void wxMacDataItemBrowserControl::MacDelete( unsigned int n )
 
 void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item)
 {
-    SInt32 frontLineOrder = 0;
-
     if ( m_sortOrder == SortOrder_None )
     {
+        
         // increase the order of the lines to be shifted
         unsigned int lines = MacGetCount();
         for ( unsigned int i = n; i < lines; ++i)
@@ -1049,22 +1048,21 @@ void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item
             wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i);
             iter->SetOrder( iter->GetOrder() + 1 );
         }
+     
+#if 0
+        // I don't understand what this code is supposed to do, RR.
+        SInt32 frontLineOrder = 0;
         if ( n > 0 )
         {
             wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1);
-            frontLineOrder = iter->GetOrder();
+            frontLineOrder = iter->GetOrder()+1;
         }
+#else   
+        item->SetOrder( n );
+#endif
     }
 
-    wxArrayMacDataItemPtr ids;
-    ids.SetCount( 1 );
-
-    if ( m_sortOrder == SortOrder_None )
-        item->SetOrder( frontLineOrder + 1 );
-
-    ids[0] = item;
-
-    AddItems( wxMacDataBrowserRootContainer, ids );
+    AddItem( wxMacDataBrowserRootContainer, item );
 }
 
 void wxMacDataItemBrowserControl::MacClear()