Few insettabular/text fixes (added cut&paste for tabulars) + Markos GNOME patch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@985 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-08-23 15:18:19 +00:00
parent 4143c4e6ec
commit 4ad21513e9
12 changed files with 335 additions and 128 deletions

View File

@ -1,3 +1,48 @@
2000-08-23 Juergen Vigna <jug@sad.it>
* src/BufferView_pimpl.C (tripleClick): disable this when in a
locking_inset.
* src/insets/insettabular.C (pasteSelection): delete the insets
LyXText as it is not valid anymore.
(copySelection): new function.
(pasteSelection): new function.
(cutSelection): new function.
(LocalDispatch): implemented cut/copy/paste of cell selections.
* src/insets/insettext.C (resizeLyXText): don't need resize if I still
don't have a LyXText.
* src/LyXAction.C (init): a NEW_TABULAR define too much.
* src/lyx_gui_misc.C (CloseAllBufferRelatedDialogs): another missing
NEW_TABULAR define.
2000-08-22 Juergen Vigna <jug@sad.it>
* src/lyx_gui_misc.C (updateAllVisibleBufferRelatedDialogs):
ifdef form_table out if NEW_TABULAR.
2000-08-21 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (TabularFeatures): BoxType is enum now.
(draw): fixed draw position so that the cursor is positioned in the
right place.
(InsetMotionNotify): hide/show cursor so the position is updated.
(GENERAL): fixed cursor_pos to show only 0/1 (begin/end of cell),
using cellstart() function where it should be used.
* src/insets/insettext.C (draw): ditto.
* src/tabular.C: fixed initialization of some missing variables and
made BoxType into an enum.
2000-08-22 Marko Vendelin <markov@ioc.ee>
* src/frontends/gnome/Menubar_pimpl.C: Mathces LyX action with Gnome
stock menu item using action numerical value, not its string
representation.
2000-08-22 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/frontends/xforms/Makefile.am (libxforms_la_SOURCES): add

View File

@ -149,7 +149,7 @@ Menuset
# Item "Paper...|a" "layout-paper"
# Item "Quotes...|Q" "layout-quotes"
OptItem "Tabular...|a" "layout-tabular"
Item "Table...|T" "layout-table"
# Item "Table...|T" "layout-table"
Separator
Item "Emphasize Style|E" "font-emph"
Item "Noun Style|N" "font-noun"
@ -164,7 +164,7 @@ Menuset
Menu "insert"
Item "Figure...|F" "figure-insert"
Item "Table...|T" "table-insert"
Item "Tabular...|T" "table-insert"
Separator
Item "Include File...|I" "buffer-child-insert"
Submenu "Import ascii file|a" "insert_ascii"

View File

