mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
the 'tabular unifiaction patch' (even with the removal of duplicated menu
entries) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5057 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
128730e4c4
commit
df03e5fc10
@ -1,3 +1,9 @@
|
||||
|
||||
|
||||
2002-08-21 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* ui/default.ui: adjust to "tabular unification"
|
||||
|
||||
2002-08-15 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||
|
||||
* bind/de_menus.bind: cleanup shortcuts for section layouts. Starred
|
||||
|
@ -63,18 +63,22 @@
|
||||
\bind "M-m t e" "math-mutate eqnarray"
|
||||
\bind "M-m t m" "math-mutate multline"
|
||||
|
||||
\bind "M-m c i" "math-column-insert"
|
||||
\bind "M-m c d" "math-column-delete"
|
||||
\bind "M-m c i" "tabular-feature insert-column"
|
||||
\bind "M-m c d" "tabular-feature delete-column"
|
||||
\bind "M-m c c" "tabular-feature copy-column"
|
||||
\bind "M-m c s" "tabular-feature swap-column"
|
||||
|
||||
\bind "M-m w i" "math-row-insert"
|
||||
\bind "M-m w d" "math-row-delete"
|
||||
\bind "M-m w i" "tabular-feature insert-row"
|
||||
\bind "M-m w d" "tabular-feature delete-row"
|
||||
\bind "M-m w c" "tabular-feature copy-row"
|
||||
\bind "M-m w s" "tabular-feature swap-row"
|
||||
|
||||
\bind "M-m a v t" "math-valign top"
|
||||
\bind "M-m a v c" "math-valign center"
|
||||
\bind "M-m a v b" "math-valign bottom"
|
||||
\bind "M-m a h l" "math-halign left"
|
||||
\bind "M-m a h c" "math-halign center"
|
||||
\bind "M-m a h r" "math-halign right"
|
||||
\bind "M-m w t" "tabular-feature valign-top"
|
||||
\bind "M-m w m" "tabular-feature valign-center"
|
||||
\bind "M-m w b" "tabular-feature valign-bottom"
|
||||
\bind "M-m c l" "tabular-feature align-left"
|
||||
\bind "M-m c m" "tabular-feature align-center"
|
||||
\bind "M-m c r" "tabular-feature align-right"
|
||||
|
||||
# Decoration accents
|
||||
|
||||
|
@ -108,9 +108,13 @@ Menuset
|
||||
Separator
|
||||
Item "Add Row|A" "tabular-feature append-row"
|
||||
Item "Delete Row|w" "tabular-feature delete-row"
|
||||
Item "Copy Row" "tabular-feature copy-row"
|
||||
Item "Swap Rows" "tabular-feature swap-row"
|
||||
Separator
|
||||
Item "Add Column|u" "tabular-feature append-column"
|
||||
Item "Delete Column|D" "tabular-feature delete-column"
|
||||
Item "Copy Column" "tabular-feature copy-column"
|
||||
Item "Swap Columns" "tabular-feature swap-column"
|
||||
End
|
||||
|
||||
Menu "edit_math"
|
||||
@ -129,20 +133,12 @@ Menuset
|
||||
Submenu "Change formula type...|t" "edit_math_mutate"
|
||||
Separator
|
||||
Submenu "Use computer algebra system|t" "edit_math_extern"
|
||||
Separator
|
||||
Item "Align Left|f" "math-halign left"
|
||||
Item "Align Center|C" "math-halign center"
|
||||
Item "Align Right|R" "math-halign right"
|
||||
Separator
|
||||
Item "V.Align Top|T" "math-valign top"
|
||||
Item "V.Align Center|e" "math-valign center"
|
||||
Item "V.Align Bottom|B" "math-valign bottom"
|
||||
Separator
|
||||
Item "Add Row" "math-row-insert"
|
||||
Item "Delete Row" "math-row-delete"
|
||||
Separator
|
||||
Item "Add Column" "math-column-insert"
|
||||
Item "Delete Column" "math-column-delete"
|
||||
|
||||
#Item "Line Top|T" "tabular-feature toggle-line-top"
|
||||
#Item "Line Bottom|B" "tabular-feature toggle-line-bottom"
|
||||
#Item "Line Left|L" "tabular-feature toggle-line-left"
|
||||
#Item "Line Right|R" "tabular-feature toggle-line-right"
|
||||
#Separator
|
||||
End
|
||||
|
||||
Menu "edit_math_extern"
|
||||
|
@ -1,3 +1,11 @@
|
||||
|
||||
2002-08-20 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* commandtags.h: new LFUNs for swapping/copying table row/colums
|
||||
|
||||
* LyXAction.C:
|
||||
* lyxfunc.C: support for new lfuns
|
||||
|
||||
2002-08-21 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* tabular.C:
|
||||
|
@ -296,12 +296,6 @@ void LyXAction::init()
|
||||
{ LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
|
||||
{ LFUN_MATH_NUMBER, "math-number", "", Noop },
|
||||
{ LFUN_MATH_EXTERN, "math-extern", "", Noop },
|
||||
{ LFUN_MATH_VALIGN, "math-valign", "", Noop },
|
||||
{ LFUN_MATH_HALIGN, "math-halign", "", Noop },
|
||||
{ LFUN_MATH_ROW_INSERT, "math-row-insert", "", Noop },
|
||||
{ LFUN_MATH_ROW_DELETE, "math-row-delete", "", Noop },
|
||||
{ LFUN_MATH_COLUMN_INSERT, "math-column-insert", "", Noop },
|
||||
{ LFUN_MATH_COLUMN_DELETE, "math-column-delete", "", Noop },
|
||||
{ LFUN_MATH_PANEL, "math-panel", "", Noop },
|
||||
{ LFUN_MATH_SIZE, "math-size", "", Noop },
|
||||
{ LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
|
||||
|
@ -142,12 +142,6 @@ enum kb_action {
|
||||
LFUN_MATH_MACRO, // ale970510
|
||||
LFUN_MATH_EXTERN, // 120 // Andre' 20010424
|
||||
LFUN_MATH_PANEL, // Andre' 20010522
|
||||
LFUN_MATH_VALIGN, // Andre' 20010522
|
||||
LFUN_MATH_HALIGN, // Andre' 20010522
|
||||
LFUN_MATH_ROW_INSERT, // Andre' 20010522
|
||||
LFUN_MATH_ROW_DELETE, // Andre' 20010522
|
||||
LFUN_MATH_COLUMN_INSERT, // Andre' 20010522
|
||||
LFUN_MATH_COLUMN_DELETE, // Andre' 20010522
|
||||
LFUN_MATH_MUTATE, // Andre' 20010523
|
||||
LFUN_MATH_IMPORT_SELECTION, // Andre' 20010704
|
||||
LFUN_MATH_SPACE, // Andre' 20010725
|
||||
|
@ -362,7 +362,47 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
disable = true;
|
||||
if (mathcursor) {
|
||||
#if 0
|
||||
// FIXME: check temporarily disabled
|
||||
// valign code
|
||||
char align = mathcursor->valign();
|
||||
if (align == '\0') {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
if (ev.argument.empty()) {
|
||||
flag.clear();
|
||||
break;
|
||||
}
|
||||
if (!contains("tcb", ev.argument[0])) {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
flag.setOnOff(ev.argument[0] == align);
|
||||
} else
|
||||
disable = true;
|
||||
|
||||
char align = mathcursor->halign();
|
||||
if (align == '\0') {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
if (ev.argument.empty()) {
|
||||
flag.clear();
|
||||
break;
|
||||
}
|
||||
if (!contains("lcr", ev.argument[0])) {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
flag.setOnOff(ev.argument[0] == align);
|
||||
#endif
|
||||
|
||||
disable = !mathcursor->halign();
|
||||
break;
|
||||
}
|
||||
|
||||
if (tli) {
|
||||
FuncStatus ret;
|
||||
//ret.disabled(true);
|
||||
@ -416,45 +456,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
case LFUN_LATEX_LOG:
|
||||
disable = !IsFileReadable(buf->getLogName().second);
|
||||
break;
|
||||
case LFUN_MATH_VALIGN:
|
||||
if (mathcursor) {
|
||||
char align = mathcursor->valign();
|
||||
if (align == '\0') {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
if (ev.argument.empty()) {
|
||||
flag.clear();
|
||||
break;
|
||||
}
|
||||
if (!contains("tcb", ev.argument[0])) {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
flag.setOnOff(ev.argument[0] == align);
|
||||
} else
|
||||
disable = true;
|
||||
break;
|
||||
|
||||
case LFUN_MATH_HALIGN:
|
||||
if (mathcursor) {
|
||||
char align = mathcursor->halign();
|
||||
if (align == '\0') {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
if (ev.argument.empty()) {
|
||||
flag.clear();
|
||||
break;
|
||||
}
|
||||
if (!contains("lcr", ev.argument[0])) {
|
||||
disable = true;
|
||||
break;
|
||||
}
|
||||
flag.setOnOff(ev.argument[0] == align);
|
||||
} else
|
||||
disable = true;
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MUTATE:
|
||||
if (mathcursor)
|
||||
@ -474,15 +475,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
disable = !mathcursor;
|
||||
break;
|
||||
|
||||
// we need to be math mode and a math array for that
|
||||
// Hack: halign produces non-zero result iff we are in a math array
|
||||
case LFUN_MATH_ROW_INSERT:
|
||||
case LFUN_MATH_ROW_DELETE:
|
||||
case LFUN_MATH_COLUMN_INSERT:
|
||||
case LFUN_MATH_COLUMN_DELETE:
|
||||
disable = !mathcursor || !mathcursor->halign();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -415,12 +415,6 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_MATH_MUTATE:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
case LFUN_MATH_HALIGN:
|
||||
case LFUN_MATH_VALIGN:
|
||||
case LFUN_MATH_ROW_INSERT:
|
||||
case LFUN_MATH_ROW_DELETE:
|
||||
case LFUN_MATH_COLUMN_INSERT:
|
||||
case LFUN_MATH_COLUMN_DELETE:
|
||||
case LFUN_MATH_NUMBER:
|
||||
case LFUN_MATH_NONUMBER:
|
||||
case LFUN_TABINSERT:
|
||||
@ -428,6 +422,7 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
case LFUN_INSERT_LABEL:
|
||||
case LFUN_MATH_EXTERN:
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
mathcursor->dispatch(cmd);
|
||||
updateLocal(bv, true);
|
||||
|
@ -578,6 +578,25 @@ void MathGridInset::delRow(row_type row)
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::copyRow(row_type row)
|
||||
{
|
||||
addRow(row);
|
||||
for (col_type col = 0; col < ncols(); ++col)
|
||||
cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col];
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::swapRow(row_type row)
|
||||
{
|
||||
if (nrows() == 1)
|
||||
return;
|
||||
if (row + 1 == nrows())
|
||||
--row;
|
||||
for (col_type col = 0; col < ncols(); ++col)
|
||||
swap(cells_[row * ncols() + col], cells_[(row + 1) * ncols() + col]);
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::addCol(col_type newcol)
|
||||
{
|
||||
const col_type nc = ncols();
|
||||
@ -621,6 +640,25 @@ void MathGridInset::delCol(col_type col)
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::copyCol(col_type col)
|
||||
{
|
||||
addCol(col);
|
||||
for (row_type row = 0; row < nrows(); ++row)
|
||||
cells_[row * ncols() + col + 1] = cells_[row * ncols() + col];
|
||||
}
|
||||
|
||||
|
||||
void MathGridInset::swapCol(col_type col)
|
||||
{
|
||||
if (ncols() == 1)
|
||||
return;
|
||||
if (col + 1 == ncols())
|
||||
--col;
|
||||
for (row_type row = 0; row < nrows(); ++row)
|
||||
swap(cells_[row * ncols() + col], cells_[row * ncols() + col + 1]);
|
||||
}
|
||||
|
||||
|
||||
int MathGridInset::cellXOffset(idx_type idx) const
|
||||
{
|
||||
col_type c = col(idx);
|
||||
@ -968,42 +1006,50 @@ MathInset::result_type MathGridInset::dispatch
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
|
||||
case LFUN_MATH_HALIGN:
|
||||
halign((cmd.argument + "c")[0], col(idx));
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
//lyxerr << "handling tabular-feature " << cmd.argument << "\n";
|
||||
if (cmd.argument == "valign-top")
|
||||
valign('t');
|
||||
else if (cmd.argument == "valign-center")
|
||||
valign('c');
|
||||
else if (cmd.argument == "valign-bottom")
|
||||
valign('b');
|
||||
else if (cmd.argument == "align-left")
|
||||
halign('l', col(idx));
|
||||
else if (cmd.argument == "align-right")
|
||||
halign('r', col(idx));
|
||||
else if (cmd.argument == "align-center")
|
||||
halign('c', col(idx));
|
||||
else if (cmd.argument == "append-row")
|
||||
addRow(row(idx));
|
||||
else if (cmd.argument == "delete-row") {
|
||||
delRow(row(idx));
|
||||
if (idx > nargs())
|
||||
idx -= ncols();
|
||||
} else if (cmd.argument == "copy-row")
|
||||
copyRow(row(idx));
|
||||
else if (cmd.argument == "swap-row")
|
||||
swapRow(row(idx));
|
||||
else if (cmd.argument == "append-column") {
|
||||
row_type r = row(idx);
|
||||
col_type c = col(idx);
|
||||
addCol(c);
|
||||
idx = index(r, c);
|
||||
} else if (cmd.argument == "delete-column") {
|
||||
row_type r = row(idx);
|
||||
col_type c = col(idx);
|
||||
delCol(col(idx));
|
||||
idx = index(r, c);
|
||||
if (idx > nargs())
|
||||
idx -= ncols();
|
||||
} else if (cmd.argument == "copy-column")
|
||||
copyCol(col(idx));
|
||||
else if (cmd.argument == "swap-column")
|
||||
swapCol(col(idx));
|
||||
else
|
||||
return UNDISPATCHED;
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_MATH_VALIGN:
|
||||
valign((cmd.argument + "c")[0]);
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_MATH_ROW_INSERT:
|
||||
addRow(row(idx));
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_MATH_ROW_DELETE:
|
||||
delRow(row(idx));
|
||||
if (idx > nargs())
|
||||
idx -= ncols();
|
||||
return DISPATCHED_POP;
|
||||
|
||||
case LFUN_MATH_COLUMN_INSERT: {
|
||||
row_type r = row(idx);
|
||||
col_type c = col(idx);
|
||||
addFancyCol(c);
|
||||
idx = index(r, c);
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
|
||||
case LFUN_MATH_COLUMN_DELETE: {
|
||||
row_type r = row(idx);
|
||||
col_type c = col(idx);
|
||||
delFancyCol(col(idx));
|
||||
idx = index(r, c);
|
||||
if (idx > nargs())
|
||||
idx -= ncols();
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
|
||||
case LFUN_PASTE: {
|
||||
//lyxerr << "pasting '" << cmd.argument << "'\n";
|
||||
MathGridInset grid(1, 1);
|
||||
|
@ -164,17 +164,17 @@ public:
|
||||
///
|
||||
virtual void delRow(row_type r);
|
||||
///
|
||||
virtual void addFancyRow(row_type r) { addRow(r); }
|
||||
virtual void copyRow(row_type r);
|
||||
///
|
||||
virtual void delFancyRow(row_type r) { delRow(r); }
|
||||
virtual void swapRow(row_type r);
|
||||
///
|
||||
virtual void addCol(col_type c);
|
||||
///
|
||||
virtual void delCol(col_type c);
|
||||
///
|
||||
virtual void addFancyCol(col_type c) { addCol(c); }
|
||||
virtual void copyCol(col_type c);
|
||||
///
|
||||
virtual void delFancyCol(col_type c) { delCol(c); }
|
||||
virtual void swapCol(col_type c);
|
||||
///
|
||||
virtual void appendRow();
|
||||
///
|
||||
|
@ -400,6 +400,12 @@ void MathHullInset::footer_write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
bool MathHullInset::colChangeOK() const
|
||||
{
|
||||
return type_ == "align" || type_ == "alignat" || type_ == "xalignat";
|
||||
}
|
||||
|
||||
|
||||
void MathHullInset::addRow(row_type row)
|
||||
{
|
||||
nonum_.insert(nonum_.begin() + row + 1, !numberedType());
|
||||
@ -418,26 +424,21 @@ void MathHullInset::delRow(row_type row)
|
||||
}
|
||||
|
||||
|
||||
void MathHullInset::addFancyCol(col_type col)
|
||||
void MathHullInset::addCol(col_type col)
|
||||
{
|
||||
if (type_ == "equation")
|
||||
mutate("eqnarray");
|
||||
|
||||
else if (type_ == "eqnarray") {
|
||||
mutate("align");
|
||||
addFancyCol(col);
|
||||
}
|
||||
|
||||
else if (type_ == "align" || type_ == "alignat"
|
||||
|| type_ == "xalignat" || type_ == "xxalignat")
|
||||
if (colChangeOK())
|
||||
MathGridInset::addCol(col);
|
||||
else
|
||||
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
|
||||
}
|
||||
|
||||
|
||||
void MathHullInset::delFancyCol(col_type col)
|
||||
void MathHullInset::delCol(col_type col)
|
||||
{
|
||||
if (type_ == "alignat" || type_ == "xalignat" || type_ == "xxalignat")
|
||||
if (colChangeOK())
|
||||
MathGridInset::delCol(col);
|
||||
else
|
||||
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
|
||||
}
|
||||
|
||||
|
||||
@ -584,12 +585,16 @@ void MathHullInset::mutate(string const & newtype)
|
||||
}
|
||||
|
||||
else if (type_ == "multline") {
|
||||
if (newtype == "gather") {
|
||||
setType("gather");
|
||||
if (newtype == "gather" || newtype == "align" ||
|
||||
newtype == "xalign" || newtype == "xxalign")
|
||||
setType(newtype);
|
||||
else if (newtype == "eqnarray") {
|
||||
MathGridInset::addCol(1);
|
||||
MathGridInset::addCol(1);
|
||||
setType("eqnarray");
|
||||
} else {
|
||||
lyxerr << "mutation from '" << type_
|
||||
<< "' to '" << newtype << "' not implemented"
|
||||
<< endl;
|
||||
<< "' to '" << newtype << "' not implemented" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,11 +806,6 @@ MathInset::result_type MathHullInset::dispatch
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
case LFUN_MATH_HALIGN:
|
||||
case LFUN_MATH_VALIGN:
|
||||
// we explicitly don't want the default behaviour here
|
||||
return UNDISPATCHED;
|
||||
|
||||
case LFUN_MATH_EXTERN:
|
||||
doExtern(cmd, idx, pos);
|
||||
return DISPATCHED_POP;
|
||||
|
@ -57,14 +57,14 @@ public:
|
||||
/// identifies HullInset
|
||||
MathHullInset * asHullInset() { return this; }
|
||||
|
||||
///
|
||||
void addRow(row_type);
|
||||
///
|
||||
void delRow(row_type);
|
||||
///
|
||||
void addFancyCol(col_type);
|
||||
///
|
||||
void delFancyCol(col_type);
|
||||
/// add a row
|
||||
void addRow(row_type row);
|
||||
/// delete a row
|
||||
void delRow(row_type row);
|
||||
/// add a column
|
||||
void addCol(col_type col);
|
||||
/// delete a column
|
||||
void delCol(col_type col);
|
||||
|
||||
/// get type
|
||||
string const & getType() const;
|
||||
@ -112,6 +112,8 @@ private:
|
||||
char const * standardFont() const;
|
||||
/// consistency check
|
||||
void check() const;
|
||||
/// can this change its number of cols?
|
||||
bool colChangeOK() const;
|
||||
|
||||
/// "none", "simple", "display", "eqnarray",...
|
||||
string type_;
|
||||
|
Loading…
Reference in New Issue
Block a user