]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiView.cpp
move updateLables to buffer
[features.git] / src / frontends / qt4 / GuiView.cpp
index a7dbaf21e229254f2dd0bd1168b3e49b545a9558..be58dc71c066165eefb330cb48ca741d3f2de46a 100644 (file)
@@ -159,9 +159,9 @@ struct GuiView::GuiViewPrivate
                in_show_(false)
        {
                // hardcode here the platform specific icon size
-               smallIconSize = 14;     // scaling problems
-               normalIconSize = 20;    // ok, default
-               bigIconSize = 26;               // better for some math icons
+               smallIconSize = 14;  // scaling problems
+               normalIconSize = 20; // ok, default
+               bigIconSize = 26;    // better for some math icons
 
                splitter_ = new QSplitter;
                bg_widget_ = new BackgroundWidget;
@@ -936,27 +936,28 @@ void GuiView::setCurrentWorkArea(GuiWorkArea * wa)
                return;
        }
        GuiWorkArea * old_gwa = theGuiApp()->currentView()->currentWorkArea();
-       if (old_gwa != wa) {
-               theGuiApp()->setCurrentView(this);
-               d.current_work_area_ = wa;
-               for (int i = 0; i != d.splitter_->count(); ++i) {
-                       if (d.tabWorkArea(i)->setCurrentWorkArea(wa)) {
-                               if (d.current_main_work_area_)
-                                       d.current_main_work_area_->setFrameStyle(QFrame::NoFrame);
-                               d.current_main_work_area_ = wa;
-                               d.current_main_work_area_->setFrameStyle(QFrame::Box | QFrame::Plain);
-                               d.current_main_work_area_->setLineWidth(2);
-                               LYXERR(Debug::DEBUG, "Current wa: " << currentWorkArea() << ", Current main wa: " << currentMainWorkArea());
-                               return;
-                       }
+       if (old_gwa == wa)
+               return;
+
+       theGuiApp()->setCurrentView(this);
+       d.current_work_area_ = wa;
+       for (int i = 0; i != d.splitter_->count(); ++i) {
+               if (d.tabWorkArea(i)->setCurrentWorkArea(wa)) {
+                       //if (d.current_main_work_area_)
+                       //      d.current_main_work_area_->setFrameStyle(QFrame::NoFrame);
+                       d.current_main_work_area_ = wa;
+                       //d.current_main_work_area_->setFrameStyle(QFrame::Box | QFrame::Plain);
+                       //d.current_main_work_area_->setLineWidth(2);
+                       LYXERR(Debug::DEBUG, "Current wa: " << currentWorkArea() << ", Current main wa: " << currentMainWorkArea());
+                       return;
                }
-               LYXERR(Debug::DEBUG, "This is not a tabbed wa");
-               on_currentWorkAreaChanged(wa);
-               BufferView & bv = wa->bufferView();
-               bv.cursor().fixIfBroken();
-               bv.updateMetrics();
-               wa->setUpdatesEnabled(true);
        }
+       LYXERR(Debug::DEBUG, "This is not a tabbed wa");
+       on_currentWorkAreaChanged(wa);
+       BufferView & bv = wa->bufferView();
+       bv.cursor().fixIfBroken();
+       bv.updateMetrics();
+       wa->setUpdatesEnabled(true);
        LYXERR(Debug::DEBUG, "Current wa: " << currentWorkArea() << ", Current main wa: " << currentMainWorkArea());
 }
 
@@ -1065,7 +1066,7 @@ void GuiView::setBuffer(Buffer * newBuffer)
 
        GuiWorkArea * wa = workArea(*newBuffer);
        if (wa == 0) {
-               updateLabels(*newBuffer->masterBuffer());
+               newBuffer->masterBuffer()->updateLabels();
                wa = addWorkArea(*newBuffer);
        } else {
                //Disconnect the old buffer...there's no new one.
@@ -1299,7 +1300,14 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
 
        case LFUN_COMPLETION_ACCEPT:
-       case LFUN_COMPLETION_CANCEL:
+               if (!d.current_work_area_
+                   || (!d.current_work_area_->completer().popupVisible()
+                       && !d.current_work_area_->completer().inlineVisible()
+                       && !d.current_work_area_->completer().completionAvailable()))
+                       enable = false;
+               break;
+
+               case LFUN_COMPLETION_CANCEL:
                if (!d.current_work_area_
                    || (!d.current_work_area_->completer().popupVisible()
                        && !d.current_work_area_->completer().inlineVisible()))
@@ -1430,8 +1438,7 @@ void GuiView::openDocument(string const & fname)
        docstring str2;
        Buffer * buf = loadDocument(fullname);
        if (buf) {
-               updateLabels(*buf);
-               
+               buf->updateLabels();
                setBuffer(buf);
                buf->errors("Parse");
                str2 = bformat(_("Document %1$s opened."), disp_fn);
@@ -1480,7 +1487,7 @@ static bool import(GuiView * lv, FileName const & filename,
                Buffer * buf = lv->loadDocument(lyxfile);
                if (!buf)
                        return false;
-               updateLabels(*buf);
+               buf->updateLabels();
                lv->setBuffer(buf);
                buf->errors("Parse");
        } else {