]> git.lyx.org Git - features.git/commitdiff
Introducing LFUN_SPLIT_VIEW
authorAbdelrazak Younes <younes@lyx.org>
Wed, 20 Feb 2008 21:46:49 +0000 (21:46 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 20 Feb 2008 21:46:49 +0000 (21:46 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23084 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXAction.cpp
src/LyXFunc.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h
src/frontends/qt4/GuiWorkArea.cpp
src/lfuns.h

index e00f3be2f55db064170e733361860adb2f2ef03d..440471a8d460a1358fea1fd65d81d1a36834f4e2 100644 (file)
@@ -1140,6 +1140,8 @@ void LyXAction::init()
                { LFUN_WINDOW_NEW, "window-new", NoBuffer, Buffer },
                { LFUN_WINDOW_CLOSE, "window-close", NoBuffer, Buffer },
 
+               { LFUN_SPLIT_VIEW, "split-view", ReadOnly, Buffer },
+
                { LFUN_DIALOG_SHOW, "dialog-show", NoBuffer, Edit },
                { LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-new-inset", Noop, Edit },
                { LFUN_DIALOG_UPDATE, "dialog-update", NoBuffer, Edit },
index 626d2079c1516d2fc6e78ba8ebdf6da4d376c872..9c37060493b5e70cb609c5e3d5ba5285792201a8 100644 (file)
@@ -452,6 +452,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_INSET_APPLY:
        case LFUN_BUFFER_WRITE:
        case LFUN_BUFFER_WRITE_AS:
+       case LFUN_SPLIT_VIEW:
                if (lyx_view_)
                        return lyx_view_->getStatus(cmd);
                enable = false;
index ec44d867dce7ead06d4ac2eead660687bca50dee..a7e02019eddead6ffa4db5745c3fcba69209e339 100644 (file)
@@ -706,23 +706,21 @@ GuiWorkArea * GuiView::workArea(Buffer & buffer)
 
 GuiWorkArea * GuiView::addWorkArea(Buffer & buffer)
 {
-
        // Automatically create a TabWorkArea if there are none yet.
-       if (!d.splitter_->count())
-               addTabWorkArea();
-
-       TabWorkArea * tab_widget = d.currentTabWorkArea();
+       TabWorkArea * tab_widget = d.splitter_->count() 
+               ? d.currentTabWorkArea() : addTabWorkArea();
        return tab_widget->addWorkArea(buffer, *this);
 }
 
 
-void GuiView::addTabWorkArea()
+TabWorkArea * GuiView::addTabWorkArea()
 {
        TabWorkArea * twa = new TabWorkArea;
        QObject::connect(twa, SIGNAL(currentWorkAreaChanged(GuiWorkArea *)),
                this, SLOT(on_currentWorkAreaChanged(GuiWorkArea *)));
        d.splitter_->addWidget(twa);
        d.stack_widget_->setCurrentWidget(d.splitter_);
+       return twa;
 }
 
 
@@ -967,6 +965,10 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
                enable = buf;
                break;
 
+       case LFUN_SPLIT_VIEW:
+               enable = buf;
+               break;
+
        case LFUN_TOOLBAR_TOGGLE:
                flag.setOnOff(d.toolbars_->visible(cmd.getArg(0)));
                break;
@@ -1814,6 +1816,15 @@ bool GuiView::dispatch(FuncRequest const & cmd)
                        setFocus();
                        break;
 
+               case LFUN_SPLIT_VIEW:
+                       if (Buffer * buf = buffer()) {
+                               TabWorkArea * twa = addTabWorkArea();
+                               GuiWorkArea * wa = twa->addWorkArea(*buf, *this);
+                               setCurrentWorkArea(wa);
+                               connectBufferView(wa->bufferView());
+                       }
+                       break;
+
                default:
                        return false;
        }
index c2a75b49a27a53a0df658ff2edfe58fb1832df1a..d0c429859683b380b2a7b03c386b1d5b59db408d 100644 (file)
@@ -39,6 +39,7 @@ class Dialog;
 class GuiLayoutBox;
 class GuiToolbar;
 class GuiWorkArea;
+class TabWorkArea;
 
 /**
  * GuiView - Qt4 implementation of LyXView
@@ -160,7 +161,7 @@ private Q_SLOTS:
 
 private:
        ///
-       void addTabWorkArea();
+       TabWorkArea * addTabWorkArea();
 
        /// connect to signals in the given BufferView
        void connectBufferView(BufferView & bv);
index 6f930f61a43f80a08639f7ae3584834913400f4d..6e48e42390232a6e9c8612c9b1acbae121534c69 100644 (file)
@@ -572,6 +572,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
 
 void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/)
 {
+       lyx_view_->setCurrentWorkArea(this);
        // Repaint the whole screen.
        // Note: this is different from redraw() as only the backing pixmap
        // will be redrawn, which is cheap.
index ccb4a8ea534b65348d42696349eea0667a914467..c3f31b0a91a39ea5f4b8a6c3838798675af7f2b0 100644 (file)
@@ -413,6 +413,7 @@ enum kb_action {
        LFUN_IN_MATHMACROTEMPLATE,
        LFUN_SCROLL,
        LFUN_UI_TOGGLE,
+       LFUN_SPLIT_VIEW,
        LFUN_LASTACTION                  // end of the table
 };