2000-07-13 Juergen Vigna <jug@sad.it>
+ * 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
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
src/table.C
src/TableLayout.C
src/tabular.C
-src/TabularLayout.C
src/text2.C
src/text.C
Spacing.C \
Spacing.h \
TableLayout.C \
- TabularLayout.C \
TextCache.C \
TextCache.h \
Timeout.C \
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;
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)
{
}
-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;
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) {
+++ /dev/null
-#include <config.h>
-
-#include <cstdlib>
-#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;
-}
-
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,
}
-void FormTabular::apply()
-{
-}
-
-
void FormTabular::update()
{
if (dialog_) {
}
}
-void FormTabular::input()
-{
- bool activate = true;
- //
- // whatever checks you need
- //
- if (activate) {
- } else {
- }
-}
-
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;
}
}
}
-void FormTabular::InputCB(FL_OBJECT * ob, long)
+void FormTabular::InputCB(FL_OBJECT * ob, long l)
{
FormTabular * pre = static_cast<FormTabular*>(ob->form->u_vdata);
- pre->input();
+ pre->SetTabularOptions(ob, l);
}
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);
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 |
// +-----------------------------------------------------------------------+
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);
}
/**@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();
//@}
InsetTabular * inset_;
int actCell_;
- bool confirmed_;
};
#endif
#include FORMS_H_LOCATION
#include <stdlib.h>
-#include "FormCitation.h"
+#include "form_citation.h"
+#include "FormCitation.h"
FD_form_citation * FormCitation::build_citation()
{
-/** 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_
/**** 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;
FL_OBJECT *textAftr;
FL_OBJECT *ok;
FL_OBJECT *cancel;
-} FD_form_citation;
-
+};
#endif /* FD_form_citation_h_ */
#include FORMS_H_LOCATION
#include <stdlib.h>
-#include "FormCopyright.h"
+#include "form_copyright.h"
+#include "FormCopyright.h"
FD_form_copyright * FormCopyright::build_copyright()
{
-/** 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_
/**** 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_ */
#include FORMS_H_LOCATION
#include <stdlib.h>
-#include "FormPreferences.h"
+#include "form_preferences.h"
+#include "FormPreferences.h"
FD_form_bind * FormPreferences::build_bind()
{
-/** 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_
/**** 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;
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;
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;
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_ */
#include FORMS_H_LOCATION
#include <stdlib.h>
-#include "FormPrint.h"
+#include "form_print.h"
+#include "FormPrint.h"
FD_form_print * FormPrint::build_print()
{
-/** 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_
/**** 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;
FL_OBJECT *input_count;
FL_OBJECT *radio_unsorted;
FL_OBJECT *input_to_page;
-} FD_form_print;
-
+};
#endif /* FD_form_print_h_ */
#include FORMS_H_LOCATION
#include <stdlib.h>
-#include "FormTabular.h"
+#include "form_tabular.h"
+#include "FormTabular.h"
FD_form_tabular * FormTabular::build_tabular()
{
-/** 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_
/**** 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;
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;
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;
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_ */
# 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
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(_(&))/' \
-e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\
\1->u_vdata = this;/' \
-e 's/,\([^ ]\)/, \1/g' >> $2
-
-
-
-
-
-
-
-
-
-
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
.c.C:
./fdfix.sh $< $@
+ rm $<
clean:
rm -f *.[hcC] *.bak
#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;
#define cellstart(p) ((p % 2) == 0)
-#define USE_NEW_LAYOUT 1
-
InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
{
if (rows <= 0)
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
}
int InsetTabular::descent(BufferView *, LyXFont const &) const
{
- return tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0);
+ return tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0) + 1;
}
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();
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<InsetTabular*>(this), false);
- locked = true;
- return;
- }
-#endif
}
top_x = int(x);
top_baseline = baseline;
void InsetTabular::InsetUnlock(BufferView * bv)
{
- TabularOptClose();
if (the_locking_inset) {
the_locking_inset->InsetUnlock(bv);
the_locking_inset = 0;
if ((inset->LyxCode() == TABULAR_CODE) &&
!the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE))
{
-#ifdef USE_NEW_LAYOUT
dialogs_ = bv->owner()->getDialogs();
dialogs_->updateTabular(const_cast<InsetTabular *>(this));
-#else
- UpdateLayoutTabular(true, const_cast<InsetTabular *>(this));
-#endif
oldcell = actcell;
}
return true;
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;
}
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:
if ((!the_locking_inset ||
!the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) &&
(actcell != oldcell)) {
-#ifdef USE_NEW_LAYOUT
dialogs_ = bv->owner()->getDialogs();
dialogs_->updateTabular(const_cast<InsetTabular *>(this));
-#else
- UpdateLayoutTabular(true, const_cast<InsetTabular *>(this));
-#endif
oldcell = actcell;
}
}
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) {