Better parbox use in tabulars, add of scrolling of inset and automatic

scrolling of tabularinsets. Much better update performance in inset-tabular.
Still some stuff todo.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@955 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-08-07 15:21:05 +00:00
parent eeaae9c355
commit 612a097878
20 changed files with 348 additions and 228 deletions

View File

@ -1,3 +1,44 @@
2000-08-07 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (recomputeTextInsets): removed function
* src/tabular.C (SetWidthOfMulticolCell):
(SetWidthOfCell):
(calculate_width_of_column_NMC): fixed return value so that it really
only returns true if the column-width has changed (there where
problems with muliticolumn-cells in this column).
2000-08-04 Juergen Vigna <jug@sad.it>
* src/BufferView_pimpl.C (checkInsetHit): changed so that it looks
also on the scrollstatus of the inset.
(workAreaMotionNotify): ditto.
* src/texrow.C (getIdFromRow): fixed compile problem on egcs-1.1.2.
2000-08-01 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (resetPos): scroll tabular automatically.
* src/commandtags.h:
* src/LyXAction.C (init):
* src/insets/inset.C (LocalDispatch): added support for
LFUN_SCROLL_INSET.
* src/insets/inset.C (scroll): new functions.
* src/insets/insettext.C (removeNewlines): new function.
(SetAutoBreakRows): removes forced newlines in the text of the
paragraph if autoBreakRows is set to false.
* src/tabular.C (Latex): generates a parbox around the cell contents
if needed.
* src/frontends/xforms/FormTabular.C (local_update): removed
the radio_useparbox button.
* src/tabular.C (UseParbox): new function
2000-08-05 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/translator.h: move all typedefs to public section

View File

@ -506,7 +506,8 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
LyXCursor cursor = bv_->text->cursor;
bv_->the_locking_inset->
InsetMotionNotify(bv_,
x - cursor.x(),
x - cursor.x() -
bv_->the_locking_inset->scroll(),
y - cursor.y() + bv_->text->first,
state);
return;
@ -906,10 +907,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
LyXCursor cursor;
text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp);
#if 0 // Are you planning to use this Jürgen? (Lgb)
bool move_cursor = ((cursor.par != text->cursor.par) ||
(cursor.pos != text->cursor.pos()));
#endif
if (cursor.pos() < cursor.par()->Last()
&& cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos())
@ -923,20 +921,17 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
int start_x, end_x;
if (is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_, font);
end_x = cursor.x();
start_x = cursor.x() - tmpinset->width(bv_, font) + tmpinset->scroll();
end_x = cursor.x() + tmpinset->scroll();
} else {
start_x = cursor.x();
end_x = cursor.x() + tmpinset->width(bv_, font);
start_x = cursor.x() + tmpinset->scroll();
end_x = cursor.x() + tmpinset->width(bv_, font) + tmpinset->scroll();
}
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
#endif
text->SetCursor(bv_, cursor.par(),cursor.pos(),true);
text->SetCursor(bv_, cursor.par(),cursor.pos(),true);
x = x - start_x;
// The origin of an inset is on the baseline
y = y_tmp - (text->cursor.y());
@ -955,11 +950,13 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
int start_x, end_x;
if (!is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_, font);
end_x = cursor.x();
start_x = cursor.x() - tmpinset->width(bv_, font) +
tmpinset->scroll();
end_x = cursor.x() + tmpinset->scroll();
} else {
start_x = cursor.x();
end_x = cursor.x() + tmpinset->width(bv_, font);
start_x = cursor.x() + tmpinset->scroll();
end_x = cursor.x() + tmpinset->width(bv_, font) +
tmpinset->scroll();
}
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)

View File

