]> git.lyx.org Git - features.git/commitdiff
* QWidget::show is synchronous, hence we see the LyX logo for a moment, even if
authorStefan Schimanski <sts@lyx.org>
Fri, 14 Mar 2008 23:33:05 +0000 (23:33 +0000)
committerStefan Schimanski <sts@lyx.org>
Fri, 14 Mar 2008 23:33:05 +0000 (23:33 +0000)
  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

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h

index eac82e48431e03fe7c2ca1fe946798abc7f096da..9b6e1f6e37de14ee1c58e24761c5adf22675a535 100644 (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);
 }
 
index c6695cc131f66fcccf96babc69cea4bfd11c991d..436732856b2af83884a97abc89e538d048b85387 100644 (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_; }
        ///