#include "insets/InsetCommand.h" // ChangeRefs
#include "insets/InsetExternal.h"
#include "insets/InsetGraphics.h"
+#include "insets/InsetNote.h"
#include "insets/InsetRef.h"
#include "insets/InsetText.h"
-#include "insets/InsetNote.h"
#include "frontends/alert.h"
#include "frontends/Application.h"
Private(BufferView & bv): wh_(0), cursor_(bv),
anchor_pit_(0), anchor_ypos_(0),
inlineCompletionUniqueChars_(0),
- last_inset_(0), mouse_position_cache_(),
+ last_inset_(0), clickable_inset_(false),
+ mouse_position_cache_(),
bookmark_edit_position_(-1), gui_(0)
{}
* Not owned, so don't delete.
*/
Inset * last_inset_;
+ /// are we hovering something that we can click
+ bool clickable_inset_;
/// position of the mouse at the time of the last mouse move
/// This is used to update the hovering status of inset in
bool const fw = act == LFUN_WORD_FIND_FORWARD;
docstring const data =
find2string(searched_string, true, false, fw);
- find(this, FuncRequest(LFUN_WORD_FIND, data));
+ bool found = lyxfind(this, FuncRequest(LFUN_WORD_FIND, data));
+ if (found)
+ dr.screenUpdate(Update::Force | Update::FitCursor);
break;
}
lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
break;
}
- if (find(this, req))
- showCursor();
+ if (lyxfind(this, req))
+ dr.screenUpdate(Update::Force | Update::FitCursor);
else
message(_("String not found!"));
d->search_request_cache_ = req;
DocIterator end = cur.selectionEnd();
if (beg.pit() == end.pit()) {
for (pos_type p = beg.pos() ; p < end.pos() ; ++p) {
- if (!cur.inMathed()
- && cur.paragraph().isDeleted(p))
+ if (!cur.inMathed() && cur.paragraph().isDeleted(p)) {
has_deleted = true;
+ break;
+ }
}
}
}
- replace(this, cmd, has_deleted);
- dr.forceBufferUpdate();
+ if (lyxreplace(this, cmd, has_deleted)) {
+ dr.forceBufferUpdate();
+ dr.screenUpdate(Update::Force | Update::FitCursor);
+ }
break;
}
istringstream iss(to_utf8(cmd.argument()));
iss >> opt;
if (findAdv(this, opt))
- cur.dispatched();
- else
- cur.undispatched();
+ dr.screenUpdate(Update::Force | Update::FitCursor);
break;
}
}
cur.recordUndo();
FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument());
- // FIXME There may be some cases where the inset knows that
- // single par update would be good enough, but it has no way
- // to tell us that at the moment.
inset->dispatch(cur, fr);
- dr.screenUpdate(Update::Force | Update::FitCursor);
- dr.forceBufferUpdate();
+ dr.screenUpdate(cur.result().screenUpdate());
+ if (cur.result().needBufferUpdate())
+ dr.forceBufferUpdate();
break;
}
void BufferView::updateHoveredInset() const
{
// Get inset under mouse, if there is one.
- Inset const * covering_inset = getCoveringInset(buffer_.text(),
- d->mouse_position_cache_.x_, d->mouse_position_cache_.y_);
+ int const x = d->mouse_position_cache_.x_;
+ int const y = d->mouse_position_cache_.y_;
+ Inset const * covering_inset = getCoveringInset(buffer_.text(), x, y);
+
+ d->clickable_inset_ = covering_inset && covering_inset->clickable(x, y);
+
if (covering_inset == d->last_inset_)
// Same inset, no need to do anything...
return;
} else
d->cursor_.setSelection(d->cursor_, length);
}
- // Ensure a redraw happens in any case because the new selection could
- // possibly be on the same screen as the previous selection.
- processUpdateFlags(Update::Force | Update::FitCursor);
}
docstring res;
Buffer buf("", false);
- if (buf.loadLyXFile(filename)) {
+ if (buf.loadLyXFile(filename) == Buffer::ReadSuccess) {
ErrorList & el = buffer_.errorList("Parse");
// Copy the inserted document error list into the current buffer one.
el = buf.errorList("Parse");
}
}
+
+bool BufferView::clickableInset() const
+{
+ return d->clickable_inset_;
+}
+
} // namespace lyx