3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS
14 #include FORMS_H_LOCATION
15 #include XPM_H_LOCATION
18 #pragma implementation
21 #include "FormDocument.h"
22 #include "forms/form_document.h"
24 #include "lyxtextclasslist.h"
26 #include "tex-strings.h"
27 #include "bufferparams.h"
31 #include "frnt_lang.h"
32 #include "frontends/LyXView.h"
35 #include "BufferView.h"
37 #include "CutAndPaste.h"
38 #include "bufferview_funcs.h"
39 #include "xforms_helpers.h"
40 #include "checkedwidgets.h"
42 #include "input_validators.h" // fl_unsigned_float_filter
43 #include "helper_funcs.h"
44 #include "lyx_main.h" // for user_lyxdir
46 #include "insets/insetquotes.h"
48 #include "support/filetools.h"
49 #include "support/lstrings.h"
51 #include FORMS_H_LOCATION
53 #include <boost/bind.hpp>
61 FormDocument::FormDocument(LyXView & lv, Dialogs & d)
62 : FormBaseBD(lv, d, _("Document Layout"), false),
63 ActCell(0), Confirmed(0),
64 current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
68 void FormDocument::redraw()
70 if (form() && form()->visible)
71 fl_redraw_form(form());
75 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
76 if (outer_form && outer_form->visible)
77 fl_redraw_form(outer_form);
81 FL_FORM * FormDocument::form() const
83 if (dialog_.get()) return dialog_->form;
88 void FormDocument::build()
91 dialog_.reset(build_document(this));
93 // Allow the base class to control messages
94 setMessageWidget(dialog_->text_warning);
96 // Manage the restore, ok, apply, restore and cancel/close buttons
97 bc().setOK(dialog_->button_ok);
98 bc().setApply(dialog_->button_apply);
99 bc().setCancel(dialog_->button_close);
100 bc().setRestore(dialog_->button_restore);
102 // the document class form
103 class_.reset(build_document_class(this));
105 // disable for read-only documents
106 bc().addReadOnly(class_->radio_doc_indent);
107 bc().addReadOnly(class_->radio_doc_skip);
108 bc().addReadOnly(class_->choice_doc_pagestyle);
109 bc().addReadOnly(class_->choice_doc_fonts);
110 bc().addReadOnly(class_->choice_doc_fontsize);
111 bc().addReadOnly(class_->radio_doc_sides_one);
112 bc().addReadOnly(class_->radio_doc_sides_two);
113 bc().addReadOnly(class_->radio_doc_columns_one);
114 bc().addReadOnly(class_->radio_doc_columns_two);
115 bc().addReadOnly(class_->input_doc_extra);
116 bc().addReadOnly(class_->input_doc_skip);
117 bc().addReadOnly(class_->choice_doc_skip);
118 bc().addReadOnly(class_->choice_doc_spacing);
119 bc().addReadOnly(class_->input_doc_spacing);
121 // check validity of "length + unit" input
122 addCheckedGlueLength(bc(), class_->input_doc_skip,
123 class_->choice_doc_skip);
125 // trigger an input event for cut&paste with middle mouse button.
126 setPrehandler(class_->input_doc_extra);
127 setPrehandler(class_->input_doc_skip);
128 setPrehandler(class_->input_doc_spacing);
130 fl_set_input_return(class_->input_doc_extra, FL_RETURN_CHANGED);
131 fl_set_input_return(class_->input_doc_skip, FL_RETURN_CHANGED);
132 fl_set_input_return(class_->input_doc_spacing, FL_RETURN_CHANGED);
136 // the class list is a combo-box and has to be inserted manually
137 obj = class_->choice_doc_class;
138 fl_deactivate_object(obj);
139 fl_addto_form(class_->form);
140 combo_doc_class.reset(new Combox(FL_COMBOX_DROPLIST));
141 combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400);
142 combo_doc_class->shortcut("#C",1);
143 combo_doc_class->setcallback(ComboInputCB, this);
145 for (LyXTextClassList::const_iterator cit = textclasslist.begin();
146 cit != textclasslist.end(); ++cit) {
147 combo_doc_class->addto(cit->description());
150 fl_addto_choice(class_->choice_doc_spacing,
151 _(" Single | OneHalf | Double | Custom "));
152 fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12");
153 for (int n = 0; tex_fonts[n][0]; ++n) {
154 fl_addto_choice(class_->choice_doc_fonts,tex_fonts[n]);
157 // Create the contents of the unit choices; don't include the
159 vector<string> units_vec = getLatexUnits();
160 vector<string>::iterator ret =
161 std::remove_if(units_vec.begin(),
163 bind2nd(contains_functor(), "%"));
164 units_vec.erase(ret, units_vec.end());
166 string const units = getStringFromVector(units_vec, "|");
168 fl_addto_choice(class_->choice_doc_pagestyle,
169 "default|empty|plain|headings|fancy");
170 fl_addto_choice(class_->choice_doc_skip,
171 _(" Smallskip | Medskip | Bigskip | Length "));
172 fl_addto_choice(class_->choice_doc_skip_units, units.c_str());
174 // Set input filters on doc spacing to make it accept only
176 fl_set_input_filter(class_->input_doc_spacing,
177 fl_unsigned_float_filter);
179 // disable for read-only documents
180 bc().addReadOnly(dialog_->button_save_defaults);
181 bc().addReadOnly(dialog_->button_reset_defaults);
183 // the document paper form
184 paper_.reset(build_document_paper(this));
186 // disable for read-only documents
187 bc().addReadOnly(paper_->choice_paperpackage);
188 bc().addReadOnly(paper_->radio_portrait);
189 bc().addReadOnly(paper_->radio_landscape);
190 bc().addReadOnly(paper_->choice_papersize);
191 bc().addReadOnly(paper_->check_use_geometry);
192 bc().addReadOnly(paper_->input_custom_width);
193 bc().addReadOnly(paper_->input_custom_height);
194 bc().addReadOnly(paper_->input_top_margin);
195 bc().addReadOnly(paper_->input_bottom_margin);
196 bc().addReadOnly(paper_->input_inner_margin);
197 bc().addReadOnly(paper_->input_outer_margin);
198 bc().addReadOnly(paper_->input_head_height);
199 bc().addReadOnly(paper_->input_head_sep);
200 bc().addReadOnly(paper_->input_foot_skip);
202 // check validity of "length + unit" input
203 addCheckedGlueLength(bc(), paper_->input_custom_width);
204 addCheckedGlueLength(bc(), paper_->input_custom_height);
205 addCheckedGlueLength(bc(), paper_->input_top_margin);
206 addCheckedGlueLength(bc(), paper_->input_bottom_margin);
207 addCheckedGlueLength(bc(), paper_->input_inner_margin);
208 addCheckedGlueLength(bc(), paper_->input_outer_margin);
209 addCheckedGlueLength(bc(), paper_->input_head_height);
210 addCheckedGlueLength(bc(), paper_->input_head_sep);
211 addCheckedGlueLength(bc(), paper_->input_foot_skip);
213 // trigger an input event for cut&paste with middle mouse button.
214 setPrehandler(paper_->input_custom_width);
215 setPrehandler(paper_->input_custom_height);
216 setPrehandler(paper_->input_top_margin);
217 setPrehandler(paper_->input_bottom_margin);
218 setPrehandler(paper_->input_inner_margin);
219 setPrehandler(paper_->input_outer_margin);
220 setPrehandler(paper_->input_head_height);
221 setPrehandler(paper_->input_head_sep);
222 setPrehandler(paper_->input_foot_skip);
224 fl_set_input_return(paper_->input_custom_width, FL_RETURN_CHANGED);
225 fl_set_input_return(paper_->input_custom_height, FL_RETURN_CHANGED);
226 fl_set_input_return(paper_->input_top_margin, FL_RETURN_CHANGED);
227 fl_set_input_return(paper_->input_bottom_margin, FL_RETURN_CHANGED);
228 fl_set_input_return(paper_->input_inner_margin, FL_RETURN_CHANGED);
229 fl_set_input_return(paper_->input_outer_margin, FL_RETURN_CHANGED);
230 fl_set_input_return(paper_->input_head_height, FL_RETURN_CHANGED);
231 fl_set_input_return(paper_->input_head_sep, FL_RETURN_CHANGED);
232 fl_set_input_return(paper_->input_foot_skip, FL_RETURN_CHANGED);
234 fl_addto_choice(paper_->choice_papersize,
235 _(" Default | Custom | US letter | US legal "
236 "| US executive | A3 | A4 | A5 | B3 | B4 | B5 "));
237 fl_addto_choice(paper_->choice_paperpackage,
240 "| Very small Margins "
241 "| Very wide Margins "));
243 fl_addto_choice(paper_->choice_custom_width_units, units.c_str());
244 fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
245 fl_addto_choice(paper_->choice_top_margin_units, units.c_str());
246 fl_addto_choice(paper_->choice_bottom_margin_units, units.c_str());
247 fl_addto_choice(paper_->choice_inner_margin_units, units.c_str());
248 fl_addto_choice(paper_->choice_outer_margin_units, units.c_str());
249 fl_addto_choice(paper_->choice_head_height_units, units.c_str());
250 fl_addto_choice(paper_->choice_head_sep_units, units.c_str());
251 fl_addto_choice(paper_->choice_foot_skip_units, units.c_str());
253 // the document language form
254 language_.reset(build_document_language(this));
256 // disable for read-only documents
257 bc().addReadOnly(language_->choice_inputenc);
258 bc().addReadOnly(language_->choice_quotes_language);
259 bc().addReadOnly(language_->radio_single);
260 bc().addReadOnly(language_->radio_double);
262 fl_addto_choice(language_->choice_inputenc,
263 "default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
264 "|koi8-r|koi8-u|cp866|cp1251|iso88595|pt154");
266 vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
267 // Store the identifiers for later
268 lang_ = getSecond(langs);
270 // The language is a combo-box and has to be inserted manually
271 obj = language_->choice_language;
272 fl_deactivate_object(obj);
273 fl_addto_form(language_->form);
274 combo_language.reset(new Combox(FL_COMBOX_DROPLIST));
275 combo_language->add(obj->x, obj->y, obj->w, obj->h, 400);
276 combo_language->shortcut("#L",1);
277 combo_language->setcallback(ComboInputCB, this);
280 vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
281 vector<frnt::LanguagePair>::const_iterator lend = langs.end();
282 for (; lit != lend; ++lit) {
283 combo_language->addto(lit->first);
285 combo_language->select(1);
287 fl_addto_choice(language_->choice_quotes_language,
288 _(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
289 " «text» | »text« "));
291 // the document options form
292 options_.reset(build_document_options(this));
294 // disable for read-only documents
295 bc_.addReadOnly(options_->counter_secnumdepth);
296 bc_.addReadOnly(options_->counter_tocdepth);
297 bc_.addReadOnly(options_->check_use_amsmath);
298 bc_.addReadOnly(options_->check_use_natbib);
299 bc_.addReadOnly(options_->choice_citation_format);
300 bc_.addReadOnly(options_->input_float_placement);
301 bc_.addReadOnly(options_->choice_postscript_driver);
303 // trigger an input event for cut&paste with middle mouse button.
304 setPrehandler(options_->input_float_placement);
306 fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
308 for (int n = 0; tex_graphics[n][0]; ++n) {
309 fl_addto_choice(options_->choice_postscript_driver,
312 fl_addto_choice(options_->choice_citation_format,
313 _(" Author-year | Numerical "));
315 // the document bullets form
316 bullets_.reset(build_document_bullet(this));
318 // disable for read-only documents
319 bc_.addReadOnly(bullets_->radio_bullet_depth_1);
320 bc_.addReadOnly(bullets_->radio_bullet_depth_2);
321 bc_.addReadOnly(bullets_->radio_bullet_depth_3);
322 bc_.addReadOnly(bullets_->radio_bullet_depth_4);
323 bc_.addReadOnly(bullets_->radio_bullet_panel_standard);
324 bc_.addReadOnly(bullets_->radio_bullet_panel_maths);
325 bc_.addReadOnly(bullets_->radio_bullet_panel_ding1);
326 bc_.addReadOnly(bullets_->radio_bullet_panel_ding2);
327 bc_.addReadOnly(bullets_->radio_bullet_panel_ding3);
328 bc_.addReadOnly(bullets_->radio_bullet_panel_ding4);
329 bc().addReadOnly(bullets_->bmtable_bullet_panel);
330 bc().addReadOnly(bullets_->choice_bullet_size);
331 bc().addReadOnly(bullets_->input_bullet_latex);
333 // trigger an input event for cut&paste with middle mouse button.
334 setPrehandler(bullets_->input_bullet_latex);
336 fl_set_input_return(bullets_->input_bullet_latex, FL_RETURN_CHANGED);
338 fl_addto_choice(bullets_->choice_bullet_size,
339 _(" default | tiny | script | footnote | small |"
340 " normal | large | Large | LARGE | huge | Huge"));
341 fl_set_choice(bullets_->choice_bullet_size, 1);
343 fl_set_input_maxchars(bullets_->input_bullet_latex, 80);
345 string const bmtablefile = LibFileSearch("images", "standard", "xpm");
346 fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6,
347 bmtablefile.c_str());
349 fl_addto_tabfolder(dialog_->tabfolder,_("Document"),
351 fl_addto_tabfolder(dialog_->tabfolder,_("Paper"),
353 fl_addto_tabfolder(dialog_->tabfolder,_("Language"),
355 fl_addto_tabfolder(dialog_->tabfolder,_("Extra"),
357 fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
360 // work-around xforms bug re update of folder->x, folder->y coords.
361 setPrehandler(dialog_->tabfolder);
363 if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) {
364 lyxerr << _("Your version of libXpm is older than 4.7.\n"
365 "The `bullet' tab of the document dialog "
366 "has been disabled") << '\n';
367 fl_deactivate_object(fbullet);
368 fl_set_object_lcol(fbullet, FL_INACTIVE);
373 void FormDocument::apply()
375 if (!lv_.view()->available() || !dialog_.get())
378 bool redo = class_apply();
380 redo = language_apply() || redo;
381 redo = options_apply() || redo;
385 lv_.view()->redoCurrentBuffer();
387 lv_.buffer()->markDirty();
388 lv_.message(_("Document layout set"));
392 void FormDocument::cancel()
394 // this avoids confusion when reopening
395 BufferParams & param = lv_.buffer()->params;
396 param.temp_bullets[0] = param.user_defined_bullets[0];
397 param.temp_bullets[1] = param.user_defined_bullets[1];
398 param.temp_bullets[2] = param.user_defined_bullets[2];
399 param.temp_bullets[3] = param.user_defined_bullets[3];
404 void FormDocument::update()
411 BufferParams const & params = lv_.buffer()->params;
413 class_update(params);
414 paper_update(params);
415 language_update(params);
416 options_update(params);
417 bullets_update(params);
422 // should this go elsewhere? Maybe a ControllerDocument? (JMarc)
423 /** Save the buffer's parameters as user default.
424 This function saves a file \c user_lyxdir/templates/defaults.lyx
425 which parameters are those of the current buffer. This file
426 is used as a default template when creating a new
427 file. Returns \c true on success.
429 bool saveParamsAsDefault(BufferParams const ¶ms)
431 if (!Alert::askQuestion(_("Do you want to save the current settings"),
432 _("for the document layout as default?"),
433 _("(they will be valid for any new document)")))
436 string const fname = AddName(AddPath(user_lyxdir, "templates/"),
438 Buffer defaults(fname);
439 defaults.params = params;
441 // add an empty paragraph. Is this enough?
442 Paragraph * par = new Paragraph;
443 par->layout(params.getLyXTextClass().defaultLayout());
444 defaults.paragraphs.set(par);
446 return defaults.writeFile(defaults.fileName());
452 bool FormDocument::input(FL_OBJECT * ob, long)
454 if (ob == class_->choice_doc_class) {
455 CheckChoiceClass(ob, 0);
457 } else if (ob == bullets_->choice_bullet_size) {
458 ChoiceBulletSize(ob, 0);
460 } else if (ob == bullets_->input_bullet_latex) {
461 InputBulletLaTeX(ob, 0);
463 } else if (ob == bullets_->radio_bullet_depth_1 ||
464 ob == bullets_->radio_bullet_depth_2 ||
465 ob == bullets_->radio_bullet_depth_3 ||
466 ob == bullets_->radio_bullet_depth_4) {
469 } else if (ob == bullets_->radio_bullet_panel_standard ||
470 ob == bullets_->radio_bullet_panel_maths ||
471 ob == bullets_->radio_bullet_panel_ding1 ||
472 ob == bullets_->radio_bullet_panel_ding2 ||
473 ob == bullets_->radio_bullet_panel_ding3 ||
474 ob == bullets_->radio_bullet_panel_ding4) {
477 } else if (ob == bullets_->bmtable_bullet_panel) {
478 BulletBMTable(ob, 0);
480 } else if (ob == class_->choice_doc_spacing) {
481 setEnabled(class_->input_doc_spacing,
482 fl_get_choice(class_->choice_doc_spacing) == 4);
484 } else if (ob == class_->radio_doc_skip ||
485 ob == class_->radio_doc_indent ||
486 ob == class_->choice_doc_skip) {
487 bool const skip_used = fl_get_button(class_->radio_doc_skip);
488 setEnabled(class_->choice_doc_skip, skip_used);
490 bool const length_input =
491 fl_get_choice(class_->choice_doc_skip) == 4;
492 setEnabled(class_->input_doc_skip,
493 skip_used && length_input);
494 setEnabled(class_->choice_doc_skip_units,
495 skip_used && length_input);
497 // Default unit choice is cm if metric, inches if US paper.
498 // If papersize is default, check the lyxrc-settings
499 int const paperchoice = fl_get_choice(paper_->choice_papersize);
500 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
501 || paperchoice == 2 || paperchoice > 5;
502 string const default_unit = metric ? "cm" : "in";
503 if (getString(class_->input_doc_skip).empty())
504 fl_set_choice_text(class_->choice_doc_skip_units,
505 default_unit.c_str());
507 } else if (ob == options_->check_use_natbib) {
508 setEnabled(options_->choice_citation_format,
509 fl_get_button(options_->check_use_natbib));
511 } else if (ob == dialog_->button_save_defaults) {
515 language_apply(params);
516 options_apply(params);
517 bullets_apply(params);
518 params.preamble = lv_.buffer()->params.preamble;
519 saveParamsAsDefault(params);
521 } else if (ob == dialog_->button_reset_defaults) {
522 BufferParams params = lv_.buffer()->params;
523 params.textclass = combo_doc_class->get() - 1;
524 params.useClassDefaults();
525 UpdateLayoutDocument(params);
527 } else if (ob == paper_->radio_landscape) {
528 fl_set_choice(paper_->choice_paperpackage,
529 BufferParams::PACKAGE_NONE + 1);
531 } else if (ob == paper_->choice_papersize) {
532 int const paperchoice = fl_get_choice(paper_->choice_papersize);
533 bool const defsize = paperchoice == 1;
534 bool const custom = paperchoice == 2;
535 bool const a3size = paperchoice == 6;
536 bool const b3size = paperchoice == 9;
537 bool const b4size = paperchoice == 10;
540 fl_set_button(paper_->radio_portrait, 1);
542 bool const use_geom = (custom || a3size || b3size || b4size);
544 fl_set_button(paper_->check_use_geometry, int(use_geom));
546 setEnabled(paper_->input_top_margin, use_geom);
547 setEnabled(paper_->input_bottom_margin, use_geom);
548 setEnabled(paper_->input_inner_margin, use_geom);
549 setEnabled(paper_->input_outer_margin, use_geom);
550 setEnabled(paper_->input_head_height, use_geom);
551 setEnabled(paper_->input_head_sep, use_geom);
552 setEnabled(paper_->input_foot_skip, use_geom);
553 setEnabled(paper_->choice_top_margin_units, use_geom);
554 setEnabled(paper_->choice_bottom_margin_units, use_geom);
555 setEnabled(paper_->choice_inner_margin_units, use_geom);
556 setEnabled(paper_->choice_outer_margin_units, use_geom);
557 setEnabled(paper_->choice_head_height_units, use_geom);
558 setEnabled(paper_->choice_head_sep_units, use_geom);
559 setEnabled(paper_->choice_foot_skip_units, use_geom);
560 setEnabled(paper_->choice_custom_width_units, use_geom);
561 setEnabled(paper_->choice_custom_height_units, use_geom);
563 setEnabled(paper_->input_custom_width, custom);
564 setEnabled(paper_->input_custom_height, custom);
565 setEnabled(paper_->choice_custom_width_units, custom);
566 setEnabled(paper_->choice_custom_height_units, custom);
567 setEnabled(paper_->radio_portrait, !custom);
568 setEnabled(paper_->radio_landscape, !custom);
570 // Default unit choice is cm if metric, inches if US paper.
571 // If papersize is default, use the lyxrc-settings
572 bool const metric = (defsize && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
573 || paperchoice == 2 || paperchoice > 5;
574 string const default_unit = metric ? "cm" : "in";
575 if (getString(paper_->input_custom_width).empty())
576 fl_set_choice_text(paper_->choice_custom_width_units,
577 default_unit.c_str());
578 if (getString(paper_->input_custom_height).empty())
579 fl_set_choice_text(paper_->choice_custom_height_units,
580 default_unit.c_str());
581 if (getString(paper_->input_top_margin).empty())
582 fl_set_choice_text(paper_->choice_top_margin_units,
583 default_unit.c_str());
584 if (getString(paper_->input_bottom_margin).empty())
585 fl_set_choice_text(paper_->choice_bottom_margin_units,
586 default_unit.c_str());
587 if (getString(paper_->input_inner_margin).empty())
588 fl_set_choice_text(paper_->choice_inner_margin_units,
589 default_unit.c_str());
590 if (getString(paper_->input_outer_margin).empty())
591 fl_set_choice_text(paper_->choice_outer_margin_units,
592 default_unit.c_str());
593 if (getString(paper_->input_head_height).empty())
594 fl_set_choice_text(paper_->choice_head_height_units,
595 default_unit.c_str());
596 if (getString(paper_->input_head_sep).empty())
597 fl_set_choice_text(paper_->choice_head_sep_units,
598 default_unit.c_str());
599 if (getString(paper_->input_foot_skip).empty())
600 fl_set_choice_text(paper_->choice_foot_skip_units,
601 default_unit.c_str());
603 } else if (ob == paper_->choice_paperpackage &&
604 fl_get_choice(paper_->choice_paperpackage) != 1) {
606 fl_set_button(paper_->check_use_geometry, 0);
607 setEnabled(paper_->input_top_margin, false);
608 setEnabled(paper_->input_bottom_margin, false);
609 setEnabled(paper_->input_inner_margin, false);
610 setEnabled(paper_->input_outer_margin, false);
611 setEnabled(paper_->input_head_height, false);
612 setEnabled(paper_->input_head_sep, false);
613 setEnabled(paper_->input_foot_skip, false);
614 setEnabled(paper_->choice_top_margin_units, false);
615 setEnabled(paper_->choice_bottom_margin_units, false);
616 setEnabled(paper_->choice_inner_margin_units, false);
617 setEnabled(paper_->choice_outer_margin_units, false);
618 setEnabled(paper_->choice_head_height_units, false);
619 setEnabled(paper_->choice_head_sep_units, false);
620 setEnabled(paper_->choice_foot_skip_units, false);
622 } else if (ob == paper_->check_use_geometry) {
623 // don't allow switching geometry off in custom papersize
624 // mode nor in A3, B3, and B4
625 int const choice = fl_get_choice(paper_->choice_papersize);
626 if (choice == 2 || choice == 6 || choice == 9 || choice == 10)
627 fl_set_button(paper_->check_use_geometry, 1);
629 fl_set_choice(paper_->choice_paperpackage,
630 BufferParams::PACKAGE_NONE + 1);
632 bool const use_geom = fl_get_button(paper_->check_use_geometry);
633 setEnabled(paper_->input_top_margin, use_geom);
634 setEnabled(paper_->input_bottom_margin, use_geom);
635 setEnabled(paper_->input_inner_margin, use_geom);
636 setEnabled(paper_->input_outer_margin, use_geom);
637 setEnabled(paper_->input_head_height, use_geom);
638 setEnabled(paper_->input_head_sep, use_geom);
639 setEnabled(paper_->input_foot_skip, use_geom);
640 setEnabled(paper_->choice_top_margin_units, use_geom);
641 setEnabled(paper_->choice_bottom_margin_units, use_geom);
642 setEnabled(paper_->choice_inner_margin_units, use_geom);
643 setEnabled(paper_->choice_outer_margin_units, use_geom);
644 setEnabled(paper_->choice_head_height_units, use_geom);
645 setEnabled(paper_->choice_head_sep_units, use_geom);
646 setEnabled(paper_->choice_foot_skip_units, use_geom);
649 if (ob == paper_->choice_papersize || ob == paper_->radio_portrait
650 || ob == paper_->radio_landscape) {
651 // either default papersize (preferences) or document
652 // papersize has to be A4
653 bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1
654 && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER )
655 || fl_get_choice(paper_->choice_papersize) == 7;
656 setEnabled(paper_->choice_paperpackage, enable && fl_get_button(paper_->radio_portrait));
663 void FormDocument::ComboInputCB(int, void * v, Combox * combox)
665 FormDocument * pre = static_cast<FormDocument*>(v);
666 if (combox == pre->combo_doc_class.get())
667 pre->CheckChoiceClass(0, 0);
672 bool FormDocument::class_apply(BufferParams ¶ms)
676 // If default skip is a "Length" but there's no text in the
677 // input field, reset the kind to "Medskip", which is the default.
678 if (fl_get_choice(class_->choice_doc_skip) == 4 &&
679 getString(class_->input_doc_skip).empty()) {
680 fl_set_choice(class_->choice_doc_skip, 2);
682 params.fonts = getString(class_->choice_doc_fonts);
683 params.fontsize = getString(class_->choice_doc_fontsize);
684 params.pagestyle = getString(class_->choice_doc_pagestyle);
686 params.textclass = combo_doc_class->get() - 1;
688 BufferParams::PARSEP tmpsep = params.paragraph_separation;
689 if (fl_get_button(class_->radio_doc_indent))
690 params.paragraph_separation = BufferParams::PARSEP_INDENT;
692 params.paragraph_separation = BufferParams::PARSEP_SKIP;
693 if (tmpsep != params.paragraph_separation)
696 VSpace tmpdefskip = params.getDefSkip();
697 switch (fl_get_choice(class_->choice_doc_skip)) {
699 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
702 params.setDefSkip(VSpace(VSpace::MEDSKIP));
705 params.setDefSkip(VSpace(VSpace::BIGSKIP));
709 string const length =
710 getLengthFromWidgets(class_->input_doc_skip,
711 class_->choice_doc_skip_units);
713 params.setDefSkip(VSpace(LyXGlueLength(length)));
717 // DocumentDefskipCB assures that this never happens
718 params.setDefSkip(VSpace(VSpace::MEDSKIP));
721 if (!(tmpdefskip == params.getDefSkip()))
724 if (fl_get_button(class_->radio_doc_columns_two))
728 if (fl_get_button(class_->radio_doc_sides_two))
729 params.sides = LyXTextClass::TwoSides;
731 params.sides = LyXTextClass::OneSide;
733 Spacing tmpSpacing = params.spacing;
734 switch (fl_get_choice(class_->choice_doc_spacing)) {
736 lyxerr[Debug::INFO] << "Spacing: SINGLE\n";
737 params.spacing.set(Spacing::Single);
740 lyxerr[Debug::INFO] << "Spacing: ONEHALF\n";
741 params.spacing.set(Spacing::Onehalf);
744 lyxerr[Debug::INFO] << "Spacing: DOUBLE\n";
745 params.spacing.set(Spacing::Double);
748 lyxerr[Debug::INFO] << "Spacing: OTHER\n";
749 params.spacing.set(Spacing::Other,
750 getString(class_->input_doc_spacing));
753 if (tmpSpacing != params.spacing)
756 params.options = getString(class_->input_doc_extra);
762 bool FormDocument::class_apply()
764 BufferParams ¶ms = lv_.buffer()->params;
766 unsigned int const old_class = params.textclass;
768 bool redo = class_apply(params);
770 if (params.textclass != old_class) {
771 // try to load new_class
772 if (textclasslist[params.textclass].load()) {
773 // successfully loaded
775 lv_.message(_("Converting document to new document class..."));
776 int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
777 old_class, params.textclass,
778 &*(lv_.buffer()->paragraphs.begin()),
779 lv_.buffer()->params);
783 s = _("One paragraph couldn't be converted");
786 s += _(" paragraphs couldn't be converted");
788 Alert::alert(_("Conversion Errors!"),s,
789 _("into chosen document class"));
793 // problem changing class -- warn user and retain old style
794 Alert::alert(_("Conversion Errors!"),
795 _("Errors loading new document class."),
796 _("Reverting to original document class."));
797 combo_doc_class->select(int(old_class) + 1);
805 void FormDocument::paper_apply(BufferParams & params)
807 params.papersize2 = char(fl_get_choice(paper_->choice_papersize) - 1);
809 params.paperpackage =
810 char(fl_get_choice(paper_->choice_paperpackage) - 1);
812 // set params.papersize from params.papersize2 and params.paperpackage
813 params.setPaperStuff();
815 params.use_geometry = fl_get_button(paper_->check_use_geometry);
817 if (fl_get_button(paper_->radio_landscape))
818 params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
820 params.orientation = BufferParams::ORIENTATION_PORTRAIT;
823 getLengthFromWidgets(paper_->input_custom_width,
824 paper_->choice_custom_width_units);
827 getLengthFromWidgets(paper_->input_custom_height,
828 paper_->choice_custom_height_units);
831 getLengthFromWidgets(paper_->input_inner_margin,
832 paper_->choice_inner_margin_units);
835 getLengthFromWidgets(paper_->input_top_margin,
836 paper_->choice_top_margin_units);
839 getLengthFromWidgets(paper_->input_outer_margin,
840 paper_->choice_outer_margin_units);
842 params.bottommargin =
843 getLengthFromWidgets(paper_->input_bottom_margin,
844 paper_->choice_bottom_margin_units);
847 getLengthFromWidgets(paper_->input_head_height,
848 paper_->choice_head_height_units);
851 getLengthFromWidgets(paper_->input_head_sep,
852 paper_->choice_head_sep_units);
855 getLengthFromWidgets(paper_->input_foot_skip,
856 paper_->choice_foot_skip_units);
860 void FormDocument::paper_apply()
862 paper_apply(lv_.buffer()->params);
866 bool FormDocument::language_apply(BufferParams & params)
868 InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
871 switch (fl_get_choice(language_->choice_quotes_language) - 1) {
873 lga = InsetQuotes::EnglishQ;
876 lga = InsetQuotes::SwedishQ;
879 lga = InsetQuotes::GermanQ;
882 lga = InsetQuotes::PolishQ;
885 lga = InsetQuotes::FrenchQ;
888 lga = InsetQuotes::DanishQ;
891 params.quotes_language = lga;
892 if (fl_get_button(language_->radio_single))
893 params.quotes_times = InsetQuotes::SingleQ;
895 params.quotes_times = InsetQuotes::DoubleQ;
897 int const pos = combo_language->get();
898 Language const * old_language = params.language;
899 Language const * new_language = languages.getLanguage(lang_[pos-1]);
901 new_language = default_language;
903 if (old_language != new_language
904 && old_language->RightToLeft() == new_language->RightToLeft()
905 && !lv_.buffer()->isMultiLingual())
906 lv_.buffer()->changeLanguage(old_language, new_language);
908 if (old_language != new_language) {
912 params.language = new_language;
913 params.inputenc = getString(language_->choice_inputenc);
919 bool FormDocument::language_apply()
921 return language_apply(lv_.buffer()->params);
925 bool FormDocument::options_apply(BufferParams & params)
929 params.graphicsDriver = getString(options_->choice_postscript_driver);
930 params.use_amsmath = fl_get_button(options_->check_use_amsmath);
931 params.use_natbib = fl_get_button(options_->check_use_natbib);
932 params.use_numerical_citations =
933 fl_get_choice(options_->choice_citation_format) - 1;
935 int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
936 if (params.secnumdepth != tmpchar)
938 params.secnumdepth = tmpchar;
940 params.tocdepth = int(fl_get_counter_value(options_->counter_tocdepth));
942 params.float_placement =
943 getString(options_->input_float_placement);
949 bool FormDocument::options_apply()
951 return options_apply(lv_.buffer()->params);
955 void FormDocument::bullets_apply(BufferParams & params)
957 /* update the bullet settings */
958 BufferParams & buf_params = lv_.buffer()->params;
960 // a little bit of loop unrolling
961 params.user_defined_bullets[0] = buf_params.temp_bullets[0];
962 params.user_defined_bullets[1] = buf_params.temp_bullets[1];
963 params.user_defined_bullets[2] = buf_params.temp_bullets[2];
964 params.user_defined_bullets[3] = buf_params.temp_bullets[3];
968 void FormDocument::bullets_apply()
970 bullets_apply(lv_.buffer()->params);
973 void FormDocument::UpdateClassParams(BufferParams const & params)
975 // These are the params that have to be updated on any class change
976 // (even if the class defaults are not used) (JSpitzm 2002-04-08)
978 LyXTextClass const & tclass = textclasslist[params.textclass];
980 combo_doc_class->select(tclass.description());
981 fl_clear_choice(class_->choice_doc_fontsize);
982 fl_addto_choice(class_->choice_doc_fontsize, "default");
983 fl_addto_choice(class_->choice_doc_fontsize,
984 tclass.opt_fontsize().c_str());
985 fl_set_choice_text(class_->choice_doc_fontsize,
986 params.fontsize.c_str());
987 fl_clear_choice(class_->choice_doc_pagestyle);
988 fl_addto_choice(class_->choice_doc_pagestyle, "default");
989 fl_addto_choice(class_->choice_doc_pagestyle,
990 tclass.opt_pagestyle().c_str());
991 fl_set_choice_text(class_->choice_doc_pagestyle,
992 params.pagestyle.c_str());
996 void FormDocument::class_update(BufferParams const & params)
1001 UpdateClassParams(params);
1003 fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str());
1005 bool const indent = params.paragraph_separation == BufferParams::PARSEP_INDENT;
1006 fl_set_button(class_->radio_doc_indent, indent);
1007 fl_set_button(class_->radio_doc_skip, !indent);
1011 pos = 2; // VSpace::MEDSKIP is default
1013 switch (params.getDefSkip().kind()) {
1014 case VSpace::LENGTH:
1017 case VSpace::BIGSKIP:
1020 case VSpace::SMALLSKIP:
1023 case VSpace::MEDSKIP:
1029 fl_set_choice (class_->choice_doc_skip, pos);
1031 bool const length_input = pos == 4;
1033 int const paperchoice = fl_get_choice(paper_->choice_papersize);
1034 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
1035 || paperchoice == 2 || paperchoice > 5;
1036 string const default_unit = metric ? "cm" : "in";
1037 string const length = params.getDefSkip().asLyXCommand();
1038 updateWidgetsFromLengthString(class_->input_doc_skip,
1039 class_->choice_doc_skip_units,
1040 length, default_unit);
1043 fl_set_input(class_->input_doc_skip, "");
1045 setEnabled(class_->choice_doc_skip, !indent);
1046 setEnabled(class_->input_doc_skip, length_input);
1047 setEnabled(class_->choice_doc_skip_units, length_input);
1049 bool const two_sides = params.sides == LyXTextClass::TwoSides;
1050 fl_set_button(class_->radio_doc_sides_one, !two_sides);
1051 fl_set_button(class_->radio_doc_sides_two, two_sides);
1053 bool const two_columns = params.columns == 2;
1054 fl_set_button(class_->radio_doc_columns_one, !two_columns);
1055 fl_set_button(class_->radio_doc_columns_two, two_columns);
1057 fl_set_input(class_->input_doc_extra, params.options.c_str());
1059 switch (params.spacing.getSpace()) {
1060 case Spacing::Other:
1063 case Spacing::Double: // \doublespacing
1066 case Spacing::Onehalf: // \onehalfspacing
1069 case Spacing::Single: // \singlespacing
1070 case Spacing::Default: // nothing bad should happen with this
1075 fl_set_choice(class_->choice_doc_spacing, pos);
1077 bool const spacing_input = pos == 4;
1078 setEnabled(class_->input_doc_spacing, spacing_input);
1079 string const input = spacing_input ? tostr(params.spacing.getValue()) : string();
1080 fl_set_input(class_->input_doc_spacing, input.c_str());
1084 void FormDocument::language_update(BufferParams const & params)
1086 if (!language_.get())
1089 int const pos = int(findPos(lang_, params.language->lang()));
1090 combo_language->select(pos+1);
1092 fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str());
1093 fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1);
1094 fl_set_button(language_->radio_single, 0);
1095 fl_set_button(language_->radio_double, 0);
1096 if (params.quotes_times == InsetQuotes::SingleQ)
1097 fl_set_button(language_->radio_single, 1);
1099 fl_set_button(language_->radio_double, 1);
1103 void FormDocument::options_update(BufferParams const & params)
1105 if (!options_.get())
1108 fl_set_choice_text(options_->choice_postscript_driver,
1109 params.graphicsDriver.c_str());
1110 fl_set_button(options_->check_use_amsmath, params.use_amsmath);
1111 fl_set_button(options_->check_use_natbib, params.use_natbib);
1112 fl_set_choice(options_->choice_citation_format,
1113 int(params.use_numerical_citations)+1);
1114 setEnabled(options_->choice_citation_format, params.use_natbib);
1115 fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
1116 fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
1117 if (!params.float_placement.empty())
1118 fl_set_input(options_->input_float_placement,
1119 params.float_placement.c_str());
1121 fl_set_input(options_->input_float_placement, "");
1125 void FormDocument::paper_update(BufferParams const & params)
1130 fl_set_choice(paper_->choice_papersize, params.papersize2 + 1);
1131 fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1);
1132 fl_set_button(paper_->check_use_geometry, params.use_geometry);
1134 int const paperchoice = fl_get_choice(paper_->choice_papersize);
1135 bool const useCustom = paperchoice == 2;
1136 bool const useGeom = fl_get_button(paper_->check_use_geometry);
1138 fl_set_button(paper_->radio_portrait, 0);
1139 setEnabled(paper_->radio_portrait, !useCustom);
1140 fl_set_button(paper_->radio_landscape, 0);
1141 setEnabled(paper_->radio_landscape, !useCustom);
1143 if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
1144 fl_set_button(paper_->radio_landscape, 1);
1146 fl_set_button(paper_->radio_portrait, 1);
1147 setEnabled(paper_->choice_paperpackage,
1148 //either default papersize (preferences)
1149 //or document papersize has to be A4
1151 || paperchoice == 1 && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER)
1152 && fl_get_button(paper_->radio_portrait));
1154 // Default unit choice is cm if metric, inches if US paper.
1155 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER)
1156 || paperchoice == 2 || paperchoice > 5;
1157 string const default_unit = metric ? "cm" : "in";
1158 updateWidgetsFromLengthString(paper_->input_custom_width,
1159 paper_->choice_custom_width_units,
1160 params.paperwidth, default_unit);
1161 setEnabled(paper_->input_custom_width, useCustom);
1162 setEnabled(paper_->choice_custom_width_units, useCustom);
1164 updateWidgetsFromLengthString(paper_->input_custom_height,
1165 paper_->choice_custom_height_units,
1166 params.paperheight, default_unit);
1167 setEnabled(paper_->input_custom_height, useCustom);
1168 setEnabled(paper_->choice_custom_height_units, useCustom);
1170 updateWidgetsFromLengthString(paper_->input_inner_margin,
1171 paper_->choice_inner_margin_units,
1172 params.leftmargin, default_unit);
1173 setEnabled(paper_->input_inner_margin, useGeom);
1174 setEnabled(paper_->choice_inner_margin_units, useGeom);
1176 updateWidgetsFromLengthString(paper_->input_top_margin,
1177 paper_->choice_top_margin_units,
1178 params.topmargin, default_unit);
1179 setEnabled(paper_->input_top_margin, useGeom);
1180 setEnabled(paper_->choice_top_margin_units, useGeom);
1182 updateWidgetsFromLengthString(paper_->input_outer_margin,
1183 paper_->choice_outer_margin_units,
1184 params.rightmargin, default_unit);
1185 setEnabled(paper_->input_outer_margin, useGeom);
1186 setEnabled(paper_->choice_outer_margin_units, useGeom);
1188 updateWidgetsFromLengthString(paper_->input_bottom_margin,
1189 paper_->choice_bottom_margin_units,
1190 params.bottommargin, default_unit);
1191 setEnabled(paper_->input_bottom_margin, useGeom);
1192 setEnabled(paper_->choice_bottom_margin_units, useGeom);
1194 updateWidgetsFromLengthString(paper_->input_head_height,
1195 paper_->choice_head_height_units,
1196 params.headheight, default_unit);
1197 setEnabled(paper_->input_head_height, useGeom);
1198 setEnabled(paper_->choice_head_height_units, useGeom);
1200 updateWidgetsFromLengthString(paper_->input_head_sep,
1201 paper_->choice_head_sep_units,
1202 params.headsep, default_unit);
1203 setEnabled(paper_->input_head_sep, useGeom);
1204 setEnabled(paper_->choice_head_sep_units, useGeom);
1206 updateWidgetsFromLengthString(paper_->input_foot_skip,
1207 paper_->choice_foot_skip_units,
1208 params.footskip, default_unit);
1209 setEnabled(paper_->input_foot_skip, useGeom);
1210 setEnabled(paper_->choice_foot_skip_units, useGeom);
1212 fl_set_focus_object(paper_->form, paper_->choice_papersize);
1216 void FormDocument::bullets_update(BufferParams const & params)
1218 if (!bullets_.get() ||
1220 (XpmVersion==4 && XpmRevision<7)))
1223 bool const isLinuxDoc = lv_.buffer()->isLinuxDoc();
1224 setEnabled(fbullet, !isLinuxDoc);
1226 if (isLinuxDoc) return;
1228 fl_set_button(bullets_->radio_bullet_depth_1, 1);
1229 fl_set_input(bullets_->input_bullet_latex,
1230 params.user_defined_bullets[0].getText().c_str());
1231 fl_set_choice(bullets_->choice_bullet_size,
1232 params.user_defined_bullets[0].getSize() + 2);
1236 void FormDocument::checkReadOnly()
1238 if (bc().readOnly(lv_.buffer()->isReadonly())) {
1239 combo_doc_class->deactivate();
1240 combo_language->deactivate();
1241 postWarning(_("Document is read-only."
1242 " No changes to layout permitted."));
1244 combo_doc_class->activate();
1245 combo_language->activate();
1251 void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
1253 BufferParams & param = lv_.buffer()->params;
1255 // convert from 1-6 range to -1-4
1256 param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
1257 fl_set_input(bullets_->input_bullet_latex,
1258 param.temp_bullets[current_bullet_depth].getText().c_str());
1262 void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
1264 BufferParams & param = lv_.buffer()->params;
1266 param.temp_bullets[current_bullet_depth].
1267 setText(getString(bullets_->input_bullet_latex));
1271 void FormDocument::BulletDepth(FL_OBJECT * ob)
1273 /* Should I do the following: */
1274 /* 1. change to the panel that the current bullet belongs in */
1275 /* 2. show that bullet as selected */
1276 /* 3. change the size setting to the size of the bullet in Q.*/
1277 /* 4. display the latex equivalent in the latex box */
1279 /* I'm inclined to just go with 3 and 4 at the moment and */
1280 /* maybe try to support the others later */
1281 BufferParams & param = lv_.buffer()->params;
1284 if (ob == bullets_->radio_bullet_depth_1)
1286 else if (ob == bullets_->radio_bullet_depth_2)
1288 else if (ob == bullets_->radio_bullet_depth_3)
1290 else if (ob == bullets_->radio_bullet_depth_4)
1293 switch (fl_get_button_numb(ob)) {
1295 // right mouse button resets to default
1296 param.temp_bullets[data] = ITEMIZE_DEFAULTS[data];
1298 current_bullet_depth = data;
1299 fl_set_input(bullets_->input_bullet_latex,
1300 param.temp_bullets[data].getText().c_str());
1301 fl_set_choice(bullets_->choice_bullet_size,
1302 param.temp_bullets[data].getSize() + 2);
1307 void FormDocument::BulletPanel(FL_OBJECT * ob)
1309 /* Here we have to change the background pixmap to that selected */
1310 /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */
1313 if (ob == bullets_->radio_bullet_panel_standard)
1315 else if (ob == bullets_->radio_bullet_panel_maths)
1317 else if (ob == bullets_->radio_bullet_panel_ding2)
1319 else if (ob == bullets_->radio_bullet_panel_ding3)
1321 else if (ob == bullets_->radio_bullet_panel_ding4)
1323 else if (ob == bullets_->radio_bullet_panel_ding1)
1326 if (data != current_bullet_panel) {
1327 fl_freeze_form(bullets_->form);
1328 current_bullet_panel = data;
1330 /* free the current pixmap */
1331 fl_free_bmtable_pixmap(bullets_->bmtable_bullet_panel);
1333 if (ob == bullets_->radio_bullet_panel_standard) {
1334 new_panel = "standard";
1335 } else if (ob == bullets_->radio_bullet_panel_maths ) {
1336 new_panel = "amssymb";
1337 } else if (ob == bullets_->radio_bullet_panel_ding2) {
1338 new_panel = "psnfss1";
1339 } else if (ob == bullets_->radio_bullet_panel_ding3) {
1340 new_panel = "psnfss2";
1341 } else if (ob == bullets_->radio_bullet_panel_ding4) {
1342 new_panel = "psnfss3";
1343 } else if (ob == bullets_->radio_bullet_panel_ding1) {
1344 new_panel = "psnfss4";
1346 /* something very wrong happened */
1347 // play it safe for now but should be an exception
1348 current_bullet_panel = 0; // standard panel
1349 new_panel = "standard";
1351 new_panel += ".xpm";
1352 fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6,
1353 LibFileSearch("images", new_panel).c_str());
1354 fl_redraw_object(bullets_->bmtable_bullet_panel);
1355 fl_unfreeze_form(bullets_->form);
1360 void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/)
1362 /* handle the user input by setting the current bullet depth's pixmap */
1363 /* to that extracted from the current chosen position of the BMTable */
1364 /* Don't forget to free the button's old pixmap first. */
1366 BufferParams & param = lv_.buffer()->params;
1367 int bmtable_button = fl_get_bmtable(ob);
1369 /* try to keep the button held down till another is pushed */
1370 /* fl_set_bmtable(ob, 1, bmtable_button); */
1371 param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
1372 param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
1373 fl_set_input(bullets_->input_bullet_latex,
1374 param.temp_bullets[current_bullet_depth].getText().c_str());
1378 void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
1381 ob = class_->choice_doc_class;
1383 lv_.prohibitInput();
1385 unsigned int tc = combo_doc_class->get() - 1;
1386 if (textclasslist[tc].load()) {
1387 // we use a copy of the bufferparams because we do not
1388 // want to modify them yet.
1389 BufferParams params = lv_.buffer()->params;
1391 if (lyxrc.auto_reset_options) {
1392 params.textclass = tc;
1393 params.useClassDefaults();
1394 UpdateLayoutDocument(params);
1396 // update the params which are needed in any case
1397 // (fontsizes, pagestyle)
1398 params.textclass = tc;
1399 UpdateClassParams(params);
1403 // unable to load new style
1404 Alert::alert(_("Conversion Errors!"),
1405 _("Unable to switch to new document class."),
1406 _("Reverting to original document class."));
1407 combo_doc_class->select(int(lv_.buffer()->params.textclass) + 1);
1413 void FormDocument::UpdateLayoutDocument(BufferParams const & params)
1419 class_update(params);
1420 paper_update(params);
1421 language_update(params);
1422 options_update(params);
1423 bullets_update(params);