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