Speed up wxHtmlHelpWindow startup time by freezing font choices.

Appending the names of all fonts could take a significant amount of time if
there were a lot of them, freeze the controls while doing it to speed it up.

Closes #15978.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-02-17 23:53:20 +00:00
parent 8e828674c4
commit 99d3a4f4d2

View File

@@ -55,6 +55,7 @@
#include "wx/fontenum.h"
#include "wx/artprov.h"
#include "wx/spinctrl.h"
#include "wx/wupdlock.h"
// what is considered "small index"?
#define INDEX_IS_SMALL 1000
@@ -1340,18 +1341,26 @@ void wxHtmlHelpWindow::OptionsDialog()
m_FixedFace = fnt.GetFaceName();
}
for (i = 0; i < m_NormalFonts->GetCount(); i++)
dlg.NormalFont->Append((*m_NormalFonts)[i]);
for (i = 0; i < m_FixedFonts->GetCount(); i++)
dlg.FixedFont->Append((*m_FixedFonts)[i]);
if (!m_NormalFace.empty())
dlg.NormalFont->SetStringSelection(m_NormalFace);
else
dlg.NormalFont->SetSelection(0);
if (!m_FixedFace.empty())
dlg.FixedFont->SetStringSelection(m_FixedFace);
else
dlg.FixedFont->SetSelection(0);
// Lock updates to the choice controls before inserting potentially many
// items into them until the end of this block.
{
wxWindowUpdateLocker lockNormalFont(dlg.NormalFont);
wxWindowUpdateLocker lockFixedFont(dlg.FixedFont);
for (i = 0; i < m_NormalFonts->GetCount(); i++)
dlg.NormalFont->Append((*m_NormalFonts)[i]);
for (i = 0; i < m_FixedFonts->GetCount(); i++)
dlg.FixedFont->Append((*m_FixedFonts)[i]);
if (!m_NormalFace.empty())
dlg.NormalFont->SetStringSelection(m_NormalFace);
else
dlg.NormalFont->SetSelection(0);
if (!m_FixedFace.empty())
dlg.FixedFont->SetStringSelection(m_FixedFace);
else
dlg.FixedFont->SetSelection(0);
}
dlg.FontSize->SetValue(m_FontSize);
dlg.UpdateTestWin();