]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetgraphics.C
The markDirty() and fitCursor() changes
[lyx.git] / src / insets / insetgraphics.C
index 932ac0af4e99c33e9334b6783f264c5452b27328..63dc4584874ec6eb6894ceb40c66e39e8d1bb3be 100644 (file)
@@ -230,17 +230,21 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
 
                string const filepath = cmd.view()->buffer()->filePath();
                setParams(p, filepath);
-               cmd.view()->updateInset(this, true);
+               cmd.view()->updateInset(this);
                result = DISPATCHED;
        }
        break;
 
        case LFUN_INSET_DIALOG_UPDATE: {
                InsetGraphicsMailer mailer(*this);
-               mailer.updateDialog();
+               mailer.updateDialog(cmd.view());
        }
        break;
 
+       case LFUN_MOUSE_RELEASE:
+               edit(cmd.view(), cmd.x, cmd.y, cmd.button());
+               break;
+
        default:
                result = DISPATCHED;
                break;
@@ -340,7 +344,7 @@ BufferView * InsetGraphics::view() const
 
 
 void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
-                        int baseline, float & x, bool) const
+                        int baseline, float & x) const
 {
        // MakeAbsPath returns params().filename unchanged if it absolute
        // already.
@@ -414,28 +418,13 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
                        paint.text(old_x + TEXT_TO_INSET_OFFSET + 6, baseline - 4, msg, msgFont);
                }
        }
-
-       // the status message may mean we changed size, so indicate
-       // we need a row redraw
-#if 0
-       if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) {
-               bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW);
-       }
-#endif
-
-       // Reset the cache, ready for the next draw request
-#if 0
-       cached_status_ = grfx::ErrorUnknown;
-       cached_image_.reset();
-       cache_filled_ = false;
-#endif
 }
 
 
-void InsetGraphics::edit(BufferView *, int, int, mouse_button::state)
+void InsetGraphics::edit(BufferView * bv, int, int, mouse_button::state)
 {
        InsetGraphicsMailer mailer(*this);
-       mailer.showDialog();
+       mailer.showDialog(bv);
 }
 
 
@@ -846,7 +835,7 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
 void InsetGraphics::statusChanged()
 {
        if (!cache_->view.expired())
-               cache_->view.lock()->updateInset(this, false);
+               cache_->view.lock()->updateInset(this);
 }
 
 
@@ -903,9 +892,11 @@ void InsetGraphicsMailer::string2params(string const & in,
                        return;
        }
 
-       InsetGraphics inset;    
-       inset.readInsetGraphics(lex);
-       params = inset.params();
+       if (lex.isOK()) {
+               InsetGraphics inset;    
+               inset.readInsetGraphics(lex);
+               params = inset.params();
+       }
 }