Tabular de-spaghettization, step 2: move functions to where they are used.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24414 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-04-21 13:47:01 +00:00
parent 884bb0c4bc
commit 60cb88d2ef
4 changed files with 38 additions and 39 deletions

View 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)

View File

@ -290,7 +290,7 @@ class DragTabBar : public QTabBar
Q_OBJECT
public:
///
DragTabBar(QWidget * parent=0);
DragTabBar(QWidget * parent = 0);
#if QT_VERSION < 0x040300
///

View 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;

View 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;