]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetminipage.C
fix #832
[lyx.git] / src / insets / insetminipage.C
index f2e5c635ec87174a5a3caa5e60ce0b96fdb540cc..120b6841b34f36e5d6bf07200170ab36622415c6 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <config.h>
 
-
 #include "insetminipage.h"
 #include "insettext.h"
 
@@ -22,6 +21,7 @@
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "lyxtext.h"
+#include "Lsstream.h"
 
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
@@ -107,8 +107,6 @@ InsetMinipage::~InsetMinipage()
 
 dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
 {
-       Inset::RESULT result = UNDISPATCHED;
-
        switch (cmd.action) {
        case LFUN_INSET_MODIFY: {
                InsetMinipage::Params params;
@@ -117,22 +115,24 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
                params_.pos   = params.pos;
                params_.width = params.width;
 
+               /* FIXME: I refuse to believe we have to live
+                * with ugliness like this ... */
+               LyXText * t = inset.getLyXText(cmd.view());
+               t->need_break_row = t->rows().begin();
+               t->fullRebreak();
+               inset.update(cmd.view(), true);
+               t->setCursorIntern(t->cursor.par(), t->cursor.pos());
                cmd.view()->updateInset(this);
-               result = DISPATCHED;
+               return DISPATCHED;
        }
-       break;
 
-       case LFUN_INSET_DIALOG_UPDATE: {
-               InsetMinipageMailer mailer(*this);
-               mailer.updateDialog(cmd.view());
-       }
-       break;
+       case LFUN_INSET_DIALOG_UPDATE: 
+               InsetMinipageMailer(*this).updateDialog(cmd.view());
+               return DISPATCHED;
 
        default:
-               result = InsetCollapsable::localDispatch(cmd);
+               return InsetCollapsable::localDispatch(cmd);
        }
-
-       return result;
 }
 
 
@@ -368,7 +368,10 @@ void InsetMinipageMailer::string2params(string const & in,
 {
        params = InsetMinipage::Params();
 
-       istringstream data(in);
+       if (in.empty())
+               return;
+       
+       istringstream data(STRCONV(in));
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -400,6 +403,5 @@ InsetMinipageMailer::params2string(InsetMinipage::Params const & params)
        ostringstream data;
        data << name_ << ' ';
        params.write(data);
-
-       return data.str();
+       return STRCONV(data.str());
 }