+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
# 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"
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"
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_);
{ 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",
extern GLyxAppWin * mainAppWin;
// Some constants
+extern kb_keymap * toplevel_keymap;
extern LyXAction lyxaction;
extern BufferList bufferlist;
extern LastFiles * lastfiles;
{
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.
}
if ((flag & LyXFunc::ToggleOn) || (flag & LyXFunc::ToggleOff))
gitem = Gnome::UI::ToggleItem(label, cback, lyxaction.helpText(item.action()));
-
+
Menus.push_back(gitem);
break;
}
}
}
-void Menubar::Pimpl::openByName(string const & name)
+void Menubar::Pimpl::openByName(string const &)
{
// Pimpl::update();
}
cursor.pos(0);
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
dialogs_ = 0;
+ paste_tabular = 0;
need_update = INIT;
}
cursor.pos(0);
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
dialogs_ = 0;
+ paste_tabular = 0;
need_update = INIT;
}
}
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) {
tabular->GetAdditionalHeight(cell+1);
}
}
+ x -= ADD_TO_TABULAR_WIDTH;
x += width(bv, font);
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
need_update = INIT;
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);
}
}
dialogs_ = bv->owner()->getDialogs();
dialogs_->showTabular(this);
-#if 0
- else if (ocell != actcell)
- bview->getOwner()->getPopups().updateTabular();
-#endif
return;
}
if (the_locking_inset) {
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;
}
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;
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;
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
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;
}
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;
}
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);
{
// 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 =
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)))));
}
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;
+}
+
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
mutable bool locked;
mutable UpdateCodes need_update;
mutable Dialogs * dialogs_;
+ LyXTabular * paste_tabular;
};
#endif
*
* Copyright 1998-2000 The LyX Team.
*
+ * @author: Jürgen Vigna
+ *
* ======================================================
*/
// 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);
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;
}
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);
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)
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);
bv->owner()->setLayout(cpar(bv)->GetLayout());
old_par = cpar(bv);
}
+ ShowInsetCursor(bv);
}
UpdatableInset::RESULT
result= UpdatableInset::LocalDispatch(bv, action, arg);
if (result != UNDISPATCHED) {
-// resetPos(bv->painter());
return DISPATCHED;
}
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;
}
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;
}
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;
*
* Copyright 1998 The LyX Team.
*
+ * @author: Jürgen Vigna
+ *
*======================================================
*/
// The pristine updatable inset: Text
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);
}
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);
*
* 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"
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;
}
left_line = true;
right_line = false;
alignment = LYX_ALIGN_CENTER;
+ valignment = LYX_VALIGN_TOP;
width_of_column = 0;
}
columnofcell = 0;
set_row_column_number_info();
is_long_tabular = false;
- rotate = 0;
+ rotate = false;
endhead = 0;
endfirsthead = 0;
endfoot = 0;
" 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;
}
-void LyXTabular::SetRotateTabular(int what)
+void LyXTabular::SetRotateTabular(bool flag)
{
- rotate = what;
+ rotate = flag;
}
}
-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;
}
}
-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;
}
{
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);
os << "}{";
}
}
- if (GetUsebox(cell) == 1) {
+ if (GetUsebox(cell) == BOX_PARBOX) {
os << "\\parbox[";
switch(GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
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:
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;
}
*
* Copyright 2000 The LyX Team.
*
+ * @author: Jürgen Vigna
+ *
* ====================================================== */
#ifndef TABULAR_H
#define TABULAR_H
LYX_VALIGN_CENTER = 2
};
+ enum BoxType {
+ ///
+ BOX_NONE = 0,
+ ///
+ BOX_PARBOX = 1,
+ ///
+ BOX_MINIPAGE = 2
+ };
+
/* konstruktor */
///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
///
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;
///
///
int GetCellNumber(int row, int column) const;
///
- void SetUsebox(int cell, int what);
+ void SetUsebox(int cell, BoxType);
///
int GetUsebox(int cell) const;
//
struct cellstruct {
///
cellstruct();
-#ifdef INSET_POINTER
- ///
- ~cellstruct();
- //
- cellstruct(cellstruct const &);
- ///
- cellstruct & operator=(cellstruct const &);
-#endif
///
int cellno;
///
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;
///
struct rowstruct {
///
rowstruct();
- //
- //~rowstruct();
- //
- // rowstruct & operator=(rowstruct const &);
///
bool top_line;
///
struct columnstruct {
///
columnstruct();
- //
- //~columnstruct();
- //
- //columnstruct & operator=(columnstruct const &);
///
int alignment;
///
///
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