mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
edit->LFUN_INSET_EDIT + CHangeLog + working URL insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6969 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
08455f2408
commit
14580a289e
@ -649,7 +649,8 @@ bool BufferView::lockInset(UpdatableInset * inset)
|
||||
}
|
||||
if (it.getInset()->getInsetFromID(id)) {
|
||||
text->setCursorIntern(pit, it.getPos());
|
||||
it.getInset()->edit(this);
|
||||
FuncRequest cmd(this, LFUN_INSET_EDIT, "left");
|
||||
it.getInset()->localDispatch(cmd);
|
||||
return theLockingInset()->lockInsetInInset(this, inset);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,13 @@
|
||||
|
||||
2003-05-16 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* BufferView.C:
|
||||
* lyxfunc.C:
|
||||
* text.C:
|
||||
* text2.C:
|
||||
* text3.C:
|
||||
* undo_funcs.C: edit() -> LFUN_INSET_EDIT
|
||||
|
||||
2003-05-14 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyx_main.C (init): remove spurious static_cast
|
||||
|
@ -1,4 +1,31 @@
|
||||
|
||||
|
||||
2003-05-16 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* inset.[Ch]:
|
||||
* insetbibitem.[Ch]:
|
||||
* insetbibtex.[Ch]:
|
||||
* insetbutton.[Ch]:
|
||||
* insetcite.[Ch]:
|
||||
* insetcollapsable.[Ch]:
|
||||
* insetcommand.[Ch]:
|
||||
* inseterror.[Ch]:
|
||||
* insetert.[Ch]:
|
||||
* insetexternal.[Ch]:
|
||||
* insetfloatlist.[Ch]:
|
||||
* insetgraphics.[Ch]:
|
||||
* insetinclude.[Ch]:
|
||||
* insetindex.[Ch]:
|
||||
* insetlabel.[Ch]:
|
||||
* insetlatexaccent.[Ch]:
|
||||
* insetparent.[Ch]:
|
||||
* insetref.[Ch]:
|
||||
* insettabular.[Ch]:
|
||||
* insettext.[Ch]:
|
||||
* insettoc.[Ch]:
|
||||
* inseturl.[Ch]:
|
||||
* updatableinset.[Ch]: edit() -> LFUN_INSET_EDIT
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetbibitem.C:
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
using std::endl;
|
||||
|
||||
// Insets default methods
|
||||
|
||||
// Initialization of the counter for the inset id's,
|
||||
unsigned int Inset::inset_id = 0;
|
||||
@ -66,10 +65,6 @@ Inset::EDITABLE Inset::editable() const
|
||||
}
|
||||
|
||||
|
||||
void Inset::edit(BufferView *, int, int, mouse_button::state)
|
||||
{}
|
||||
|
||||
|
||||
void Inset::validate(LaTeXFeatures &) const
|
||||
{}
|
||||
|
||||
@ -80,10 +75,6 @@ bool Inset::autoDelete() const
|
||||
}
|
||||
|
||||
|
||||
void Inset::edit(BufferView *, bool)
|
||||
{}
|
||||
|
||||
|
||||
#if 0
|
||||
LyXFont const Inset::convertFont(LyXFont const & font) const
|
||||
{
|
||||
@ -143,10 +134,10 @@ void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
|
||||
{}
|
||||
|
||||
|
||||
bool Inset::forceDefaultParagraphs(Inset const * in) const
|
||||
bool Inset::forceDefaultParagraphs(Inset const * inset) const
|
||||
{
|
||||
if (owner())
|
||||
return owner()->forceDefaultParagraphs(in);
|
||||
return owner()->forceDefaultParagraphs(inset);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -15,14 +15,14 @@
|
||||
#ifndef INSET_H
|
||||
#define INSET_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "LString.h"
|
||||
#include "LColor.h"
|
||||
#include "insetbase.h"
|
||||
#include "frontends/mouse_state.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class LyXFont;
|
||||
class Buffer;
|
||||
class Painter;
|
||||
@ -170,10 +170,6 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual string const editMessage() const;
|
||||
///
|
||||
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
virtual void edit(BufferView *, bool front = true);
|
||||
///
|
||||
virtual EDITABLE editable() const;
|
||||
///
|
||||
virtual bool isTextInset() const { return false; }
|
||||
|
@ -27,6 +27,7 @@ using std::max;
|
||||
int InsetBibitem::key_counter = 0;
|
||||
const string key_prefix = "key-";
|
||||
|
||||
|
||||
InsetBibitem::InsetBibitem(InsetCommandParams const & p)
|
||||
: InsetCommand(p), counter(1)
|
||||
{
|
||||
@ -52,14 +53,17 @@ Inset * InsetBibitem::clone(Buffer const &, bool) const
|
||||
|
||||
dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
break;
|
||||
return DISPATCHED;
|
||||
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
@ -75,15 +79,12 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||
#warning and whether the repaint() is needed at all
|
||||
cmd.view()->repaint();
|
||||
cmd.view()->fitCursor();
|
||||
|
||||
result = DISPATCHED;
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
result = InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -135,19 +136,6 @@ string const InsetBibitem::getScreenLabel(Buffer const *) const
|
||||
}
|
||||
|
||||
|
||||
void InsetBibitem::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetCommandMailer mailer("bibitem", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetBibitem::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
|
||||
int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
{
|
||||
|
@ -41,10 +41,6 @@ public:
|
||||
///
|
||||
virtual string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BIBITEM_CODE; }
|
||||
@ -53,7 +49,7 @@ public:
|
||||
///
|
||||
void setCounter(int);
|
||||
///
|
||||
int getCounter() const { return counter; }
|
||||
int getCounter() const { return counter; }
|
||||
///
|
||||
string const getBibLabel() const;
|
||||
///
|
||||
|
@ -48,14 +48,17 @@ InsetBibtex::~InsetBibtex()
|
||||
|
||||
dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
break;
|
||||
return DISPATCHED;
|
||||
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
@ -64,14 +67,13 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = InsetCommand::localDispatch(cmd);
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
string const InsetBibtex::getScreenLabel(Buffer const *) const
|
||||
@ -218,19 +220,6 @@ void InsetBibtex::fillWithBibKeys
|
||||
}
|
||||
|
||||
|
||||
void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetCommandMailer mailer("bibtex", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetBibtex::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
bool InsetBibtex::addDatabase(string const & db)
|
||||
{
|
||||
string contents(getContents());
|
||||
|
@ -39,10 +39,6 @@ public:
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
|
||||
///
|
||||
void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool freespace) const;
|
||||
///
|
||||
|
@ -132,7 +132,5 @@ BufferView * InsetButton::view() const
|
||||
|
||||
dispatch_result InsetButton::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
FuncRequest cmd1(cmd);
|
||||
edit(cmd1.view(), cmd1.x, cmd1.y, cmd1.button());
|
||||
return DISPATCHED;
|
||||
return Inset::localDispatch(cmd);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "insetcite.h"
|
||||
#include "funcrequest.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
@ -317,20 +318,20 @@ void InsetCitation::setLoadingBuffer(Buffer const * buffer, bool state) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
// A call to edit() indicates that we're no longer loading the
|
||||
// buffer but doing some real work.
|
||||
setLoadingBuffer(bv->buffer(), false);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
// A call to edit indicates that we're no longer loading the
|
||||
// buffer but doing some real work.
|
||||
setLoadingBuffer(cmd.view()->buffer(), false);
|
||||
InsetCommandMailer("citation", *this).showDialog(cmd.view());
|
||||
break;
|
||||
|
||||
InsetCommandMailer mailer("citation", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,14 +35,12 @@ public:
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::CITE_CODE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
/** Invoked by BufferView::Pimpl::dispatch when a new citation key
|
||||
is inserted. Tells us that the buffer is no longer being loaded
|
||||
|
@ -38,9 +38,6 @@ using std::endl;
|
||||
using std::max;
|
||||
|
||||
|
||||
class LyXText;
|
||||
|
||||
|
||||
InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
|
||||
: UpdatableInset(), collapsed_(collapsed), inset(bp),
|
||||
button_length(0), button_top_y(0), button_bottom_y(0),
|
||||
@ -232,65 +229,6 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||
mouse_button::state button)
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
|
||||
#endif
|
||||
if (button == mouse_button::button3)
|
||||
return;
|
||||
|
||||
UpdatableInset::edit(bv, xp, yp, button);
|
||||
|
||||
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);
|
||||
} else {
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
if (yp <= button_bottom_y) {
|
||||
inset.edit(bv, xp, 0, button);
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + yp -
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.edit(bv, xp, yy, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::edit(BufferView * bv, bool front)
|
||||
{
|
||||
UpdatableInset::edit(bv, front);
|
||||
|
||||
if (collapsed_) {
|
||||
collapsed_ = false;
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
inset.setUpdateStatus(bv, InsetText::FULL);
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.edit(bv, front);
|
||||
first_after_edit = true;
|
||||
} else {
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
inset.edit(bv, front);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Inset::EDITABLE InsetCollapsable::editable() const
|
||||
{
|
||||
if (collapsed_)
|
||||
@ -425,7 +363,62 @@ void InsetCollapsable::update(BufferView * bv, bool reinit)
|
||||
|
||||
Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
BufferView * bv = cmd.view();
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT: {
|
||||
if (!cmd.argument.empty()) {
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
if (collapsed_) {
|
||||
collapsed_ = false;
|
||||
if (bv->lockInset(this)) {
|
||||
inset.setUpdateStatus(bv, InsetText::FULL);
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.localDispatch(cmd);
|
||||
first_after_edit = true;
|
||||
}
|
||||
} else {
|
||||
if (bv->lockInset(this))
|
||||
inset.localDispatch(cmd);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
|
||||
#endif
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
return DISPATCHED;
|
||||
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
|
||||
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 DISPATCHED;
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.localDispatch(cmd);
|
||||
} else {
|
||||
FuncRequest cmd1 = cmd;
|
||||
if (!bv->lockInset(this))
|
||||
return DISPATCHED;
|
||||
if (cmd.y <= button_bottom_y) {
|
||||
cmd1.y = 0;
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
cmd1.y = ascent(bv, font) + cmd.y -
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
}
|
||||
inset.localDispatch(cmd);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
lfunMousePress(cmd);
|
||||
@ -442,11 +435,10 @@ Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
default:
|
||||
UpdatableInset::RESULT result = inset.localDispatch(cmd);
|
||||
if (result >= FINISHED)
|
||||
cmd.view()->unlockInset(this);
|
||||
bv->unlockInset(this);
|
||||
first_after_edit = false;
|
||||
return result;
|
||||
}
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#ifndef INSETCOLLAPSABLE_H
|
||||
#define INSETCOLLAPSABLE_H
|
||||
|
||||
|
||||
#include "inset.h"
|
||||
#include "insettext.h"
|
||||
#include "lyxfont.h"
|
||||
@ -58,10 +57,6 @@ public:
|
||||
///
|
||||
void update(BufferView *, bool =false);
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView *, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
///
|
||||
bool insertInset(BufferView *, Inset * inset);
|
||||
|
@ -67,38 +67,30 @@ int InsetCommand::docbook(Buffer const *, ostream &, bool) const
|
||||
|
||||
dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
|
||||
lyxerr << "insetCommand::localDispatch\n";
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
break;
|
||||
return UNDISPATCHED;
|
||||
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this);
|
||||
result = DISPATCHED;
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetCommandMailer mailer(cmd.argument, *this);
|
||||
mailer.updateDialog(cmd.view());
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetCommandMailer(cmd.argument, *this).updateDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
edit(cmd.view(), cmd.x, cmd.y, cmd.button());
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
return localDispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
|
||||
|
||||
default:
|
||||
break;
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
using std::ostream;
|
||||
|
||||
/* Error, used for the LaTeX-Error Messages */
|
||||
|
||||
InsetError::InsetError(string const & str, bool)
|
||||
: contents(str)
|
||||
@ -45,14 +44,13 @@ dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
edit(cmd.view(), cmd.x, cmd.y, cmd.button());
|
||||
break;
|
||||
case LFUN_INSET_EDIT:
|
||||
cmd.view()->owner()->getDialogs().show("error", getContents(), this);
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
break;
|
||||
return Inset::localDispatch(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -111,15 +109,3 @@ string const InsetError::editMessage() const
|
||||
{
|
||||
return _("Opened error");
|
||||
}
|
||||
|
||||
|
||||
void InsetError::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
bv->owner()->getDialogs().show("error", getContents(), this);
|
||||
}
|
||||
|
||||
|
||||
void InsetError::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#ifndef INSET_ERROR_H
|
||||
#define INSET_ERROR_H
|
||||
|
||||
|
||||
#include "inset.h"
|
||||
#include "LString.h"
|
||||
|
||||
@ -55,10 +54,6 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
string const editMessage() const;
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset * clone(Buffer const &, bool same_id = false) const {
|
||||
|
@ -266,22 +266,6 @@ void InsetERT::updateStatus(BufferView * bv, bool swap) const
|
||||
}
|
||||
}
|
||||
|
||||
void InsetERT::edit(BufferView * bv, int x, int y, mouse_button::state button)
|
||||
{
|
||||
if (button == mouse_button::button3)
|
||||
return;
|
||||
|
||||
if (status_ == Inlined) {
|
||||
if (!bv->lockInset(this))
|
||||
return;
|
||||
inset.edit(bv, x, y, button);
|
||||
} else {
|
||||
InsetCollapsable::edit(bv, x, y, button);
|
||||
}
|
||||
set_latex_font(bv);
|
||||
updateStatus(bv);
|
||||
}
|
||||
|
||||
|
||||
Inset::EDITABLE InsetERT::editable() const
|
||||
{
|
||||
@ -291,14 +275,6 @@ Inset::EDITABLE InsetERT::editable() const
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::edit(BufferView * bv, bool front)
|
||||
{
|
||||
InsetCollapsable::edit(bv, front);
|
||||
updateStatus(0);
|
||||
set_latex_font(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::lfunMousePress(FuncRequest const & cmd)
|
||||
{
|
||||
if (status_ == Inlined)
|
||||
@ -449,6 +425,21 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
break;
|
||||
if (status_ == Inlined) {
|
||||
if (!bv->lockInset(this))
|
||||
break;
|
||||
result = inset.localDispatch(cmd);
|
||||
} else {
|
||||
result = InsetCollapsable::localDispatch(cmd);
|
||||
}
|
||||
set_latex_font(bv);
|
||||
updateStatus(bv);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetERT::ERTStatus status_;
|
||||
InsetERTMailer::string2params(cmd.argument, status_);
|
||||
|
@ -62,10 +62,6 @@ public:
|
||||
void setFont(BufferView *, LyXFont const &,
|
||||
bool toggleall = false, bool selectall = false);
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &, bool fragile,
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <cstdio>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
@ -64,37 +63,30 @@ InsetExternal::Params const & InsetExternal::params() const
|
||||
|
||||
dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetExternal::Params p;
|
||||
InsetExternalMailer::string2params(cmd.argument, p);
|
||||
if (p.filename.empty())
|
||||
break;
|
||||
|
||||
setFromParams(p);
|
||||
cmd.view()->updateInset(this);
|
||||
result = DISPATCHED;
|
||||
if (!p.filename.empty()) {
|
||||
setFromParams(p);
|
||||
cmd.view()->updateInset(this);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetExternalMailer mailer(*this);
|
||||
mailer.updateDialog(cmd.view());
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetExternalMailer(*this).updateDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
edit(cmd.view(), cmd.x, cmd.y, cmd.button());
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetExternalMailer(*this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
break;
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -112,19 +104,6 @@ string const InsetExternal::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
void InsetExternal::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetExternalMailer mailer(*this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetExternal::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
void InsetExternal::write(Buffer const *, ostream & os) const
|
||||
{
|
||||
os << "External " << params_.templ.lyxName << ",\""
|
||||
|
@ -12,7 +12,6 @@
|
||||
#ifndef INSET_EXTERNAL_H
|
||||
#define INSET_EXTERNAL_H
|
||||
|
||||
|
||||
#include "insetbutton.h"
|
||||
#include "ExternalTemplate.h"
|
||||
#include "LString.h"
|
||||
@ -42,10 +41,6 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual string const editMessage() const;
|
||||
///
|
||||
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
virtual void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
virtual EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
virtual void write(Buffer const *, std::ostream &) const;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyxlex.h"
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "buffer.h"
|
||||
#include "toc.h"
|
||||
#include "gettext.h"
|
||||
@ -23,9 +24,6 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
@ -97,16 +95,15 @@ void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
void InsetFloatList::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
InsetCommandMailer mailer("toc", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetFloatList::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("toc", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,12 +30,10 @@ public:
|
||||
return new InsetFloatList(getCmdName());
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
void edit(BufferView * bv, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
bool display() const { return true; }
|
||||
|
@ -68,6 +68,7 @@ TODO
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lsstream.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
#include "Lsstream.h"
|
||||
@ -218,38 +219,30 @@ InsetGraphics::~InsetGraphics()
|
||||
|
||||
dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetGraphicsParams p;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, p);
|
||||
if (p.filename.empty())
|
||||
break;
|
||||
|
||||
string const filepath = cmd.view()->buffer()->filePath();
|
||||
setParams(p, filepath);
|
||||
cmd.view()->updateInset(this);
|
||||
result = DISPATCHED;
|
||||
if (!p.filename.empty()) {
|
||||
string const filepath = cmd.view()->buffer()->filePath();
|
||||
setParams(p, filepath);
|
||||
cmd.view()->updateInset(this);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetGraphicsMailer mailer(*this);
|
||||
mailer.updateDialog(cmd.view());
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetGraphicsMailer(*this).updateDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
edit(cmd.view(), cmd.x, cmd.y, cmd.button());
|
||||
break;
|
||||
InsetGraphicsMailer(*this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
return Inset::localDispatch(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -420,19 +413,6 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetGraphicsMailer mailer(*this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
Inset::EDITABLE InsetGraphics::editable() const
|
||||
{
|
||||
return IS_EDITABLE;
|
||||
|
@ -13,8 +13,6 @@
|
||||
#ifndef INSET_GRAPHICS_H
|
||||
#define INSET_GRAPHICS_H
|
||||
|
||||
|
||||
|
||||
#include "insets/inset.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
|
||||
@ -45,10 +43,6 @@ public:
|
||||
///
|
||||
void draw(BufferView *, LyXFont const &, int, float &) const;
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
///
|
||||
void write(Buffer const *, std::ostream &) const;
|
||||
|
@ -112,38 +112,31 @@ InsetInclude::~InsetInclude()
|
||||
|
||||
dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetInclude::Params p;
|
||||
InsetIncludeMailer::string2params(cmd.argument, p);
|
||||
if (p.cparams.getCmdName().empty())
|
||||
break;
|
||||
|
||||
set(p);
|
||||
params_.masterFilename_ = cmd.view()->buffer()->fileName();
|
||||
|
||||
cmd.view()->updateInset(this);
|
||||
result = DISPATCHED;
|
||||
if (!p.cparams.getCmdName().empty()) {
|
||||
set(p);
|
||||
params_.masterFilename_ = cmd.view()->buffer()->fileName();
|
||||
cmd.view()->updateInset(this);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetIncludeMailer mailer(*this);
|
||||
mailer.updateDialog(cmd.view());
|
||||
}
|
||||
break;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetIncludeMailer(*this).updateDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
edit(cmd.view(), cmd.x, cmd.y, cmd.button());
|
||||
break;
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetIncludeMailer(*this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
break;
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -155,11 +148,8 @@ InsetInclude::Params const & InsetInclude::params() const
|
||||
|
||||
bool InsetInclude::Params::operator==(Params const & o) const
|
||||
{
|
||||
if (cparams == o.cparams && flag == o.flag &&
|
||||
masterFilename_ == o.masterFilename_)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return cparams == o.cparams && flag == o.flag &&
|
||||
masterFilename_ == o.masterFilename_;
|
||||
}
|
||||
|
||||
|
||||
@ -209,19 +199,6 @@ Inset * InsetInclude::clone(Buffer const & buffer, bool) const
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetIncludeMailer mailer(*this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::write(Buffer const *, ostream & os) const
|
||||
{
|
||||
os << "Include " << params_.cparams.getCommand() << '\n'
|
||||
|
@ -12,7 +12,6 @@
|
||||
#ifndef INSET_INCLUDE_H
|
||||
#define INSET_INCLUDE_H
|
||||
|
||||
|
||||
#include "insetcommand.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
@ -83,10 +82,6 @@ public:
|
||||
/// This returns the list of bibkeys on the child buffer
|
||||
void fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const;
|
||||
///
|
||||
void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const
|
||||
{
|
||||
return IS_EDITABLE;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "insetindex.h"
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
@ -38,16 +39,16 @@ string const InsetIndex::getScreenLabel(Buffer const *) const
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
InsetCommandMailer mailer("index", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("index", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
|
||||
void InsetIndex::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,11 +66,16 @@ Inset::Code InsetIndex::lyxCode() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
|
||||
InsetPrintIndex::~InsetPrintIndex()
|
||||
{}
|
||||
|
||||
|
||||
string const InsetPrintIndex::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
return _("Index");
|
||||
|
@ -30,14 +30,12 @@ public:
|
||||
return new InsetIndex(params(), same_id);
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
///
|
||||
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
|
||||
@ -49,16 +47,16 @@ public:
|
||||
///
|
||||
InsetPrintIndex(InsetCommandParams const &, bool same_id = false);
|
||||
///
|
||||
virtual Inset * clone(Buffer const &, bool same_id = false) const {
|
||||
~InsetPrintIndex();
|
||||
///
|
||||
Inset * clone(Buffer const &, bool same_id = false) const {
|
||||
return new InsetPrintIndex(params(), same_id);
|
||||
}
|
||||
///
|
||||
//dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state) {}
|
||||
///
|
||||
void edit(BufferView *, bool = true) {}
|
||||
///
|
||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
||||
///
|
||||
bool display() const { return true; }
|
||||
|
@ -45,18 +45,17 @@ vector<string> const InsetLabel::getLabelList() const
|
||||
}
|
||||
|
||||
|
||||
void InsetLabel::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
InsetCommandMailer mailer("label", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("label", *this).showDialog(cmd.view());
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
@ -83,12 +82,6 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
void InsetLabel::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::latex(Buffer const *, ostream & os,
|
||||
bool /*fragile*/, bool /*fs*/) const
|
||||
{
|
||||
|
@ -34,10 +34,6 @@ public:
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::LABEL_CODE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "insetlatexaccent.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "support/lstrings.h"
|
||||
@ -24,6 +24,7 @@
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
|
||||
/* LatexAccent. Proper handling of accented characters */
|
||||
/* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
|
||||
/* Later modified by Lars G. Bjønnes, larsbj@lyx.org */
|
||||
@ -95,7 +96,9 @@ void InsetLatexAccent::checkContents()
|
||||
|
||||
lyxerr[Debug::KEY] << "Decode: " << contents << endl;
|
||||
|
||||
remdot = false; plusasc = false; plusdesc = false;
|
||||
remdot = false;
|
||||
plusasc = false;
|
||||
plusdesc = false;
|
||||
|
||||
switch (contents[1]) { // second char should be one of these
|
||||
case '\'': // acute
|
||||
|
@ -13,10 +13,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
|
||||
#include "insetparent.h"
|
||||
#include "support/filetools.h"
|
||||
#include "BufferView.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "support/LOstream.h"
|
||||
@ -24,7 +21,8 @@
|
||||
#include "buffer.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/BoostFormat.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
using std::ostream;
|
||||
|
||||
@ -39,24 +37,19 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
|
||||
|
||||
string const InsetParent::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
#if USE_BOOST_FORMAT
|
||||
return STRCONV(boost::io::str(boost::format(_("Parent: %s"))
|
||||
% STRCONV(getContents())));
|
||||
#else
|
||||
return _("Parent: ") + getContents();
|
||||
#endif
|
||||
return bformat(_("Parent: %1$s"), getContents());
|
||||
}
|
||||
|
||||
|
||||
void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetParent::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
|
||||
}
|
||||
|
||||
|
||||
void InsetParent::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
cmd.view()->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,19 +31,17 @@ public:
|
||||
return new InsetParent(params(), buffer, same_id);
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::PARENT_CODE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
///
|
||||
void setParent(string fn) { setContents(fn); }
|
||||
void setParent(string const & fn) { setContents(fn); }
|
||||
};
|
||||
#endif
|
||||
|
@ -30,27 +30,28 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
|
||||
|
||||
InsetRef::~InsetRef()
|
||||
{
|
||||
InsetCommandMailer mailer("ref", *this);
|
||||
mailer.hideDialog();
|
||||
InsetCommandMailer("ref", *this).hideDialog();
|
||||
}
|
||||
|
||||
|
||||
void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
|
||||
dispatch_result InsetRef::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
// FuncRequestually trigger dialog with button 3 not 1
|
||||
if (button == mouse_button::button3)
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
||||
else if (button == mouse_button::button1) {
|
||||
InsetCommandMailer mailer("ref", *this);
|
||||
mailer.showDialog(bv);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
// Eventually trigger dialog with button 3 not 1
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
cmd.view()->owner()->
|
||||
dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
||||
if (cmd.button() == mouse_button::button1)
|
||||
InsetCommandMailer("ref", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetRef::edit(BufferView *, bool)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetRef::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
string temp;
|
||||
|
@ -44,16 +44,14 @@ public:
|
||||
return new InsetRef(params(), buffer, same_id);
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::REF_CODE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
bool display() const { return false; }
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
|
@ -441,57 +441,6 @@ string const InsetTabular::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::edit(BufferView * bv, int x, int y, mouse_button::state button)
|
||||
{
|
||||
UpdatableInset::edit(bv, x, y, button);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
setPos(bv, x, y);
|
||||
clearSelection();
|
||||
finishUndo();
|
||||
if (insetHit(bv, x, y) && (button != mouse_button::button3)) {
|
||||
activateCellInsetAbs(bv, x, y, button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::edit(BufferView * bv, bool front)
|
||||
{
|
||||
UpdatableInset::edit(bv, front);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
finishUndo();
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_x = 0;
|
||||
inset_y = 0;
|
||||
if (front) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::insetUnlock(BufferView * bv)
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
@ -556,7 +505,7 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
}
|
||||
if (in->getInsetFromID(id)) {
|
||||
actcell = i;
|
||||
in->edit(bv);
|
||||
in->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||
}
|
||||
}
|
||||
@ -777,8 +726,49 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
// the_locking_inset->localDispatch might unlock it.
|
||||
old_locking_inset = the_locking_inset;
|
||||
RESULT result = UpdatableInset::localDispatch(cmd);
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
if (cmd.action == LFUN_INSET_EDIT) {
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
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) {
|
||||
activateCellInsetAbs(bv, cmd.x, cmd.y, cmd.button());
|
||||
}
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
||||
resetPos(bv);
|
||||
return result;
|
||||
@ -2082,7 +2072,7 @@ bool InsetTabular::activateCellInset(BufferView * bv, int x, int y, mouse_button
|
||||
}
|
||||
//inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
|
||||
//inset_y = cursor.y();
|
||||
inset->edit(bv, x, y, button);
|
||||
inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, x, y, button));
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, CELL);
|
||||
@ -2574,7 +2564,7 @@ InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
|
||||
inset->edit(bv, 0, 0, mouse_button::none);
|
||||
inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
WordLangTuple word(selectNextWordInt(bv, value));
|
||||
nodraw(false);
|
||||
if (!word.word().empty())
|
||||
@ -2600,7 +2590,7 @@ WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) co
|
||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
|
||||
inset->edit(bv);
|
||||
inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
return selectNextWordInt(bv, value);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#ifndef INSETTABULAR_H
|
||||
#define INSETTABULAR_H
|
||||
|
||||
|
||||
#include "inset.h"
|
||||
#include "tabular.h"
|
||||
#include "LString.h"
|
||||
@ -97,10 +96,6 @@ public:
|
||||
void update(BufferView *, bool = false);
|
||||
///
|
||||
string const editMessage() const;
|
||||
///
|
||||
void edit(BufferView *, int x, int y, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
//
|
||||
void insetUnlock(BufferView *);
|
||||
///
|
||||
|
@ -71,6 +71,7 @@ using std::for_each;
|
||||
using lyx::pos_type;
|
||||
using lyx::textclass_type;
|
||||
|
||||
|
||||
// These functions should probably go into bufferview_funcs somehow (Jug)
|
||||
|
||||
void InsetText::saveLyXTextState(LyXText * t) const
|
||||
@ -598,109 +599,6 @@ string const InsetText::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::edit(BufferView * bv, int x, int y, mouse_button::state button)
|
||||
{
|
||||
UpdatableInset::edit(bv, x, y, button);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_pos = inset_x = inset_y = 0;
|
||||
inset_boundary = false;
|
||||
inset_par = 0;
|
||||
old_par = 0;
|
||||
int tmp_y = (y < 0) ? 0 : y;
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
// 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, mouse_button::none)) {
|
||||
lt->setCursorFromCoordinates(x - drawTextXOffset,
|
||||
y + insetAscent);
|
||||
lt->cursor.x_fix(lt->cursor.x());
|
||||
}
|
||||
lt->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() &&
|
||||
boost::next(paragraphs.begin()) == paragraphs.end()&&
|
||||
bv->getParentLanguage(this) != lt->current_font.language())
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
if (clear)
|
||||
lt = 0;
|
||||
|
||||
int code = CURSOR;
|
||||
if (drawFrame_ == LOCKED)
|
||||
code = CURSOR|DRAW_FRAME;
|
||||
updateLocal(bv, code, false);
|
||||
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
}
|
||||
|
||||
|
||||
void InsetText::edit(BufferView * bv, bool front)
|
||||
{
|
||||
UpdatableInset::edit(bv, front);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return;
|
||||
}
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_pos = inset_x = inset_y = 0;
|
||||
inset_boundary = false;
|
||||
inset_par = 0;
|
||||
old_par = 0;
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
if (front)
|
||||
lt->setCursor(paragraphs.begin(), 0);
|
||||
else {
|
||||
ParagraphList::iterator it = paragraphs.begin();
|
||||
ParagraphList::iterator end = paragraphs.end();
|
||||
while (boost::next(it) != end)
|
||||
++it;
|
||||
// int const pos = (p->size() ? p->size()-1 : p->size());
|
||||
lt->setCursor(it, it->size());
|
||||
}
|
||||
lt->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() &&
|
||||
boost::next(paragraphs.begin()) == paragraphs.end() &&
|
||||
bv->getParentLanguage(this) != lt->current_font.language()) {
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
if (clear)
|
||||
lt = 0;
|
||||
int code = CURSOR;
|
||||
if (drawFrame_ == LOCKED)
|
||||
code = CURSOR|DRAW_FRAME;
|
||||
updateLocal(bv, code, false);
|
||||
}
|
||||
|
||||
|
||||
void InsetText::insetUnlock(BufferView * bv)
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
@ -812,7 +710,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
}
|
||||
if (it.getInset()->getInsetFromID(id)) {
|
||||
getLyXText(bv)->setCursorIntern(pit, it.getPos());
|
||||
it.getInset()->edit(bv);
|
||||
it.getInset()->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||
}
|
||||
}
|
||||
@ -1090,18 +988,91 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
BufferView * bv = ev.view();
|
||||
switch (ev.action) {
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
if (cmd.action == LFUN_INSET_EDIT) {
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
inset_pos = inset_x = inset_y = 0;
|
||||
inset_boundary = false;
|
||||
inset_par = 0;
|
||||
old_par = 0;
|
||||
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
|
||||
if (cmd.argument.size()) {
|
||||
if (cmd.argument == "left")
|
||||
lt->setCursor(paragraphs.begin(), 0);
|
||||
else {
|
||||
ParagraphList::iterator it = paragraphs.begin();
|
||||
ParagraphList::iterator end = paragraphs.end();
|
||||
while (boost::next(it) != end)
|
||||
++it;
|
||||
// int const pos = (p->size() ? p->size()-1 : p->size());
|
||||
lt->setCursor(it, it->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)) {
|
||||
lt->setCursorFromCoordinates(cmd.x - drawTextXOffset,
|
||||
cmd.y + insetAscent);
|
||||
lt->cursor.x_fix(lt->cursor.x());
|
||||
}
|
||||
}
|
||||
|
||||
lt->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() &&
|
||||
boost::next(paragraphs.begin()) == paragraphs.end()&&
|
||||
bv->getParentLanguage(this) != lt->current_font.language())
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
setFont(bv, font, false);
|
||||
}
|
||||
|
||||
if (clear)
|
||||
lt = 0;
|
||||
int code = CURSOR;
|
||||
if (drawFrame_ == LOCKED)
|
||||
code = CURSOR | DRAW_FRAME;
|
||||
|
||||
updateLocal(bv, code, false);
|
||||
// Tell the paragraph dialog that we've entered an insettext.
|
||||
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_PRESS:
|
||||
lfunMousePress(ev);
|
||||
lfunMousePress(cmd);
|
||||
return DISPATCHED;
|
||||
case LFUN_MOUSE_MOTION:
|
||||
lfunMouseMotion(ev);
|
||||
lfunMouseMotion(cmd);
|
||||
return DISPATCHED;
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
return lfunMouseRelease(ev) ? DISPATCHED : UNDISPATCHED;
|
||||
return lfunMouseRelease(cmd) ? DISPATCHED : UNDISPATCHED;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1109,16 +1080,16 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
bool was_empty = (paragraphs.begin()->empty() &&
|
||||
boost::next(paragraphs.begin()) == paragraphs.end());
|
||||
no_selection = false;
|
||||
RESULT result = UpdatableInset::localDispatch(ev);
|
||||
RESULT result = UpdatableInset::localDispatch(cmd);
|
||||
if (result != UNDISPATCHED)
|
||||
return DISPATCHED;
|
||||
|
||||
result = DISPATCHED;
|
||||
if (ev.action < 0 && ev.argument.empty())
|
||||
if (cmd.action < 0 && cmd.argument.empty())
|
||||
return FINISHED;
|
||||
|
||||
if (the_locking_inset) {
|
||||
result = the_locking_inset->localDispatch(ev);
|
||||
result = the_locking_inset->localDispatch(cmd);
|
||||
if (result == DISPATCHED_NOUPDATE)
|
||||
return result;
|
||||
else if (result == DISPATCHED) {
|
||||
@ -1167,7 +1138,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
if (lt->selection.set())
|
||||
cursor_update = SELECTION;
|
||||
|
||||
switch (ev.action) {
|
||||
switch (cmd.action) {
|
||||
|
||||
// Normal chars
|
||||
case LFUN_SELFINSERT:
|
||||
@ -1175,7 +1146,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
// setErrorMessage(N_("Document is read only"));
|
||||
break;
|
||||
}
|
||||
if (!ev.argument.empty()) {
|
||||
if (!cmd.argument.empty()) {
|
||||
/* Automatically delete the currently selected
|
||||
* text and replace it with what is being
|
||||
* typed in now. Depends on lyxrc settings
|
||||
@ -1193,9 +1164,9 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
}
|
||||
}
|
||||
lt->clearSelection();
|
||||
for (string::size_type i = 0; i < ev.argument.length(); ++i) {
|
||||
for (string::size_type i = 0; i < cmd.argument.length(); ++i) {
|
||||
bv->owner()->getIntl().getTransManager().
|
||||
TranslateAndInsert(ev.argument[i], lt);
|
||||
TranslateAndInsert(cmd.argument[i], lt);
|
||||
}
|
||||
}
|
||||
lt->selection.cursor = lt->cursor;
|
||||
@ -1289,7 +1260,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
|
||||
if (clip.empty())
|
||||
break;
|
||||
if (ev.argument == "paragraph") {
|
||||
if (cmd.argument == "paragraph") {
|
||||
lt->insertStringAsParagraphs(clip);
|
||||
} else {
|
||||
lt->insertStringAsLines(clip);
|
||||
@ -1362,7 +1333,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
// and current buffer's textclass (number). */
|
||||
LyXTextClass const & tclass =
|
||||
bv->buffer()->params.getLyXTextClass();
|
||||
string layout = ev.argument;
|
||||
string layout = cmd.argument;
|
||||
bool hasLayout = tclass.hasLayout(layout);
|
||||
|
||||
// If the entry is obsolete, use the new one instead.
|
||||
@ -1375,7 +1346,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
|
||||
// see if we found the layout number:
|
||||
if (!hasLayout) {
|
||||
FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + ev.argument + N_(" not known"));
|
||||
FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + cmd.argument + N_(" not known"));
|
||||
bv->owner()->dispatch(lf);
|
||||
break;
|
||||
}
|
||||
@ -1405,7 +1376,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
cur_value = pit->params().spacing().getValue();
|
||||
}
|
||||
|
||||
istringstream istr(STRCONV(ev.argument));
|
||||
istringstream istr(STRCONV(cmd.argument));
|
||||
string tmp;
|
||||
istr >> tmp;
|
||||
Spacing::Space new_spacing = cur_spacing;
|
||||
@ -1430,7 +1401,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
new_spacing = Spacing::Default;
|
||||
} else {
|
||||
lyxerr << _("Unknown spacing argument: ")
|
||||
<< ev.argument << endl;
|
||||
<< cmd.argument << endl;
|
||||
}
|
||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
||||
pit->params().spacing(Spacing(new_spacing, new_value));
|
||||
@ -1452,7 +1423,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
case LFUN_ENDBUF:
|
||||
case LFUN_BEGINNINGBUF:
|
||||
updwhat = cursor_update;
|
||||
if (!bv->dispatch(ev))
|
||||
if (!bv->dispatch(cmd))
|
||||
result = UNDISPATCHED;
|
||||
break;
|
||||
|
||||
@ -1469,7 +1440,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
if (!bv->dispatch(ev))
|
||||
if (!bv->dispatch(cmd))
|
||||
result = UNDISPATCHED;
|
||||
break;
|
||||
}
|
||||
@ -1929,7 +1900,8 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
|
||||
static_cast<UpdatableInset*>(cpar(bv)->getInset(cpos(bv)));
|
||||
if (!isHighlyEditableInset(inset))
|
||||
return false;
|
||||
inset->edit(bv, front);
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, front ? "left" : "right");
|
||||
inset->localDispatch(cmd);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, CURSOR, false);
|
||||
@ -1961,7 +1933,8 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
||||
y = insetDescent;
|
||||
inset_x = cix(bv) - top_x + drawTextXOffset;
|
||||
inset_y = ciy(bv) + drawTextYOffset;
|
||||
inset->edit(bv, x - inset_x, y - inset_y, button);
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
|
||||
inset->localDispatch(cmd);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, CURSOR, false);
|
||||
|
@ -12,12 +12,12 @@
|
||||
#ifndef INSETTEXT_H
|
||||
#define INSETTEXT_H
|
||||
|
||||
|
||||
#include "updatableinset.h"
|
||||
#include "LString.h"
|
||||
#include "LColor.h"
|
||||
#include "ParagraphList.h"
|
||||
#include "RowList.h"
|
||||
#include "frontends/mouse_state.h"
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
@ -102,10 +102,6 @@ public:
|
||||
///
|
||||
string const editMessage() const;
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView *, bool front = true);
|
||||
///
|
||||
bool isTextInset() const { return true; }
|
||||
///
|
||||
void insetUnlock(BufferView *);
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "gettext.h"
|
||||
#include "insettoc.h"
|
||||
#include "funcrequest.h"
|
||||
#include "BufferView.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
@ -53,16 +54,15 @@ Inset::Code InsetTOC::lyxCode() const
|
||||
}
|
||||
|
||||
|
||||
void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
InsetCommandMailer mailer("toc", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetTOC::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("toc", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,12 +28,10 @@ public:
|
||||
return new InsetTOC(params(), same_id);
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
void edit(BufferView * bv, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
bool display() const { return true; }
|
||||
|
@ -7,10 +7,11 @@
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "inseturl.h"
|
||||
#include "funcrequest.h"
|
||||
#include "BufferView.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "frontends/LyXView.h"
|
||||
@ -29,21 +30,19 @@ InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
|
||||
|
||||
InsetUrl::~InsetUrl()
|
||||
{
|
||||
InsetCommandMailer mailer("url", *this);
|
||||
mailer.hideDialog();
|
||||
InsetCommandMailer("url", *this).hideDialog();
|
||||
}
|
||||
|
||||
|
||||
void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
dispatch_result InsetUrl::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
InsetCommandMailer mailer("url", *this);
|
||||
mailer.showDialog(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetUrl::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, mouse_button::none);
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("url", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
return new InsetUrl(params(), same_id);
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::URL_CODE; }
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
@ -39,10 +41,6 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
void edit(BufferView *, int, int, mouse_button::state);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
bool display() const { return false; }
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
|
@ -52,14 +52,6 @@ void UpdatableInset::fitInsetCursor(BufferView *) const
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::edit(BufferView *, int, int, mouse_button::state)
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::edit(BufferView *, bool)
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::draw(BufferView *, LyXFont const &,
|
||||
int /* baseline */, float & x) const
|
||||
{
|
||||
|
@ -66,10 +66,6 @@ public:
|
||||
///
|
||||
virtual void insetUnlock(BufferView *);
|
||||
///
|
||||
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
virtual void edit(BufferView *, bool front = true);
|
||||
///
|
||||
virtual void draw(BufferView *, LyXFont const &,
|
||||
int baseline, float & x) const;
|
||||
///
|
||||
|
@ -312,7 +312,7 @@ enum kb_action {
|
||||
LFUN_MOUSE_RELEASE, // André 9 Aug 2002
|
||||
LFUN_MOUSE_DOUBLE, // André 9 Aug 2002
|
||||
LFUN_MOUSE_TRIPLE, // André 9 Aug 2002
|
||||
LFUN_EDIT, // André 16 Aug 2002
|
||||
LFUN_INSET_EDIT, // André 16 Aug 2002
|
||||
LFUN_INSET_WRAP, // Dekel 7 Apr 2002
|
||||
// 240
|
||||
LFUN_TRACK_CHANGES, // Levon 20021001 (cool date !)
|
||||
|
@ -1366,7 +1366,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
if (view()->theLockingInset())
|
||||
view()->unlockInset(view()->theLockingInset());
|
||||
if (par->inInset()) {
|
||||
par->inInset()->edit(view());
|
||||
FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
|
||||
par->inInset()->localDispatch(cmd);
|
||||
}
|
||||
// Set the cursor
|
||||
view()->getLyXText()->setCursor(par, 0);
|
||||
|
@ -13,12 +13,9 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "Lsstream.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
|
||||
#include "formula.h"
|
||||
#include "formulamacro.h"
|
||||
#include "lyxrc.h"
|
||||
@ -53,14 +50,16 @@
|
||||
#include "intl.h"
|
||||
#include "ref_inset.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using std::endl;
|
||||
using std::ostream;
|
||||
using std::vector;
|
||||
using std::abs;
|
||||
using std::max;
|
||||
|
||||
MathCursor * mathcursor = 0;
|
||||
|
||||
MathCursor * mathcursor = 0;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -68,15 +67,13 @@ namespace {
|
||||
int first_x;
|
||||
int first_y;
|
||||
|
||||
|
||||
|
||||
bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
|
||||
{
|
||||
if (!bv->insertInset(new_inset)) {
|
||||
delete new_inset;
|
||||
return false;
|
||||
}
|
||||
new_inset->edit(bv, true);
|
||||
new_inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,31 +166,6 @@ string const InsetFormulaBase::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::edit(BufferView * bv, int x, int y, mouse_button::state)
|
||||
{
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << 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);
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::edit(BufferView * bv, bool front)
|
||||
{
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "Cannot lock math inset in edit call!\n";
|
||||
releaseMathCursor(bv);
|
||||
mathcursor = new MathCursor(this, front);
|
||||
metrics(bv);
|
||||
bv->updateInset(this);
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::insetUnlock(BufferView * bv)
|
||||
{
|
||||
if (mathcursor) {
|
||||
@ -369,10 +341,29 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
// << " y: '" << cmd.y
|
||||
// << "' button: " << cmd.button() << endl;
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
// delete empty mathbox (LFUN_BACKSPACE and LFUN_DELETE)
|
||||
bool remove_inset = false;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "Cannot lock math inset in edit call!\n";
|
||||
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 DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
//lyxerr << "Mouse single press\n";
|
||||
return lfunMousePress(cmd);
|
||||
@ -392,7 +383,6 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
if (!mathcursor)
|
||||
return UNDISPATCHED;
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
string argument = cmd.argument;
|
||||
RESULT result = DISPATCHED;
|
||||
bool sel = false;
|
||||
|
@ -59,10 +59,6 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual string const editMessage() const;
|
||||
///
|
||||
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||
///
|
||||
virtual void edit(BufferView *, bool front = true);
|
||||
///
|
||||
virtual void fitInsetCursor(BufferView *) const;
|
||||
/// FIXME
|
||||
virtual void getCursorPos(BufferView *, int &, int &) const;
|
||||
|
@ -241,9 +241,6 @@ public:
|
||||
/// identifies things that can get \limits or \nolimits
|
||||
virtual bool takesLimits() const { return false; }
|
||||
|
||||
///
|
||||
virtual void edit(BufferView *, int, int, mouse_button::state) {}
|
||||
|
||||
/// request "external features"
|
||||
virtual void validate(LaTeXFeatures &) const {}
|
||||
/// char char code if possible
|
||||
|
@ -2203,7 +2203,8 @@ LyXText::selectNextWordToSpellcheck(float & value)
|
||||
if (cursor.pos() < cursor.par()->size() &&
|
||||
cursor.par()->isInset(cursor.pos())) {
|
||||
// lock the inset!
|
||||
cursor.par()->getInset(cursor.pos())->edit(bv());
|
||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, "left");
|
||||
cursor.par()->getInset(cursor.pos())->localDispatch(cmd);
|
||||
// now call us again to do the above trick
|
||||
// but obviously we have to start from down below ;)
|
||||
return bv()->text->selectNextWordToSpellcheck(value);
|
||||
|
@ -1231,7 +1231,7 @@ void LyXText::updateCounters()
|
||||
|
||||
string const oldLabel = pit->params().labelString();
|
||||
|
||||
int maxdepth = 0;
|
||||
size_t maxdepth = 0;
|
||||
if (pit != ownerParagraphs().begin())
|
||||
maxdepth = boost::prior(pit)->getMaxDepthAfter();
|
||||
|
||||
@ -2046,7 +2046,8 @@ void LyXText::cursorUp(bool selecting)
|
||||
y -= topy;
|
||||
Inset * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
inset_hit->edit(bv(), x, y - (y2 - y1), mouse_button::none);
|
||||
inset_hit->localDispatch(
|
||||
FuncRequest(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none));
|
||||
}
|
||||
}
|
||||
#else
|
||||
@ -2070,7 +2071,8 @@ void LyXText::cursorDown(bool selecting)
|
||||
y -= topy;
|
||||
Inset * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
inset_hit->edit(bv(), x, y - (y2 - y1), mouse_button::none);
|
||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none);
|
||||
inset_hit->localDispatch(cmd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
12
src/text3.C
12
src/text3.C
@ -385,8 +385,10 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
|
||||
gotsel = true;
|
||||
}
|
||||
if (bv->insertInset(inset)) {
|
||||
if (edit)
|
||||
inset->edit(bv);
|
||||
if (edit) {
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
|
||||
inset->localDispatch(cmd);
|
||||
}
|
||||
if (gotsel && pastesel)
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
|
||||
}
|
||||
@ -606,7 +608,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
&& isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
|
||||
Inset * tmpinset = cursor.par()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
tmpinset->edit(bv, !is_rtl);
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
|
||||
tmpinset->localDispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
if (!is_rtl)
|
||||
@ -631,7 +634,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
|
||||
Inset * tmpinset = cursor.par()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
tmpinset->edit(bv, is_rtl);
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
|
||||
tmpinset->localDispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
if (is_rtl)
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "undo_funcs.h"
|
||||
#include "lyxtext.h"
|
||||
#include "funcrequest.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "insets/updatableinset.h"
|
||||
@ -218,7 +219,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
it = static_cast<UpdatableInset*>(tmppar->inInset());
|
||||
LyXText * t;
|
||||
if (it) {
|
||||
it->edit(bv);
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
|
||||
it->localDispatch(cmd);
|
||||
t = it->getLyXText(bv);
|
||||
} else {
|
||||
t = bv->text;
|
||||
@ -242,7 +244,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
LyXText * t;
|
||||
Inset * it = tmppar->inInset();
|
||||
if (it) {
|
||||
it->edit(bv);
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
|
||||
it->localDispatch(cmd);
|
||||
t = it->getLyXText(bv);
|
||||
} else {
|
||||
t = bv->text;
|
||||
|
Loading…
Reference in New Issue
Block a user