Kaydet (Commit) 37cc33e2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Delay potentially expensive first-time template initialization

...from first start of soffice to first click on Templates button.  At least in
an --enable-dbgutil build (no idea whether it's substantially faster for a
"product" build) with lots of templates (--enable-extra-templates, --enable-sun-
templates) the UI still becomes unacceptabliy unrepsonsive when you clik on the
Templates button for the first time, though.

Change-Id: I226acaf26e20022b825478f47bb6a1f791c7c145
üst c52ac92a
...@@ -90,6 +90,7 @@ static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailV ...@@ -90,6 +90,7 @@ static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailV
BackingWindow::BackingWindow( vcl::Window* i_pParent ) : BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
Window( i_pParent ), Window( i_pParent ),
mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ), mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ),
mbLocalViewInitialized(false),
mbIsSaveMode( false ), mbIsSaveMode( false ),
mbInitControls( false ), mbInitControls( false ),
mnHideExternalLinks( 0 ), mnHideExternalLinks( 0 ),
...@@ -259,10 +260,7 @@ void BackingWindow::initControls() ...@@ -259,10 +260,7 @@ void BackingWindow::initControls()
//initialize Template view //initialize Template view
mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL); mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL);
mpLocalView->Populate();
mpLocalView->showRootRegion();
mpLocalView->Hide(); mpLocalView->Hide();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
...@@ -315,6 +313,17 @@ void BackingWindow::initControls() ...@@ -315,6 +313,17 @@ void BackingWindow::initControls()
set_height_request(mpAllButtonsBox->GetOptimalSize().Height()); set_height_request(mpAllButtonsBox->GetOptimalSize().Height());
} }
void BackingWindow::initializeLocalView()
{
if (!mbLocalViewInitialized)
{
mbLocalViewInitialized = true;
mpLocalView->Populate();
mpLocalView->showRootRegion();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
}
}
void BackingWindow::setupButton( PushButton* pButton ) void BackingWindow::setupButton( PushButton* pButton )
{ {
// the buttons should have a bit bigger font // the buttons should have a bit bigger font
...@@ -552,6 +561,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) ...@@ -552,6 +561,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
else if( pButton == mpTemplateButton ) else if( pButton == mpTemplateButton )
{ {
mpAllRecentThumbnails->Hide(); mpAllRecentThumbnails->Hide();
initializeLocalView();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE));
mpLocalView->Show(); mpLocalView->Show();
mpLocalView->reload(); mpLocalView->reload();
...@@ -562,6 +572,8 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) ...@@ -562,6 +572,8 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton ) IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
{ {
initializeLocalView();
OString sId = pButton->GetCurItemIdent(); OString sId = pButton->GetCurItemIdent();
if( sId == "filter_writer" ) if( sId == "filter_writer" )
......
...@@ -87,6 +87,7 @@ class BackingWindow ...@@ -87,6 +87,7 @@ class BackingWindow
RecentDocsView* mpAllRecentThumbnails; RecentDocsView* mpAllRecentThumbnails;
TemplateDefaultView* mpLocalView; TemplateDefaultView* mpLocalView;
bool mbLocalViewInitialized;
std::vector<vcl::Window*> maDndWindows; std::vector<vcl::Window*> maDndWindows;
...@@ -119,6 +120,8 @@ class BackingWindow ...@@ -119,6 +120,8 @@ class BackingWindow
void initControls(); void initControls();
void initializeLocalView();
public: public:
BackingWindow( vcl::Window* pParent ); BackingWindow( vcl::Window* pParent );
virtual ~BackingWindow(); virtual ~BackingWindow();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment