]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
fix memory leaks
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 428336cb7ac70364d67e6f38a623794a154d9a32..2c53eb524ff99b995b1e6a4b8e0073ae0ffb8367 100644 (file)
@@ -55,7 +55,6 @@
 #include <QTimer>
 
 #include <boost/bind.hpp>
-#include <boost/current_function.hpp>
 
 #ifdef Q_WS_X11
 #include <QX11Info>
@@ -79,7 +78,6 @@ using std::string;
 namespace lyx {
 
 using support::FileName;
-using support::ForkedCallsController;
 
 
 /// return the LyX mouse button state from Qt's
@@ -239,9 +237,8 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
        // PageStep only depends on the viewport height.
        verticalScrollBar()->setPageStep(viewport()->height());
 
-       LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION
-               << "\n viewport width\t" << viewport()->width()
-               << "\n viewport height\t" << viewport()->height());
+       LYXERR(Debug::GUI, "viewport width: " << viewport()->width()
+               << "  viewport height: " << viewport()->height());
 
        // Enables input methods for asian languages.
        // Must be set when creating custom text editing widgets.
@@ -254,6 +251,7 @@ GuiWorkArea::~GuiWorkArea()
 {
        buffer_view_->buffer().workAreaManager().remove(this);
        delete buffer_view_;
+       delete cursor_;
 }
 
 
@@ -458,8 +456,7 @@ void GuiWorkArea::toggleCursor()
        // Use this opportunity to deal with any child processes that
        // have finished but are waiting to communicate this fact
        // to the rest of LyX.
-       ForkedCallsController & fcc = ForkedCallsController::get();
-       fcc.handleCompletedProcesses();
+       support::ForkedCallsController::handleCompletedProcesses();
 }
 
 
@@ -650,18 +647,15 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
 #ifdef Q_WS_X11
        if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat() 
                        && (Qt::Key_PageDown || Qt::Key_PageUp)) {
-               LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
-                       << "\nsystem is busy: scroll key event ignored");
+               LYXERR(Debug::KEY, "system is busy: scroll key event ignored");
                ev->ignore();
                return;
        }
 #endif
 
-       LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
-               << " count=" << ev->count()
-               << " text=" << fromqstr(ev->text())
-               << " isAutoRepeat=" << ev->isAutoRepeat()
-               << " key=" << ev->key());
+       LYXERR(Debug::KEY, " count: " << ev->count()
+               << " text: " << fromqstr(ev->text())
+               << " isAutoRepeat: " << ev->isAutoRepeat() << " key: " << ev->key());
 
        KeySymbol sym;
        setKeySymbol(&sym, ev);
@@ -703,12 +697,8 @@ void GuiWorkArea::update(int x, int y, int w, int h)
 void GuiWorkArea::paintEvent(QPaintEvent * ev)
 {
        QRect const rc = ev->rect();
-       /*
-       LYXERR(Debug::PAINTING) << "paintEvent begin: x: " << rc.x()
-               << " y: " << rc.y()
-               << " w: " << rc.width()
-               << " h: " << rc.height() << endl;
-       */
+       // LYXERR(Debug::PAINTING, "paintEvent begin: x: " << rc.x()
+       //      << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
 
        if (need_resize_) {
                verticalScrollBar()->setPageStep(viewport()->height());
@@ -767,14 +757,13 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
 
        if (!commit_string.isEmpty()) {
 
-               LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
-                       << " preeditString =" << fromqstr(e->preeditString())
-                       << " commitString  =" << fromqstr(e->commitString()));
+               LYXERR(Debug::KEY, "preeditString: " << fromqstr(e->preeditString())
+                       << " commitString: " << fromqstr(e->commitString()));
 
                int key = 0;
 
                // FIXME Iwami 04/01/07: we should take care also of UTF16 surrogates here.
-               for (int i = 0; i < commit_string.size(); ++i) {
+               for (int i = 0; i != commit_string.size(); ++i) {
                        QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string[i]);
                        keyPressEvent(&ev);
                }
@@ -822,7 +811,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
        // cursor_pos : cursor position in preedit string.
        size_t cursor_pos = 0;
        bool cursor_is_visible = false;
-       for (int i = 0; i < att.size(); ++i) {
+       for (int i = 0; i != att.size(); ++i) {
                if (att.at(i).type == QInputMethodEvent::Cursor) {
                        cursor_pos = att.at(i).start;
                        cursor_is_visible = att.at(i).length != 0;
@@ -839,7 +828,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
        // rLength : selected string length in IM.
        size_t rLength = 0;
        if (cursor_pos < preedit_length) {
-               for (int i = 0; i < att.size(); ++i) {
+               for (int i = 0; i != att.size(); ++i) {
                        if (att.at(i).type == QInputMethodEvent::TextFormat) {
                                if (att.at(i).start <= int(cursor_pos)
                                        && int(cursor_pos) < att.at(i).start + att.at(i).length) {