]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
* InsetMathNest.C (handleFont): avoid crash on undo when
[lyx.git] / src / BufferView.C
index 6da56b3fd5ce8ed5d8ac9d97ef65f7da81fb0b05..2ff1ec0a0736a88c10920b725bf23ac2072a96af 100644 (file)
@@ -88,7 +88,6 @@ using support::fileSearch;
 using support::isDirWriteable;
 using support::isFileReadable;
 using support::makeDisplayPath;
-using support::makeAbsPath;
 using support::package;
 
 using std::distance;
@@ -125,7 +124,7 @@ BufferView::BufferView()
        : width_(0), height_(0), buffer_(0), wh_(0),
          cursor_(*this),
          multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0),
-         intl_(new Intl)
+         intl_(new Intl), last_inset_(0)
 {
        xsel_cache_.set = false;
        intl_->initKeyMapper(lyxrc.use_kbmap);
@@ -302,7 +301,7 @@ void BufferView::resize()
        lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << endl;
 
        buffer_->text().init(this);
-       update();
+       updateMetrics(false);
        switchKeyMap();
 }
 
@@ -721,7 +720,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_FONT_STATE:
-               cur.message(from_utf8(cur.currentState()));
+               cur.message(cur.currentState());
                break;
 
        case LFUN_BOOKMARK_SAVE:
@@ -1013,17 +1012,16 @@ void BufferView::clearSelection()
 
 void BufferView::workAreaResize(int width, int height)
 {
-       bool const widthChange = width != width_;
-       bool const heightChange = height != height_;
-
+       // A resize is triggered whenever a window gets focus,
+       // because of the shared rows() of a buffer in multiple
+       // buffer views.
+       
        // Update from work area
        width_ = width;
        height_ = height;
 
        if (buffer_)
                resize();
-
-       update();
 }
 
 
@@ -1058,18 +1056,15 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
        // NOTE: editXY returns the top level inset of nested insets. If you happen
        // to move from a text (inset=0) to a text inside an inset (e.g. an opened
        // footnote inset, again inset=0), that inset will not be redrawn.
-       // FIXME (abdel 07/12/06): I don't think the static solution will work in
-       // a multiple BufferView context.
-       static InsetBase * last_inset = NULL;
        if (cmd.action == LFUN_MOUSE_MOTION && cmd.button() == mouse_button::none) {
                bool need_redraw = false;
                
-               if (inset != last_inset) {
-                       if (last_inset)
-                               need_redraw |= last_inset->setMouseHover(false);
+               if (inset != last_inset_) {
+                       if (last_inset_)
+                               need_redraw |= last_inset_->setMouseHover(false);
                        if (inset)
                                need_redraw |= inset->setMouseHover(true);
-                       last_inset = inset;
+                       last_inset_ = inset;
                }
 
                // if last metrics update was in singlepar mode, WorkArea::redraw() will
@@ -1397,7 +1392,7 @@ void BufferView::menuInsertLyXFile(string const & filenm)
                if (buffer_) {
                        string const trypath = buffer_->filePath();
                        // If directory is writeable, use this as default.
-                       if (isDirWriteable(trypath))
+                       if (isDirWriteable(FileName(trypath)))
                                initpath = trypath;
                }