From aecf612d106115866527898dfa40ca37e57c6ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 29 Mar 2004 12:11:53 +0000 Subject: [PATCH] customize bibtex call (bug 720) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8559 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 3 + src/LaTeX.C | 9 +- src/frontends/qt2/ChangeLog | 4 + src/frontends/qt2/QPrefs.C | 2 + src/frontends/qt2/QPrefsDialog.C | 1 + src/frontends/qt2/ui/QPrefLatexModule.ui | 114 +++++++++++------- src/frontends/xforms/ChangeLog | 3 + src/frontends/xforms/FormPreferences.C | 3 + .../xforms/forms/form_preferences.fd | 26 +++- src/lyxrc.C | 16 +++ src/lyxrc.h | 3 + 11 files changed, 129 insertions(+), 55 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5e27f6f39f..4e0b80731a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2004-03-29 Jürgen Spitzmüller + * lyxrc.[Ch]: add lyxrc bibtex_command + * LaTeX.C: use rc.bibtex_command instead of hardcoded string. + * buffer.C: increment file format to 231. 2004-03-28 Alfredo Braunstein diff --git a/src/LaTeX.C b/src/LaTeX.C index 6640b7fb7d..4a54f6e492 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -17,6 +17,7 @@ #include "LaTeX.h" #include "bufferlist.h" #include "gettext.h" +#include "lyxrc.h" #include "debug.h" #include "DepTable.h" #include "support/filetools.h" @@ -70,13 +71,11 @@ using std::vector; // BufferList::updateIncludedTeXfiles, this should either // be done before calling LaTeX::funcs or in a completely // different way. -// - the bibtex command options should be supported. // - the makeindex style files should be taken care of with // the dependency mechanism. // - makeindex commandline options should be supported // - somewhere support viewing of bibtex and makeindex log files. // - we should perhaps also scan the bibtex log file -// - we should perhaps also scan the bibtex log file extern BufferList bufferlist; @@ -528,11 +527,7 @@ bool LaTeX::runBibTeX(vector const & bibtex_info) continue; result = true; - // FIXME: the bibtex call should not be hardcoded. bibtex has - // options (--min-crossrefs is useful) and there are also - // alternatives (bibtex8, bibulus, mlbibtex, clbibtex etc.). - // Move to converters? (JSpitzm) - string tmp = "bibtex "; + string tmp = lyxrc.bibtex_command + " "; tmp += OnlyFilename(ChangeExtension(it->aux_file, string())); Systemcall one; one.startscript(Systemcall::Wait, tmp); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 0d6ce8b280..87cef54e62 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,5 +1,9 @@ 2004-03-29 Jürgen Spitzmüller + * QPrefs.C: + * QPrefsDialog.C: + * ui/QPrefsLaTeXModule.ui: customize bibtex call. + * QFloat.C: * QFloatDialog.C: * floatplacement.[Ch]: add support for sidewaysfloats diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 3c8c1072e4..4f9fd856c7 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -161,6 +161,7 @@ void QPrefs::apply() rc.fontenc = fromqstr(latexmod->latexEncodingED->text()); rc.chktex_command = fromqstr(latexmod->latexChecktexED->text()); + rc.bibtex_command = fromqstr(latexmod->latexBibtexED->text()); rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked(); rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text()); rc.default_papersize = @@ -472,6 +473,7 @@ void QPrefs::update_contents() latexmod->latexEncodingED->setText(toqstr(rc.fontenc)); latexmod->latexChecktexED->setText(toqstr(rc.chktex_command)); + latexmod->latexBibtexED->setText(toqstr(rc.bibtex_command)); latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options); latexmod->latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option)); latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize); diff --git a/src/frontends/qt2/QPrefsDialog.C b/src/frontends/qt2/QPrefsDialog.C index 169c9afb9d..4f20c39fbf 100644 --- a/src/frontends/qt2/QPrefsDialog.C +++ b/src/frontends/qt2/QPrefsDialog.C @@ -202,6 +202,7 @@ QPrefsDialog::QPrefsDialog(QPrefs * form) connect(dateModule->DateED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(latexModule->latexChecktexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); + connect(latexModule->latexBibtexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(latexModule->latexAutoresetCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(latexModule->latexDviPaperED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(latexModule->latexPaperSizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); diff --git a/src/frontends/qt2/ui/QPrefLatexModule.ui b/src/frontends/qt2/ui/QPrefLatexModule.ui index 64134a2e7e..982fe96e69 100644 --- a/src/frontends/qt2/ui/QPrefLatexModule.ui +++ b/src/frontends/qt2/ui/QPrefLatexModule.ui @@ -13,7 +13,7 @@ 0 0 - 376 + 372 237 @@ -21,7 +21,7 @@ caption LaTeX settings - + margin 11 @@ -30,7 +30,7 @@ spacing 6 - + QLayoutWidget name @@ -177,7 +177,7 @@ - + QCheckBox name @@ -192,7 +192,28 @@ Set class options to default on class change - + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + QGroupBox name @@ -211,22 +232,7 @@ spacing 6 - - QLabel - - name - latexChecktexLA - - - text - Chec&kTeX command: - - - buddy - latexChecktexED - - - + QLabel name @@ -241,7 +247,7 @@ latexDviPaperED - + QLineEdit name @@ -263,30 +269,50 @@ CheckTeX start options and flags + + QLabel + + name + latexChecktexLA + + + text + Chec&kTeX command: + + + buddy + latexChecktexED + + + + QLineEdit + + name + latexBibtexED + + + toolTip + BibTeX command and options + + + + QLabel + + name + latexChecktexLA_2 + + + text + &BibTeX command: + + + buddy + latexChecktexED + + - - - name - Spacer3 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - + latexEncodingED diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 57cc59170d..fca5762f09 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,5 +1,8 @@ 2004-03-29 Jürgen Spitzmüller + * FormPreferences.C: + * forms/form_preferences.fd: customize bibtex call. + * FormFloat.C: * forms/form_float.fd: add support for sidewaysfloats diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index db10c7371e..564629b5c4 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -1737,6 +1737,7 @@ void FormPreferences::OutputsMisc::apply(LyXRC & rc) const rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff); rc.chktex_command = fl_get_input(dialog_->input_checktex); + rc.bibtex_command = fl_get_input(dialog_->input_bibtex); rc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption); rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt); } @@ -1802,6 +1803,8 @@ void FormPreferences::OutputsMisc::update(LyXRC const & rc) rc.ascii_roff_command.c_str()); fl_set_input(dialog_->input_checktex, rc.chktex_command.c_str()); + fl_set_input(dialog_->input_bibtex, + rc.bibtex_command.c_str()); fl_set_input(dialog_->input_paperoption, rc.view_dvi_paper_option.c_str()); fl_set_button(dialog_->check_autoreset_classopt, diff --git a/src/frontends/xforms/forms/form_preferences.fd b/src/frontends/xforms/forms/form_preferences.fd index a4c47e7a87..be885d9a77 100644 --- a/src/frontends/xforms/forms/form_preferences.fd +++ b/src/frontends/xforms/forms/form_preferences.fd @@ -2750,7 +2750,7 @@ argument: Name: form_preferences_outputs_misc Width: 455 Height: 375 -Number of Objects: 10 +Number of Objects: 11 -------------------- class: FL_BOX @@ -2849,7 +2849,7 @@ argument: 0 -------------------- class: FL_LABELFRAME type: ENGRAVED_FRAME -box: 10 190 435 135 +box: 10 190 435 165 boxtype: FL_NO_BOX colors: FL_BLACK FL_COL1 alignment: FL_ALIGN_TOP_LEFT @@ -2885,7 +2885,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 145 245 285 30 +box: 145 240 285 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -2903,7 +2903,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 145 285 285 30 +box: 145 310 285 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -2936,5 +2936,23 @@ name: check_autoreset_classopt callback: C_FormBaseInputCB argument: 0 +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 145 275 285 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Bibtex:|#B +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bibtex +callback: C_FormBaseInputCB +argument: 0 + ============================== create_the_forms diff --git a/src/lyxrc.C b/src/lyxrc.C index 11110b040e..eb3b2fe0b5 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -65,6 +65,7 @@ keyword_item lyxrcTags[] = { { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS }, { "\\autosave", LyXRC::RC_AUTOSAVE }, { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH }, + { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND }, { "\\bind_file", LyXRC::RC_BINDFILE }, { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES }, { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND }, @@ -201,6 +202,7 @@ void LyXRC::setDefaults() { default_papersize = PAPER_USLETTER; custom_export_format = "ps"; chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; + bibtex_command = "bibtex"; fontenc = "default"; dpi = 75; // Because a screen typically is wider than a piece of paper: @@ -555,6 +557,12 @@ int LyXRC::read(string const & filename) chktex_command = lexrc.getString(); } break; + + case RC_BIBTEX_COMMAND: + if (lexrc.next()) { + bibtex_command = lexrc.getString(); + } + break; case RC_SCREEN_DPI: if (lexrc.next()) { @@ -1161,6 +1169,10 @@ void LyXRC::output(ostream & os) const if (chktex_command != system_lyxrc.chktex_command) { os << "\\chktex_command \"" << chktex_command << "\"\n"; } + case RC_BIBTEX_COMMAND: + if (bibtex_command != system_lyxrc.bibtex_command) { + os << "\\bibtex_command \"" << bibtex_command << "\"\n"; + } case RC_KBMAP: if (use_kbmap != system_lyxrc.use_kbmap) { os << "\\kbmap " << tostr(use_kbmap) << '\n'; @@ -1977,6 +1989,10 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_CHKTEX_COMMAND: str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation."); break; + + case RC_BIBTEX_COMMAND: + str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus)."); + break; case RC_CURSOR_FOLLOWS_SCROLLBAR: str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen."); diff --git a/src/lyxrc.h b/src/lyxrc.h index 71894683e0..068549f7e6 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -98,6 +98,7 @@ enum LyXRCTags { RC_PERS_DICT, RC_ESC_CHARS, RC_CHKTEX_COMMAND, + RC_BIBTEX_COMMAND, RC_CURSOR_FOLLOWS_SCROLLBAR, RC_DIALOGS_ICONIFY_WITH_MAIN, RC_MAKE_BACKUP, @@ -196,6 +197,8 @@ enum LyXRCTags { PAPER_SIZE default_papersize; /// command to run chktex incl. options std::string chktex_command; + /// command to run bibtex incl. options + std::string bibtex_command; /// std::string document_path; ///