4 #include FORMS_H_LOCATION
6 #include "layout_forms.h"
10 #include "support/filetools.h"
13 #include "lyx_gui_misc.h"
14 #include "BufferView.h"
15 #include "lyxscreen.h"
20 extern void BeforeChange();
23 extern FD_form_table_options * fd_form_table_options;
24 extern FD_form_table_extra * fd_form_table_extra;
25 extern BufferView * current_view;
27 static int Confirmed = false;
30 // hack to keep the cursor from jumping to the end of the text in the Extra
31 // form input fields during editing. The values in LyXTable itself is changed in
32 // real-time, but we have no callbacks for the input fields, so I simply
33 // store and restore the cursor position for now. (too much of a hazzle to
34 // do it proper; we'll trash all this code in 1.1 anyway)
35 static int extra_col_cursor_x; // need no y's, one-line input fields
36 static int extra_multicol_cursor_x;
40 bool UpdateLayoutTable(int flag)
43 if (!current_view->getScreen() || !current_view->available())
46 if (update && current_view->text->cursor.par->table) {
48 string pwidth, special;
50 LyXTable * table = current_view->text->cursor.par->table;
52 int cell = current_view->text->
53 NumberOfCell(current_view->text->cursor.par,
54 current_view->text->cursor.pos);
56 int column = table->column_of_cell(cell)+1;
57 fl_set_object_label(fd_form_table_options->text_warning, "");
59 fl_activate_object(fd_form_table_extra->input_special_alignment);
60 fl_activate_object(fd_form_table_extra->input_special_multialign);
61 fl_activate_object(fd_form_table_options->input_column_width);
62 sprintf(buf, "%d", column);
63 fl_set_input(fd_form_table_options->input_table_column, buf);
64 fl_deactivate_object(fd_form_table_options->input_table_column);
65 int row = table->row_of_cell(cell)+1;
66 sprintf(buf, "%d", row);
67 fl_set_input(fd_form_table_options->input_table_row, buf);
68 fl_deactivate_object(fd_form_table_options->input_table_row);
69 if (table->IsMultiColumn(cell))
70 fl_set_button(fd_form_table_options->radio_multicolumn, 1);
72 fl_set_button(fd_form_table_options->radio_multicolumn, 0);
73 if (table->RotateCell(cell))
74 fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
76 fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
77 if (table->TopLine(cell))
78 fl_set_button(fd_form_table_options->radio_border_top, 1);
80 fl_set_button(fd_form_table_options->radio_border_top, 0);
81 if (table->BottomLine(cell))
82 fl_set_button(fd_form_table_options->radio_border_bottom, 1);
84 fl_set_button(fd_form_table_options->radio_border_bottom, 0);
85 if (table->LeftLine(cell))
86 fl_set_button(fd_form_table_options->radio_border_left, 1);
88 fl_set_button(fd_form_table_options->radio_border_left, 0);
89 if (table->RightLine(cell))
90 fl_set_button(fd_form_table_options->radio_border_right, 1);
92 fl_set_button(fd_form_table_options->radio_border_right, 0);
93 int align = table->GetAlignment(cell);
94 fl_set_button(fd_form_table_options->radio_align_left, 0);
95 fl_set_button(fd_form_table_options->radio_align_right, 0);
96 fl_set_button(fd_form_table_options->radio_align_center, 0);
97 special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN);
100 fl_set_input(fd_form_table_extra->input_special_alignment,
102 fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
103 extra_col_cursor_x, 0); // restore the cursor
105 if (current_view->buffer()->isReadonly())
106 fl_deactivate_object(fd_form_table_extra->input_special_alignment);
107 special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_MULTI);
110 fl_set_input(fd_form_table_extra->input_special_multialign,
112 fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
113 extra_multicol_cursor_x, 0); // restore the cursor
115 if (current_view->buffer()->isReadonly())
116 fl_deactivate_object(fd_form_table_extra->input_special_multialign);
117 pwidth = table->GetPWidth(cell);
119 fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str());
120 if (current_view->buffer()->isReadonly())
121 fl_deactivate_object(fd_form_table_options->input_column_width);
122 if (!pwidth.empty()) {
123 fl_activate_object(fd_form_table_options->radio_linebreak_cell);
124 fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
126 fl_set_button(fd_form_table_options->radio_linebreak_cell,
127 table->Linebreaks(table->FirstVirtualCell(cell)));
129 fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
130 fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
132 fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
134 if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
135 (align == LYX_ALIGN_LEFT))
136 fl_set_button(fd_form_table_options->radio_align_left, 1);
137 else if (align == LYX_ALIGN_RIGHT)
138 fl_set_button(fd_form_table_options->radio_align_right, 1);
140 fl_set_button(fd_form_table_options->radio_align_center, 1);
141 if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
142 fl_deactivate_object(fd_form_table_options->radio_align_left);
143 fl_deactivate_object(fd_form_table_options->radio_align_right);
144 fl_deactivate_object(fd_form_table_options->radio_align_center);
145 fl_set_object_lcol(fd_form_table_options->radio_align_left,
147 fl_set_object_lcol(fd_form_table_options->radio_align_right,
149 fl_set_object_lcol(fd_form_table_options->radio_align_center,
152 fl_activate_object(fd_form_table_options->radio_align_left);
153 fl_activate_object(fd_form_table_options->radio_align_right);
154 fl_activate_object(fd_form_table_options->radio_align_center);
155 fl_set_object_lcol(fd_form_table_options->radio_align_left,
157 fl_set_object_lcol(fd_form_table_options->radio_align_right,
159 fl_set_object_lcol(fd_form_table_options->radio_align_center,
162 fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTable());
163 if (table->IsLongTable()) {
164 fl_activate_object(fd_form_table_options->radio_lt_firsthead);
165 fl_activate_object(fd_form_table_options->radio_lt_head);
166 fl_activate_object(fd_form_table_options->radio_lt_foot);
167 fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
168 fl_activate_object(fd_form_table_options->radio_lt_newpage);
169 fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
171 fl_set_object_lcol(fd_form_table_options->radio_lt_head,
173 fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
175 fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
177 fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
179 fl_set_button(fd_form_table_options->radio_lt_firsthead,
180 table->RowOfLTFirstHead(cell));
181 fl_set_button(fd_form_table_options->radio_lt_head,
182 table->RowOfLTHead(cell));
183 fl_set_button(fd_form_table_options->radio_lt_foot,
184 table->RowOfLTFoot(cell));
185 fl_set_button(fd_form_table_options->radio_lt_lastfoot,
186 table->RowOfLTLastFoot(cell));
187 fl_set_button(fd_form_table_options->radio_lt_newpage,
188 table->LTNewPage(cell));
190 fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
191 fl_deactivate_object(fd_form_table_options->radio_lt_head);
192 fl_deactivate_object(fd_form_table_options->radio_lt_foot);
193 fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
194 fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
195 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
196 fl_set_button(fd_form_table_options->radio_lt_head, 0);
197 fl_set_button(fd_form_table_options->radio_lt_foot, 0);
198 fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
199 fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
200 fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
202 fl_set_object_lcol(fd_form_table_options->radio_lt_head,
204 fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
206 fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
208 fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
211 fl_set_button(fd_form_table_options->radio_rotate_table,
212 table->RotateTable());
213 fl_set_focus_object(fd_form_table_options->form_table_options,
214 fd_form_table_options->button_table_delete);
215 } else if (fd_form_table_options->form_table_options->visible) {
216 fl_set_focus_object(fd_form_table_options->form_table_options,
217 fd_form_table_options->button_table_delete);
218 fl_hide_form(fd_form_table_options->form_table_options);
223 bool UpdateLayoutTable(int flag)
226 if (!current_view->getScreen() || !current_view->available())
229 if (update && current_view->buffer()->text->cursor.par->table) {
231 string pwidth, special;
233 LyXTable * table = current_view->buffer()->text->cursor.par->table;
235 int cell = current_view->buffer()->text->
236 NumberOfCell(current_view->buffer()->text->cursor.par,
237 current_view->buffer()->text->cursor.pos);
239 int column = table->column_of_cell(cell)+1;
240 fl_set_object_label(fd_form_table_options->text_warning, "");
242 fl_activate_object(fd_form_table_extra->input_special_alignment);
243 fl_activate_object(fd_form_table_extra->input_special_multialign);
244 fl_activate_object(fd_form_table_options->input_column_width);
245 sprintf(buf, "%d", column);
246 fl_set_input(fd_form_table_options->input_table_column, buf);
247 fl_deactivate_object(fd_form_table_options->input_table_column);
248 int row = table->row_of_cell(cell)+1;
249 sprintf(buf, "%d", row);
250 fl_set_input(fd_form_table_options->input_table_row, buf);
251 fl_deactivate_object(fd_form_table_options->input_table_row);
252 if (table->IsMultiColumn(cell))
253 fl_set_button(fd_form_table_options->radio_multicolumn, 1);
255 fl_set_button(fd_form_table_options->radio_multicolumn, 0);
256 if (table->RotateCell(cell))
257 fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
259 fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
260 if (table->TopLine(cell))
261 fl_set_button(fd_form_table_options->radio_border_top, 1);
263 fl_set_button(fd_form_table_options->radio_border_top, 0);
264 if (table->BottomLine(cell))
265 fl_set_button(fd_form_table_options->radio_border_bottom, 1);
267 fl_set_button(fd_form_table_options->radio_border_bottom, 0);
268 if (table->LeftLine(cell))
269 fl_set_button(fd_form_table_options->radio_border_left, 1);
271 fl_set_button(fd_form_table_options->radio_border_left, 0);
272 if (table->RightLine(cell))
273 fl_set_button(fd_form_table_options->radio_border_right, 1);
275 fl_set_button(fd_form_table_options->radio_border_right, 0);
276 int align = table->GetAlignment(cell);
277 fl_set_button(fd_form_table_options->radio_align_left, 0);
278 fl_set_button(fd_form_table_options->radio_align_right, 0);
279 fl_set_button(fd_form_table_options->radio_align_center, 0);
280 special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN);
283 fl_set_input(fd_form_table_extra->input_special_alignment,
285 fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
286 extra_col_cursor_x, 0); // restore the cursor
288 if (current_view->buffer()->isReadonly())
289 fl_deactivate_object(fd_form_table_extra->input_special_alignment);
290 special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_MULTI);
293 fl_set_input(fd_form_table_extra->input_special_multialign,
295 fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
296 extra_multicol_cursor_x, 0); // restore the cursor
298 if (current_view->buffer()->isReadonly())
299 fl_deactivate_object(fd_form_table_extra->input_special_multialign);
300 pwidth = table->GetPWidth(cell);
302 fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str());
303 if (current_view->buffer()->isReadonly())
304 fl_deactivate_object(fd_form_table_options->input_column_width);
305 if (!pwidth.empty()) {
306 fl_activate_object(fd_form_table_options->radio_linebreak_cell);
307 fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
309 fl_set_button(fd_form_table_options->radio_linebreak_cell,
310 table->Linebreaks(table->FirstVirtualCell(cell)));
312 fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
313 fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
315 fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
317 if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
318 (align == LYX_ALIGN_LEFT))
319 fl_set_button(fd_form_table_options->radio_align_left, 1);
320 else if (align == LYX_ALIGN_RIGHT)
321 fl_set_button(fd_form_table_options->radio_align_right, 1);
323 fl_set_button(fd_form_table_options->radio_align_center, 1);
324 if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
325 fl_deactivate_object(fd_form_table_options->radio_align_left);
326 fl_deactivate_object(fd_form_table_options->radio_align_right);
327 fl_deactivate_object(fd_form_table_options->radio_align_center);
328 fl_set_object_lcol(fd_form_table_options->radio_align_left,
330 fl_set_object_lcol(fd_form_table_options->radio_align_right,
332 fl_set_object_lcol(fd_form_table_options->radio_align_center,
335 fl_activate_object(fd_form_table_options->radio_align_left);
336 fl_activate_object(fd_form_table_options->radio_align_right);
337 fl_activate_object(fd_form_table_options->radio_align_center);
338 fl_set_object_lcol(fd_form_table_options->radio_align_left,
340 fl_set_object_lcol(fd_form_table_options->radio_align_right,
342 fl_set_object_lcol(fd_form_table_options->radio_align_center,
345 fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTable());
346 if (table->IsLongTable()) {
347 fl_activate_object(fd_form_table_options->radio_lt_firsthead);
348 fl_activate_object(fd_form_table_options->radio_lt_head);
349 fl_activate_object(fd_form_table_options->radio_lt_foot);
350 fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
351 fl_activate_object(fd_form_table_options->radio_lt_newpage);
352 fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
354 fl_set_object_lcol(fd_form_table_options->radio_lt_head,
356 fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
358 fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
360 fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
362 fl_set_button(fd_form_table_options->radio_lt_firsthead,
363 table->RowOfLTFirstHead(cell));
364 fl_set_button(fd_form_table_options->radio_lt_head,
365 table->RowOfLTHead(cell));
366 fl_set_button(fd_form_table_options->radio_lt_foot,
367 table->RowOfLTFoot(cell));
368 fl_set_button(fd_form_table_options->radio_lt_lastfoot,
369 table->RowOfLTLastFoot(cell));
370 fl_set_button(fd_form_table_options->radio_lt_newpage,
371 table->LTNewPage(cell));
373 fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
374 fl_deactivate_object(fd_form_table_options->radio_lt_head);
375 fl_deactivate_object(fd_form_table_options->radio_lt_foot);
376 fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
377 fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
378 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
379 fl_set_button(fd_form_table_options->radio_lt_head, 0);
380 fl_set_button(fd_form_table_options->radio_lt_foot, 0);
381 fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
382 fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
383 fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
385 fl_set_object_lcol(fd_form_table_options->radio_lt_head,
387 fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
389 fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
391 fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
394 fl_set_button(fd_form_table_options->radio_rotate_table,
395 table->RotateTable());
396 fl_set_focus_object(fd_form_table_options->form_table_options,
397 fd_form_table_options->button_table_delete);
398 } else if (fd_form_table_options->form_table_options->visible) {
399 fl_set_focus_object(fd_form_table_options->form_table_options,
400 fd_form_table_options->button_table_delete);
401 fl_hide_form(fd_form_table_options->form_table_options);
407 void OpenLayoutTableExtra()
410 if (fd_form_table_extra->form_table_extra->visible) {
411 fl_raise_form(fd_form_table_extra->form_table_extra);
413 static int ow = -1, oh;
414 fl_show_form(fd_form_table_extra->form_table_extra,
415 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
416 _("Table Extra Form"));
418 ow = fd_form_table_extra->form_table_extra->w;
419 oh = fd_form_table_extra->form_table_extra->h;
421 fl_set_form_minsize(fd_form_table_extra->form_table_extra,
427 void MenuLayoutTable(int flag)
429 if (UpdateLayoutTable(flag)) {
430 if (fd_form_table_options->form_table_options->visible) {
431 fl_raise_form(fd_form_table_options->form_table_options);
434 fl_show_form(fd_form_table_options->form_table_options,
435 FL_PLACE_MOUSE, FL_FULLBORDER,
442 void TableOptionsCB(FL_OBJECT * ob, long)
444 LyXTable * table = 0;
449 if (!current_view->available()
450 || !(table = current_view->text->cursor.par->table)) {
454 int cell = current_view->text->
455 NumberOfCell(current_view->text->cursor.par,
456 current_view->text->cursor.pos);
457 if (ActCell != cell) {
459 fl_set_object_label(fd_form_table_options->text_warning,
460 _("Warning: Wrong Cursor position, updated window"));
461 fl_show_object(fd_form_table_options->text_warning);
462 extra_col_cursor_x = 0; // would rather place it at the end, but...
463 extra_multicol_cursor_x = 0;
467 if (!current_view->available()
469 !(table = current_view->buffer()->text->cursor.par->table)) {
473 int cell = current_view->buffer()->text->
474 NumberOfCell(current_view->buffer()->text->cursor.par,
475 current_view->buffer()->text->cursor.pos);
476 if (ActCell != cell) {
478 fl_set_object_label(fd_form_table_options->text_warning,
479 _("Warning: Wrong Cursor position, updated window"));
480 fl_show_object(fd_form_table_options->text_warning);
481 extra_col_cursor_x = 0; // would rather place it at the end, but...
482 extra_multicol_cursor_x = 0;
486 // No point in processing directives that you can't do anything with
487 // anyhow, so exit now if the buffer is read-only.
488 if (current_view->buffer()->isReadonly()) {
493 if (ob != fd_form_table_options->button_table_delete) {
494 fl_set_object_label(fd_form_table_options->text_warning, "");
497 str = fl_get_input(fd_form_table_options->input_column_width);
498 if (!str.empty() && !isValidLength(str)) {
499 fl_set_object_label(fd_form_table_options->text_warning,
500 _("Warning: Invalid Length (valid example: 10mm)"));
501 fl_show_object(fd_form_table_options->text_warning);
504 if (((ob == fd_form_table_options->button_delete_row) && (table->rows<= 1)) ||
505 ((ob == fd_form_table_options->button_delete_column) && (table->columns<= 1)))
506 ob = fd_form_table_options->button_table_delete;
507 if (ob == fd_form_table_options->button_append_row)
508 num = LyXTable::APPEND_ROW;
509 else if (ob == fd_form_table_options->button_append_column)
510 num = LyXTable::APPEND_COLUMN;
511 else if (ob == fd_form_table_options->button_delete_row)
512 num = LyXTable::DELETE_ROW;
513 else if (ob == fd_form_table_options->button_delete_column)
514 num = LyXTable::DELETE_COLUMN;
515 else if (ob == fd_form_table_options->button_set_borders)
516 num = LyXTable::SET_ALL_LINES;
517 else if (ob == fd_form_table_options->button_unset_borders)
518 num = LyXTable::UNSET_ALL_LINES;
519 else if (ob == fd_form_table_options->radio_border_top)
520 num = LyXTable::TOGGLE_LINE_TOP;
521 else if (ob == fd_form_table_options->radio_border_bottom)
522 num = LyXTable::TOGGLE_LINE_BOTTOM;
523 else if (ob == fd_form_table_options->radio_border_left)
524 num = LyXTable::TOGGLE_LINE_LEFT;
525 else if (ob == fd_form_table_options->radio_border_right)
526 num = LyXTable::TOGGLE_LINE_RIGHT;
527 else if (ob == fd_form_table_options->radio_align_left)
528 num = LyXTable::ALIGN_LEFT;
529 else if (ob == fd_form_table_options->radio_align_right)
530 num = LyXTable::ALIGN_RIGHT;
531 else if (ob == fd_form_table_options->radio_align_center)
532 num = LyXTable::ALIGN_CENTER;
533 else if ((ob == fd_form_table_options->button_table_delete) && !Confirmed) {
534 fl_set_object_label(fd_form_table_options->text_warning,
535 _("Confirm: press Delete-Button again"));
538 } else if ((ob == fd_form_table_options->button_table_delete)
540 num = LyXTable::DELETE_TABLE;
542 } else if (ob == fd_form_table_options->radio_multicolumn)
543 num = LyXTable::MULTICOLUMN;
544 else if (ob == fd_form_table_options->radio_longtable) {
545 s = fl_get_button(fd_form_table_options->radio_longtable);
547 num = LyXTable::SET_LONGTABLE;
548 fl_activate_object(fd_form_table_options->radio_lt_firsthead);
549 fl_activate_object(fd_form_table_options->radio_lt_head);
550 fl_activate_object(fd_form_table_options->radio_lt_foot);
551 fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
552 fl_activate_object(fd_form_table_options->radio_lt_newpage);
553 fl_set_button(fd_form_table_options->radio_lt_firsthead,
554 table->RowOfLTFirstHead(cell));
555 fl_set_button(fd_form_table_options->radio_lt_head,
556 table->RowOfLTHead(cell));
557 fl_set_button(fd_form_table_options->radio_lt_foot,
558 table->RowOfLTFoot(cell));
559 fl_set_button(fd_form_table_options->radio_lt_lastfoot,
560 table->RowOfLTLastFoot(cell));
561 fl_set_button(fd_form_table_options->radio_lt_firsthead,
562 table->LTNewPage(cell));
564 num = LyXTable::UNSET_LONGTABLE;
565 fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
566 fl_deactivate_object(fd_form_table_options->radio_lt_head);
567 fl_deactivate_object(fd_form_table_options->radio_lt_foot);
568 fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
569 fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
570 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
571 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
572 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
573 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
574 fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
575 fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
577 fl_set_object_lcol(fd_form_table_options->radio_lt_head,
579 fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
581 fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
583 fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
586 } else if (ob == fd_form_table_options->radio_rotate_table) {
587 s = fl_get_button(fd_form_table_options->radio_rotate_table);
589 num = LyXTable::SET_ROTATE_TABLE;
591 num = LyXTable::UNSET_ROTATE_TABLE;
592 } else if (ob == fd_form_table_options->radio_rotate_cell) {
593 s = fl_get_button(fd_form_table_options->radio_rotate_cell);
595 num = LyXTable::SET_ROTATE_CELL;
597 num = LyXTable::UNSET_ROTATE_CELL;
598 } else if (ob == fd_form_table_options->radio_linebreak_cell) {
599 num = LyXTable::SET_LINEBREAKS;
600 } else if (ob == fd_form_table_options->radio_lt_firsthead) {
601 num = LyXTable::SET_LTFIRSTHEAD;
602 } else if (ob == fd_form_table_options->radio_lt_head) {
603 num = LyXTable::SET_LTHEAD;
604 } else if (ob == fd_form_table_options->radio_lt_foot) {
605 num = LyXTable::SET_LTFOOT;
606 } else if (ob == fd_form_table_options->radio_lt_lastfoot) {
607 num = LyXTable::SET_LTLASTFOOT;
608 } else if (ob == fd_form_table_options->radio_lt_newpage) {
609 num = LyXTable::SET_LTNEWPAGE;
610 } else if (ob == fd_form_table_options->button_table_extra) {
611 OpenLayoutTableExtra();
613 } else if (ob == fd_form_table_extra->input_special_alignment) {
614 special = fl_get_input(fd_form_table_extra->input_special_alignment);
616 fl_get_input_cursorpos(ob, &extra_col_cursor_x, &dummy);
617 num = LyXTable::SET_SPECIAL_COLUMN;
618 } else if (ob == fd_form_table_extra->input_special_multialign) {
619 special = fl_get_input(fd_form_table_extra->input_special_multialign);
621 fl_get_input_cursorpos(ob, &extra_multicol_cursor_x, &dummy);
622 num = LyXTable::SET_SPECIAL_MULTI;
625 if (current_view->available()){
626 current_view->getScreen()->HideCursor();
628 if (!current_view->text->selection){
630 current_view->update(-2);
632 if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
633 (num == LyXTable::SET_SPECIAL_MULTI))
634 current_view->text->TableFeatures(num, special);
636 current_view->text->TableFeatures(num);
637 current_view->update(1);
639 if (!current_view->buffer()->text->selection){
641 current_view->buffer()->update(-2);
643 if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
644 (num == LyXTable::SET_SPECIAL_MULTI))
645 current_view->buffer()->text->TableFeatures(num, special);
647 current_view->buffer()->text->TableFeatures(num);
648 current_view->buffer()->update(1);
651 if (num == LyXTable::DELETE_TABLE) {
652 fl_set_focus_object(fd_form_table_options->form_table_options,
653 fd_form_table_options->button_table_delete);
654 fl_hide_form(fd_form_table_options->form_table_options);
656 UpdateLayoutTable(true);
660 void TableOptCloseCB(FL_OBJECT *, long)
662 fl_set_focus_object(fd_form_table_options->form_table_options,
663 fd_form_table_options->button_table_delete);
664 fl_hide_form(fd_form_table_options->form_table_options);
668 void TableSpeCloseCB(FL_OBJECT *, long)
670 fl_set_focus_object(fd_form_table_options->form_table_options,
671 fd_form_table_options->button_table_delete);
672 fl_hide_form(fd_form_table_extra->form_table_extra);
676 void SetPWidthCB(FL_OBJECT *ob, long)
678 fl_set_object_label(fd_form_table_options->text_warning, "");
680 if (ob == fd_form_table_options->input_column_width) {
683 str = fl_get_input(ob);
684 if (!str.empty() && !isValidLength(str)) {
685 fl_set_object_label(fd_form_table_options->text_warning,
686 _("Warning: Invalid Length (valid example: 10mm)"));
687 fl_show_object(fd_form_table_options->text_warning);
690 if (current_view->available()){
691 current_view->getScreen()->HideCursor();
693 if (!current_view->text->selection){
695 current_view->update(-2);
697 current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
698 current_view->update(1);
700 if (!current_view->buffer()->text->selection){
702 current_view->buffer()->update(-2);
704 current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH, str);
705 current_view->buffer()->update(1);
708 MenuLayoutTable(0); // update for alignment