- for (i = 0; i < noTemplates; i++)
- {
- if (templates[i]->IsVisible())
- {
- strings.Add(templates[i]->m_description);
- if (!sort)
- {
- data[n] = templates[i];
- n ++;
- }
- }
- } // for
-
- if (sort)
- {
- // Yes, this will be slow, but template lists
- // are typically short.
- int j;
- n = strings.Count();
- for (i = 0; i < n; i++)
- {
- for (j = 0; j < noTemplates; j++)
- {
- if (strings[i] == templates[j]->m_description)
- data[i] = templates[j];
- }
- }
- }
+
+ for (i = 0; i < noTemplates; i++)
+ {
+ if (templates[i]->IsVisible())
+ {
+ int j;
+ bool want = TRUE;
+ for (j = 0; j < n; j++)
+ {
+ //filter out NOT unique documents + view combinations
+ if ( templates[i]->m_docTypeName == data[j]->m_docTypeName &&
+ templates[i]->m_viewTypeName == data[j]->m_viewTypeName
+ )
+ want = FALSE;
+ }
+
+ if ( want )
+ {
+ strings.Add(templates[i]->m_description);
+
+ data[n] = templates[i];
+ n ++;
+ }
+ }
+ } // for
+
+ if (sort)
+ {
+ strings.Sort(wxStringSortAscending);
+ // Yes, this will be slow, but template lists
+ // are typically short.
+ int j;
+ n = strings.Count();
+ for (i = 0; i < n; i++)
+ {
+ for (j = 0; j < noTemplates; j++)
+ {
+ if (strings[i] == templates[j]->m_description)
+ data[i] = templates[j];
+ }
+ }
+ }