GuiTabular::GuiTabular(QWidget * parent)
: InsetParamsWidget(parent), firstheader_suppressable_(false),
GuiTabular::GuiTabular(QWidget * parent)
: InsetParamsWidget(parent), firstheader_suppressable_(false),
- lastfooter_suppressable_(false)
+ lastfooter_suppressable_(false), orig_leftborder_(GuiSetBorder::LINE_UNDEF),
+ orig_rightborder_(GuiSetBorder::LINE_UNDEF)
connect(interlinespaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(checkEnabled()));
connect(booktabsRB, SIGNAL(clicked(bool)),
connect(interlinespaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(checkEnabled()));
connect(booktabsRB, SIGNAL(clicked(bool)),
- this, SLOT(checkEnabled()));
+ this, SLOT(booktabs_toggled(bool)));
connect(borderDefaultRB, SIGNAL(clicked(bool)),
connect(borderDefaultRB, SIGNAL(clicked(bool)),
- this, SLOT(checkEnabled()));
+ this, SLOT(nonbooktabs_toggled(bool)));
connect(borderSetPB, SIGNAL(clicked()),
this, SLOT(borderSet_clicked()));
connect(borderUnsetPB, SIGNAL(clicked()),
connect(borderSetPB, SIGNAL(clicked()),
this, SLOT(borderSet_clicked()));
connect(borderUnsetPB, SIGNAL(clicked()),
+void GuiTabular::booktabs_toggled(bool const check)
+{
+ // when switching from formal, restore the left/right lines
+ if (!check) {
+ borders->setLeft(orig_leftborder_);
+ borders->setRight(orig_rightborder_);
+ }
+ // repaint the setborder widget
+ borders->update();
+ checkEnabled();
+}
+
+
+void GuiTabular::nonbooktabs_toggled(bool const check)
+{
+ booktabs_toggled(!check);
+}
+
+
static void setParam(string & param_str, Tabular::Feature f, string const & arg = string())
{
param_str += ' ';
static void setParam(string & param_str, Tabular::Feature f, string const & arg = string())
{
param_str += ' ';
}
// In what follows, we check the borders of all selected cells,
}
// In what follows, we check the borders of all selected cells,
- // and if there are diverging settings, we use the LINE_UNDECIDED
+ // and if there are diverging settings, we use the LINE_UNDEF
// border status.
GuiSetBorder::BorderState lt = GuiSetBorder::LINE_UNDEF;
GuiSetBorder::BorderState lb = GuiSetBorder::LINE_UNDEF;
// border status.
GuiSetBorder::BorderState lt = GuiSetBorder::LINE_UNDEF;
GuiSetBorder::BorderState lb = GuiSetBorder::LINE_UNDEF;
lb = borderState(lb, tabular.bottomLine(cc));
ll = borderState(ll, tabular.leftLine(cc));
lr = borderState(lr, tabular.rightLine(cc));
lb = borderState(lb, tabular.bottomLine(cc));
ll = borderState(ll, tabular.leftLine(cc));
lr = borderState(lr, tabular.rightLine(cc));
+ // store left/right borders for the case of formal/nonformal switch
+ orig_leftborder_ = borderState(ll, tabular.leftLine(cc, true));
+ orig_rightborder_ = borderState(lr, tabular.rightLine(cc, true));
}
} else {
lt = tabular.topLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
lb = tabular.bottomLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
ll = tabular.leftLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
lr = tabular.rightLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
}
} else {
lt = tabular.topLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
lb = tabular.bottomLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
ll = tabular.leftLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
lr = tabular.rightLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ // store left/right borders for the case of formal/nonformal switch
+ orig_leftborder_ = tabular.leftLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
+ orig_rightborder_ = tabular.rightLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
}
borders->setTop(lt);
borders->setBottom(lb);
}
borders->setTop(lt);
borders->setBottom(lb);
void checkEnabled();
void borderSet_clicked();
void borderUnset_clicked();
void checkEnabled();
void borderSet_clicked();
void borderUnset_clicked();
+ void booktabs_toggled(bool const check);
+ void nonbooktabs_toggled(bool const check);
void on_topspaceCO_activated(int index);
void on_bottomspaceCO_activated(int index);
void on_interlinespaceCO_activated(int index);
void on_topspaceCO_activated(int index);
void on_bottomspaceCO_activated(int index);
void on_interlinespaceCO_activated(int index);
bool firstheader_suppressable_;
///
bool lastfooter_suppressable_;
bool firstheader_suppressable_;
///
bool lastfooter_suppressable_;
+ ///
+ GuiSetBorder::BorderState orig_leftborder_;
+ ///
+ GuiSetBorder::BorderState orig_rightborder_;
};
} // namespace frontend
};
} // namespace frontend
-bool Tabular::leftLine(idx_type cell) const
+bool Tabular::leftLine(idx_type cell, bool const ignore_bt) const
+ if (use_booktabs && !ignore_bt)
return false;
return cellInfo(cell).left_line;
}
return false;
return cellInfo(cell).left_line;
}
-bool Tabular::rightLine(idx_type cell) const
+bool Tabular::rightLine(idx_type cell, bool const ignore_bt) const
+ if (use_booktabs && !ignore_bt)
return false;
return cellInfo(cell).right_line;
}
return false;
return cellInfo(cell).right_line;
}
/// Returns true if there is a topline, returns false if not
bool bottomLine(idx_type cell) const;
/// Returns true if there is a topline, returns false if not
/// Returns true if there is a topline, returns false if not
bool bottomLine(idx_type cell) const;
/// Returns true if there is a topline, returns false if not
- bool leftLine(idx_type cell) const;
+ /// If \p ignore_bt is true, we return the state as if booktabs was
+ /// not used
+ bool leftLine(idx_type cell, bool const ignore_bt = false) const;
/// Returns true if there is a topline, returns false if not
/// Returns true if there is a topline, returns false if not
- bool rightLine(idx_type cell) const;
+ /// If \p ignore_bt is true, we return the state as if booktabs was
+ /// not used
+ bool rightLine(idx_type cell, bool const ignore_bt = false) const;
/// return space occupied by the second horizontal line and
/// interline space above row \p row in pixels
/// return space occupied by the second horizontal line and
/// interline space above row \p row in pixels
- Fix display of formal table bottom line with multirows (bug 11445).
- Fix display of formal table bottom line with multirows (bug 11445).
+- Fix left/right border UI when toggling formal table style (bug 9835).
+