]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
Code cleanup
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 08b935d9da43e5c562cf7dfeef41b156994e6672..410f5e97dd6642e18e331ca08999ac6f2119f5c8 100644 (file)
@@ -239,7 +239,7 @@ GuiWorkArea::GuiWorkArea(QWidget *)
        : buffer_view_(0), lyx_view_(0),
        cursor_visible_(false),
        need_resize_(false), schedule_redraw_(false),
-       preedit_lines_(1), completer_(new GuiCompleter(this)),
+       preedit_lines_(1), completer_(new GuiCompleter(this, this)),
        context_target_pos_()
 {
 }
@@ -249,7 +249,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & gv)
        : buffer_view_(0), lyx_view_(0),
        cursor_visible_(false),
        need_resize_(false), schedule_redraw_(false),
-       preedit_lines_(1), completer_(new GuiCompleter(this)),
+       preedit_lines_(1), completer_(new GuiCompleter(this, this)),
        context_target_pos_()
 {
        setGuiView(gv);
@@ -321,6 +321,7 @@ GuiWorkArea::~GuiWorkArea()
        delete buffer_view_;
        delete cursor_;
        // Completer has a QObject parent and is thus automatically destroyed.
+       // See #4758.
        // delete completer_;
 }
 
@@ -697,14 +698,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
 
 void GuiWorkArea::focusInEvent(QFocusEvent * e)
 {
-       /*
-       LYXERR(Debug::DEBUG, "GuiWorkArea::focusInEvent(): " << this << std::endl);
-       GuiWorkArea * old_gwa = theGuiApp()->currentView()->currentWorkArea();
-       if (old_gwa)
-               old_gwa->stopBlinkingCursor();
-       lyx_view_->setCurrentWorkArea(this);
-       */
-
+       LYXERR(Debug::DEBUG, "GuiWorkArea::focusInEvent(): " << this << endl);
        if (lyx_view_->currentWorkArea() != this)
                lyx_view_->setCurrentWorkArea(this);
 
@@ -715,7 +709,7 @@ void GuiWorkArea::focusInEvent(QFocusEvent * e)
 
 void GuiWorkArea::focusOutEvent(QFocusEvent * e)
 {
-       LYXERR(Debug::DEBUG, "GuiWorkArea::focusOutEvent(): " << this << std::endl);
+       LYXERR(Debug::DEBUG, "GuiWorkArea::focusOutEvent(): " << this << endl);
        stopBlinkingCursor();
        QAbstractScrollArea::focusOutEvent(e);
 }
@@ -1277,6 +1271,9 @@ void EmbeddedWorkArea::disable()
        stopBlinkingCursor();
        if (view().currentWorkArea() != this)
                return;
+       // No problem if currentMainWorkArea() is 0 (setCurrentWorkArea()
+       // tolerates it and shows the background logo), what happens if
+       // an EmbeddedWorkArea is closed after closing all document WAs
        view().setCurrentWorkArea(view().currentMainWorkArea());
 }
 
@@ -1509,7 +1506,7 @@ void TabWorkArea::on_currentTabChanged(int i)
        currentWorkAreaChanged(wa);
 
        LYXERR(Debug::GUI, "currentTabChanged " << i
-               << "File" << wa->bufferView().buffer().absFileName());
+               << " File: " << wa->bufferView().buffer().absFileName());
 }