sfx2/source/dialog/backingwindow.cxx | 18 +++++++++++++++--- sfx2/source/dialog/backingwindow.hxx | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-)
New commits: commit 37cc33e27188a5686e15751c5bb39b422909f201 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Dec 3 17:40:24 2014 +0100 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 diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index f121c21..0e6a8bd 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -90,6 +90,7 @@ static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailV BackingWindow::BackingWindow( vcl::Window* i_pParent ) : Window( i_pParent ), mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ), + mbLocalViewInitialized(false), mbIsSaveMode( false ), mbInitControls( false ), mnHideExternalLinks( 0 ), @@ -259,10 +260,7 @@ void BackingWindow::initControls() //initialize Template view mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL); - mpLocalView->Populate(); - mpLocalView->showRootRegion(); mpLocalView->Hide(); - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); @@ -315,6 +313,17 @@ void BackingWindow::initControls() 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 ) { // the buttons should have a bit bigger font @@ -552,6 +561,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) else if( pButton == mpTemplateButton ) { mpAllRecentThumbnails->Hide(); + initializeLocalView(); mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpLocalView->Show(); mpLocalView->reload(); @@ -562,6 +572,8 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton ) { + initializeLocalView(); + OString sId = pButton->GetCurItemIdent(); if( sId == "filter_writer" ) diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 3c96626..aa6e498 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -87,6 +87,7 @@ class BackingWindow RecentDocsView* mpAllRecentThumbnails; TemplateDefaultView* mpLocalView; + bool mbLocalViewInitialized; std::vector<vcl::Window*> maDndWindows; @@ -119,6 +120,8 @@ class BackingWindow void initControls(); + void initializeLocalView(); + public: BackingWindow( vcl::Window* pParent ); virtual ~BackingWindow(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits