2002-03-11 17:00:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file FormDocument.C
|
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
|
|
|
|
* See the file COPYING.
|
2000-08-18 14:36:12 +00:00
|
|
|
|
*
|
2002-03-11 17:00:41 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna, jug@sad.it
|
|
|
|
|
*/
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
#include XPM_H_LOCATION
|
|
|
|
|
|
2002-04-23 08:16:27 +00:00
|
|
|
|
#ifdef __GNUG__
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "FormDocument.h"
|
|
|
|
|
#include "form_document.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "Alert.h"
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#include "Dialogs.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "lyxtextclasslist.h"
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#include "combox.h"
|
|
|
|
|
#include "tex-strings.h"
|
|
|
|
|
#include "bufferparams.h"
|
|
|
|
|
#include "vspace.h"
|
|
|
|
|
#include "bmtable.h"
|
|
|
|
|
#include "language.h"
|
2002-04-29 15:56:36 +00:00
|
|
|
|
#include "frnt_lang.h"
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#include "LyXView.h"
|
2001-09-21 10:41:09 +00:00
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
|
#include "lyxrc.h"
|
2000-08-11 14:42:20 +00:00
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "Liason.h"
|
|
|
|
|
#include "CutAndPaste.h"
|
2000-08-18 14:36:12 +00:00
|
|
|
|
#include "bufferview_funcs.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
#include "xforms_helpers.h"
|
2001-07-29 15:34:18 +00:00
|
|
|
|
#include "debug.h"
|
2001-10-09 12:36:36 +00:00
|
|
|
|
#include "input_validators.h" // fl_unsigned_float_filter
|
2002-03-21 21:21:28 +00:00
|
|
|
|
#include "helper_funcs.h"
|
2001-11-07 11:39:58 +00:00
|
|
|
|
#include "lyx_main.h" // for user_lyxdir
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "insets/insetquotes.h"
|
|
|
|
|
|
|
|
|
|
#include "support/filetools.h"
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
|
|
using std::bind2nd;
|
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
using Liason::setMinibuffer;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
using SigC::slot;
|
2002-03-02 16:39:54 +00:00
|
|
|
|
using std::vector;
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
FormDocument::FormDocument(LyXView * lv, Dialogs * d)
|
2001-09-12 16:18:22 +00:00
|
|
|
|
: FormBaseBD(lv, d, _("Document Layout")),
|
|
|
|
|
ActCell(0), Confirmed(0),
|
|
|
|
|
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// 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));
|
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-10-03 05:53:25 +00:00
|
|
|
|
FL_FORM * FormDocument::form() const
|
2000-10-02 00:10:25 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (dialog_.get()) return dialog_->form;
|
|
|
|
|
return 0;
|
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::build()
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
// the tabbed folder
|
|
|
|
|
dialog_.reset(build_tabbed_document());
|
|
|
|
|
|
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
|
|
|
|
|
bc().setOK(dialog_->button_ok);
|
|
|
|
|
bc().setApply(dialog_->button_apply);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
bc().setCancel(dialog_->button_close);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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());
|
2001-10-09 12:36:36 +00:00
|
|
|
|
fl_addto_choice(paper_->choice_papersize,
|
2001-10-03 16:31:10 +00:00
|
|
|
|
_(" 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 "));
|
|
|
|
|
|
2002-01-07 18:42:30 +00:00
|
|
|
|
fl_set_input_return(paper_->input_custom_width, FL_RETURN_CHANGED);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input_return(paper_->input_custom_height, FL_RETURN_CHANGED);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
fl_set_input_return(paper_->input_top_margin, FL_RETURN_CHANGED);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input_return(paper_->input_bottom_margin, FL_RETURN_CHANGED);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
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);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2002-03-11 18:24:31 +00:00
|
|
|
|
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);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
|
|
|
|
// Create the contents of the unit choices
|
2001-10-15 10:28:31 +00:00
|
|
|
|
// Don't include the "%" terms...
|
2002-03-02 16:39:54 +00:00
|
|
|
|
vector<string> units_vec = getLatexUnits();
|
|
|
|
|
#if 0
|
|
|
|
|
for (vector<string>::iterator it = units_vec.begin();
|
2002-03-21 16:59:12 +00:00
|
|
|
|
it != units_vec.end(); ++it) {
|
2001-10-15 10:28:31 +00:00
|
|
|
|
if (contains(*it, "%"))
|
|
|
|
|
it = units_vec.erase(it, it+1) - 1;
|
|
|
|
|
}
|
2002-03-02 16:39:54 +00:00
|
|
|
|
#else
|
|
|
|
|
vector<string>::iterator ret =
|
2002-03-04 10:40:01 +00:00
|
|
|
|
std::remove_if(units_vec.begin(),
|
|
|
|
|
units_vec.end(),
|
|
|
|
|
bind2nd(contains_functor(), "%"));
|
2002-03-02 16:39:54 +00:00
|
|
|
|
units_vec.erase(ret, units_vec.end());
|
|
|
|
|
#endif
|
2001-10-15 10:28:31 +00:00
|
|
|
|
string units = getStringFromVector(units_vec, "|");
|
2001-10-09 12:36:36 +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());
|
2002-01-07 18:42:30 +00:00
|
|
|
|
fl_addto_choice(paper_->choice_inner_margin_units, units.c_str());
|
|
|
|
|
fl_addto_choice(paper_->choice_outer_margin_units, units.c_str());
|
2001-10-09 12:36:36 +00:00
|
|
|
|
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
|
|
|
|
bc().addReadOnly (paper_->choice_paperpackage);
|
|
|
|
|
bc().addReadOnly (paper_->radio_portrait);
|
|
|
|
|
bc().addReadOnly (paper_->radio_landscape);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
bc().addReadOnly (paper_->choice_papersize);
|
|
|
|
|
bc().addReadOnly (paper_->check_use_geometry);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
bc().addReadOnly (paper_->input_custom_width);
|
|
|
|
|
bc().addReadOnly (paper_->input_custom_height);
|
|
|
|
|
bc().addReadOnly (paper_->input_top_margin);
|
|
|
|
|
bc().addReadOnly (paper_->input_bottom_margin);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
bc().addReadOnly (paper_->input_inner_margin);
|
|
|
|
|
bc().addReadOnly (paper_->input_outer_margin);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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,
|
2002-03-12 14:11:15 +00:00
|
|
|
|
dialog_->tabfolder);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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 "));
|
2001-10-23 09:00:12 +00:00
|
|
|
|
fl_addto_choice(class_->choice_default_skip_units, units.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(class_->input_doc_extra);
|
|
|
|
|
setPrehandler(class_->input_doc_skip);
|
|
|
|
|
setPrehandler(class_->input_doc_spacing);
|
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.
|
2002-01-16 16:34:03 +00:00
|
|
|
|
fl_set_input_filter(class_->input_doc_spacing, fl_unsigned_float_filter);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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,
|
2001-10-08 14:50:16 +00:00
|
|
|
|
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
|
2001-10-03 16:31:10 +00:00
|
|
|
|
"|koi8-r|koi8-u|cp866|cp1251|iso88595");
|
|
|
|
|
|
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);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// 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,
|
2002-03-12 14:11:15 +00:00
|
|
|
|
dialog_->tabfolder);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
combo_language->shortcut("#L",1);
|
|
|
|
|
combo_language->setcallback(ComboInputCB, this);
|
|
|
|
|
fl_end_form();
|
|
|
|
|
|
2002-04-29 15:56:36 +00:00
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
|
|
|
|
for (; lit != lend; ++lit) {
|
2002-04-30 15:07:03 +00:00
|
|
|
|
combo_language->addto(lit->first);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2002-04-29 15:56:36 +00:00
|
|
|
|
combo_language->select(1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
fl_addto_choice(language_->choice_quotes_language,
|
|
|
|
|
_(" ``text'' | ''text'' | ,,text`` | ,,text'' |"
|
|
|
|
|
" <20>text<78> | <20>text<78> "));
|
|
|
|
|
|
|
|
|
|
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);
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(options_->input_float_placement);
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_counter_bounds(options_->counter_secnumdepth,-2,5);
|
|
|
|
|
fl_set_counter_bounds(options_->counter_tocdepth,-1,5);
|
|
|
|
|
fl_set_counter_step(options_->counter_secnumdepth,1,1);
|
|
|
|
|
fl_set_counter_step(options_->counter_tocdepth,1,1);
|
|
|
|
|
fl_set_counter_precision(options_->counter_secnumdepth, 0);
|
|
|
|
|
fl_set_counter_precision(options_->counter_tocdepth, 0);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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 "));
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
bc_.addReadOnly (options_->counter_secnumdepth);
|
|
|
|
|
bc_.addReadOnly (options_->counter_tocdepth);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(bullets_->input_bullet_latex);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input_maxchars(bullets_->input_bullet_latex, 80);
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_depth_1);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_depth_2);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_depth_3);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_depth_4);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_standard);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_maths);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_ding1);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_ding2);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_ding3);
|
|
|
|
|
bc_.addReadOnly(bullets_->radio_bullet_panel_ding4);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
bc().addReadOnly (bullets_->bmtable_bullet_panel);
|
|
|
|
|
bc().addReadOnly (bullets_->choice_bullet_size);
|
|
|
|
|
bc().addReadOnly (bullets_->input_bullet_latex);
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Document"),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
class_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Paper"),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
paper_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Language"),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
language_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder,_("Extra"),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
options_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
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()
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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"));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-05 07:57:00 +00:00
|
|
|
|
void FormDocument::cancel()
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// 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();
|
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
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
BufferParams const & params = lv_->buffer()->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);
|
2000-10-05 07:57:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-11-07 11:39:58 +00:00
|
|
|
|
namespace {
|
|
|
|
|
// should this go elsewhere? Maybe a ControllerDocument? (JMarc)
|
|
|
|
|
/** Save the buffer's parameters as user default.
|
|
|
|
|
This function saves a file \c user_lyxdir/templates/defaults.lyx
|
|
|
|
|
which parameters are those of the current buffer. This file
|
|
|
|
|
is used as a default template when creating a new
|
|
|
|
|
file. Returns \c true on success.
|
|
|
|
|
*/
|
|
|
|
|
bool saveParamsAsDefault(BufferParams const ¶ms)
|
|
|
|
|
{
|
2001-11-26 10:19:58 +00:00
|
|
|
|
if (!Alert::askQuestion(_("Do you want to save the current settings"),
|
2002-03-21 16:59:12 +00:00
|
|
|
|
_("for the document layout as default?"),
|
|
|
|
|
_("(they will be valid for any new document)")))
|
2001-11-07 11:39:58 +00:00
|
|
|
|
return false;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-11-07 11:39:58 +00:00
|
|
|
|
string const fname = AddName(AddPath(user_lyxdir, "templates/"),
|
|
|
|
|
"defaults.lyx");
|
|
|
|
|
Buffer defaults = Buffer(fname);
|
|
|
|
|
defaults.params = params;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-11-07 11:39:58 +00:00
|
|
|
|
// add an empty paragraph. Is this enough?
|
|
|
|
|
defaults.paragraph = new Paragraph;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-11-07 11:39:58 +00:00
|
|
|
|
return defaults.writeFile(defaults.fileName(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} //namespace
|
|
|
|
|
|
2002-03-21 16:59:12 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
bool FormDocument::input(FL_OBJECT * ob, long data)
|
2000-10-05 07:57:00 +00:00
|
|
|
|
{
|
2002-02-16 15:59:55 +00:00
|
|
|
|
State cb = static_cast<State>(data);
|
2000-10-05 07:57:00 +00:00
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
|
switch (cb) {
|
2000-10-05 07:57:00 +00:00
|
|
|
|
case CHECKCHOICECLASS:
|
|
|
|
|
CheckChoiceClass(ob, 0);
|
|
|
|
|
break;
|
|
|
|
|
case CHOICEBULLETSIZE:
|
|
|
|
|
ChoiceBulletSize(ob, 0);
|
|
|
|
|
break;
|
|
|
|
|
case INPUTBULLETLATEX:
|
|
|
|
|
InputBulletLaTeX(ob, 0);
|
|
|
|
|
break;
|
|
|
|
|
case BULLETDEPTH1:
|
|
|
|
|
case BULLETDEPTH2:
|
|
|
|
|
case BULLETDEPTH3:
|
|
|
|
|
case BULLETDEPTH4:
|
|
|
|
|
BulletDepth(ob, cb);
|
|
|
|
|
break;
|
|
|
|
|
case BULLETPANEL1:
|
|
|
|
|
case BULLETPANEL2:
|
|
|
|
|
case BULLETPANEL3:
|
|
|
|
|
case BULLETPANEL4:
|
|
|
|
|
case BULLETPANEL5:
|
|
|
|
|
case BULLETPANEL6:
|
|
|
|
|
BulletPanel(ob, cb);
|
|
|
|
|
break;
|
|
|
|
|
case BULLETBMTABLE:
|
|
|
|
|
BulletBMTable(ob, 0);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-09-11 08:46:30 +00:00
|
|
|
|
|
2001-10-23 09:00:12 +00:00
|
|
|
|
bool const length_input = fl_get_choice(class_->choice_doc_skip) == 4;
|
|
|
|
|
if (ob == class_->choice_doc_skip) {
|
|
|
|
|
setEnabled(class_->input_doc_skip, length_input);
|
|
|
|
|
setEnabled(class_->choice_default_skip_units, length_input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ob == class_->choice_doc_spacing)
|
|
|
|
|
setEnabled(class_->input_doc_spacing,
|
|
|
|
|
fl_get_choice(class_->choice_doc_spacing) == 4);
|
|
|
|
|
|
|
|
|
|
bool const skip_used = fl_get_button(class_->radio_doc_skip);
|
|
|
|
|
if (ob == class_->radio_doc_skip ||
|
|
|
|
|
ob == class_->radio_doc_indent) {
|
|
|
|
|
setEnabled(class_->choice_doc_skip, skip_used);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
setEnabled(class_->input_doc_skip,
|
|
|
|
|
skip_used && length_input);
|
|
|
|
|
setEnabled(class_->choice_default_skip_units,
|
|
|
|
|
skip_used && length_input);
|
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);
|
2002-01-04 15:14:22 +00:00
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
int const default_unit = metric ? 8 : 9;
|
|
|
|
|
if (strip(fl_get_input(class_->input_doc_skip)).empty())
|
|
|
|
|
fl_set_choice(class_->choice_default_skip_units,
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-11 08:46:30 +00:00
|
|
|
|
if (ob == options_->check_use_natbib) {
|
|
|
|
|
setEnabled(options_->choice_citation_format,
|
|
|
|
|
fl_get_button(options_->check_use_natbib));
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-21 15:20:17 +00:00
|
|
|
|
if (ob == dialog_->button_save_defaults) {
|
2001-11-07 11:39:58 +00:00
|
|
|
|
BufferParams params;
|
|
|
|
|
class_apply(params);
|
|
|
|
|
paper_apply(params);
|
|
|
|
|
language_apply(params);
|
|
|
|
|
options_apply(params);
|
|
|
|
|
bullets_apply(params);
|
|
|
|
|
saveParamsAsDefault(params);
|
2001-09-21 10:41:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-27 12:13:51 +00:00
|
|
|
|
if (ob == dialog_->button_reset_defaults) {
|
2001-09-21 10:41:09 +00:00
|
|
|
|
BufferParams params = lv_->buffer()->params;
|
|
|
|
|
params.textclass = combo_doc_class->get() - 1;
|
|
|
|
|
params.useClassDefaults();
|
|
|
|
|
UpdateLayoutDocument(params);
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (ob == paper_->radio_landscape)
|
|
|
|
|
fl_set_choice(paper_->choice_paperpackage,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
BufferParams::PACKAGE_NONE + 1);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2001-10-09 12:36:36 +00:00
|
|
|
|
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
|
|
|
|
|
bool const metric = (defsize && lyxrc.default_papersize > 3)
|
|
|
|
|
|| paperchoice == 2 || paperchoice > 5;
|
2001-10-15 10:28:31 +00:00
|
|
|
|
int const default_unit = metric ? 8 : 9;
|
|
|
|
|
if (strip(fl_get_input(paper_->input_custom_width)).empty())
|
2002-03-21 16:59:12 +00:00
|
|
|
|
fl_set_choice(paper_->choice_custom_width_units,
|
|
|
|
|
default_unit);
|
2001-10-15 10:28:31 +00:00
|
|
|
|
if (strip(fl_get_input(paper_->input_custom_height)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_custom_height_units,
|
|
|
|
|
default_unit);
|
|
|
|
|
if (strip(fl_get_input(paper_->input_top_margin)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_top_margin_units,
|
|
|
|
|
default_unit);
|
|
|
|
|
if (strip(fl_get_input(paper_->input_bottom_margin)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_bottom_margin_units,
|
|
|
|
|
default_unit);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
if (strip(fl_get_input(paper_->input_inner_margin)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_inner_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
default_unit);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
if (strip(fl_get_input(paper_->input_outer_margin)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_outer_margin_units,
|
2001-10-15 10:28:31 +00:00
|
|
|
|
default_unit);
|
|
|
|
|
if (strip(fl_get_input(paper_->input_head_height)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_head_height_units,
|
|
|
|
|
default_unit);
|
|
|
|
|
if (strip(fl_get_input(paper_->input_head_sep)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_head_sep_units,
|
|
|
|
|
default_unit);
|
|
|
|
|
if (strip(fl_get_input(paper_->input_foot_skip)).empty())
|
|
|
|
|
fl_set_choice(paper_->choice_foot_skip_units,
|
|
|
|
|
default_unit);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
2001-09-21 10:41:09 +00:00
|
|
|
|
|
2001-10-11 17:28:28 +00:00
|
|
|
|
if (ob == paper_->choice_papersize ||
|
|
|
|
|
ob == paper_->radio_portrait ||
|
|
|
|
|
ob == paper_->radio_landscape) {
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
setEnabled(paper_->choice_paperpackage,
|
|
|
|
|
//either default papersize (preferences)
|
|
|
|
|
//or document papersize has to be A4
|
2001-10-09 12:36:36 +00:00
|
|
|
|
(fl_get_choice(paper_->choice_papersize) == 7
|
|
|
|
|
|| fl_get_choice(paper_->choice_papersize) == 1
|
2001-10-03 16:31:10 +00:00
|
|
|
|
&& lyxrc.default_papersize == 5)
|
|
|
|
|
&& fl_get_button(paper_->radio_portrait));
|
2001-10-09 12:36:36 +00:00
|
|
|
|
}
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
if (ob == paper_->choice_paperpackage) {
|
|
|
|
|
if (fl_get_choice(paper_->choice_paperpackage) != 1) {
|
2001-10-09 12:36:36 +00:00
|
|
|
|
fl_set_button(paper_->check_use_geometry, 0);
|
|
|
|
|
|
|
|
|
|
setEnabled(paper_->input_top_margin, false);
|
|
|
|
|
setEnabled(paper_->input_bottom_margin, false);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->input_inner_margin, false);
|
|
|
|
|
setEnabled(paper_->input_outer_margin, false);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
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);
|
2002-01-07 18:42:30 +00:00
|
|
|
|
setEnabled(paper_->choice_inner_margin_units, false);
|
|
|
|
|
setEnabled(paper_->choice_outer_margin_units, false);
|
2001-10-09 12:36:36 +00:00
|
|
|
|
setEnabled(paper_->choice_head_height_units, false);
|
|
|
|
|
setEnabled(paper_->choice_head_sep_units, false);
|
|
|
|
|
setEnabled(paper_->choice_foot_skip_units, false);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-09 12:36:36 +00:00
|
|
|
|
if (ob == paper_->check_use_geometry) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
//don't allow switching geometry off in custom papersize mode
|
2001-10-11 17:28:28 +00:00
|
|
|
|
//nor in A3, B3, and B4
|
|
|
|
|
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,
|
|
|
|
|
BufferParams::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
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
|
switch (data) {
|
2000-10-05 07:57:00 +00:00
|
|
|
|
case INPUT:
|
|
|
|
|
case CHECKCHOICECLASS:
|
|
|
|
|
case CHOICEBULLETSIZE:
|
|
|
|
|
case INPUTBULLETLATEX:
|
|
|
|
|
case BULLETBMTABLE:
|
|
|
|
|
return CheckDocumentInput(ob, 0);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormDocument::ComboInputCB(int, void * v, Combox * combox)
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
FormDocument * pre = static_cast<FormDocument*>(v);
|
|
|
|
|
if (combox == pre->combo_doc_class.get())
|
|
|
|
|
pre->CheckChoiceClass(0, 0);
|
|
|
|
|
pre->bc().valid(pre->CheckDocumentInput(0,0));
|
2000-10-05 07:57:00 +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
|
|
|
|
|
// input field, reset the kind to "Medskip", which is the default.
|
|
|
|
|
if ((fl_get_choice (class_->choice_doc_skip) == 4) &&
|
|
|
|
|
!*(fl_get_input (class_->input_doc_skip))) {
|
|
|
|
|
fl_set_choice (class_->choice_doc_skip, 2);
|
|
|
|
|
}
|
|
|
|
|
params.fonts = fl_get_choice_text(class_->choice_doc_fonts);
|
|
|
|
|
params.fontsize = fl_get_choice_text(class_->choice_doc_fontsize);
|
|
|
|
|
params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle);
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
params.textclass = combo_doc_class->get() - 1;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-10-15 03:46:23 +00:00
|
|
|
|
BufferParams::PARSEP tmpsep = params.paragraph_separation;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
if (fl_get_button(class_->radio_doc_indent))
|
|
|
|
|
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();
|
|
|
|
|
switch (fl_get_choice (class_->choice_doc_skip)) {
|
|
|
|
|
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 =
|
|
|
|
|
getLengthFromWidgets(class_->input_doc_skip,
|
|
|
|
|
class_->choice_default_skip_units);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
if (fl_get_button(class_->radio_doc_columns_two))
|
|
|
|
|
params.columns = 2;
|
|
|
|
|
else
|
|
|
|
|
params.columns = 1;
|
|
|
|
|
if (fl_get_button(class_->radio_doc_sides_two))
|
|
|
|
|
params.sides = LyXTextClass::TwoSides;
|
|
|
|
|
else
|
|
|
|
|
params.sides = LyXTextClass::OneSide;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
Spacing tmpSpacing = params.spacing;
|
2000-11-04 10:00:12 +00:00
|
|
|
|
switch (fl_get_choice(class_->choice_doc_spacing)) {
|
2000-08-11 14:42:20 +00:00
|
|
|
|
case 1:
|
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: SINGLE\n";
|
|
|
|
|
params.spacing.set(Spacing::Single);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: ONEHALF\n";
|
|
|
|
|
params.spacing.set(Spacing::Onehalf);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: DOUBLE\n";
|
|
|
|
|
params.spacing.set(Spacing::Double);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
lyxerr[Debug::INFO] << "Spacing: OTHER\n";
|
2002-03-21 21:21:28 +00:00
|
|
|
|
params.spacing.set(Spacing::Other,
|
2000-08-11 14:42:20 +00:00
|
|
|
|
fl_get_input(class_->input_doc_spacing));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (tmpSpacing != params.spacing)
|
|
|
|
|
redo = true;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
|
params.options = fl_get_input(class_->input_doc_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
|
|
|
|
bool FormDocument::class_apply()
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-11-07 10:25:05 +00:00
|
|
|
|
BufferParams ¶ms = lv_->buffer()->params;
|
|
|
|
|
|
|
|
|
|
unsigned int const old_class = params.textclass;
|
|
|
|
|
|
|
|
|
|
bool redo = class_apply(params);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
if (params.textclass != old_class) {
|
|
|
|
|
// try to load new_class
|
2002-03-02 16:39:54 +00:00
|
|
|
|
if (textclasslist[params.textclass].load()) {
|
2001-11-07 10:25:05 +00:00
|
|
|
|
// successfully loaded
|
|
|
|
|
redo = true;
|
|
|
|
|
setMinibuffer(lv_, _("Converting document to new document class..."));
|
|
|
|
|
int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
|
|
|
|
|
old_class, params.textclass,
|
2001-12-15 14:34:17 +00:00
|
|
|
|
lv_->buffer()->paragraph,
|
|
|
|
|
lv_->buffer()->params);
|
2001-11-07 10:25:05 +00:00
|
|
|
|
if (ret) {
|
|
|
|
|
string s;
|
2002-03-02 16:39:54 +00:00
|
|
|
|
if (ret == 1) {
|
2001-11-07 10:25:05 +00:00
|
|
|
|
s = _("One paragraph couldn't be converted");
|
|
|
|
|
} else {
|
|
|
|
|
s += tostr(ret);
|
|
|
|
|
s += _(" paragraphs couldn't be converted");
|
|
|
|
|
}
|
2001-11-26 10:19:58 +00:00
|
|
|
|
Alert::alert(_("Conversion Errors!"),s,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
_("into chosen document class"));
|
2001-11-07 10:25:05 +00:00
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
} else {
|
|
|
|
|
// problem changing class -- warn user and retain old style
|
2001-11-26 10:19:58 +00:00
|
|
|
|
Alert::alert(_("Conversion Errors!"),
|
2002-03-21 16:59:12 +00:00
|
|
|
|
_("Errors loading new document class."),
|
|
|
|
|
_("Reverting to original document class."));
|
2001-11-07 10:25:05 +00:00
|
|
|
|
combo_doc_class->select(int(old_class) + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
|
return redo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormDocument::paper_apply(BufferParams & params)
|
|
|
|
|
{
|
2001-10-09 12:36:36 +00:00
|
|
|
|
params.papersize2 = char(fl_get_choice(paper_->choice_papersize)-1);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.paperpackage =
|
2001-10-09 12:36:36 +00:00
|
|
|
|
char(fl_get_choice(paper_->choice_paperpackage)-1);
|
|
|
|
|
|
|
|
|
|
// 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))
|
|
|
|
|
params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
|
|
|
|
|
else
|
|
|
|
|
params.orientation = BufferParams::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
|
|
|
|
void FormDocument::paper_apply()
|
|
|
|
|
{
|
|
|
|
|
paper_apply(lv_->buffer()->params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2002-04-29 15:56:36 +00:00
|
|
|
|
int const pos = combo_language->get();
|
2001-12-15 14:00:36 +00:00
|
|
|
|
Language const * old_language = params.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;
|
|
|
|
|
|
2001-12-15 14:00:36 +00:00
|
|
|
|
if (old_language != new_language
|
|
|
|
|
&& old_language->RightToLeft() == params.language->RightToLeft()
|
|
|
|
|
&& !lv_->buffer()->isMultiLingual())
|
|
|
|
|
lv_->buffer()->changeLanguage(old_language, params.language);
|
|
|
|
|
|
|
|
|
|
if (old_language != new_language) {
|
|
|
|
|
redo = true;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
params.language = new_language;
|
|
|
|
|
params.inputenc = fl_get_choice_text(language_->choice_inputenc);
|
|
|
|
|
|
|
|
|
|
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::language_apply()
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-12-15 14:00:36 +00:00
|
|
|
|
return language_apply(lv_->buffer()->params);
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
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 =
|
|
|
|
|
fl_get_input(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
|
|
|
|
bool FormDocument::options_apply()
|
|
|
|
|
{
|
|
|
|
|
return options_apply(lv_->buffer()->params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 */
|
2001-11-07 11:39:58 +00:00
|
|
|
|
BufferParams & buf_params = lv_->buffer()->params;
|
2001-10-03 16:31:10 +00:00
|
|
|
|
|
|
|
|
|
// a little bit of loop unrolling
|
2001-11-07 11:39:58 +00:00
|
|
|
|
params.user_defined_bullets[0] = buf_params.temp_bullets[0];
|
|
|
|
|
params.user_defined_bullets[1] = buf_params.temp_bullets[1];
|
|
|
|
|
params.user_defined_bullets[2] = buf_params.temp_bullets[2];
|
|
|
|
|
params.user_defined_bullets[3] = buf_params.temp_bullets[3];
|
2001-11-07 10:25:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FormDocument::bullets_apply()
|
|
|
|
|
{
|
|
|
|
|
bullets_apply(lv_->buffer()->params);
|
2000-08-11 14:42:20 +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
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
combo_doc_class->select(tclass.description());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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());
|
2002-04-10 14:06:14 +00:00
|
|
|
|
fl_set_choice_text(class_->choice_doc_fontsize,
|
|
|
|
|
params.fontsize.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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());
|
2002-04-10 14:06:14 +00:00
|
|
|
|
fl_set_choice_text(class_->choice_doc_pagestyle,
|
|
|
|
|
params.pagestyle.c_str());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FormDocument::class_update(BufferParams const & params)
|
|
|
|
|
{
|
|
|
|
|
if (!class_.get())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
UpdateClassParams(params);
|
|
|
|
|
|
|
|
|
|
fl_set_choice_text(class_->choice_doc_fonts,
|
|
|
|
|
params.fonts.c_str());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
|
|
|
|
bool const input_length = fl_get_choice(class_->choice_doc_skip) == 4;
|
|
|
|
|
setEnabled(class_->choice_default_skip_units, input_length);
|
|
|
|
|
setEnabled(class_->input_doc_skip, input_length);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
switch (params.getDefSkip().kind()) {
|
2002-03-21 21:21:28 +00:00
|
|
|
|
case VSpace::SMALLSKIP:
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice (class_->choice_doc_skip, 1);
|
|
|
|
|
break;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
case VSpace::MEDSKIP:
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice (class_->choice_doc_skip, 2);
|
|
|
|
|
break;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
case VSpace::BIGSKIP:
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice (class_->choice_doc_skip, 3);
|
|
|
|
|
break;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
case VSpace::LENGTH:
|
|
|
|
|
{
|
2002-01-04 15:14:22 +00:00
|
|
|
|
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
|
|
|
|
|| 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();
|
|
|
|
|
updateWidgetsFromLengthString(class_->input_doc_skip,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
class_->choice_default_skip_units,
|
|
|
|
|
length, default_unit);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
}
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
setEnabled(class_->choice_doc_skip,
|
|
|
|
|
fl_get_button(class_->radio_doc_skip));
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input(class_->input_doc_spacing, "");
|
2002-01-17 17:16:19 +00:00
|
|
|
|
setEnabled(class_->input_doc_spacing, false);
|
2001-10-23 09:00:12 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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:
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_choice(class_->choice_doc_spacing, 4);
|
|
|
|
|
char sval[20];
|
2002-03-21 21:21:28 +00:00
|
|
|
|
sprintf(sval,"%g",params.spacing.getValue());
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input(class_->input_doc_spacing, sval);
|
2002-01-17 17:16:19 +00:00
|
|
|
|
setEnabled(class_->input_doc_spacing, true);
|
2001-10-03 16:31:10 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!params.options.empty())
|
|
|
|
|
fl_set_input(class_->input_doc_extra, params.options.c_str());
|
|
|
|
|
else
|
|
|
|
|
fl_set_input(class_->input_doc_extra, "");
|
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()));
|
|
|
|
|
combo_language->select(pos+1);
|
|
|
|
|
|
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());
|
|
|
|
|
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);
|
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);
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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
|
2001-10-15 10:28:31 +00:00
|
|
|
|
(paperchoice == 7
|
|
|
|
|
|| paperchoice == 1 && lyxrc.default_papersize == 5)
|
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.
|
2002-01-04 15:14:22 +00:00
|
|
|
|
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
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
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
bool const isLinuxDoc = lv_->buffer()->isLinuxDoc();
|
|
|
|
|
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
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-08-29 01:46:59 +00:00
|
|
|
|
void FormDocument::checkReadOnly()
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (bc().readOnly(lv_->buffer()->isReadonly())) {
|
|
|
|
|
combo_doc_class->deactivate();
|
|
|
|
|
combo_language->deactivate();
|
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 {
|
|
|
|
|
combo_doc_class->activate();
|
|
|
|
|
combo_language->activate();
|
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-01-16 16:34:03 +00:00
|
|
|
|
bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
string str;
|
|
|
|
|
bool ok = true;
|
|
|
|
|
char const * input;
|
2001-10-09 12:36:36 +00:00
|
|
|
|
|
2002-01-16 16:34:03 +00:00
|
|
|
|
// 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.
|
|
|
|
|
// disable OK/Apply if input is not valid
|
|
|
|
|
str = fl_get_input(class_->input_doc_skip);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_custom_width);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_custom_height);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_outer_margin);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_inner_margin);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_top_margin);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_bottom_margin);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_head_height);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_head_sep);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
str = fl_get_input(paper_->input_foot_skip);
|
|
|
|
|
ok = ok && (str.empty() || isValidLength(str) || isStrDbl(str));
|
|
|
|
|
|
|
|
|
|
//display warning if input is not valid
|
|
|
|
|
if (ob == class_->input_doc_skip
|
2002-03-21 16:59:12 +00:00
|
|
|
|
|| ob == paper_->input_custom_width
|
|
|
|
|
|| ob == paper_->input_custom_height
|
|
|
|
|
|| ob == paper_->input_outer_margin
|
|
|
|
|
|| ob == paper_->input_inner_margin
|
|
|
|
|
|| ob == paper_->input_top_margin
|
|
|
|
|
|| ob == paper_->input_bottom_margin
|
|
|
|
|
|| ob == paper_->input_head_height
|
|
|
|
|
|| ob == paper_->input_head_sep
|
|
|
|
|
|| ob == paper_->input_foot_skip) {
|
2002-01-16 16:34:03 +00:00
|
|
|
|
if (!ok) {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
2002-01-16 16:34:03 +00:00
|
|
|
|
return false;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
} else {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
clearMessage();
|
2002-01-16 16:34:03 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// "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 ((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;
|
2001-10-23 09:00:12 +00:00
|
|
|
|
else if (fl_get_choice(class_->choice_doc_spacing) != 4)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
fl_set_input (class_->input_doc_spacing, "");
|
|
|
|
|
return ok;
|
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::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
BufferParams & param = lv_->buffer()->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
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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());
|
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)
|
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
BufferParams & param = lv_->buffer()->params;
|
2000-08-11 14:42:20 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
param.temp_bullets[current_bullet_depth].
|
|
|
|
|
setText(fl_get_input(bullets_->input_bullet_latex));
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-10-05 07:57:00 +00:00
|
|
|
|
void FormDocument::BulletDepth(FL_OBJECT * ob, State cb)
|
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 */
|
|
|
|
|
BufferParams & param = lv_->buffer()->params;
|
|
|
|
|
|
|
|
|
|
int data = 0;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (cb == BULLETDEPTH1)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 0;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETDEPTH2)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 1;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETDEPTH3)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 2;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETDEPTH4)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
2000-08-11 14:42:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2000-10-05 07:57:00 +00:00
|
|
|
|
void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
|
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;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (cb == BULLETPANEL1)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 0;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETPANEL2)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 1;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETPANEL3)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 2;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETPANEL4)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 3;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETPANEL5)
|
2001-10-03 16:31:10 +00:00
|
|
|
|
data = 4;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
else if (cb == BULLETPANEL6)
|
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 */
|
|
|
|
|
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);
|
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
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
BufferParams & param = lv_->buffer()->params;
|
|
|
|
|
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); */
|
|
|
|
|
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());
|
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::CheckChoiceClass(FL_OBJECT * ob, long)
|
2000-08-11 14:42:20 +00:00
|
|
|
|
{
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (!ob)
|
|
|
|
|
ob = class_->choice_doc_class;
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
lv_->prohibitInput();
|
2000-09-13 15:07:06 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
unsigned int tc = combo_doc_class->get() - 1;
|
2002-03-02 16:39:54 +00:00
|
|
|
|
if (textclasslist[tc].load()) {
|
2001-10-03 16:31:10 +00:00
|
|
|
|
// we use a copy of the bufferparams because we do not
|
|
|
|
|
// want to modify them yet.
|
|
|
|
|
BufferParams params = lv_->buffer()->params;
|
2000-08-18 14:36:12 +00:00
|
|
|
|
|
2001-10-03 16:31:10 +00:00
|
|
|
|
if (lyxrc.auto_reset_options) {
|
|
|
|
|
params.textclass = tc;
|
|
|
|
|
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)
|
2002-03-28 13:15:16 +00:00
|
|
|
|
params.textclass = tc;
|
2002-04-10 14:06:14 +00:00
|
|
|
|
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 {
|
|
|
|
|
// unable to load new style
|
2001-11-26 10:19:58 +00:00
|
|
|
|
Alert::alert(_("Conversion Errors!"),
|
2002-03-21 16:59:12 +00:00
|
|
|
|
_("Unable to switch to new document class."),
|
|
|
|
|
_("Reverting to original document class."));
|
2001-10-03 16:31:10 +00:00
|
|
|
|
combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
|
2000-08-18 14:36:12 +00:00
|
|
|
|
}
|
2001-10-03 16:31:10 +00:00
|
|
|
|
lv_->allowInput();
|
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
|
|
|
|
}
|