2 * FormTabular Interface Class Implementation
6 #include "lyx_gui_misc.h"
8 #include FORMS_H_LOCATION
10 #include "FormTabular.h"
11 #include "form_tabular.h"
12 #include "xform_macros.h"
13 #include "input_validators.h"
19 #include "insets/insettabular.h"
23 #ifdef SIGC_CXX_NAMESPACES
27 C_RETURNCB(FormTabular, WMHideCB)
28 C_GENERICCB(FormTabular, CloseCB)
29 C_GENERICCB(FormTabular, InputCB)
30 C_GENERICCB(FormTabular, OKCB)
31 C_GENERICCB(FormTabular, ApplyCB)
32 C_GENERICCB(FormTabular, CancelCB)
35 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
36 : dialog_(0), tabular_options_(0), column_options_(0),
37 cell_options_(0), longtable_options_(0), create_tabular_(0),
38 lv_(lv), d_(d), u_(0), h_(0), inset_(0), actCell_(-1)
40 // let the dialog be shown
41 // This is a permanent connection so we won't bother
42 // storing a copy because we won't be disconnecting.
43 d->showTabular.connect(slot(this, &FormTabular::showInset));
44 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
45 d->hideTabular.connect(slot(this, &FormTabular::hideInset));
46 d->showTabularCreate.connect(slot(this, &FormTabular::show_create));
50 FormTabular::~FormTabular()
56 void FormTabular::build()
58 dialog_ = build_tabular();
59 tabular_options_ = build_tabular_options();
60 column_options_ = build_column_options();
61 cell_options_ = build_cell_options();
62 longtable_options_ = build_longtable_options();
63 create_tabular_ = build_create_tabular();
65 fl_set_input_return(column_options_->input_column_width,
67 fl_set_input_return(column_options_->input_special_alignment,
69 fl_set_input_return(cell_options_->input_mcolumn_width,
71 fl_set_input_return(cell_options_->input_special_multialign,
74 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
75 tabular_options_->form_tabular_options);
76 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
77 column_options_->form_column_options);
78 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
79 cell_options_->form_cell_options);
80 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
81 longtable_options_->form_longtable_options);
83 fl_set_form_atclose(dialog_->form_tabular,
84 C_FormTabularWMHideCB, 0);
86 fl_set_slider_bounds(create_tabular_->slider_rows, 1, 50);
87 fl_set_slider_bounds(create_tabular_->slider_columns, 1, 50);
88 fl_set_slider_value(create_tabular_->slider_rows, 5);
89 fl_set_slider_value(create_tabular_->slider_columns, 5);
90 fl_set_slider_precision(create_tabular_->slider_rows, 0);
91 fl_set_slider_precision(create_tabular_->slider_columns, 0);
92 fl_set_form_atclose(create_tabular_->form_create_tabular,
93 C_FormTabularWMHideCB, 0);
97 void FormTabular::show()
102 update(); // make sure its up-to-date
104 if (dialog_->form_tabular->visible) {
105 fl_raise_form(dialog_->form_tabular);
107 fl_show_form(dialog_->form_tabular,
108 FL_PLACE_MOUSE | FL_FREE_SIZE,
110 _("Tabular Layout"));
111 // u_ = d_->updateBufferDependent.connect(slot(this,
112 // &FormTabular::update));
113 h_ = d_->hideBufferDependent.connect(slot(this,
114 &FormTabular::hide));
118 void FormTabular::showInset(InsetTabular * ti)
126 void FormTabular::hide()
128 if (dialog_ && dialog_->form_tabular && dialog_->form_tabular->visible) {
129 fl_hide_form(dialog_->form_tabular);
137 void FormTabular::hideInset(InsetTabular * ti)
146 void FormTabular::update()
153 void FormTabular::updateInset(InsetTabular * ti)
156 if (ti && dialog_ && dialog_->form_tabular->visible) {
162 void FormTabular::free()
164 // we don't need to delete u and h here because
165 // hide() does that after disconnecting.
167 if (dialog_->form_tabular
168 && dialog_->form_tabular->visible) {
171 fl_free_form(dialog_->form_tabular);
175 fl_free_form(tabular_options_->form_tabular_options);
176 delete tabular_options_;
177 tabular_options_ = 0;
179 fl_free_form(column_options_->form_column_options);
180 delete column_options_;
183 fl_free_form(cell_options_->form_cell_options);
184 delete cell_options_;
187 fl_free_form(longtable_options_->form_longtable_options);
188 delete longtable_options_;
189 longtable_options_ = 0;
192 fl_free_form(create_tabular_->form_create_tabular);
193 delete create_tabular_;
199 int FormTabular::WMHideCB(FL_FORM * form, void *)
201 // Ensure that the signals (u and h) are disconnected even if the
202 // window manager is used to close the dialog.
203 FormTabular * pre = static_cast<FormTabular*>(form->u_vdata);
209 void FormTabular::CloseCB(FL_OBJECT * ob, long)
211 FormTabular * pre = static_cast<FormTabular*>(ob->form->u_vdata);
216 void FormTabular::InputCB(FL_OBJECT * ob, long l)
218 FormTabular * pre = static_cast<FormTabular*>(ob->form->u_vdata);
219 pre->SetTabularOptions(ob, l);
223 bool FormTabular::local_update(bool)
225 if (!inset_ || !inset_->tabular)
229 * tabular = inset_->tabular;
239 actCell_ = cell = inset_->GetActCell();
240 column = tabular->column_of_cell(cell)+1;
241 fl_set_object_label(dialog_->text_warning,"");
242 fl_activate_object(column_options_->input_special_alignment);
243 fl_activate_object(cell_options_->input_special_multialign);
244 fl_activate_object(column_options_->input_column_width);
245 sprintf(buf,"%d",column);
246 fl_set_input(dialog_->input_tabular_column, buf);
247 fl_deactivate_object(dialog_->input_tabular_column);
248 row = tabular->row_of_cell(cell)+1;
249 sprintf(buf,"%d",row);
250 fl_set_input(dialog_->input_tabular_row, buf);
251 fl_deactivate_object(dialog_->input_tabular_row);
252 if (tabular->IsMultiColumn(cell)) {
253 fl_set_button(cell_options_->radio_multicolumn, 1);
254 fl_set_button(cell_options_->radio_border_top,
255 tabular->TopLine(cell)?1:0);
256 fl_activate_object(cell_options_->radio_border_top);
257 fl_set_object_lcol(cell_options_->radio_border_top, FL_BLACK);
258 fl_set_button(cell_options_->radio_border_bottom,
259 tabular->BottomLine(cell)?1:0);
260 fl_activate_object(cell_options_->radio_border_bottom);
261 fl_set_object_lcol(cell_options_->radio_border_bottom, FL_BLACK);
262 fl_set_button(cell_options_->radio_border_left,
263 tabular->LeftLine(cell)?1:0);
264 fl_activate_object(cell_options_->radio_border_left);
265 fl_set_object_lcol(cell_options_->radio_border_left, FL_BLACK);
266 fl_set_button(cell_options_->radio_border_right,
267 tabular->RightLine(cell)?1:0);
268 fl_activate_object(cell_options_->radio_border_right);
269 fl_set_object_lcol(cell_options_->radio_border_right, FL_BLACK);
270 pwidth = tabular->GetMColumnPWidth(cell);
271 align = tabular->GetAlignment(cell);
272 if (!pwidth.empty() || (align == LYX_ALIGN_LEFT))
273 fl_set_button(cell_options_->radio_align_left, 1);
274 else if (align == LYX_ALIGN_RIGHT)
275 fl_set_button(cell_options_->radio_align_right, 1);
277 fl_set_button(cell_options_->radio_align_center, 1);
278 fl_activate_object(cell_options_->radio_align_left);
279 fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK);
280 fl_activate_object(cell_options_->radio_align_right);
281 fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK);
282 fl_activate_object(cell_options_->radio_align_center);
283 fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK);
284 align = tabular->GetVAlignment(cell);
285 fl_set_button(cell_options_->radio_valign_top, 0);
286 fl_set_button(cell_options_->radio_valign_bottom, 0);
287 fl_set_button(cell_options_->radio_valign_center, 0);
288 if (pwidth.empty() || (align == LyXTabular::LYX_VALIGN_CENTER))
289 fl_set_button(cell_options_->radio_valign_center, 1);
290 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
291 fl_set_button(cell_options_->radio_valign_bottom, 1);
293 fl_set_button(cell_options_->radio_valign_top, 1);
294 fl_activate_object(cell_options_->radio_valign_top);
295 fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK);
296 fl_activate_object(cell_options_->radio_valign_bottom);
297 fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK);
298 fl_activate_object(cell_options_->radio_valign_center);
299 fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK);
300 special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI);
301 fl_set_input(cell_options_->input_special_multialign, special.c_str());
302 fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str());
303 if (!lv_->buffer()->isReadonly()) {
304 fl_activate_object(cell_options_->input_special_multialign);
305 fl_set_object_lcol(cell_options_->input_special_multialign,
307 fl_activate_object(cell_options_->input_mcolumn_width);
308 fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_BLACK);
310 if (!pwidth.empty()) {
311 fl_deactivate_object(cell_options_->radio_align_left);
312 fl_deactivate_object(cell_options_->radio_align_right);
313 fl_deactivate_object(cell_options_->radio_align_center);
314 fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE);
315 fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE);
316 fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE);
317 fl_activate_object(cell_options_->radio_valign_top);
318 fl_activate_object(cell_options_->radio_valign_bottom);
319 fl_activate_object(cell_options_->radio_valign_center);
320 fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK);
321 fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK);
322 fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK);
324 fl_activate_object(cell_options_->radio_align_left);
325 fl_activate_object(cell_options_->radio_align_right);
326 fl_activate_object(cell_options_->radio_align_center);
327 fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK);
328 fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK);
329 fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK);
330 fl_deactivate_object(cell_options_->radio_valign_top);
331 fl_deactivate_object(cell_options_->radio_valign_bottom);
332 fl_deactivate_object(cell_options_->radio_valign_center);
333 fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE);
334 fl_set_object_lcol(cell_options_->radio_valign_bottom,FL_INACTIVE);
335 fl_set_object_lcol(cell_options_->radio_valign_center,FL_INACTIVE);
338 fl_set_button(cell_options_->radio_multicolumn, 0);
339 fl_set_button(cell_options_->radio_border_top, 0);
340 fl_deactivate_object(cell_options_->radio_border_top);
341 fl_set_object_lcol(cell_options_->radio_border_top, FL_INACTIVE);
342 fl_set_button(cell_options_->radio_border_bottom, 0);
343 fl_deactivate_object(cell_options_->radio_border_bottom);
344 fl_set_object_lcol(cell_options_->radio_border_bottom, FL_INACTIVE);
345 fl_set_button(cell_options_->radio_border_left, 0);
346 fl_deactivate_object(cell_options_->radio_border_left);
347 fl_set_object_lcol(cell_options_->radio_border_left, FL_INACTIVE);
348 fl_set_button(cell_options_->radio_border_right, 0);
349 fl_deactivate_object(cell_options_->radio_border_right);
350 fl_set_object_lcol(cell_options_->radio_border_right, FL_INACTIVE);
351 fl_set_button(cell_options_->radio_align_left, 0);
352 fl_deactivate_object(cell_options_->radio_align_left);
353 fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE);
354 fl_set_button(cell_options_->radio_align_right, 0);
355 fl_deactivate_object(cell_options_->radio_align_right);
356 fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE);
357 fl_set_button(cell_options_->radio_align_center, 0);
358 fl_deactivate_object(cell_options_->radio_align_center);
359 fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE);
360 fl_set_button(cell_options_->radio_valign_top, 0);
361 fl_deactivate_object(cell_options_->radio_valign_top);
362 fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE);
363 fl_set_button(cell_options_->radio_valign_bottom, 0);
364 fl_deactivate_object(cell_options_->radio_valign_bottom);
365 fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_INACTIVE);
366 fl_set_button(cell_options_->radio_valign_center, 0);
367 fl_deactivate_object(cell_options_->radio_valign_center);
368 fl_set_object_lcol(cell_options_->radio_valign_center, FL_INACTIVE);
369 fl_set_input(cell_options_->input_special_multialign, "");
370 fl_deactivate_object(cell_options_->input_special_multialign);
371 fl_set_object_lcol(cell_options_->input_special_multialign, FL_INACTIVE);
372 fl_set_input(cell_options_->input_mcolumn_width,"");
373 fl_deactivate_object(cell_options_->input_mcolumn_width);
374 fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_INACTIVE);
376 if (tabular->GetRotateCell(cell))
377 fl_set_button(cell_options_->radio_rotate_cell, 1);
379 fl_set_button(cell_options_->radio_rotate_cell, 0);
380 if (tabular->TopLine(cell, true))
381 fl_set_button(column_options_->radio_border_top, 1);
383 fl_set_button(column_options_->radio_border_top, 0);
384 if (tabular->BottomLine(cell, true))
385 fl_set_button(column_options_->radio_border_bottom, 1);
387 fl_set_button(column_options_->radio_border_bottom, 0);
388 if (tabular->LeftLine(cell, true))
389 fl_set_button(column_options_->radio_border_left, 1);
391 fl_set_button(column_options_->radio_border_left, 0);
392 if (tabular->RightLine(cell, true))
393 fl_set_button(column_options_->radio_border_right, 1);
395 fl_set_button(column_options_->radio_border_right, 0);
396 special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_COLUMN);
397 fl_set_input(column_options_->input_special_alignment, special.c_str());
398 if (lv_->buffer()->isReadonly())
399 fl_deactivate_object(column_options_->input_special_alignment);
401 fl_activate_object(column_options_->input_special_alignment);
402 pwidth = tabular->GetColumnPWidth(cell);
403 fl_set_input(column_options_->input_column_width,pwidth.c_str());
404 if (lv_->buffer()->isReadonly()) {
405 fl_deactivate_object(column_options_->input_column_width);
407 fl_activate_object(column_options_->input_column_width);
409 if (!pwidth.empty()) {
410 fl_activate_object(cell_options_->radio_useminipage);
411 fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK);
412 if (tabular->GetUsebox(cell) == 2)
413 fl_set_button(cell_options_->radio_useminipage, 1);
415 fl_set_button(cell_options_->radio_useminipage, 0);
417 fl_deactivate_object(cell_options_->radio_useminipage);
418 fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE);
419 fl_set_button(cell_options_->radio_useminipage,0);
421 align = tabular->GetAlignment(cell, true);
422 fl_set_button(column_options_->radio_align_left, 0);
423 fl_set_button(column_options_->radio_align_right, 0);
424 fl_set_button(column_options_->radio_align_center, 0);
425 if (!pwidth.empty() || (align == LYX_ALIGN_LEFT))
426 fl_set_button(column_options_->radio_align_left, 1);
427 else if (align == LYX_ALIGN_RIGHT)
428 fl_set_button(column_options_->radio_align_right, 1);
430 fl_set_button(column_options_->radio_align_center, 1);
431 align = tabular->GetVAlignment(cell, true);
432 fl_set_button(column_options_->radio_valign_top, 0);
433 fl_set_button(column_options_->radio_valign_bottom, 0);
434 fl_set_button(column_options_->radio_valign_center, 0);
435 if (pwidth.empty() || (align == LyXTabular::LYX_VALIGN_CENTER))
436 fl_set_button(column_options_->radio_valign_center, 1);
437 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
438 fl_set_button(column_options_->radio_valign_bottom, 1);
440 fl_set_button(column_options_->radio_valign_top, 1);
441 if (!pwidth.empty()) {
442 fl_deactivate_object(column_options_->radio_align_left);
443 fl_deactivate_object(column_options_->radio_align_right);
444 fl_deactivate_object(column_options_->radio_align_center);
445 fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE);
446 fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE);
447 fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE);
448 fl_activate_object(column_options_->radio_valign_top);
449 fl_activate_object(column_options_->radio_valign_bottom);
450 fl_activate_object(column_options_->radio_valign_center);
451 fl_set_object_lcol(column_options_->radio_valign_top, FL_BLACK);
452 fl_set_object_lcol(column_options_->radio_valign_bottom, FL_BLACK);
453 fl_set_object_lcol(column_options_->radio_valign_center, FL_BLACK);
455 fl_activate_object(column_options_->radio_align_left);
456 fl_activate_object(column_options_->radio_align_right);
457 fl_activate_object(column_options_->radio_align_center);
458 fl_set_object_lcol(column_options_->radio_align_left, FL_BLACK);
459 fl_set_object_lcol(column_options_->radio_align_right, FL_BLACK);
460 fl_set_object_lcol(column_options_->radio_align_center, FL_BLACK);
461 fl_deactivate_object(column_options_->radio_valign_top);
462 fl_deactivate_object(column_options_->radio_valign_bottom);
463 fl_deactivate_object(column_options_->radio_valign_center);
464 fl_set_object_lcol(column_options_->radio_valign_top, FL_INACTIVE);
465 fl_set_object_lcol(column_options_->radio_valign_bottom, FL_INACTIVE);
466 fl_set_object_lcol(column_options_->radio_valign_center, FL_INACTIVE);
468 fl_set_button(tabular_options_->radio_longtable,
469 tabular->IsLongTabular());
470 if (tabular->IsLongTabular()) {
471 fl_activate_object(longtable_options_->radio_lt_firsthead);
472 fl_activate_object(longtable_options_->radio_lt_head);
473 fl_activate_object(longtable_options_->radio_lt_foot);
474 fl_activate_object(longtable_options_->radio_lt_lastfoot);
475 fl_activate_object(longtable_options_->radio_lt_newpage);
476 fl_set_object_lcol(longtable_options_->radio_lt_firsthead, FL_BLACK);
477 fl_set_object_lcol(longtable_options_->radio_lt_head, FL_BLACK);
478 fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_BLACK);
479 fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_BLACK);
480 fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_BLACK);
482 fl_set_button(longtable_options_->radio_lt_firsthead,
483 tabular->GetRowOfLTFirstHead(cell, dummy));
484 fl_set_button(longtable_options_->radio_lt_head,
485 tabular->GetRowOfLTHead(cell, dummy));
486 fl_set_button(longtable_options_->radio_lt_foot,
487 tabular->GetRowOfLTFoot(cell, dummy));
488 fl_set_button(longtable_options_->radio_lt_lastfoot,
489 tabular->GetRowOfLTLastFoot(cell, dummy));
490 fl_set_button(longtable_options_->radio_lt_newpage,
491 tabular->GetLTNewPage(cell));
493 fl_deactivate_object(longtable_options_->radio_lt_firsthead);
494 fl_deactivate_object(longtable_options_->radio_lt_head);
495 fl_deactivate_object(longtable_options_->radio_lt_foot);
496 fl_deactivate_object(longtable_options_->radio_lt_lastfoot);
497 fl_deactivate_object(longtable_options_->radio_lt_newpage);
498 fl_set_button(longtable_options_->radio_lt_firsthead,0);
499 fl_set_button(longtable_options_->radio_lt_head,0);
500 fl_set_button(longtable_options_->radio_lt_foot,0);
501 fl_set_button(longtable_options_->radio_lt_lastfoot,0);
502 fl_set_button(longtable_options_->radio_lt_newpage,0);
503 fl_set_object_lcol(longtable_options_->radio_lt_firsthead,FL_INACTIVE);
504 fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE);
505 fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE);
506 fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_INACTIVE);
507 fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_INACTIVE);
509 fl_set_button(tabular_options_->radio_rotate_tabular,
510 tabular->GetRotateTabular());
514 void FormTabular::SetTabularOptions(FL_OBJECT * ob, long)
520 * tabular = inset_->tabular;
529 cell = inset_->GetActCell();
530 if (actCell_ != cell) {
532 fl_set_object_label(dialog_->text_warning,
533 _("Warning: Wrong Cursor position, updated window"));
534 fl_show_object(dialog_->text_warning);
537 // No point in processing directives that you can't do anything with
538 // anyhow, so exit now if the buffer is read-only.
539 if (lv_->buffer()->isReadonly()) {
543 if (ob == column_options_->input_column_width) {
546 str = fl_get_input(ob);
547 if (!str.empty() && !isValidLength(str)) {
548 fl_set_object_label(dialog_->text_warning,
549 _("Warning: Invalid Length (valid example: 10mm)"));
550 fl_show_object(dialog_->text_warning);
553 inset_->TabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH,str);
554 local_update(false); // update for alignment
557 if (ob == cell_options_->input_mcolumn_width) {
560 str = fl_get_input(ob);
561 if (!str.empty() && !isValidLength(str)) {
562 fl_set_object_label(dialog_->text_warning,
563 _("Warning: Invalid Length (valid example: 10mm)"));
564 fl_show_object(dialog_->text_warning);
567 inset_->TabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH,str);
568 local_update(false); // update for alignment
571 str = fl_get_input(column_options_->input_column_width);
572 if (!str.empty() && !isValidLength(str)) {
574 dialog_->text_warning,
575 _("Warning: Invalid Length (valid example: 10mm)"));
576 fl_show_object(dialog_->text_warning);
579 if (ob == tabular_options_->button_append_row)
580 num = LyXTabular::APPEND_ROW;
581 else if (ob == tabular_options_->button_append_column)
582 num = LyXTabular::APPEND_COLUMN;
583 else if (ob == tabular_options_->button_delete_row)
584 num = LyXTabular::DELETE_ROW;
585 else if (ob == tabular_options_->button_delete_column)
586 num = LyXTabular::DELETE_COLUMN;
587 else if (ob == tabular_options_->button_set_borders)
588 num = LyXTabular::SET_ALL_LINES;
589 else if (ob == tabular_options_->button_unset_borders)
590 num = LyXTabular::UNSET_ALL_LINES;
591 else if (ob == column_options_->radio_border_top)
592 num = LyXTabular::TOGGLE_LINE_TOP;
593 else if (ob == column_options_->radio_border_bottom)
594 num = LyXTabular::TOGGLE_LINE_BOTTOM;
595 else if (ob == column_options_->radio_border_left)
596 num = LyXTabular::TOGGLE_LINE_LEFT;
597 else if (ob == column_options_->radio_border_right)
598 num = LyXTabular::TOGGLE_LINE_RIGHT;
599 else if (ob == column_options_->radio_align_left)
600 num = LyXTabular::ALIGN_LEFT;
601 else if (ob == column_options_->radio_align_right)
602 num = LyXTabular::ALIGN_RIGHT;
603 else if (ob == column_options_->radio_align_center)
604 num = LyXTabular::ALIGN_CENTER;
605 else if (ob == column_options_->radio_valign_top)
606 num = LyXTabular::VALIGN_TOP;
607 else if (ob == column_options_->radio_valign_bottom)
608 num = LyXTabular::VALIGN_BOTTOM;
609 else if (ob == column_options_->radio_valign_center)
610 num = LyXTabular::VALIGN_CENTER;
611 else if (ob == cell_options_->radio_multicolumn)
612 num = LyXTabular::MULTICOLUMN;
613 else if (ob == tabular_options_->radio_longtable) {
614 s=fl_get_button(tabular_options_->radio_longtable);
616 num = LyXTabular::SET_LONGTABULAR;
617 fl_activate_object(longtable_options_->radio_lt_firsthead);
618 fl_activate_object(longtable_options_->radio_lt_head);
619 fl_activate_object(longtable_options_->radio_lt_foot);
620 fl_activate_object(longtable_options_->radio_lt_lastfoot);
621 fl_activate_object(longtable_options_->radio_lt_newpage);
623 fl_set_button(longtable_options_->radio_lt_firsthead,
624 tabular->GetRowOfLTFirstHead(cell, dummy));
625 fl_set_button(longtable_options_->radio_lt_head,
626 tabular->GetRowOfLTHead(cell, dummy));
627 fl_set_button(longtable_options_->radio_lt_foot,
628 tabular->GetRowOfLTFoot(cell, dummy));
629 fl_set_button(longtable_options_->radio_lt_lastfoot,
630 tabular->GetRowOfLTLastFoot(cell, dummy));
631 fl_set_button(longtable_options_->radio_lt_firsthead,
632 tabular->GetLTNewPage(cell));
634 num = LyXTabular::UNSET_LONGTABULAR;
635 fl_deactivate_object(longtable_options_->radio_lt_firsthead);
636 fl_deactivate_object(longtable_options_->radio_lt_head);
637 fl_deactivate_object(longtable_options_->radio_lt_foot);
638 fl_deactivate_object(longtable_options_->radio_lt_lastfoot);
639 fl_deactivate_object(longtable_options_->radio_lt_newpage);
640 fl_set_button(longtable_options_->radio_lt_firsthead,0);
641 fl_set_button(longtable_options_->radio_lt_head,0);
642 fl_set_button(longtable_options_->radio_lt_foot,0);
643 fl_set_button(longtable_options_->radio_lt_lastfoot,0);
644 fl_set_button(longtable_options_->radio_lt_newpage,0);
645 fl_set_object_lcol(longtable_options_->radio_lt_firsthead,
647 fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE);
648 fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE);
649 fl_set_object_lcol(longtable_options_->radio_lt_lastfoot,
651 fl_set_object_lcol(longtable_options_->radio_lt_newpage,
654 } else if (ob == tabular_options_->radio_rotate_tabular) {
655 s=fl_get_button(tabular_options_->radio_rotate_tabular);
657 num = LyXTabular::SET_ROTATE_TABULAR;
659 num = LyXTabular::UNSET_ROTATE_TABULAR;
660 } else if (ob == cell_options_->radio_rotate_cell) {
661 s=fl_get_button(cell_options_->radio_rotate_cell);
663 num = LyXTabular::SET_ROTATE_CELL;
665 num = LyXTabular::UNSET_ROTATE_CELL;
666 } else if (ob == cell_options_->radio_useminipage) {
667 num = LyXTabular::SET_USEBOX;
669 } else if (ob == longtable_options_->radio_lt_firsthead) {
670 num = LyXTabular::SET_LTFIRSTHEAD;
671 } else if (ob == longtable_options_->radio_lt_head) {
672 num = LyXTabular::SET_LTHEAD;
673 } else if (ob == longtable_options_->radio_lt_foot) {
674 num = LyXTabular::SET_LTFOOT;
675 } else if (ob == longtable_options_->radio_lt_lastfoot) {
676 num = LyXTabular::SET_LTLASTFOOT;
677 } else if (ob == longtable_options_->radio_lt_newpage) {
678 num = LyXTabular::SET_LTNEWPAGE;
679 } else if (ob == column_options_->input_special_alignment) {
680 special = fl_get_input(column_options_->input_special_alignment);
681 num = LyXTabular::SET_SPECIAL_COLUMN;
682 } else if (ob == cell_options_->input_special_multialign) {
683 special = fl_get_input(cell_options_->input_special_multialign);
684 num = LyXTabular::SET_SPECIAL_MULTI;
685 } else if (ob == cell_options_->radio_border_top)
686 num = LyXTabular::M_TOGGLE_LINE_TOP;
687 else if (ob == cell_options_->radio_border_bottom)
688 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
689 else if (ob == cell_options_->radio_border_left)
690 num = LyXTabular::M_TOGGLE_LINE_LEFT;
691 else if (ob == cell_options_->radio_border_right)
692 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
693 else if (ob == cell_options_->radio_align_left)
694 num = LyXTabular::M_ALIGN_LEFT;
695 else if (ob == cell_options_->radio_align_right)
696 num = LyXTabular::M_ALIGN_RIGHT;
697 else if (ob == cell_options_->radio_align_center)
698 num = LyXTabular::M_ALIGN_CENTER;
699 else if (ob == cell_options_->radio_valign_top)
700 num = LyXTabular::M_VALIGN_TOP;
701 else if (ob == cell_options_->radio_valign_bottom)
702 num = LyXTabular::M_VALIGN_BOTTOM;
703 else if (ob == cell_options_->radio_valign_center)
704 num = LyXTabular::M_VALIGN_CENTER;
708 inset_->TabularFeatures(lv_->view(), num, special);
712 // +-----------------------------------------------------------------------+
713 // | Functions/Dialogs for creating tabular insets |
714 // +-----------------------------------------------------------------------+
716 void FormTabular::show_create()
721 if (create_tabular_->form_create_tabular->visible) {
722 fl_raise_form(create_tabular_->form_create_tabular);
724 fl_show_form(create_tabular_->form_create_tabular,
725 FL_PLACE_MOUSE | FL_FREE_SIZE,
726 FL_FULLBORDER, _("Insert Tabular"));
731 void FormTabular::hide_create()
733 if (create_tabular_->form_create_tabular &&
734 create_tabular_->form_create_tabular->visible)
735 fl_hide_form(create_tabular_->form_create_tabular);
739 void FormTabular::apply_create()
744 // comm->setMinibuffer(_("Inserting tabular inset..."));
745 ysize = int(fl_get_slider_value(create_tabular_->slider_columns) + 0.5);
746 xsize = int(fl_get_slider_value(create_tabular_->slider_rows) + 0.5);
747 InsetTabular * in = new InsetTabular(lv_->buffer(),xsize,ysize);
748 if (!lv_->view()->open_new_inset(in)) {
751 // comm->setMinibuffer(_("Tabular mode"));
755 void FormTabular::OKCB(FL_OBJECT * ob, long)
757 FormTabular * pre = (FormTabular*)ob->form->u_vdata;
763 void FormTabular::ApplyCB(FL_OBJECT * ob, long)
765 FormTabular * pre = (FormTabular*)ob->form->u_vdata;
770 void FormTabular::CancelCB(FL_OBJECT * ob, long)
772 FormTabular * pre = (FormTabular*)ob->form->u_vdata;