]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocWidget.cpp
Use QFontMetrics information for underlines (and friends) width and position
[lyx.git] / src / frontends / qt4 / TocWidget.cpp
index 4bb5345f2786cb0e1a6ca3408da1bd6707c3970c..c3b9e034ac3edd90ea730b08ceba94c996c0e679 100644 (file)
@@ -52,11 +52,11 @@ TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
 {
        setupUi(this);
 
-       moveOutTB->setIcon(QIcon(getPixmap("images/", "promote", "png")));
-       moveInTB->setIcon(QIcon(getPixmap("images/", "demote", "png")));
-       moveUpTB->setIcon(QIcon(getPixmap("images/", "up", "png")));
-       moveDownTB->setIcon(QIcon(getPixmap("images/", "down", "png")));
-       updateTB->setIcon(QIcon(getPixmap("images/", "reload", "png")));
+       moveOutTB->setIcon(QIcon(getPixmap("images/", "outline-out", "svgz,png")));
+       moveInTB->setIcon(QIcon(getPixmap("images/", "outline-in", "svgz,png")));
+       moveUpTB->setIcon(QIcon(getPixmap("images/", "outline-up", "svgz,png")));
+       moveDownTB->setIcon(QIcon(getPixmap("images/", "outline-down", "svgz,png")));
+       updateTB->setIcon(QIcon(getPixmap("images/", "reload", "svgz,png")));
 
        // avoid flickering
        tocTV->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
@@ -152,12 +152,12 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_OUTLINE_IN:
        case LFUN_OUTLINE_OUT:
        case LFUN_SECTION_SELECT:
-               status.setEnabled(true);
+               status.setEnabled(item.dit() != 0);
                return true;
 
-       case LFUN_LABEL_COPY_AS_REF: {
+       case LFUN_LABEL_COPY_AS_REFERENCE: {
                // For labels in math, we need to supply the label as a string
-               FuncRequest label_copy(LFUN_LABEL_COPY_AS_REF, item.asString());
+               FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.asString());
                if (inset)
                        return inset->getStatus(cur, label_copy, status);
        }
@@ -187,19 +187,26 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
        {
        case LFUN_CHANGE_ACCEPT:
        case LFUN_CHANGE_REJECT:
+               dispatch(item.action());
+               cur.dispatch(tmpcmd);
+               break;
+
        case LFUN_SECTION_SELECT:
                dispatch(item.action());
                cur.dispatch(tmpcmd);
+               // necessary to get the selection drawn.
+               cur.buffer()->changed(true);
+               gui_view_.setFocus();
                break;
 
-       case LFUN_LABEL_COPY_AS_REF: {
+       case LFUN_LABEL_COPY_AS_REFERENCE: {
                // For labels in math, we need to supply the label as a string
-               FuncRequest label_copy(LFUN_LABEL_COPY_AS_REF, item.asString());
+               FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.asString());
                if (inset)
                        inset->dispatch(cur, label_copy);
                break;
        }
-       
+
        case LFUN_OUTLINE_UP:
        case LFUN_OUTLINE_DOWN:
        case LFUN_OUTLINE_IN: