mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
Just some changes to be able to change TabularFeatures with the Table menu
so that I can test the stuff. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@724 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4c7916d1cd
commit
ba08201457
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2000-05-05 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* src/insets/insettabular.C (UpdateLocal): resetCursorPos when
|
||||||
|
recalculating inset-widths.
|
||||||
|
(TabularFeatures): activated this function so that I can change
|
||||||
|
tabular-features via menu.
|
||||||
|
|
||||||
|
* src/menus.C (ShowEditMenu): inserted support for insettabular so
|
||||||
|
that I can test some functions with the Table menu.
|
||||||
|
|
||||||
2000-05-05 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2000-05-05 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* src/lyxfont.C (stateText): guard against stupid c++libs.
|
* src/lyxfont.C (stateText): guard against stupid c++libs.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
#include "lyx_gui_misc.h"
|
||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
|
|
||||||
const int ADD_TO_HEIGHT = 2;
|
const int ADD_TO_HEIGHT = 2;
|
||||||
@ -252,8 +253,10 @@ void InsetTabular::InsetUnlock(BufferView * bv)
|
|||||||
|
|
||||||
void InsetTabular::UpdateLocal(BufferView * bv, bool flag)
|
void InsetTabular::UpdateLocal(BufferView * bv, bool flag)
|
||||||
{
|
{
|
||||||
if (flag)
|
if (flag) {
|
||||||
calculate_width_of_cells(bv->painter(), LyXFont(LyXFont::ALL_SANE));
|
calculate_width_of_cells(bv->painter(), LyXFont(LyXFont::ALL_SANE));
|
||||||
|
resetPos(bv->painter());
|
||||||
|
}
|
||||||
bv->updateInset(this, flag);
|
bv->updateInset(this, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,9 +795,8 @@ void InsetTabular::SetFont(BufferView *, LyXFont const &, bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::TabularFeatures(int, string)
|
void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
int
|
int
|
||||||
i,
|
i,
|
||||||
sel_pos_start,
|
sel_pos_start,
|
||||||
@ -838,183 +840,62 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
break;
|
break;
|
||||||
case LyXTabular::APPEND_ROW:
|
case LyXTabular::APPEND_ROW:
|
||||||
{
|
{
|
||||||
int
|
|
||||||
pos = cursor.pos,
|
|
||||||
cell_org = actcell,
|
|
||||||
cell = actcell;
|
|
||||||
|
|
||||||
// if there is a ContRow following this row I have to add
|
|
||||||
// the row after the ContRow's
|
|
||||||
if ((pos < par->last()) && tabular->RowHasContRow(cell_org)) {
|
|
||||||
while((pos < par->last()) && !tabular->IsContRow(cell)) {
|
|
||||||
while (pos < par->last() && !par->IsNewline(pos))
|
|
||||||
++pos;
|
|
||||||
if (pos < par->last())
|
|
||||||
++pos;
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
while((pos < par->last()) && tabular->IsContRow(cell)) {
|
|
||||||
while (pos < par->last() && !par->IsNewline(pos))
|
|
||||||
++pos;
|
|
||||||
if (pos < par->last())
|
|
||||||
++pos;
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
cell_org = --cell;
|
|
||||||
if (pos < par->last())
|
|
||||||
--pos;
|
|
||||||
}
|
|
||||||
while ((pos < par->last()) &&
|
|
||||||
((cell == cell_org) || !tabular->IsFirstCell(cell))) {
|
|
||||||
while ((pos < par->last()) && !par->IsNewline(pos))
|
|
||||||
++pos;
|
|
||||||
if (pos < par->last())
|
|
||||||
++pos;
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
// insert the new cells
|
|
||||||
int number = tabular->NumberOfCellsInRow(cell_org);
|
|
||||||
for (i=0; i<number; ++i)
|
|
||||||
par->InsertChar(pos, LYX_META_NEWLINE);
|
|
||||||
|
|
||||||
// append the row into the tabular
|
// append the row into the tabular
|
||||||
tabular->AppendRow(cell_org);
|
tabular->AppendRow(actcell);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case LyXTabular::APPEND_CONT_ROW:
|
|
||||||
{
|
|
||||||
int
|
|
||||||
pos = cursor.pos,
|
|
||||||
cell_org = actcell,
|
|
||||||
cell = actcell;
|
|
||||||
|
|
||||||
// if there is already a controw but not for this cell
|
|
||||||
// the AppendContRow sets only the right values but does
|
|
||||||
// not actually add a row
|
|
||||||
if (tabular->RowHasContRow(cell_org) &&
|
|
||||||
(tabular->CellHasContRow(cell_org) < 0)) {
|
|
||||||
tabular->AppendContRow(cell_org);
|
|
||||||
calculate_width_of_cells();
|
|
||||||
UpdateLocal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while ((pos < par->last()) &&
|
|
||||||
((cell == cell_org) || !tabular->IsFirstCell(cell))) {
|
|
||||||
while (pos < par->last() && !par->IsNewline(pos))
|
|
||||||
++pos;
|
|
||||||
if (pos < par->last())
|
|
||||||
++pos;
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
// insert the new cells
|
|
||||||
int number = tabular->NumberOfCellsInRow(cell_org);
|
|
||||||
for (i=0; i<number; ++i)
|
|
||||||
par->InsertChar(pos, LYX_META_NEWLINE);
|
|
||||||
// append the row into the tabular
|
|
||||||
tabular->AppendContRow(cell_org);
|
|
||||||
calculate_width_of_cells();
|
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LyXTabular::APPEND_COLUMN:
|
case LyXTabular::APPEND_COLUMN:
|
||||||
{
|
{
|
||||||
int
|
|
||||||
pos = 0,
|
|
||||||
cell_org = actcell,
|
|
||||||
cell = 0;
|
|
||||||
do {
|
|
||||||
if (pos && (par->IsNewline(pos-1))) {
|
|
||||||
if (tabular->AppendCellAfterCell(cell_org, cell)) {
|
|
||||||
par->InsertChar(pos, LYX_META_NEWLINE);
|
|
||||||
if (pos <= cursor.pos)
|
|
||||||
++cursor.pos;
|
|
||||||
++pos;
|
|
||||||
}
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
++pos;
|
|
||||||
} while (pos <= par->last());
|
|
||||||
// remember that the very last cell doesn't end with a newline.
|
|
||||||
// This saves one byte memory per tabular ;-)
|
|
||||||
if (tabular->AppendCellAfterCell(cell_org, cell))
|
|
||||||
par->InsertChar(par->last(), LYX_META_NEWLINE);
|
|
||||||
// append the column into the tabular
|
// append the column into the tabular
|
||||||
tabular->AppendColumn(cell_org);
|
tabular->AppendColumn(actcell);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LyXTabular::DELETE_ROW:
|
case LyXTabular::DELETE_ROW:
|
||||||
RemoveTabularRow();
|
RemoveTabularRow();
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
case LyXTabular::DELETE_COLUMN:
|
case LyXTabular::DELETE_COLUMN:
|
||||||
{
|
{
|
||||||
int pos = 0;
|
|
||||||
int cell = 0;
|
|
||||||
do {
|
|
||||||
if (!pos || (par->IsNewline(pos-1))){
|
|
||||||
if (tabular->DeleteCellIfColumnIsDeleted(cell, actcell)) {
|
|
||||||
// delete one cell
|
|
||||||
while (pos < par->last() && !par->IsNewline(pos))
|
|
||||||
par->Erase(pos);
|
|
||||||
if (pos < par->last())
|
|
||||||
par->Erase(pos);
|
|
||||||
else
|
|
||||||
par->Erase(pos - 1); // the missing newline
|
|
||||||
// at the end of a tabular
|
|
||||||
--pos; // because of ++pos below
|
|
||||||
}
|
|
||||||
++cell;
|
|
||||||
}
|
|
||||||
++pos;
|
|
||||||
} while (pos <= par->last());
|
|
||||||
/* delete the column from the tabular */
|
/* delete the column from the tabular */
|
||||||
tabular->DeleteColumn(actcell);
|
tabular->DeleteColumn(actcell);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LyXTabular::TOGGLE_LINE_TOP:
|
case LyXTabular::TOGGLE_LINE_TOP:
|
||||||
lineSet = !tabular->TopLine(actcell);
|
lineSet = !tabular->TopLine(actcell);
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetTopLine(i,lineSet);
|
tabular->SetTopLine(i,lineSet);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
||||||
lineSet = !tabular->BottomLine(actcell);
|
lineSet = !tabular->BottomLine(actcell);
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetBottomLine(i,lineSet);
|
tabular->SetBottomLine(i,lineSet);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_LEFT:
|
case LyXTabular::TOGGLE_LINE_LEFT:
|
||||||
lineSet = !tabular->LeftLine(actcell);
|
lineSet = !tabular->LeftLine(actcell);
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetLeftLine(i,lineSet);
|
tabular->SetLeftLine(i,lineSet);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_RIGHT:
|
case LyXTabular::TOGGLE_LINE_RIGHT:
|
||||||
lineSet = !tabular->RightLine(actcell);
|
lineSet = !tabular->RightLine(actcell);
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetRightLine(i,lineSet);
|
tabular->SetRightLine(i,lineSet);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
case LyXTabular::ALIGN_LEFT:
|
case LyXTabular::ALIGN_LEFT:
|
||||||
case LyXTabular::ALIGN_RIGHT:
|
case LyXTabular::ALIGN_RIGHT:
|
||||||
case LyXTabular::ALIGN_CENTER:
|
case LyXTabular::ALIGN_CENTER:
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetAlignment(i,setAlign);
|
tabular->SetAlignment(i,setAlign);
|
||||||
UpdateLocal();
|
UpdateLocal(bv, true);
|
||||||
return;
|
return;
|
||||||
case LyXTabular::MULTICOLUMN:
|
case LyXTabular::MULTICOLUMN:
|
||||||
{
|
{
|
||||||
@ -1029,26 +910,17 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
if (!hasCellSelection()) {
|
if (!hasCellSelection()) {
|
||||||
// check wether we are completly in a multicol
|
// check wether we are completly in a multicol
|
||||||
if (tabular->IsMultiColumn(actcell)) {
|
if (tabular->IsMultiColumn(actcell)) {
|
||||||
int
|
tabular->UnsetMultiColumn(actcell);
|
||||||
newlines,
|
UpdateLocal(bv, true);
|
||||||
pos = cursor.pos;
|
|
||||||
if ((newlines=tabular->UnsetMultiColumn(actcell))) {
|
|
||||||
while ((pos < par->last()) && !par->IsNewline(pos))
|
|
||||||
++pos;
|
|
||||||
for (;newlines;--newlines)
|
|
||||||
par->InsertChar(pos, LYX_META_NEWLINE);
|
|
||||||
}
|
|
||||||
calculate_width_of_cells();
|
|
||||||
} else {
|
} else {
|
||||||
tabular->SetMultiColumn(actcell, 1);
|
tabular->SetMultiColumn(actcell, 1);
|
||||||
|
UpdateLocal(bv, false);
|
||||||
}
|
}
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we have a selection so this means we just add all this
|
// we have a selection so this means we just add all this
|
||||||
// cells to form a multicolumn cell
|
// cells to form a multicolumn cell
|
||||||
int
|
int
|
||||||
number = 1,
|
|
||||||
s_start, s_end;
|
s_start, s_end;
|
||||||
|
|
||||||
if (sel_pos_start > sel_pos_end) {
|
if (sel_pos_start > sel_pos_end) {
|
||||||
@ -1058,23 +930,10 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
s_start = sel_pos_start;
|
s_start = sel_pos_start;
|
||||||
s_end = sel_pos_end;
|
s_end = sel_pos_end;
|
||||||
}
|
}
|
||||||
for(i=s_start; i < s_end; ++i) {
|
tabular->SetMultiColumn(s_start, s_end);
|
||||||
if (par->IsNewline(i)) {
|
|
||||||
par->Erase(i);
|
|
||||||
// check for double-blanks
|
|
||||||
if ((i && !par->IsLineSeparator(i-1)) &&
|
|
||||||
(i < par->last()) && !par->IsLineSeparator(i))
|
|
||||||
par->InsertChar(i, ' ');
|
|
||||||
else
|
|
||||||
--i;
|
|
||||||
++number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tabular->SetMultiColumn(sel_pos_start,number);
|
|
||||||
cursor.pos = s_start;
|
cursor.pos = s_start;
|
||||||
sel_cell_end = sel_cell_start;
|
sel_cell_end = sel_cell_start;
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LyXTabular::SET_ALL_LINES:
|
case LyXTabular::SET_ALL_LINES:
|
||||||
@ -1082,16 +941,15 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
case LyXTabular::UNSET_ALL_LINES:
|
case LyXTabular::UNSET_ALL_LINES:
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetAllLines(i, setLines);
|
tabular->SetAllLines(i, setLines);
|
||||||
calculate_width_of_cells();
|
UpdateLocal(bv, true);
|
||||||
UpdateLocal();
|
|
||||||
return;
|
return;
|
||||||
case LyXTabular::SET_LONGTABULAR:
|
case LyXTabular::SET_LONGTABULAR:
|
||||||
tabular->SetLongTabular(true);
|
tabular->SetLongTabular(true);
|
||||||
UpdateLocal(); // because this toggles displayed
|
UpdateLocal(bv, true); // because this toggles displayed
|
||||||
return;
|
return;
|
||||||
case LyXTabular::UNSET_LONGTABULAR:
|
case LyXTabular::UNSET_LONGTABULAR:
|
||||||
tabular->SetLongTabular(false);
|
tabular->SetLongTabular(false);
|
||||||
UpdateLocal(); // because this toggles displayed
|
UpdateLocal(bv, true); // because this toggles displayed
|
||||||
return;
|
return;
|
||||||
case LyXTabular::SET_ROTATE_TABULAR:
|
case LyXTabular::SET_ROTATE_TABULAR:
|
||||||
tabular->SetRotateTabular(true);
|
tabular->SetRotateTabular(true);
|
||||||
@ -1108,7 +966,7 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
tabular->SetRotateCell(i,false);
|
tabular->SetRotateCell(i,false);
|
||||||
return;
|
return;
|
||||||
case LyXTabular::SET_LINEBREAKS:
|
case LyXTabular::SET_LINEBREAKS:
|
||||||
what = !tabular->Linebreaks(tabular->FirstVirtualCell(actcell));
|
what = !tabular->GetLinebreaks(actcell);
|
||||||
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
for(i=sel_pos_start; i<=sel_pos_end; ++i)
|
||||||
tabular->SetLinebreaks(i,what);
|
tabular->SetLinebreaks(i,what);
|
||||||
return;
|
return;
|
||||||
@ -1125,11 +983,10 @@ void InsetTabular::TabularFeatures(int, string)
|
|||||||
tabular->SetLTFoot(actcell,true);
|
tabular->SetLTFoot(actcell,true);
|
||||||
return;
|
return;
|
||||||
case LyXTabular::SET_LTNEWPAGE:
|
case LyXTabular::SET_LTNEWPAGE:
|
||||||
what = !tabular->LTNewPage(actcell);
|
what = !tabular->GetLTNewPage(actcell);
|
||||||
tabular->SetLTNewPage(actcell,what);
|
tabular->SetLTNewPage(actcell,what);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetTabular::RemoveTabularRow()
|
void InsetTabular::RemoveTabularRow()
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
///
|
///
|
||||||
void ToggleInsetCursor(BufferView *);
|
void ToggleInsetCursor(BufferView *);
|
||||||
///
|
///
|
||||||
void TabularFeatures(int feature, string val="");
|
void TabularFeatures(BufferView * bv, int feature, string val="");
|
||||||
///
|
///
|
||||||
int GetActCell() { return actcell; }
|
int GetActCell() { return actcell; }
|
||||||
///
|
///
|
||||||
|
151
src/menus.C
151
src/menus.C
@ -46,6 +46,8 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
|
#include "insets/insettabular.h"
|
||||||
|
#include "tabular.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -860,65 +862,61 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
if (men->currentView()->available() &&
|
if (men->currentView()->available() &&
|
||||||
men->currentView()->text->cursor.par->table &&
|
men->currentView()->text->cursor.par->table &&
|
||||||
!tmpbuffer->isReadonly()){
|
!tmpbuffer->isReadonly()){
|
||||||
|
LyXTable *table = men->currentView()->text->cursor.par->table;
|
||||||
|
|
||||||
fl_addtopup(SubEditTable, _("Table%t"));
|
fl_addtopup(SubEditTable, _("Table%t"));
|
||||||
|
|
||||||
if (men->currentView()->text->cursor.par->table->
|
if (table->IsMultiColumn(men->currentView()->text->
|
||||||
IsMultiColumn(men->currentView()->text->
|
NumberOfCell(men->currentView()->
|
||||||
NumberOfCell(men->currentView()->
|
text->cursor.par,
|
||||||
text->cursor.par,
|
men->currentView()->
|
||||||
men->currentView()->
|
text->cursor.pos)))
|
||||||
text->cursor.pos)))
|
|
||||||
fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
|
fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
|
||||||
else
|
else
|
||||||
fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
|
fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
|
||||||
fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
|
fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
|
||||||
|
|
||||||
if (men->currentView()->text->cursor.par->table->
|
if (table->TopLine(men->currentView()->text->
|
||||||
TopLine(men->currentView()->text->
|
NumberOfCell(men->currentView()->
|
||||||
NumberOfCell(men->currentView()->
|
text->cursor.par,
|
||||||
text->cursor.par,
|
men->currentView()->text->
|
||||||
men->currentView()->text->
|
cursor.pos)))
|
||||||
cursor.pos)))
|
|
||||||
fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
|
fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
|
||||||
else
|
else
|
||||||
fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
|
fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
|
||||||
fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
|
fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
|
||||||
|
|
||||||
if (men->currentView()->text->cursor.par->table->
|
if (table->BottomLine(men->currentView()->text->
|
||||||
BottomLine(men->currentView()->text->
|
NumberOfCell(men->currentView()->
|
||||||
NumberOfCell(men->currentView()->
|
text->cursor.par,
|
||||||
text->cursor.par,
|
men->currentView()->
|
||||||
men->currentView()->
|
text->cursor.pos)))
|
||||||
text->cursor.pos)))
|
|
||||||
fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
|
fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
|
||||||
else
|
else
|
||||||
fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
|
fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
|
||||||
fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
|
fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
|
||||||
|
|
||||||
if (men->currentView()->text->cursor.par->table->
|
if (table->LeftLine(men->currentView()->text->
|
||||||
LeftLine(men->currentView()->text->
|
NumberOfCell(men->currentView()->
|
||||||
NumberOfCell(men->currentView()->
|
text->cursor.par,
|
||||||
text->cursor.par,
|
men->currentView()->
|
||||||
men->currentView()->
|
text->cursor.pos)))
|
||||||
text->cursor.pos)))
|
|
||||||
fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
|
fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
|
||||||
else
|
else
|
||||||
fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
|
fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
|
||||||
fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
|
fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
|
||||||
|
|
||||||
if (men->currentView()->text->cursor.par->table->
|
if (table->RightLine(men->currentView()->text->
|
||||||
RightLine(men->currentView()->text->
|
NumberOfCell(men->currentView()->
|
||||||
NumberOfCell(men->currentView()->
|
text->cursor.par,
|
||||||
text->cursor.par,
|
men->currentView()->
|
||||||
men->currentView()->
|
text->cursor.pos)))
|
||||||
text->cursor.pos)))
|
|
||||||
fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
|
fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
|
||||||
else
|
else
|
||||||
fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
|
fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
|
||||||
fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
|
fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
|
||||||
|
|
||||||
int align = men->currentView()->text->cursor.par->
|
int align =
|
||||||
table->GetAlignment(men->currentView()->text->
|
table->GetAlignment(men->currentView()->text->
|
||||||
NumberOfCell(men->currentView()->
|
NumberOfCell(men->currentView()->
|
||||||
text->cursor.par,
|
text->cursor.par,
|
||||||
@ -957,8 +955,80 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
// xgettext:no-c-format
|
// xgettext:no-c-format
|
||||||
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
||||||
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
||||||
}
|
} else if (men->currentView()->the_locking_inset &&
|
||||||
else {
|
(men->currentView()->the_locking_inset->LyxCode() ==
|
||||||
|
Inset::TABULAR_CODE) &&
|
||||||
|
!tmpbuffer->isReadonly()) {
|
||||||
|
InsetTabular * inset = static_cast<InsetTabular *>(men->currentView()->the_locking_inset);
|
||||||
|
LyXTabular * table = inset->tabular;
|
||||||
|
|
||||||
|
fl_addtopup(SubEditTable, _("Table%t"));
|
||||||
|
|
||||||
|
if (table->IsMultiColumn(inset->GetActCell()))
|
||||||
|
fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
|
||||||
|
|
||||||
|
if (table->TopLine(inset->GetActCell()))
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
|
||||||
|
|
||||||
|
if (table->BottomLine(inset->GetActCell()))
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
|
||||||
|
|
||||||
|
if (table->LeftLine(inset->GetActCell()))
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
|
||||||
|
|
||||||
|
if (table->RightLine(inset->GetActCell()))
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
|
||||||
|
|
||||||
|
int align = table->GetAlignment(inset->GetActCell());
|
||||||
|
if (align == LYX_ALIGN_LEFT)
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Left%r%x40"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 40, scex(_("EMT|eE#e#E")));
|
||||||
|
|
||||||
|
if (align == LYX_ALIGN_RIGHT)
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Right%R%x41"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Right%r%x41"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 41, scex(_("EMT|iI#i#I")));
|
||||||
|
|
||||||
|
if (align == LYX_ALIGN_CENTER)
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Center%R%x42%l"));
|
||||||
|
else
|
||||||
|
fl_addtopup(SubEditTable, _("|Align Center%r%x42%l"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 42, scex(_("EMT|Cc#c#C")));
|
||||||
|
|
||||||
|
// xgettext:no-c-format
|
||||||
|
fl_addtopup(SubEditTable, _("|Append Row%x32"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 32, scex(_("EMT|oO#o#O")));
|
||||||
|
// xgettext:no-c-format
|
||||||
|
fl_addtopup(SubEditTable, _("|Append Column%x33%l"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 33, scex(_("EMT|uU#u#U")));
|
||||||
|
// xgettext:no-c-format
|
||||||
|
fl_addtopup(SubEditTable, _("|Delete Row%x34"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 34, scex(_("EMT|wW#w#W")));
|
||||||
|
// xgettext:no-c-format
|
||||||
|
fl_addtopup(SubEditTable, _("|Delete Column%x35%l"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 35, scex(_("EMT|nN#n#N")));
|
||||||
|
// xgettext:no-c-format
|
||||||
|
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
||||||
|
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
||||||
|
} else {
|
||||||
fl_addtopup(SubEditTable, _("Table%t"));
|
fl_addtopup(SubEditTable, _("Table%t"));
|
||||||
// xgettext:no-c-format
|
// xgettext:no-c-format
|
||||||
fl_addtopup(SubEditTable, _("|Insert table%x31"));
|
fl_addtopup(SubEditTable, _("|Insert table%x31"));
|
||||||
@ -1113,9 +1183,18 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
men->currentView()->beforeChange();
|
men->currentView()->beforeChange();
|
||||||
men->currentView()->update(-2);
|
men->currentView()->update(-2);
|
||||||
}
|
}
|
||||||
men->currentView()->text->
|
if (men->currentView()->the_locking_inset &&
|
||||||
TableFeatures(choice - 32);
|
(men->currentView()->the_locking_inset->LyxCode()
|
||||||
men->currentView()->update(1);
|
== Inset::TABULAR_CODE)) {
|
||||||
|
InsetTabular * inset =
|
||||||
|
static_cast<InsetTabular *>
|
||||||
|
(men->currentView()->the_locking_inset);
|
||||||
|
inset->TabularFeatures(men->currentView(), choice - 32);
|
||||||
|
} else {
|
||||||
|
men->currentView()->text->
|
||||||
|
TableFeatures(choice - 32);
|
||||||
|
men->currentView()->update(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// version control sub-menu
|
// version control sub-menu
|
||||||
|
Loading…
Reference in New Issue
Block a user