* QWidget::show is synchronous, hence we see the LyX logo for a moment, even if

in the next moment the new buffer appears. So we first create the buffer and
  then show the view.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23742 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-03-14 23:33:05 +00:00
parent 2aff4838f9
commit 09fe21bd11
2 changed files with 15 additions and 7 deletions

View File

@ -320,9 +320,13 @@ bool GuiApplication::dispatch(FuncRequest const & cmd)
case LFUN_BUFFER_NEW:
if (viewCount() == 0
|| (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0))
createView();
current_view_->newDocument(to_utf8(cmd.argument()), false);
|| (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) {
createView(QString(), false); // keep hidden
current_view_->newDocument(to_utf8(cmd.argument()), false);
current_view_->show();
setActiveWindow(current_view_);
} else
current_view_->newDocument(to_utf8(cmd.argument()), false);
break;
case LFUN_BUFFER_NEW_TEMPLATE:
@ -376,7 +380,7 @@ static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
}
void GuiApplication::createView(QString const & geometry_arg)
void GuiApplication::createView(QString const & geometry_arg, bool autoShow)
{
// release the keyboard which might have been grabed by the global
// menubar on Mac to catch shortcuts even without any GuiView.
@ -398,7 +402,11 @@ void GuiApplication::createView(QString const & geometry_arg)
views_[id] = view;
updateIds(views_, view_ids_);
view->show();
if (autoShow) {
view->show();
setActiveWindow(view);
}
if (!geometry_arg.isEmpty()) {
#ifdef Q_WS_WIN
int x, y;
@ -413,7 +421,6 @@ void GuiApplication::createView(QString const & geometry_arg)
#endif
}
view->setFocus();
setActiveWindow(view);
setCurrentView(*view);
}

View File

@ -89,7 +89,8 @@ public:
/// Create the main window with given geometry settings.
/// \param geometry_arg: only for Windows platform.
void createView(QString const & geometry_arg = QString());
void createView(QString const & geometry_arg = QString(),
bool autoShow = true);
///
GuiView const * currentView() const { return current_view_; }
///