summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2006-02-16 20:06:54 +0000
committerleo2006-02-16 20:06:54 +0000
commit60d58f37d89ecd0597dd7e279aeaef3e21495744 (patch)
tree5bfdc4ec59dc69e776cfab0c4f0ba4c714e7a1b7 /win
parentfd9079695f4e5de4f4e5f54a621a23c6e6f60de9 (diff)
Fixed sorting of patterned pieces in the pieces bar.
git-svn-id: http://svn.leocad.org/trunk@479 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Piecebar.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp
index 1975b2f..0a0c0f1 100644
--- a/win/Piecebar.cpp
+++ b/win/Piecebar.cpp
@@ -1051,7 +1051,10 @@ BOOL CPiecesBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
Lib->GetCategoryEntries(CategoryIndex, true, SinglePieces, GroupedPieces);
+ // Merge and sort the arrays.
+ SinglePieces += GroupedPieces;
SinglePieces.Sort(PiecesSortFunc, NULL);
+
for (i = 0; i < SinglePieces.GetSize(); i++)
{
PieceInfo* Info = SinglePieces[i];
@@ -1059,18 +1062,10 @@ BOOL CPiecesBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
if (!m_bSubParts && Info->IsSubPiece())
continue;
- m_PiecesTree.InsertItem(TVIF_PARAM|TVIF_TEXT, Info->m_strDescription, 0, 0, 0, 0, (LPARAM)Info, CategoryItem, TVI_LAST);
- }
-
- GroupedPieces.Sort(PiecesSortFunc, NULL);
- for (i = 0; i < GroupedPieces.GetSize(); i++)
- {
- PieceInfo* Info = GroupedPieces[i];
-
- if (!m_bSubParts && Info->IsSubPiece())
- continue;
-
- m_PiecesTree.InsertItem(TVIF_CHILDREN|TVIF_PARAM|TVIF_TEXT, Info->m_strDescription, 0, 0, 0, 0, (LPARAM)Info, CategoryItem, TVI_LAST);
+ if (GroupedPieces.FindIndex(Info) == -1)
+ m_PiecesTree.InsertItem(TVIF_PARAM|TVIF_TEXT, Info->m_strDescription, 0, 0, 0, 0, (LPARAM)Info, CategoryItem, TVI_LAST);
+ else
+ m_PiecesTree.InsertItem(TVIF_CHILDREN|TVIF_PARAM|TVIF_TEXT, Info->m_strDescription, 0, 0, 0, 0, (LPARAM)Info, CategoryItem, TVI_LAST);
}
}