]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/FindAndReplace.cpp
On Mac, moving down a paragraph should place the cursor at the end of the current...
[lyx.git] / src / frontends / qt4 / FindAndReplace.cpp
index a4e973ba79781ea42a3d5a8c96cd14874156bbd8..1a390ec4b27cc0c31a6260edf545ff5a18b434b7 100644 (file)
 #include "qt_helpers.h"
 #include "Language.h"
 
+#include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferList.h"
+#include "BufferView.h"
+#include "Text.h"
 #include "TextClass.h"
 #include "Cursor.h"
 #include "FuncRequest.h"
+#include "LyX.h"
 #include "lyxfind.h"
 
 #include "frontends/alert.h"
@@ -65,6 +69,18 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
 }
 
 
+void FindAndReplaceWidget::dockLocationChanged(Qt::DockWidgetArea area)
+{
+       if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) {
+               dynamicLayoutBasic_->setDirection(QBoxLayout::TopToBottom);
+               dynamicLayoutAdvanced_->setDirection(QBoxLayout::TopToBottom);
+       } else {
+               dynamicLayoutBasic_->setDirection(QBoxLayout::LeftToRight);
+               dynamicLayoutAdvanced_->setDirection(QBoxLayout::LeftToRight);
+       }
+}
+
+
 bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
 {
        if (event->type() != QEvent::KeyPress
@@ -147,7 +163,7 @@ static vector<string> const & allManualsFiles()
 }
 
 
-/** Switch p_buf to point to next document buffer.
+/** Switch buf to point to next document buffer.
  **
  ** Return true if restarted from master-document buffer.
  **/
@@ -157,7 +173,7 @@ static bool nextDocumentBuffer(Buffer * & buf)
        LYXERR(Debug::FIND, "children.size()=" << children.size());
        ListOfBuffers::const_iterator it =
                find(children.begin(), children.end(), buf);
-       LASSERT(it != children.end(), /**/);
+       LASSERT(it != children.end(), return false);
        ++it;
        if (it == children.end()) {
                buf = *children.begin();
@@ -178,7 +194,7 @@ static bool prevDocumentBuffer(Buffer * & buf)
        LYXERR(Debug::FIND, "children.size()=" << children.size());
        ListOfBuffers::const_iterator it =
                find(children.begin(), children.end(), buf);
-       LASSERT(it != children.end(), /**/)
+       LASSERT(it != children.end(), return false)
        if (it == children.begin()) {
                it = children.end();
                --it;
@@ -422,7 +438,7 @@ bool FindAndReplaceWidget::findAndReplace(
        else if (AllManualsRB->isChecked())
                scope = FindAndReplaceOptions::S_ALL_MANUALS;
        else
-               LASSERT(false, /**/);
+               LATTEST(false);
        LYXERR(Debug::FIND, "FindAndReplaceOptions: "
               << "find_buf_name=" << find_buf_name
               << ", casesensitiv=" << casesensitive
@@ -503,7 +519,7 @@ static void copy_params(BufferView const & bv, BufferView & dest_bv) {
        Buffer & dest_buf = dest_bv.buffer();
        dest_buf.params().setLanguage(lang);
        dest_buf.params().setBaseClass(doc_class);
-       dest_buf.params().makeDocumentClass();
+       dest_bv.makeDocumentClass();
        dest_bv.cursor().current_font.setLanguage(doc_bp.language);
 }
 
@@ -555,6 +571,9 @@ FindAndReplace::FindAndReplace(GuiView & parent,
        widget_ = new FindAndReplaceWidget(parent);
        setWidget(widget_);
        setFocusProxy(widget_);
+
+       connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
+               widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
 }