1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
10 *======================================================*/
14 #include FORMS_H_LOCATION
15 #include XPM_H_LOCATION
18 #pragma implementation
21 #include "FormDocument.h"
22 #include "form_document.h"
25 #include "lyxtextclasslist.h"
27 #include "tex-strings.h"
28 #include "bufferparams.h"
35 #include "BufferView.h"
38 #include "CutAndPaste.h"
39 #include "bufferview_funcs.h"
40 #include "xforms_helpers.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"
55 using Liason::setMinibuffer;
59 FormDocument::FormDocument(LyXView * lv, Dialogs * d)
60 : FormBaseBD(lv, d, _("Document Layout")),
61 ActCell(0), Confirmed(0),
62 current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
64 // let the dialog be shown
65 // This is a permanent connection so we won't bother
66 // storing a copy because we won't be disconnecting.
67 d->showDocument.connect(slot(this, &FormDocument::show));
71 void FormDocument::redraw()
73 if (form() && form()->visible)
74 fl_redraw_form(form());
78 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder);
79 if (outer_form && outer_form->visible)
80 fl_redraw_form(outer_form);
84 FL_FORM * FormDocument::form() const
86 if (dialog_.get()) return dialog_->form;
91 void FormDocument::build()
96 dialog_.reset(build_tabbed_document());
98 // Manage the restore, ok, apply, restore and cancel/close buttons
99 bc().setOK(dialog_->button_ok);
100 bc().setApply(dialog_->button_apply);
101 bc().setCancel(dialog_->button_cancel);
102 bc().setRestore(dialog_->button_restore);
103 bc().addReadOnly (dialog_->button_save_defaults);
104 bc().addReadOnly (dialog_->button_reset_defaults);
106 // the document paper form
107 paper_.reset(build_doc_paper());
108 fl_addto_choice(paper_->choice_papersize,
109 _(" Default | Custom | USletter | USlegal "
110 "| USexecutive | A3 | A4 | A5 | B3 | B4 | B5 "));
111 fl_addto_choice(paper_->choice_paperpackage,
114 "| Very small Margins "
115 "| Very wide Margins "));
117 fl_set_input_return(paper_->input_custom_width, FL_RETURN_CHANGED);
118 fl_set_input_return(paper_->input_custom_height, FL_RETURN_CHANGED);
119 fl_set_input_return(paper_->input_top_margin, FL_RETURN_CHANGED);
120 fl_set_input_return(paper_->input_bottom_margin, FL_RETURN_CHANGED);
121 fl_set_input_return(paper_->input_inner_margin, FL_RETURN_CHANGED);
122 fl_set_input_return(paper_->input_outer_margin, FL_RETURN_CHANGED);
123 fl_set_input_return(paper_->input_head_height, FL_RETURN_CHANGED);
124 fl_set_input_return(paper_->input_head_sep, FL_RETURN_CHANGED);
125 fl_set_input_return(paper_->input_foot_skip, FL_RETURN_CHANGED);
128 // Create the contents of the unit choices
129 // Don't include the "%" terms...
130 vector<string> units_vec = getLatexUnits();
132 for (vector<string>::iterator it = units_vec.begin();
133 it != units_vec.end(); ++it) {
134 if (contains(*it, "%"))
135 it = units_vec.erase(it, it+1) - 1;
138 vector<string>::iterator ret =
139 remove_if(units_vec.begin(),
141 bind2nd(contains_functor(), "%"));
142 units_vec.erase(ret, units_vec.end());
144 string units = getStringFromVector(units_vec, "|");
146 fl_addto_choice(paper_->choice_custom_width_units, units.c_str());
147 fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
148 fl_addto_choice(paper_->choice_top_margin_units, units.c_str());
149 fl_addto_choice(paper_->choice_bottom_margin_units, units.c_str());
150 fl_addto_choice(paper_->choice_inner_margin_units, units.c_str());
151 fl_addto_choice(paper_->choice_outer_margin_units, units.c_str());
152 fl_addto_choice(paper_->choice_head_height_units, units.c_str());
153 fl_addto_choice(paper_->choice_head_sep_units, units.c_str());
154 fl_addto_choice(paper_->choice_foot_skip_units, units.c_str());
156 bc().addReadOnly (paper_->choice_paperpackage);
157 bc().addReadOnly (paper_->group_radio_orientation);
158 bc().addReadOnly (paper_->radio_portrait);
159 bc().addReadOnly (paper_->radio_landscape);
160 bc().addReadOnly (paper_->choice_papersize);
161 bc().addReadOnly (paper_->check_use_geometry);
162 bc().addReadOnly (paper_->input_custom_width);
163 bc().addReadOnly (paper_->input_custom_height);
164 bc().addReadOnly (paper_->input_top_margin);
165 bc().addReadOnly (paper_->input_bottom_margin);
166 bc().addReadOnly (paper_->input_inner_margin);
167 bc().addReadOnly (paper_->input_outer_margin);
168 bc().addReadOnly (paper_->input_head_height);
169 bc().addReadOnly (paper_->input_head_sep);
170 bc().addReadOnly (paper_->input_foot_skip);
172 // the document class form
173 class_.reset(build_doc_class());
176 // The language is a combo-box and has to be inserted manually
177 obj = class_->choice_doc_class;
178 fl_deactivate_object(obj);
179 fl_addto_form(class_->form);
180 combo_doc_class.reset(new Combox(FL_COMBOX_DROPLIST));
181 combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400,
182 dialog_->tabbed_folder);
183 combo_doc_class->shortcut("#C",1);
184 combo_doc_class->setcallback(ComboInputCB, this);
186 for (LyXTextClassList::const_iterator cit = textclasslist.begin();
187 cit != textclasslist.end(); ++cit) {
188 combo_doc_class->addto(cit->description());
191 fl_addto_choice(class_->choice_doc_spacing,
192 _(" Single | OneHalf | Double | Other "));
193 fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12");
194 for (n=0; tex_fonts[n][0]; ++n) {
195 fl_addto_choice(class_->choice_doc_fonts,tex_fonts[n]);
197 fl_addto_choice(class_->choice_doc_pagestyle,
198 "default|empty|plain|headings|fancy");
199 fl_addto_choice(class_->choice_doc_skip,
200 _(" Smallskip | Medskip | Bigskip | Length "));
201 fl_addto_choice(class_->choice_default_skip_units, units.c_str());
202 fl_set_input_return(class_->input_doc_extra, FL_RETURN_CHANGED);
203 fl_set_input_return(class_->input_doc_skip, FL_RETURN_CHANGED);
204 fl_set_input_return(class_->input_doc_spacing, FL_RETURN_CHANGED);
206 // Set input filters on doc spacing to make it accept only
208 fl_set_input_filter(class_->input_doc_spacing, fl_unsigned_float_filter);
210 bc().addReadOnly (class_->radio_doc_indent);
211 bc().addReadOnly (class_->radio_doc_skip);
213 bc().addReadOnly (class_->choice_doc_pagestyle);
214 bc().addReadOnly (class_->choice_doc_fonts);
215 bc().addReadOnly (class_->choice_doc_fontsize);
216 bc().addReadOnly (class_->radio_doc_sides_one);
217 bc().addReadOnly (class_->radio_doc_sides_two);
218 bc().addReadOnly (class_->radio_doc_columns_one);
219 bc().addReadOnly (class_->radio_doc_columns_two);
220 bc().addReadOnly (class_->input_doc_extra);
221 bc().addReadOnly (class_->input_doc_skip);
222 bc().addReadOnly (class_->choice_doc_skip);
223 bc().addReadOnly (class_->choice_doc_spacing);
224 bc().addReadOnly (class_->input_doc_spacing);
226 // the document language form
227 language_.reset(build_doc_language());
228 fl_addto_choice(language_->choice_inputenc,
229 "default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
230 "|koi8-r|koi8-u|cp866|cp1251|iso88595");
232 // The language is a combo-box and has to be inserted manually
233 obj = language_->choice_language;
234 fl_deactivate_object(obj);
235 fl_addto_form(language_->form);
236 combo_language.reset(new Combox(FL_COMBOX_DROPLIST));
237 combo_language->add(obj->x, obj->y, obj->w, obj->h, 400,
238 dialog_->tabbed_folder);
239 combo_language->shortcut("#L",1);
240 combo_language->setcallback(ComboInputCB, this);
243 for (Languages::const_iterator cit = languages.begin();
244 cit != languages.end(); ++cit) {
245 combo_language->addto(cit->second.lang());
248 fl_addto_choice(language_->choice_quotes_language,
249 _(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
250 " «text» | »text« "));
252 bc().addReadOnly (language_->choice_inputenc);
253 bc().addReadOnly (language_->choice_quotes_language);
254 bc().addReadOnly (language_->radio_single);
255 bc().addReadOnly (language_->radio_double);
257 // the document options form
258 options_.reset(build_doc_options());
259 fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
260 fl_set_counter_bounds(options_->slider_secnumdepth,-2,5);
261 fl_set_counter_bounds(options_->slider_tocdepth,-1,5);
262 fl_set_counter_step(options_->slider_secnumdepth,1,1);
263 fl_set_counter_step(options_->slider_tocdepth,1,1);
264 fl_set_counter_precision(options_->slider_secnumdepth, 0);
265 fl_set_counter_precision(options_->slider_tocdepth, 0);
266 for (n=0; tex_graphics[n][0]; ++n) {
267 fl_addto_choice(options_->choice_postscript_driver,
270 fl_addto_choice(options_->choice_citation_format,
271 _(" Author-year | Numerical "));
273 bc_.addReadOnly (options_->slider_secnumdepth);
274 bc_.addReadOnly (options_->slider_tocdepth);
275 bc_.addReadOnly (options_->check_use_amsmath);
276 bc_.addReadOnly (options_->check_use_natbib);
277 bc_.addReadOnly (options_->choice_citation_format);
278 bc_.addReadOnly (options_->input_float_placement);
279 bc_.addReadOnly (options_->choice_postscript_driver);
281 // the document bullets form
282 bullets_.reset(build_doc_bullet());
283 fl_addto_choice(bullets_->choice_bullet_size,
284 _(" default | tiny | script | footnote | small |"
285 " normal | large | Large | LARGE | huge | Huge"));
286 fl_set_choice(bullets_->choice_bullet_size, 1);
287 fl_set_input_return(bullets_->input_bullet_latex, FL_RETURN_CHANGED);
288 fl_set_input_maxchars(bullets_->input_bullet_latex, 80);
290 bc().addReadOnly (bullets_->bmtable_bullet_panel);
291 bc().addReadOnly (bullets_->choice_bullet_size);
292 bc().addReadOnly (bullets_->input_bullet_latex);
293 bc().addReadOnly (bullets_->radio_bullet_depth);
294 bc().addReadOnly (bullets_->radio_bullet_panel);
296 fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"),
298 fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"),
300 fl_addto_tabfolder(dialog_->tabbed_folder,_("Language"),
302 fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"),
304 fbullet = fl_addto_tabfolder(dialog_->tabbed_folder,_("Bullets"),
306 if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) {
307 lyxerr << _("Your version of libXpm is older than 4.7.\n"
308 "The `bullet' tab of the document dialog "
309 "has been disabled") << '\n';
310 fl_deactivate_object(fbullet);
311 fl_set_object_lcol(fbullet, FL_INACTIVE);
316 void FormDocument::apply()
318 if (!lv_->view()->available() || !dialog_.get())
321 bool redo = class_apply();
323 redo = language_apply() || redo;
324 redo = options_apply() || redo;
328 lv_->view()->redoCurrentBuffer();
330 lv_->buffer()->markDirty();
331 setMinibuffer(lv_, _("Document layout set"));
335 void FormDocument::cancel()
337 // this avoids confusion when reopening
338 BufferParams & param = lv_->buffer()->params;
339 param.temp_bullets[0] = param.user_defined_bullets[0];
340 param.temp_bullets[1] = param.user_defined_bullets[1];
341 param.temp_bullets[2] = param.user_defined_bullets[2];
342 param.temp_bullets[3] = param.user_defined_bullets[3];
347 void FormDocument::update()
354 BufferParams const & params = lv_->buffer()->params;
356 class_update(params);
357 paper_update(params);
358 language_update(params);
359 options_update(params);
360 bullets_update(params);
365 // should this go elsewhere? Maybe a ControllerDocument? (JMarc)
366 /** Save the buffer's parameters as user default.
367 This function saves a file \c user_lyxdir/templates/defaults.lyx
368 which parameters are those of the current buffer. This file
369 is used as a default template when creating a new
370 file. Returns \c true on success.
372 bool saveParamsAsDefault(BufferParams const ¶ms)
374 if (!Alert::askQuestion(_("Do you want to save the current settings"),
375 _("for the document layout as default?"),
376 _("(they will be valid for any new document)")))
379 string const fname = AddName(AddPath(user_lyxdir, "templates/"),
381 Buffer defaults = Buffer(fname);
382 defaults.params = params;
384 // add an empty paragraph. Is this enough?
385 defaults.paragraph = new Paragraph;
387 return defaults.writeFile(defaults.fileName(), false);
392 bool FormDocument::input(FL_OBJECT * ob, long data)
394 State cb = static_cast<State>(data);
397 case CHECKCHOICECLASS:
398 CheckChoiceClass(ob, 0);
400 case CHOICEBULLETSIZE:
401 ChoiceBulletSize(ob, 0);
403 case INPUTBULLETLATEX:
404 InputBulletLaTeX(ob, 0);
421 BulletBMTable(ob, 0);
427 bool const length_input = fl_get_choice(class_->choice_doc_skip) == 4;
428 if (ob == class_->choice_doc_skip) {
429 setEnabled(class_->input_doc_skip, length_input);
430 setEnabled(class_->choice_default_skip_units, length_input);
433 if (ob == class_->choice_doc_spacing)
434 setEnabled(class_->input_doc_spacing,
435 fl_get_choice(class_->choice_doc_spacing) == 4);
437 bool const skip_used = fl_get_button(class_->radio_doc_skip);
438 if (ob == class_->radio_doc_skip ||
439 ob == class_->radio_doc_indent) {
440 setEnabled(class_->choice_doc_skip, skip_used);
441 setEnabled(class_->input_doc_skip,
442 skip_used && length_input);
443 setEnabled(class_->choice_default_skip_units,
444 skip_used && length_input);
445 // Default unit choice is cm if metric, inches if US paper.
446 // If papersize is default, check the lyxrc-settings
447 int const paperchoice = fl_get_choice(paper_->choice_papersize);
448 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
449 || paperchoice == 2 || paperchoice > 5;
450 int const default_unit = metric ? 8 : 9;
451 if (strip(fl_get_input(class_->input_doc_skip)).empty())
452 fl_set_choice(class_->choice_default_skip_units,
456 if (ob == options_->check_use_natbib) {
457 setEnabled(options_->choice_citation_format,
458 fl_get_button(options_->check_use_natbib));
461 if (ob == dialog_->button_save_defaults) {
465 language_apply(params);
466 options_apply(params);
467 bullets_apply(params);
468 saveParamsAsDefault(params);
471 if (ob == dialog_->button_reset_defaults) {
472 BufferParams params = lv_->buffer()->params;
473 params.textclass = combo_doc_class->get() - 1;
474 params.useClassDefaults();
475 UpdateLayoutDocument(params);
478 if (ob == paper_->radio_landscape)
479 fl_set_choice(paper_->choice_paperpackage,
480 BufferParams::PACKAGE_NONE + 1);
482 if (ob == paper_->choice_papersize) {
483 int const paperchoice = fl_get_choice(paper_->choice_papersize);
484 bool const defsize = paperchoice == 1;
485 bool const custom = paperchoice == 2;
486 bool const a3size = paperchoice == 6;
487 bool const b3size = paperchoice == 9;
488 bool const b4size = paperchoice == 10;
491 fl_set_button(paper_->radio_portrait, 1);
493 bool const use_geom = (custom || a3size || b3size || b4size);
495 fl_set_button(paper_->check_use_geometry, int(use_geom));
497 setEnabled(paper_->input_top_margin, use_geom);
498 setEnabled(paper_->input_bottom_margin, use_geom);
499 setEnabled(paper_->input_inner_margin, use_geom);
500 setEnabled(paper_->input_outer_margin, use_geom);
501 setEnabled(paper_->input_head_height, use_geom);
502 setEnabled(paper_->input_head_sep, use_geom);
503 setEnabled(paper_->input_foot_skip, use_geom);
504 setEnabled(paper_->choice_top_margin_units, use_geom);
505 setEnabled(paper_->choice_bottom_margin_units, use_geom);
506 setEnabled(paper_->choice_inner_margin_units, use_geom);
507 setEnabled(paper_->choice_outer_margin_units, use_geom);
508 setEnabled(paper_->choice_head_height_units, use_geom);
509 setEnabled(paper_->choice_head_sep_units, use_geom);
510 setEnabled(paper_->choice_foot_skip_units, use_geom);
511 setEnabled(paper_->choice_custom_width_units, use_geom);
512 setEnabled(paper_->choice_custom_height_units, use_geom);
514 setEnabled(paper_->input_custom_width, custom);
515 setEnabled(paper_->input_custom_height, custom);
516 setEnabled(paper_->choice_custom_width_units, custom);
517 setEnabled(paper_->choice_custom_height_units, custom);
518 setEnabled(paper_->radio_portrait, !custom);
519 setEnabled(paper_->radio_landscape, !custom);
521 // Default unit choice is cm if metric, inches if US paper.
522 // If papersize is default, use the lyxrc-settings
523 bool const metric = (defsize && lyxrc.default_papersize > 3)
524 || paperchoice == 2 || paperchoice > 5;
525 int const default_unit = metric ? 8 : 9;
526 if (strip(fl_get_input(paper_->input_custom_width)).empty())
527 fl_set_choice(paper_->choice_custom_width_units,
529 if (strip(fl_get_input(paper_->input_custom_height)).empty())
530 fl_set_choice(paper_->choice_custom_height_units,
532 if (strip(fl_get_input(paper_->input_top_margin)).empty())
533 fl_set_choice(paper_->choice_top_margin_units,
535 if (strip(fl_get_input(paper_->input_bottom_margin)).empty())
536 fl_set_choice(paper_->choice_bottom_margin_units,
538 if (strip(fl_get_input(paper_->input_inner_margin)).empty())
539 fl_set_choice(paper_->choice_inner_margin_units,
541 if (strip(fl_get_input(paper_->input_outer_margin)).empty())
542 fl_set_choice(paper_->choice_outer_margin_units,
544 if (strip(fl_get_input(paper_->input_head_height)).empty())
545 fl_set_choice(paper_->choice_head_height_units,
547 if (strip(fl_get_input(paper_->input_head_sep)).empty())
548 fl_set_choice(paper_->choice_head_sep_units,
550 if (strip(fl_get_input(paper_->input_foot_skip)).empty())
551 fl_set_choice(paper_->choice_foot_skip_units,
555 if (ob == paper_->choice_papersize ||
556 ob == paper_->radio_portrait ||
557 ob == paper_->radio_landscape) {
559 setEnabled(paper_->choice_paperpackage,
560 //either default papersize (preferences)
561 //or document papersize has to be A4
562 (fl_get_choice(paper_->choice_papersize) == 7
563 || fl_get_choice(paper_->choice_papersize) == 1
564 && lyxrc.default_papersize == 5)
565 && fl_get_button(paper_->radio_portrait));
568 if (ob == paper_->choice_paperpackage) {
569 if (fl_get_choice(paper_->choice_paperpackage) != 1) {
570 fl_set_button(paper_->check_use_geometry, 0);
572 setEnabled(paper_->input_top_margin, false);
573 setEnabled(paper_->input_bottom_margin, false);
574 setEnabled(paper_->input_inner_margin, false);
575 setEnabled(paper_->input_outer_margin, false);
576 setEnabled(paper_->input_head_height, false);
577 setEnabled(paper_->input_head_sep, false);
578 setEnabled(paper_->input_foot_skip, false);
579 setEnabled(paper_->choice_top_margin_units, false);
580 setEnabled(paper_->choice_bottom_margin_units, false);
581 setEnabled(paper_->choice_inner_margin_units, false);
582 setEnabled(paper_->choice_outer_margin_units, false);
583 setEnabled(paper_->choice_head_height_units, false);
584 setEnabled(paper_->choice_head_sep_units, false);
585 setEnabled(paper_->choice_foot_skip_units, false);
589 if (ob == paper_->check_use_geometry) {
590 //don't allow switching geometry off in custom papersize mode
591 //nor in A3, B3, and B4
592 int const choice = fl_get_choice(paper_->choice_papersize);
593 if (choice == 2 || choice == 6 || choice == 9 || choice == 10)
594 fl_set_button(paper_->check_use_geometry, 1);
596 fl_set_choice(paper_->choice_paperpackage,
597 BufferParams::PACKAGE_NONE + 1);
599 bool const use_geom = fl_get_button(paper_->check_use_geometry);
600 setEnabled(paper_->input_top_margin, use_geom);
601 setEnabled(paper_->input_bottom_margin, use_geom);
602 setEnabled(paper_->input_inner_margin, use_geom);
603 setEnabled(paper_->input_outer_margin, use_geom);
604 setEnabled(paper_->input_head_height, use_geom);
605 setEnabled(paper_->input_head_sep, use_geom);
606 setEnabled(paper_->input_foot_skip, use_geom);
607 setEnabled(paper_->choice_top_margin_units, use_geom);
608 setEnabled(paper_->choice_bottom_margin_units, use_geom);
609 setEnabled(paper_->choice_inner_margin_units, use_geom);
610 setEnabled(paper_->choice_outer_margin_units, use_geom);
611 setEnabled(paper_->choice_head_height_units, use_geom);
612 setEnabled(paper_->choice_head_sep_units, use_geom);
613 setEnabled(paper_->choice_foot_skip_units, use_geom);
618 case CHECKCHOICECLASS:
619 case CHOICEBULLETSIZE:
620 case INPUTBULLETLATEX:
622 return CheckDocumentInput(ob, 0);
631 void FormDocument::ComboInputCB(int, void * v, Combox * combox)
633 FormDocument * pre = static_cast<FormDocument*>(v);
634 if (combox == pre->combo_doc_class.get())
635 pre->CheckChoiceClass(0, 0);
636 pre->bc().valid(pre->CheckDocumentInput(0,0));
640 bool FormDocument::class_apply(BufferParams ¶ms)
644 // If default skip is a "Length" but there's no text in the
645 // input field, reset the kind to "Medskip", which is the default.
646 if ((fl_get_choice (class_->choice_doc_skip) == 4) &&
647 !*(fl_get_input (class_->input_doc_skip))) {
648 fl_set_choice (class_->choice_doc_skip, 2);
650 params.fonts = fl_get_choice_text(class_->choice_doc_fonts);
651 params.fontsize = fl_get_choice_text(class_->choice_doc_fontsize);
652 params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle);
654 params.textclass = combo_doc_class->get() - 1;
656 BufferParams::PARSEP tmpsep = params.paragraph_separation;
657 if (fl_get_button(class_->radio_doc_indent))
658 params.paragraph_separation = BufferParams::PARSEP_INDENT;
660 params.paragraph_separation = BufferParams::PARSEP_SKIP;
661 if (tmpsep != params.paragraph_separation)
664 VSpace tmpdefskip = params.getDefSkip();
665 switch (fl_get_choice (class_->choice_doc_skip)) {
667 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
670 params.setDefSkip(VSpace(VSpace::MEDSKIP));
673 params.setDefSkip(VSpace(VSpace::BIGSKIP));
677 string const length =
678 getLengthFromWidgets(class_->input_doc_skip,
679 class_->choice_default_skip_units);
681 params.setDefSkip(VSpace(LyXGlueLength(length)));
685 // DocumentDefskipCB assures that this never happens
686 params.setDefSkip(VSpace(VSpace::MEDSKIP));
689 if (!(tmpdefskip == params.getDefSkip()))
692 if (fl_get_button(class_->radio_doc_columns_two))
696 if (fl_get_button(class_->radio_doc_sides_two))
697 params.sides = LyXTextClass::TwoSides;
699 params.sides = LyXTextClass::OneSide;
701 Spacing tmpSpacing = params.spacing;
702 switch (fl_get_choice(class_->choice_doc_spacing)) {
704 lyxerr[Debug::INFO] << "Spacing: SINGLE\n";
705 params.spacing.set(Spacing::Single);
708 lyxerr[Debug::INFO] << "Spacing: ONEHALF\n";
709 params.spacing.set(Spacing::Onehalf);
712 lyxerr[Debug::INFO] << "Spacing: DOUBLE\n";
713 params.spacing.set(Spacing::Double);
716 lyxerr[Debug::INFO] << "Spacing: OTHER\n";
717 params.spacing.set(Spacing::Other,
718 fl_get_input(class_->input_doc_spacing));
721 if (tmpSpacing != params.spacing)
724 params.options = fl_get_input(class_->input_doc_extra);
730 bool FormDocument::class_apply()
732 BufferParams ¶ms = lv_->buffer()->params;
734 unsigned int const old_class = params.textclass;
736 bool redo = class_apply(params);
738 if (params.textclass != old_class) {
739 // try to load new_class
740 if (textclasslist[params.textclass].load()) {
741 // successfully loaded
743 setMinibuffer(lv_, _("Converting document to new document class..."));
744 int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
745 old_class, params.textclass,
746 lv_->buffer()->paragraph,
747 lv_->buffer()->params);
751 s = _("One paragraph couldn't be converted");
754 s += _(" paragraphs couldn't be converted");
756 Alert::alert(_("Conversion Errors!"),s,
757 _("into chosen document class"));
761 // problem changing class -- warn user and retain old style
762 Alert::alert(_("Conversion Errors!"),
763 _("Errors loading new document class."),
764 _("Reverting to original document class."));
765 combo_doc_class->select(int(old_class) + 1);
773 void FormDocument::paper_apply(BufferParams & params)
775 params.papersize2 = char(fl_get_choice(paper_->choice_papersize)-1);
777 params.paperpackage =
778 char(fl_get_choice(paper_->choice_paperpackage)-1);
780 // set params.papersize from params.papersize2 and params.paperpackage
781 params.setPaperStuff();
783 params.use_geometry = fl_get_button(paper_->check_use_geometry);
785 if (fl_get_button(paper_->radio_landscape))
786 params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
788 params.orientation = BufferParams::ORIENTATION_PORTRAIT;
791 getLengthFromWidgets(paper_->input_custom_width,
792 paper_->choice_custom_width_units);
795 getLengthFromWidgets(paper_->input_custom_height,
796 paper_->choice_custom_height_units);
799 getLengthFromWidgets(paper_->input_inner_margin,
800 paper_->choice_inner_margin_units);
803 getLengthFromWidgets(paper_->input_top_margin,
804 paper_->choice_top_margin_units);
807 getLengthFromWidgets(paper_->input_outer_margin,
808 paper_->choice_outer_margin_units);
810 params.bottommargin =
811 getLengthFromWidgets(paper_->input_bottom_margin,
812 paper_->choice_bottom_margin_units);
815 getLengthFromWidgets(paper_->input_head_height,
816 paper_->choice_head_height_units);
819 getLengthFromWidgets(paper_->input_head_sep,
820 paper_->choice_head_sep_units);
823 getLengthFromWidgets(paper_->input_foot_skip,
824 paper_->choice_foot_skip_units);
828 void FormDocument::paper_apply()
830 paper_apply(lv_->buffer()->params);
834 bool FormDocument::language_apply(BufferParams & params)
836 InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
839 switch (fl_get_choice(language_->choice_quotes_language) - 1) {
841 lga = InsetQuotes::EnglishQ;
844 lga = InsetQuotes::SwedishQ;
847 lga = InsetQuotes::GermanQ;
850 lga = InsetQuotes::PolishQ;
853 lga = InsetQuotes::FrenchQ;
856 lga = InsetQuotes::DanishQ;
859 params.quotes_language = lga;
860 if (fl_get_button(language_->radio_single))
861 params.quotes_times = InsetQuotes::SingleQ;
863 params.quotes_times = InsetQuotes::DoubleQ;
865 Language const * old_language = params.language;
866 Language const * new_language =
867 languages.getLanguage(combo_language->getline());
869 new_language = default_language;
871 if (old_language != new_language
872 && old_language->RightToLeft() == params.language->RightToLeft()
873 && !lv_->buffer()->isMultiLingual())
874 lv_->buffer()->changeLanguage(old_language, params.language);
876 if (old_language != new_language) {
880 params.language = new_language;
881 params.inputenc = fl_get_choice_text(language_->choice_inputenc);
887 bool FormDocument::language_apply()
889 return language_apply(lv_->buffer()->params);
893 bool FormDocument::options_apply(BufferParams & params)
897 params.graphicsDriver =
898 fl_get_choice_text(options_->choice_postscript_driver);
899 params.use_amsmath = fl_get_button(options_->check_use_amsmath);
900 params.use_natbib = fl_get_button(options_->check_use_natbib);
901 params.use_numerical_citations =
902 fl_get_choice(options_->choice_citation_format)-1;
904 int tmpchar = int(fl_get_counter_value(options_->slider_secnumdepth));
905 if (params.secnumdepth != tmpchar)
907 params.secnumdepth = tmpchar;
909 params.tocdepth = int(fl_get_counter_value(options_->slider_tocdepth));
911 params.float_placement =
912 fl_get_input(options_->input_float_placement);
918 bool FormDocument::options_apply()
920 return options_apply(lv_->buffer()->params);
924 void FormDocument::bullets_apply(BufferParams & params)
926 /* update the bullet settings */
927 BufferParams & buf_params = lv_->buffer()->params;
929 // a little bit of loop unrolling
930 params.user_defined_bullets[0] = buf_params.temp_bullets[0];
931 params.user_defined_bullets[1] = buf_params.temp_bullets[1];
932 params.user_defined_bullets[2] = buf_params.temp_bullets[2];
933 params.user_defined_bullets[3] = buf_params.temp_bullets[3];
937 void FormDocument::bullets_apply()
939 bullets_apply(lv_->buffer()->params);
943 void FormDocument::class_update(BufferParams const & params)
948 LyXTextClass const & tclass = textclasslist[params.textclass];
950 combo_doc_class->select(tclass.description());
951 fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str());
952 fl_clear_choice(class_->choice_doc_fontsize);
953 fl_addto_choice(class_->choice_doc_fontsize, "default");
954 fl_addto_choice(class_->choice_doc_fontsize,
955 tclass.opt_fontsize().c_str());
956 fl_set_choice(class_->choice_doc_fontsize,
957 tokenPos(tclass.opt_fontsize(), '|', params.fontsize)+2);
958 fl_clear_choice(class_->choice_doc_pagestyle);
959 fl_addto_choice(class_->choice_doc_pagestyle, "default");
960 fl_addto_choice(class_->choice_doc_pagestyle,
961 tclass.opt_pagestyle().c_str());
962 fl_set_choice(class_->choice_doc_pagestyle,
963 tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle)+2);
964 fl_set_button(class_->radio_doc_indent, 0);
965 fl_set_button(class_->radio_doc_skip, 0);
966 if (params.paragraph_separation == BufferParams::PARSEP_INDENT)
967 fl_set_button(class_->radio_doc_indent, 1);
969 fl_set_button(class_->radio_doc_skip, 1);
971 bool const input_length = fl_get_choice(class_->choice_doc_skip) == 4;
972 setEnabled(class_->choice_default_skip_units, input_length);
973 setEnabled(class_->input_doc_skip, input_length);
975 switch (params.getDefSkip().kind()) {
976 case VSpace::SMALLSKIP:
977 fl_set_choice (class_->choice_doc_skip, 1);
979 case VSpace::MEDSKIP:
980 fl_set_choice (class_->choice_doc_skip, 2);
982 case VSpace::BIGSKIP:
983 fl_set_choice (class_->choice_doc_skip, 3);
987 int const paperchoice = fl_get_choice(paper_->choice_papersize);
988 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
989 || paperchoice == 2 || paperchoice > 5;
990 string const default_unit = metric ? "cm" : "in";
991 string const length = params.getDefSkip().asLyXCommand();
992 updateWidgetsFromLengthString(class_->input_doc_skip,
993 class_->choice_default_skip_units,
994 length, default_unit);
998 fl_set_choice (class_->choice_doc_skip, 2);
1001 fl_set_button(class_->radio_doc_sides_one, 0);
1002 fl_set_button(class_->radio_doc_sides_two, 0);
1003 setEnabled(class_->choice_doc_skip,
1004 fl_get_button(class_->radio_doc_skip));
1006 if (params.sides == LyXTextClass::TwoSides)
1007 fl_set_button(class_->radio_doc_sides_two, 1);
1009 fl_set_button(class_->radio_doc_sides_one, 1);
1010 fl_set_button(class_->radio_doc_columns_one, 0);
1011 fl_set_button(class_->radio_doc_columns_two, 0);
1012 if (params.columns == 2)
1013 fl_set_button(class_->radio_doc_columns_two, 1);
1015 fl_set_button(class_->radio_doc_columns_one, 1);
1017 fl_set_input(class_->input_doc_spacing, "");
1018 setEnabled(class_->input_doc_spacing, false);
1020 switch (params.spacing.getSpace()) {
1021 case Spacing::Default: // nothing bad should happen with this
1022 case Spacing::Single:
1024 fl_set_choice(class_->choice_doc_spacing, 1);
1026 case Spacing::Onehalf:
1028 fl_set_choice(class_->choice_doc_spacing, 2);
1030 case Spacing::Double:
1032 fl_set_choice(class_->choice_doc_spacing, 3);
1034 case Spacing::Other:
1036 fl_set_choice(class_->choice_doc_spacing, 4);
1038 sprintf(sval,"%g",params.spacing.getValue());
1039 fl_set_input(class_->input_doc_spacing, sval);
1040 setEnabled(class_->input_doc_spacing, true);
1044 if (!params.options.empty())
1045 fl_set_input(class_->input_doc_extra, params.options.c_str());
1047 fl_set_input(class_->input_doc_extra, "");
1051 void FormDocument::language_update(BufferParams const & params)
1053 if (!language_.get())
1056 combo_language->select(params.language->lang());
1057 fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str());
1058 fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1);
1059 fl_set_button(language_->radio_single, 0);
1060 fl_set_button(language_->radio_double, 0);
1061 if (params.quotes_times == InsetQuotes::SingleQ)
1062 fl_set_button(language_->radio_single, 1);
1064 fl_set_button(language_->radio_double, 1);
1068 void FormDocument::options_update(BufferParams const & params)
1070 if (!options_.get())
1073 fl_set_choice_text(options_->choice_postscript_driver,
1074 params.graphicsDriver.c_str());
1075 fl_set_button(options_->check_use_amsmath, params.use_amsmath);
1076 fl_set_button(options_->check_use_natbib, params.use_natbib);
1077 fl_set_choice(options_->choice_citation_format,
1078 int(params.use_numerical_citations)+1);
1079 setEnabled(options_->choice_citation_format, params.use_natbib);
1080 fl_set_counter_value(options_->slider_secnumdepth, params.secnumdepth);
1081 fl_set_counter_value(options_->slider_tocdepth, params.tocdepth);
1082 if (!params.float_placement.empty())
1083 fl_set_input(options_->input_float_placement,
1084 params.float_placement.c_str());
1086 fl_set_input(options_->input_float_placement, "");
1090 void FormDocument::paper_update(BufferParams const & params)
1095 fl_set_choice(paper_->choice_papersize, params.papersize2 + 1);
1096 fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1);
1097 fl_set_button(paper_->check_use_geometry, params.use_geometry);
1099 int const paperchoice = fl_get_choice(paper_->choice_papersize);
1100 bool const useCustom = paperchoice == 2;
1101 bool const useGeom = fl_get_button(paper_->check_use_geometry);
1103 fl_set_button(paper_->radio_portrait, 0);
1104 setEnabled(paper_->radio_portrait, !useCustom);
1105 fl_set_button(paper_->radio_landscape, 0);
1106 setEnabled(paper_->radio_landscape, !useCustom);
1108 if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
1109 fl_set_button(paper_->radio_landscape, 1);
1111 fl_set_button(paper_->radio_portrait, 1);
1112 setEnabled(paper_->choice_paperpackage,
1113 //either default papersize (preferences)
1114 //or document papersize has to be A4
1116 || paperchoice == 1 && lyxrc.default_papersize == 5)
1117 && fl_get_button(paper_->radio_portrait));
1119 // Default unit choice is cm if metric, inches if US paper.
1120 bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
1121 || paperchoice == 2 || paperchoice > 5;
1122 string const default_unit = metric ? "cm" : "in";
1123 updateWidgetsFromLengthString(paper_->input_custom_width,
1124 paper_->choice_custom_width_units,
1125 params.paperwidth, default_unit);
1126 setEnabled(paper_->input_custom_width, useCustom);
1127 setEnabled(paper_->choice_custom_width_units, useCustom);
1129 updateWidgetsFromLengthString(paper_->input_custom_height,
1130 paper_->choice_custom_height_units,
1131 params.paperheight, default_unit);
1132 setEnabled(paper_->input_custom_height, useCustom);
1133 setEnabled(paper_->choice_custom_height_units, useCustom);
1135 updateWidgetsFromLengthString(paper_->input_inner_margin,
1136 paper_->choice_inner_margin_units,
1137 params.leftmargin, default_unit);
1138 setEnabled(paper_->input_inner_margin, useGeom);
1139 setEnabled(paper_->choice_inner_margin_units, useGeom);
1141 updateWidgetsFromLengthString(paper_->input_top_margin,
1142 paper_->choice_top_margin_units,
1143 params.topmargin, default_unit);
1144 setEnabled(paper_->input_top_margin, useGeom);
1145 setEnabled(paper_->choice_top_margin_units, useGeom);
1147 updateWidgetsFromLengthString(paper_->input_outer_margin,
1148 paper_->choice_outer_margin_units,
1149 params.rightmargin, default_unit);
1150 setEnabled(paper_->input_outer_margin, useGeom);
1151 setEnabled(paper_->choice_outer_margin_units, useGeom);
1153 updateWidgetsFromLengthString(paper_->input_bottom_margin,
1154 paper_->choice_bottom_margin_units,
1155 params.bottommargin, default_unit);
1156 setEnabled(paper_->input_bottom_margin, useGeom);
1157 setEnabled(paper_->choice_bottom_margin_units, useGeom);
1159 updateWidgetsFromLengthString(paper_->input_head_height,
1160 paper_->choice_head_height_units,
1161 params.headheight, default_unit);
1162 setEnabled(paper_->input_head_height, useGeom);
1163 setEnabled(paper_->choice_head_height_units, useGeom);
1165 updateWidgetsFromLengthString(paper_->input_head_sep,
1166 paper_->choice_head_sep_units,
1167 params.headsep, default_unit);
1168 setEnabled(paper_->input_head_sep, useGeom);
1169 setEnabled(paper_->choice_head_sep_units, useGeom);
1171 updateWidgetsFromLengthString(paper_->input_foot_skip,
1172 paper_->choice_foot_skip_units,
1173 params.footskip, default_unit);
1174 setEnabled(paper_->input_foot_skip, useGeom);
1175 setEnabled(paper_->choice_foot_skip_units, useGeom);
1177 fl_set_focus_object(paper_->form, paper_->choice_papersize);
1181 void FormDocument::bullets_update(BufferParams const & params)
1183 if (!bullets_.get() ||
1185 (XpmVersion==4 && XpmRevision<7)))
1188 bool const isLinuxDoc = lv_->buffer()->isLinuxDoc();
1189 setEnabled(fbullet, !isLinuxDoc);
1191 if (isLinuxDoc) return;
1193 fl_set_button(bullets_->radio_bullet_depth_1, 1);
1194 fl_set_input(bullets_->input_bullet_latex,
1195 params.user_defined_bullets[0].getText().c_str());
1196 fl_set_choice(bullets_->choice_bullet_size,
1197 params.user_defined_bullets[0].getSize() + 2);
1201 void FormDocument::checkReadOnly()
1203 if (bc().readOnly(lv_->buffer()->isReadonly())) {
1204 combo_doc_class->deactivate();
1205 combo_language->deactivate();
1206 fl_set_object_label(dialog_->text_warning,
1207 _("Document is read-only."
1208 " No changes to layout permitted."));
1209 fl_show_object(dialog_->text_warning);
1211 combo_doc_class->activate();
1212 combo_language->activate();
1213 fl_hide_object(dialog_->text_warning);
1218 bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
1224 // this has to be all out of if/elseif because it has to deactivate
1225 // the document buttons and so the whole stuff has to be tested again.
1226 // disable OK/Apply if input is not valid
1227 str = fl_get_input(class_->input_doc_skip);
1228 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1229 str = fl_get_input(paper_->input_custom_width);
1230 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1231 str = fl_get_input(paper_->input_custom_height);
1232 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1233 str = fl_get_input(paper_->input_outer_margin);
1234 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1235 str = fl_get_input(paper_->input_inner_margin);
1236 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1237 str = fl_get_input(paper_->input_top_margin);
1238 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1239 str = fl_get_input(paper_->input_bottom_margin);
1240 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1241 str = fl_get_input(paper_->input_head_height);
1242 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1243 str = fl_get_input(paper_->input_head_sep);
1244 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1245 str = fl_get_input(paper_->input_foot_skip);
1246 ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
1248 //display warning if input is not valid
1249 if (ob == class_->input_doc_skip
1250 || ob == paper_->input_custom_width
1251 || ob == paper_->input_custom_height
1252 || ob == paper_->input_outer_margin
1253 || ob == paper_->input_inner_margin
1254 || ob == paper_->input_top_margin
1255 || ob == paper_->input_bottom_margin
1256 || ob == paper_->input_head_height
1257 || ob == paper_->input_head_sep
1258 || ob == paper_->input_foot_skip) {
1260 fl_set_object_label(dialog_->text_warning,
1261 _("Warning: Invalid Length (valid example: 10mm)"));
1262 fl_show_object(dialog_->text_warning);
1265 fl_hide_object(dialog_->text_warning);
1270 // "Synchronize" the choice and the input field, so that it
1271 // is impossible to commit senseless data.
1272 input = fl_get_input (class_->input_doc_skip);
1273 if ((fl_get_choice(class_->choice_doc_skip) == 4) && !*input)
1275 else if (fl_get_choice(class_->choice_doc_skip) != 4)
1276 fl_set_input (class_->input_doc_skip, "");
1278 input = fl_get_input(class_->input_doc_spacing);
1279 if ((fl_get_choice(class_->choice_doc_spacing) == 4) && !*input)
1281 else if (fl_get_choice(class_->choice_doc_spacing) != 4)
1282 fl_set_input (class_->input_doc_spacing, "");
1287 void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
1289 BufferParams & param = lv_->buffer()->params;
1291 // convert from 1-6 range to -1-4
1292 param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
1293 fl_set_input(bullets_->input_bullet_latex,
1294 param.temp_bullets[current_bullet_depth].getText().c_str());
1298 void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
1300 BufferParams & param = lv_->buffer()->params;
1302 param.temp_bullets[current_bullet_depth].
1303 setText(fl_get_input(bullets_->input_bullet_latex));
1307 void FormDocument::BulletDepth(FL_OBJECT * ob, State cb)
1309 /* Should I do the following: */
1310 /* 1. change to the panel that the current bullet belongs in */
1311 /* 2. show that bullet as selected */
1312 /* 3. change the size setting to the size of the bullet in Q.*/
1313 /* 4. display the latex equivalent in the latex box */
1315 /* I'm inclined to just go with 3 and 4 at the moment and */
1316 /* maybe try to support the others later */
1317 BufferParams & param = lv_->buffer()->params;
1320 if (cb == BULLETDEPTH1)
1322 else if (cb == BULLETDEPTH2)
1324 else if (cb == BULLETDEPTH3)
1326 else if (cb == BULLETDEPTH4)
1329 switch (fl_get_button_numb(ob)) {
1331 // right mouse button resets to default
1332 param.temp_bullets[data] = ITEMIZE_DEFAULTS[data];
1334 current_bullet_depth = data;
1335 fl_set_input(bullets_->input_bullet_latex,
1336 param.temp_bullets[data].getText().c_str());
1337 fl_set_choice(bullets_->choice_bullet_size,
1338 param.temp_bullets[data].getSize() + 2);
1343 void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
1345 /* Here we have to change the background pixmap to that selected */
1346 /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */
1349 if (cb == BULLETPANEL1)
1351 else if (cb == BULLETPANEL2)
1353 else if (cb == BULLETPANEL3)
1355 else if (cb == BULLETPANEL4)
1357 else if (cb == BULLETPANEL5)
1359 else if (cb == BULLETPANEL6)
1362 if (data != current_bullet_panel) {
1363 fl_freeze_form(bullets_->form);
1364 current_bullet_panel = data;
1366 /* free the current pixmap */
1367 fl_free_bmtable_pixmap(bullets_->bmtable_bullet_panel);
1370 /* display the new one */
1372 new_panel = "standard";
1375 new_panel = "amssymb";
1378 new_panel = "psnfss1";
1381 new_panel = "psnfss2";
1384 new_panel = "psnfss3";
1387 new_panel = "psnfss4";
1390 /* something very wrong happened */
1391 // play it safe for now but should be an exception
1392 current_bullet_panel = 0; // standard panel
1393 new_panel = "standard";
1396 new_panel += ".xpm";
1397 fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6,
1398 LibFileSearch("images", new_panel).c_str());
1399 fl_redraw_object(bullets_->bmtable_bullet_panel);
1400 fl_unfreeze_form(bullets_->form);
1405 void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/)
1407 /* handle the user input by setting the current bullet depth's pixmap */
1408 /* to that extracted from the current chosen position of the BMTable */
1409 /* Don't forget to free the button's old pixmap first. */
1411 BufferParams & param = lv_->buffer()->params;
1412 int bmtable_button = fl_get_bmtable(ob);
1414 /* try to keep the button held down till another is pushed */
1415 /* fl_set_bmtable(ob, 1, bmtable_button); */
1416 param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
1417 param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
1418 fl_set_input(bullets_->input_bullet_latex,
1419 param.temp_bullets[current_bullet_depth].getText().c_str());
1423 void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
1426 ob = class_->choice_doc_class;
1428 lv_->prohibitInput();
1430 unsigned int tc = combo_doc_class->get() - 1;
1431 if (textclasslist[tc].load()) {
1432 // we use a copy of the bufferparams because we do not
1433 // want to modify them yet.
1434 BufferParams params = lv_->buffer()->params;
1436 if (lyxrc.auto_reset_options) {
1437 params.textclass = tc;
1438 params.useClassDefaults();
1439 UpdateLayoutDocument(params);
1442 // unable to load new style
1443 Alert::alert(_("Conversion Errors!"),
1444 _("Unable to switch to new document class."),
1445 _("Reverting to original document class."));
1446 combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
1452 void FormDocument::UpdateLayoutDocument(BufferParams const & params)
1458 class_update(params);
1459 paper_update(params);
1460 language_update(params);
1461 options_update(params);
1462 bullets_update(params);