#include "xforms_helpers.h"
#include "xformsBC.h"
+#include "bufferparams.h"
+
#include "support/lstrings.h"
#include "lyx_forms.h"
-using lyx::support::getStringFromVector;
-using lyx::support::getVectorFromString;
-using lyx::support::trim;
-
using std::find;
using std::max;
using std::string;
+namespace lyx {
+
+using support::getStringFromVector;
+using support::getVectorFromString;
+using support::trim;
+
+namespace frontend {
+
namespace {
// shamelessly stolen from Menubar_pimpl.C
// 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);
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 || controller().usingJurabib());
- setEnabled(dialog_->input_before, natbib || controller().usingJurabib());
+ 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);
setEnabled(dialog_->button_up, activate_up);
setEnabled(dialog_->button_down, activate_down);
}
+
+} // namespace frontend
+} // namespace lyx