]> git.lyx.org Git - features.git/commitdiff
Tabular de-spaghettization, step 2: move functions to where they are used.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 21 Apr 2008 13:47:01 +0000 (13:47 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 21 Apr 2008 13:47:01 +0000 (13:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24414 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiWorkArea.h
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index 5161e7bf04fedc0c5d0303417eb3fc1566550b57..dccad356a56560e5e6e08b4c5d44805c9ccd5eb9 100644 (file)
@@ -567,11 +567,38 @@ void GuiTabular::update_borders()
 }
 
 
+namespace {
+
+Length getColumnPWidth(Tabular const & t, size_t cell)
+{
+       return t.column_info[t.cellColumn(cell)].p_width;
+}
+
+
+Length getMColumnPWidth(Tabular const & t, size_t cell)
+{
+       if (t.isMultiColumn(cell))
+               return t.cellInfo(cell).p_width;
+       return Length();
+}
+
+
+docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
+{
+       if (what == Tabular::SET_SPECIAL_MULTI)
+               return t.cellInfo(cell).align_special;
+       return t.column_info[t.cellColumn(cell)].align_special;
+}
+
+}
+
+
+
 void GuiTabular::updateContents()
 {
        initialiseParams(string());
 
-       Tabular::idx_type const cell = getActiveCell();
+       size_t const cell = getActiveCell();
 
        Tabular::row_type const row = tabular_.cellRow(cell);
        Tabular::col_type const col = tabular_.cellColumn(cell);
@@ -594,11 +621,11 @@ void GuiTabular::updateContents()
        docstring special;
 
        if (multicol) {
-               special = tabular_.getAlignSpecial(cell, Tabular::SET_SPECIAL_MULTI);
-               pwidth = tabular_.getMColumnPWidth(cell);
+               special = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_MULTI);
+               pwidth = getMColumnPWidth(tabular_, cell);
        } else {
-               special = tabular_.getAlignSpecial(cell, Tabular::SET_SPECIAL_COLUMN);
-               pwidth = tabular_.getColumnPWidth(cell);
+               special = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_COLUMN);
+               pwidth = getColumnPWidth(tabular_, cell);
        }
 
        specialAlignmentED->setText(toqstr(special));
@@ -828,13 +855,13 @@ void GuiTabular::closeGUI()
        // since the changes update the actual tabular_
        //
        // apply the fixed width values
-       Tabular::idx_type const cell = getActiveCell();
+       size_t const cell = getActiveCell();
        bool const multicol = tabular_.isMultiColumn(cell);
        string width = widgetsToLength(widthED, widthUnit);
        string width2;
 
-       Length llen = tabular_.getColumnPWidth(cell);
-       Length llenMulti = tabular_.getMColumnPWidth(cell);
+       Length llen = getColumnPWidth(tabular_, cell);
+       Length llenMulti = getMColumnPWidth(tabular_, cell);
 
        if (multicol && !llenMulti.zero())
                width2 = llenMulti.asString();
@@ -846,9 +873,9 @@ void GuiTabular::closeGUI()
        docstring sa2;
 
        if (multicol)
-               sa2 = tabular_.getAlignSpecial(cell, Tabular::SET_SPECIAL_MULTI);
+               sa2 = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_MULTI);
        else
-               sa2 = tabular_.getAlignSpecial(cell, Tabular::SET_SPECIAL_COLUMN);
+               sa2 = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_COLUMN);
 
        if (sa1 != sa2) {
                if (multicol)
index 7120372341fa73ff3b4f7c063f13e017a00e3811..86da009bfbcd20f9e187b62d70d133bf4ddcd2cc 100644 (file)
@@ -290,7 +290,7 @@ class DragTabBar : public QTabBar
        Q_OBJECT
 public:
        ///
-       DragTabBar(QWidget * parent=0);
+       DragTabBar(QWidget * parent = 0);
 
 #if QT_VERSION < 0x040300
        ///
index 96f18d98a915713e70eb23d8e0e604edd40c10a9..f9bdd7360d672ed1ccc5b07fdfa10be179bdc050 100644 (file)
@@ -1128,28 +1128,6 @@ Length const Tabular::getPWidth(idx_type cell) const
 }
 
 
-Length const Tabular::getColumnPWidth(idx_type cell) const
-{
-       return column_info[cellColumn(cell)].p_width;
-}
-
-
-Length const Tabular::getMColumnPWidth(idx_type cell) const
-{
-       if (isMultiColumn(cell))
-               return cellInfo(cell).p_width;
-       return Length();
-}
-
-
-docstring const Tabular::getAlignSpecial(idx_type cell, int what) const
-{
-       if (what == SET_SPECIAL_MULTI)
-               return cellInfo(cell).align_special;
-       return column_info[cellColumn(cell)].align_special;
-}
-
-
 int Tabular::cellWidth(idx_type cell) const
 {
        return cellInfo(cell).width;
index 3275e8b8bfcbdd6c1b76514af746cd5a253d59b4..149ea8012143d11ea8011a21b20378ed6b234953 100644 (file)
@@ -314,12 +314,6 @@ public:
        ///
        Length const getPWidth(idx_type cell) const;
        ///
-       Length const getColumnPWidth(idx_type cell) const;
-       ///
-       Length const getMColumnPWidth(idx_type cell) const;
-       ///
-       docstring const getAlignSpecial(idx_type cell, int what) const;
-       ///
        int cellWidth(idx_type cell) const;
        ///
        int getBeginningOfTextInCell(idx_type cell) const;