#include <config.h>
#include "FormDocument.h"
-#include "ControlDocument.h"
#include "forms/form_document.h"
+#include "controllers/ControlDocument.h"
+
#include "bmtable.h"
#include "checkedwidgets.h"
#include "ColorHandler.h"
#include <iomanip>
-using lyx::support::bformat;
-using lyx::support::contains;
-using lyx::support::getStringFromVector;
-using lyx::support::getVectorFromString;
-using lyx::support::LibFileSearch;
-
using boost::bind;
using std::endl;
using std::string;
using std::vector;
+namespace lyx {
+
+using support::bformat;
+using support::contains;
+using support::getStringFromVector;
+using support::getVectorFromString;
+using support::LibFileSearch;
+
+namespace frontend {
namespace {
bool const scalableTabfolders = true;
#endif
+enum {
+ DEFCITE,
+ NATBIB,
+ JURABIB
+};
+
+enum GuiColors {
+ GUI_COLOR_CHOICE = FL_FREE_COL15
+};
} // namespace anon
-typedef FormCB<ControlDocument, FormDB<FD_document> > base_class;
+typedef FormController<ControlDocument, FormView<FD_document> > base_class;
-FormDocument::FormDocument()
- : base_class(_("Document Settings"), scalableTabfolders),
+FormDocument::FormDocument(Dialog & parent)
+ : base_class(parent, _("Document Settings"), scalableTabfolders),
ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{}
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
"|koi8-r|koi8-u|cp866|cp1251|iso88595|pt154");
- vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
+ vector<LanguagePair> const langs = getLanguageData(false);
// Store the identifiers for later
lang_ = getSecond(langs);
- vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
- vector<frnt::LanguagePair>::const_iterator lend = langs.end();
+ vector<LanguagePair>::const_iterator lit = langs.begin();
+ vector<LanguagePair>::const_iterator lend = langs.end();
for (; lit != lend; ++lit) {
fl_addto_combox(language_->combox_language,
lit->first.c_str());
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_->choice_cite_engine);
+ bcview().addReadOnly(options_->check_bibtopic);
bcview().addReadOnly(options_->input_float_placement);
bcview().addReadOnly(options_->choice_postscript_driver);
+ string const cite_choices =
+ _(" Basic | Natbib author-year | Natbib numerical | Jurabib ");
+ fl_addto_choice(options_->choice_cite_engine, cite_choices.c_str());
+
+ // set up the tooltips for optionss form
+ string str = _("Natbib is used often for natural sciences and arts\n"
+ "Jurabib is more common in law and humanities");
+ tooltips().init(options_->choice_cite_engine, str);
+ str = _("Select this if you want to split your bibliography into sections");
+ tooltips().init(options_->check_bibtopic, str);
+
// trigger an input event for cut&paste with middle mouse button.
setPrehandler(options_->input_float_placement);
fl_addto_choice(options_->choice_postscript_driver,
tex_graphics[n]);
}
- fl_addto_choice(options_->choice_citation_format,
- _(" Author-year | Numerical ").c_str());
// the document bullets form
bullets_.reset(build_document_bullet(this));
bcview().addReadOnly(branch_->browser_all_branches);
// set up the tooltips for branches form
- string str = _("Enter the name of a new branch.");
+ 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);
fl_set_choice_text(class_->choice_skip_units,
default_unit.c_str());
- } else if (ob == options_->check_use_natbib) {
- setEnabled(options_->choice_citation_format,
- fl_get_button(options_->check_use_natbib));
-
} else if (ob == branch_->browser_all_branches ||
ob == branch_->browser_selection ||
ob == branch_->button_add_branch ||
bool const selecting = ob == branch_->button_select;
string current_branch;
-
- // When selecting, take highlighted item from left browser,
+
+ // When selecting, take highlighted item from left browser,
// when deselecting, from right browser:
if (selecting) {
int const i = fl_get_browser(branch_->browser_all_branches);
- current_branch =
+ current_branch =
fl_get_browser_line(branch_->browser_all_branches, i);
} else {
int const i = fl_get_browser(branch_->browser_selection);
params.graphicsDriver = getString(options_->choice_postscript_driver);
params.use_amsmath = static_cast<BufferParams::AMS>(
fl_get_choice(options_->choice_ams_math) - 1);
- params.use_natbib = fl_get_button(options_->check_use_natbib);
- params.use_numerical_citations =
- fl_get_choice(options_->choice_citation_format) - 1;
+
+ int const cite_choice = fl_get_choice(options_->choice_cite_engine);
+ switch (cite_choice) {
+ case 1:
+ params.cite_engine = biblio::ENGINE_BASIC;
+ break;
+ case 2:
+ params.cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR;
+ break;
+ case 3:
+ params.cite_engine = biblio::ENGINE_NATBIB_NUMERICAL;
+ break;
+ case 4:
+ params.cite_engine = biblio::ENGINE_JURABIB;
+ break;
+ }
+
+ params.use_bibtopic = fl_get_button(options_->check_bibtopic);
int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
if (params.secnumdepth != tmpchar)
fl_set_choice_text(options_->choice_postscript_driver,
params.graphicsDriver.c_str());
fl_set_choice(options_->choice_ams_math, params.use_amsmath + 1);
- 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);
+
+ int cite_choice = 1;
+ switch (params.cite_engine) {
+ case biblio::ENGINE_BASIC:
+ cite_choice = 1;
+ break;
+ case biblio::ENGINE_NATBIB_AUTHORYEAR:
+ cite_choice = 2;
+ break;
+ case biblio::ENGINE_NATBIB_NUMERICAL:
+ cite_choice = 3;
+ break;
+ case biblio::ENGINE_JURABIB:
+ cite_choice = 4;
+ break;
+ }
+ fl_set_choice(options_->choice_cite_engine, cite_choice);
+
+ fl_set_button(options_->check_bibtopic, params.use_bibtopic);
fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
if (!params.float_placement.empty())
(XpmVersion==4 && XpmRevision<7)))
return;
- bool const isLinuxDoc =
- controller().docType() == ControlDocument::LINUXDOC;
+ bool const isLinuxDoc = kernel().docType() == Kernel::LINUXDOC;
setEnabled(fbullet, !isLinuxDoc);
if (isLinuxDoc) return;
void FormDocument::checkReadOnly()
{
- if (bc().readOnly(controller().bufferIsReadonly())) {
+ if (bc().readOnly(kernel().isBufferReadonly())) {
postWarning(_("Document is read-only."
" No changes to layout permitted."));
} else {
{
BufferParams & params = controller().params();
- lyx::textclass_type const tc =
- fl_get_combox(class_->combox_class) - 1;
+ textclass_type const tc = fl_get_combox(class_->combox_class) - 1;
if (controller().loadTextclass(tc)) {
params.textclass = tc;
options_update(params);
bullets_update(params);
}
+
+} // namespace frontend
+} // namespace lyx