]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiTabular.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiTabular.cpp
index 7f1277f3eb450a363331c5e4f1e6ddb434a87f56..54bf939037bd88f11b21e32ea349362c772ab9bf 100644 (file)
 
 #include "insets/InsetTabular.h"
 
-#include <QCloseEvent>
 #include <QCheckBox>
 #include <QPushButton>
 #include <QRadioButton>
 #include <QLineEdit>
 
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiTabular::GuiTabular(LyXView & lv)
-       : GuiDialog(lv, "tabular"), Controller(this)
+GuiTabular::GuiTabular(GuiView & lv)
+       : GuiDialog(lv, "tabular", qt_("Table Settings"))
 {
        active_cell_ = Tabular::npos;
 
        setupUi(this);
-       setViewTitle(_("Table Settings"));
-       setController(this, false);
 
        widthED->setValidator(unsignedLengthValidator(widthED));
        topspaceED->setValidator(new LengthValidator(topspaceED));
@@ -164,13 +160,6 @@ void GuiTabular::change_adaptor()
 }
 
 
-void GuiTabular::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       GuiDialog::closeEvent(e);
-}
-
-
 void GuiTabular::booktabsChanged(bool)
 {
        changed();
@@ -294,28 +283,28 @@ void GuiTabular::borderUnset_clicked()
 
 void GuiTabular::leftBorder_changed()
 {
-       toggleLeftLine();
+       set(Tabular::TOGGLE_LINE_LEFT);
        changed();
 }
 
 
 void GuiTabular::rightBorder_changed()
 {
-       toggleRightLine();
+       set(Tabular::TOGGLE_LINE_RIGHT);
        changed();
 }
 
 
 void GuiTabular::topBorder_changed()
 {
-       toggleTopLine();
+       set(Tabular::TOGGLE_LINE_TOP);
        changed();
 }
 
 
 void GuiTabular::bottomBorder_changed()
 {
-       toggleBottomLine();
+       set(Tabular::TOGGLE_LINE_BOTTOM);
        changed();
 }
 
@@ -565,39 +554,10 @@ void GuiTabular::ltLastFooterEmpty_clicked()
 void GuiTabular::update_borders()
 {
        Tabular::idx_type const cell = getActiveCell();
-       bool const isMulticolumnCell = tabular_.isMultiColumn(cell);
-
-       if (!isMulticolumnCell) {
-               borders->setLeftEnabled(true);
-               borders->setRightEnabled(true);
-               borders->setTop(tabular_.topLine(cell, true));
-               borders->setBottom(tabular_.bottomLine(cell, true));
-               borders->setLeft(tabular_.leftLine(cell, true));
-               borders->setRight(tabular_.rightLine(cell, true));
-               // repaint the setborder widget
-               borders->update();
-               return;
-       }
-
        borders->setTop(tabular_.topLine(cell));
        borders->setBottom(tabular_.bottomLine(cell));
-       // pay attention to left/right lines: they are only allowed
-       // to set if we are in first/last cell of row or if the left/right
-       // cell is also a multicolumn.
-       if (tabular_.isFirstCellInRow(cell) || tabular_.isMultiColumn(cell - 1)) {
-               borders->setLeftEnabled(true);
-               borders->setLeft(tabular_.leftLine(cell));
-       } else {
-               borders->setLeft(false);
-               borders->setLeftEnabled(false);
-       }
-       if (tabular_.isLastCellInRow(cell) || tabular_.isMultiColumn(cell + 1)) {
-               borders->setRightEnabled(true);
-               borders->setRight(tabular_.rightLine(cell));
-       } else {
-               borders->setRight(false);
-               borders->setRightEnabled(false);
-       }
+       borders->setLeft(tabular_.leftLine(cell));
+       borders->setRight(tabular_.rightLine(cell));
        // repaint the setborder widget
        borders->update();
 }
@@ -942,6 +902,7 @@ void GuiTabular::closeGUI()
 */
 }
 
+
 bool GuiTabular::initialiseParams(string const & data)
 {
        // try to get the current cell
@@ -952,7 +913,7 @@ bool GuiTabular::initialiseParams(string const & data)
                // get the innermost tabular inset;
                // assume that it is "ours"
                for (int i = cur.depth() - 1; i >= 0; --i)
-                       if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
+                       if (cur[i].inset().lyxCode() == TABULAR_CODE) {
                                current_inset = static_cast<InsetTabular const *>(&cur[i].inset());
                                active_cell_ = cur[i].idx();
                                break;
@@ -965,7 +926,7 @@ bool GuiTabular::initialiseParams(string const & data)
        }
 
        InsetTabular tmp(buffer());
-       InsetTabularMailer::string2params(data, tmp);
+       InsetTabular::string2params(data, tmp);
        tabular_ = Tabular(tmp.tabular);
        return true;
 }
@@ -998,42 +959,6 @@ bool GuiTabular::useMetricUnits() const
 }
 
 
-void GuiTabular::toggleTopLine()
-{
-       if (tabular_.isMultiColumn(getActiveCell()))
-               set(Tabular::M_TOGGLE_LINE_TOP);
-       else
-               set(Tabular::TOGGLE_LINE_TOP);
-}
-
-
-void GuiTabular::toggleBottomLine()
-{
-       if (tabular_.isMultiColumn(getActiveCell()))
-               set(Tabular::M_TOGGLE_LINE_BOTTOM);
-       else
-               set(Tabular::TOGGLE_LINE_BOTTOM);
-}
-
-
-void GuiTabular::toggleLeftLine()
-{
-       if (tabular_.isMultiColumn(getActiveCell()))
-               set(Tabular::M_TOGGLE_LINE_LEFT);
-       else
-               set(Tabular::TOGGLE_LINE_LEFT);
-}
-
-
-void GuiTabular::toggleRightLine()
-{
-       if (tabular_.isMultiColumn(getActiveCell()))
-               set(Tabular::M_TOGGLE_LINE_RIGHT);
-       else
-               set(Tabular::TOGGLE_LINE_RIGHT);
-}
-
-
 void GuiTabular::setSpecial(string const & special)
 {
        if (tabular_.isMultiColumn(getActiveCell()))
@@ -1050,14 +975,14 @@ void GuiTabular::setWidth(string const & width)
        else
                set(Tabular::SET_PWIDTH, width);
 
-       dialog().updateView();
+       updateView();
 }
 
 
 void GuiTabular::toggleMultiColumn()
 {
        set(Tabular::MULTICOLUMN);
-       dialog().updateView();
+       updateView();
 }
 
 
@@ -1155,7 +1080,7 @@ void GuiTabular::longTabular(bool yes)
 }
 
 
-Dialog * createGuiTabular(LyXView & lv) { return new GuiTabular(lv); }
+Dialog * createGuiTabular(GuiView & lv) { return new GuiTabular(lv); }
 
 
 } // namespace frontend