mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
cursor changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8035 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
32a716152e
commit
db78dbfa04
@ -547,6 +547,18 @@ int BufferView::workHeight() const
|
||||
}
|
||||
|
||||
|
||||
LCursor & BufferView::cursor()
|
||||
{
|
||||
return pimpl_->cursor_;
|
||||
}
|
||||
|
||||
|
||||
LCursor const & BufferView::cursor() const
|
||||
{
|
||||
return pimpl_->cursor_;
|
||||
}
|
||||
|
||||
|
||||
void BufferView::x_target(int x)
|
||||
{
|
||||
x_target_ = x;
|
||||
|
@ -27,6 +27,7 @@ class ErrorList;
|
||||
class FuncRequest;
|
||||
class InsetOld;
|
||||
class Language;
|
||||
class LCursor;
|
||||
class LyXText;
|
||||
class LyXScreen;
|
||||
class LyXView;
|
||||
@ -34,6 +35,7 @@ class Painter;
|
||||
class TeXErrors;
|
||||
class UpdatableInset;
|
||||
|
||||
|
||||
/**
|
||||
* A buffer view encapsulates a view onto a particular
|
||||
* buffer, and allows access to operate upon it. A view
|
||||
@ -200,6 +202,11 @@ public:
|
||||
/// return target x position of cursor
|
||||
int BufferView::x_target() const;
|
||||
|
||||
/// access to cursor
|
||||
LCursor & cursor();
|
||||
/// access to cursor
|
||||
LCursor const & cursor() const;
|
||||
|
||||
private:
|
||||
/// Set the current locking inset
|
||||
void theLockingInset(UpdatableInset * inset);
|
||||
|
@ -122,7 +122,7 @@ boost::signals::connection lostcon;
|
||||
BufferView::Pimpl::Pimpl(BufferView * bv, LyXView * owner,
|
||||
int xpos, int ypos, int width, int height)
|
||||
: bv_(bv), owner_(owner), buffer_(0), cursor_timeout(400),
|
||||
using_xterm_cursor(false)
|
||||
using_xterm_cursor(false), cursor_(bv)
|
||||
{
|
||||
workarea_.reset(WorkAreaFactory::create(xpos, ypos, width, height));
|
||||
screen_.reset(LyXScreenFactory::create(workarea()));
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define BUFFERVIEW_PIMPL_H
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "cursor.h"
|
||||
#include "errorlist.h"
|
||||
|
||||
#include "insets/inset.h"
|
||||
@ -43,7 +44,7 @@ class FuncRequest;
|
||||
///
|
||||
struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
///
|
||||
Pimpl(BufferView * i, LyXView * o,
|
||||
Pimpl(BufferView * bv, LyXView * owner,
|
||||
int xpos, int ypos, int width, int height);
|
||||
///
|
||||
Painter & painter() const;
|
||||
@ -196,5 +197,7 @@ private:
|
||||
void MenuInsertLyXFile(std::string const & filen);
|
||||
/// our workarea
|
||||
WorkArea & workarea() const;
|
||||
///
|
||||
LCursor cursor_;
|
||||
};
|
||||
#endif // BUFFERVIEW_PIMPL_H
|
||||
|
@ -1,3 +1,20 @@
|
||||
2003-11-04 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* cursor.[Ch]: restructure
|
||||
|
||||
* BufferView.[Ch]:
|
||||
* BufferView_pimpl.[Ch]: new LCursor cursor_ member
|
||||
|
||||
* iterators.[Ch] (asCursor): remove
|
||||
|
||||
* lfuns.h: remove LFUN_INSET_EDIT
|
||||
|
||||
* lyxfunc.C:
|
||||
* tabular.C:
|
||||
* text.C:
|
||||
* text2.C:
|
||||
* text3.C: use Inset::edit() instead of dispatch(LFUN_INSET_EDIT)
|
||||
|
||||
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyxfind.[Ch]: complete overhaul
|
||||
|
128
src/cursor.C
128
src/cursor.C
@ -3,7 +3,7 @@
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Vigna
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -20,12 +20,34 @@
|
||||
#include "paragraph.h"
|
||||
|
||||
#include "insets/updatableinset.h"
|
||||
#include "insets/insettext.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
using std::vector;
|
||||
using std::endl;
|
||||
|
||||
|
||||
DispatchResult Cursor::dispatch(FuncRequest const & cmd)
|
||||
std::ostream & operator<<(std::ostream & os, CursorItem const & item)
|
||||
{
|
||||
os << " inset: " << item.inset_
|
||||
<< " idx: " << item.idx_
|
||||
<< " text: " << item.text_
|
||||
<< " par: " << item.par_
|
||||
<< " pos: " << item.pos_;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, LCursor const & cursor)
|
||||
{
|
||||
for (size_t i = 0, n = cursor.data_.size(); i != n; ++i)
|
||||
os << " " << cursor.data_[i];
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
DispatchResult LCursor::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
for (int i = data_.size() - 1; i >= 0; --i) {
|
||||
CursorItem & citem = data_[i];
|
||||
@ -34,47 +56,77 @@ DispatchResult Cursor::dispatch(FuncRequest const & cmd)
|
||||
DispatchResult res = citem.inset_->dispatch(cmd);
|
||||
lyxerr << " result: " << res.val() << endl;
|
||||
|
||||
if (res.dispatched())
|
||||
return res;
|
||||
switch (res.val()) {
|
||||
case FINISHED:
|
||||
pop();
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case FINISHED_RIGHT: {
|
||||
pop();
|
||||
//InsetText * inset = static_cast<InsetText *>(innerInset());
|
||||
//if (inset)
|
||||
// inset->moveRightIntern(bv_, false, false);
|
||||
//else
|
||||
// bv_->text->cursorRight(bv_);
|
||||
innerText()->cursorRight(bv_);
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
case FINISHED_UP: {
|
||||
pop();
|
||||
//InsetText * inset = static_cast<InsetText *>(inset());
|
||||
//if (inset)
|
||||
// result = inset->moveUp(bv);
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
case FINISHED_DOWN: {
|
||||
pop();
|
||||
//InsetText * inset = static_cast<InsetText *>(inset());
|
||||
//if (inset)
|
||||
// result = inset->moveDown(bv);
|
||||
return DispatchResult(true);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lyxerr << "# unhandled result: " << res.val() << endl;
|
||||
}
|
||||
return DispatchResult(false);
|
||||
|
||||
lyxerr << "trying to dispatch to main text " << bv_->text << endl;
|
||||
DispatchResult res = bv_->text->dispatch(cmd);
|
||||
lyxerr << " result: " << res.val() << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void buildCursor(Cursor & cursor, BufferView & bv)
|
||||
LCursor::LCursor(BufferView * bv)
|
||||
: bv_(bv)
|
||||
{}
|
||||
|
||||
|
||||
void LCursor::push(InsetOld * inset, LyXText * text)
|
||||
{
|
||||
UpdatableInset * inset = bv.theLockingInset();
|
||||
lyxerr << "\nbuildCursor: " << inset << endl;
|
||||
if (!inset)
|
||||
return;
|
||||
|
||||
inset = inset->getLockingInset();
|
||||
|
||||
bool ok = false;
|
||||
ParIterator pit = bv.buffer()->par_iterator_begin();
|
||||
ParIterator end = bv.buffer()->par_iterator_end();
|
||||
for ( ; pit != end && !ok; ++pit) {
|
||||
InsetList::iterator it = pit->insetlist.begin();
|
||||
InsetList::iterator iend = pit->insetlist.end();
|
||||
for ( ; it != iend && !ok; ++it)
|
||||
if (it->inset == inset || it->inset == inset->owner())
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
lyxerr << " tli not found! inset: " << inset << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
pit.asCursor(cursor);
|
||||
for (size_t i = 0, n = cursor.data_.size(); i != n; ++i) {
|
||||
lyxerr << " inset: " << cursor.data_[i].inset_
|
||||
<< " idx: " << cursor.data_[i].idx_
|
||||
<< " text: " << cursor.data_[i].text_
|
||||
<< " par: " << cursor.data_[i].par_
|
||||
<< " pos: " << cursor.data_[i].pos_
|
||||
<< endl;
|
||||
}
|
||||
data_.push_back(CursorItem(inset, text));
|
||||
}
|
||||
|
||||
|
||||
void LCursor::pop()
|
||||
{
|
||||
BOOST_ASSERT(!data_.empty());
|
||||
data_.pop_back();
|
||||
}
|
||||
|
||||
|
||||
InsetOld * LCursor::innerInset() const
|
||||
{
|
||||
return data_.empty() ? 0 : data_.back().inset_;
|
||||
}
|
||||
|
||||
|
||||
LyXText * LCursor::innerText() const
|
||||
{
|
||||
return data_.empty() ? bv_->text : data_.back().text_;
|
||||
}
|
||||
|
32
src/cursor.h
32
src/cursor.h
@ -29,10 +29,16 @@ class LyXText;
|
||||
* The cursor class describes the position of a cursor within a document.
|
||||
*/
|
||||
|
||||
class CursorItem : public TextCursor {
|
||||
class CursorItem {
|
||||
public:
|
||||
///
|
||||
CursorItem() : inset_(0), text_(0), idx_(0), par_(0), pos_(0) {}
|
||||
///
|
||||
CursorItem(InsetOld * inset, LyXText * text)
|
||||
: inset_(inset), text_(text), idx_(0), par_(0), pos_(0)
|
||||
{}
|
||||
///
|
||||
friend std::ostream & operator<<(std::ostream &, CursorItem const &);
|
||||
public:
|
||||
///
|
||||
InsetOld * inset_;
|
||||
@ -47,21 +53,27 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Cursor {
|
||||
class LCursor {
|
||||
public:
|
||||
///
|
||||
Cursor() {}
|
||||
LCursor(BufferView * bv);
|
||||
///
|
||||
DispatchResult dispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void push(InsetOld *, LyXText *);
|
||||
///
|
||||
void pop();
|
||||
///
|
||||
InsetOld * innerInset() const;
|
||||
///
|
||||
LyXText * innerText() const;
|
||||
///
|
||||
friend std::ostream & operator<<(std::ostream &, LCursor const &);
|
||||
public:
|
||||
/// mainly used as stack, bnut wee need random access
|
||||
/// mainly used as stack, but wee need random access
|
||||
std::vector<CursorItem> data_;
|
||||
///
|
||||
BufferView * bv_;
|
||||
};
|
||||
|
||||
/// build cursor from current cursor in view
|
||||
void buildCursor(Cursor & cursor, BufferView & bv);
|
||||
|
||||
/// build cursor from (x,y) coordinates
|
||||
void buildCursor(Cursor & cursor, BufferView & bv, int x, int y);
|
||||
|
||||
#endif // LYXCURSOR_H
|
||||
|
@ -1,3 +1,22 @@
|
||||
2003-11-04 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* inset.h (edit): move locking code from dispatch() to edit()
|
||||
|
||||
* insetbase.[Ch]:
|
||||
* insetbibitem.C:
|
||||
* insetbranch.[Ch]:
|
||||
* insetcite.[Ch]:
|
||||
* insetcollapsable.[Ch]:
|
||||
* insetcommand.C:
|
||||
* insetert.[Ch]:
|
||||
* insetexternal.[Ch]:
|
||||
* insetgraphics.[Ch]:
|
||||
* insetindex.[Ch]:
|
||||
* insetlabel.C:
|
||||
* insetnote.[Ch]:
|
||||
* insetref.C:
|
||||
* insettabular.[Ch]:
|
||||
* insettext.[Ch]: adjust
|
||||
|
||||
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
|
@ -240,8 +240,6 @@ public:
|
||||
/// return the cursor if we own one otherwise giv'em just the
|
||||
/// BufferView cursor to work with.
|
||||
virtual LyXCursor const & cursor(BufferView * bview) const;
|
||||
/// lock cell with given index
|
||||
virtual void edit(BufferView *, int /*index*/) {}
|
||||
|
||||
/// used to toggle insets
|
||||
// is the inset open?
|
||||
|
@ -35,3 +35,13 @@ InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &)
|
||||
{
|
||||
return DispatchResult(false);
|
||||
}
|
||||
|
||||
|
||||
void InsetBase::edit(BufferView *, bool)
|
||||
{}
|
||||
|
||||
|
||||
void InsetBase::edit(BufferView * bv, int, int)
|
||||
{
|
||||
edit(bv, true);
|
||||
}
|
||||
|
@ -53,6 +53,11 @@ public:
|
||||
DispatchResult
|
||||
dispatch(FuncRequest const & cmd);
|
||||
|
||||
/// cursor enters
|
||||
virtual void edit(BufferView * bv, bool left);
|
||||
/// cursor enters
|
||||
virtual void edit(BufferView * bv, int x, int y);
|
||||
|
||||
/// compute the size of the object returned in dim
|
||||
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
|
||||
/// draw inset and update (xo, yo)-cache
|
||||
|
@ -65,7 +65,7 @@ InsetBibitem::priv_dispatch(FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_PRESS:
|
||||
InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
|
||||
|
@ -131,7 +131,8 @@ InsetBranch::priv_dispatch(FuncRequest const & cmd,
|
||||
bv->updateInset(this);
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
case LFUN_INSET_EDIT:
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
if (cmd.button() != mouse_button::button3)
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
return DispatchResult(false);
|
||||
@ -142,10 +143,11 @@ InsetBranch::priv_dispatch(FuncRequest const & cmd,
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
|
||||
InsetBranchMailer("branch", *this).showDialog(bv);
|
||||
InsetBranchMailer("branch", *this).showDialog(bv);
|
||||
return DispatchResult(true);
|
||||
}
|
||||
// fallthrough:
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
default:
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
@ -34,8 +34,6 @@
|
||||
class InsetBranch : public InsetCollapsable {
|
||||
public:
|
||||
///
|
||||
|
||||
|
||||
InsetBranch(BufferParams const &, std::string const &);
|
||||
/// Copy constructor
|
||||
InsetBranch(InsetBranch const &);
|
||||
|
@ -311,10 +311,11 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
|
||||
DispatchResult
|
||||
InsetCitation::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
InsetCommandMailer("citation", *this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
|
||||
@ -322,7 +323,7 @@ InsetCitation::priv_dispatch(FuncRequest const & cmd,
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int InsetCitation::ascii(Buffer const & buffer, ostream & os, int) const
|
||||
{
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
DispatchResult localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
protected:
|
||||
///
|
||||
|
@ -274,15 +274,61 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::edit(BufferView * bv, int index)
|
||||
void InsetCollapsable::edit(BufferView * bv, bool left)
|
||||
{
|
||||
lyxerr << "InsetCollapsable: edit" << endl;
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "InsetCollapsable: can't lock index " << index << endl;
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
lyxerr << "InsetCollapsable: can't lock" << endl;
|
||||
inset.edit(bv, left);
|
||||
first_after_edit = true;
|
||||
}
|
||||
|
||||
/*
|
||||
if (!cmd.argument.empty()) {
|
||||
UpdatableInset::edit(
|
||||
if (collapsed_) {
|
||||
lyxerr << "branch collapsed_" << endl;
|
||||
collapsed_ = false;
|
||||
if (bv->lockInset(this)) {
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.dispatch(cmd);
|
||||
first_after_edit = true;
|
||||
}
|
||||
} else {
|
||||
lyxerr << "branch not collapsed_" << endl;
|
||||
if (bv->lockInset(this))
|
||||
inset.dispatch(cmd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
UpdatableInset::edit(cmd, idx, pos);
|
||||
*/
|
||||
|
||||
|
||||
void InsetCollapsable::edit(BufferView * bv, int x, int y)
|
||||
{
|
||||
if (collapsed_) {
|
||||
collapsed_ = false;
|
||||
// set this only here as it should be recollapsed only if
|
||||
// it was already collapsed!
|
||||
first_after_edit = true;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.edit(bv, x, y);
|
||||
} else {
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
if (y <= button_dim.y2)
|
||||
inset.edit(bv, x, 0);
|
||||
else
|
||||
inset.edit(bv, x,
|
||||
ascent() + y - (height_collapsed() + inset.ascent()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DispatchResult
|
||||
InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
|
||||
@ -292,57 +338,6 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
|
||||
// << cmd.action << " '" << cmd.argument << "'\n";
|
||||
BufferView * bv = cmd.view();
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT: {
|
||||
if (!cmd.argument.empty()) {
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
if (collapsed_) {
|
||||
lyxerr << "branch collapsed_" << endl;
|
||||
collapsed_ = false;
|
||||
if (bv->lockInset(this)) {
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.dispatch(cmd);
|
||||
first_after_edit = true;
|
||||
}
|
||||
} else {
|
||||
lyxerr << "branch not collapsed_" << endl;
|
||||
if (bv->lockInset(this))
|
||||
inset.dispatch(cmd);
|
||||
}
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
|
||||
#endif
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
return DispatchResult(true, true);
|
||||
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
if (collapsed_) {
|
||||
collapsed_ = false;
|
||||
// set this only here as it should be recollapsed only if
|
||||
// it was already collapsed!
|
||||
first_after_edit = true;
|
||||
if (!bv->lockInset(this))
|
||||
return DispatchResult(true, true);
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.dispatch(cmd);
|
||||
} else {
|
||||
if (!bv->lockInset(this))
|
||||
return DispatchResult(true, true);
|
||||
if (cmd.y <= button_dim.y2) {
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.y = 0;
|
||||
inset.dispatch(cmd1);
|
||||
} else
|
||||
inset.dispatch(adjustCommand(cmd));
|
||||
}
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
if (!collapsed_ && cmd.y > button_dim.y2)
|
||||
inset.dispatch(adjustCommand(cmd));
|
||||
@ -359,8 +354,6 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
|
||||
|
||||
default:
|
||||
DispatchResult const result = inset.dispatch(cmd);
|
||||
if (result.val() >= FINISHED)
|
||||
bv->unlockInset(this);
|
||||
first_after_edit = false;
|
||||
return result;
|
||||
}
|
||||
|
@ -153,14 +153,16 @@ protected:
|
||||
void setCollapsed(bool) const;
|
||||
///
|
||||
Box const & buttonDim() const;
|
||||
///
|
||||
void edit(BufferView *, bool);
|
||||
///
|
||||
void edit(BufferView *, int, int);
|
||||
|
||||
private:
|
||||
///
|
||||
void lfunMouseRelease(FuncRequest const &);
|
||||
///
|
||||
FuncRequest adjustCommand(FuncRequest const &);
|
||||
///
|
||||
void edit(BufferView *, int index);
|
||||
|
||||
public:
|
||||
///
|
||||
|
@ -108,7 +108,8 @@ InsetCommand::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
|
||||
edit(cmd.view(), true);
|
||||
return DispatchResult(true);
|
||||
|
||||
default:
|
||||
return DispatchResult(false);
|
||||
|
@ -424,35 +424,31 @@ int InsetERT::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::edit(BufferView * bv, bool left)
|
||||
{
|
||||
if (status_ == Inlined) {
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
inset.edit(bv, left);
|
||||
} else {
|
||||
InsetCollapsable::edit(bv, left);
|
||||
}
|
||||
set_latex_font(bv);
|
||||
updateStatus(bv);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult
|
||||
InsetERT::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
DispatchResult result = DispatchResult(false);
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
if (inset.paragraphs.begin()->empty()) {
|
||||
if (inset.paragraphs.begin()->empty())
|
||||
set_latex_font(bv);
|
||||
}
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
break;
|
||||
if (status_ == Inlined) {
|
||||
if (!bv->lockInset(this))
|
||||
break;
|
||||
result = inset.dispatch(cmd);
|
||||
} else {
|
||||
// Is the following line correct? Ab
|
||||
open(bv);
|
||||
result = InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
set_latex_font(bv);
|
||||
updateStatus(bv);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetERT::ERTStatus status_;
|
||||
InsetERTMailer::string2params(cmd.argument, status_);
|
||||
@ -467,35 +463,25 @@ InsetERT::priv_dispatch(FuncRequest const & cmd,
|
||||
*/
|
||||
inset.getLyXText(cmd.view())->fullRebreak();
|
||||
bv->updateInset(this);
|
||||
result = DispatchResult(true, true);
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
lfunMousePress(cmd);
|
||||
result = DispatchResult(true, true);
|
||||
break;
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_MOUSE_MOTION:
|
||||
lfunMouseMotion(cmd);
|
||||
result = DispatchResult(true, true);
|
||||
break;
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
lfunMouseRelease(cmd);
|
||||
result = DispatchResult(true, true);
|
||||
break;
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_LAYOUT:
|
||||
bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
|
||||
result = DispatchResult(true);
|
||||
break;
|
||||
return DispatchResult(true);
|
||||
|
||||
default:
|
||||
result = InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
case LFUN_BACKSPACE:
|
||||
@ -505,12 +491,11 @@ InsetERT::priv_dispatch(FuncRequest const & cmd,
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
case LFUN_CUT:
|
||||
set_latex_font(bv);
|
||||
break;
|
||||
return DispatchResult(false);
|
||||
|
||||
default:
|
||||
break;
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,6 +131,8 @@ private:
|
||||
void set_latex_font(BufferView *);
|
||||
/// update status on button
|
||||
void updateStatus(BufferView *, bool = false) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool left);
|
||||
|
||||
///
|
||||
mutable ERTStatus status_;
|
||||
|
@ -458,7 +458,6 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetExternalMailer(*this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
|
||||
@ -468,6 +467,12 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
}
|
||||
|
||||
|
||||
void InsetExternal::edit(BufferView * bv, bool)
|
||||
{
|
||||
InsetExternalMailer(*this).showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetExternal::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
renderer_->metrics(mi, dim);
|
||||
|
@ -140,6 +140,8 @@ public:
|
||||
void setParams(InsetExternalParams const &, Buffer const &);
|
||||
///
|
||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool);
|
||||
|
||||
protected:
|
||||
///
|
||||
|
@ -210,7 +210,6 @@ InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
InsetGraphicsMailer(*this).updateDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
InsetGraphicsMailer(*this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
@ -221,6 +220,12 @@ InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::edit(BufferView * bv, bool)
|
||||
{
|
||||
InsetGraphicsMailer(*this).showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
graphic_->metrics(mi, dim);
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
InsetGraphicsParams const & params() const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool);
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
|
@ -61,12 +61,11 @@ void InsetPrintIndex::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
DispatchResult
|
||||
InsetIndex::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
DispatchResult InsetIndex::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
InsetCommandMailer("index", *this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
|
||||
|
@ -38,11 +38,9 @@ public:
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
DispatchResult
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
DispatchResult priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos);
|
||||
};
|
||||
|
||||
|
||||
|
@ -66,10 +66,9 @@ InsetLabel::priv_dispatch(FuncRequest const & cmd,
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
InsetCommandMailer("label", *this).showDialog(bv);
|
||||
return DispatchResult(true, true);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
|
@ -145,11 +145,6 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
return DispatchResult(false);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetNoteMailer("note", *this).updateDialog(bv);
|
||||
return DispatchResult(true, true);
|
||||
|
@ -12,11 +12,10 @@
|
||||
#ifndef INSETNOTE_H
|
||||
#define INSETNOTE_H
|
||||
|
||||
|
||||
#include "insetcollapsable.h"
|
||||
|
||||
|
||||
struct InsetNoteParams {
|
||||
struct InsetNoteParams {
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
///
|
||||
|
@ -51,7 +51,7 @@ InsetRef::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_PRESS:
|
||||
// Eventually trigger dialog with button 3 not 1
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
cmd.view()->owner()->
|
||||
|
@ -454,7 +454,7 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
the_locking_inset = in;
|
||||
locked = true;
|
||||
resetPos(bv);
|
||||
in->dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
in->edit(bv, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -639,27 +639,63 @@ void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::edit(BufferView * bv, int index)
|
||||
void InsetTabular::edit(BufferView * bv, bool left)
|
||||
{
|
||||
lyxerr << "InsetTabular::edit" << endl;
|
||||
lyxerr << "InsetTabular::edit: " << this << " first cell: "
|
||||
<< &tabular.cell_info[0][0].inset << endl;
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr << "InsetTabular::Cannot lock inset (2)" << endl;
|
||||
lyxerr << "InsetTabular::Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
finishUndo();
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
actcell = index;
|
||||
|
||||
if (left) {
|
||||
if (isRightToLeft(bv))
|
||||
actcell = tabular.getLastCellInRow(0);
|
||||
else
|
||||
actcell = 0;
|
||||
} else {
|
||||
if (isRightToLeft(bv))
|
||||
actcell = tabular.getFirstCellInRow(tabular.rows()-1);
|
||||
else
|
||||
actcell = tabular.getNumberOfCells() - 1;
|
||||
}
|
||||
clearSelection();
|
||||
resetPos(bv);
|
||||
bv->fitCursor();
|
||||
}
|
||||
|
||||
UpdatableInset & inset = tabular.getCellInset(actcell);
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
if (the_locking_inset)
|
||||
updateLocal(bv);
|
||||
|
||||
void InsetTabular::edit(BufferView * bv, int x, int y)
|
||||
{
|
||||
lyxerr << "InsetTabular::edit: " << this << " first cell "
|
||||
<< &tabular.cell_info[0][0].inset << endl;
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr << "InsetTabular::Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
finishUndo();
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
|
||||
setPos(bv, x, y);
|
||||
clearSelection();
|
||||
finishUndo();
|
||||
if (insetHit(bv, x, y)) {
|
||||
inset_x = cursorx_ - top_x + tabular.getBeginningOfTextInCell(actcell);
|
||||
inset_y = cursory_;
|
||||
activateCellInset(bv, x - inset_x, y - inset_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -673,53 +709,6 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
|
||||
DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
if (cmd.action == LFUN_INSET_EDIT) {
|
||||
|
||||
lyxerr << "InsetTabular::edit: " << this << " args: '"
|
||||
<< cmd.argument << "' first cell: "
|
||||
<< &tabular.cell_info[0][0].inset << endl;
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr << "InsetTabular::Cannot lock inset" << endl;
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
finishUndo();
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
|
||||
if (cmd.argument.size()) {
|
||||
if (cmd.argument == "left") {
|
||||
if (isRightToLeft(bv))
|
||||
actcell = tabular.getLastCellInRow(0);
|
||||
else
|
||||
actcell = 0;
|
||||
} else {
|
||||
if (isRightToLeft(bv))
|
||||
actcell = tabular.getFirstCellInRow(tabular.rows()-1);
|
||||
else
|
||||
actcell = tabular.getNumberOfCells() - 1;
|
||||
}
|
||||
clearSelection();
|
||||
resetPos(bv);
|
||||
bv->fitCursor();
|
||||
}
|
||||
|
||||
else {
|
||||
setPos(bv, cmd.x, cmd.y);
|
||||
clearSelection();
|
||||
finishUndo();
|
||||
if (insetHit(bv, cmd.x, cmd.y) && cmd.button() != mouse_button::button3) {
|
||||
inset_x = cursorx_ - top_x + tabular.getBeginningOfTextInCell(actcell);
|
||||
inset_y = cursory_;
|
||||
activateCellInset(bv, cmd.x - inset_x, cmd.y - inset_y, cmd.button());
|
||||
}
|
||||
}
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
if (result.dispatched()) {
|
||||
resetPos(bv);
|
||||
return result;
|
||||
@ -1430,7 +1419,7 @@ DispatchResult InsetTabular::moveLeft(BufferView * bv, bool lock)
|
||||
if (!moved)
|
||||
return DispatchResult(false, FINISHED);
|
||||
// behind the inset
|
||||
if (lock && activateCellInset(bv, 0, 0, mouse_button::none, true))
|
||||
if (lock && activateCellInset(bv, 0, 0, true))
|
||||
return DispatchResult(true, true);
|
||||
resetPos(bv);
|
||||
return DispatchResult(true);
|
||||
@ -1501,7 +1490,7 @@ bool InsetTabular::moveNextCell(BufferView * bv, bool lock)
|
||||
if (lock) {
|
||||
bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
|
||||
isRightToLeftPar(bv->buffer()->params());
|
||||
activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
|
||||
activateCellInset(bv, 0, 0, !rtl);
|
||||
}
|
||||
resetPos(bv);
|
||||
return true;
|
||||
@ -1530,7 +1519,7 @@ bool InsetTabular::movePrevCell(BufferView * bv, bool lock)
|
||||
if (lock) {
|
||||
bool rtl = tabular.getCellInset(actcell).paragraphs.begin()->
|
||||
isRightToLeftPar(bv->buffer()->params());
|
||||
activateCellInset(bv, 0, 0, mouse_button::none, !rtl);
|
||||
activateCellInset(bv, 0, 0, !rtl);
|
||||
}
|
||||
resetPos(bv);
|
||||
return true;
|
||||
@ -1986,8 +1975,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::activateCellInset(BufferView * bv, int x, int y,
|
||||
mouse_button::state button, bool behind)
|
||||
bool InsetTabular::activateCellInset(BufferView * bv, int x, int y, bool behind)
|
||||
{
|
||||
UpdatableInset & inset = tabular.getCellInset(actcell);
|
||||
if (behind) {
|
||||
@ -1997,7 +1985,7 @@ bool InsetTabular::activateCellInset(BufferView * bv, int x, int y,
|
||||
}
|
||||
//inset_x = cursorx_ - top_x + tabular.getBeginningOfTextInCell(actcell);
|
||||
//inset_y = cursory_;
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, x, y, button));
|
||||
inset.edit(bv, x, y);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv);
|
||||
|
@ -193,14 +193,16 @@ public:
|
||||
|
||||
/// set the owning buffer
|
||||
void buffer(Buffer * buf);
|
||||
/// lock cell with given index
|
||||
void edit(BufferView * bv, bool);
|
||||
///
|
||||
void edit(BufferView * bv, int, int);
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
DispatchResult
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
/// lock cell with given index
|
||||
void edit(BufferView * bv, int index);
|
||||
///
|
||||
void lfunMousePress(FuncRequest const &);
|
||||
///
|
||||
@ -253,7 +255,6 @@ private:
|
||||
}
|
||||
///
|
||||
bool activateCellInset(BufferView *, int x = 0, int y = 0,
|
||||
mouse_button::state button = mouse_button::none,
|
||||
bool behind = false);
|
||||
///
|
||||
bool insetHit(BufferView * bv, int x, int y) const;
|
||||
|
@ -108,11 +108,8 @@ void InsetText::init()
|
||||
for (; pit != end; ++pit)
|
||||
pit->setInsetOwner(this);
|
||||
text_.paragraphs_ = ¶graphs;
|
||||
top_y = 0;
|
||||
|
||||
locked = false;
|
||||
inset_par = -1;
|
||||
inset_pos = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
no_selection = true;
|
||||
@ -267,13 +264,8 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
|
||||
x += scroll();
|
||||
|
||||
top_baseline = y;
|
||||
top_y = y - dim_.asc;
|
||||
|
||||
if (the_locking_inset
|
||||
&& text_.cursor.par() == inset_par && cpos() == inset_pos) {
|
||||
inset_x = cx() - x;
|
||||
inset_y = cy();
|
||||
}
|
||||
inset_x = cx() - x;
|
||||
inset_y = cy();
|
||||
|
||||
x += TEXT_TO_INSET_OFFSET;
|
||||
|
||||
@ -353,9 +345,8 @@ void InsetText::lockInset(BufferView * bv)
|
||||
{
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_pos = inset_x = inset_y = 0;
|
||||
inset_x = inset_y = 0;
|
||||
inset_boundary = false;
|
||||
inset_par = -1;
|
||||
old_par = -1;
|
||||
text_.setCursorIntern(0, 0);
|
||||
text_.clearSelection();
|
||||
@ -376,8 +367,6 @@ void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
|
||||
the_locking_inset = inset;
|
||||
inset_x = cx() - top_x;
|
||||
inset_y = cy();
|
||||
inset_pos = cpos();
|
||||
inset_par = text_.cursor.par();
|
||||
inset_boundary = cboundary();
|
||||
}
|
||||
|
||||
@ -418,13 +407,8 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
}
|
||||
|
||||
if (the_locking_inset && the_locking_inset == inset) {
|
||||
if (text_.cursor.par() == inset_par && cpos() == inset_pos) {
|
||||
lyxerr[Debug::INSETS] << "OK" << endl;
|
||||
inset_x = cx() - top_x;
|
||||
inset_y = cy();
|
||||
} else {
|
||||
lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl;
|
||||
}
|
||||
inset_x = cx() - top_x;
|
||||
inset_y = cy();
|
||||
} else if (the_locking_inset) {
|
||||
lyxerr[Debug::INSETS] << "MAYBE" << endl;
|
||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||
@ -547,7 +531,6 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||
no_selection = true;
|
||||
if (the_locking_inset) {
|
||||
DispatchResult const res = the_locking_inset->dispatch(cmd1);
|
||||
|
||||
return res.dispatched();
|
||||
}
|
||||
|
||||
@ -591,6 +574,87 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
void InsetText::edit(BufferView * bv, bool left)
|
||||
{
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
inset_boundary = false;
|
||||
old_par = -1;
|
||||
|
||||
if (left)
|
||||
text_.setCursorIntern(0, 0);
|
||||
else
|
||||
text_.setCursor(paragraphs.size() - 1, paragraphs.back().size());
|
||||
|
||||
// If the inset is empty set the language of the current font to the
|
||||
// language to the surronding text (if different).
|
||||
if (paragraphs.begin()->empty() &&
|
||||
paragraphs.size() == 1 &&
|
||||
bv->getParentLanguage(this) != text_.current_font.language())
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
|
||||
updateLocal(bv, false);
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
}
|
||||
|
||||
|
||||
void InsetText::edit(BufferView * bv, int x, int y)
|
||||
{
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
inset_boundary = false;
|
||||
old_par = -1;
|
||||
|
||||
int tmp_y = (y < 0) ? 0 : y;
|
||||
// we put here -1 and not button as now the button in the
|
||||
// edit call should not be needed we will fix this in 1.3.x
|
||||
// cycle hopefully (Jug 20020509)
|
||||
// FIXME: GUII I've changed this to none: probably WRONG
|
||||
if (!checkAndActivateInset(bv, x, tmp_y)) {
|
||||
text_.setCursorFromCoordinates(x, y + dim_.asc);
|
||||
text_.cursor.x(text_.cursor.x());
|
||||
bv->x_target(text_.cursor.x());
|
||||
}
|
||||
|
||||
text_.clearSelection();
|
||||
finishUndo();
|
||||
|
||||
// If the inset is empty set the language of the current font to the
|
||||
// language to the surronding text (if different).
|
||||
if (paragraphs.begin()->empty() &&
|
||||
paragraphs.size() == 1 &&
|
||||
bv->getParentLanguage(this) != text_.current_font.language())
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
|
||||
updateLocal(bv, false);
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
}
|
||||
|
||||
|
||||
DispatchResult
|
||||
InsetText::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
@ -599,62 +663,6 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
|
||||
setViewCache(bv);
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT: {
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_pos = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
inset_boundary = false;
|
||||
inset_par = -1;
|
||||
old_par = -1;
|
||||
|
||||
|
||||
if (cmd.argument.size()) {
|
||||
if (cmd.argument == "left")
|
||||
text_.setCursorIntern(0, 0);
|
||||
else
|
||||
text_.setCursor(paragraphs.size() - 1, paragraphs.back().size());
|
||||
} else {
|
||||
int tmp_y = (cmd.y < 0) ? 0 : cmd.y;
|
||||
// we put here -1 and not button as now the button in the
|
||||
// edit call should not be needed we will fix this in 1.3.x
|
||||
// cycle hopefully (Jug 20020509)
|
||||
// FIXME: GUII I've changed this to none: probably WRONG
|
||||
if (!checkAndActivateInset(bv, cmd.x, tmp_y, mouse_button::none)) {
|
||||
text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
|
||||
text_.cursor.x(text_.cursor.x());
|
||||
bv->x_target(text_.cursor.x());
|
||||
}
|
||||
}
|
||||
|
||||
text_.clearSelection();
|
||||
finishUndo();
|
||||
|
||||
// If the inset is empty set the language of the current font to the
|
||||
// language to the surronding text (if different).
|
||||
if (paragraphs.begin()->empty() &&
|
||||
paragraphs.size() == 1 &&
|
||||
bv->getParentLanguage(this) != text_.current_font.language())
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
|
||||
updateLocal(bv, false);
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
lfunMousePress(cmd);
|
||||
return DispatchResult(true, true);
|
||||
@ -1193,7 +1201,6 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (text_.selection.set())
|
||||
text_.recUndo(text_.cursor.par());
|
||||
|
||||
@ -1221,8 +1228,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
|
||||
InsetOld * inset = cpar()->getInset(cpos());
|
||||
if (!isHighlyEditableInset(inset))
|
||||
return false;
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, front ? "left" : "right");
|
||||
inset->dispatch(cmd);
|
||||
inset->edit(bv, front);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, false);
|
||||
@ -1230,30 +1236,22 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
|
||||
}
|
||||
|
||||
|
||||
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
||||
mouse_button::state button)
|
||||
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y)
|
||||
{
|
||||
int dummyx = x;
|
||||
int dummyy = y + dim_.asc;
|
||||
InsetOld * inset = getLyXText(bv)->checkInsetHit(dummyx, dummyy);
|
||||
// we only do the edit() call if the inset was hit by the mouse
|
||||
// or if it is a highly editable inset. So we should call this
|
||||
// function from our own edit with button < 0.
|
||||
// FIXME: GUII jbl. I've changed this to ::none for now which is probably
|
||||
// WRONG
|
||||
if (button == mouse_button::none && !isHighlyEditableInset(inset))
|
||||
return false;
|
||||
|
||||
if (!inset)
|
||||
return false;
|
||||
if (!isHighlyEditableInset(inset))
|
||||
return false;
|
||||
if (x < 0)
|
||||
x = dim_.wid;
|
||||
if (y < 0)
|
||||
y = dim_.des;
|
||||
inset_x = cx() - top_x;
|
||||
inset_y = cy();
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
|
||||
inset->dispatch(cmd);
|
||||
inset->edit(bv, x - inset_x, y - inset_y);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, false);
|
||||
|
@ -179,6 +179,11 @@ public:
|
||||
///
|
||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||
|
||||
///
|
||||
void edit(BufferView *, bool);
|
||||
///
|
||||
void edit(BufferView *, int, int);
|
||||
|
||||
///
|
||||
int numParagraphs() const { return 1; }
|
||||
///
|
||||
@ -221,14 +226,13 @@ private:
|
||||
///
|
||||
DispatchResult moveUp(BufferView *);
|
||||
///
|
||||
DispatchResult moveDown(BufferView *);
|
||||
DispatchResult moveDown(BufferView *);
|
||||
///
|
||||
void setCharFont(Buffer const &, int pos, LyXFont const & font);
|
||||
///
|
||||
bool checkAndActivateInset(BufferView * bv, bool front);
|
||||
///
|
||||
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
|
||||
mouse_button::state button = mouse_button::none);
|
||||
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0);
|
||||
///
|
||||
void removeNewlines();
|
||||
///
|
||||
@ -262,12 +266,6 @@ private:
|
||||
///
|
||||
mutable bool locked;
|
||||
///
|
||||
mutable int top_y;
|
||||
///
|
||||
lyx::paroffset_type inset_par;
|
||||
///
|
||||
lyx::pos_type inset_pos;
|
||||
///
|
||||
bool inset_boundary;
|
||||
///
|
||||
mutable int inset_x;
|
||||
|
@ -49,7 +49,7 @@ InsetUrl::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_PRESS:
|
||||
InsetCommandMailer("url", *this).showDialog(cmd.view());
|
||||
return DispatchResult(true, true);
|
||||
default:
|
||||
|
@ -16,11 +16,8 @@
|
||||
#include "PosIterator.h"
|
||||
#include "cursor.h"
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "dispatchresult.h"
|
||||
|
||||
|
||||
|
||||
#include "insets/inset.h"
|
||||
#include "insets/updatableinset.h"
|
||||
#include "insets/insettext.h"
|
||||
@ -183,22 +180,6 @@ int ParIterator::index() const
|
||||
}
|
||||
|
||||
|
||||
void ParIterator::asCursor(Cursor & cursor) const
|
||||
{
|
||||
cursor.data_.clear();
|
||||
for (size_t i = 1, n = size(); i < n; ++i) {
|
||||
ParPosition const & pos = pimpl_->positions[i - 1];
|
||||
CursorItem item;
|
||||
item.inset_ = (*pos.it)->inset;
|
||||
item.idx_ = (*pos.index);
|
||||
item.text_ = (*pos.it)->inset->getText(*pos.index);
|
||||
item.par_ = 0;
|
||||
item.pos_ = 0;
|
||||
cursor.data_.push_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Paragraph & ParIterator::operator*() const
|
||||
{
|
||||
return *pimpl_->positions.back().pit;
|
||||
@ -387,18 +368,18 @@ void ParIterator::lockPath(BufferView * bv) const
|
||||
bv->insetUnlock();
|
||||
int last = size() - 1;
|
||||
for (int i = 0; i < last; ++i) {
|
||||
UpdatableInset * outer = dynamic_cast<UpdatableInset *>((*pimpl_->positions[i].it)->inset);
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT);
|
||||
outer->dispatch(cmd);
|
||||
UpdatableInset * outer =
|
||||
dynamic_cast<UpdatableInset *>((*pimpl_->positions[i].it)->inset);
|
||||
outer->edit(bv, true);
|
||||
LyXText * txt = outer->getText(*pimpl_->positions[i].index);
|
||||
InsetText * inner = txt->inset_owner;
|
||||
// deep vodoo magic: on a table, the edit call locks the first
|
||||
// deep voodoo magic: on a table, the edit call locks the first
|
||||
// cell and further lock calls get lost there.
|
||||
// We have to unlock it to then lock the correct one.
|
||||
if (outer != inner) {
|
||||
outer->insetUnlock(bv);
|
||||
outer->lockInsetInInset(bv, inner);
|
||||
inner->dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
inner->edit(bv, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,6 @@ public:
|
||||
///
|
||||
size_t size() const;
|
||||
///
|
||||
void asCursor(Cursor & cursor) const;
|
||||
///
|
||||
friend
|
||||
bool operator==(ParIterator const & iter1, ParIterator const & iter2);
|
||||
///
|
||||
|
13
src/lfuns.h
13
src/lfuns.h
@ -293,41 +293,40 @@ enum kb_action {
|
||||
// 220
|
||||
LFUN_MOUSE_DOUBLE, // André 9 Aug 2002
|
||||
LFUN_MOUSE_TRIPLE, // André 9 Aug 2002
|
||||
LFUN_INSET_EDIT, // André 16 Aug 2002
|
||||
LFUN_INSET_WRAP, // Dekel 7 Apr 2002
|
||||
LFUN_TRACK_CHANGES, // Levon 20021001 (cool date !)
|
||||
// 225
|
||||
LFUN_MERGE_CHANGES, // Levon 20021016
|
||||
// 225
|
||||
LFUN_ACCEPT_CHANGE, // Levon 20021016
|
||||
LFUN_REJECT_CHANGE, // Levon 20021016
|
||||
LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016
|
||||
LFUN_REJECT_ALL_CHANGES, // Levon 20021016
|
||||
// 230
|
||||
LFUN_INSERT_BIBITEM, // André 14 Feb 2003
|
||||
// 230
|
||||
LFUN_DIALOG_SHOW,
|
||||
LFUN_DIALOG_SHOW_NEW_INSET,
|
||||
LFUN_DIALOG_SHOW_NEXT_INSET,
|
||||
LFUN_DIALOG_UPDATE,
|
||||
// 235
|
||||
LFUN_DIALOG_HIDE,
|
||||
// 235
|
||||
LFUN_DIALOG_DISCONNECT_INSET,
|
||||
LFUN_INSET_APPLY,
|
||||
LFUN_INSET_INSERT,
|
||||
LFUN_INSET_MODIFY,
|
||||
// 240
|
||||
LFUN_INSET_DIALOG_UPDATE,
|
||||
// 240
|
||||
LFUN_INSET_SETTINGS,
|
||||
LFUN_PARAGRAPH_APPLY,
|
||||
LFUN_PARAGRAPH_UPDATE,
|
||||
LFUN_EXTERNAL_EDIT,
|
||||
// 245
|
||||
LFUN_INSERT_BRANCH,
|
||||
// 245
|
||||
LFUN_INSET_DIALOG_SHOW,
|
||||
LFUN_INSERT_BOX,
|
||||
LFUN_INSERT_LINE,
|
||||
LFUN_INSERT_PAGEBREAK,
|
||||
// 250
|
||||
LFUN_REPEAT,
|
||||
// 250
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -882,11 +882,9 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
view()->hideCursor();
|
||||
|
||||
#if 1
|
||||
{
|
||||
Cursor cursor;
|
||||
buildCursor(cursor, *view());
|
||||
if (0) {
|
||||
DispatchResult result =
|
||||
cursor.dispatch(FuncRequest(func, view()));
|
||||
view()->cursor().dispatch(FuncRequest(func, view()));
|
||||
|
||||
if (result.dispatched()) {
|
||||
if (result.update()) {
|
||||
@ -1411,8 +1409,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
|
||||
LyXText * lt = view()->getLyXText();
|
||||
if (par->inInset()) {
|
||||
FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
|
||||
par.inset()->dispatch(cmd);
|
||||
par.inset()->edit(view(), true);
|
||||
lt = par->inInset()->getLyXText(view());
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
|
||||
delete new_inset;
|
||||
return false;
|
||||
}
|
||||
new_inset->dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
new_inset->edit(bv, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,6 +317,34 @@ DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::edit(BufferView * bv, bool left)
|
||||
{
|
||||
lyxerr << "Called FormulaBase::edit" << endl;
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "Cannot lock math inset in edit call!" << endl;
|
||||
releaseMathCursor(bv);
|
||||
mathcursor = new MathCursor(this, left);
|
||||
// if that is removed, we won't get the magenta box when entering an
|
||||
// inset for the first time
|
||||
bv->updateInset(this);
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::edit(BufferView * bv, int x, int y)
|
||||
{
|
||||
lyxerr << "Called FormulaBase::EDIT with '" << x << ' ' << y << "'" << endl;
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "Cannot lock math inset in edit call!" << endl;
|
||||
releaseMathCursor(bv);
|
||||
mathcursor = new MathCursor(this, true);
|
||||
//metrics(bv);
|
||||
mathcursor->setPos(x + xo_, y + yo_);
|
||||
// if that is removed, we won't get the magenta box when entering an
|
||||
// inset for the first time
|
||||
bv->updateInset(this);
|
||||
}
|
||||
|
||||
|
||||
DispatchResult
|
||||
InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type &, pos_type &)
|
||||
@ -333,24 +361,6 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
|
||||
bool remove_inset = false;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
lyxerr << "Called EDIT with '" << cmd.argument << "'" << endl;
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "Cannot lock math inset in edit call!" << endl;
|
||||
releaseMathCursor(bv);
|
||||
if (!cmd.argument.empty()) {
|
||||
mathcursor = new MathCursor(this, cmd.argument == "left");
|
||||
//metrics(bv);
|
||||
} else {
|
||||
mathcursor = new MathCursor(this, true);
|
||||
//metrics(bv);
|
||||
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||
}
|
||||
// if that is removed, we won't get the magenta box when entering an
|
||||
// inset for the first time
|
||||
bv->updateInset(this);
|
||||
return DispatchResult(true, true);
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
//lyxerr << "Mouse single press" << endl;
|
||||
return lfunMousePress(cmd);
|
||||
|
@ -81,6 +81,10 @@ public:
|
||||
bool display() const;
|
||||
// return the selection as std::string
|
||||
std::string selectionAsString() const;
|
||||
///
|
||||
void edit(BufferView * bv, bool);
|
||||
///
|
||||
void edit(BufferView * bv, int, int);
|
||||
protected:
|
||||
/// To allow transparent use of math editing functions
|
||||
virtual
|
||||
|
@ -2560,7 +2560,7 @@ int LyXTabular::getCellFromInset(InsetOld const * inset) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int cell = getNumberOfCells(); cell >= 0; --cell)
|
||||
for (int cell = 0, n = getNumberOfCells(); cell < n; ++cell)
|
||||
if (&getCellInset(cell) == inset) {
|
||||
lyxerr[Debug::INSETTEXT] << "LyXTabular::getCellFromInset: "
|
||||
<< "cell=" << cell << endl;
|
||||
@ -2568,7 +2568,8 @@ int LyXTabular::getCellFromInset(InsetOld const * inset) const
|
||||
}
|
||||
|
||||
// We should have found a cell at this point
|
||||
lyxerr << "LyXTabular::getCellFromInset: Cell not found!" << endl;
|
||||
lyxerr << "LyXTabular::getCellFromInset: Cell of inset "
|
||||
<< inset << " not found!" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "BufferView.h"
|
||||
#include "Bullet.h"
|
||||
#include "counters.h"
|
||||
#include "cursor.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "debug.h"
|
||||
#include "dispatchresult.h"
|
||||
@ -1629,8 +1630,8 @@ void LyXText::cursorUp(bool selecting)
|
||||
y -= topy;
|
||||
InsetOld * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
inset_hit->dispatch(
|
||||
FuncRequest(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none));
|
||||
inset_hit->edit(bv(), x, y - (y2 - y1));
|
||||
bv()->cursor().push(inset_hit, inset_hit->getText(0));
|
||||
}
|
||||
}
|
||||
#else
|
||||
@ -1657,8 +1658,8 @@ void LyXText::cursorDown(bool selecting)
|
||||
y -= topy;
|
||||
InsetOld * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none);
|
||||
inset_hit->dispatch(cmd);
|
||||
bv()->cursor().push(inset_hit, inset_hit->getText(0));
|
||||
inset_hit->edit(bv(), x, y - (y2 - y1));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
13
src/text3.C
13
src/text3.C
@ -20,6 +20,7 @@
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "BufferView.h"
|
||||
#include "cursor.h"
|
||||
#include "debug.h"
|
||||
#include "dispatchresult.h"
|
||||
#include "factory.h"
|
||||
@ -376,8 +377,8 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
|
||||
}
|
||||
if (bv->insertInset(inset)) {
|
||||
if (edit) {
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
|
||||
inset->dispatch(cmd);
|
||||
inset->edit(bv, true);
|
||||
bv->cursor().push(inset, inset->getText(0));
|
||||
}
|
||||
if (gotsel && pastesel)
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
|
||||
@ -594,8 +595,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
||||
&& isHighlyEditableInset(cursorPar()->getInset(cursor.pos()))) {
|
||||
InsetOld * tmpinset = cursorPar()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
|
||||
tmpinset->dispatch(cmd1);
|
||||
tmpinset->edit(bv, !is_rtl);
|
||||
bv->cursor().push(tmpinset, tmpinset->getText(0));
|
||||
break;
|
||||
}
|
||||
if (!is_rtl)
|
||||
@ -619,8 +620,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
||||
isHighlyEditableInset(cursorPar()->getInset(cursor.pos()))) {
|
||||
InsetOld * tmpinset = cursorPar()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
|
||||
tmpinset->dispatch(cmd1);
|
||||
tmpinset->edit(bv, is_rtl);
|
||||
bv->cursor().push(tmpinset, tmpinset->getText(0));
|
||||
break;
|
||||
}
|
||||
if (is_rtl)
|
||||
|
Loading…
Reference in New Issue
Block a user