mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
fix bug 2453
change of behavior of rotate-tabular and rotate-cell toolbar buttons such that they toggle the rotation. Therefore a toggle feature is added to the tabular features. Moreover after the patch the state of the set-rotate-cell and toggle-rotate-cell buttons is on only if all selected cells in the table are rotated. If not all selected cells are rotated then the toggle button rotates all selected cells. The toggle-icons are copied from the set-icons. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18280 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
59252c1f8f
commit
6de5d0ad58
46
lib/images/tabular-feature_toggle-rotate-cell.xpm
Normal file
46
lib/images/tabular-feature_toggle-rotate-cell.xpm
Normal file
@ -0,0 +1,46 @@
|
||||
/* XPM */
|
||||
static char *tabular_feature_set_rotate_cell_[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"22 22 18 1",
|
||||
" c black",
|
||||
". c gray4",
|
||||
"X c #131313131313",
|
||||
"o c #1B1B1B1B1B1B",
|
||||
"O c gray14",
|
||||
"+ c #343434343434",
|
||||
"@ c gray23",
|
||||
"# c #414141414141",
|
||||
"$ c #484848484848",
|
||||
"% c gray32",
|
||||
"& c #5D5D5D5D5D5D",
|
||||
"* c #626262626262",
|
||||
"= c #6D6D6D6D6D6D",
|
||||
"- c gray48",
|
||||
"; c #838383838383",
|
||||
": c gray58",
|
||||
"> c gray100",
|
||||
", c None",
|
||||
/* pixels */
|
||||
",,,,,,,,,,, ,,,,,,,,,,",
|
||||
",,,,,,,,,,X.,,,,,,,,,,",
|
||||
",,,,,,,,,o;. ,,,,,,,,",
|
||||
",,,,,,,,X:=.+&@ ,,,,,,",
|
||||
",,,,,,,.:*o =* ,,,,,",
|
||||
",,,,,,,> *# X& ,,,,",
|
||||
",,,,,,,,, *o Xoo# >,,",
|
||||
",,,,,,,,,, . >*O+o.=>,",
|
||||
",,,,,,,,,,>.,,>,@*.@>,",
|
||||
",,,,,,,,,,,,,,,>*=o.,,",
|
||||
",,,,,,, ,,> @ ,,",
|
||||
",,,,,,, >>>>> ,,, * ,,",
|
||||
",,,,,,, >>>>> ,,, -O>,",
|
||||
",,,,,,, >>>>> ,,> *@>,",
|
||||
",,,,,,, >>>>> ,>* .,>,",
|
||||
",,,,,,, ,> =%>,,",
|
||||
",,,,,,,,,,,,,,, = >,,,",
|
||||
",,,,,,,,,,,,>,.$ ,,,,,",
|
||||
",,,,,,,,,,,>&Xo ,,,,,,",
|
||||
",,,,,,,,, X$->,,,,,,",
|
||||
",,,,,,,,,,,,,>>,,,,,,,",
|
||||
",,,,,,,,,,,,,,,,,,,,,,"
|
||||
};
|
46
lib/images/tabular-feature_toggle-rotate-tabular.xpm
Normal file
46
lib/images/tabular-feature_toggle-rotate-tabular.xpm
Normal file
@ -0,0 +1,46 @@
|
||||
/* XPM */
|
||||
static char *tabular_feature_set_rotate_tabular_[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"22 22 18 1",
|
||||
" c black",
|
||||
". c gray4",
|
||||
"X c #131313131313",
|
||||
"o c #1B1B1B1B1B1B",
|
||||
"O c gray14",
|
||||
"+ c #343434343434",
|
||||
"@ c gray23",
|
||||
"# c #414141414141",
|
||||
"$ c #484848484848",
|
||||
"% c gray32",
|
||||
"& c #5D5D5D5D5D5D",
|
||||
"* c #626262626262",
|
||||
"= c #6D6D6D6D6D6D",
|
||||
"- c gray48",
|
||||
"; c #838383838383",
|
||||
": c gray58",
|
||||
"> c gray100",
|
||||
", c None",
|
||||
/* pixels */
|
||||
",,,,,,,,,,, ,,,,,,,,,,",
|
||||
",,,,,,,,,,X.,,,,,,,,,,",
|
||||
",,,,,,,,,o;. ,,,,,,,,",
|
||||
",,, X:=.+&@ ,,,",
|
||||
",,, >>>.:*o =* > ,,,",
|
||||
",,, >>>> *# X& ,,,",
|
||||
",,, *o Xoo# >,,",
|
||||
",,, >>>> > . >*O+o.=>,",
|
||||
",,, >>>> >>.> >>@*.@>,",
|
||||
",,, >*=o.,,",
|
||||
",,, >>>> >>>> >>> @ ,,",
|
||||
",,, >>>> >>>> >>> * ,,",
|
||||
",,, -O>,",
|
||||
",,, >>>> >>>> >>> *@>,",
|
||||
",,, >>>> >>>> >>* .,>,",
|
||||
",,, > =%>,,",
|
||||
",,, >>>> >>>> > = >,,,",
|
||||
",,, >>>> >>>> .$ > ,,,",
|
||||
",,, >&Xo ,,,",
|
||||
",,,,,,,,, X$->,,,,,,",
|
||||
",,,,,,,,,,,,,>>,,,,,,,",
|
||||
",,,,,,,,,,,,,,,,,,,,,,"
|
||||
};
|
@ -128,8 +128,8 @@ ToolbarSet
|
||||
Item "Align middle" "tabular-feature valign-middle"
|
||||
Item "Align bottom" "tabular-feature valign-bottom"
|
||||
Separator
|
||||
Item "Rotate cell" "tabular-feature set-rotate-cell"
|
||||
Item "Rotate table" "tabular-feature set-rotate-tabular"
|
||||
Item "Rotate cell" "tabular-feature toggle-rotate-cell"
|
||||
Item "Rotate table" "tabular-feature toggle-rotate-tabular"
|
||||
Item "Set multi-column" "tabular-feature multicolumn"
|
||||
End
|
||||
|
||||
|
@ -151,8 +151,10 @@ TabularFeature tabularFeature[] =
|
||||
{ Tabular::SET_MPWIDTH, "set-mpwidth" },
|
||||
{ Tabular::SET_ROTATE_TABULAR, "set-rotate-tabular" },
|
||||
{ Tabular::UNSET_ROTATE_TABULAR, "unset-rotate-tabular" },
|
||||
{ Tabular::TOGGLE_ROTATE_TABULAR, "toggle-rotate-tabular" },
|
||||
{ Tabular::SET_ROTATE_CELL, "set-rotate-cell" },
|
||||
{ Tabular::UNSET_ROTATE_CELL, "unset-rotate-cell" },
|
||||
{ Tabular::TOGGLE_ROTATE_CELL, "toggle-rotate-cell" },
|
||||
{ Tabular::SET_USEBOX, "set-usebox" },
|
||||
{ Tabular::SET_LTHEAD, "set-lthead" },
|
||||
{ Tabular::UNSET_LTHEAD, "unset-lthead" },
|
||||
@ -3542,11 +3544,12 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
row_type sel_row_start = 0;
|
||||
row_type sel_row_end = 0;
|
||||
col_type dummy;
|
||||
col_type sel_col_start = 0;
|
||||
col_type sel_col_end = 0;
|
||||
Tabular::ltType dummyltt;
|
||||
bool flag = true;
|
||||
|
||||
getSelection(cur, sel_row_start, sel_row_end, dummy, dummy);
|
||||
getSelection(cur, sel_row_start, sel_row_end, sel_col_start, sel_col_end);
|
||||
|
||||
switch (action) {
|
||||
case Tabular::SET_PWIDTH:
|
||||
@ -3647,6 +3650,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.setOnOff(!tabular.isLongTabular());
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_ROTATE_TABULAR:
|
||||
case Tabular::SET_ROTATE_TABULAR:
|
||||
status.setOnOff(tabular.getRotateTabular());
|
||||
break;
|
||||
@ -3655,12 +3659,15 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.setOnOff(!tabular.getRotateTabular());
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_ROTATE_CELL:
|
||||
case Tabular::SET_ROTATE_CELL:
|
||||
status.setOnOff(tabular.getRotateCell(cur.idx()));
|
||||
status.setOnOff(!oneCellHasRotationState(false,
|
||||
sel_row_start, sel_row_end, sel_col_start, sel_col_end));
|
||||
break;
|
||||
|
||||
case Tabular::UNSET_ROTATE_CELL:
|
||||
status.setOnOff(!tabular.getRotateCell(cur.idx()));
|
||||
status.setOnOff(!oneCellHasRotationState(true,
|
||||
sel_row_start, sel_row_end, sel_col_start, sel_col_end));
|
||||
break;
|
||||
|
||||
case Tabular::SET_USEBOX:
|
||||
@ -4079,6 +4086,20 @@ static void checkLongtableSpecial(Tabular::ltType & ltt,
|
||||
}
|
||||
}
|
||||
|
||||
bool InsetTabular::oneCellHasRotationState(bool rotated,
|
||||
row_type row_start, row_type row_end,
|
||||
col_type col_start, col_type col_end) const {
|
||||
|
||||
for (row_type i = row_start; i <= row_end; ++i) {
|
||||
for (col_type j = col_start; j <= col_end; ++j) {
|
||||
if (tabular.getRotateCell(tabular.getCellNumber(i, j))
|
||||
== rotated) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
Tabular::Feature feature, string const & value)
|
||||
@ -4339,6 +4360,10 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
tabular.setRotateTabular(false);
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_ROTATE_TABULAR:
|
||||
tabular.setRotateTabular(!tabular.getRotateTabular());
|
||||
break;
|
||||
|
||||
case Tabular::SET_ROTATE_CELL:
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
|
||||
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
|
||||
@ -4353,6 +4378,18 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
tabular.getCellNumber(i, j), false);
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_ROTATE_CELL:
|
||||
{
|
||||
bool oneNotRotated = oneCellHasRotationState(false,
|
||||
sel_row_start, sel_row_end, sel_col_start, sel_col_end);
|
||||
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
|
||||
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
|
||||
tabular.setRotateCell(tabular.getCellNumber(i, j),
|
||||
oneNotRotated);
|
||||
}
|
||||
break;
|
||||
|
||||
case Tabular::SET_USEBOX: {
|
||||
Tabular::BoxType val = Tabular::BoxType(convert<int>(value));
|
||||
if (val == tabular.getUsebox(cur.idx()))
|
||||
|
@ -144,10 +144,14 @@ public:
|
||||
///
|
||||
UNSET_ROTATE_TABULAR,
|
||||
///
|
||||
TOGGLE_ROTATE_TABULAR,
|
||||
///
|
||||
SET_ROTATE_CELL,
|
||||
///
|
||||
UNSET_ROTATE_CELL,
|
||||
///
|
||||
TOGGLE_ROTATE_CELL,
|
||||
///
|
||||
SET_USEBOX,
|
||||
///
|
||||
SET_LTHEAD,
|
||||
@ -810,6 +814,10 @@ private:
|
||||
/// return the cell nearest to x, y
|
||||
idx_type getNearestCell(BufferView &, int x, int y) const;
|
||||
|
||||
/// test the rotation state of the give cell range.
|
||||
bool oneCellHasRotationState(bool rotated,
|
||||
row_type row_start, row_type row_end,
|
||||
col_type col_start, col_type col_end) const;
|
||||
///
|
||||
Buffer const * buffer_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user