@ -365,6 +365,8 @@ void LyXAction::init()
{ LFUN_CENTER, "screen-recenter", "", ReadOnly },
{ LFUN_PRIOR, "screen-up", "", ReadOnly },
{ LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
{ LFUN_SCROLL_INSET, "inset-scroll", N_("Scroll inset"),
ReadOnly },
{ LFUN_SELFINSERT, "self-insert", "", Noop },
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
{ LFUN_GETFONT, "server-get-font", "", ReadOnly },

View File

@ -273,6 +273,7 @@ enum kb_action {
LFUN_INSERT_URL, // Angus 20000726
LFUN_TABULAR_FEATURE, // Jug 20000728
LFUN_LAYOUT_TABULAR, // Jug 20000731
LFUN_SCROLL_INSET, // Jug 20000801
LFUN_INDEX_INSERT, // Angus 20000803
LFUN_LASTACTION /* this marks the end of the table */
};

View File

@ -38,6 +38,7 @@ using std::find;
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
: FormCommand(lv, d, _("Citation")), dialog_(0)
{
dialog_ = 0;
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.

View File

@ -407,24 +407,13 @@ bool FormTabular::local_update(bool)
fl_activate_object(column_options_->input_column_width);
}
if (!pwidth.empty()) {
fl_activate_object(cell_options_->radio_useparbox);
fl_activate_object(cell_options_->radio_useminipage);
fl_set_object_lcol(cell_options_->radio_useparbox, FL_BLACK);
fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK);
fl_set_button(cell_options_->radio_useparbox, 0);
fl_set_button(cell_options_->radio_useminipage, 0);
switch (tabular->GetUsebox(cell)) {
case 1:
fl_set_button(cell_options_->radio_useparbox, 1);
break;
case 2:
if (tabular->GetUsebox(cell) == 2)
fl_set_button(cell_options_->radio_useminipage, 1);
break;
}
else
fl_set_button(cell_options_->radio_useminipage, 0);
} else {
fl_deactivate_object(cell_options_->radio_useparbox);
fl_set_object_lcol(cell_options_->radio_useparbox, FL_INACTIVE);
fl_set_button(cell_options_->radio_useparbox,0);
fl_deactivate_object(cell_options_->radio_useminipage);
fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE);
fl_set_button(cell_options_->radio_useminipage,0);
@ -674,9 +663,6 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long)
num = LyXTabular::SET_ROTATE_CELL;
else
num = LyXTabular::UNSET_ROTATE_CELL;
} else if (ob == cell_options_->radio_useparbox) {
num = LyXTabular::SET_USEBOX;
special = "1";
} else if (ob == cell_options_->radio_useminipage) {
num = LyXTabular::SET_USEBOX;
special = "2";

View File

@ -29,6 +29,7 @@
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
: FormCommand(lv, d, _("Url")), dialog_(0)
{
dialog_ = 0;
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.

View File

@ -15,22 +15,22 @@ FD_form_tabular * FormTabular::build_tabular()
FL_OBJECT *obj;
FD_form_tabular *fdui = new FD_form_tabular;
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 315);
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 295);
fdui->form_tabular->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 315, "");
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 275, _("Tabbed folder"));
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 295, "");
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 250, _("Tabbed folder"));
fl_set_object_resize(obj, FL_RESIZE_ALL);
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 280, 90, 30, idex(_("Close|#C")));
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 260, 90, 30, idex(_("Close|#C")));
fl_set_button_shortcut(obj, scex(_("Close|#C")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularCloseCB, 0);
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 65, 280, 60, 30, "");
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 65, 260, 60, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 5, 280, 60, 30, "");
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 5, 260, 60, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 125, 275, 290, 30, "");
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 125, 260, 290, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
@ -190,28 +190,28 @@ FD_form_cell_options * FormTabular::build_cell_options()
FL_OBJECT *obj;
FD_form_cell_options *fdui = new FD_form_cell_options;
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 257);
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 227);
fdui->form_cell_options->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 257, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 335, 145, 155, 100, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 145, 180, 100, "");
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 335, 115, 155, 100, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 115, 180, 100, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
obj = fl_add_text(FL_NORMAL_TEXT, 15, 135, 70, 20, _("Borders"));
obj = fl_add_text(FL_NORMAL_TEXT, 15, 105, 70, 20, _("Borders"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 195, 145, 130, 100, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 195, 115, 130, 100, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_text(FL_NORMAL_TEXT, 200, 135, 115, 20, _("H. Alignment"));
obj = fl_add_text(FL_NORMAL_TEXT, 200, 105, 115, 20, _("H. Alignment"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
obj = fl_add_text(FL_NORMAL_TEXT, 345, 135, 115, 20, _("V. Alignment"));
obj = fl_add_text(FL_NORMAL_TEXT, 345, 105, 115, 20, _("V. Alignment"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 15, 150, 115, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 15, 150, 90, "");
obj = fl_add_text(FL_NORMAL_TEXT, 15, 5, 140, 20, _("Special Cell"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
@ -219,12 +219,9 @@ FD_form_cell_options * FormTabular::build_cell_options()
fdui->radio_multicolumn = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 25, 145, 25, idex(_("Multicolumn|#M")));
fl_set_button_shortcut(obj, scex(_("Multicolumn|#M")), 1);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_useparbox = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 50, 145, 25, idex(_("Use ParBox|#U")));
fl_set_button_shortcut(obj, scex(_("Use ParBox|#U")), 1);
fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 75, 145, 25, _("Rotate 90°"));
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 100, 145, 25, _("Rotate 90°"));
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 165, 15, 325, 115, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 165, 15, 325, 90, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->input_special_multialign = obj = fl_add_input(FL_NORMAL_INPUT, 175, 30, 310, 30, "");
@ -237,51 +234,51 @@ FD_form_cell_options * FormTabular::build_cell_options()
fdui->input_mcolumn_width = obj = fl_add_input(FL_NORMAL_INPUT, 360, 65, 125, 30, _("Width of multi-column:"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 170, 25, 25, idex(_("Top|#t")));
fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 140, 25, 25, idex(_("Top|#t")));
fl_set_button_shortcut(obj, scex(_("Top|#t")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 200, 25, 25, idex(_("Bottom|#b")));
fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 170, 25, 25, idex(_("Bottom|#b")));
fl_set_button_shortcut(obj, scex(_("Bottom|#b")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_BOTTOM_LEFT);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 185, 25, 25, idex(_("Left|#l")));
fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 155, 25, 25, idex(_("Left|#l")));
fl_set_button_shortcut(obj, scex(_("Left|#l")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 185, 25, 25, idex(_("Right|#r")));
fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 155, 25, 25, idex(_("Right|#r")));
fl_set_button_shortcut(obj, scex(_("Right|#r")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 155, 110, 25, idex(_("Left|#e")));
fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 125, 110, 25, idex(_("Left|#e")));
fl_set_button_shortcut(obj, scex(_("Left|#e")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 205, 115, 25, idex(_("Right|#i")));
fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 175, 115, 25, idex(_("Right|#i")));
fl_set_button_shortcut(obj, scex(_("Right|#i")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 180, 115, 25, idex(_("Center|#c")));
fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 150, 115, 25, idex(_("Center|#c")));
fl_set_button_shortcut(obj, scex(_("Center|#c")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 155, 140, 25, idex(_("Top|#p")));
fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 125, 140, 25, idex(_("Top|#p")));
fl_set_button_shortcut(obj, scex(_("Top|#p")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 180, 140, 25, idex(_("Center|#n")));
fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 150, 140, 25, idex(_("Center|#n")));
fl_set_button_shortcut(obj, scex(_("Center|#n")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 205, 140, 25, idex(_("Bottom|#o")));
fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 175, 140, 25, idex(_("Bottom|#o")));
fl_set_button_shortcut(obj, scex(_("Bottom|#o")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fdui->radio_useminipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 75, 145, 25, idex(_("Use Minipage|#s")));
fdui->radio_useminipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 50, 145, 25, idex(_("Use Minipage|#s")));
fl_set_button_shortcut(obj, scex(_("Use Minipage|#s")), 1);
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
fl_end_form();

View File

@ -1,4 +1,4 @@
/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/
/** Header file generated with fdesign on Tue Aug 1 15:15:57 2000.**/
#ifndef FD_form_tabular_h_
#define FD_form_tabular_h_
@ -61,7 +61,6 @@ struct FD_form_cell_options {
FL_FORM *form_cell_options;
FL_OBJECT *radio_multicolumn;
FL_OBJECT *radio_useparbox;
FL_OBJECT *radio_rotate_cell;
FL_OBJECT *input_special_multialign;
FL_OBJECT *input_mcolumn_width;

View File

@ -10,13 +10,13 @@ SnapGrid: 5
=============== FORM ===============
Name: form_tabular
Width: 510
Height: 315
Height: 295
Number of Objects: 6
--------------------
class: FL_BOX
type: FLAT_BOX
box: 0 0 510 315
box: 0 0 510 295
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -34,7 +34,7 @@ argument:
--------------------
class: FL_TABFOLDER
type: TOP_TABFOLDER
box: 0 0 505 275
box: 0 0 505 250
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_TOP_LEFT
@ -52,7 +52,7 @@ argument:
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 415 280 90 30
box: 415 260 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -70,7 +70,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 65 280 60 30
box: 65 260 60 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP_LEFT
@ -88,7 +88,7 @@ argument:
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 5 280 60 30
box: 5 260 60 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP_LEFT
@ -106,7 +106,7 @@ argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 125 275 290 30
box: 125 260 290 30
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@ -712,13 +712,13 @@ argument: 0
=============== FORM ===============
Name: form_cell_options
Width: 505
Height: 257
Number of Objects: 27
Height: 227
Number of Objects: 26
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 505 257
box: 0 0 505 227
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -736,7 +736,7 @@ argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 335 145 155 100
box: 335 115 155 100
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
@ -754,7 +754,7 @@ argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 10 145 180 100
box: 10 115 180 100
boxtype: FL_NO_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -772,7 +772,7 @@ argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 15 135 70 20
box: 15 105 70 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@ -790,7 +790,7 @@ argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 195 145 130 100
box: 195 115 130 100
boxtype: FL_NO_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -808,7 +808,7 @@ argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 200 135 115 20
box: 200 105 115 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@ -826,7 +826,7 @@ argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 345 135 115 20
box: 345 105 115 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
@ -844,7 +844,7 @@ argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 10 15 150 115
box: 10 15 150 90
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
@ -898,25 +898,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 10 50 145 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Use ParBox|#U
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_useparbox
callback: C_FormTabularInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 10 100 145 25
box: 10 75 145 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -934,7 +916,7 @@ argument: 0
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 165 15 325 115
box: 165 15 325 90
boxtype: FL_NO_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -1006,7 +988,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 75 170 25 25
box: 75 140 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
@ -1024,7 +1006,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 75 200 25 25
box: 75 170 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_BOTTOM_LEFT
@ -1042,7 +1024,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 55 185 25 25
box: 55 155 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
@ -1060,7 +1042,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 95 185 25 25
box: 95 155 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
@ -1078,7 +1060,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 195 155 110 25
box: 195 125 110 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1096,7 +1078,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 195 205 115 25
box: 195 175 115 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1114,7 +1096,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 195 180 115 25
box: 195 150 115 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1132,7 +1114,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 345 155 140 25
box: 345 125 140 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1150,7 +1132,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 345 180 140 25
box: 345 150 140 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1168,7 +1150,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 345 205 140 25
box: 345 175 140 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1186,7 +1168,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 10 75 145 25
box: 10 50 145 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER

View File

@ -14,11 +14,17 @@
#pragma implementation "lyxinset.h"
#endif
#define SCROLL_INSET
#include "lyxinset.h"
#include "debug.h"
#include "BufferView.h"
#include "support/lstrings.h"
#include "Painter.h"
#ifdef SCROLL_INSET
#include "commandtags.h"
#include "support/lstrings.h"
#endif
using std::endl;
@ -26,19 +32,19 @@ using std::endl;
bool Inset::Deletable() const
{
return true;
return true;
}
bool Inset::DirectWrite() const
{
return false;
return false;
}
Inset::EDITABLE Inset::Editable() const
{
return NOT_EDITABLE;
return NOT_EDITABLE;
}
@ -49,7 +55,7 @@ void Inset::Validate(LaTeXFeatures &) const
bool Inset::AutoDelete() const
{
return false;
return false;
}
@ -60,13 +66,13 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
LyXFont Inset::ConvertFont(LyXFont const & font) const
{
return LyXFont(font);
return LyXFont(font);
}
char const * Inset::EditMessage() const
{
return _("Opened inset");
return _("Opened inset");
}
@ -83,41 +89,41 @@ LyXText * Inset::getLyXText(BufferView * bv) const
void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
{
lyxerr.debug() << "Inset Button Press x=" << x
<< ", y=" << y << ", button=" << button << endl;
lyxerr.debug() << "Inset Button Press x=" << x
<< ", y=" << y << ", button=" << button << endl;
}
void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
{
lyxerr.debug() << "Inset Button Release x=" << x
<< ", y=" << y << ", button=" << button << endl;
lyxerr.debug() << "Inset Button Release x=" << x
<< ", y=" << y << ", button=" << button << endl;
}
void UpdatableInset::InsetKeyPress(XKeyEvent *)
{
lyxerr.debug() << "Inset Keypress" << endl;
lyxerr.debug() << "Inset Keypress" << endl;
}
void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
{
lyxerr.debug() << "Inset Motion Notify x=" << x
<< ", y=" << y << ", state=" << state << endl;
lyxerr.debug() << "Inset Motion Notify x=" << x
<< ", y=" << y << ", state=" << state << endl;
}
void UpdatableInset::InsetUnlock(BufferView *)
{
lyxerr.debug() << "Inset Unlock" << endl;
lyxerr.debug() << "Inset Unlock" << endl;
}
// An updatable inset is highly editable by definition
Inset::EDITABLE UpdatableInset::Editable() const
{
return HIGHLY_EDITABLE;
return HIGHLY_EDITABLE;
}
@ -136,20 +142,15 @@ void UpdatableInset::HideInsetCursor(BufferView *)
}
void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
void UpdatableInset::Edit(BufferView *, int, int, unsigned int)
{
LyXFont font;
scx = 0;
mx_scx = abs((width(bv, font) - bv->workWidth()) / 2);
}
void UpdatableInset::draw(BufferView *, LyXFont const &,
int /* baseline */, float & x, bool/*cleared*/) const
{
if (scx) x += float(scx);
x += float(scx);
// ATTENTION: don't do the following here!!!
// top_x = int(x);
// top_baseline = baseline;
@ -161,10 +162,59 @@ void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
}
#ifdef SCROLL_INSET
void UpdatableInset::scroll(BufferView * bv, float s) const
{
LyXFont font;
if (((top_x - scx) > 0) &&
(top_x - scx + width(bv, font)) < bv->workWidth())
return;
if ((s > 0) && (top_x > 0))
return;
// int mx_scx=abs((width(bv,font) - bv->workWidth())/2);
int save_scx = scx;
scx = int(s*bv->workWidth()/2);
// if (!display())
// scx += 20;
if ((top_x - save_scx + scx + width(bv, font)) < (bv->workWidth()/2)) {
scx += (bv->workWidth()/2) - (top_x - save_scx + scx + width(bv,font));
}
// bv->updateInset(const_cast<UpdatableInset *>(this), false);
}
void UpdatableInset::scroll(BufferView * bv, int offset) const
{
if (offset > 0) {
if (!scx && top_x > 0)
return;
if ((top_x + offset) > 20)
scx += offset - (top_x - scx + offset - 20);
else
scx += offset;
} else {
LyXFont font;
if (!scx && (top_x+width(bv, font)) < (bv->workWidth()-20))
return;
if ((top_x - scx + offset + width(bv,font)) < (bv->workWidth()-20)) {
scx = bv->workWidth() - width(bv,font) - top_x + scx - 20;
} else {
scx += offset;
}
}
// bv->updateInset(const_cast<UpdatableInset *>(this), false);
}
#endif
/// An updatable inset could handle lyx editing commands
#ifdef SCROLL_INSET
UpdatableInset::RESULT
UpdatableInset::LocalDispatch(BufferView *,
UpdatableInset::LocalDispatch(BufferView * bv,
int action, string const & arg)
#else
UpdatableInset::RESULT
@ -172,14 +222,19 @@ UpdatableInset::LocalDispatch(BufferView *, int, string const &)
#endif
{
#ifdef SCROLL_INSET
if (action==LFUN_SCROLL_INSET)
{
float xx;
sscanf(arg.c_str(), "%f", &xx);
scroll(xx);
return DISPATCHED;
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
if (arg.find('.') != arg.npos) {
float xx = static_cast<float>(strToDbl(arg));
scroll(bv, xx);
} else {
int xx = strToInt(arg);
scroll(bv, xx);
}
bv->updateInset(this, false);
return DISPATCHED;
}
#endif
return UNDISPATCHED;
}

View File

@ -259,9 +259,19 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
DrawCellSelection(pain, nx, baseline, i, j, cell);
if (dodraw && !cleared && locked && the_locking_inset) {
if (the_locking_inset == tabular->GetCellInset(cell))
#warning Reminder make this better! (Jug)
if (need_update == CELL) // clear this cell
pain.fillRectangle(cx,
baseline -
tabular->GetAscentOfRow(i),
tabular->GetWidthOfColumn(cell),
tabular->GetAscentOfRow(i) +
tabular->GetDescentOfRow(i));
tabular->GetCellInset(cell)->draw(bv, font,
baseline, cx,
cleared);
need_update==CELL);
if (need_update == CELL)
DrawCellLines(pain, nx, baseline, i, cell);
} else if (dodraw) {
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx,
cleared);
@ -276,7 +286,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
}
}
x += width(bv, font);
need_update = NONE;
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
need_update = INIT;
else
need_update = NONE;
}
@ -403,23 +416,27 @@ void InsetTabular::InsetUnlock(BufferView * bv)
the_locking_inset = 0;
}
HideInsetCursor(bv);
if (hasSelection()) {
sel_pos_start = sel_pos_end = 0;
sel_cell_start = sel_cell_end = 0;
UpdateLocal(bv, FULL, false);
}
no_selection = false;
oldcell = -1;
locked = false;
if (scroll() || hasSelection()) {
if (scroll()) {
scroll(bv, (float)0.0);
} else {
sel_pos_start = sel_pos_end = 0;
sel_cell_start = sel_cell_end = 0;
}
UpdateLocal(bv, FULL, false);
}
}
void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what,
bool mark_dirty)
bool mark_dirty) const
{
need_update = what;
bv->updateInset(this, mark_dirty);
if (what != NONE)
bv->updateInset(const_cast<InsetTabular *>(this), mark_dirty);
if (locked && (what != NONE))
resetPos(bv);
}
@ -536,8 +553,12 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
no_selection = false;
int ocell = actcell;
int orow = actrow;
HideInsetCursor(bv);
setPos(bv, x, y);
if (actrow != orow)
UpdateLocal(bv, NONE, false);
sel_pos_start = sel_pos_end = cursor.pos();
sel_cell_start = sel_cell_end = actcell;
@ -554,6 +575,7 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
ActivateCellInset(bv, x, y, button);
the_locking_inset->InsetButtonPress(bv, x-inset_x, y-inset_y, button);
}
ShowInsetCursor(bv);
}
@ -905,17 +927,21 @@ void InsetTabular::ShowInsetCursor(BufferView * bv)
void InsetTabular::HideInsetCursor(BufferView * bv)
{
if (cursor_visible)
ToggleInsetCursor(bv);
if (cursor_visible) {
bv->hideLockedInsetCursor();
cursor_visible = false;
}
// if (cursor_visible)
// ToggleInsetCursor(bv);
}
void InsetTabular::setPos(BufferView * bv, int x, int y) const
{
cursor.y(0);
cursor.pos(0);
cursor.y(0);
cursor.pos(0);
actcell = actrow = actcol = 0;
actcell = actrow = actcol = 0;
int ly = tabular->GetDescentOfRow(actrow);
// first search the right row
@ -935,12 +961,12 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
for(; !tabular->IsLastCellInRow(actcell) && (lx < x);
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
tabular->GetAdditionalWidth(actcell - 1));
cursor.pos(((actcell+1) * 2) - 1);
cursor.pos(0);
resetPos(bv);
if ((lx - (tabular->GetWidthOfColumn(actcell)/2)) < x) {
cursor.x(lx + top_x - 2);
cursor.pos(1);
} else {
cursor.pos(cursor.pos() - 1);
cursor.x(lx - tabular->GetWidthOfColumn(actcell) + top_x + 2);
}
resetPos(bv);
@ -957,8 +983,7 @@ int InsetTabular::getCellXPos(int cell) const
for(; (c < cell); ++c) {
lx += tabular->GetWidthOfColumn(c);
}
return (lx - tabular->GetWidthOfColumn(cell) + top_x +
ADD_TO_TABULAR_WIDTH);
return (lx - tabular->GetWidthOfColumn(cell) + top_x);
}
@ -979,8 +1004,18 @@ void InsetTabular::resetPos(BufferView * bv) const
++actrow;
}
}
cursor.x(getCellXPos(actcell) + 2);
if (cursor.pos() % 2) {
static int offset = ADD_TO_TABULAR_WIDTH + 2;
cursor.x(getCellXPos(actcell) + offset);
if (((cursor.x() - offset) > 20) &&
((cursor.x()-offset+tabular->GetWidthOfColumn(actcell)) >
(bv->workWidth()-20)))
{
scroll(bv, -tabular->GetWidthOfColumn(actcell)-20);
UpdateLocal(bv, FULL, false);
} else if ((cursor.x() - offset) < 20) {
scroll(bv, 20 - cursor.x() + offset);
UpdateLocal(bv, FULL, false);
} else if (!cellstart(cursor.pos())) {
LyXFont font(LyXFont::ALL_SANE);
cursor.x(cursor.x() + tabular->GetCellInset(actcell)->width(bv,font) +
tabular->GetBeginningOfTextInCell(actcell));
@ -1500,28 +1535,6 @@ int InsetTabular::getMaxWidth(Painter & pain,
}
void InsetTabular::recomputeTextInsets(BufferView * bv,
LyXFont const & font) const
{
InsetText * inset;
int cell;
// cx = top_x;
for(int j= 0; j < tabular->columns(); ++j) {
for(int i = 0; i < tabular->rows(); ++i) {
if (tabular->IsPartOfMultiColumn(i,j))
continue;
cell = tabular->GetCellNumber(i,j);
inset = tabular->GetCellInset(cell);
inset->update(bv, font);
tabular->SetWidthOfCell(cell, inset->width(bv, font));
}
// cell = tabular->GetCellNumber(0, j);
// cx += tabular->GetWidthOfColumn(cell);
}
}
void InsetTabular::resizeLyXText(BufferView *) const
{
need_update = FULL;

View File

@ -102,7 +102,7 @@ public:
///
void InsetUnlock(BufferView *);
///
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty) const;
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
@ -209,8 +209,6 @@ private:
bool InsetHit(BufferView * bv, int x, int y) const;
///
int GetMaxWidthOfCell(Painter &, int cell) const;
///
void recomputeTextInsets(BufferView *, const LyXFont &) const;
///
/// Private structures and variables

View File

@ -175,14 +175,14 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
continue;
if (token == "\\end_inset")
break;
if (const_cast<Buffer*>(buf)->parseSingleLyXformat2Token(lex, par, return_par,
token, pos, depth,
font
if (const_cast<Buffer*>(buf)->
parseSingleLyXformat2Token(lex, par, return_par,token, pos, depth,
font
#ifndef NEW_INSETS
, footnoteflag,
footnotekind
, footnoteflag, footnotekind
#endif
)) {
))
{
// the_end read this should NEVER happen
lex.printError("\\the_end read in inset! Error in document!");
return;
@ -267,9 +267,9 @@ 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);
// owner()->update(bv, f, true);
bv->text->status = LyXText::CHANGED_IN_DRAW;
// return;
return;
}
top_baseline = baseline;
@ -319,7 +319,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
LColor::background);
}
x += insetWidth - TEXT_TO_INSET_OFFSET;
if (need_update != INIT)
if (bv->text->status==LyXText::CHANGED_IN_DRAW)
need_update = INIT;
else if (need_update != INIT)
need_update = NONE;
}
@ -1244,6 +1246,8 @@ void InsetText::SetAutoBreakRows(bool flag)
if (flag != autoBreakRows) {
autoBreakRows = flag;
need_update = FULL;
if (!flag)
removeNewlines();
}
}
@ -1390,3 +1394,16 @@ void InsetText::resizeLyXText(BufferView * bv) const
}
need_update = FULL;
}
void InsetText::removeNewlines()
{
LyXParagraph * p = par;
for(;p; p = p->next) {
for(int i = 0; i < p->Last(); ++i) {
if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
p->Erase(i);
}
}
}