@ -723,7 +723,7 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a line
if (buffer_ && screen_ && button == 1) {
if (buffer_ && screen_ && !bv_->the_locking_inset && (button == 1)) {
screen_->HideCursor();
screen_->ToggleSelection(bv_->text);
bv_->text->CursorHome(bv_);

View File

@ -382,9 +382,7 @@ void LyXAction::init()
{ LFUN_SHIFT_TAB, "tab-backward", "", Noop },
{ LFUN_TAB, "tab-forward", "", Noop },
{ LFUN_TABINSERT, "tab-insert", "", Noop },
#ifndef NEW_TABULAR
{ LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
#endif
{ LFUN_TABULAR_FEATURE, "tabular-feature",
N_("Tabular Features"), Noop },
{ LFUN_INSET_TABULAR, "tabular-insert",

View File

@ -41,6 +41,7 @@ using std::endl;
extern GLyxAppWin * mainAppWin;
// Some constants
extern kb_keymap * toplevel_keymap;
extern LyXAction lyxaction;
extern BufferList bufferlist;
extern LastFiles * lastfiles;
@ -120,35 +121,71 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
{
using namespace Gnome::MenuItems;
string actionname = lyxaction.getActionName(item.action());
if ( actionname == "buffer-open") gitem = Open(cback);
else if ( actionname == "lyx-quit") gitem = Exit(cback);
else if ( actionname == "buffer-close") gitem = Close(cback);
else if ( actionname == "buffer-write") gitem = Save(cback);
else if ( actionname == "buffer-write-as") gitem = SaveAs(cback);
else if ( actionname == "buffer-print") gitem = Print(cback);
else if ( actionname == "cut") gitem = Cut(cback);
else if ( actionname == "copy") gitem = Copy(cback);
else if ( actionname == "paste") gitem = Paste(cback);
else if ( actionname == "undo") gitem = Gnome::MenuItems::Undo(cback); // confused with class Undo
else if ( actionname == "redo") gitem = Redo(cback);
else if ( actionname == "dialog-preferences") gitem = Preferences(cback);
else if ( actionname == "buffer-new")
int ac = item.action();
kb_action action;
string argument;
if (lyxaction.isPseudoAction(ac))
action = lyxaction.retrieveActionArg(ac, argument);
else
action = static_cast<kb_action>(ac);
switch(action) {
case LFUN_MENUOPEN:
gitem = Open(cback);
break;
case LFUN_QUIT:
gitem = Exit(cback);
break;
case LFUN_CLOSEBUFFER:
gitem = Close(cback);
break;
case LFUN_MENUWRITE:
gitem = Save(cback);
break;
case LFUN_MENUWRITEAS:
gitem = SaveAs(cback);
break;
case LFUN_BUFFER_PRINT:
gitem = Print(cback);
break;
case LFUN_CUT:
gitem = Cut(cback);
break;
case LFUN_COPY:
gitem = Copy(cback);
break;
case LFUN_PASTE:
gitem = Paste(cback);
break;
case LFUN_UNDO:
gitem = Gnome::MenuItems::Undo(cback); // confused with class Undo
break;
case LFUN_REDO:
gitem = Redo(cback);
break;
case LFUN_DIALOG_PREFERENCES:
gitem = Preferences(cback);
break;
case LFUN_MENUNEW:
gitem = Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_NEW),
label, cback, lyxaction.helpText(item.action()));
else if ( actionname == "buffer-new-template")
break;
case LFUN_MENUNEWTMPLT:
gitem = Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_NEW),
label, cback, lyxaction.helpText(item.action()));
else if ( actionname == "find-replace" )
break;
case LFUN_MENUSEARCH:
gitem = Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_SRCHRPL),
label, cback, lyxaction.helpText(item.action()));
else if ( actionname == "spellchecker" )
break;
case LFUN_SPELLCHECK:
gitem = Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_SPELLCHECK),
label, cback, lyxaction.helpText(item.action()));
// else if ( actionname == "" )
// gitem = Gnome::UI::Item(Gnome::UI::Icon(),
// label, cback, lyxaction.helpText(item.action()));
else gitem = Gnome::UI::Item(label, cback, lyxaction.helpText(item.action()));
break;
default:
gitem = Gnome::UI::Item(label, cback, lyxaction.helpText(item.action()));
break;
}
}
// first handle optional entries.
@ -159,7 +196,7 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
}
if ((flag & LyXFunc::ToggleOn) || (flag & LyXFunc::ToggleOff))
gitem = Gnome::UI::ToggleItem(label, cback, lyxaction.helpText(item.action()));
Menus.push_back(gitem);
break;
}
@ -259,7 +296,7 @@ void Menubar::Pimpl::update()
}
}
void Menubar::Pimpl::openByName(string const & name)
void Menubar::Pimpl::openByName(string const &)
{
// Pimpl::update();
}

View File

