]> git.lyx.org Git - lyx.git/commitdiff
fix #4758
authorAndré Pönitz <poenitz@gmx.net>
Mon, 21 Apr 2008 19:12:15 +0000 (19:12 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 21 Apr 2008 19:12:15 +0000 (19:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24416 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiCompleter.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWorkArea.h

index c22eaa0fb3c3fa582537f57ca019ef887c441b92..72589dac41eb5d7485ae6b3e492b3e06f091a34e 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <config.h>
 
-#include "GuiWorkArea.h"
+#include "GuiCompleter.h"
 
 #include "Buffer.h"
 #include "BufferView.h"
@@ -18,6 +18,7 @@
 #include "Cursor.h"
 #include "Dimension.h"
 #include "FuncRequest.h"
+#include "GuiWorkArea.h"
 #include "GuiView.h"
 #include "LyXFunc.h"
 #include "LyXRC.h"
index c10c5924a90cc2128e144682b2d78e956543e851..9882c3a840b2a8c8c6ecb4ea6b062c79c5c665b3 100644 (file)
@@ -18,6 +18,7 @@
 #include "Dialog.h"
 #include "FileDialog.h"
 #include "GuiApplication.h"
+#include "GuiCompleter.h"
 #include "GuiWorkArea.h"
 #include "GuiKeySymbol.h"
 #include "GuiToolbar.h"
index 9bed56018fbdf5663b0c656aad3905c80888d176..f040777e3c5aea84dec1712ebb34d9892bafbcea 100644 (file)
@@ -21,6 +21,7 @@
 #include "Font.h"
 #include "FuncRequest.h"
 #include "GuiApplication.h"
+#include "GuiCompleter.h"
 #include "GuiKeySymbol.h"
 #include "GuiPainter.h"
 #include "GuiView.h"
@@ -229,7 +230,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
        : buffer_view_(new BufferView(buffer)), lyx_view_(&lv),
        cursor_visible_(false),
        need_resize_(false), schedule_redraw_(false),
-       preedit_lines_(1), completer_(this)
+       preedit_lines_(1), completer_(new GuiCompleter(this))
 {
        buffer.workAreaManager().add(this);
        // Setup the signals
@@ -450,7 +451,7 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
 
        // Skip these when selecting
        if (cmd.action != LFUN_MOUSE_MOTION) {
-               completer_.updateVisibility(false, false);
+               completer_->updateVisibility(false, false);
                lyx_view_->updateLayoutList();
                lyx_view_->updateToolbars();
        }
@@ -525,9 +526,9 @@ void GuiWorkArea::showCursor()
 
        // show cursor on screen
        bool completable = cur.inset().showCompletionCursor()
-               && completer_.completionAvailable()
-               && !completer_.popupVisible()
-               && !completer_.inlineVisible();
+               && completer_->completionAvailable()
+               && !completer_->popupVisible()
+               && !completer_->inlineVisible();
        if (cursorInView) {
                cursor_visible_ = true;
                showCursor(x, y, h, l_shape, isrtl, completable);
@@ -811,11 +812,11 @@ void GuiWorkArea::generateSyntheticMouseEvent()
 void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
 {
        // intercept some keys if completion popup is visible
-       if (completer_.popupVisible()) {
+       if (completer_->popupVisible()) {
                switch (ev->key()) {
                case Qt::Key_Enter:
                case Qt::Key_Return:
-                       completer_.activate();
+                       completer_->activate();
                        ev->accept();
                        return;
                }
@@ -823,19 +824,19 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
        
        // intercept keys for the completion
        if (ev->key() == Qt::Key_Tab) {
-               completer_.tab();
+               completer_->tab();
                ev->accept();
                return;
        } 
 
-       if (completer_.popupVisible() && ev->key() == Qt::Key_Escape) {
-               completer_.hidePopup();
+       if (completer_->popupVisible() && ev->key() == Qt::Key_Escape) {
+               completer_->hidePopup();
                ev->accept();
                return;
        }
 
-       if (completer_.inlineVisible() && ev->key() == Qt::Key_Escape) {
-               completer_.hideInline();
+       if (completer_->inlineVisible() && ev->key() == Qt::Key_Escape) {
+               completer_->hideInline();
                ev->accept();
                return;
        }
index 86da009bfbcd20f9e187b62d70d133bf4ddcd2cc..b86835356325a724d326522270a67349e04a1ac2 100644 (file)
@@ -14,7 +14,6 @@
 #define WORKAREA_H
 
 #include "frontends/WorkArea.h"
-#include "frontends/qt4/GuiCompleter.h"
 
 #include "DocIterator.h"
 #include "FuncRequest.h"
@@ -48,6 +47,7 @@ class Buffer;
 
 namespace frontend {
 
+class GuiCompleter;
 class GuiView;
 class GuiWorkArea;
 
@@ -128,7 +128,7 @@ public:
        void resizeBufferView();
 
        ///
-       GuiCompleter & completer() { return completer_; }
+       GuiCompleter & completer() { return *completer_; }
        
 Q_SIGNALS:
        ///
@@ -237,7 +237,7 @@ private:
        int preedit_lines_;
 
        ///
-       GuiCompleter completer_;
+       GuiCompleter completer_;
 }; // GuiWorkArea