The new SORT parameter for SelectViewType() and SelectDocumentType() sorted the displayed list, but the view/template returned as the one selected was corresponding to the template from the original unsorted list of templates.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1446,10 +1446,29 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
|
|||||||
if (templates[i]->IsVisible())
|
if (templates[i]->IsVisible())
|
||||||
{
|
{
|
||||||
strings.Add(templates[i]->m_description);
|
strings.Add(templates[i]->m_description);
|
||||||
|
if (!sort)
|
||||||
|
{
|
||||||
data[n] = templates[i];
|
data[n] = templates[i];
|
||||||
n ++;
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxDocTemplate *theTemplate;
|
wxDocTemplate *theTemplate;
|
||||||
|
|
||||||
@@ -1495,10 +1514,29 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
|
|||||||
if ( templ->IsVisible() && !templ->GetViewName().empty() )
|
if ( templ->IsVisible() && !templ->GetViewName().empty() )
|
||||||
{
|
{
|
||||||
strings.Add(templ->m_viewTypeName);
|
strings.Add(templ->m_viewTypeName);
|
||||||
|
if (!sort)
|
||||||
|
{
|
||||||
data[n] = templ;
|
data[n] = templ;
|
||||||
n ++;
|
n ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_viewTypeName)
|
||||||
|
data[i] = templates[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxDocTemplate *theTemplate;
|
wxDocTemplate *theTemplate;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user