mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
GuiTabular, InsetTabular: fix http://bugzilla.lyx.org/show_bug.cgi?id=5752
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28437 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0c3109e2d3
commit
e029b216b7
@ -23,6 +23,8 @@
|
|||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
|
#include "FuncStatus.h"
|
||||||
|
#include "LyXFunc.h"
|
||||||
|
|
||||||
#include "insets/InsetTabular.h"
|
#include "insets/InsetTabular.h"
|
||||||
|
|
||||||
@ -784,6 +786,37 @@ void GuiTabular::updateContents()
|
|||||||
captionStatusCB->setChecked(tabular_.ltCaption(row));
|
captionStatusCB->setChecked(tabular_.ltCaption(row));
|
||||||
captionStatusCB->blockSignals(false);
|
captionStatusCB->blockSignals(false);
|
||||||
|
|
||||||
|
// FIXME: shouldn't this be handled by GuiDialog?
|
||||||
|
// FIXME: Some of them should be handled directly in TabularUI.ui
|
||||||
|
firstheaderBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD));
|
||||||
|
firstheaderBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD));
|
||||||
|
// first header can only be suppressed when there is a header
|
||||||
|
firstheaderNoContentsCB->setEnabled(tabular_.haveLTHead()
|
||||||
|
&& !tabular_.haveLTFirstHead());
|
||||||
|
// check if setting a first header is allowed
|
||||||
|
// additionally check firstheaderStatusCB because when this is the case
|
||||||
|
// a first header makes no sense
|
||||||
|
firstheaderStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD)
|
||||||
|
&& !firstheaderNoContentsCB->isChecked());
|
||||||
|
//firstheaderStatusCB->setEnabled(!firstheaderNoContentsCB->isChecked());
|
||||||
|
headerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
||||||
|
headerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
||||||
|
headerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
||||||
|
footerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
||||||
|
footerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
||||||
|
footerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
||||||
|
lastfooterBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT));
|
||||||
|
lastfooterBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT));
|
||||||
|
// last footer can only be suppressed when there is a footer
|
||||||
|
lastfooterNoContentsCB->setEnabled(tabular_.haveLTFoot()
|
||||||
|
&& !tabular_.haveLTLastFoot());
|
||||||
|
// check if setting a last footer is allowed
|
||||||
|
// additionally check lastfooterNoContentsCB because when this is the case
|
||||||
|
// a last footer makes no sense
|
||||||
|
lastfooterStatusCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT)
|
||||||
|
&& !lastfooterNoContentsCB->isChecked());
|
||||||
|
captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION));
|
||||||
|
|
||||||
Tabular::ltType ltt;
|
Tabular::ltType ltt;
|
||||||
bool use_empty;
|
bool use_empty;
|
||||||
bool row_set = tabular_.getRowOfLTHead(row, ltt);
|
bool row_set = tabular_.getRowOfLTHead(row, ltt);
|
||||||
@ -813,7 +846,6 @@ void GuiTabular::updateContents()
|
|||||||
firstheaderBorderAboveCB->setChecked(false);
|
firstheaderBorderAboveCB->setChecked(false);
|
||||||
firstheaderBorderBelowCB->setChecked(false);
|
firstheaderBorderBelowCB->setChecked(false);
|
||||||
if (use_empty) {
|
if (use_empty) {
|
||||||
firstheaderNoContentsCB->setChecked(ltt.empty);
|
|
||||||
if (ltt.empty)
|
if (ltt.empty)
|
||||||
firstheaderStatusCB->setEnabled(false);
|
firstheaderStatusCB->setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -846,7 +878,6 @@ void GuiTabular::updateContents()
|
|||||||
lastfooterBorderAboveCB->setChecked(false);
|
lastfooterBorderAboveCB->setChecked(false);
|
||||||
lastfooterBorderBelowCB->setChecked(false);
|
lastfooterBorderBelowCB->setChecked(false);
|
||||||
if (use_empty) {
|
if (use_empty) {
|
||||||
lastfooterNoContentsCB->setChecked(ltt.empty);
|
|
||||||
if (ltt.empty)
|
if (ltt.empty)
|
||||||
lastfooterStatusCB->setEnabled(false);
|
lastfooterStatusCB->setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -1119,6 +1150,13 @@ void GuiTabular::longTabular(bool yes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// to get the status of the longtable row settings
|
||||||
|
bool GuiTabular::funcEnabled(Tabular::Feature f) const
|
||||||
|
{
|
||||||
|
return getStatus(FuncRequest(getLfun(), featureAsString(f))).enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Dialog * createGuiTabular(GuiView & lv) { return new GuiTabular(lv); }
|
Dialog * createGuiTabular(GuiView & lv) { return new GuiTabular(lv); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +115,8 @@ private:
|
|||||||
|
|
||||||
void longTabular(bool yes);
|
void longTabular(bool yes);
|
||||||
|
|
||||||
|
bool funcEnabled(Tabular::Feature f) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
Tabular::idx_type active_cell_;
|
Tabular::idx_type active_cell_;
|
||||||
///
|
///
|
||||||
|
@ -1750,8 +1750,14 @@ Tabular::idx_type Tabular::setLTCaption(row_type row, bool what)
|
|||||||
setBottomLine(i, false);
|
setBottomLine(i, false);
|
||||||
setLeftLine(i, false);
|
setLeftLine(i, false);
|
||||||
setRightLine(i, false);
|
setRightLine(i, false);
|
||||||
} else
|
// FIXME: when a row is set as caption, then also insert a caption
|
||||||
|
// dispatch(FuncRequest(LFUN_CAPTION_INSERT));
|
||||||
|
} else {
|
||||||
unsetMultiColumn(i);
|
unsetMultiColumn(i);
|
||||||
|
// FIXME: when unsetting a caption row, also all existing captions
|
||||||
|
// in this row must be dissolved, see (bug 5754)
|
||||||
|
// dispatch(FuncRequest(LFUN_INSET_DISSOLVE, "caption-insert"));
|
||||||
|
}
|
||||||
row_info[row].caption = what;
|
row_info[row].caption = what;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -1763,6 +1769,15 @@ bool Tabular::ltCaption(row_type row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Tabular::haveLTCaption() const
|
||||||
|
{
|
||||||
|
for (row_type i = 0; i < row_info.size(); ++i)
|
||||||
|
if (row_info[i].caption)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// end longtable support functions
|
// end longtable support functions
|
||||||
|
|
||||||
void Tabular::setRowAscent(row_type row, int height)
|
void Tabular::setRowAscent(row_type row, int height)
|
||||||
@ -3884,7 +3899,17 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
status.setOnOff(convert<int>(argument) == tabular.getUsebox(cur.idx()));
|
status.setOnOff(convert<int>(argument) == tabular.getUsebox(cur.idx()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Tabular::SET_LTFIRSTHEAD:
|
// when a header/footer/caption is set, no other row can be the same
|
||||||
|
// furthermore, every row can only be one thing:
|
||||||
|
// either a footer or header or caption
|
||||||
|
case Tabular::SET_LTFIRSTHEAD:
|
||||||
|
status.setEnabled(sel_row_start == sel_row_end
|
||||||
|
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.ltCaption(sel_row_start)
|
||||||
|
&& (!tabular.haveLTFirstHead()
|
||||||
|
|| tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)));
|
||||||
status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
|
status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3893,6 +3918,13 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Tabular::SET_LTHEAD:
|
case Tabular::SET_LTHEAD:
|
||||||
|
status.setEnabled(sel_row_start == sel_row_end
|
||||||
|
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.ltCaption(sel_row_start)
|
||||||
|
&& (!tabular.haveLTHead()
|
||||||
|
|| tabular.getRowOfLTHead(sel_row_start, dummyltt)));
|
||||||
status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
|
status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3901,6 +3933,13 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Tabular::SET_LTFOOT:
|
case Tabular::SET_LTFOOT:
|
||||||
|
status.setEnabled(sel_row_start == sel_row_end
|
||||||
|
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.ltCaption(sel_row_start)
|
||||||
|
&& (!tabular.haveLTFoot()
|
||||||
|
|| tabular.getRowOfLTFoot(sel_row_start, dummyltt)));
|
||||||
status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
|
status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3909,6 +3948,13 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Tabular::SET_LTLASTFOOT:
|
case Tabular::SET_LTLASTFOOT:
|
||||||
|
status.setEnabled(sel_row_start == sel_row_end
|
||||||
|
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.ltCaption(sel_row_start)
|
||||||
|
&& (!tabular.haveLTLastFoot()
|
||||||
|
|| tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)));
|
||||||
status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
|
status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3921,7 +3967,15 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Tabular::TOGGLE_LTCAPTION:
|
case Tabular::TOGGLE_LTCAPTION:
|
||||||
status.setEnabled(sel_row_start == sel_row_end);
|
status.setEnabled(sel_row_start == sel_row_end
|
||||||
|
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
|
||||||
|
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
|
||||||
|
// Only the first row can be the caption.
|
||||||
|
&& sel_row_start == 0
|
||||||
|
&& (!tabular.haveLTCaption()
|
||||||
|
|| tabular.ltCaption(sel_row_start)));
|
||||||
status.setOnOff(tabular.ltCaption(sel_row_start));
|
status.setOnOff(tabular.ltCaption(sel_row_start));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -426,6 +426,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool haveLTLastFoot() const;
|
bool haveLTLastFoot() const;
|
||||||
///
|
///
|
||||||
|
bool haveLTCaption() const;
|
||||||
|
///
|
||||||
// end longtable support
|
// end longtable support
|
||||||
///
|
///
|
||||||
boost::shared_ptr<InsetTableCell> cellInset(idx_type cell) const;
|
boost::shared_ptr<InsetTableCell> cellInset(idx_type cell) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user