2002-03-11 17:00:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file FormDocument.C
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2000-08-18 14:36:12 +00:00
|
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2002-10-23 13:15:32 +00:00
|
|
|
|
* \author Rob Lahaye
|
2003-08-17 11:28:23 +00:00
|
|
|
|
* \author Martin Vermeer
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-03-11 17:00:41 +00:00
|
|
|
|
*/
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "FormDocument.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "ControlDocument.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
|
#include "forms/form_document.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#include "bmtable.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
#include "checkedwidgets.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "ColorHandler.h"
|
|
|
|
|
#include "combox.h"
|
|
|
|
|
#include "FormColorpicker.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
#include "input_validators.h" // fl_unsigned_float_filter
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "Tooltips.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
#include "xforms_helpers.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "xformsBC.h"
|
|
|
|
|
|
|
|
|
|
#include "controllers/ButtonController.h"
|
|
|
|
|
#include "controllers/frnt_lang.h"
|
|
|
|
|
#include "controllers/helper_funcs.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "Bullet.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
#include "bufferparams.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
#include "language.h"
|
2003-09-16 09:44:34 +00:00
|
|
|
|
#include "LColor.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
#include "lyxrc.h"
|
|
|
|
|
#include "lyxtextclasslist.h"
|
|
|
|
|
#include "tex-strings.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "vspace.h"
|
2002-10-24 09:48:56 +00:00
|
|
|
|
|
2003-05-13 14:36:24 +00:00
|
|
|
|
#include "support/tostr.h"
|
2002-11-22 10:47:56 +00:00
|
|
|
|
#include "support/lstrings.h" // contains_functor, getStringFromVector
|
|
|
|
|
#include "support/filetools.h" // LibFileSearch
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
|
#include "lyx_xpm.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
#include <iomanip>
|
2002-03-02 16:39:54 +00:00
|
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::bformat;
|
|
|
|
|
using lyx::support::contains_functor;
|
|
|
|
|
using lyx::support::getStringFromVector;
|
|
|
|
|
using lyx::support::getVectorFromString;
|
|
|
|
|
using lyx::support::LibFileSearch;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
using std::bind2nd;
|
2003-08-02 14:35:31 +00:00
|
|
|
|
using std::endl;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-09-05 13:15:43 +00:00
|
|
|
|
using std::vector;
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2003-04-09 21:34:50 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
|
|
|
|
|
bool const scalableTabfolders = false;
|
|
|
|
|
#else
|
|
|
|
|
bool const scalableTabfolders = true;
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2003-04-09 21:34:50 +00:00
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
typedef FormCB<ControlDocument, FormDB<FD_document> > base_class;
|
|
|
|
|
|
|
|
|
|
FormDocument::FormDocument()
|
2003-04-30 02:06:04 +00:00
|
|
|
|
: base_class(_("Document Settings"), scalableTabfolders),
|
2001-09-12 16:18:22 +00:00
|
|
|
|
ActCell(0), Confirmed(0),
|
|
|
|
|
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
|
2002-10-23 13:15:32 +00:00
|
|
|
|
{}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
|
void FormDocument::redraw()
|
|
|
|
|
{
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (form() && form()->visible)
|
|
|
|
|
fl_redraw_form(form());
|
2000-11-10 17:29:47 +00:00
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
if (outer_form && outer_form->visible)
|
2002-02-16 15:59:55 +00:00
|
|
|
|
fl_redraw_form(outer_form);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
void FormDocument::build()
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// the tabbed folder
|
2002-06-13 13:43:51 +00:00
|
|
|
|
dialog_.reset(build_document(this));
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-03-20 17:53:39 +00:00
|
|
|
|
// Allow the base class to control messages
|
|
|
|
|
setMessageWidget(dialog_->text_warning);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// Manage the restore, ok, apply, restore and cancel/close buttons
|
2003-03-10 03:13:28 +00:00
|
|
|
|
bcview().setOK(dialog_->button_ok);
|
|
|
|
|
bcview().setApply(dialog_->button_apply);
|
|
|
|
|
bcview().setCancel(dialog_->button_close);
|
|
|
|
|
bcview().setRestore(dialog_->button_restore);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
// the document class form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
class_.reset(build_document_class(this));
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
// disable for read-only documents
|
2003-04-02 18:57:58 +00:00
|
|
|
|
bcview().addReadOnly(class_->combox_class);
|
|
|
|
|
bcview().addReadOnly(class_->radio_indent);
|
|
|
|
|
bcview().addReadOnly(class_->radio_skip);
|
|
|
|
|
bcview().addReadOnly(class_->choice_pagestyle);
|
|
|
|
|
bcview().addReadOnly(class_->choice_fonts);
|
|
|
|
|
bcview().addReadOnly(class_->choice_fontsize);
|
|
|
|
|
bcview().addReadOnly(class_->radio_sides_one);
|
|
|
|
|
bcview().addReadOnly(class_->radio_sides_two);
|
|
|
|
|
bcview().addReadOnly(class_->radio_columns_one);
|
|
|
|
|
bcview().addReadOnly(class_->radio_columns_two);
|
|
|
|
|
bcview().addReadOnly(class_->input_extra);
|
|
|
|
|
bcview().addReadOnly(class_->input_skip);
|
|
|
|
|
bcview().addReadOnly(class_->choice_skip);
|
|
|
|
|
bcview().addReadOnly(class_->choice_spacing);
|
|
|
|
|
bcview().addReadOnly(class_->input_spacing);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// check validity of "length + unit" input
|
2003-04-02 18:57:58 +00:00
|
|
|
|
addCheckedGlueLength(bcview(), class_->input_skip,
|
|
|
|
|
class_->choice_skip);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setPrehandler(class_->input_extra);
|
|
|
|
|
setPrehandler(class_->input_skip);
|
|
|
|
|
setPrehandler(class_->input_spacing);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input_return(class_->input_extra, FL_RETURN_CHANGED);
|
|
|
|
|
fl_set_input_return(class_->input_skip, FL_RETURN_CHANGED);
|
|
|
|
|
fl_set_input_return(class_->input_spacing, FL_RETURN_CHANGED);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
FL_OBJECT * obj;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
|
// Fill the combox and choices.
|
2003-04-02 18:57:58 +00:00
|
|
|
|
obj = class_->combox_class;
|
2003-04-02 14:20:30 +00:00
|
|
|
|
LyXTextClassList::const_iterator tit = textclasslist.begin();
|
|
|
|
|
LyXTextClassList::const_iterator tend = textclasslist.end();
|
|
|
|
|
for (; tit != tend; ++tit) {
|
2003-05-03 19:24:36 +00:00
|
|
|
|
if (tit->isTeXClassAvailable()) {
|
|
|
|
|
fl_addto_combox(obj, tit->description().c_str());
|
|
|
|
|
} else {
|
2003-06-30 10:32:43 +00:00
|
|
|
|
string item = bformat(_("Unavailable: %1$s"), tit->description());
|
2003-05-03 19:24:36 +00:00
|
|
|
|
fl_addto_combox(obj, item.c_str());
|
|
|
|
|
}
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2003-04-02 14:20:30 +00:00
|
|
|
|
fl_set_combox_browser_height(obj, 400);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_spacing,
|
2003-05-19 21:08:58 +00:00
|
|
|
|
_(" Single | OneHalf | Double | Custom ").c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_fontsize, "default|10|11|12");
|
2002-10-23 13:15:32 +00:00
|
|
|
|
for (int n = 0; tex_fonts[n][0]; ++n) {
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_fonts,tex_fonts[n]);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// Create the contents of the unit choices; don't include the
|
|
|
|
|
// "%" terms...
|
|
|
|
|
vector<string> units_vec = getLatexUnits();
|
|
|
|
|
vector<string>::iterator ret =
|
|
|
|
|
std::remove_if(units_vec.begin(),
|
|
|
|
|
units_vec.end(),
|
|
|
|
|
bind2nd(contains_functor(), "%"));
|
|
|
|
|
units_vec.erase(ret, units_vec.end());
|
|
|
|
|
|
|
|
|
|
string const units = getStringFromVector(units_vec, "|");
|
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_pagestyle,
|
2001-10-03 16:31:10 +00:00
|
|
|
|
"default|empty|plain|headings|fancy");
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_skip,
|
2003-05-19 21:08:58 +00:00
|
|
|
|
_(" SmallSkip | MedSkip | BigSkip | Length ").c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(class_->choice_skip_units, units.c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-01-16 16:34:03 +00:00
|
|
|
|
// Set input filters on doc spacing to make it accept only
|
2001-10-23 09:00:12 +00:00
|
|
|
|
// unsigned numbers.
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input_filter(class_->input_spacing,
|
2002-10-23 13:15:32 +00:00
|
|
|
|
fl_unsigned_float_filter);
|
|
|
|
|
|
|
|
|
|
// disable for read-only documents
|
2003-03-10 03:13:28 +00:00
|
|
|
|
bcview().addReadOnly(dialog_->button_save_defaults);
|
|
|
|
|
bcview().addReadOnly(dialog_->button_reset_defaults);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// the document paper form
|
|
|
|
|
paper_.reset(build_document_paper(this));
|
|
|
|
|
|
|
|
|
|
// disable for read-only documents
|
2003-03-10 03:13:28 +00:00
|
|
|
|
bcview().addReadOnly(paper_->choice_paperpackage);
|
|
|
|
|
bcview().addReadOnly(paper_->radio_portrait);
|
|
|
|
|
bcview().addReadOnly(paper_->radio_landscape);
|
|
|
|
|
bcview().addReadOnly(paper_->choice_papersize);
|
|
|
|
|
bcview().addReadOnly(paper_->check_use_geometry);
|
|
|
|
|
bcview().addReadOnly(paper_->input_custom_width);
|
|
|
|
|
bcview().addReadOnly(paper_->input_custom_height);
|
|
|
|
|
bcview().addReadOnly(paper_->input_top_margin);
|
|
|
|
|
bcview().addReadOnly(paper_->input_bottom_margin);
|
|
|
|
|
bcview().addReadOnly(paper_->input_inner_margin);
|
|
|
|
|
bcview().addReadOnly(paper_->input_outer_margin);
|
|
|
|
|
bcview().addReadOnly(paper_->input_head_height);
|
|
|
|
|
bcview().addReadOnly(paper_->input_head_sep);
|
|
|
|
|
bcview().addReadOnly(paper_->input_foot_skip);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// check validity of "length + unit" input
|
2003-03-10 03:13:28 +00:00
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_custom_width);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_custom_height);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_top_margin);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_bottom_margin);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_inner_margin);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_outer_margin);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_head_height);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_head_sep);
|
|
|
|
|
addCheckedGlueLength(bcview(), paper_->input_foot_skip);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
|
|
|
|
setPrehandler(paper_->input_custom_width);
|
|
|
|
|
setPrehandler(paper_->input_custom_height);
|
|
|
|
|
setPrehandler(paper_->input_top_margin);
|
|
|
|
|
setPrehandler(paper_->input_bottom_margin);
|
|
|
|
|
setPrehandler(paper_->input_inner_margin);
|
|
|
|
|
setPrehandler(paper_->input_outer_margin);
|
|
|
|
|
setPrehandler(paper_->input_head_height);
|
|
|
|
|
setPrehandler(paper_->input_head_sep);
|
|
|
|
|
setPrehandler(paper_->input_foot_skip);
|
|
|
|
|
|
|
|
|
|
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_inner_margin, FL_RETURN_CHANGED);
|
|
|
|
|
fl_set_input_return(paper_->input_outer_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);
|
|
|
|
|
|
|
|
|
|
fl_addto_choice(paper_->choice_papersize,
|
|
|
|
|
_(" Default | Custom | US letter | US legal "
|
2003-05-19 21:08:58 +00:00
|
|
|
|
"| US executive | A3 | A4 | A5 "
|
|
|
|
|
"| B3 | B4 | B5 ").c_str());
|
2002-10-23 13:15:32 +00:00
|
|
|
|
fl_addto_choice(paper_->choice_paperpackage,
|
|
|
|
|
_(" None "
|
|
|
|
|
"| Small Margins "
|
|
|
|
|
"| Very small Margins "
|
2003-05-19 21:08:58 +00:00
|
|
|
|
"| Very wide Margins ").c_str());
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
fl_addto_choice(paper_->choice_custom_width_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_top_margin_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_bottom_margin_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_inner_margin_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_outer_margin_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_head_height_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_head_sep_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_foot_skip_units, units.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
// the document language form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
language_.reset(build_document_language(this));
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// disable for read-only documents
|
2003-04-02 14:20:30 +00:00
|
|
|
|
bcview().addReadOnly(language_->combox_language);
|
2003-03-10 03:13:28 +00:00
|
|
|
|
bcview().addReadOnly(language_->choice_inputenc);
|
|
|
|
|
bcview().addReadOnly(language_->choice_quotes_language);
|
|
|
|
|
bcview().addReadOnly(language_->radio_single);
|
|
|
|
|
bcview().addReadOnly(language_->radio_double);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_addto_choice(language_->choice_inputenc,
|
2001-10-08 14:50:16 +00:00
|
|
|
|
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
|
2002-07-03 14:18:32 +00:00
|
|
|
|
"|koi8-r|koi8-u|cp866|cp1251|iso88595|pt154");
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-04-30 15:07:03 +00:00
|
|
|
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
2002-04-29 15:56:36 +00:00
|
|
|
|
// Store the identifiers for later
|
|
|
|
|
lang_ = getSecond(langs);
|
|
|
|
|
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
|
|
|
|
for (; lit != lend; ++lit) {
|
2003-04-02 14:20:30 +00:00
|
|
|
|
fl_addto_combox(language_->combox_language,
|
|
|
|
|
lit->first.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2003-04-02 14:20:30 +00:00
|
|
|
|
fl_set_combox_browser_height(language_->combox_language, 400);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
fl_addto_choice(language_->choice_quotes_language,
|
|
|
|
|
_(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
|
2003-11-21 11:38:17 +00:00
|
|
|
|
" <<text>> | >>text<< ").c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
// the document options form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
options_.reset(build_document_options(this));
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// disable for read-only documents
|
2003-03-10 03:13:28 +00:00
|
|
|
|
bcview().addReadOnly(options_->counter_secnumdepth);
|
|
|
|
|
bcview().addReadOnly(options_->counter_tocdepth);
|
|
|
|
|
bcview().addReadOnly(options_->choice_ams_math);
|
|
|
|
|
bcview().addReadOnly(options_->check_use_natbib);
|
|
|
|
|
bcview().addReadOnly(options_->choice_citation_format);
|
|
|
|
|
bcview().addReadOnly(options_->input_float_placement);
|
|
|
|
|
bcview().addReadOnly(options_->choice_postscript_driver);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(options_->input_float_placement);
|
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
|
|
|
|
|
|
2003-04-02 09:49:19 +00:00
|
|
|
|
fl_addto_choice(options_->choice_ams_math,
|
2003-11-28 19:17:34 +00:00
|
|
|
|
_(" Never | Automatically | Yes ").c_str());
|
2003-03-06 11:07:55 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
for (int n = 0; tex_graphics[n][0]; ++n) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_addto_choice(options_->choice_postscript_driver,
|
|
|
|
|
tex_graphics[n]);
|
|
|
|
|
}
|
|
|
|
|
fl_addto_choice(options_->choice_citation_format,
|
2003-05-19 21:08:58 +00:00
|
|
|
|
_(" Author-year | Numerical ").c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
// the document bullets form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
bullets_.reset(build_document_bullet(this));
|
2002-08-14 19:19:47 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
// disable for read-only documents
|
2003-04-02 18:57:58 +00:00
|
|
|
|
bcview().addReadOnly(bullets_->radio_depth_1);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_depth_2);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_depth_3);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_depth_4);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_standard);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_maths);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_ding1);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_ding2);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_ding3);
|
|
|
|
|
bcview().addReadOnly(bullets_->radio_panel_ding4);
|
|
|
|
|
bcview().addReadOnly(bullets_->bmtable_panel);
|
|
|
|
|
bcview().addReadOnly(bullets_->choice_size);
|
|
|
|
|
bcview().addReadOnly(bullets_->input_latex);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setPrehandler(bullets_->input_latex);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input_return(bullets_->input_latex, FL_RETURN_CHANGED);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_addto_choice(bullets_->choice_size,
|
2003-05-19 21:08:58 +00:00
|
|
|
|
_(" Default | Tiny | Smallest | Smaller "
|
|
|
|
|
"| Small | Normal | Large | Larger | Largest "
|
|
|
|
|
"| Huge | Huger ").c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice(bullets_->choice_size, 1);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input_maxchars(bullets_->input_latex, 80);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
string const bmtablefile = LibFileSearch("images", "standard", "xpm");
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
|
2002-10-23 13:15:32 +00:00
|
|
|
|
bmtablefile.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
picker_.reset(new FormColorpicker);
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
// the document branches form
|
|
|
|
|
branch_.reset(build_document_branch(this));
|
|
|
|
|
|
|
|
|
|
fl_set_object_color(branch_->button_color,
|
|
|
|
|
GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
bcview().addReadOnly(branch_->input_all_branches);
|
|
|
|
|
bcview().addReadOnly(branch_->button_add_branch);
|
|
|
|
|
bcview().addReadOnly(branch_->button_remove_branch);
|
|
|
|
|
bcview().addReadOnly(branch_->button_select);
|
|
|
|
|
bcview().addReadOnly(branch_->button_deselect);
|
|
|
|
|
bcview().addReadOnly(branch_->button_modify);
|
|
|
|
|
bcview().addReadOnly(branch_->browser_all_branches);
|
|
|
|
|
|
|
|
|
|
// set up the tooltips for branches form
|
|
|
|
|
string str = _("Enter the name of a new branch.");
|
|
|
|
|
tooltips().init(branch_->input_all_branches, str);
|
|
|
|
|
str = _("Add a new branch to the document.");
|
|
|
|
|
tooltips().init(branch_->button_add_branch, str);
|
|
|
|
|
str = _("Remove the selected branch from the document.");
|
|
|
|
|
tooltips().init(branch_->button_remove_branch, str);
|
|
|
|
|
str = _("Activate the selected branch for output.");
|
|
|
|
|
tooltips().init(branch_->button_select, str);
|
|
|
|
|
str = _("Deactivate the selected activated branch.");
|
|
|
|
|
tooltips().init(branch_->button_deselect, str);
|
|
|
|
|
str = _("Available branches for this document.");
|
|
|
|
|
tooltips().init(branch_->browser_all_branches, str);
|
|
|
|
|
str = _("Activated branches. Content will occur in the document\'s output");
|
|
|
|
|
tooltips().init(branch_->browser_selection, str);
|
|
|
|
|
str = _("Modify background color of branch inset");
|
|
|
|
|
tooltips().init(branch_->button_modify, str);
|
|
|
|
|
str = _("Background color of branch inset");
|
|
|
|
|
tooltips().init(branch_->button_color, str);
|
|
|
|
|
|
|
|
|
|
// Handle middle mouse paint:
|
|
|
|
|
setPrehandler(branch_->input_all_branches);
|
|
|
|
|
fl_set_input_return(branch_->input_all_branches, FL_RETURN_CHANGED);
|
|
|
|
|
|
2003-04-09 21:34:50 +00:00
|
|
|
|
// Enable the tabfolder to be rescaled correctly.
|
|
|
|
|
if (scalableTabfolders)
|
|
|
|
|
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
|
|
|
|
|
|
|
|
|
|
// Stack tabs
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Document").c_str(),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
class_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Paper").c_str(),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
paper_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Language").c_str(),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
language_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Extra").c_str(),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
options_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets").c_str(),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
bullets_->form);
|
2002-10-03 17:20:28 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Branches").c_str(),
|
|
|
|
|
branch_->form);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
void FormDocument::apply()
|
|
|
|
|
{
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & params = controller().params();
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
class_apply(params);
|
|
|
|
|
paper_apply(params);
|
|
|
|
|
language_apply(params);
|
|
|
|
|
options_apply(params);
|
|
|
|
|
bullets_apply(params);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
branch_apply(params);
|
2000-10-05 07:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
void FormDocument::update()
|
2000-10-05 07:57:00 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!dialog_.get())
|
|
|
|
|
return;
|
2000-10-05 07:57:00 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
checkReadOnly();
|
2000-10-05 07:57:00 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams const & params = controller().params();
|
2001-09-27 12:13:51 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
class_update(params);
|
|
|
|
|
paper_update(params);
|
|
|
|
|
language_update(params);
|
|
|
|
|
options_update(params);
|
|
|
|
|
bullets_update(params);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
branch_update(params);
|
2000-10-05 07:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
|
2000-10-05 07:57:00 +00:00
|
|
|
|
{
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (ob == bullets_->choice_size) {
|
2000-10-05 07:57:00 +00:00
|
|
|
|
ChoiceBulletSize(ob, 0);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->input_latex) {
|
2000-10-05 07:57:00 +00:00
|
|
|
|
InputBulletLaTeX(ob, 0);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_depth_1 ||
|
|
|
|
|
ob == bullets_->radio_depth_2 ||
|
|
|
|
|
ob == bullets_->radio_depth_3 ||
|
|
|
|
|
ob == bullets_->radio_depth_4) {
|
2002-06-13 13:43:51 +00:00
|
|
|
|
BulletDepth(ob);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_standard ||
|
|
|
|
|
ob == bullets_->radio_panel_maths ||
|
|
|
|
|
ob == bullets_->radio_panel_ding1 ||
|
|
|
|
|
ob == bullets_->radio_panel_ding2 ||
|
|
|
|
|
ob == bullets_->radio_panel_ding3 ||
|
|
|
|
|
ob == bullets_->radio_panel_ding4) {
|
2002-06-13 13:43:51 +00:00
|
|
|
|
BulletPanel(ob);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->bmtable_panel) {
|
2000-10-05 07:57:00 +00:00
|
|
|
|
BulletBMTable(ob, 0);
|
2001-09-11 08:46:30 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == class_->choice_spacing) {
|
|
|
|
|
setEnabled(class_->input_spacing,
|
|
|
|
|
fl_get_choice(class_->choice_spacing) == 4);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == class_->combox_class) {
|
2003-04-02 14:20:30 +00:00
|
|
|
|
CheckChoiceClass();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == class_->radio_skip ||
|
|
|
|
|
ob == class_->radio_indent ||
|
|
|
|
|
ob == class_->choice_skip) {
|
|
|
|
|
bool const skip_used = fl_get_button(class_->radio_skip);
|
|
|
|
|
setEnabled(class_->choice_skip, skip_used);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
bool const length_input =
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_get_choice(class_->choice_skip) == 4;
|
|
|
|
|
setEnabled(class_->input_skip,
|
2001-10-23 11:35:48 +00:00
|
|
|
|
skip_used && length_input);
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setEnabled(class_->choice_skip_units,
|
2001-10-23 11:35:48 +00:00
|
|
|
|
skip_used && length_input);
|
2002-12-01 21:10:37 +00:00
|
|
|
|
|
2001-10-23 09:00:12 +00:00
|
|
|
|
// Default unit choice is cm if metric, inches if US paper.
|
2002-01-04 15:14:22 +00:00
|
|
|
|
// If papersize is default, check the lyxrc-settings
|
2001-10-23 09:00:12 +00:00
|
|
|
|
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
2003-07-26 23:04:39 +00:00
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
2002-01-04 15:14:22 +00:00
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (getString(class_->input_skip).empty())
|
|
|
|
|
fl_set_choice_text(class_->choice_skip_units,
|
2003-04-02 09:49:19 +00:00
|
|
|
|
default_unit.c_str());
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
} else if (ob == options_->check_use_natbib) {
|
2001-09-11 08:46:30 +00:00
|
|
|
|
setEnabled(options_->choice_citation_format,
|
|
|
|
|
fl_get_button(options_->check_use_natbib));
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
} else if (ob == branch_->browser_all_branches ||
|
|
|
|
|
ob == branch_->browser_selection ||
|
|
|
|
|
ob == branch_->button_add_branch ||
|
|
|
|
|
ob == branch_->button_remove_branch ||
|
|
|
|
|
ob == branch_->button_modify ||
|
|
|
|
|
ob == branch_->button_select ||
|
|
|
|
|
ob == branch_->button_deselect ||
|
|
|
|
|
ob == branch_->button_deselect) {
|
|
|
|
|
branch_input(ob);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
} else if (ob == dialog_->button_save_defaults) {
|
2002-11-22 10:47:56 +00:00
|
|
|
|
apply();
|
|
|
|
|
controller().saveAsDefault();
|
2001-09-21 10:41:09 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
} else if (ob == dialog_->button_reset_defaults) {
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & params = controller().params();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
params.textclass = fl_get_combox(class_->combox_class) - 1;
|
2001-09-21 10:41:09 +00:00
|
|
|
|
params.useClassDefaults();
|
|
|
|
|
UpdateLayoutDocument(params);
|
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
} else if (ob == paper_->radio_landscape) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice(paper_->choice_paperpackage,
|
2003-07-26 23:04:39 +00:00
|
|
|
|
PACKAGE_NONE + 1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
} else if (ob == paper_->choice_papersize) {
|
2001-10-15 10:28:31 +00:00
|
|
|
|
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
2002-01-04 15:14:22 +00:00
|
|
|
|
bool const defsize = paperchoice == 1;
|
2001-10-15 10:28:31 +00:00
|
|
|
|
bool const custom = paperchoice == 2;
|
|
|
|
|
bool const a3size = paperchoice == 6;
|
|
|
|
|
bool const b3size = paperchoice == 9;
|
|
|
|
|
bool const b4size = paperchoice == 10;
|
2001-10-11 17:28:28 +00:00
|
|
|
|
|
2001-10-12 08:34:29 +00:00
|
|
|
|
if (custom)
|
|
|
|
|
fl_set_button(paper_->radio_portrait, 1);
|
2001-10-11 17:28:28 +00:00
|
|
|
|
|
|
|
|
|
bool const use_geom = (custom || a3size || b3size || b4size);
|
|
|
|
|
|
|
|
|
|
fl_set_button(paper_->check_use_geometry, int(use_geom));
|
|
|
|
|
|
|
|
|
|
setEnabled(paper_->input_top_margin, use_geom);
|
|
|
|
|
setEnabled(paper_->input_bottom_margin, use_geom);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->input_inner_margin, use_geom);
|
|
|
|
|
setEnabled(paper_->input_outer_margin, use_geom);
|
2001-10-11 17:28:28 +00:00
|
|
|
|
setEnabled(paper_->input_head_height, use_geom);
|
|
|
|
|
setEnabled(paper_->input_head_sep, use_geom);
|
|
|
|
|
setEnabled(paper_->input_foot_skip, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_top_margin_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_bottom_margin_units, use_geom);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->choice_inner_margin_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_outer_margin_units, use_geom);
|
2001-10-11 17:28:28 +00:00
|
|
|
|
setEnabled(paper_->choice_head_height_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_head_sep_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_foot_skip_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_custom_width_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_custom_height_units, use_geom);
|
|
|
|
|
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_custom_width, custom);
|
|
|
|
|
setEnabled(paper_->input_custom_height, custom);
|
|
|
|
|
setEnabled(paper_->choice_custom_width_units, custom);
|
|
|
|
|
setEnabled(paper_->choice_custom_height_units, custom);
|
|
|
|
|
setEnabled(paper_->radio_portrait, !custom);
|
|
|
|
|
setEnabled(paper_->radio_landscape, !custom);
|
2001-10-15 10:28:31 +00:00
|
|
|
|
|
|
|
|
|
// Default unit choice is cm if metric, inches if US paper.
|
2002-01-04 15:14:22 +00:00
|
|
|
|
// If papersize is default, use the lyxrc-settings
|
2003-07-26 23:04:39 +00:00
|
|
|
|
bool const metric = (defsize && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
2002-01-04 15:14:22 +00:00
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
|
|
|
|
if (getString(paper_->input_custom_width).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_custom_width_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_custom_height).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_custom_height_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_top_margin).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_top_margin_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_bottom_margin).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_bottom_margin_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_inner_margin).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_inner_margin_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_outer_margin).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_outer_margin_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_head_height).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_head_height_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_head_sep).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_head_sep_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
if (getString(paper_->input_foot_skip).empty())
|
|
|
|
|
fl_set_choice_text(paper_->choice_foot_skip_units,
|
|
|
|
|
default_unit.c_str());
|
|
|
|
|
|
|
|
|
|
} else if (ob == paper_->choice_paperpackage &&
|
|
|
|
|
fl_get_choice(paper_->choice_paperpackage) != 1) {
|
|
|
|
|
|
|
|
|
|
fl_set_button(paper_->check_use_geometry, 0);
|
|
|
|
|
setEnabled(paper_->input_top_margin, false);
|
|
|
|
|
setEnabled(paper_->input_bottom_margin, false);
|
|
|
|
|
setEnabled(paper_->input_inner_margin, false);
|
|
|
|
|
setEnabled(paper_->input_outer_margin, false);
|
|
|
|
|
setEnabled(paper_->input_head_height, false);
|
|
|
|
|
setEnabled(paper_->input_head_sep, false);
|
|
|
|
|
setEnabled(paper_->input_foot_skip, false);
|
|
|
|
|
setEnabled(paper_->choice_top_margin_units, false);
|
|
|
|
|
setEnabled(paper_->choice_bottom_margin_units, false);
|
|
|
|
|
setEnabled(paper_->choice_inner_margin_units, false);
|
|
|
|
|
setEnabled(paper_->choice_outer_margin_units, false);
|
|
|
|
|
setEnabled(paper_->choice_head_height_units, false);
|
|
|
|
|
setEnabled(paper_->choice_head_sep_units, false);
|
|
|
|
|
setEnabled(paper_->choice_foot_skip_units, false);
|
|
|
|
|
|
|
|
|
|
} else if (ob == paper_->check_use_geometry) {
|
|
|
|
|
// don't allow switching geometry off in custom papersize
|
|
|
|
|
// mode nor in A3, B3, and B4
|
2001-10-11 17:28:28 +00:00
|
|
|
|
int const choice = fl_get_choice(paper_->choice_papersize);
|
|
|
|
|
if (choice == 2 || choice == 6 || choice == 9 || choice == 10)
|
2001-10-09 12:36:36 +00:00
|
|
|
|
fl_set_button(paper_->check_use_geometry, 1);
|
2001-10-11 17:28:28 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice(paper_->choice_paperpackage,
|
2003-07-26 23:04:39 +00:00
|
|
|
|
PACKAGE_NONE + 1);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
bool const use_geom = fl_get_button(paper_->check_use_geometry);
|
|
|
|
|
setEnabled(paper_->input_top_margin, use_geom);
|
|
|
|
|
setEnabled(paper_->input_bottom_margin, use_geom);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->input_inner_margin, use_geom);
|
|
|
|
|
setEnabled(paper_->input_outer_margin, use_geom);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_head_height, use_geom);
|
|
|
|
|
setEnabled(paper_->input_head_sep, use_geom);
|
|
|
|
|
setEnabled(paper_->input_foot_skip, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_top_margin_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_bottom_margin_units, use_geom);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->choice_inner_margin_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_outer_margin_units, use_geom);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->choice_head_height_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_head_sep_units, use_geom);
|
|
|
|
|
setEnabled(paper_->choice_foot_skip_units, use_geom);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2001-09-21 10:41:09 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
if (ob == paper_->choice_papersize || ob == paper_->radio_portrait
|
2003-04-02 09:49:19 +00:00
|
|
|
|
|| ob == paper_->radio_landscape) {
|
2002-10-23 13:15:32 +00:00
|
|
|
|
// either default papersize (preferences) or document
|
|
|
|
|
// papersize has to be A4
|
|
|
|
|
bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1
|
2003-07-26 23:04:39 +00:00
|
|
|
|
&& lyxrc.default_papersize == PAPER_A4PAPER )
|
2003-04-02 09:49:19 +00:00
|
|
|
|
|| fl_get_choice(paper_->choice_papersize) == 7;
|
2003-02-12 17:05:56 +00:00
|
|
|
|
if (!enable)
|
|
|
|
|
fl_set_choice(paper_->choice_paperpackage,
|
2003-07-26 23:04:39 +00:00
|
|
|
|
PACKAGE_NONE + 1);
|
2003-02-21 15:36:29 +00:00
|
|
|
|
setEnabled(paper_->choice_paperpackage,
|
2003-04-02 09:49:19 +00:00
|
|
|
|
enable && fl_get_button(paper_->radio_portrait));
|
2002-10-23 13:15:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2000-10-05 07:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
void FormDocument::branch_input(FL_OBJECT * ob)
|
|
|
|
|
{
|
|
|
|
|
BufferParams & params = controller().params();
|
|
|
|
|
std::vector<string> vec;
|
|
|
|
|
|
|
|
|
|
if (ob == branch_->button_add_branch) {
|
|
|
|
|
string new_branch = fl_get_input(branch_->input_all_branches);
|
|
|
|
|
if (!new_branch.empty()) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.branchlist().add(new_branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_set_input(branch_->input_all_branches, "");
|
|
|
|
|
// Update branch list
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const all_branches = params.branchlist().allBranches();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_clear_browser(branch_->browser_all_branches);
|
|
|
|
|
vec = getVectorFromString(all_branches, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_all_branches,
|
|
|
|
|
vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
LColor::color c = static_cast<LColor::color>(lcolor.size());
|
|
|
|
|
lcolor.fill(c, new_branch, lcolor.getX11Name(LColor::background));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (ob == branch_->button_remove_branch) {
|
|
|
|
|
unsigned i = fl_get_browser(branch_->browser_all_branches);
|
|
|
|
|
string const current_branch =
|
|
|
|
|
fl_get_browser_line(branch_->browser_all_branches, i);
|
|
|
|
|
if (!current_branch.empty()) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.branchlist().remove(current_branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
// Update branch list
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const all_branches = params.branchlist().allBranches();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_clear_browser(branch_->browser_all_branches);
|
|
|
|
|
vec = getVectorFromString(all_branches, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_all_branches,
|
|
|
|
|
vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
// Update selected-list...
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const all_selected = params.branchlist().allSelected();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_clear_browser(branch_->browser_selection);
|
|
|
|
|
vec = getVectorFromString(all_selected, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_selection, vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (ob == branch_->button_select) {
|
|
|
|
|
unsigned i = fl_get_browser(branch_->browser_all_branches);
|
|
|
|
|
string const current_branch =
|
|
|
|
|
fl_get_browser_line(branch_->browser_all_branches, i);
|
|
|
|
|
if (!current_branch.empty()) {
|
|
|
|
|
fl_clear_browser(branch_->browser_selection);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.branchlist().setSelected(current_branch, true);
|
|
|
|
|
string const all_selected = params.branchlist().allSelected();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
vec = getVectorFromString(all_selected, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_selection,
|
|
|
|
|
vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (ob == branch_->button_deselect) {
|
|
|
|
|
unsigned i = fl_get_browser(branch_->browser_selection);
|
|
|
|
|
string const current_sel =
|
|
|
|
|
fl_get_browser_line(branch_->browser_selection, i);
|
|
|
|
|
if (!current_sel.empty()) {
|
|
|
|
|
fl_clear_browser(branch_->browser_selection);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.branchlist().setSelected(current_sel, false);
|
|
|
|
|
string const all_selected = params.branchlist().allSelected();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
vec = getVectorFromString(all_selected, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_selection,
|
|
|
|
|
vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (ob == branch_->button_modify) {
|
|
|
|
|
unsigned i = fl_get_browser(branch_->browser_all_branches);
|
|
|
|
|
string const current_branch =
|
|
|
|
|
fl_get_browser_line(branch_->browser_all_branches, i);
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
RGBColor before;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string x11hexname = params.branchlist().getColor(current_branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (x11hexname[0] == '#') {
|
|
|
|
|
before = RGBColor(x11hexname);
|
|
|
|
|
} else{
|
|
|
|
|
fl_getmcolor(FL_COL1, &before.r, &before.g, &before.b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RGBColor col = picker_->requestColor(before);
|
|
|
|
|
if (before != col) {
|
|
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
|
|
|
|
|
fl_redraw_object(branch_->button_color);
|
|
|
|
|
// Figure out here how to stash the new colour into the
|
|
|
|
|
// LyX colour database.
|
|
|
|
|
|
|
|
|
|
x11hexname = X11hexname(col);
|
|
|
|
|
|
|
|
|
|
// current_branch already in database
|
|
|
|
|
LColor::color c = lcolor.getFromLyXName(current_branch);
|
|
|
|
|
lcolor.setColor(current_branch, x11hexname);
|
|
|
|
|
// Make sure that new colour is also displayed ;-)
|
|
|
|
|
lyxColorHandler->getGCForeground(c);
|
|
|
|
|
lyxColorHandler->updateColor(c);
|
|
|
|
|
// what about system_lcolor?
|
|
|
|
|
// Here set colour in BranchList:
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.branchlist().setColor(current_branch, x11hexname);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
} else if (ob == branch_->browser_all_branches) {
|
|
|
|
|
unsigned i = fl_get_browser(branch_->browser_all_branches);
|
|
|
|
|
string const current_branch =
|
|
|
|
|
fl_get_browser_line(branch_->browser_all_branches, i);
|
|
|
|
|
// make button_color track selected branch:
|
|
|
|
|
|
|
|
|
|
RGBColor rgb;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string x11hexname = params.branchlist().getColor(current_branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (x11hexname[0] == '#') {
|
|
|
|
|
rgb = RGBColor(x11hexname);
|
|
|
|
|
} else {
|
|
|
|
|
fl_getmcolor(FL_COL1, &rgb.r, &rgb.g, &rgb.b);
|
|
|
|
|
}
|
|
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, rgb.r, rgb.g, rgb.b);
|
|
|
|
|
fl_redraw_object(branch_->button_color);
|
|
|
|
|
}
|
|
|
|
|
setEnabled(branch_->button_select,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
setEnabled(branch_->button_deselect,
|
|
|
|
|
(fl_get_browser(branch_->browser_selection) > 0));
|
|
|
|
|
setEnabled(branch_->button_remove_branch,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
setEnabled(branch_->button_modify,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
branchlist_ = params.branchlist();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
bool FormDocument::class_apply(BufferParams ¶ms)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
|
|
|
|
bool redo = false;
|
|
|
|
|
|
|
|
|
|
// If default skip is a "Length" but there's no text in the
|
2003-01-23 16:23:43 +00:00
|
|
|
|
// input field, reset the kind to "MedSkip", which is the default.
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (fl_get_choice(class_->choice_skip) == 4 &&
|
|
|
|
|
getString(class_->input_skip).empty()) {
|
|
|
|
|
fl_set_choice(class_->choice_skip, 2);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
2003-04-02 18:57:58 +00:00
|
|
|
|
params.fonts = getString(class_->choice_fonts);
|
|
|
|
|
params.fontsize = getString(class_->choice_fontsize);
|
|
|
|
|
params.pagestyle = getString(class_->choice_pagestyle);
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
params.textclass = fl_get_combox(class_->combox_class) - 1;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-10-15 03:46:23 +00:00
|
|
|
|
BufferParams::PARSEP tmpsep = params.paragraph_separation;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (fl_get_button(class_->radio_indent))
|
2000-08-11 14:42:20 +00:00
|
|
|
|
params.paragraph_separation = BufferParams::PARSEP_INDENT;
|
|
|
|
|
else
|
|
|
|
|
params.paragraph_separation = BufferParams::PARSEP_SKIP;
|
|
|
|
|
if (tmpsep != params.paragraph_separation)
|
|
|
|
|
redo = true;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
VSpace tmpdefskip = params.getDefSkip();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
switch (fl_get_choice(class_->choice_skip)) {
|
2000-08-11 14:42:20 +00:00
|
|
|
|
case 1:
|
|
|
|
|
params.setDefSkip(VSpace(VSpace::SMALLSKIP));
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
params.setDefSkip(VSpace(VSpace::MEDSKIP));
|
|
|
|
|
break;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
case 3:
|
2002-03-21 16:59:12 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::BIGSKIP));
|
|
|
|
|
break;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
case 4:
|
2001-10-23 09:00:12 +00:00
|
|
|
|
{
|
|
|
|
|
string const length =
|
2003-04-02 18:57:58 +00:00
|
|
|
|
getLengthFromWidgets(class_->input_skip,
|
|
|
|
|
class_->choice_skip_units);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
|
|
|
|
params.setDefSkip(VSpace(LyXGlueLength(length)));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
default:
|
2001-10-23 09:00:12 +00:00
|
|
|
|
// DocumentDefskipCB assures that this never happens
|
2000-08-11 14:42:20 +00:00
|
|
|
|
params.setDefSkip(VSpace(VSpace::MEDSKIP));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!(tmpdefskip == params.getDefSkip()))
|
|
|
|
|
redo = true;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (fl_get_button(class_->radio_columns_two))
|
2000-08-11 14:42:20 +00:00
|
|
|
|
params.columns = 2;
|
|
|
|
|
else
|
|
|
|
|
params.columns = 1;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (fl_get_button(class_->radio_sides_two))
|
2000-08-11 14:42:20 +00:00
|
|
|
|
params.sides = LyXTextClass::TwoSides;
|
|
|
|
|
else
|
|
|
|
|
params.sides = LyXTextClass::OneSide;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
Spacing tmpSpacing = params.spacing();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
switch (fl_get_choice(class_->choice_spacing)) {
|
2000-08-11 14:42:20 +00:00
|
|
|
|
case 1:
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: SINGLE" << endl;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.spacing().set(Spacing::Single);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: ONEHALF" << endl;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.spacing().set(Spacing::Onehalf);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: DOUBLE" << endl;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.spacing().set(Spacing::Double);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: OTHER" << endl;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.spacing().set(Spacing::Other,
|
2003-04-02 18:57:58 +00:00
|
|
|
|
getString(class_->input_spacing));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2003-09-09 17:00:19 +00:00
|
|
|
|
if (tmpSpacing != params.spacing())
|
2000-08-11 14:42:20 +00:00
|
|
|
|
redo = true;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
params.options = getString(class_->input_extra);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
return redo;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
void FormDocument::paper_apply(BufferParams & params)
|
|
|
|
|
{
|
2003-07-26 23:04:39 +00:00
|
|
|
|
params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.paperpackage =
|
2003-07-26 23:04:39 +00:00
|
|
|
|
PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
// set params.papersize from params.papersize2 and params.paperpackage
|
2001-11-07 10:25:05 +00:00
|
|
|
|
params.setPaperStuff();
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
params.use_geometry = fl_get_button(paper_->check_use_geometry);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (fl_get_button(paper_->radio_landscape))
|
2003-07-26 23:04:39 +00:00
|
|
|
|
params.orientation = ORIENTATION_LANDSCAPE;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
else
|
2003-07-26 23:04:39 +00:00
|
|
|
|
params.orientation = ORIENTATION_PORTRAIT;
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
params.paperwidth =
|
|
|
|
|
getLengthFromWidgets(paper_->input_custom_width,
|
|
|
|
|
paper_->choice_custom_width_units);
|
|
|
|
|
|
|
|
|
|
params.paperheight =
|
|
|
|
|
getLengthFromWidgets(paper_->input_custom_height,
|
|
|
|
|
paper_->choice_custom_height_units);
|
|
|
|
|
|
|
|
|
|
params.leftmargin =
|
2002-01-07 18:42:30 +00:00
|
|
|
|
getLengthFromWidgets(paper_->input_inner_margin,
|
|
|
|
|
paper_->choice_inner_margin_units);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
params.topmargin =
|
|
|
|
|
getLengthFromWidgets(paper_->input_top_margin,
|
|
|
|
|
paper_->choice_top_margin_units);
|
|
|
|
|
|
|
|
|
|
params.rightmargin =
|
2002-01-07 18:42:30 +00:00
|
|
|
|
getLengthFromWidgets(paper_->input_outer_margin,
|
|
|
|
|
paper_->choice_outer_margin_units);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
params.bottommargin =
|
|
|
|
|
getLengthFromWidgets(paper_->input_bottom_margin,
|
|
|
|
|
paper_->choice_bottom_margin_units);
|
|
|
|
|
|
|
|
|
|
params.headheight =
|
|
|
|
|
getLengthFromWidgets(paper_->input_head_height,
|
|
|
|
|
paper_->choice_head_height_units);
|
|
|
|
|
|
|
|
|
|
params.headsep =
|
|
|
|
|
getLengthFromWidgets(paper_->input_head_sep,
|
|
|
|
|
paper_->choice_head_sep_units);
|
|
|
|
|
|
|
|
|
|
params.footskip =
|
|
|
|
|
getLengthFromWidgets(paper_->input_foot_skip,
|
|
|
|
|
paper_->choice_foot_skip_units);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
bool FormDocument::language_apply(BufferParams & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
|
|
|
|
|
bool redo = false;
|
|
|
|
|
|
|
|
|
|
switch (fl_get_choice(language_->choice_quotes_language) - 1) {
|
|
|
|
|
case 0:
|
|
|
|
|
lga = InsetQuotes::EnglishQ;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
break;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
if (fl_get_button(language_->radio_single))
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.quotes_times = InsetQuotes::SingleQ;
|
|
|
|
|
else
|
|
|
|
|
params.quotes_times = InsetQuotes::DoubleQ;
|
|
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
|
int const pos = fl_get_combox(language_->combox_language);
|
2002-04-29 15:56:36 +00:00
|
|
|
|
Language const * new_language = languages.getLanguage(lang_[pos-1]);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!new_language)
|
|
|
|
|
new_language = default_language;
|
|
|
|
|
|
|
|
|
|
params.language = new_language;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
params.inputenc = getString(language_->choice_inputenc);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
return redo;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
bool FormDocument::options_apply(BufferParams & params)
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
bool redo = false;
|
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
params.graphicsDriver = getString(options_->choice_postscript_driver);
|
2003-03-06 11:07:55 +00:00
|
|
|
|
params.use_amsmath = static_cast<BufferParams::AMS>(
|
|
|
|
|
fl_get_choice(options_->choice_ams_math) - 1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.use_natbib = fl_get_button(options_->check_use_natbib);
|
|
|
|
|
params.use_numerical_citations =
|
2002-08-23 11:49:28 +00:00
|
|
|
|
fl_get_choice(options_->choice_citation_format) - 1;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (params.secnumdepth != tmpchar)
|
|
|
|
|
redo = true;
|
|
|
|
|
params.secnumdepth = tmpchar;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
params.tocdepth = int(fl_get_counter_value(options_->counter_tocdepth));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.float_placement =
|
2002-10-23 13:15:32 +00:00
|
|
|
|
getString(options_->input_float_placement);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
return redo;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
void FormDocument::bullets_apply(BufferParams & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* update the bullet settings */
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & buf_params = controller().params();
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.user_defined_bullet(i) = buf_params.temp_bullet(i);
|
2003-04-02 14:20:30 +00:00
|
|
|
|
}
|
2001-11-07 10:25:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
void FormDocument::branch_apply(BufferParams & params)
|
|
|
|
|
{
|
|
|
|
|
BufferParams & prms = controller().params();
|
|
|
|
|
if (branchlist_.empty())
|
2003-09-09 17:00:19 +00:00
|
|
|
|
branchlist_ = prms.branchlist();
|
|
|
|
|
params.branchlist() = branchlist_;
|
2003-08-17 11:28:23 +00:00
|
|
|
|
branchlist_.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2002-04-10 14:06:14 +00:00
|
|
|
|
void FormDocument::UpdateClassParams(BufferParams const & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2002-04-10 14:06:14 +00:00
|
|
|
|
// These are the params that have to be updated on any class change
|
|
|
|
|
// (even if the class defaults are not used) (JSpitzm 2002-04-08)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
LyXTextClass const & tclass = textclasslist[params.textclass];
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_combox(class_->combox_class, params.textclass + 1);
|
|
|
|
|
fl_clear_choice(class_->choice_fontsize);
|
|
|
|
|
fl_addto_choice(class_->choice_fontsize, "default");
|
|
|
|
|
fl_addto_choice(class_->choice_fontsize,
|
2001-10-03 16:31:10 +00:00
|
|
|
|
tclass.opt_fontsize().c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice_text(class_->choice_fontsize,
|
2003-04-02 09:49:19 +00:00
|
|
|
|
params.fontsize.c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_clear_choice(class_->choice_pagestyle);
|
|
|
|
|
fl_addto_choice(class_->choice_pagestyle, "default");
|
|
|
|
|
fl_addto_choice(class_->choice_pagestyle,
|
2001-10-03 16:31:10 +00:00
|
|
|
|
tclass.opt_pagestyle().c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice_text(class_->choice_pagestyle,
|
2003-04-02 09:49:19 +00:00
|
|
|
|
params.pagestyle.c_str());
|
2002-04-10 14:06:14 +00:00
|
|
|
|
|
2003-08-20 07:23:06 +00:00
|
|
|
|
fl_set_input(class_->input_extra, tclass.options().c_str());
|
2002-04-10 14:06:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FormDocument::class_update(BufferParams const & params)
|
|
|
|
|
{
|
|
|
|
|
if (!class_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
UpdateClassParams(params);
|
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice_text(class_->choice_fonts, params.fonts.c_str());
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
bool const indent = params.paragraph_separation == BufferParams::PARSEP_INDENT;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_button(class_->radio_indent, indent);
|
|
|
|
|
fl_set_button(class_->radio_skip, !indent);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
int pos;
|
|
|
|
|
if (indent) {
|
|
|
|
|
pos = 2; // VSpace::MEDSKIP is default
|
|
|
|
|
} else {
|
|
|
|
|
switch (params.getDefSkip().kind()) {
|
|
|
|
|
case VSpace::LENGTH:
|
|
|
|
|
pos = 4;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
|
|
|
|
pos = 3;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::SMALLSKIP:
|
|
|
|
|
pos = 1;
|
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
|
|
|
|
default:
|
|
|
|
|
pos = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice (class_->choice_skip, pos);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
bool const length_input = pos == 4;
|
|
|
|
|
if (length_input) {
|
2002-01-04 15:14:22 +00:00
|
|
|
|
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
2003-07-26 23:04:39 +00:00
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
2002-01-04 15:14:22 +00:00
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
|
|
|
|
string const length = params.getDefSkip().asLyXCommand();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
updateWidgetsFromLengthString(class_->input_skip,
|
|
|
|
|
class_->choice_skip_units,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
length, default_unit);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
} else {
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(class_->input_skip, "");
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setEnabled(class_->choice_skip, !indent);
|
|
|
|
|
setEnabled(class_->input_skip, length_input);
|
|
|
|
|
setEnabled(class_->choice_skip_units, length_input);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2002-10-23 13:15:32 +00:00
|
|
|
|
bool const two_sides = params.sides == LyXTextClass::TwoSides;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_button(class_->radio_sides_one, !two_sides);
|
|
|
|
|
fl_set_button(class_->radio_sides_two, two_sides);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
bool const two_columns = params.columns == 2;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_button(class_->radio_columns_one, !two_columns);
|
|
|
|
|
fl_set_button(class_->radio_columns_two, two_columns);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(class_->input_extra, params.options.c_str());
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
switch (params.spacing().getSpace()) {
|
2002-10-23 13:15:32 +00:00
|
|
|
|
case Spacing::Other:
|
|
|
|
|
pos = 4;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
case Spacing::Double: // \doublespacing
|
|
|
|
|
pos = 3;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
case Spacing::Onehalf: // \onehalfspacing
|
|
|
|
|
pos = 2;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
2002-10-23 13:15:32 +00:00
|
|
|
|
case Spacing::Single: // \singlespacing
|
|
|
|
|
case Spacing::Default: // nothing bad should happen with this
|
|
|
|
|
default:
|
|
|
|
|
pos = 1;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice(class_->choice_spacing, pos);
|
2002-10-23 13:15:32 +00:00
|
|
|
|
|
|
|
|
|
bool const spacing_input = pos == 4;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setEnabled(class_->input_spacing, spacing_input);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const input = spacing_input ? tostr(params.spacing().getValue()) : string();
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(class_->input_spacing, input.c_str());
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-18 14:36:12 +00:00
|
|
|
|
void FormDocument::language_update(BufferParams const & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!language_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
2002-04-29 15:56:36 +00:00
|
|
|
|
int const pos = int(findPos(lang_, params.language->lang()));
|
2003-04-02 14:20:30 +00:00
|
|
|
|
fl_set_combox(language_->combox_language, pos+1);
|
2002-04-29 15:56:36 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-18 14:36:12 +00:00
|
|
|
|
void FormDocument::options_update(BufferParams const & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!options_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
fl_set_choice_text(options_->choice_postscript_driver,
|
|
|
|
|
params.graphicsDriver.c_str());
|
2003-03-06 11:07:55 +00:00
|
|
|
|
fl_set_choice(options_->choice_ams_math, params.use_amsmath + 1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
|
|
|
|
|
fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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, "");
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-18 14:36:12 +00:00
|
|
|
|
void FormDocument::paper_update(BufferParams const & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!paper_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
2001-10-09 12:36:36 +00:00
|
|
|
|
fl_set_choice(paper_->choice_papersize, params.papersize2 + 1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
fl_set_button(paper_->check_use_geometry, params.use_geometry);
|
|
|
|
|
|
2001-10-15 10:28:31 +00:00
|
|
|
|
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
|
|
|
|
bool const useCustom = paperchoice == 2;
|
2001-10-09 12:36:36 +00:00
|
|
|
|
bool const useGeom = fl_get_button(paper_->check_use_geometry);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_button(paper_->radio_portrait, 0);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->radio_portrait, !useCustom);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_button(paper_->radio_landscape, 0);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->radio_landscape, !useCustom);
|
|
|
|
|
|
2003-07-26 23:04:39 +00:00
|
|
|
|
if (params.orientation == ORIENTATION_LANDSCAPE)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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
|
2001-10-15 10:28:31 +00:00
|
|
|
|
(paperchoice == 7
|
2003-07-26 23:04:39 +00:00
|
|
|
|
|| paperchoice == 1 && lyxrc.default_papersize == PAPER_A4PAPER)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
&& fl_get_button(paper_->radio_portrait));
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
2001-10-15 10:28:31 +00:00
|
|
|
|
// Default unit choice is cm if metric, inches if US paper.
|
2003-07-26 23:04:39 +00:00
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
2002-03-21 16:59:12 +00:00
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2001-10-15 10:28:31 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
2001-10-09 12:36:36 +00:00
|
|
|
|
updateWidgetsFromLengthString(paper_->input_custom_width,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
paper_->choice_custom_width_units,
|
|
|
|
|
params.paperwidth, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_custom_width, useCustom);
|
|
|
|
|
setEnabled(paper_->choice_custom_width_units, useCustom);
|
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_custom_height,
|
|
|
|
|
paper_->choice_custom_height_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.paperheight, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_custom_height, useCustom);
|
|
|
|
|
setEnabled(paper_->choice_custom_height_units, useCustom);
|
|
|
|
|
|
2002-01-07 18:42:30 +00:00
|
|
|
|
updateWidgetsFromLengthString(paper_->input_inner_margin,
|
|
|
|
|
paper_->choice_inner_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.leftmargin, default_unit);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->input_inner_margin, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_inner_margin_units, useGeom);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_top_margin,
|
|
|
|
|
paper_->choice_top_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.topmargin, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_top_margin, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_top_margin_units, useGeom);
|
|
|
|
|
|
2002-01-07 18:42:30 +00:00
|
|
|
|
updateWidgetsFromLengthString(paper_->input_outer_margin,
|
|
|
|
|
paper_->choice_outer_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.rightmargin, default_unit);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->input_outer_margin, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_outer_margin_units, useGeom);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_bottom_margin,
|
|
|
|
|
paper_->choice_bottom_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.bottommargin, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_bottom_margin, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_bottom_margin_units, useGeom);
|
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_head_height,
|
|
|
|
|
paper_->choice_head_height_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.headheight, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_head_height, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_head_height_units, useGeom);
|
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_head_sep,
|
|
|
|
|
paper_->choice_head_sep_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.headsep, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_head_sep, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_head_sep_units, useGeom);
|
|
|
|
|
|
|
|
|
|
updateWidgetsFromLengthString(paper_->input_foot_skip,
|
|
|
|
|
paper_->choice_foot_skip_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
params.footskip, default_unit);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->input_foot_skip, useGeom);
|
|
|
|
|
setEnabled(paper_->choice_foot_skip_units, useGeom);
|
|
|
|
|
|
|
|
|
|
fl_set_focus_object(paper_->form, paper_->choice_papersize);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-18 14:36:12 +00:00
|
|
|
|
void FormDocument::bullets_update(BufferParams const & params)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!bullets_.get() ||
|
|
|
|
|
((XpmVersion<4) ||
|
|
|
|
|
(XpmVersion==4 && XpmRevision<7)))
|
|
|
|
|
return;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
bool const isLinuxDoc =
|
|
|
|
|
controller().docType() == ControlDocument::LINUXDOC;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
setEnabled(fbullet, !isLinuxDoc);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (isLinuxDoc) return;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_button(bullets_->radio_depth_1, 1);
|
|
|
|
|
fl_set_input(bullets_->input_latex,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.user_defined_bullet(0).getText().c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice(bullets_->choice_size,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
params.user_defined_bullet(0).getSize() + 2);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
void FormDocument::branch_update(BufferParams const & params)
|
|
|
|
|
{
|
|
|
|
|
if (!branch_.get())
|
|
|
|
|
return;
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const all_branches = params.branchlist().allBranches();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_clear_browser(branch_->browser_all_branches);
|
|
|
|
|
string current_branch("none");
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (!all_branches.empty()) {
|
|
|
|
|
std::vector<string> vec = getVectorFromString(all_branches, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_all_branches, vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
fl_select_browser_line(branch_->browser_all_branches, 1);
|
2003-08-29 12:18:40 +00:00
|
|
|
|
if (!vec.empty())
|
|
|
|
|
current_branch =
|
|
|
|
|
fl_get_browser_line(branch_->browser_all_branches, 1);
|
|
|
|
|
else
|
|
|
|
|
current_branch = "none";
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// display proper selection...
|
2003-09-09 17:00:19 +00:00
|
|
|
|
string const all_selected = params.branchlist().allSelected();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
fl_clear_browser(branch_->browser_selection);
|
|
|
|
|
if (!all_selected.empty()) {
|
|
|
|
|
std::vector<string> vec = getVectorFromString(all_selected, "|");
|
|
|
|
|
for (unsigned i = 0; i < vec.size(); ++i) {
|
|
|
|
|
fl_addto_browser(branch_->browser_selection, vec[i].c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// display proper colour...
|
|
|
|
|
RGBColor rgb;
|
2003-08-29 12:18:40 +00:00
|
|
|
|
string x11hexname;
|
|
|
|
|
if (current_branch == "none")
|
|
|
|
|
x11hexname = "none";
|
|
|
|
|
else
|
2003-09-09 17:00:19 +00:00
|
|
|
|
x11hexname = params.branchlist().getColor(current_branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (x11hexname[0] == '#') {
|
|
|
|
|
rgb = RGBColor(x11hexname);
|
|
|
|
|
} else {
|
|
|
|
|
fl_getmcolor(FL_COL1, &rgb.r, &rgb.g, &rgb.b);
|
|
|
|
|
}
|
|
|
|
|
fl_mapcolor(GUI_COLOR_CHOICE, rgb.r, rgb.g, rgb.b);
|
|
|
|
|
fl_redraw_object(branch_->button_color);
|
|
|
|
|
|
|
|
|
|
setEnabled(branch_->button_select,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
setEnabled(branch_->button_deselect,
|
|
|
|
|
(fl_get_browser(branch_->browser_selection) > 0));
|
|
|
|
|
setEnabled(branch_->button_remove_branch,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
setEnabled(branch_->button_modify,
|
|
|
|
|
(fl_get_browser(branch_->browser_all_branches) > 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-29 01:46:59 +00:00
|
|
|
|
void FormDocument::checkReadOnly()
|
|
|
|
|
{
|
2002-11-22 10:47:56 +00:00
|
|
|
|
if (bc().readOnly(controller().bufferIsReadonly())) {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
postWarning(_("Document is read-only."
|
|
|
|
|
" No changes to layout permitted."));
|
2001-10-03 16:31:10 +00:00
|
|
|
|
} else {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
clearMessage();
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2000-08-29 01:46:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & param = controller().params();
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
// convert from 1-6 range to -1-4
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(current_bullet_depth).setSize(fl_get_choice(ob) - 2);
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(bullets_->input_latex,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(current_bullet_depth).getText().c_str());
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
|
|
|
|
|
{
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & param = controller().params();
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(current_bullet_depth).
|
2003-04-02 18:57:58 +00:00
|
|
|
|
setText(getString(bullets_->input_latex));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
|
void FormDocument::BulletDepth(FL_OBJECT * ob)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* 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 */
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & param = controller().params();
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
int data = 0;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (ob == bullets_->radio_depth_1)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 0;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_depth_2)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 1;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_depth_3)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 2;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_depth_4)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 3;
|
|
|
|
|
|
|
|
|
|
switch (fl_get_button_numb(ob)) {
|
|
|
|
|
case 3:
|
|
|
|
|
// right mouse button resets to default
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(data) = ITEMIZE_DEFAULTS[data];
|
2001-10-03 16:31:10 +00:00
|
|
|
|
default:
|
|
|
|
|
current_bullet_depth = data;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(bullets_->input_latex,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(data).getText().c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_choice(bullets_->choice_size,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(data).getSize() + 2);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
|
void FormDocument::BulletPanel(FL_OBJECT * ob)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* Here we have to change the background pixmap to that selected */
|
|
|
|
|
/* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
int data = 0;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (ob == bullets_->radio_panel_standard)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 0;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_panel_maths)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 1;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_panel_ding2)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 2;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_panel_ding3)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 3;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_panel_ding4)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 4;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
else if (ob == bullets_->radio_panel_ding1)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 5;
|
|
|
|
|
|
|
|
|
|
if (data != current_bullet_panel) {
|
|
|
|
|
fl_freeze_form(bullets_->form);
|
|
|
|
|
current_bullet_panel = data;
|
|
|
|
|
|
|
|
|
|
/* free the current pixmap */
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_free_bmtable_pixmap(bullets_->bmtable_panel);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
string new_panel;
|
2003-04-02 18:57:58 +00:00
|
|
|
|
if (ob == bullets_->radio_panel_standard) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "standard";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_maths ) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "amssymb";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_ding2) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "psnfss1";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_ding3) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "psnfss2";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_ding4) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "psnfss3";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
} else if (ob == bullets_->radio_panel_ding1) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
new_panel = "psnfss4";
|
2002-06-13 13:43:51 +00:00
|
|
|
|
} else {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* something very wrong happened */
|
|
|
|
|
// play it safe for now but should be an exception
|
|
|
|
|
current_bullet_panel = 0; // standard panel
|
|
|
|
|
new_panel = "standard";
|
|
|
|
|
}
|
|
|
|
|
new_panel += ".xpm";
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
|
2001-10-03 16:31:10 +00:00
|
|
|
|
LibFileSearch("images", new_panel).c_str());
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_redraw_object(bullets_->bmtable_panel);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_unfreeze_form(bullets_->form);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* 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. */
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & param = controller().params();
|
2001-10-03 16:31:10 +00:00
|
|
|
|
int bmtable_button = fl_get_bmtable(ob);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
/* try to keep the button held down till another is pushed */
|
|
|
|
|
/* fl_set_bmtable(ob, 1, bmtable_button); */
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(current_bullet_depth).setFont(current_bullet_panel);
|
|
|
|
|
param.temp_bullet(current_bullet_depth).setCharacter(bmtable_button);
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_input(bullets_->input_latex,
|
2003-09-09 17:00:19 +00:00
|
|
|
|
param.temp_bullet(current_bullet_depth).getText().c_str());
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
void FormDocument::CheckChoiceClass()
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2002-11-22 10:47:56 +00:00
|
|
|
|
BufferParams & params = controller().params();
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
|
lyx::textclass_type const tc =
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_get_combox(class_->combox_class) - 1;
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2002-11-22 10:47:56 +00:00
|
|
|
|
if (controller().loadTextclass(tc)) {
|
|
|
|
|
params.textclass = tc;
|
2000-08-18 14:36:12 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (lyxrc.auto_reset_options) {
|
|
|
|
|
params.useClassDefaults();
|
|
|
|
|
UpdateLayoutDocument(params);
|
2002-03-28 13:15:16 +00:00
|
|
|
|
} else {
|
2002-04-10 14:06:14 +00:00
|
|
|
|
// update the params which are needed in any case
|
|
|
|
|
// (fontsizes, pagestyle)
|
|
|
|
|
UpdateClassParams(params);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2002-03-28 13:15:16 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
} else {
|
2002-11-22 10:47:56 +00:00
|
|
|
|
int const revert = int(params.textclass);
|
2003-04-02 18:57:58 +00:00
|
|
|
|
fl_set_combox(class_->combox_class, revert + 1);
|
2000-08-18 14:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-18 14:36:12 +00:00
|
|
|
|
void FormDocument::UpdateLayoutDocument(BufferParams const & params)
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!dialog_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
checkReadOnly();
|
|
|
|
|
class_update(params);
|
|
|
|
|
paper_update(params);
|
|
|
|
|
language_update(params);
|
|
|
|
|
options_update(params);
|
|
|
|
|
bullets_update(params);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|