X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetbibtex.C;h=0dbbed0c56d9337feba15637d9c45d3933f5a535;hb=cd424d78530c9e38502ee7f989ef5c426c97ad61;hp=3687af8b63ab5d4eaa043496d5b3814c707b62c4;hpb=781e0ef62e262a633b094917eb40a5b840fea913;p=lyx.git diff --git a/src/insets/insetbibtex.C b/src/insets/insetbibtex.C index 3687af8b63..0dbbed0c56 100644 --- a/src/insets/insetbibtex.C +++ b/src/insets/insetbibtex.C @@ -11,31 +11,47 @@ #include #include "insetbibtex.h" -#include "metricsinfo.h" + #include "buffer.h" -#include "BufferView.h" +#include "bufferparams.h" +#include "dispatchresult.h" #include "debug.h" #include "funcrequest.h" #include "gettext.h" -#include "latexrunparams.h" +#include "metricsinfo.h" +#include "outputparams.h" #include "support/filetools.h" -#include "support/path.h" -#include "support/os.h" #include "support/lstrings.h" -#include "support/LAssert.h" +#include "support/os.h" +#include "support/path.h" #include -#include -using namespace lyx::support; +using lyx::support::ascii_lowercase; +using lyx::support::ChangeExtension; +using lyx::support::contains; +using lyx::support::findtexfile; +using lyx::support::IsFileReadable; +using lyx::support::ltrim; +using lyx::support::MakeAbsPath; +using lyx::support::Path; +using lyx::support::prefixIs; +using lyx::support::rtrim; +using lyx::support::split; +using lyx::support::subst; +using lyx::support::tokenPos; +using lyx::support::trim; + +namespace os = lyx::support::os; -using std::ostream; -using std::ifstream; -using std::getline; using std::endl; -using std::vector; +using std::getline; +using std::string; +using std::ifstream; +using std::ostream; using std::pair; +using std::vector; InsetBibtex::InsetBibtex(InsetCommandParams const & p) @@ -72,33 +88,44 @@ void InsetBibtex::draw(PainterInfo & pi, int x, int y) const } -dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd) +DispatchResult +InsetBibtex::priv_dispatch(FuncRequest const & cmd, + idx_type & idx, pos_type & pos) { + DispatchResult result(false); + switch (cmd.action) { case LFUN_INSET_DIALOG_SHOW: InsetCommandMailer("bibtex", *this).showDialog(cmd.view()); - return DISPATCHED; + result.dispatched(true); + break; + case LFUN_MOUSE_RELEASE: - if (button().box().contains(cmd.x, cmd.y)) + if (button().box().contains(cmd.x, cmd.y)) InsetCommandMailer("bibtex", *this).showDialog(cmd.view()); - return DISPATCHED; - + result.dispatched(true); + break; + case LFUN_INSET_MODIFY: { InsetCommandParams p; InsetCommandMailer::string2params(cmd.argument, p); - if (p.getCmdName().empty()) - return DISPATCHED; - setParams(p); - return DISPATCHED; + if (!p.getCmdName().empty()) + setParams(p); + result.dispatched(true); + result.update(true); } - + break; + default: - return InsetCommand::localDispatch(cmd); + result = InsetCommand::priv_dispatch(cmd, idx, pos); + break; } + return result; } + string const InsetBibtex::getScreenLabel(Buffer const &) const { return _("BibTeX Generated References"); @@ -106,7 +133,7 @@ string const InsetBibtex::getScreenLabel(Buffer const &) const int InsetBibtex::latex(Buffer const & buffer, ostream & os, - LatexRunParams const & runparams) const + OutputParams const & runparams) const { // changing the sequence of the commands // 1. \bibliographystyle{style} @@ -141,9 +168,9 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os, // part of its name, because it's than book. // For the "official" lyx-layouts it's no problem to support // all well - if (!contains(buffer.params.getLyXTextClass().name(), + if (!contains(buffer.params().getLyXTextClass().name(), "art")) { - if (buffer.params.sides == LyXTextClass::OneSide) { + if (buffer.params().sides == LyXTextClass::OneSide) { // oneside os << "\\clearpage"; } else {