From 0f1623f064f2b8ad4dd47619e51bb08c1b9d1506 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 13 Jul 2000 15:03:34 +0000 Subject: [PATCH] Patch fdfix from Angus, using only the new tabular-layout, some fixes! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@881 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 2 + po/POTFILES.in | 8 +- src/Makefile.am | 1 - src/TableLayout.C | 21 +- src/TabularLayout.C | 449 ------------------------ src/frontends/xforms/FormTabular.C | 203 +++++++++-- src/frontends/xforms/FormTabular.h | 6 +- src/frontends/xforms/form_citation.C | 3 +- src/frontends/xforms/form_citation.h | 11 +- src/frontends/xforms/form_copyright.C | 3 +- src/frontends/xforms/form_copyright.h | 11 +- src/frontends/xforms/form_preferences.C | 3 +- src/frontends/xforms/form_preferences.h | 53 +-- src/frontends/xforms/form_print.C | 3 +- src/frontends/xforms/form_print.h | 11 +- src/frontends/xforms/form_tabular.C | 3 +- src/frontends/xforms/form_tabular.h | 46 +-- src/frontends/xforms/forms/fdfix.sh | 19 +- src/frontends/xforms/forms/makefile | 10 +- src/insets/insettabular.C | 45 +-- src/text.C | 14 + 21 files changed, 274 insertions(+), 651 deletions(-) delete mode 100644 src/TabularLayout.C diff --git a/ChangeLog b/ChangeLog index 028cc1c495..e1146d8d1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2000-07-13 Juergen Vigna + * src/text.C (GetVisibleRow): fixed clearing of rows with insets! + * lib/examples/Literate.lyx: small patch! * src/insets/insetbib.C (Read): added this function because of wrong diff --git a/po/POTFILES.in b/po/POTFILES.in index e7cfff5210..0961c34f8e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -33,6 +33,13 @@ src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_preferences.C src/frontends/xforms/FormPrint.C src/frontends/xforms/form_print.C +src/frontends/xforms/forms/form_citation.C +src/frontends/xforms/forms/form_copyright.C +src/frontends/xforms/forms/form_preferences.C +src/frontends/xforms/forms/form_print.C +src/frontends/xforms/forms/form_tabular.C +src/frontends/xforms/FormTabular.C +src/frontends/xforms/form_tabular.C src/gettext.h src/insets/figinset.C src/insets/form_graphics.C @@ -106,6 +113,5 @@ src/support/path.h src/table.C src/TableLayout.C src/tabular.C -src/TabularLayout.C src/text2.C src/text.C diff --git a/src/Makefile.am b/src/Makefile.am index 82debf7ca1..59b6fef0b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,7 +66,6 @@ lyx_SOURCES = \ Spacing.C \ Spacing.h \ TableLayout.C \ - TabularLayout.C \ TextCache.C \ TextCache.h \ Timeout.C \ diff --git a/src/TableLayout.C b/src/TableLayout.C index 810b281358..f047f7af00 100644 --- a/src/TableLayout.C +++ b/src/TableLayout.C @@ -23,11 +23,6 @@ extern FD_form_table_options * fd_form_table_options; extern FD_form_table_extra * fd_form_table_extra; extern BufferView * current_view; -extern bool UpdateLayoutTabular(int); -extern void TabularOptionsCB(FL_OBJECT * ob, long l); -extern void SetPWidthTabularCB(FL_OBJECT * ob, long l); - - static int Confirmed = false; static int ActCell; @@ -41,8 +36,6 @@ static int extra_col_cursor_x; // need no y's, one-line input fields static int extra_multicol_cursor_x; // Joacim -#define IS_TABULAR (current_view->the_locking_inset && \ - current_view->the_locking_inset->GetFirstLockingInsetOfType(Inset::TABULAR_CODE)) bool UpdateLayoutTable(int flag) { @@ -262,13 +255,8 @@ void MenuLayoutTable(int flag) } -void TableOptionsCB(FL_OBJECT * ob, long l) +void TableOptionsCB(FL_OBJECT * ob, long) { - if (IS_TABULAR) { - TabularOptionsCB(ob, l); - return; - } - LyXTable * table = 0; int s, num = 0; string special, str; @@ -469,13 +457,8 @@ void TableSpeCloseCB(FL_OBJECT *, long) return; } -void SetPWidthCB(FL_OBJECT * ob, long l) +void SetPWidthCB(FL_OBJECT * ob, long) { - if (IS_TABULAR) { - SetPWidthTabularCB(ob, l); - return; - } - fl_set_object_label(fd_form_table_options->text_warning, ""); Confirmed = false; if (ob == fd_form_table_options->input_column_width) { diff --git a/src/TabularLayout.C b/src/TabularLayout.C deleted file mode 100644 index 0b195fc788..0000000000 --- a/src/TabularLayout.C +++ /dev/null @@ -1,449 +0,0 @@ -#include - -#include -#include FORMS_H_LOCATION - -#include "layout_forms.h" -#include "lyx_main.h" -#include "lyxrc.h" -#include "LString.h" -#include "support/filetools.h" -#include "buffer.h" -#include "vspace.h" -#include "lyx_gui_misc.h" -#include "BufferView.h" -#include "gettext.h" -#include "layout.h" -#include "tabular.h" -#include "insets/insettabular.h" - - -// Prototypes -extern FD_form_table_options * fd_form_table_options; -extern FD_form_table_extra * fd_form_table_extra; -extern BufferView * current_view; - -extern void OpenLayoutTableExtra(); -extern bool UpdateLayoutTabular(bool, InsetTabular *); - -static int Confirmed = false; -static int ActCell; - -// hack to keep the cursor from jumping to the end of the text in the Extra -// form input fields during editing. The values in LyXTabular itself is -// changed in real-time, but we have no callbacks for the input fields, -// so I simply store and restore the cursor position for now. -// (too much of a hazzle to do it proper; we'll trash all this code -// in 1.1 anyway) -static int extra_col_cursor_x; // need no y's, one-line input fields -static int extra_multicol_cursor_x; -// Joacim - -static InsetTabular * inset = 0; - -void MenuLayoutTabular(bool flag, InsetTabular * ins) -{ - inset = ins; - if (!inset) - return; - if (UpdateLayoutTabular(flag, ins)) { - if (fd_form_table_options->form_table_options->visible) { - fl_raise_form(fd_form_table_options->form_table_options); - } - else { - fl_show_form(fd_form_table_options->form_table_options, - FL_PLACE_MOUSE, FL_FULLBORDER, - _("Tabular Layout")); - } - } -} - -bool UpdateLayoutTabular(bool flag, InsetTabular *ins) -{ - if (!ins) - return false; - - inset = ins; - - bool update = true; - if (!current_view->available()) - update = false; - - if (update) { - char buf[12]; - string pwidth, special; - - LyXTabular * table = inset->tabular; - - int cell = inset->GetActCell(); - ActCell = cell; - int column = table->column_of_cell(cell)+1; - fl_set_object_label(fd_form_table_options->text_warning, ""); - Confirmed = false; - fl_activate_object(fd_form_table_extra->input_special_alignment); - fl_activate_object(fd_form_table_extra->input_special_multialign); - fl_activate_object(fd_form_table_options->input_column_width); - sprintf(buf, "%d", column); - fl_set_input(fd_form_table_options->input_table_column, buf); - fl_deactivate_object(fd_form_table_options->input_table_column); - int row = table->row_of_cell(cell)+1; - sprintf(buf, "%d", row); - fl_set_input(fd_form_table_options->input_table_row, buf); - fl_deactivate_object(fd_form_table_options->input_table_row); - if (table->IsMultiColumn(cell)) - fl_set_button(fd_form_table_options->radio_multicolumn, 1); - else - fl_set_button(fd_form_table_options->radio_multicolumn, 0); - if (table->GetRotateCell(cell)) - fl_set_button(fd_form_table_options->radio_rotate_cell, 1); - else - fl_set_button(fd_form_table_options->radio_rotate_cell, 0); - if (table->TopLine(cell)) - fl_set_button(fd_form_table_options->radio_border_top, 1); - else - fl_set_button(fd_form_table_options->radio_border_top, 0); - if (table->BottomLine(cell)) - fl_set_button(fd_form_table_options->radio_border_bottom, 1); - else - fl_set_button(fd_form_table_options->radio_border_bottom, 0); - if (table->LeftLine(cell)) - fl_set_button(fd_form_table_options->radio_border_left, 1); - else - fl_set_button(fd_form_table_options->radio_border_left, 0); - if (table->RightLine(cell)) - fl_set_button(fd_form_table_options->radio_border_right, 1); - else - fl_set_button(fd_form_table_options->radio_border_right, 0); - int align = table->GetAlignment(cell); - fl_set_button(fd_form_table_options->radio_align_left, 0); - fl_set_button(fd_form_table_options->radio_align_right, 0); - fl_set_button(fd_form_table_options->radio_align_center, 0); - special = table->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN); - if (flag) - { - fl_set_input(fd_form_table_extra->input_special_alignment, - special.c_str()); - fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment, - extra_col_cursor_x, 0); // restore the cursor - } - if (current_view->buffer()->isReadonly()) - fl_deactivate_object(fd_form_table_extra->input_special_alignment); - special = table->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI); - if (flag) - { - fl_set_input(fd_form_table_extra->input_special_multialign, - special.c_str()); - fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign, - extra_multicol_cursor_x, 0); // restore the cursor - } - if (current_view->buffer()->isReadonly()) - fl_deactivate_object(fd_form_table_extra->input_special_multialign); - pwidth = table->GetPWidth(cell); - if (flag) - fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str()); - if (current_view->buffer()->isReadonly()) - fl_deactivate_object(fd_form_table_options->input_column_width); - if (!pwidth.empty()) { - fl_activate_object(fd_form_table_options->radio_linebreak_cell); - fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell, - FL_BLACK); - fl_set_button(fd_form_table_options->radio_linebreak_cell, - table->GetLinebreaks(cell)); - } else { - fl_deactivate_object(fd_form_table_options->radio_linebreak_cell); - fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell, - FL_INACTIVE); - fl_set_button(fd_form_table_options->radio_linebreak_cell, 0); - } - if ((!pwidth.empty() && !table->IsMultiColumn(cell)) || - (align == LYX_ALIGN_LEFT)) - fl_set_button(fd_form_table_options->radio_align_left, 1); - else if (align == LYX_ALIGN_RIGHT) - fl_set_button(fd_form_table_options->radio_align_right, 1); - else - fl_set_button(fd_form_table_options->radio_align_center, 1); - if (!pwidth.empty() && !table->IsMultiColumn(cell)) { - fl_deactivate_object(fd_form_table_options->radio_align_left); - fl_deactivate_object(fd_form_table_options->radio_align_right); - fl_deactivate_object(fd_form_table_options->radio_align_center); - fl_set_object_lcol(fd_form_table_options->radio_align_left, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_align_right, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_align_center, - FL_INACTIVE); - } else { - fl_activate_object(fd_form_table_options->radio_align_left); - fl_activate_object(fd_form_table_options->radio_align_right); - fl_activate_object(fd_form_table_options->radio_align_center); - fl_set_object_lcol(fd_form_table_options->radio_align_left, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_align_right, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_align_center, - FL_BLACK); - } - fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTabular()); - if (table->IsLongTabular()) { - fl_activate_object(fd_form_table_options->radio_lt_firsthead); - fl_activate_object(fd_form_table_options->radio_lt_head); - fl_activate_object(fd_form_table_options->radio_lt_foot); - fl_activate_object(fd_form_table_options->radio_lt_lastfoot); - fl_activate_object(fd_form_table_options->radio_lt_newpage); - fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_lt_head, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_lt_foot, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot, - FL_BLACK); - fl_set_object_lcol(fd_form_table_options->radio_lt_newpage, - FL_BLACK); - fl_set_button(fd_form_table_options->radio_lt_firsthead, - table->GetRowOfLTFirstHead(cell)); - fl_set_button(fd_form_table_options->radio_lt_head, - table->GetRowOfLTHead(cell)); - fl_set_button(fd_form_table_options->radio_lt_foot, - table->GetRowOfLTFoot(cell)); - fl_set_button(fd_form_table_options->radio_lt_lastfoot, - table->GetRowOfLTLastFoot(cell)); - fl_set_button(fd_form_table_options->radio_lt_newpage, - table->GetLTNewPage(cell)); - } else { - fl_deactivate_object(fd_form_table_options->radio_lt_firsthead); - fl_deactivate_object(fd_form_table_options->radio_lt_head); - fl_deactivate_object(fd_form_table_options->radio_lt_foot); - fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot); - fl_deactivate_object(fd_form_table_options->radio_lt_newpage); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_button(fd_form_table_options->radio_lt_head, 0); - fl_set_button(fd_form_table_options->radio_lt_foot, 0); - fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0); - fl_set_button(fd_form_table_options->radio_lt_newpage, 0); - fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_head, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_foot, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_newpage, - FL_INACTIVE); - } - fl_set_button(fd_form_table_options->radio_rotate_table, - table->GetRotateTabular()); - fl_hide_object(fd_form_table_options->button_table_delete); - fl_set_focus_object(fd_form_table_options->form_table_options, - fd_form_table_options->button_table_delete); - } else if (fd_form_table_options->form_table_options->visible) { - fl_set_focus_object(fd_form_table_options->form_table_options, - fd_form_table_options->button_table_delete); - fl_hide_form(fd_form_table_options->form_table_options); - } - return update; -} - - -void TabularOptionsCB(FL_OBJECT * ob, long) -{ - if (!inset) - return; - - int s, num = 0; - string special, str; - - LyXTabular * table = inset->tabular; - - int cell = inset->GetActCell(); - if (ActCell != cell) { - MenuLayoutTabular(false, inset); - fl_set_object_label(fd_form_table_options->text_warning, - _("Warning: Wrong Cursor position, updated window")); - fl_show_object(fd_form_table_options->text_warning); - extra_col_cursor_x = 0; // would rather place it at the end, but... - extra_multicol_cursor_x = 0; - return; - } - - // No point in processing directives that you can't do anything with - // anyhow, so exit now if the buffer is read-only. - if (current_view->buffer()->isReadonly()) { - MenuLayoutTabular(false, inset); - return; - } - - if (ob != fd_form_table_options->button_table_delete) { - fl_set_object_label(fd_form_table_options->text_warning, ""); - Confirmed = false; - } - str = fl_get_input(fd_form_table_options->input_column_width); - if (!str.empty() && !isValidLength(str)) { - fl_set_object_label(fd_form_table_options->text_warning, - _("Warning: Invalid Length (valid example: 10mm)")); - fl_show_object(fd_form_table_options->text_warning); - return; - } - if (((ob==fd_form_table_options->button_delete_row)&&(table->rows()<=1)) || - ((ob==fd_form_table_options->button_delete_column)&&(table->columns()<=1))) - ob = fd_form_table_options->button_table_delete; - if (ob == fd_form_table_options->button_append_row) - num = LyXTabular::APPEND_ROW; - else if (ob == fd_form_table_options->button_append_column) - num = LyXTabular::APPEND_COLUMN; - else if (ob == fd_form_table_options->button_delete_row) - num = LyXTabular::DELETE_ROW; - else if (ob == fd_form_table_options->button_delete_column) - num = LyXTabular::DELETE_COLUMN; - else if (ob == fd_form_table_options->button_set_borders) - num = LyXTabular::SET_ALL_LINES; - else if (ob == fd_form_table_options->button_unset_borders) - num = LyXTabular::UNSET_ALL_LINES; - else if (ob == fd_form_table_options->radio_border_top) - num = LyXTabular::TOGGLE_LINE_TOP; - else if (ob == fd_form_table_options->radio_border_bottom) - num = LyXTabular::TOGGLE_LINE_BOTTOM; - else if (ob == fd_form_table_options->radio_border_left) - num = LyXTabular::TOGGLE_LINE_LEFT; - else if (ob == fd_form_table_options->radio_border_right) - num = LyXTabular::TOGGLE_LINE_RIGHT; - else if (ob == fd_form_table_options->radio_align_left) - num = LyXTabular::ALIGN_LEFT; - else if (ob == fd_form_table_options->radio_align_right) - num = LyXTabular::ALIGN_RIGHT; - else if (ob == fd_form_table_options->radio_align_center) - num = LyXTabular::ALIGN_CENTER; -#if 0 - // not needed in tabulars as you can delete them with a single delete! - else if ((ob == fd_form_table_options->button_table_delete) && !Confirmed) { - fl_set_object_label(fd_form_table_options->text_warning, - _("Confirm: press Delete-Button again")); - Confirmed = true; - return; - } -#endif - else if ((ob == fd_form_table_options->button_table_delete) - && Confirmed) { - num = LyXTabular::DELETE_TABULAR; - Confirmed = false; - } else if (ob == fd_form_table_options->radio_multicolumn) - num = LyXTabular::MULTICOLUMN; - else if (ob == fd_form_table_options->radio_longtable) { - s = fl_get_button(fd_form_table_options->radio_longtable); - if (s) { - num = LyXTabular::SET_LONGTABULAR; - fl_activate_object(fd_form_table_options->radio_lt_firsthead); - fl_activate_object(fd_form_table_options->radio_lt_head); - fl_activate_object(fd_form_table_options->radio_lt_foot); - fl_activate_object(fd_form_table_options->radio_lt_lastfoot); - fl_activate_object(fd_form_table_options->radio_lt_newpage); - fl_set_button(fd_form_table_options->radio_lt_firsthead, - table->GetRowOfLTFirstHead(cell)); - fl_set_button(fd_form_table_options->radio_lt_head, - table->GetRowOfLTHead(cell)); - fl_set_button(fd_form_table_options->radio_lt_foot, - table->GetRowOfLTFoot(cell)); - fl_set_button(fd_form_table_options->radio_lt_lastfoot, - table->GetRowOfLTLastFoot(cell)); - fl_set_button(fd_form_table_options->radio_lt_firsthead, - table->GetLTNewPage(cell)); - } else { - num = LyXTabular::UNSET_LONGTABULAR; - fl_deactivate_object(fd_form_table_options->radio_lt_firsthead); - fl_deactivate_object(fd_form_table_options->radio_lt_head); - fl_deactivate_object(fd_form_table_options->radio_lt_foot); - fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot); - fl_deactivate_object(fd_form_table_options->radio_lt_newpage); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); - fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_head, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_foot, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot, - FL_INACTIVE); - fl_set_object_lcol(fd_form_table_options->radio_lt_newpage, - FL_INACTIVE); - } - } else if (ob == fd_form_table_options->radio_rotate_table) { - s = fl_get_button(fd_form_table_options->radio_rotate_table); - if (s) - num = LyXTabular::SET_ROTATE_TABULAR; - else - num = LyXTabular::UNSET_ROTATE_TABULAR; - } else if (ob == fd_form_table_options->radio_rotate_cell) { - s = fl_get_button(fd_form_table_options->radio_rotate_cell); - if (s) - num = LyXTabular::SET_ROTATE_CELL; - else - num = LyXTabular::UNSET_ROTATE_CELL; - } else if (ob == fd_form_table_options->radio_linebreak_cell) { - num = LyXTabular::SET_LINEBREAKS; - } else if (ob == fd_form_table_options->radio_lt_firsthead) { - num = LyXTabular::SET_LTFIRSTHEAD; - } else if (ob == fd_form_table_options->radio_lt_head) { - num = LyXTabular::SET_LTHEAD; - } else if (ob == fd_form_table_options->radio_lt_foot) { - num = LyXTabular::SET_LTFOOT; - } else if (ob == fd_form_table_options->radio_lt_lastfoot) { - num = LyXTabular::SET_LTLASTFOOT; - } else if (ob == fd_form_table_options->radio_lt_newpage) { - num = LyXTabular::SET_LTNEWPAGE; - } else if (ob == fd_form_table_options->button_table_extra) { - OpenLayoutTableExtra(); - return; - } else if (ob == fd_form_table_extra->input_special_alignment) { - special = fl_get_input(fd_form_table_extra->input_special_alignment); - int dummy; - fl_get_input_cursorpos(ob, &extra_col_cursor_x, &dummy); - num = LyXTabular::SET_SPECIAL_COLUMN; - } else if (ob == fd_form_table_extra->input_special_multialign) { - special = fl_get_input(fd_form_table_extra->input_special_multialign); - int dummy; - fl_get_input_cursorpos(ob, &extra_multicol_cursor_x, &dummy); - num = LyXTabular::SET_SPECIAL_MULTI; - } else - return; - if (current_view->available()) { - current_view->hideCursor(); - inset->TabularFeatures(current_view, num, special); - } - UpdateLayoutTabular(true, inset); - return; -} - -void SetPWidthTabularCB(FL_OBJECT * ob, long) -{ - if (!inset) { - return; - } - - fl_set_object_label(fd_form_table_options->text_warning, ""); - Confirmed = false; - if (ob == fd_form_table_options->input_column_width) { - string str = fl_get_input(ob); - if (!str.empty() && !isValidLength(str)) { - fl_set_object_label(fd_form_table_options->text_warning, - _("Warning: Invalid Length (valid example: 10mm)")); - fl_show_object(fd_form_table_options->text_warning); - return; - } - if (current_view->available()){ - current_view->hideCursor(); - inset->TabularFeatures(current_view, LyXTabular::SET_PWIDTH, str); - } - MenuLayoutTabular(false, inset); // update for alignment - } -} - -void TabularOptClose() -{ - inset = 0; -} - diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index 5eda1408ad..eaf2bb7cc8 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -62,7 +62,7 @@ void FormTabular::build() create_tabular_ = build_create_tabular(); fl_set_input_return(column_options_->input_column_width, - FL_RETURN_CHANGED); + FL_RETURN_END); fl_set_input_return(column_options_->input_special_alignment, FL_RETURN_CHANGED); fl_set_input_return(cell_options_->input_mcolumn_width, @@ -142,11 +142,6 @@ void FormTabular::hideInset(InsetTabular * ti) } -void FormTabular::apply() -{ -} - - void FormTabular::update() { if (dialog_) { @@ -162,17 +157,6 @@ void FormTabular::updateInset(InsetTabular * ti) } } -void FormTabular::input() -{ - bool activate = true; - // - // whatever checks you need - // - if (activate) { - } else { - } -} - void FormTabular::free() { @@ -186,6 +170,27 @@ void FormTabular::free() fl_free_form(dialog_->form_tabular); delete dialog_; dialog_ = 0; + + fl_free_form(tabular_options_->form_tabular_options); + delete tabular_options_; + tabular_options_ = 0; + + fl_free_form(column_options_->form_column_options); + delete column_options_; + column_options_ = 0; + + fl_free_form(cell_options_->form_cell_options); + delete cell_options_; + cell_options_ = 0; + + fl_free_form(longtable_options_->form_longtable_options); + delete longtable_options_; + longtable_options_ = 0; + + hide_create(); + fl_free_form(create_tabular_->form_create_tabular); + delete create_tabular_; + create_tabular_ = 0; } } @@ -207,10 +212,10 @@ void FormTabular::CloseCB(FL_OBJECT * ob, long) } -void FormTabular::InputCB(FL_OBJECT * ob, long) +void FormTabular::InputCB(FL_OBJECT * ob, long l) { FormTabular * pre = static_cast(ob->form->u_vdata); - pre->input(); + pre->SetTabularOptions(ob, l); } @@ -233,7 +238,6 @@ bool FormTabular::local_update(bool flag) actCell_ = cell = inset_->GetActCell(); column = tabular->column_of_cell(cell)+1; fl_set_object_label(dialog_->text_warning,""); - confirmed_ = false; fl_activate_object(column_options_->input_special_alignment); fl_activate_object(cell_options_->input_special_multialign); fl_activate_object(column_options_->input_column_width); @@ -368,6 +372,162 @@ bool FormTabular::local_update(bool flag) return true; } +void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) +{ + if (!inset_) + return; + + LyXTabular + * tabular = inset_->tabular; + int + cell, + s, + num = 0; + string + special, + str; + + cell = inset_->GetActCell(); + if (actCell_ != cell) { + local_update(false); + fl_set_object_label(dialog_->text_warning, + _("Warning: Wrong Cursor position, updated window")); + fl_show_object(dialog_->text_warning); + return; + } + // No point in processing directives that you can't do anything with + // anyhow, so exit now if the buffer is read-only. + if (lv_->buffer()->isReadonly()) { + local_update(false); + return; + } + if (ob == column_options_->input_column_width) { + string + str; + str = fl_get_input(ob); + if (!str.empty() && !isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + return; + } + inset_->TabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH,str); + local_update(false); // update for alignment + return; + } + str = fl_get_input(column_options_->input_column_width); + if (!str.empty() && !isValidLength(str)) { + fl_set_object_label( + dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + return; + } + if (ob == tabular_options_->button_append_row) + num = LyXTabular::APPEND_ROW; + else if (ob == tabular_options_->button_append_column) + num = LyXTabular::APPEND_COLUMN; + else if (ob == tabular_options_->button_delete_row) + num = LyXTabular::DELETE_ROW; + else if (ob == tabular_options_->button_delete_column) + num = LyXTabular::DELETE_COLUMN; + else if (ob == tabular_options_->button_set_borders) + num = LyXTabular::SET_ALL_LINES; + else if (ob == tabular_options_->button_unset_borders) + num = LyXTabular::UNSET_ALL_LINES; + else if (ob == column_options_->radio_border_top) + num = LyXTabular::TOGGLE_LINE_TOP; + else if (ob == column_options_->radio_border_bottom) + num = LyXTabular::TOGGLE_LINE_BOTTOM; + else if (ob == column_options_->radio_border_left) + num = LyXTabular::TOGGLE_LINE_LEFT; + else if (ob == column_options_->radio_border_right) + num = LyXTabular::TOGGLE_LINE_RIGHT; + else if (ob == column_options_->radio_align_left) + num = LyXTabular::ALIGN_LEFT; + else if (ob == column_options_->radio_align_right) + num = LyXTabular::ALIGN_RIGHT; + else if (ob == column_options_->radio_align_center) + num = LyXTabular::ALIGN_CENTER; + else if (ob == cell_options_->radio_multicolumn) + num = LyXTabular::MULTICOLUMN; + else if (ob == tabular_options_->radio_longtable) { + s=fl_get_button(tabular_options_->radio_longtable); + if (s) { + num = LyXTabular::SET_LONGTABULAR; + fl_activate_object(longtable_options_->radio_lt_firsthead); + fl_activate_object(longtable_options_->radio_lt_head); + fl_activate_object(longtable_options_->radio_lt_foot); + fl_activate_object(longtable_options_->radio_lt_lastfoot); + fl_activate_object(longtable_options_->radio_lt_newpage); + fl_set_button(longtable_options_->radio_lt_firsthead, + tabular->GetRowOfLTFirstHead(cell)); + fl_set_button(longtable_options_->radio_lt_head, + tabular->GetRowOfLTHead(cell)); + fl_set_button(longtable_options_->radio_lt_foot, + tabular->GetRowOfLTFoot(cell)); + fl_set_button(longtable_options_->radio_lt_lastfoot, + tabular->GetRowOfLTLastFoot(cell)); + fl_set_button(longtable_options_->radio_lt_firsthead, + tabular->GetLTNewPage(cell)); + } else { + num = LyXTabular::UNSET_LONGTABULAR; + fl_deactivate_object(longtable_options_->radio_lt_firsthead); + fl_deactivate_object(longtable_options_->radio_lt_head); + fl_deactivate_object(longtable_options_->radio_lt_foot); + fl_deactivate_object(longtable_options_->radio_lt_lastfoot); + fl_deactivate_object(longtable_options_->radio_lt_newpage); + fl_set_button(longtable_options_->radio_lt_firsthead,0); + fl_set_button(longtable_options_->radio_lt_head,0); + fl_set_button(longtable_options_->radio_lt_foot,0); + fl_set_button(longtable_options_->radio_lt_lastfoot,0); + fl_set_button(longtable_options_->radio_lt_newpage,0); + fl_set_object_lcol(longtable_options_->radio_lt_firsthead, + FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, + FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_newpage, + FL_INACTIVE); + } + } else if (ob == tabular_options_->radio_rotate_tabular) { + s=fl_get_button(tabular_options_->radio_rotate_tabular); + if (s) + num = LyXTabular::SET_ROTATE_TABULAR; + else + num = LyXTabular::UNSET_ROTATE_TABULAR; + } else if (ob == cell_options_->radio_rotate_cell) { + s=fl_get_button(cell_options_->radio_rotate_cell); + if (s) + num = LyXTabular::SET_ROTATE_CELL; + else + num = LyXTabular::UNSET_ROTATE_CELL; + } else if (ob == cell_options_->radio_linebreak_cell) { + num = LyXTabular::SET_LINEBREAKS; + } else if (ob == longtable_options_->radio_lt_firsthead) { + num = LyXTabular::SET_LTFIRSTHEAD; + } else if (ob == longtable_options_->radio_lt_head) { + num = LyXTabular::SET_LTHEAD; + } else if (ob == longtable_options_->radio_lt_foot) { + num = LyXTabular::SET_LTFOOT; + } else if (ob == longtable_options_->radio_lt_lastfoot) { + num = LyXTabular::SET_LTLASTFOOT; + } else if (ob == longtable_options_->radio_lt_newpage) { + num = LyXTabular::SET_LTNEWPAGE; + } else if (ob == column_options_->input_special_alignment) { + special = fl_get_input(column_options_->input_special_alignment); + num = LyXTabular::SET_SPECIAL_COLUMN; + } else if (ob == cell_options_->input_special_multialign) { + special = fl_get_input(cell_options_->input_special_multialign); + num = LyXTabular::SET_SPECIAL_MULTI; + } else + return; + + inset_->TabularFeatures(lv_->view(), num, special); + local_update(false); +} + // +-----------------------------------------------------------------------+ // | Functions/Dialogs for creating tabular insets | // +-----------------------------------------------------------------------+ @@ -389,7 +549,8 @@ void FormTabular::show_create() void FormTabular::hide_create() { - if (create_tabular_->form_create_tabular) + if (create_tabular_->form_create_tabular && + create_tabular_->form_create_tabular->visible) fl_hide_form(create_tabular_->form_create_tabular); } diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index e5def09932..c2f69e66ed 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -73,13 +73,12 @@ private: /**@name Dialog internal methods */ //@{ /// Apply from dialog - void apply(); void apply_create(); - /// Filter the inputs - void input(); /// Build the dialog void build(); /// + void SetTabularOptions(FL_OBJECT *, long); + /// FD_form_tabular * build_tabular(); /// FD_form_tabular_options * build_tabular_options(); @@ -121,7 +120,6 @@ private: //@} InsetTabular * inset_; int actCell_; - bool confirmed_; }; #endif diff --git a/src/frontends/xforms/form_citation.C b/src/frontends/xforms/form_citation.C index bd22b69622..84c5ecc17b 100644 --- a/src/frontends/xforms/form_citation.C +++ b/src/frontends/xforms/form_citation.C @@ -7,7 +7,8 @@ #include FORMS_H_LOCATION #include -#include "FormCitation.h" +#include "form_citation.h" +#include "FormCitation.h" FD_form_citation * FormCitation::build_citation() { diff --git a/src/frontends/xforms/form_citation.h b/src/frontends/xforms/form_citation.h index 7f38b5643f..2137d2c09a 100644 --- a/src/frontends/xforms/form_citation.h +++ b/src/frontends/xforms/form_citation.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Tue Jul 11 11:01:26 2000.**/ +/** Header file generated with fdesign on Thu Jul 13 16:53:24 2000.**/ #ifndef FD_form_citation_h_ #define FD_form_citation_h_ @@ -10,11 +10,9 @@ extern "C" void C_FormCitationCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { +struct FD_form_citation { + FL_FORM *form_citation; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *box; FL_OBJECT *citeBrsr; FL_OBJECT *bibBrsr; @@ -28,7 +26,6 @@ typedef struct { FL_OBJECT *textAftr; FL_OBJECT *ok; FL_OBJECT *cancel; -} FD_form_citation; - +}; #endif /* FD_form_citation_h_ */ diff --git a/src/frontends/xforms/form_copyright.C b/src/frontends/xforms/form_copyright.C index c32293919e..7e2e9639ef 100644 --- a/src/frontends/xforms/form_copyright.C +++ b/src/frontends/xforms/form_copyright.C @@ -7,7 +7,8 @@ #include FORMS_H_LOCATION #include -#include "FormCopyright.h" +#include "form_copyright.h" +#include "FormCopyright.h" FD_form_copyright * FormCopyright::build_copyright() { diff --git a/src/frontends/xforms/form_copyright.h b/src/frontends/xforms/form_copyright.h index d5ebfc6f9f..fc1977bd06 100644 --- a/src/frontends/xforms/form_copyright.h +++ b/src/frontends/xforms/form_copyright.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Tue Jul 11 11:01:26 2000.**/ +/** Header file generated with fdesign on Thu Jul 13 16:53:24 2000.**/ #ifndef FD_form_copyright_h_ #define FD_form_copyright_h_ @@ -8,13 +8,10 @@ extern "C" void C_FormCopyrightOKCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { +struct FD_form_copyright { + FL_FORM *form_copyright; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *button_ok; -} FD_form_copyright; - +}; #endif /* FD_form_copyright_h_ */ diff --git a/src/frontends/xforms/form_preferences.C b/src/frontends/xforms/form_preferences.C index abfb927658..60433b3440 100644 --- a/src/frontends/xforms/form_preferences.C +++ b/src/frontends/xforms/form_preferences.C @@ -7,7 +7,8 @@ #include FORMS_H_LOCATION #include -#include "FormPreferences.h" +#include "form_preferences.h" +#include "FormPreferences.h" FD_form_bind * FormPreferences::build_bind() { diff --git a/src/frontends/xforms/form_preferences.h b/src/frontends/xforms/form_preferences.h index a655c6e7f3..1abb4c2012 100644 --- a/src/frontends/xforms/form_preferences.h +++ b/src/frontends/xforms/form_preferences.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Tue Jul 11 11:01:26 2000.**/ +/** Header file generated with fdesign on Thu Jul 13 16:53:24 2000.**/ #ifndef FD_form_bind_h_ #define FD_form_bind_h_ @@ -16,32 +16,24 @@ extern "C" void C_FormPreferencesOKCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { +struct FD_form_bind { + FL_FORM *form_bind; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_bind; -} FD_form_bind; +}; +struct FD_form_misc { -typedef struct { FL_FORM *form_misc; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *check_banner; FL_OBJECT *check_auto_region_delete; FL_OBJECT *check_exit_confirm; FL_OBJECT *check_display_shortcuts; FL_OBJECT *counter_autosave; FL_OBJECT *counter_line_len; -} FD_form_misc; +}; +struct FD_form_screen_fonts { -typedef struct { FL_FORM *form_screen_fonts; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_roman; FL_OBJECT *input_sans; FL_OBJECT *input_typewriter; @@ -58,23 +50,17 @@ typedef struct { FL_OBJECT *input_normal; FL_OBJECT *input_huge; FL_OBJECT *input_huger; -} FD_form_screen_fonts; +}; +struct FD_form_interface_fonts { -typedef struct { FL_FORM *form_interface_fonts; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_popup_font; FL_OBJECT *input_menu_font; FL_OBJECT *input_encoding; -} FD_form_interface_fonts; +}; +struct FD_form_printer { -typedef struct { FL_FORM *form_printer; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_command; FL_OBJECT *input_page_range; FL_OBJECT *input_copies; @@ -93,13 +79,10 @@ typedef struct { FL_OBJECT *input_paper_size; FL_OBJECT *input_name; FL_OBJECT *check_adapt_output; -} FD_form_printer; +}; +struct FD_form_paths { -typedef struct { FL_FORM *form_paths; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_default_path; FL_OBJECT *button_document_browse; FL_OBJECT *counter_lastfiles; @@ -114,18 +97,14 @@ typedef struct { FL_OBJECT *check_make_backups; FL_OBJECT *input_backup_path; FL_OBJECT *button_backup_path_browse; -} FD_form_paths; +}; +struct FD_form_preferences { -typedef struct { FL_FORM *form_preferences; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *button_apply; FL_OBJECT *button_cancel; FL_OBJECT *button_ok; FL_OBJECT *tabfolder_prefs; -} FD_form_preferences; - +}; #endif /* FD_form_bind_h_ */ diff --git a/src/frontends/xforms/form_print.C b/src/frontends/xforms/form_print.C index 50a6305229..8c8db52b29 100644 --- a/src/frontends/xforms/form_print.C +++ b/src/frontends/xforms/form_print.C @@ -7,7 +7,8 @@ #include FORMS_H_LOCATION #include -#include "FormPrint.h" +#include "form_print.h" +#include "FormPrint.h" FD_form_print * FormPrint::build_print() { diff --git a/src/frontends/xforms/form_print.h b/src/frontends/xforms/form_print.h index 2ca66c5428..04857d5436 100644 --- a/src/frontends/xforms/form_print.h +++ b/src/frontends/xforms/form_print.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Tue Jul 11 11:01:26 2000.**/ +/** Header file generated with fdesign on Thu Jul 13 16:53:24 2000.**/ #ifndef FD_form_print_h_ #define FD_form_print_h_ @@ -11,11 +11,9 @@ extern "C" void C_FormPrintCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { +struct FD_form_print { + FL_FORM *form_print; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *input_printer; FL_OBJECT *input_file; FL_OBJECT *group_radio_printto; @@ -35,7 +33,6 @@ typedef struct { FL_OBJECT *input_count; FL_OBJECT *radio_unsorted; FL_OBJECT *input_to_page; -} FD_form_print; - +}; #endif /* FD_form_print_h_ */ diff --git a/src/frontends/xforms/form_tabular.C b/src/frontends/xforms/form_tabular.C index 0a58769abf..78d425b2e7 100644 --- a/src/frontends/xforms/form_tabular.C +++ b/src/frontends/xforms/form_tabular.C @@ -7,7 +7,8 @@ #include FORMS_H_LOCATION #include -#include "FormTabular.h" +#include "form_tabular.h" +#include "FormTabular.h" FD_form_tabular * FormTabular::build_tabular() { diff --git a/src/frontends/xforms/form_tabular.h b/src/frontends/xforms/form_tabular.h index f25187ab73..7dbd0cfd69 100644 --- a/src/frontends/xforms/form_tabular.h +++ b/src/frontends/xforms/form_tabular.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Wed Jul 12 15:19:16 2000.**/ +/** Header file generated with fdesign on Thu Jul 13 16:53:24 2000.**/ #ifndef FD_form_tabular_h_ #define FD_form_tabular_h_ @@ -20,23 +20,18 @@ extern "C" void C_FormTabularCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { +struct FD_form_tabular { + FL_FORM *form_tabular; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *tabFolder; FL_OBJECT *button_close; FL_OBJECT *input_tabular_column; FL_OBJECT *input_tabular_row; FL_OBJECT *text_warning; -} FD_form_tabular; +}; +struct FD_form_tabular_options { -typedef struct { FL_FORM *form_tabular_options; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *button_append_column; FL_OBJECT *button_delete_column; FL_OBJECT *button_append_row; @@ -45,13 +40,10 @@ typedef struct { FL_OBJECT *button_unset_borders; FL_OBJECT *radio_longtable; FL_OBJECT *radio_rotate_tabular; -} FD_form_tabular_options; +}; +struct FD_form_column_options { -typedef struct { FL_FORM *form_column_options; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *radio_border_top; FL_OBJECT *radio_border_bottom; FL_OBJECT *radio_border_left; @@ -64,13 +56,10 @@ typedef struct { FL_OBJECT *radio_valign_center; FL_OBJECT *radio_valign_bottom; FL_OBJECT *input_special_alignment; -} FD_form_column_options; +}; +struct FD_form_cell_options { -typedef struct { FL_FORM *form_cell_options; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *radio_multicolumn; FL_OBJECT *radio_linebreak_cell; FL_OBJECT *radio_rotate_cell; @@ -86,31 +75,24 @@ typedef struct { FL_OBJECT *radio_valign_top; FL_OBJECT *radio_valign_center; FL_OBJECT *radio_valign_bottom; -} FD_form_cell_options; +}; +struct FD_form_longtable_options { -typedef struct { FL_FORM *form_longtable_options; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *radio_lt_firsthead; FL_OBJECT *radio_lt_head; FL_OBJECT *radio_lt_foot; FL_OBJECT *radio_lt_lastfoot; FL_OBJECT *radio_lt_newpage; -} FD_form_longtable_options; +}; +struct FD_form_create_tabular { -typedef struct { FL_FORM *form_create_tabular; - void *vdata; - char *cdata; - long ldata; FL_OBJECT *button_ok; FL_OBJECT *button_apply; FL_OBJECT *button_cancel; FL_OBJECT *slider_columns; FL_OBJECT *slider_rows; -} FD_form_create_tabular; - +}; #endif /* FD_form_tabular_h_ */ diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index c0f43d6b5a..5fdb627495 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -46,6 +46,12 @@ echo >> $2 # For all lines containing "fl_" and a string _not_ containging |, # replace the string with _(string) # +# -e "/#include \"form_.*\"/a\\ +# #include \"$classname.h\" " +# +# For all lines containing "#include "form_*"", append a line +# containing the header file of the parent class +# # -e '/shortcut/ s/".*[|].*"/scex(_(&))/' # # For all lines containing "shortcut" and a string containing |, replace @@ -90,7 +96,8 @@ export classname cat $1 | sed \ -e 's/#include \"forms\.h\"/#include FORMS_H_LOCATION/' \ --e "s/#include \".orm_.*\"/#include \"$classname.h\"/" \ +-e "/#include \"form_.*\"/a\\ +#include \"$classname.h\" " \ -e '/fl_/ s/".[^|]*"/_(&)/' \ -e '/shortcut/ s/".*[|].*"/scex(_(&))/' \ -e '/fl_add/ s/".*[|].*"/idex(_(&))/' \ @@ -100,13 +107,3 @@ cat $1 | sed \ -e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\ \1->u_vdata = this;/' \ -e 's/,\([^ ]\)/, \1/g' >> $2 - - - - - - - - - - diff --git a/src/frontends/xforms/forms/makefile b/src/frontends/xforms/forms/makefile index 2d023dce22..fc50cf26dd 100644 --- a/src/frontends/xforms/forms/makefile +++ b/src/frontends/xforms/forms/makefile @@ -40,19 +40,14 @@ c: $(OBJS) d: c $(COBJS) -# -e 's/\([^ ]* \*\)\([^ ]*\)/\1 \2/' -# -# Make declarations like "void *cdata;" into "void * cdata;" -# +# Modify the header files using the instructions in fdfixh.sed e: c for hfil in *.h ; do \ if [ -f "$$hfil.patch" ] ; then \ (echo "Patching $$hfil with $$hfil.patch" ; \ patch -s $$hfil < $$hfil.patch) \ fi; \ - sed < $$hfil > $$hfil.tmp \ - -e 's/\(extern \)\(.*\)/\1 "C" \2/' \ - -e '/create_form_/d' ; \ + sed -f fdfixh.sed < $$hfil > $$hfil.tmp; \ mv $$hfil.tmp $$hfil; \ done @@ -72,6 +67,7 @@ updatesrc: d e .c.C: ./fdfix.sh $< $@ + rm $< clean: rm -f *.[hcC] *.bak diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 2cffe7fc69..646587c82a 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -33,10 +33,6 @@ #include "insets/insettext.h" #include "frontends/Dialogs.h" -extern void MenuLayoutTabular(bool, InsetTabular *); -extern bool UpdateLayoutTabular(bool, InsetTabular *); -extern void TabularOptClose(); - const int ADD_TO_HEIGHT = 2; const int ADD_TO_TABULAR_WIDTH = 2; @@ -47,8 +43,6 @@ using std::endl; #define cellstart(p) ((p % 2) == 0) -#define USE_NEW_LAYOUT 1 - InsetTabular::InsetTabular(Buffer * buf, int rows, int columns) { if (rows <= 0) @@ -90,12 +84,8 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer * buf) InsetTabular::~InsetTabular() { delete tabular; -#ifdef USE_NEW_LAYOUT - if (buffer->getUser()) - buffer->getUser()->owner()->getDialogs()->hideTabular(this); - else if (dialogs_) + if (dialogs_) dialogs_->hideTabular(this); -#endif } @@ -150,7 +140,7 @@ int InsetTabular::ascent(BufferView *, LyXFont const &) const int InsetTabular::descent(BufferView *, LyXFont const &) const { - return tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0); + return tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0) + 1; } @@ -171,7 +161,6 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, UpdatableInset::draw(bv,font,baseline,x,cleared); if (!cleared && ((need_update == INIT) || (need_update == FULL) || (top_x != int(x)) || (top_baseline != baseline))) { -#if 1 int h = ascent(bv, font) + descent(bv, font); int tx = display()? 0:top_x; int w = tx? width(bv, font):pain.paperWidth(); @@ -186,18 +175,6 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, pain.fillRectangle(tx, ty, w, h); need_update = FULL; cleared = true; -#else - need_update = FULL; - resetPos(pain); - if (locked) { // repaint this way as the background was not cleared - if (the_locking_inset) - the_locking_inset->update(bv, font, true); - locked = false; - bv->updateInset(const_cast(this), false); - locked = true; - return; - } -#endif } top_x = int(x); top_baseline = baseline; @@ -361,7 +338,6 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button) void InsetTabular::InsetUnlock(BufferView * bv) { - TabularOptClose(); if (the_locking_inset) { the_locking_inset->InsetUnlock(bv); the_locking_inset = 0; @@ -434,12 +410,8 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset, if ((inset->LyxCode() == TABULAR_CODE) && !the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) { -#ifdef USE_NEW_LAYOUT dialogs_ = bv->owner()->getDialogs(); dialogs_->updateTabular(const_cast(this)); -#else - UpdateLayoutTabular(true, const_cast(this)); -#endif oldcell = actcell; } return true; @@ -532,15 +504,11 @@ void InsetTabular::InsetButtonRelease(BufferView * bv, return; } } -#ifdef USE_NEW_LAYOUT dialogs_ = bv->owner()->getDialogs(); dialogs_->showTabular(this); #if 0 else if (ocell != actcell) bview->getOwner()->getPopups().updateTabular(); -#endif -#else - MenuLayoutTabular(true, this); #endif return; } @@ -743,13 +711,8 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action, break; case LFUN_LAYOUT_TABLE: { -#ifdef USE_NEW_LAYOUT dialogs_ = bv->owner()->getDialogs(); dialogs_->showTabular(this); -#else - int flag = (arg == "true"); - MenuLayoutTabular(flag, this); -#endif } break; default: @@ -952,12 +915,8 @@ void InsetTabular::resetPos(BufferView * bv) const if ((!the_locking_inset || !the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) && (actcell != oldcell)) { -#ifdef USE_NEW_LAYOUT dialogs_ = bv->owner()->getDialogs(); dialogs_->updateTabular(const_cast(this)); -#else - UpdateLayoutTabular(true, const_cast(this)); -#endif oldcell = actcell; } } diff --git a/src/text.C b/src/text.C index 3f76ed95f6..1dff79e464 100644 --- a/src/text.C +++ b/src/text.C @@ -3807,6 +3807,20 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset, w = ww; pain.fillRectangle(x_offset, y_offset, w, h); } + h += inset->ascent(bview, font) + inset->descent(bview, font); + if ((row_ptr->height() - h) > 0) { + int w; + if (inset_owner) + w = inset_owner->width(bview, font); + else + w = ww; + pain.fillRectangle(x_offset,h, w, row_ptr->height()-h); + } + if (!inset_owner && !inset->display() && !inset->needFullRow()) + { + int w = inset->width(bview, font) + int(x); + pain.fillRectangle(w, y_offset, ww - w, row_ptr->height()); + } } if (selection) { -- 2.39.2