View File

@ -205,6 +205,8 @@ private:
///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
void removeNewlines();
///
int cx(BufferView *) const;
///

View File

@ -116,7 +116,7 @@ public:
};
///
Inset() { owner_ = 0; top_x = top_baseline = 0; }
Inset() { owner_ = 0; top_x = top_baseline = 0; scx = 0; }
///
virtual ~Inset() {}
///
@ -215,11 +215,14 @@ public:
virtual LyXText * getLyXText(BufferView *) const;
virtual void deleteLyXText(BufferView *, bool =true) const {}
virtual void resizeLyXText(BufferView *) const {}
// returns the actuall scroll-value
int scroll() const { return scx; }
protected:
///
mutable int top_x;
mutable int top_baseline;
mutable int scx;
private:
///
@ -283,7 +286,7 @@ public:
}
///
UpdatableInset() { scx = mx_scx = 0; }
UpdatableInset() {}
///
virtual EDITABLE Editable() const;
@ -341,14 +344,16 @@ public:
virtual bool isCursorVisible() const { return cursor_visible; }
///
virtual int getMaxWidth(Painter & pain, UpdatableInset const *) const;
///
int scroll() const { return scx; }
protected:
///
mutable bool cursor_visible;
private:
///
int mx_scx;
mutable int scx;
// scrolls to absolute position in bufferview-workwidth * sx units
void scroll(BufferView *, float sx) const;
// scrolls offset pixels
void scroll(BufferView *, int offset) const;
};
#endif