@ -128,6 +128,7 @@ InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
cursor.pos(0);
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
dialogs_ = 0;
paste_tabular = 0;
need_update = INIT;
}
@ -144,6 +145,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer * buf)
cursor.pos(0);
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
dialogs_ = 0;
paste_tabular = 0;
need_update = INIT;
}
@ -285,8 +287,6 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
}
tabular->GetCellInset(cell)->draw(
bv, font, baseline, cx, false);
// if (need_update == CELL)
// DrawCellLines(pain, nx, baseline, i, cell);
} while(bv->text->status == LyXText::CHANGED_IN_DRAW);
}
} else if (dodraw) {
@ -302,6 +302,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
tabular->GetAdditionalHeight(cell+1);
}
}
x -= ADD_TO_TABULAR_WIDTH;
x += width(bv, font);
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
need_update = INIT;
@ -591,6 +592,7 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
if (inset_hit && bv->the_locking_inset) {
ActivateCellInset(bv, x, y, button);
the_locking_inset->InsetButtonPress(bv, x-inset_x, y-inset_y, button);
return;
}
ShowInsetCursor(bv);
}
@ -609,10 +611,6 @@ void InsetTabular::InsetButtonRelease(BufferView * bv,
}
dialogs_ = bv->owner()->getDialogs();
dialogs_->showTabular(this);
#if 0
else if (ocell != actcell)
bview->getOwner()->getPopups().updateTabular();
#endif
return;
}
if (the_locking_inset) {
@ -631,18 +629,16 @@ void InsetTabular::InsetMotionNotify(BufferView * bv, int x, int y, int button)
return;
}
if (!no_selection) {
// int ocell = actcell,
int old = sel_pos_end;
HideInsetCursor(bv);
int old_pos = sel_pos_end;
int old_cell = actcell;
setPos(bv, x, y);
sel_pos_end = cursor.pos();
sel_cell_end = actcell;
if (old != sel_pos_end)
if ((sel_cell_end != old_cell) || (old_pos != sel_pos_end))
UpdateLocal(bv, SELECTION, false);
#if 0
if (ocell != actcell)
bview->getOwner()->getPopups().updateFormTabular();
#endif
ShowInsetCursor(bv);
}
no_selection = false;
}
@ -822,7 +818,42 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
if (!TabularFeatures(bv, arg))
result = UNDISPATCHED;
break;
case LFUN_CUT:
if (!copySelection())
break;
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next
#else
bv->text->cursor.par()->previous,
bv->text->cursor.par()->next
#endif
);
cutSelection();
UpdateLocal(bv, INIT, true);
break;
case LFUN_COPY:
if (!hasSelection())
break;
bv->text->FinishUndo();
copySelection();
break;
case LFUN_PASTE:
if (!hasPasteBuffer())
break;
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
#ifndef NEW_INSETS
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next
#else
bv->text->cursor.par()->previous,
bv->text->cursor.par()->next
#endif
);
pasteSelection(bv);
UpdateLocal(bv, INIT, true);
break;
default:
result = UNDISPATCHED;
break;
@ -1053,12 +1084,12 @@ UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
if (tabular->IsLastCell(actcell))
return FINISHED;
++actcell;
cursor.pos(cursor.pos() + 1);
cursor.pos((cursor.pos() + 1) % 2);
} else if (lock) {
if (ActivateCellInset(bv))
return DISPATCHED;
} else { // before the inset
cursor.pos(cursor.pos() + 1);
cursor.pos((cursor.pos() + 1) % 2);
}
resetPos(bv);
return DISPATCHED_NOUPDATE;
@ -1070,9 +1101,9 @@ UpdatableInset::RESULT InsetTabular::moveLeft(BufferView * bv, bool lock)
if (!cursor.pos()) {
if (!actcell)
return FINISHED;
cursor.pos(2);
cursor.pos(0);
}
cursor.pos(cursor.pos() - 1);
cursor.pos((cursor.pos() - 1) % 2);
if (!cellstart(cursor.pos())) {
--actcell;
} else if (lock) { // behind the inset
@ -1111,9 +1142,9 @@ bool InsetTabular::moveNextCell(BufferView * bv)
if (tabular->IsLastCell(actcell))
return false;
++actcell;
cursor.pos(cursor.pos() + 1);
cursor.pos((cursor.pos() + 1) % 2);
if (!cellstart(cursor.pos()))
cursor.pos(cursor.pos() + 1);
cursor.pos((cursor.pos() + 1) % 2);
resetPos(bv);
return true;
}
@ -1124,9 +1155,9 @@ bool InsetTabular::movePrevCell(BufferView * bv)
if (!actcell) // first cell
return false;
--actcell;
cursor.pos(cursor.pos() - 1);
cursor.pos((cursor.pos() - 1) % 2);
if (cellstart(cursor.pos()))
cursor.pos(cursor.pos() - 1);
cursor.pos((cursor.pos() - 1) % 2);
resetPos(bv);
return true;
}
@ -1450,9 +1481,10 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string value)
break;
case LyXTabular::SET_USEBOX:
{
int val = strToInt(value);
LyXTabular::BoxType val = static_cast<LyXTabular::BoxType>
(strToInt(value));
if (val == tabular->GetUsebox(actcell))
val = 0;
val = LyXTabular::BOX_NONE;
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetUsebox(tabular->GetCellNumber(i,j),val);
@ -1483,8 +1515,8 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button,
{
// the cursor.pos has to be before the inset so if it isn't now just
// reset the curor pos first!
if (cursor.pos() % 2) { // behind the inset
cursor.pos(cursor.pos() - 1);
if (!cellstart(cursor.pos())) {
cursor.pos((cursor.pos() - 1) % 2);
resetPos(bv);
}
UpdatableInset * inset =
@ -1509,7 +1541,7 @@ bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const
InsetText * inset = tabular->GetCellInset(actcell);
int x1 = x + top_x;
if (cursor.pos() % 2) { // behind the inset
if (!cellstart(cursor.pos())) {
return (((x + top_x) < cursor.x()) &&
((x + top_x) > (cursor.x() - inset->width(bv,
LyXFont(LyXFont::ALL_SANE)))));
@ -1802,3 +1834,87 @@ LyXFunc::func_status InsetTabular::getStatus(string what) const
}
return status;
}
bool InsetTabular::copySelection()
{
if (!hasSelection())
return false;
delete paste_tabular;
int sel_col_start, sel_col_end;
int sel_row_start, sel_row_end;
sel_col_start = tabular->column_of_cell(sel_cell_start);
sel_col_end = tabular->column_of_cell(sel_cell_end);
if (sel_col_start > sel_col_end) {
sel_col_start = sel_col_end;
sel_col_end = tabular->right_column_of_cell(sel_cell_start);
} else {
sel_col_end = tabular->right_column_of_cell(sel_cell_end);
}
int columns = sel_col_end - sel_col_start + 1;
sel_row_start = tabular->row_of_cell(sel_cell_start);
sel_row_end = tabular->row_of_cell(sel_cell_end);
if (sel_row_start > sel_row_end) {
int tmp;
tmp = sel_row_start;
sel_row_start = sel_row_end;
sel_row_end = tmp;
}
int rows = sel_row_end - sel_row_start + 1;
paste_tabular = new LyXTabular(this, rows, columns);
if (sel_cell_start > sel_cell_end) {
int tmp = sel_cell_start;
sel_cell_start = sel_cell_end;
sel_cell_end = tmp;
}
for(int i=sel_cell_start, j=0; i <= sel_cell_end; ++i, ++j) {
while(paste_tabular->row_of_cell(j) <
(tabular->row_of_cell(i)-sel_row_start)) {
++j;
}
while(paste_tabular->row_of_cell(j) >
(tabular->row_of_cell(i)-sel_row_start)) {
++i;
}
*(paste_tabular->GetCellInset(j)) = *(tabular->GetCellInset(i));
}
return true;
}
bool InsetTabular::pasteSelection(BufferView * bv)
{
if (!paste_tabular)
return false;
for(int j=0, i=actcell; j<paste_tabular->GetNumberOfCells(); ++j,++i) {
while (paste_tabular->row_of_cell(j) > tabular->row_of_cell(i)-actrow)
++i;
if (tabular->GetNumberOfCells() <= i)
break;
while (paste_tabular->row_of_cell(j) < tabular->row_of_cell(i)-actrow)
++j;
if (paste_tabular->GetNumberOfCells() <= j)
break;
*(tabular->GetCellInset(i)) = *(paste_tabular->GetCellInset(j));
tabular->GetCellInset(i)->setOwner(this);
tabular->GetCellInset(i)->deleteLyXText(bv);
}
return true;
}
bool InsetTabular::cutSelection()
{
if (!hasSelection())
return false;
for(int i=sel_cell_start; i < sel_cell_end; ++i) {
tabular->GetCellInset(i)->clear();
}
return true;
}

View File

@ -210,6 +210,12 @@ private:
bool InsetHit(BufferView * bv, int x, int y) const;
///
int GetMaxWidthOfCell(Painter &, int cell) const;
///
bool hasPasteBuffer() const { return (paste_tabular != 0); }
///
bool copySelection();
bool pasteSelection(BufferView *);
bool cutSelection();
///
/// Private structures and variables
@ -234,5 +240,6 @@ private:
mutable bool locked;
mutable UpdateCodes need_update;
mutable Dialogs * dialogs_;
LyXTabular * paste_tabular;
};
#endif

View File

@ -6,6 +6,8 @@
*
* Copyright 1998-2000 The LyX Team.
*
* @author: Jürgen Vigna
*
* ======================================================
*/
@ -245,8 +247,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
// no draw is necessary !!!
if ((drawFrame == LOCKED) && !locked && !par->size()) {
if (!cleared && (need_update == CLEAR_FRAME)) {
pain.rectangle(top_x, baseline - insetAscent, insetWidth,
insetAscent + insetDescent,
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
width(bv, f) - 1,
insetAscent + insetDescent - 1,
LColor::background);
}
top_x = int(x);
@ -283,7 +286,6 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
if (top_x != int(x)) {
need_update = INIT;
top_x = int(x);
// owner()->update(bv, f, true);
bv->text->status = LyXText::CHANGED_IN_DRAW;
return;
}
@ -302,10 +304,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
need_update = NONE;
return;
}
x += 1; // place for border
x += TEXT_TO_INSET_OFFSET;
long int y = 0;
Row * row = TEXT(bv)->GetRowNearY(y);
y += baseline - row->ascent_of_text() + 1;
y += baseline - row->ascent_of_text();
if (cleared || !locked || (need_update == FULL)) {
while (row != 0) {
TEXT(bv)->GetVisibleRow(bv, y, int(x), row, y, cleared);
@ -327,14 +329,15 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
TEXT(bv)->refresh_y = 0;
TEXT(bv)->status = LyXText::UNCHANGED;
if ((drawFrame == ALWAYS) || ((drawFrame == LOCKED) && locked)) {
pain.rectangle(top_x, baseline - insetAscent, insetWidth,
insetAscent + insetDescent, frame_color);
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
width(bv, f) - 1, insetAscent + insetDescent - 1,
frame_color);
} else if (need_update == CLEAR_FRAME) {
pain.rectangle(top_x, baseline - insetAscent, insetWidth,
insetAscent + insetDescent,
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
width(bv, f) - 1, insetAscent + insetDescent - 1,
LColor::background);
}
x += width(bv, f) - 1;
x += width(bv, f) - TEXT_TO_INSET_OFFSET;
if (bv->text->status==LyXText::CHANGED_IN_DRAW)
need_update = INIT;
else if (need_update != INIT)
@ -554,10 +557,10 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
no_selection = false;
int tmp_x = x - drawTextXOffset;
// int tmp_y = y + TEXT(bv)->first + insetAscent;
int tmp_y = y + insetAscent;
Inset * inset = bv->checkInsetHit(TEXT(bv), tmp_x, tmp_y, button);
HideInsetCursor(bv);
if (the_locking_inset) {
if (the_locking_inset == inset) {
the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
@ -601,6 +604,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
bv->owner()->setLayout(cpar(bv)->GetLayout());
old_par = cpar(bv);
}
ShowInsetCursor(bv);
}
@ -668,7 +672,6 @@ InsetText::LocalDispatch(BufferView * bv,
UpdatableInset::RESULT
result= UpdatableInset::LocalDispatch(bv, action, arg);
if (result != UNDISPATCHED) {
// resetPos(bv->painter());
return DISPATCHED;
}
@ -1034,8 +1037,7 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
if (cursor_visible)
bv->hideLockedInsetCursor();
else
bv->showLockedInsetCursor(cx(bv)-1, cy(bv),
asc, desc);
bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
cursor_visible = !cursor_visible;
}
@ -1297,14 +1299,14 @@ LyXFont InsetText::GetDrawFont(BufferView * bv, LyXParagraph * p, int pos) const
int InsetText::cx(BufferView * bv) const
{
return TEXT(bv)->cursor.x() + top_x + 1;
return TEXT(bv)->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
}
int InsetText::cy(BufferView * bv) const
{
LyXFont font;
return TEXT(bv)->cursor.y() - ascent(bv, font);
return TEXT(bv)->cursor.y() - ascent(bv, font) + TEXT_TO_INSET_OFFSET;
}
@ -1354,7 +1356,9 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
void InsetText::resizeLyXText(BufferView * bv) const
{
if (!par->next && !par->size()) // not neccessary!
if (!par->next && !par->size()) // resize not neccessary!
return;
if (cache.find(bv) == cache.end())
return;
LyXParagraph * lpar = 0;

View File

@ -6,6 +6,8 @@
*
* Copyright 1998 The LyX Team.
*
* @author: Jürgen Vigna
*
*======================================================
*/
// The pristine updatable inset: Text

View File

@ -110,19 +110,26 @@ void CloseAllBufferRelatedDialogs()
if (fd_form_paper->form_paper->visible) {
fl_hide_form(fd_form_paper->form_paper);
}
if (fd_form_bullet) {
if (fd_form_bullet->form_bullet->visible) {
fl_hide_form(fd_form_bullet->form_bullet);
}
}
#endif
if (fd_form_preamble->form_preamble->visible) {
fl_hide_form(fd_form_preamble->form_preamble);
}
if (fd_form_table->form_table->visible) {
fl_hide_form(fd_form_table->form_table);
}
if (fd_form_figure->form_figure->visible) {
fl_hide_form(fd_form_figure->form_figure);
}
#ifndef NEW_TABULAR
if (fd_form_table->form_table->visible) {
fl_hide_form(fd_form_table->form_table);
}
if (fd_form_table_options->form_table_options->visible) {
fl_hide_form(fd_form_table_options->form_table_options);
}
#endif
if (fd_form_sendto->form_sendto->visible) {
fl_hide_form(fd_form_sendto->form_sendto);
}
@ -134,11 +141,6 @@ void CloseAllBufferRelatedDialogs()
fl_trigger_object(fd_form_spell_check->done);
}
}
if (fd_form_bullet) {
if (fd_form_bullet->form_bullet->visible) {
fl_hide_form(fd_form_bullet->form_bullet);
}
}
if (fd_panel) {
if (fd_panel->panel->visible) {
fl_hide_form(fd_panel->panel);

View File

@ -3,20 +3,22 @@
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
* Copyright 2000 The LyX Team.
*
* @author: Jürgen Vigna
*
* ======================================================
*/
#include <config.h>
#include <algorithm>
#include <cstdlib>
#ifdef __GNUG__
#pragma implementation
#endif
#include <algorithm>
#include <cstdlib>
#include "tabular.h"
#include "debug.h"
#include "vspace.h"
@ -46,14 +48,17 @@ extern BufferView * current_view;
LyXTabular::cellstruct::cellstruct()
{
cellno = 0; //should be initilaized correctly later.
cellno = 0;
width_of_cell = 0;
multicolumn = LyXTabular::CELL_NORMAL;
alignment = LYX_ALIGN_CENTER;
top_line = true;
valignment = LYX_VALIGN_TOP;
top_line = false;
bottom_line = false;
left_line = false;
right_line = false;
usebox = BOX_NONE;
rotate = false;
usebox = false;
}
@ -72,6 +77,7 @@ LyXTabular::columnstruct::columnstruct()
left_line = true;
right_line = false;
alignment = LYX_ALIGN_CENTER;
valignment = LYX_VALIGN_TOP;
width_of_column = 0;
}
@ -186,7 +192,7 @@ void LyXTabular::Init(int rows_arg, int columns_arg)
columnofcell = 0;
set_row_column_number_info();
is_long_tabular = false;
rotate = 0;
rotate = false;
endhead = 0;
endfirsthead = 0;
endfoot = 0;
@ -945,7 +951,7 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const
" leftline=" << cell_info[i][j].left_line <<
" rightline=" << cell_info[i][j].right_line <<
" rotate=" << cell_info[i][j].rotate <<
" usebox=" << cell_info[i][j].usebox <<
" usebox=" << (int)cell_info[i][j].usebox <<
" width=\"" << cell_info[i][j].p_width <<
"\" special=\"" << cell_info[i][j].align_special <<
"\">" << endl;
@ -1593,9 +1599,9 @@ bool LyXTabular::IsLongTabular() const
}
void LyXTabular::SetRotateTabular(int what)
void LyXTabular::SetRotateTabular(bool flag)
{
rotate = what;
rotate = flag;
}
@ -1605,9 +1611,9 @@ bool LyXTabular::GetRotateTabular() const
}
void LyXTabular::SetRotateCell(int cell, int what)
void LyXTabular::SetRotateCell(int cell, bool flag)
{
cellinfo_of_cell(cell)->rotate = what;
cellinfo_of_cell(cell)->rotate = flag;
}
@ -1690,9 +1696,9 @@ int LyXTabular::GetCellNumber(int row, int column) const
}
void LyXTabular::SetUsebox(int cell, int what)
void LyXTabular::SetUsebox(int cell, BoxType type)
{
cellinfo_of_cell(cell)->usebox = what;
cellinfo_of_cell(cell)->usebox = type;
}
@ -1700,7 +1706,7 @@ int LyXTabular::GetUsebox(int cell) const
{
if (column_info[column_of_cell(cell)].p_width.empty() &&
!(IsMultiColumn(cell) && !cellinfo_of_cell(cell)->p_width.empty()))
return 0;
return BOX_NONE;
if (cellinfo_of_cell(cell)->usebox > 1)
return cellinfo_of_cell(cell)->usebox;
return UseParbox(cell);
@ -1958,7 +1964,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
os << "}{";
}
}
if (GetUsebox(cell) == 1) {
if (GetUsebox(cell) == BOX_PARBOX) {
os << "\\parbox[";
switch(GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
@ -1972,7 +1978,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
break;
}
os << "]{" << GetPWidth(cell) << "}{";
} else if (GetUsebox(cell) == 2) {
} else if (GetUsebox(cell) == BOX_MINIPAGE) {
os << "\\begin{minipage}[";
switch(GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
@ -1997,9 +2003,9 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
int ret = 0;
// usual cells
if (GetUsebox(cell) == 1)
if (GetUsebox(cell) == BOX_PARBOX)
os << "}";
else if (GetUsebox(cell) == 2) {
else if (GetUsebox(cell) == BOX_MINIPAGE) {
os << "%\n\\end{minipage}";
ret += 2;
}

View File

@ -6,6 +6,8 @@
*
* Copyright 2000 The LyX Team.
*
* @author: Jürgen Vigna
*
* ====================================================== */
#ifndef TABULAR_H
#define TABULAR_H
@ -143,6 +145,15 @@ public:
LYX_VALIGN_CENTER = 2
};
enum BoxType {
///
BOX_NONE = 0,
///
BOX_PARBOX = 1,
///
BOX_MINIPAGE = 2
};
/* konstruktor */
///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
@ -298,11 +309,11 @@ public:
///
bool IsLongTabular() const;
///
void SetRotateTabular(int what);
void SetRotateTabular(bool);
///
bool GetRotateTabular() const;
///
void SetRotateCell(int cell, int what);
void SetRotateCell(int cell, bool);
///
bool GetRotateCell(int cell) const;
///
@ -320,7 +331,7 @@ public:
///
int GetCellNumber(int row, int column) const;
///
void SetUsebox(int cell, int what);
void SetUsebox(int cell, BoxType);
///
int GetUsebox(int cell) const;
//
@ -357,14 +368,6 @@ private: //////////////////////////////////////////////////////////////////
struct cellstruct {
///
cellstruct();
#ifdef INSET_POINTER
///
~cellstruct();
//
cellstruct(cellstruct const &);
///
cellstruct & operator=(cellstruct const &);
#endif
///
int cellno;
///
@ -383,15 +386,10 @@ private: //////////////////////////////////////////////////////////////////
bool left_line;
///
bool right_line;
/**
0 ... don't use a box
1 ... use a parbox
2 ... use a minipage
This should be made into an enum (Lgb)
*/
///
int usebox;
///
int rotate;
bool rotate;
///
string align_special;
///
@ -408,10 +406,6 @@ private: //////////////////////////////////////////////////////////////////
struct rowstruct {
///
rowstruct();
//
//~rowstruct();
//
// rowstruct & operator=(rowstruct const &);
///
bool top_line;
///
@ -430,10 +424,6 @@ private: //////////////////////////////////////////////////////////////////
struct columnstruct {
///
columnstruct();
//
//~columnstruct();
//
//columnstruct & operator=(columnstruct const &);
///
int alignment;
///
@ -471,11 +461,11 @@ private: //////////////////////////////////////////////////////////////////
///
int width_of_tabular;
///
int rotate;
bool rotate;
//
// for long tabulars
///
int is_long_tabular;
bool is_long_tabular;
/// row of endhead
int endhead;
/// row of endfirsthead