#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
istringstream iss(to_utf8(cmd.argument()));
iss >> opt;
if (findAdv(this, opt))
- cur.dispatched();
- else
- cur.undispatched();
+ dr.screenUpdate(Update::Force | Update::FitCursor);
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