View File

@ -930,6 +930,7 @@ string LyXFunc::Dispatch(int ac,
break;
case LFUN_TABULAR_FEATURE:
case LFUN_SCROLL_INSET:
// this is not handled here as this funktion is only aktive
// if we have a locking_inset and that one is (or contains)
// a tabular-inset

View File

@ -249,7 +249,7 @@ void LyXTabular::AppendColumn(int cell)
cellstruct()));
int column = column_of_cell(cell);
int i, j;
column_vector::iterator cit = column_info.begin() + column;
column_vector::iterator cit = column_info.begin() + column + 1;
column_info.insert(cit, columnstruct());
for (i = 0; i < rows_; ++i) {
@ -544,11 +544,13 @@ bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width)
}
// set the width to MAX_WIDTH until width > 0
int width = (new_width + 2 * WIDTH_OF_LINE);
for (i = column1; (i < column2) && (width > 0); ++i) {
for (i = column1; (i < column2) && (width>column_info[i].width_of_column);
++i)
{
cell_info[row][i].width_of_cell = column_info[i].width_of_column;
width -= column_info[i].width_of_column;
}
if (i == column2) {
if (width > 0) {
cell_info[row][i].width_of_cell = width;
}
return true;
@ -578,10 +580,12 @@ bool LyXTabular::SetWidthOfCell(int cell, int new_width)
{
int row = row_of_cell(cell);
int column1 = column_of_cell(cell);
int tmp = 0;
bool tmp = false;
int width = 0;
if (IsMultiColumn(cell)) {
if (GetWidthOfCell(cell) == (new_width+2*WIDTH_OF_LINE))
return false;
if (IsMultiColumn(cell, true)) {
tmp = SetWidthOfMulticolCell(cell, new_width);
} else {
width = (new_width + 2*WIDTH_OF_LINE);
@ -779,9 +783,6 @@ int LyXTabular::GetWidthOfCell(int cell) const
for (; i <= column2; ++i) {
result += cell_info[row][i].width_of_cell;
}
// result += GetAdditionalWidth(cell);
return result;
}
@ -847,12 +848,16 @@ bool LyXTabular::calculate_width_of_column(int column)
}
///
/// calculate the with of the column without regarding REAL MultiColumn
/// cells. This means MultiColumn-cells spanning more than 1 column.
///
bool LyXTabular::calculate_width_of_column_NMC(int column)
{
int old_column_width = column_info[column].width_of_column;
int max = 0;
for (int i = 0; i < rows_; ++i) {
if (!IsMultiColumn(GetCellNumber(i, column)) &&
if (!IsMultiColumn(GetCellNumber(i, column), true) &&
(cell_info[i][column].width_of_cell > max)) {
max = cell_info[i][column].width_of_cell;
}
@ -1509,9 +1514,10 @@ int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
}
bool LyXTabular::IsMultiColumn(int cell) const
bool LyXTabular::IsMultiColumn(int cell, bool real) const
{
return (cellinfo_of_cell(cell)->multicolumn != LyXTabular::CELL_NORMAL);
return ((!real || (column_of_cell(cell) != right_column_of_cell(cell))) &&
(cellinfo_of_cell(cell)->multicolumn !=LyXTabular::CELL_NORMAL));
}
@ -1694,8 +1700,10 @@ 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 false;
return cellinfo_of_cell(cell)->usebox;
return 0;
if (cellinfo_of_cell(cell)->usebox > 1)
return cellinfo_of_cell(cell)->usebox;
return UseParbox(cell);
}
@ -2169,3 +2177,17 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
GetCellInset(cell)->Validate(features);
}
}
bool LyXTabular::UseParbox(int cell) const
{
LyXParagraph *par = GetCellInset(cell)->par;
for(;par; par = par->next) {
for(int i = 0; i < par->Last(); ++i) {
if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
return true;
}
}
return false;
}

View File

@ -230,7 +230,7 @@ public:
char const * GetDocBookAlign(int cell, bool isColumn = false) const;
///
bool IsMultiColumn(int cell) const;
bool IsMultiColumn(int cell, bool real = false) const;
///
void SetMultiColumn(int cell, int number);
///
@ -407,8 +407,12 @@ private: //////////////////////////////////////////////////////////////////
///
int width_of_tabular;
///
int rotate;
///
/// for long tabulars
///
int is_long_tabular;
///
int endhead; // row of endhead
int endfirsthead; // row of endfirsthead
int endfoot; // row of endfoot
@ -430,19 +434,14 @@ private: //////////////////////////////////////////////////////////////////
bool calculate_width_of_column_NMC(int column); // no multi cells
///
void calculate_width_of_tabular();
///
cellstruct * cellinfo_of_cell(int cell) const;
///
void delete_column(int column);
///
int cells_in_multicolumn(int cell) const;
///
int is_long_tabular;
///
int rotate;
bool UseParbox(int cell) const;
};
#endif

View File

@ -3038,9 +3038,10 @@ void LyXText::PrepareToPrint(BufferView * bview,
#endif
// center displayed insets
Inset * inset;
if (row->par()->GetChar(row->pos()) == LyXParagraph::META_INSET
&& row->par()->GetInset(row->pos())
&& row->par()->GetInset(row->pos())->display())
&& (inset=row->par()->GetInset(row->pos()))
&& (inset->display())) // || (inset->scroll() < 0)))
align = LYX_ALIGN_CENTER;
switch (align) {