From 640ac2650ba67dc2ac4139411e3d97c94493bab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 27 Mar 2008 23:37:59 +0000 Subject: [PATCH] this feels more natural... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24008 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/factory.cpp | 5 ++--- src/frontends/qt4/GuiERT.cpp | 2 +- src/insets/InsetERT.cpp | 18 ++++++++---------- src/insets/InsetERT.h | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/factory.cpp b/src/factory.cpp index 609abcf793..b50b64abd1 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -240,9 +240,8 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) } case ERT_CODE: { - InsetCollapsable::CollapseStatus st; - InsetERT::string2params(to_utf8(cmd.argument()), st); - return new InsetERT(buf, st); + return new InsetERT(buf, + InsetERT::string2params(to_utf8(cmd.argument()))); } case LISTINGS_CODE: { diff --git a/src/frontends/qt4/GuiERT.cpp b/src/frontends/qt4/GuiERT.cpp index 175c4f4fc0..da1c0037d0 100644 --- a/src/frontends/qt4/GuiERT.cpp +++ b/src/frontends/qt4/GuiERT.cpp @@ -67,7 +67,7 @@ void GuiERT::updateContents() bool GuiERT::initialiseParams(string const & data) { - InsetERT::string2params(data, status_); + status_ = InsetERT::string2params(data); return true; } diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index e4f4d4188e..68147e20d5 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -114,9 +114,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd) break; } case LFUN_INSET_MODIFY: { - InsetCollapsable::CollapseStatus st; - InsetERT::string2params(to_utf8(cmd.argument()), st); - setStatus(cur, st); + setStatus(cur, string2params(to_utf8(cmd.argument()))); break; } default: @@ -192,11 +190,11 @@ bool InsetERT::showInsetDialog(BufferView * bv) const } -void InsetERT::string2params(string const & in, CollapseStatus & status) +InsetCollapsable::CollapseStatus InsetERT::string2params(string const & in) { - status = InsetCollapsable::Collapsed; + CollapseStatus status = Collapsed; if (in.empty()) - return; + return status; istringstream data(in); Lexer lex(0,0); @@ -205,15 +203,15 @@ void InsetERT::string2params(string const & in, CollapseStatus & status) string name; lex >> name; if (name != "ert") { - LYXERR0("InsetERT::string2params(" << in << ")\n" - "Expected arg 1 to be \"ert\"\n"); - return; + LYXERR0("Expected arg 1 to be \"ert\" in " << in); + return status; } int s; lex >> s; if (lex) - status = static_cast(s); + status = static_cast(s); + return status; } diff --git a/src/insets/InsetERT.h b/src/insets/InsetERT.h index c8ab5e18a3..af60deb76f 100644 --- a/src/insets/InsetERT.h +++ b/src/insets/InsetERT.h @@ -36,7 +36,7 @@ public: /// ~InsetERT(); /// - static void string2params(std::string const &, CollapseStatus &); + static CollapseStatus string2params(std::string const &); /// static std::string params2string(CollapseStatus); private: