#include <config.h>
-#include "xformsBC.h"
-#include "ControlCitation.h"
#include "FormCitation.h"
+#include "ControlCitation.h"
#include "forms/form_citation.h"
-#include "Kernel.h"
+
#include "Tooltips.h"
-#include "helper_funcs.h"
#include "xforms_helpers.h"
-#include "lyx_forms.h"
+#include "xformsBC.h"
-#include "gettext.h"
-#include "support/LAssert.h"
-#include "support/lstrings.h"
+#include "bufferparams.h"
-#include <algorithm>
+#include "support/lstrings.h"
-using namespace lyx::support;
+#include "lyx_forms.h"
using std::find;
using std::max;
-using std::min;
-using std::pair;
-using std::sort;
+
using std::vector;
+using std::string;
+
+
+namespace lyx {
+
+using support::getStringFromVector;
+using support::getVectorFromString;
+using support::trim;
+
+namespace frontend {
namespace {
// Find the style of the citekeys
vector<biblio::CiteStyle> const & styles =
ControlCitation::getCiteStyles();
- biblio::CitationStyle cs = biblio::getCitationStyle(command);
+ biblio::CitationStyle const cs(command);
vector<biblio::CiteStyle>::const_iterator cit =
find(styles.begin(), styles.end(), cs.style);
bool const force =
fl_get_button(dialog_->check_force_uppercase);
- command = biblio::getCiteCommand(styles[choice], full, force);
+ command =
+ biblio::CitationStyle(styles[choice], full, force)
+ .asLatexStr();
+
}
controller().params().setCmdName(command);
controller().params().setContents(getStringFromVector(citekeys));
+ string const before = getString(dialog_->input_before);
+ controller().params().setSecOptions(before);
+
string const after = getString(dialog_->input_after);
controller().params().setOptions(after);
}
fl_set_choice(dialog_->choice_style, choice);
}
+ // Invalid if no citation has been chosen
+ if (fl_get_browser_maxline(dialog_->browser_cite) < 1)
+ activate = ButtonPolicy::SMI_INVALID;
+
return activate;
}
// Use the citation command to update the GUI
updateStyle(dialog_.get(), controller().params().getCmdName());
- bool const natbib = controller().usingNatbib();
- setEnabled(dialog_->check_full_author_list, natbib);
- setEnabled(dialog_->check_force_uppercase, natbib);
- setEnabled(dialog_->choice_style, natbib);
+ biblio::CiteEngine const engine = controller().getEngine();
+ bool const natbib_engine =
+ engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
+ engine == biblio::ENGINE_NATBIB_NUMERICAL;
+ bool const basic_engine = engine == biblio::ENGINE_BASIC;
+
+ setEnabled(dialog_->check_full_author_list, natbib_engine);
+ setEnabled(dialog_->check_force_uppercase, natbib_engine);
+ setEnabled(dialog_->choice_style, !basic_engine);
+ setEnabled(dialog_->input_before, !basic_engine);
// No keys have been selected yet, so...
fl_clear_browser(dialog_->browser_info);
setCiteButtons(OFF);
// Natbib can have comments before and after the citation.
- // This is not yet supported. After only.
fl_set_input(dialog_->input_after,
controller().params().getOptions().c_str());
- fl_set_input(dialog_->input_before, _("Not yet supported").c_str());
- setEnabled(dialog_->input_before, false);
+ fl_set_input(dialog_->input_before,
+ controller().params().getSecOptions().c_str());
}
setEnabled(dialog_->button_up, activate_up);
setEnabled(dialog_->button_down, activate_down);
}
+
+} // namespace frontend
+} // namespace lyx