From afb64cfd0181244a73bdfbc79a0632266cc80b9d Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 3 Oct 2001 16:31:10 +0000 Subject: [PATCH] =?utf8?q?J=EF=BF=BDrgen=20Spitzm=EF=BF=BDller's=20changes?= =?utf8?q?=20to=20the=20document=20dialog.=20Please=20test=20hard!!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2838 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 8 + src/frontends/xforms/FormDocument.C | 1565 ++++++++++--------- src/frontends/xforms/form_document.C | 63 +- src/frontends/xforms/forms/form_document.fd | 234 +-- 4 files changed, 946 insertions(+), 924 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 3bc5164672..b6ac753a71 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,11 @@ +2001-10-03 Jürgen Spitzmüller + + * forms/form_document.fd: rearrangement of the paper tab; + rename "use geometry" to "custom margins/sizes". + + * FormDocument.C: add code to avoid the input of senseless data + in document -> paper. + 2001-10-01 Jürgen Spitzmüller * FormDocument.C: Disable choice "Special" if landscape diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index ddfeb59551..660ef36229 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -52,10 +52,10 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d) ActCell(0), Confirmed(0), current_bullet_panel(0), current_bullet_depth(0), fbullet(0) { - // let the dialog be shown - // This is a permanent connection so we won't bother - // storing a copy because we won't be disconnecting. - d->showDocument.connect(slot(this, &FormDocument::show)); + // let the dialog be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showDocument.connect(slot(this, &FormDocument::show)); } @@ -74,256 +74,254 @@ void FormDocument::redraw() FL_FORM * FormDocument::form() const { - if (dialog_.get()) return dialog_->form; - return 0; + if (dialog_.get()) return dialog_->form; + return 0; } void FormDocument::build() { - int n; - - // the tabbed folder - dialog_.reset(build_tabbed_document()); - - // Manage the restore, ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_cancel); - bc().setRestore(dialog_->button_restore); - bc().addReadOnly (dialog_->button_save_defaults); - bc().addReadOnly (dialog_->button_reset_defaults); - - // the document paper form - paper_.reset(build_doc_paper()); - fl_addto_choice(paper_->choice_papersize2, - _(" Default | Custom | USletter | USlegal " - "| USexecutive | A3 | A4 | A5 | B3 | B4 | B5 ")); - fl_addto_choice(paper_->choice_paperpackage, - _(" None " - "| A4 small Margins (only portrait) " - "| A4 very small Margins (only portrait) " - "| A4 very wide margins (only portrait) ")); - setEnabled(paper_->choice_paperpackage, true); - - fl_set_input_return(paper_->input_custom_width, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_custom_height, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_top_margin, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_bottom_margin, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_left_margin, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_right_margin, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_head_height, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_head_sep, FL_RETURN_CHANGED); - fl_set_input_return(paper_->input_foot_skip, FL_RETURN_CHANGED); - - bc().addReadOnly (paper_->choice_paperpackage); - bc().addReadOnly (paper_->greoup_radio_orientation); - bc().addReadOnly (paper_->radio_portrait); - bc().addReadOnly (paper_->radio_landscape); - bc().addReadOnly (paper_->choice_papersize2); - bc().addReadOnly (paper_->push_use_geometry); - bc().addReadOnly (paper_->input_custom_width); - bc().addReadOnly (paper_->input_custom_height); - bc().addReadOnly (paper_->input_top_margin); - bc().addReadOnly (paper_->input_bottom_margin); - bc().addReadOnly (paper_->input_left_margin); - bc().addReadOnly (paper_->input_right_margin); - bc().addReadOnly (paper_->input_head_height); - bc().addReadOnly (paper_->input_head_sep); - bc().addReadOnly (paper_->input_foot_skip); - - // the document class form - class_.reset(build_doc_class()); - - FL_OBJECT * obj; - // The language is a combo-box and has to be inserted manually - obj = class_->choice_doc_class; - fl_deactivate_object(obj); - fl_addto_form(class_->form); - combo_doc_class.reset(new Combox(FL_COMBOX_DROPLIST)); - combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400, - dialog_->tabbed_folder); - combo_doc_class->shortcut("#C",1); - combo_doc_class->setcallback(ComboInputCB, this); - fl_end_form(); - for (LyXTextClassList::const_iterator cit = textclasslist.begin(); - cit != textclasslist.end(); ++cit) - { - combo_doc_class->addto(cit->description()); - } - - fl_addto_choice(class_->choice_doc_spacing, - _(" Single | OneHalf | Double | Other ")); - fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12"); - for (n=0; tex_fonts[n][0]; ++n) { - fl_addto_choice(class_->choice_doc_fonts,tex_fonts[n]); - } - fl_addto_choice(class_->choice_doc_pagestyle, - "default|empty|plain|headings|fancy"); - fl_addto_choice(class_->choice_doc_skip, - _(" Smallskip | Medskip | Bigskip | Length ")); - fl_set_input_return(class_->input_doc_extra, FL_RETURN_CHANGED); - fl_set_input_return(class_->input_doc_skip, FL_RETURN_CHANGED); - fl_set_input_return(class_->input_doc_spacing, FL_RETURN_CHANGED); - - bc().addReadOnly (class_->radio_doc_indent); - bc().addReadOnly (class_->radio_doc_skip); - - bc().addReadOnly (class_->choice_doc_pagestyle); - bc().addReadOnly (class_->choice_doc_fonts); - bc().addReadOnly (class_->choice_doc_fontsize); - bc().addReadOnly (class_->radio_doc_sides_one); - bc().addReadOnly (class_->radio_doc_sides_two); - bc().addReadOnly (class_->radio_doc_columns_one); - bc().addReadOnly (class_->radio_doc_columns_two); - bc().addReadOnly (class_->input_doc_extra); - bc().addReadOnly (class_->input_doc_skip); - bc().addReadOnly (class_->choice_doc_skip); - bc().addReadOnly (class_->choice_doc_spacing); - bc().addReadOnly (class_->input_doc_spacing); - - - // the document language form - language_.reset(build_doc_language()); - fl_addto_choice(language_->choice_inputenc, - "default|auto|latin1|latin2|latin5|latin9" - "|koi8-r|koi8-u|cp866|cp1251|iso88595"); - - // The language is a combo-box and has to be inserted manually - obj = language_->choice_language; - fl_deactivate_object(obj); - fl_addto_form(language_->form); - combo_language.reset(new Combox(FL_COMBOX_DROPLIST)); - combo_language->add(obj->x, obj->y, obj->w, obj->h, 400, - dialog_->tabbed_folder); - combo_language->shortcut("#L",1); - combo_language->setcallback(ComboInputCB, this); - fl_end_form(); - - for (Languages::const_iterator cit = languages.begin(); - cit != languages.end(); ++cit) { - combo_language->addto(cit->second.lang()); - } - - fl_addto_choice(language_->choice_quotes_language, - _(" ``text'' | ''text'' | ,,text`` | ,,text'' |" - " «text» | »text« ")); - - bc().addReadOnly (language_->choice_inputenc); - bc().addReadOnly (language_->choice_quotes_language); - bc().addReadOnly (language_->radio_single); - bc().addReadOnly (language_->radio_double); - - // the document options form - options_.reset(build_doc_options()); - fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED); - fl_set_counter_bounds(options_->slider_secnumdepth,-2,5); - fl_set_counter_bounds(options_->slider_tocdepth,-1,5); - fl_set_counter_step(options_->slider_secnumdepth,1,1); - fl_set_counter_step(options_->slider_tocdepth,1,1); - fl_set_counter_precision(options_->slider_secnumdepth, 0); - fl_set_counter_precision(options_->slider_tocdepth, 0); - for (n=0; tex_graphics[n][0]; ++n) { - fl_addto_choice(options_->choice_postscript_driver, tex_graphics[n]); - } - fl_addto_choice(options_->choice_citation_format, - _(" Author-year | Numerical ")); - - bc_.addReadOnly (options_->slider_secnumdepth); - bc_.addReadOnly (options_->slider_tocdepth); - bc_.addReadOnly (options_->check_use_amsmath); - bc_.addReadOnly (options_->check_use_natbib); - bc_.addReadOnly (options_->choice_citation_format); - bc_.addReadOnly (options_->input_float_placement); - bc_.addReadOnly (options_->choice_postscript_driver); - - // the document bullets form - bullets_.reset(build_doc_bullet()); - fl_addto_choice(bullets_->choice_bullet_size, - _(" default | tiny | script | footnote | small |" - " normal | large | Large | LARGE | huge | Huge")); - fl_set_choice(bullets_->choice_bullet_size, 1); - fl_set_input_return(bullets_->input_bullet_latex, FL_RETURN_CHANGED); - fl_set_input_maxchars(bullets_->input_bullet_latex, 80); - - bc().addReadOnly (bullets_->bmtable_bullet_panel); - bc().addReadOnly (bullets_->choice_bullet_size); - bc().addReadOnly (bullets_->input_bullet_latex); - bc().addReadOnly (bullets_->radio_bullet_depth); - bc().addReadOnly (bullets_->radio_bullet_panel); - - fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"), - class_->form); - fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"), - paper_->form); - fl_addto_tabfolder(dialog_->tabbed_folder,_("Language"), - language_->form); - fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), - options_->form); - fbullet = fl_addto_tabfolder(dialog_->tabbed_folder,_("Bullets"), - bullets_->form); - if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) { - lyxerr << _("Your version of libXpm is older than 4.7.\n" - "The `bullet' tab of the document dialog " - "has been disabled") << '\n'; - fl_deactivate_object(fbullet); - fl_set_object_lcol(fbullet, FL_INACTIVE); - } + int n; + + // the tabbed folder + dialog_.reset(build_tabbed_document()); + + // Manage the restore, ok, apply, restore and cancel/close buttons + bc().setOK(dialog_->button_ok); + bc().setApply(dialog_->button_apply); + bc().setCancel(dialog_->button_cancel); + bc().setRestore(dialog_->button_restore); + bc().addReadOnly (dialog_->button_save_defaults); + bc().addReadOnly (dialog_->button_reset_defaults); + + // the document paper form + paper_.reset(build_doc_paper()); + fl_addto_choice(paper_->choice_papersize2, + _(" Default | Custom | USletter | USlegal " + "| USexecutive | A3 | A4 | A5 | B3 | B4 | B5 ")); + fl_addto_choice(paper_->choice_paperpackage, + _(" None " + "| Small Margins " + "| Very small Margins " + "| Very wide Margins ")); + + fl_set_input_return(paper_->input_custom_width, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_custom_height, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_top_margin, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_bottom_margin, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_left_margin, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_right_margin, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_head_height, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_head_sep, FL_RETURN_CHANGED); + fl_set_input_return(paper_->input_foot_skip, FL_RETURN_CHANGED); + + bc().addReadOnly (paper_->choice_paperpackage); + bc().addReadOnly (paper_->greoup_radio_orientation); + bc().addReadOnly (paper_->radio_portrait); + bc().addReadOnly (paper_->radio_landscape); + bc().addReadOnly (paper_->choice_papersize2); + bc().addReadOnly (paper_->push_use_geometry); + bc().addReadOnly (paper_->input_custom_width); + bc().addReadOnly (paper_->input_custom_height); + bc().addReadOnly (paper_->input_top_margin); + bc().addReadOnly (paper_->input_bottom_margin); + bc().addReadOnly (paper_->input_left_margin); + bc().addReadOnly (paper_->input_right_margin); + bc().addReadOnly (paper_->input_head_height); + bc().addReadOnly (paper_->input_head_sep); + bc().addReadOnly (paper_->input_foot_skip); + + // the document class form + class_.reset(build_doc_class()); + + FL_OBJECT * obj; + // The language is a combo-box and has to be inserted manually + obj = class_->choice_doc_class; + fl_deactivate_object(obj); + fl_addto_form(class_->form); + combo_doc_class.reset(new Combox(FL_COMBOX_DROPLIST)); + combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400, + dialog_->tabbed_folder); + combo_doc_class->shortcut("#C",1); + combo_doc_class->setcallback(ComboInputCB, this); + fl_end_form(); + for (LyXTextClassList::const_iterator cit = textclasslist.begin(); + cit != textclasslist.end(); ++cit) { + combo_doc_class->addto(cit->description()); + } + + fl_addto_choice(class_->choice_doc_spacing, + _(" Single | OneHalf | Double | Other ")); + fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12"); + for (n=0; tex_fonts[n][0]; ++n) { + fl_addto_choice(class_->choice_doc_fonts,tex_fonts[n]); + } + fl_addto_choice(class_->choice_doc_pagestyle, + "default|empty|plain|headings|fancy"); + fl_addto_choice(class_->choice_doc_skip, + _(" Smallskip | Medskip | Bigskip | Length ")); + fl_set_input_return(class_->input_doc_extra, FL_RETURN_CHANGED); + fl_set_input_return(class_->input_doc_skip, FL_RETURN_CHANGED); + fl_set_input_return(class_->input_doc_spacing, FL_RETURN_CHANGED); + + bc().addReadOnly (class_->radio_doc_indent); + bc().addReadOnly (class_->radio_doc_skip); + + bc().addReadOnly (class_->choice_doc_pagestyle); + bc().addReadOnly (class_->choice_doc_fonts); + bc().addReadOnly (class_->choice_doc_fontsize); + bc().addReadOnly (class_->radio_doc_sides_one); + bc().addReadOnly (class_->radio_doc_sides_two); + bc().addReadOnly (class_->radio_doc_columns_one); + bc().addReadOnly (class_->radio_doc_columns_two); + bc().addReadOnly (class_->input_doc_extra); + bc().addReadOnly (class_->input_doc_skip); + bc().addReadOnly (class_->choice_doc_skip); + bc().addReadOnly (class_->choice_doc_spacing); + bc().addReadOnly (class_->input_doc_spacing); + + // the document language form + language_.reset(build_doc_language()); + fl_addto_choice(language_->choice_inputenc, + "default|auto|latin1|latin2|latin5|latin9" + "|koi8-r|koi8-u|cp866|cp1251|iso88595"); + + // The language is a combo-box and has to be inserted manually + obj = language_->choice_language; + fl_deactivate_object(obj); + fl_addto_form(language_->form); + combo_language.reset(new Combox(FL_COMBOX_DROPLIST)); + combo_language->add(obj->x, obj->y, obj->w, obj->h, 400, + dialog_->tabbed_folder); + combo_language->shortcut("#L",1); + combo_language->setcallback(ComboInputCB, this); + fl_end_form(); + + for (Languages::const_iterator cit = languages.begin(); + cit != languages.end(); ++cit) { + combo_language->addto(cit->second.lang()); + } + + fl_addto_choice(language_->choice_quotes_language, + _(" ``text'' | ''text'' | ,,text`` | ,,text'' |" + " «text» | »text« ")); + + bc().addReadOnly (language_->choice_inputenc); + bc().addReadOnly (language_->choice_quotes_language); + bc().addReadOnly (language_->radio_single); + bc().addReadOnly (language_->radio_double); + + // the document options form + options_.reset(build_doc_options()); + fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED); + fl_set_counter_bounds(options_->slider_secnumdepth,-2,5); + fl_set_counter_bounds(options_->slider_tocdepth,-1,5); + fl_set_counter_step(options_->slider_secnumdepth,1,1); + fl_set_counter_step(options_->slider_tocdepth,1,1); + fl_set_counter_precision(options_->slider_secnumdepth, 0); + fl_set_counter_precision(options_->slider_tocdepth, 0); + for (n=0; tex_graphics[n][0]; ++n) { + fl_addto_choice(options_->choice_postscript_driver, + tex_graphics[n]); + } + fl_addto_choice(options_->choice_citation_format, + _(" Author-year | Numerical ")); + + bc_.addReadOnly (options_->slider_secnumdepth); + bc_.addReadOnly (options_->slider_tocdepth); + bc_.addReadOnly (options_->check_use_amsmath); + bc_.addReadOnly (options_->check_use_natbib); + bc_.addReadOnly (options_->choice_citation_format); + bc_.addReadOnly (options_->input_float_placement); + bc_.addReadOnly (options_->choice_postscript_driver); + + // the document bullets form + bullets_.reset(build_doc_bullet()); + fl_addto_choice(bullets_->choice_bullet_size, + _(" default | tiny | script | footnote | small |" + " normal | large | Large | LARGE | huge | Huge")); + fl_set_choice(bullets_->choice_bullet_size, 1); + fl_set_input_return(bullets_->input_bullet_latex, FL_RETURN_CHANGED); + fl_set_input_maxchars(bullets_->input_bullet_latex, 80); + + bc().addReadOnly (bullets_->bmtable_bullet_panel); + bc().addReadOnly (bullets_->choice_bullet_size); + bc().addReadOnly (bullets_->input_bullet_latex); + bc().addReadOnly (bullets_->radio_bullet_depth); + bc().addReadOnly (bullets_->radio_bullet_panel); + + fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"), + class_->form); + fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"), + paper_->form); + fl_addto_tabfolder(dialog_->tabbed_folder,_("Language"), + language_->form); + fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), + options_->form); + fbullet = fl_addto_tabfolder(dialog_->tabbed_folder,_("Bullets"), + bullets_->form); + if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) { + lyxerr << _("Your version of libXpm is older than 4.7.\n" + "The `bullet' tab of the document dialog " + "has been disabled") << '\n'; + fl_deactivate_object(fbullet); + fl_set_object_lcol(fbullet, FL_INACTIVE); + } } void FormDocument::apply() { - if (!lv_->view()->available() || !dialog_.get()) - return; - - bool redo = class_apply(); - paper_apply(); - redo = language_apply() || redo; - redo = options_apply() || redo; - bullets_apply(); - - if (redo) { - lv_->view()->redoCurrentBuffer(); - } - lv_->buffer()->markDirty(); - setMinibuffer(lv_, _("Document layout set")); + if (!lv_->view()->available() || !dialog_.get()) + return; + + bool redo = class_apply(); + paper_apply(); + redo = language_apply() || redo; + redo = options_apply() || redo; + bullets_apply(); + + if (redo) { + lv_->view()->redoCurrentBuffer(); + } + lv_->buffer()->markDirty(); + setMinibuffer(lv_, _("Document layout set")); } void FormDocument::cancel() { - // this avoids confusion when reopening - BufferParams & param = lv_->buffer()->params; - param.temp_bullets[0] = param.user_defined_bullets[0]; - param.temp_bullets[1] = param.user_defined_bullets[1]; - param.temp_bullets[2] = param.user_defined_bullets[2]; - param.temp_bullets[3] = param.user_defined_bullets[3]; - hide(); + // this avoids confusion when reopening + BufferParams & param = lv_->buffer()->params; + param.temp_bullets[0] = param.user_defined_bullets[0]; + param.temp_bullets[1] = param.user_defined_bullets[1]; + param.temp_bullets[2] = param.user_defined_bullets[2]; + param.temp_bullets[3] = param.user_defined_bullets[3]; + hide(); } void FormDocument::update() { - if (!dialog_.get()) - return; + if (!dialog_.get()) + return; - checkReadOnly(); + checkReadOnly(); - BufferParams const & params = lv_->buffer()->params; + BufferParams const & params = lv_->buffer()->params; - fl_set_object_label(dialog_->button_save_defaults, - _("Save as Defaults")); - fl_set_object_label(dialog_->button_reset_defaults, - _("Reset")); - setEnabled(dialog_->button_reset_defaults, - !params.hasClassDefaults()); +// fl_set_object_label(dialog_->button_save_defaults, +// _("Save as Defaults")); +// fl_set_object_label(dialog_->button_reset_defaults, +// _("Use Class Defaults")); + setEnabled(dialog_->button_reset_defaults, + !params.hasClassDefaults()); - class_update(params); - paper_update(params); - language_update(params); - options_update(params); - bullets_update(params); + class_update(params); + paper_update(params); + language_update(params); + options_update(params); + bullets_update(params); } @@ -378,10 +376,78 @@ bool FormDocument::input( FL_OBJECT * ob, long data ) UpdateLayoutDocument(params); } + if (ob == paper_->radio_landscape) + fl_set_choice(paper_->choice_paperpackage, + BufferParams::PACKAGE_NONE + 1); + + if (ob == paper_->choice_papersize2) { + if (fl_get_choice(paper_->choice_papersize2) == 2) + fl_set_button(paper_->radio_portrait, 1); + setEnabled(paper_->input_custom_width, + fl_get_choice(paper_->choice_papersize2) == 2); + setEnabled(paper_->input_custom_height, + fl_get_choice(paper_->choice_papersize2) == 2); + setEnabled(paper_->radio_portrait, + fl_get_choice(paper_->choice_papersize2) != 2); + setEnabled(paper_->radio_landscape, + fl_get_choice(paper_->choice_papersize2) != 2); + } - setEnabled(dialog_->button_reset_defaults, - lv_->buffer()->params.hasClassDefaults()); + if (ob == paper_->choice_papersize2 + || paper_->radio_portrait + || paper_->radio_landscape) + setEnabled(paper_->choice_paperpackage, + //either default papersize (preferences) + //or document papersize has to be A4 + (fl_get_choice(paper_->choice_papersize2) == 7 + || fl_get_choice(paper_->choice_papersize2) == 1 + && lyxrc.default_papersize == 5) + && fl_get_button(paper_->radio_portrait)); + + if (ob == paper_->choice_paperpackage) { + if (fl_get_choice(paper_->choice_paperpackage) != 1) { + fl_set_button(paper_->push_use_geometry, 0); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + } + } + + if (ob == paper_->push_use_geometry) { + //don't allow switching geometry off in custom papersize mode + if (fl_get_choice(paper_->choice_papersize2) == 2) + fl_set_button(paper_->push_use_geometry, 1); + fl_set_choice(paper_->choice_paperpackage, + BufferParams::PACKAGE_NONE + 1); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + } + setEnabled(dialog_->button_reset_defaults, + lv_->buffer()->params.hasClassDefaults()); switch (data) { case INPUT: @@ -400,10 +466,10 @@ bool FormDocument::input( FL_OBJECT * ob, long data ) void FormDocument::ComboInputCB(int, void * v, Combox * combox) { - FormDocument * pre = static_cast(v); - if (combox == pre->combo_doc_class.get()) - pre->CheckChoiceClass(0, 0); - pre->bc().valid(pre->CheckDocumentInput(0,0)); + FormDocument * pre = static_cast(v); + if (combox == pre->combo_doc_class.get()) + pre->CheckChoiceClass(0, 0); + pre->bc().valid(pre->CheckDocumentInput(0,0)); } @@ -431,8 +497,8 @@ bool FormDocument::class_apply() redo = true; setMinibuffer(lv_, _("Converting document to new document class...")); int ret = CutAndPaste::SwitchLayoutsBetweenClasses( - params.textclass, new_class, - lv_->buffer()->paragraph); + params.textclass, new_class, + lv_->buffer()->paragraph); if (ret) { string s; if (ret==1) { @@ -525,314 +591,347 @@ bool FormDocument::class_apply() void FormDocument::paper_apply() { - BufferParams & params = lv_->buffer()->params; - - params.papersize2 = - static_cast(fl_get_choice(paper_->choice_papersize2)-1); - params.paperpackage = - static_cast(fl_get_choice(paper_->choice_paperpackage)-1); - params.use_geometry = fl_get_button(paper_->push_use_geometry); - if (fl_get_button(paper_->radio_landscape)) - params.orientation = BufferParams::ORIENTATION_LANDSCAPE; - else - params.orientation = BufferParams::ORIENTATION_PORTRAIT; - params.paperwidth = fl_get_input(paper_->input_custom_width); - params.paperheight = fl_get_input(paper_->input_custom_height); - params.leftmargin = fl_get_input(paper_->input_left_margin); - params.topmargin = fl_get_input(paper_->input_top_margin); - params.rightmargin = fl_get_input(paper_->input_right_margin); - params.bottommargin = fl_get_input(paper_->input_bottom_margin); - params.headheight = fl_get_input(paper_->input_head_height); - params.headsep = fl_get_input(paper_->input_head_sep); - params.footskip = fl_get_input(paper_->input_foot_skip); - lv_->buffer()->setPaperStuff(); + BufferParams & params = lv_->buffer()->params; + + params.papersize2 = + static_cast(fl_get_choice(paper_->choice_papersize2)-1); + params.paperpackage = + static_cast(fl_get_choice(paper_->choice_paperpackage)-1); + params.use_geometry = fl_get_button(paper_->push_use_geometry); + if (fl_get_button(paper_->radio_landscape)) + params.orientation = BufferParams::ORIENTATION_LANDSCAPE; + else + params.orientation = BufferParams::ORIENTATION_PORTRAIT; + params.paperwidth = fl_get_input(paper_->input_custom_width); + params.paperheight = fl_get_input(paper_->input_custom_height); + params.leftmargin = fl_get_input(paper_->input_left_margin); + params.topmargin = fl_get_input(paper_->input_top_margin); + params.rightmargin = fl_get_input(paper_->input_right_margin); + params.bottommargin = fl_get_input(paper_->input_bottom_margin); + params.headheight = fl_get_input(paper_->input_head_height); + params.headsep = fl_get_input(paper_->input_head_sep); + params.footskip = fl_get_input(paper_->input_foot_skip); + lv_->buffer()->setPaperStuff(); } bool FormDocument::language_apply() { - BufferParams & params = lv_->buffer()->params; - InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; - bool redo = false; - - switch (fl_get_choice(language_->choice_quotes_language) - 1) { - case 0: - lga = InsetQuotes::EnglishQ; - break; - case 1: - lga = InsetQuotes::SwedishQ; - break; - case 2: - lga = InsetQuotes::GermanQ; - break; - case 3: - lga = InsetQuotes::PolishQ; + BufferParams & params = lv_->buffer()->params; + InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; + bool redo = false; + + switch (fl_get_choice(language_->choice_quotes_language) - 1) { + case 0: + lga = InsetQuotes::EnglishQ; break; - case 4: - lga = InsetQuotes::FrenchQ; - break; - case 5: - lga = InsetQuotes::DanishQ; - break; - } - params.quotes_language = lga; - if (fl_get_button(language_->radio_single)) - params.quotes_times = InsetQuotes::SingleQ; - else - params.quotes_times = InsetQuotes::DoubleQ; - - Language const * old_language = params.language; - Language const * new_language = - languages.getLanguage(combo_language->getline()); - if (!new_language) - new_language = default_language; - - if (old_language != new_language - && old_language->RightToLeft() == new_language->RightToLeft() - && !lv_->buffer()->isMultiLingual()) - lv_->buffer()->changeLanguage(old_language, new_language); - if (old_language != new_language) { - redo = true; - } - params.language = new_language; - params.inputenc = fl_get_choice_text(language_->choice_inputenc); - - return redo; + case 1: + lga = InsetQuotes::SwedishQ; + break; + case 2: + lga = InsetQuotes::GermanQ; + break; + case 3: + lga = InsetQuotes::PolishQ; + break; + case 4: + lga = InsetQuotes::FrenchQ; + break; + case 5: + lga = InsetQuotes::DanishQ; + break; + } + params.quotes_language = lga; + if (fl_get_button(language_->radio_single)) + params.quotes_times = InsetQuotes::SingleQ; + else + params.quotes_times = InsetQuotes::DoubleQ; + + Language const * old_language = params.language; + Language const * new_language = + languages.getLanguage(combo_language->getline()); + if (!new_language) + new_language = default_language; + + if (old_language != new_language + && old_language->RightToLeft() == new_language->RightToLeft() + && !lv_->buffer()->isMultiLingual()) + lv_->buffer()->changeLanguage(old_language, new_language); + if (old_language != new_language) { + redo = true; + } + params.language = new_language; + params.inputenc = fl_get_choice_text(language_->choice_inputenc); + + return redo; } bool FormDocument::options_apply() { - BufferParams & params = lv_->buffer()->params; - bool redo = false; - - params.graphicsDriver = - fl_get_choice_text(options_->choice_postscript_driver); - params.use_amsmath = fl_get_button(options_->check_use_amsmath); - params.use_natbib = fl_get_button(options_->check_use_natbib); - params.use_numerical_citations = - fl_get_choice(options_->choice_citation_format)-1; - - int tmpchar = int(fl_get_counter_value(options_->slider_secnumdepth)); - if (params.secnumdepth != tmpchar) - redo = true; - params.secnumdepth = tmpchar; + BufferParams & params = lv_->buffer()->params; + bool redo = false; + + params.graphicsDriver = + fl_get_choice_text(options_->choice_postscript_driver); + params.use_amsmath = fl_get_button(options_->check_use_amsmath); + params.use_natbib = fl_get_button(options_->check_use_natbib); + params.use_numerical_citations = + fl_get_choice(options_->choice_citation_format)-1; + + int tmpchar = int(fl_get_counter_value(options_->slider_secnumdepth)); + if (params.secnumdepth != tmpchar) + redo = true; + params.secnumdepth = tmpchar; - params.tocdepth = int(fl_get_counter_value(options_->slider_tocdepth)); + params.tocdepth = int(fl_get_counter_value(options_->slider_tocdepth)); - params.float_placement = - fl_get_input(options_->input_float_placement); + params.float_placement = + fl_get_input(options_->input_float_placement); - return redo; + return redo; } void FormDocument::bullets_apply() { - /* update the bullet settings */ - BufferParams & param = lv_->buffer()->params; - - // a little bit of loop unrolling - param.user_defined_bullets[0] = param.temp_bullets[0]; - param.user_defined_bullets[1] = param.temp_bullets[1]; - param.user_defined_bullets[2] = param.temp_bullets[2]; - param.user_defined_bullets[3] = param.temp_bullets[3]; + /* update the bullet settings */ + BufferParams & param = lv_->buffer()->params; + + // a little bit of loop unrolling + param.user_defined_bullets[0] = param.temp_bullets[0]; + param.user_defined_bullets[1] = param.temp_bullets[1]; + param.user_defined_bullets[2] = param.temp_bullets[2]; + param.user_defined_bullets[3] = param.temp_bullets[3]; } void FormDocument::class_update(BufferParams const & params) { - if (!class_.get()) - return; - - LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); - - combo_doc_class->select( - textclasslist.DescOfClass(params.textclass)); - fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str()); - fl_clear_choice(class_->choice_doc_fontsize); - fl_addto_choice(class_->choice_doc_fontsize, "default"); - fl_addto_choice(class_->choice_doc_fontsize, - tclass.opt_fontsize().c_str()); - fl_set_choice(class_->choice_doc_fontsize, - tokenPos(tclass.opt_fontsize(), '|', params.fontsize)+2); - fl_clear_choice(class_->choice_doc_pagestyle); - fl_addto_choice(class_->choice_doc_pagestyle, "default"); - fl_addto_choice(class_->choice_doc_pagestyle, - tclass.opt_pagestyle().c_str()); - fl_set_choice(class_->choice_doc_pagestyle, - tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle)+2); - fl_set_button(class_->radio_doc_indent, 0); - fl_set_button(class_->radio_doc_skip, 0); - if (params.paragraph_separation == BufferParams::PARSEP_INDENT) - fl_set_button(class_->radio_doc_indent, 1); - else - fl_set_button(class_->radio_doc_skip, 1); - switch (params.getDefSkip().kind()) { - case VSpace::SMALLSKIP: - fl_set_choice (class_->choice_doc_skip, 1); - break; - case VSpace::MEDSKIP: - fl_set_choice (class_->choice_doc_skip, 2); - break; - case VSpace::BIGSKIP: - fl_set_choice (class_->choice_doc_skip, 3); - break; - case VSpace::LENGTH: - fl_set_choice (class_->choice_doc_skip, 4); - fl_set_input (class_->input_doc_skip, - params.getDefSkip().asLyXCommand().c_str()); - break; - default: - fl_set_choice (class_->choice_doc_skip, 2); - break; - } - fl_set_button(class_->radio_doc_sides_one, 0); - fl_set_button(class_->radio_doc_sides_two, 0); - if (params.sides == LyXTextClass::TwoSides) - fl_set_button(class_->radio_doc_sides_two, 1); - else - fl_set_button(class_->radio_doc_sides_one, 1); - fl_set_button(class_->radio_doc_columns_one, 0); - fl_set_button(class_->radio_doc_columns_two, 0); - if (params.columns == 2) - fl_set_button(class_->radio_doc_columns_two, 1); - else - fl_set_button(class_->radio_doc_columns_one, 1); - fl_set_input(class_->input_doc_spacing, ""); - switch (params.spacing.getSpace()) { - case Spacing::Default: // nothing bad should happen with this - case Spacing::Single: - // \singlespacing - fl_set_choice(class_->choice_doc_spacing, 1); - break; - case Spacing::Onehalf: - // \onehalfspacing - fl_set_choice(class_->choice_doc_spacing, 2); - break; - case Spacing::Double: - // \doublespacing - fl_set_choice(class_->choice_doc_spacing, 3); - break; - case Spacing::Other: + if (!class_.get()) + return; + + LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); + + combo_doc_class->select( + textclasslist.DescOfClass(params.textclass)); + fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str()); + fl_clear_choice(class_->choice_doc_fontsize); + fl_addto_choice(class_->choice_doc_fontsize, "default"); + fl_addto_choice(class_->choice_doc_fontsize, + tclass.opt_fontsize().c_str()); + fl_set_choice(class_->choice_doc_fontsize, + tokenPos(tclass.opt_fontsize(), '|', params.fontsize)+2); + fl_clear_choice(class_->choice_doc_pagestyle); + fl_addto_choice(class_->choice_doc_pagestyle, "default"); + fl_addto_choice(class_->choice_doc_pagestyle, + tclass.opt_pagestyle().c_str()); + fl_set_choice(class_->choice_doc_pagestyle, + tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle)+2); + fl_set_button(class_->radio_doc_indent, 0); + fl_set_button(class_->radio_doc_skip, 0); + if (params.paragraph_separation == BufferParams::PARSEP_INDENT) + fl_set_button(class_->radio_doc_indent, 1); + else + fl_set_button(class_->radio_doc_skip, 1); + switch (params.getDefSkip().kind()) { + case VSpace::SMALLSKIP: + fl_set_choice (class_->choice_doc_skip, 1); + break; + case VSpace::MEDSKIP: + fl_set_choice (class_->choice_doc_skip, 2); + break; + case VSpace::BIGSKIP: + fl_set_choice (class_->choice_doc_skip, 3); + break; + case VSpace::LENGTH: + fl_set_choice (class_->choice_doc_skip, 4); + fl_set_input (class_->input_doc_skip, + params.getDefSkip().asLyXCommand().c_str()); + break; + default: + fl_set_choice (class_->choice_doc_skip, 2); + break; + } + fl_set_button(class_->radio_doc_sides_one, 0); + fl_set_button(class_->radio_doc_sides_two, 0); + if (params.sides == LyXTextClass::TwoSides) + fl_set_button(class_->radio_doc_sides_two, 1); + else + fl_set_button(class_->radio_doc_sides_one, 1); + fl_set_button(class_->radio_doc_columns_one, 0); + fl_set_button(class_->radio_doc_columns_two, 0); + if (params.columns == 2) + fl_set_button(class_->radio_doc_columns_two, 1); + else + fl_set_button(class_->radio_doc_columns_one, 1); + fl_set_input(class_->input_doc_spacing, ""); + switch (params.spacing.getSpace()) { + case Spacing::Default: // nothing bad should happen with this + case Spacing::Single: + // \singlespacing + fl_set_choice(class_->choice_doc_spacing, 1); + break; + case Spacing::Onehalf: + // \onehalfspacing + fl_set_choice(class_->choice_doc_spacing, 2); + break; + case Spacing::Double: + // \doublespacing + fl_set_choice(class_->choice_doc_spacing, 3); + break; + case Spacing::Other: { - fl_set_choice(class_->choice_doc_spacing, 4); - char sval[20]; - sprintf(sval,"%g",params.spacing.getValue()); - fl_set_input(class_->input_doc_spacing, sval); - break; + fl_set_choice(class_->choice_doc_spacing, 4); + char sval[20]; + sprintf(sval,"%g",params.spacing.getValue()); + fl_set_input(class_->input_doc_spacing, sval); + break; + } } - } - if (!params.options.empty()) - fl_set_input(class_->input_doc_extra, params.options.c_str()); - else - fl_set_input(class_->input_doc_extra, ""); + if (!params.options.empty()) + fl_set_input(class_->input_doc_extra, params.options.c_str()); + else + fl_set_input(class_->input_doc_extra, ""); } void FormDocument::language_update(BufferParams const & params) { - if (!language_.get()) - return; - - combo_language->select(params.language->lang()); - fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str()); - fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1); - fl_set_button(language_->radio_single, 0); - fl_set_button(language_->radio_double, 0); - if (params.quotes_times == InsetQuotes::SingleQ) - fl_set_button(language_->radio_single, 1); - else - fl_set_button(language_->radio_double, 1); + if (!language_.get()) + return; + + combo_language->select(params.language->lang()); + fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str()); + fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1); + fl_set_button(language_->radio_single, 0); + fl_set_button(language_->radio_double, 0); + if (params.quotes_times == InsetQuotes::SingleQ) + fl_set_button(language_->radio_single, 1); + else + fl_set_button(language_->radio_double, 1); } void FormDocument::options_update(BufferParams const & params) { - if (!options_.get()) - return; - - fl_set_choice_text(options_->choice_postscript_driver, - params.graphicsDriver.c_str()); - fl_set_button(options_->check_use_amsmath, params.use_amsmath); - fl_set_button(options_->check_use_natbib, params.use_natbib); - fl_set_choice(options_->choice_citation_format, - int(params.use_numerical_citations)+1); - setEnabled(options_->choice_citation_format, params.use_natbib); - fl_set_counter_value(options_->slider_secnumdepth, params.secnumdepth); - fl_set_counter_value(options_->slider_tocdepth, params.tocdepth); - if (!params.float_placement.empty()) - fl_set_input(options_->input_float_placement, - params.float_placement.c_str()); - else - fl_set_input(options_->input_float_placement, ""); + if (!options_.get()) + return; + + fl_set_choice_text(options_->choice_postscript_driver, + params.graphicsDriver.c_str()); + fl_set_button(options_->check_use_amsmath, params.use_amsmath); + fl_set_button(options_->check_use_natbib, params.use_natbib); + fl_set_choice(options_->choice_citation_format, + int(params.use_numerical_citations)+1); + setEnabled(options_->choice_citation_format, params.use_natbib); + fl_set_counter_value(options_->slider_secnumdepth, params.secnumdepth); + fl_set_counter_value(options_->slider_tocdepth, params.tocdepth); + if (!params.float_placement.empty()) + fl_set_input(options_->input_float_placement, + params.float_placement.c_str()); + else + fl_set_input(options_->input_float_placement, ""); } void FormDocument::paper_update(BufferParams const & params) { - if (!paper_.get()) - return; - - fl_set_choice(paper_->choice_papersize2, params.papersize2 + 1); - fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1); - fl_set_button(paper_->push_use_geometry, params.use_geometry); - fl_set_button(paper_->radio_portrait, 0); - fl_set_button(paper_->radio_landscape, 0); - if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE) - fl_set_button(paper_->radio_landscape, 1); - else - fl_set_button(paper_->radio_portrait, 1); - fl_set_input(paper_->input_custom_width, params.paperwidth.c_str()); - fl_set_input(paper_->input_custom_height, params.paperheight.c_str()); - fl_set_input(paper_->input_left_margin, params.leftmargin.c_str()); - fl_set_input(paper_->input_top_margin, params.topmargin.c_str()); - fl_set_input(paper_->input_right_margin, params.rightmargin.c_str()); - fl_set_input(paper_->input_bottom_margin, params.bottommargin.c_str()); - fl_set_input(paper_->input_head_height, params.headheight.c_str()); - fl_set_input(paper_->input_head_sep, params.headsep.c_str()); - fl_set_input(paper_->input_foot_skip, params.footskip.c_str()); - fl_set_focus_object(paper_->form, paper_->choice_papersize2); + if (!paper_.get()) + return; + + fl_set_choice(paper_->choice_papersize2, params.papersize2 + 1); + fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1); + fl_set_button(paper_->push_use_geometry, params.use_geometry); + fl_set_button(paper_->radio_portrait, 0); + setEnabled(paper_->radio_portrait, + fl_get_choice(paper_->choice_papersize2) != 2); + fl_set_button(paper_->radio_landscape, 0); + setEnabled(paper_->radio_landscape, + fl_get_choice(paper_->choice_papersize2) != 2); + if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE) + fl_set_button(paper_->radio_landscape, 1); + else + fl_set_button(paper_->radio_portrait, 1); + setEnabled(paper_->choice_paperpackage, + //either default papersize (preferences) + //or document papersize has to be A4 + (fl_get_choice(paper_->choice_papersize2) == 7 + || fl_get_choice(paper_->choice_papersize2) == 1 + && lyxrc.default_papersize == 5) + && fl_get_button(paper_->radio_portrait)); + fl_set_input(paper_->input_custom_width, params.paperwidth.c_str()); + setEnabled(paper_->input_custom_width, + fl_get_choice(paper_->choice_papersize2) == 2); + fl_set_input(paper_->input_custom_height, params.paperheight.c_str()); + setEnabled(paper_->input_custom_height, + fl_get_choice(paper_->choice_papersize2) == 2); + fl_set_input(paper_->input_left_margin, params.leftmargin.c_str()); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_top_margin, params.topmargin.c_str()); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_right_margin, params.rightmargin.c_str()); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_bottom_margin, params.bottommargin.c_str()); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_head_height, params.headheight.c_str()); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_head_sep, params.headsep.c_str()); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + fl_set_input(paper_->input_foot_skip, params.footskip.c_str()); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + fl_set_focus_object(paper_->form, paper_->choice_papersize2); } void FormDocument::bullets_update(BufferParams const & params) { - if (!bullets_.get() || ((XpmVersion<4) || (XpmVersion==4 && XpmRevision<7))) - return; + if (!bullets_.get() || + ((XpmVersion<4) || + (XpmVersion==4 && XpmRevision<7))) + return; - bool const isLinuxDoc = lv_->buffer()->isLinuxDoc(); - setEnabled(fbullet, !isLinuxDoc); + bool const isLinuxDoc = lv_->buffer()->isLinuxDoc(); + setEnabled(fbullet, !isLinuxDoc); - if (isLinuxDoc) return; + if (isLinuxDoc) return; - fl_set_button(bullets_->radio_bullet_depth_1, 1); - fl_set_input(bullets_->input_bullet_latex, - params.user_defined_bullets[0].getText().c_str()); - fl_set_choice(bullets_->choice_bullet_size, - params.user_defined_bullets[0].getSize() + 2); + fl_set_button(bullets_->radio_bullet_depth_1, 1); + fl_set_input(bullets_->input_bullet_latex, + params.user_defined_bullets[0].getText().c_str()); + fl_set_choice(bullets_->choice_bullet_size, + params.user_defined_bullets[0].getSize() + 2); } void FormDocument::checkReadOnly() { - if (bc().readOnly(lv_->buffer()->isReadonly())) { - combo_doc_class->deactivate(); - combo_language->deactivate(); - fl_set_object_label(dialog_->text_warning, - _("Document is read-only." - " No changes to layout permitted.")); - fl_show_object(dialog_->text_warning); - } else { - combo_doc_class->activate(); - combo_language->activate(); - fl_hide_object(dialog_->text_warning); - } + if (bc().readOnly(lv_->buffer()->isReadonly())) { + combo_doc_class->deactivate(); + combo_language->deactivate(); + fl_set_object_label(dialog_->text_warning, + _("Document is read-only." + " No changes to layout permitted.")); + fl_show_object(dialog_->text_warning); + } else { + combo_doc_class->activate(); + combo_language->activate(); + fl_hide_object(dialog_->text_warning); + } } void FormDocument::checkMarginValues() { +//this is not needed after the recent redesign (JSpitzm) +#if 0 bool const not_empty = strlen(fl_get_input(paper_->input_top_margin)) || strlen(fl_get_input(paper_->input_bottom_margin)) || @@ -843,288 +942,316 @@ void FormDocument::checkMarginValues() strlen(fl_get_input(paper_->input_foot_skip)) || strlen(fl_get_input(paper_->input_custom_width)) || strlen(fl_get_input(paper_->input_custom_height)); - if (not_empty) - fl_set_button(paper_->push_use_geometry, 1); +#endif } + bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long) { - string str; - int val; - bool ok = true; - char const * input; + string str; + int val; + bool ok = true; + char const * input; - checkMarginValues(); - if (ob == paper_->choice_papersize2) { - val = fl_get_choice(paper_->choice_papersize2)-1; - if (val == BufferParams::VM_PAPER_DEFAULT) { - fl_set_button(paper_->push_use_geometry, 0); - checkMarginValues(); - } else { - if ((val != BufferParams::VM_PAPER_USLETTER) && - (val != BufferParams::VM_PAPER_USLEGAL) && - (val != BufferParams::VM_PAPER_USEXECUTIVE) && - (val != BufferParams::VM_PAPER_A4) && - (val != BufferParams::VM_PAPER_A5) && - (val != BufferParams::VM_PAPER_B5)) { - fl_set_button(paper_->push_use_geometry, 1); - } - fl_set_choice(paper_->choice_paperpackage, - BufferParams::PACKAGE_NONE + 1); - } - } else if (ob == paper_->choice_paperpackage) { - val = fl_get_choice(paper_->choice_paperpackage)-1; - if (val != BufferParams::PACKAGE_NONE) { - fl_set_choice(paper_->choice_papersize2, - BufferParams::VM_PAPER_DEFAULT + 1); - fl_set_button(paper_->push_use_geometry, 0); - } - } else if (ob == class_->input_doc_spacing) { - input = fl_get_input(class_->input_doc_spacing); - if (!*input) { - fl_set_choice (class_->choice_doc_spacing, 1); - } else { - fl_set_choice(class_->choice_doc_spacing, 4); + checkMarginValues(); + if (ob == paper_->choice_papersize2) { + val = fl_get_choice(paper_->choice_papersize2)-1; + if (val == BufferParams::VM_PAPER_DEFAULT) { + fl_set_button(paper_->push_use_geometry, 0); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + checkMarginValues(); + } else { + if ((val != BufferParams::VM_PAPER_USLETTER) && + (val != BufferParams::VM_PAPER_USLEGAL) && + (val != BufferParams::VM_PAPER_USEXECUTIVE) && + (val != BufferParams::VM_PAPER_A4) && + (val != BufferParams::VM_PAPER_A5) && + (val != BufferParams::VM_PAPER_B5)) { + fl_set_button(paper_->push_use_geometry, 1); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + } + fl_set_choice(paper_->choice_paperpackage, + BufferParams::PACKAGE_NONE + 1); + } + } else if (ob == paper_->choice_paperpackage) { + val = fl_get_choice(paper_->choice_paperpackage)-1; + if (val != BufferParams::PACKAGE_NONE) { + fl_set_button(paper_->push_use_geometry, 0); + setEnabled(paper_->input_top_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_bottom_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_left_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_right_margin, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_height, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_head_sep, + fl_get_button(paper_->push_use_geometry)); + setEnabled(paper_->input_foot_skip, + fl_get_button(paper_->push_use_geometry)); + } + } else if (ob == class_->input_doc_spacing) { + input = fl_get_input(class_->input_doc_spacing); + if (!*input) { + fl_set_choice (class_->choice_doc_spacing, 1); + } else { + fl_set_choice(class_->choice_doc_spacing, 4); + } } - } - // this has to be all out of if/elseif because it has to deactivate - // the document buttons and so the whole stuff has to be tested again. - str = fl_get_input(paper_->input_custom_width); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_custom_height); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_left_margin); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_right_margin); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_top_margin); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_bottom_margin); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_head_height); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_head_sep); - ok = ok && (str.empty() || isValidLength(str)); - str = fl_get_input(paper_->input_foot_skip); - ok = ok && (str.empty() || isValidLength(str)); - // "Synchronize" the choice and the input field, so that it - // is impossible to commit senseless data. - input = fl_get_input (class_->input_doc_skip); - if (ob == class_->input_doc_skip) { - if (!*input) { - fl_set_choice (class_->choice_doc_skip, 2); - } else if (isValidGlueLength (input)) { - fl_set_choice (class_->choice_doc_skip, 4); + // this has to be all out of if/elseif because it has to deactivate + // the document buttons and so the whole stuff has to be tested again. + str = fl_get_input(paper_->input_custom_width); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_custom_height); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_left_margin); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_right_margin); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_top_margin); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_bottom_margin); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_head_height); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_head_sep); + ok = ok && (str.empty() || isValidLength(str)); + str = fl_get_input(paper_->input_foot_skip); + ok = ok && (str.empty() || isValidLength(str)); + // "Synchronize" the choice and the input field, so that it + // is impossible to commit senseless data. + input = fl_get_input (class_->input_doc_skip); + if (ob == class_->input_doc_skip) { + if (!*input) { + fl_set_choice (class_->choice_doc_skip, 2); + } else if (isValidGlueLength (input)) { + fl_set_choice (class_->choice_doc_skip, 4); + } else { + fl_set_choice(class_->choice_doc_skip, 4); + ok = false; + } } else { - fl_set_choice(class_->choice_doc_skip, 4); - ok = false; + if (*input && !isValidGlueLength(input)) + ok = false; } - } else { - if (*input && !isValidGlueLength(input)) - ok = false; - } - - if (ob == paper_->radio_portrait) { - setEnabled(paper_->choice_paperpackage, - fl_get_button(paper_->radio_portrait)); - } - - if (ob == paper_->radio_landscape) { - setEnabled(paper_->choice_paperpackage, - fl_get_button(paper_->radio_portrait)); - fl_set_choice(paper_->choice_paperpackage, - BufferParams::PACKAGE_NONE + 1); - } - - if ((fl_get_choice(class_->choice_doc_skip) == 4) && !*input) - ok = false; - else if (fl_get_choice(class_->choice_doc_skip) != 4) - fl_set_input (class_->input_doc_skip, ""); - - input = fl_get_input(class_->input_doc_spacing); - if ((fl_get_choice(class_->choice_doc_spacing) == 4) && !*input) - ok = false; - else if (fl_get_choice(class_->choice_doc_spacing) != 4) - fl_set_input (class_->input_doc_spacing, ""); - return ok; + + if ((fl_get_choice(class_->choice_doc_skip) == 4) && !*input) + ok = false; + else if (fl_get_choice(class_->choice_doc_skip) != 4) + fl_set_input (class_->input_doc_skip, ""); + + input = fl_get_input(class_->input_doc_spacing); + if ((fl_get_choice(class_->choice_doc_spacing) == 4) && !*input) + ok = false; + else if (fl_get_choice(class_->choice_doc_spacing) != 4) + fl_set_input (class_->input_doc_spacing, ""); + return ok; } void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ ) { - BufferParams & param = lv_->buffer()->params; + BufferParams & param = lv_->buffer()->params; - // convert from 1-6 range to -1-4 - param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2); - fl_set_input(bullets_->input_bullet_latex, - param.temp_bullets[current_bullet_depth].getText().c_str()); + // convert from 1-6 range to -1-4 + param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2); + fl_set_input(bullets_->input_bullet_latex, + param.temp_bullets[current_bullet_depth].getText().c_str()); } void FormDocument::InputBulletLaTeX(FL_OBJECT *, long) { - BufferParams & param = lv_->buffer()->params; + BufferParams & param = lv_->buffer()->params; - param.temp_bullets[current_bullet_depth]. - setText(fl_get_input(bullets_->input_bullet_latex)); + param.temp_bullets[current_bullet_depth]. + setText(fl_get_input(bullets_->input_bullet_latex)); } void FormDocument::BulletDepth(FL_OBJECT * ob, State cb) { - /* Should I do the following: */ - /* 1. change to the panel that the current bullet belongs in */ - /* 2. show that bullet as selected */ - /* 3. change the size setting to the size of the bullet in Q.*/ - /* 4. display the latex equivalent in the latex box */ - /* */ - /* I'm inclined to just go with 3 and 4 at the moment and */ - /* maybe try to support the others later */ - BufferParams & param = lv_->buffer()->params; - - int data = 0; - if (cb == BULLETDEPTH1 ) - data = 0; - else if (cb == BULLETDEPTH2 ) - data = 1; - else if (cb == BULLETDEPTH3 ) - data = 2; - else if (cb == BULLETDEPTH4 ) - data = 3; - - switch (fl_get_button_numb(ob)) { - case 3: - // right mouse button resets to default - param.temp_bullets[data] = ITEMIZE_DEFAULTS[data]; - default: - current_bullet_depth = data; - fl_set_input(bullets_->input_bullet_latex, - param.temp_bullets[data].getText().c_str()); - fl_set_choice(bullets_->choice_bullet_size, - param.temp_bullets[data].getSize() + 2); - } + /* Should I do the following: */ + /* 1. change to the panel that the current bullet belongs in */ + /* 2. show that bullet as selected */ + /* 3. change the size setting to the size of the bullet in Q.*/ + /* 4. display the latex equivalent in the latex box */ + /* */ + /* I'm inclined to just go with 3 and 4 at the moment and */ + /* maybe try to support the others later */ + BufferParams & param = lv_->buffer()->params; + + int data = 0; + if (cb == BULLETDEPTH1 ) + data = 0; + else if (cb == BULLETDEPTH2 ) + data = 1; + else if (cb == BULLETDEPTH3 ) + data = 2; + else if (cb == BULLETDEPTH4 ) + data = 3; + + switch (fl_get_button_numb(ob)) { + case 3: + // right mouse button resets to default + param.temp_bullets[data] = ITEMIZE_DEFAULTS[data]; + default: + current_bullet_depth = data; + fl_set_input(bullets_->input_bullet_latex, + param.temp_bullets[data].getText().c_str()); + fl_set_choice(bullets_->choice_bullet_size, + param.temp_bullets[data].getSize() + 2); + } } void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb) { - /* Here we have to change the background pixmap to that selected */ - /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */ + /* Here we have to change the background pixmap to that selected */ + /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */ - int data = 0; - if (cb == BULLETPANEL1 ) - data = 0; - else if (cb == BULLETPANEL2 ) - data = 1; - else if (cb == BULLETPANEL3 ) - data = 2; - else if (cb == BULLETPANEL4 ) - data = 3; - else if (cb == BULLETPANEL5 ) - data = 4; - else if (cb == BULLETPANEL6 ) - data = 5; - - if (data != current_bullet_panel) { - fl_freeze_form(bullets_->form); - current_bullet_panel = data; - - /* free the current pixmap */ - fl_free_bmtable_pixmap(bullets_->bmtable_bullet_panel); - string new_panel; - switch (cb) { - /* display the new one */ - case BULLETPANEL1 : - new_panel = "standard"; - break; - case BULLETPANEL2 : - new_panel = "amssymb"; - break; - case BULLETPANEL3 : - new_panel = "psnfss1"; - break; - case BULLETPANEL4 : - new_panel = "psnfss2"; - break; - case BULLETPANEL5 : - new_panel = "psnfss3"; - break; - case BULLETPANEL6 : - new_panel = "psnfss4"; - break; - default : - /* something very wrong happened */ - // play it safe for now but should be an exception - current_bullet_panel = 0; // standard panel - new_panel = "standard"; - break; + int data = 0; + if (cb == BULLETPANEL1 ) + data = 0; + else if (cb == BULLETPANEL2 ) + data = 1; + else if (cb == BULLETPANEL3 ) + data = 2; + else if (cb == BULLETPANEL4 ) + data = 3; + else if (cb == BULLETPANEL5 ) + data = 4; + else if (cb == BULLETPANEL6 ) + data = 5; + + if (data != current_bullet_panel) { + fl_freeze_form(bullets_->form); + current_bullet_panel = data; + + /* free the current pixmap */ + fl_free_bmtable_pixmap(bullets_->bmtable_bullet_panel); + string new_panel; + switch (cb) { + /* display the new one */ + case BULLETPANEL1 : + new_panel = "standard"; + break; + case BULLETPANEL2 : + new_panel = "amssymb"; + break; + case BULLETPANEL3 : + new_panel = "psnfss1"; + break; + case BULLETPANEL4 : + new_panel = "psnfss2"; + break; + case BULLETPANEL5 : + new_panel = "psnfss3"; + break; + case BULLETPANEL6 : + new_panel = "psnfss4"; + break; + default : + /* something very wrong happened */ + // play it safe for now but should be an exception + current_bullet_panel = 0; // standard panel + new_panel = "standard"; + break; + } + new_panel += ".xpm"; + fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6, + LibFileSearch("images", new_panel).c_str()); + fl_redraw_object(bullets_->bmtable_bullet_panel); + fl_unfreeze_form(bullets_->form); } - new_panel += ".xpm"; - fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6, - LibFileSearch("images", new_panel).c_str()); - fl_redraw_object(bullets_->bmtable_bullet_panel); - fl_unfreeze_form(bullets_->form); - } } void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ ) { - /* handle the user input by setting the current bullet depth's pixmap */ - /* to that extracted from the current chosen position of the BMTable */ - /* Don't forget to free the button's old pixmap first. */ - - BufferParams & param = lv_->buffer()->params; - int bmtable_button = fl_get_bmtable(ob); - - /* try to keep the button held down till another is pushed */ - /* fl_set_bmtable(ob, 1, bmtable_button); */ - param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel); - param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button); - fl_set_input(bullets_->input_bullet_latex, - param.temp_bullets[current_bullet_depth].getText().c_str()); + /* handle the user input by setting the current bullet depth's pixmap */ + /* to that extracted from the current chosen position of the BMTable */ + /* Don't forget to free the button's old pixmap first. */ + + BufferParams & param = lv_->buffer()->params; + int bmtable_button = fl_get_bmtable(ob); + + /* try to keep the button held down till another is pushed */ + /* fl_set_bmtable(ob, 1, bmtable_button); */ + param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel); + param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button); + fl_set_input(bullets_->input_bullet_latex, + param.temp_bullets[current_bullet_depth].getText().c_str()); } void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long) { - if (!ob) - ob = class_->choice_doc_class; + if (!ob) + ob = class_->choice_doc_class; - lv_->prohibitInput(); + lv_->prohibitInput(); - unsigned int tc = combo_doc_class->get() - 1; - if (textclasslist.Load(tc)) { - // we use a copy of the bufferparams because we do not - // want to modify them yet. - BufferParams params = lv_->buffer()->params; + unsigned int tc = combo_doc_class->get() - 1; + if (textclasslist.Load(tc)) { + // we use a copy of the bufferparams because we do not + // want to modify them yet. + BufferParams params = lv_->buffer()->params; - if (lyxrc.auto_reset_options) { - params.textclass = tc; - params.useClassDefaults(); - UpdateLayoutDocument(params); + if (lyxrc.auto_reset_options) { + params.textclass = tc; + params.useClassDefaults(); + UpdateLayoutDocument(params); + } + } else { + // unable to load new style + WriteAlert(_("Conversion Errors!"), + _("Unable to switch to new document class."), + _("Reverting to original document class.")); + combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1); } - } else { - // unable to load new style - WriteAlert(_("Conversion Errors!"), - _("Unable to switch to new document class."), - _("Reverting to original document class.")); - combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1); - } - lv_->allowInput(); + lv_->allowInput(); } void FormDocument::UpdateLayoutDocument(BufferParams const & params) { - if (!dialog_.get()) - return; - - checkReadOnly(); - class_update(params); - paper_update(params); - language_update(params); - options_update(params); - bullets_update(params); + if (!dialog_.get()) + return; + + checkReadOnly(); + class_update(params); + paper_update(params); + language_update(params); + options_update(params); + bullets_update(params); } diff --git a/src/frontends/xforms/form_document.C b/src/frontends/xforms/form_document.C index 931f2b564b..58de37b4a9 100644 --- a/src/frontends/xforms/form_document.C +++ b/src/frontends/xforms/form_document.C @@ -91,54 +91,31 @@ FD_form_doc_paper * FormDocument::build_doc_paper() fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 345, ""); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 85, 200, 100, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); { - char const * const dummy = N_("Special:|#S"); - fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 15, 140, 30, idex(_(dummy))); + char const * const dummy = N_("Special (A4 portrait only):|#S"); + fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE, 230, 180, 185, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 205, 200, 130, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 165, 190, 170, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 155, 70, 20, _("Margins")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT, 240, 195, 160, 20, _("Foot/Head Margins")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 360, 10, 10, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 350, 10, 10, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 85, 190, 70, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 75, 95, 20, _("Orientation")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->greoup_radio_orientation = fl_bgn_group(); { char const * const dummy = N_("Portrait|#o"); - fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 90, 120, 30, idex(_(dummy))); + fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 40, 120, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Landscape|#L"); - fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 120, 120, 30, idex(_(dummy))); + fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 75, 120, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -147,54 +124,51 @@ FD_form_doc_paper * FormDocument::build_doc_paper() { char const * const dummy = N_("Papersize:|#P"); - fdui->choice_papersize2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 85, 15, 135, 30, idex(_(dummy))); + fdui->choice_papersize2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 110, 25, 115, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); - obj = fl_add_text(FL_NORMAL_TEXT, 240, 75, 150, 20, _("Custom Papersize")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); { - char const * const dummy = N_("Use Geometry Package|#U"); - fdui->push_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 45, 170, 30, idex(_(dummy))); + char const * const dummy = N_("Custom Margins/Sizes|#M"); + fdui->push_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 155, 30, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Width:|#W"); - fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT, 330, 100, 90, 30, idex(_(dummy))); + fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT, 135, 60, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Height:|#H"); - fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT, 330, 140, 90, 30, idex(_(dummy))); + fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT, 135, 95, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Top:|#T"); - fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 175, 90, 30, idex(_(dummy))); + fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 190, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Bottom:|#B"); - fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 215, 90, 30, idex(_(dummy))); + fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 225, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Left:|#e"); - fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 255, 90, 30, idex(_(dummy))); + fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 260, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -208,21 +182,21 @@ FD_form_doc_paper * FormDocument::build_doc_paper() fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Headheight:|#i"); - fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT, 330, 215, 90, 30, idex(_(dummy))); + fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT, 340, 225, 75, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Headsep:|#d"); - fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT, 330, 255, 90, 30, idex(_(dummy))); + fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT, 340, 260, 75, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT); { char const * const dummy = N_("Footskip:|#F"); - fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT, 330, 295, 90, 30, idex(_(dummy))); + fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT, 340, 295, 75, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -231,6 +205,9 @@ FD_form_doc_paper * FormDocument::build_doc_paper() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 245, 15, 180, 120, _("Orientation")); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 15, 225, 120, _("Papersize")); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 145, 415, 185, _("Margins")); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/forms/form_document.fd b/src/frontends/xforms/forms/form_document.fd index 79f0df48a7..382b61b7b3 100644 --- a/src/frontends/xforms/forms/form_document.fd +++ b/src/frontends/xforms/forms/form_document.fd @@ -179,7 +179,7 @@ argument: INPUT Name: form_doc_paper Width: 440 Height: 345 -Number of Objects: 28 +Number of Objects: 23 -------------------- class: FL_BOX @@ -199,35 +199,17 @@ name: callback: argument: --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 230 85 200 100 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 290 15 140 30 +box: 230 180 185 30 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT +alignment: FL_ALIGN_TOP style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Special:|#S +label: Special (A4 portrait only):|#S shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity @@ -235,78 +217,6 @@ name: choice_paperpackage callback: C_FormBaseDeprecatedInputCB argument: INPUT --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 230 205 200 130 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 10 165 190 170 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 155 70 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Margins -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 240 195 160 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Foot/Head Margins -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - -------------------- class: FL_FRAME type: ENGRAVED_FRAME @@ -343,42 +253,6 @@ name: callback: argument: --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 10 85 190 70 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 75 95 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Orientation -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - -------------------- class: FL_BEGIN_GROUP type: 0 @@ -400,7 +274,7 @@ argument: -------------------- class: FL_CHECKBUTTON type: RADIO_BUTTON -box: 20 90 120 30 +box: 255 40 120 30 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -418,7 +292,7 @@ argument: INPUT -------------------- class: FL_CHECKBUTTON type: RADIO_BUTTON -box: 20 120 120 30 +box: 255 75 120 30 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -454,7 +328,7 @@ argument: -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 85 15 135 30 +box: 110 25 115 30 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -469,35 +343,17 @@ name: choice_papersize2 callback: C_FormBaseDeprecatedInputCB argument: INPUT --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 240 75 150 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Custom Papersize -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 20 45 170 30 +box: 20 155 30 30 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER +alignment: FL_ALIGN_RIGHT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use Geometry Package|#U +label: Custom Margins/Sizes|#M shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity @@ -508,7 +364,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 330 100 90 30 +box: 135 60 90 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -526,7 +382,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 330 140 90 30 +box: 135 95 90 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -544,7 +400,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 100 175 90 30 +box: 100 190 90 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -562,7 +418,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 100 215 90 30 +box: 100 225 90 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -580,7 +436,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 100 255 90 30 +box: 100 260 90 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -616,7 +472,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 330 215 90 30 +box: 340 225 75 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -634,7 +490,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 330 255 90 30 +box: 340 260 75 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -652,7 +508,7 @@ argument: INPUT -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 330 295 90 30 +box: 340 295 75 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -685,6 +541,60 @@ name: text_warning callback: argument: +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 245 15 180 120 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Orientation +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 10 15 225 120 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Papersize +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 10 145 415 185 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Margins +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + =============== FORM =============== Name: form_doc_class Width: 440 -- 2.39.2