mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
Michael's open-close-patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8119 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
34b73170c6
commit
6ff15cc813
@ -1,3 +1,10 @@
|
|||||||
|
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
||||||
|
|
||||||
|
* factory.C: change call to InsetERT constructor to avoid
|
||||||
|
additional invocation of method status
|
||||||
|
* text2.C (toggleInset): remove redundant update() call
|
||||||
|
* InsetList.[Ch] (insetsOpenCloseBranch): Pass Buffer reference
|
||||||
|
instead of a Bufferview pointer
|
||||||
|
|
||||||
2003-11-21 André Pönitz <poenitz@gmx.net>
|
2003-11-21 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
@ -158,18 +158,17 @@ void InsetList::decreasePosAfterPos(pos_type pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetList::insetsOpenCloseBranch(BufferView * bv)
|
void InsetList::insetsOpenCloseBranch(Buffer const & buf)
|
||||||
{
|
{
|
||||||
BufferParams const & bp = bv->buffer()->params();
|
|
||||||
List::iterator it = list.begin();
|
List::iterator it = list.begin();
|
||||||
List::iterator end = list.end();
|
List::iterator end = list.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
if (it->inset && it->inset->lyxCode() == InsetOld::BRANCH_CODE) {
|
if (it->inset && it->inset->lyxCode() == InsetOld::BRANCH_CODE) {
|
||||||
InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
|
InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
|
||||||
if (bp.branchlist().selected(inset->params().branch)) {
|
if (buf.params().branchlist().selected(inset->params().branch)) {
|
||||||
inset->open(bv);
|
inset->open();
|
||||||
} else {
|
} else {
|
||||||
inset->close(bv);
|
inset->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class InsetOld;
|
class InsetOld;
|
||||||
class BufferView;
|
class Buffer;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
///
|
///
|
||||||
void decreasePosAfterPos(lyx::pos_type pos);
|
void decreasePosAfterPos(lyx::pos_type pos);
|
||||||
///
|
///
|
||||||
void insetsOpenCloseBranch(BufferView * bv);
|
void insetsOpenCloseBranch(Buffer const & buf);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -229,11 +229,9 @@ InsetOld * createInset(FuncRequest const & cmd)
|
|||||||
return new InsetCitation(icp);
|
return new InsetCitation(icp);
|
||||||
|
|
||||||
} else if (name == "ert") {
|
} else if (name == "ert") {
|
||||||
InsetERT * inset = new InsetERT(params);
|
|
||||||
InsetERT::ERTStatus s;
|
InsetERT::ERTStatus s;
|
||||||
InsetERTMailer::string2params(cmd.argument, s);
|
InsetERTMailer::string2params(cmd.argument, s);
|
||||||
inset->status(bv, s);
|
return new InsetERT(params, s);
|
||||||
return inset;
|
|
||||||
|
|
||||||
} else if (name == "external") {
|
} else if (name == "external") {
|
||||||
Buffer const & buffer = *cmd.view()->buffer();
|
Buffer const & buffer = *cmd.view()->buffer();
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
||||||
|
|
||||||
|
* ControlDocument.C: Change call to insetsOpenCloseBranch
|
||||||
|
|
||||||
2003-11-07 Alfredo Braunstein <abraunst@libero.it>
|
2003-11-07 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* ControlSpellchecker.C (isLetter): skip ert
|
* ControlSpellchecker.C (isLetter): skip ert
|
||||||
|
@ -90,7 +90,7 @@ void ControlDocument::apply()
|
|||||||
ParIterator pit = buffer()->par_iterator_begin();
|
ParIterator pit = buffer()->par_iterator_begin();
|
||||||
ParIterator pend = buffer()->par_iterator_end();
|
ParIterator pend = buffer()->par_iterator_end();
|
||||||
for (; pit != pend; ++pit) {
|
for (; pit != pend; ++pit) {
|
||||||
pit->insetlist.insetsOpenCloseBranch(bufferview());
|
pit->insetlist.insetsOpenCloseBranch(*buffer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
||||||
|
|
||||||
|
* inset.h:
|
||||||
|
* insetcollapsable.[Ch]:
|
||||||
|
* insetert.[Ch]: remove bufferview parameter in methods
|
||||||
|
open, close, status, and updateStatus.
|
||||||
|
|
||||||
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
||||||
|
|
||||||
|
@ -233,9 +233,9 @@ public:
|
|||||||
// is the inset open?
|
// is the inset open?
|
||||||
virtual bool isOpen() const { return false; }
|
virtual bool isOpen() const { return false; }
|
||||||
/// open the inset
|
/// open the inset
|
||||||
virtual void open(BufferView *) {}
|
virtual void open() {}
|
||||||
/// close the inset
|
/// close the inset
|
||||||
virtual void close(BufferView *) const {}
|
virtual void close() const {}
|
||||||
/// check if the font of the char we want inserting is correct
|
/// check if the font of the char we want inserting is correct
|
||||||
/// and modify it if it is not.
|
/// and modify it if it is not.
|
||||||
virtual bool checkInsertChar(LyXFont &);
|
virtual bool checkInsertChar(LyXFont &);
|
||||||
|
@ -264,7 +264,7 @@ void InsetCollapsable::edit(BufferView * bv, bool left)
|
|||||||
{
|
{
|
||||||
lyxerr << "InsetCollapsable: edit left/right" << endl;
|
lyxerr << "InsetCollapsable: edit left/right" << endl;
|
||||||
inset.edit(bv, left);
|
inset.edit(bv, left);
|
||||||
open(bv);
|
open();
|
||||||
bv->cursor().push(this);
|
bv->cursor().push(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ LyXText * InsetCollapsable::getText(int i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::open(BufferView *)
|
void InsetCollapsable::open()
|
||||||
{
|
{
|
||||||
if (!collapsed_)
|
if (!collapsed_)
|
||||||
return;
|
return;
|
||||||
@ -389,7 +389,7 @@ void InsetCollapsable::open(BufferView *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::close(BufferView * bv) const
|
void InsetCollapsable::close() const
|
||||||
{
|
{
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
return;
|
return;
|
||||||
|
@ -108,9 +108,9 @@ public:
|
|||||||
///
|
///
|
||||||
bool isOpen() const;
|
bool isOpen() const;
|
||||||
///
|
///
|
||||||
void open(BufferView *);
|
void open();
|
||||||
///
|
///
|
||||||
void close(BufferView *) const;
|
void close() const;
|
||||||
///
|
///
|
||||||
void markErased();
|
void markErased();
|
||||||
///
|
///
|
||||||
|
@ -119,12 +119,12 @@ void InsetERT::read(Buffer const & buf, LyXLex & lex)
|
|||||||
string const tmp_token = lex.getString();
|
string const tmp_token = lex.getString();
|
||||||
|
|
||||||
if (tmp_token == "Inlined") {
|
if (tmp_token == "Inlined") {
|
||||||
status(0, Inlined);
|
status(Inlined);
|
||||||
} else if (tmp_token == "Collapsed") {
|
} else if (tmp_token == "Collapsed") {
|
||||||
status(0, Collapsed);
|
status(Collapsed);
|
||||||
} else {
|
} else {
|
||||||
// leave this as default!
|
// leave this as default!
|
||||||
status(0, Open);
|
status(Open);
|
||||||
}
|
}
|
||||||
|
|
||||||
token_found = true;
|
token_found = true;
|
||||||
@ -154,9 +154,9 @@ void InsetERT::read(Buffer const & buf, LyXLex & lex)
|
|||||||
|
|
||||||
if (!token_found) {
|
if (!token_found) {
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
status(0, Open);
|
status(Open);
|
||||||
else
|
else
|
||||||
status(0, Collapsed);
|
status(Collapsed);
|
||||||
}
|
}
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
}
|
}
|
||||||
@ -237,13 +237,13 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::updateStatus(BufferView * bv, bool swap) const
|
void InsetERT::updateStatus(bool swap) const
|
||||||
{
|
{
|
||||||
if (status_ != Inlined) {
|
if (status_ != Inlined) {
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
status(bv, swap ? Collapsed : Open);
|
status(swap ? Collapsed : Open);
|
||||||
else
|
else
|
||||||
status(bv, swap ? Open : Collapsed);
|
status(swap ? Open : Collapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ bool InsetERT::lfunMouseRelease(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status_ != Inlined && hitButton(cmd)) {
|
if (status_ != Inlined && hitButton(cmd)) {
|
||||||
updateStatus(bv, true);
|
updateStatus(true);
|
||||||
} else {
|
} else {
|
||||||
FuncRequest cmd1 = cmd;
|
FuncRequest cmd1 = cmd;
|
||||||
#warning metrics?
|
#warning metrics?
|
||||||
@ -409,7 +409,7 @@ void InsetERT::edit(BufferView * bv, bool left)
|
|||||||
InsetCollapsable::edit(bv, left);
|
InsetCollapsable::edit(bv, left);
|
||||||
}
|
}
|
||||||
set_latex_font(bv);
|
set_latex_font(bv);
|
||||||
updateStatus(bv);
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ InsetERT::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
|||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
InsetERT::ERTStatus status_;
|
InsetERT::ERTStatus status_;
|
||||||
InsetERTMailer::string2params(cmd.argument, status_);
|
InsetERTMailer::string2params(cmd.argument, status_);
|
||||||
status(bv, status_);
|
status(status_);
|
||||||
bv->update();
|
bv->update();
|
||||||
return DispatchResult(true, true);
|
return DispatchResult(true, true);
|
||||||
}
|
}
|
||||||
@ -537,13 +537,13 @@ void InsetERT::set_latex_font(BufferView * /*bv*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// attention this function can be called with bv == 0
|
void InsetERT::status(ERTStatus const st) const
|
||||||
void InsetERT::status(BufferView * bv, ERTStatus const st) const
|
|
||||||
{
|
{
|
||||||
if (st == status_)
|
if (st == status_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
status_ = st;
|
status_ = st;
|
||||||
|
|
||||||
switch (st) {
|
switch (st) {
|
||||||
case Inlined:
|
case Inlined:
|
||||||
break;
|
break;
|
||||||
@ -554,16 +554,8 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
|
|||||||
case Collapsed:
|
case Collapsed:
|
||||||
setCollapsed(true);
|
setCollapsed(true);
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
#ifdef LOCK
|
|
||||||
if (bv)
|
|
||||||
bv->unlockInset();
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (bv) {
|
|
||||||
bv->update();
|
|
||||||
bv->buffer()->markDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -574,19 +566,19 @@ bool InsetERT::showInsetDialog(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::open(BufferView * bv)
|
void InsetERT::open()
|
||||||
{
|
{
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
status(bv, Open);
|
status(Open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::close(BufferView * bv) const
|
void InsetERT::close() const
|
||||||
{
|
{
|
||||||
if (status_ == Collapsed || status_ == Inlined)
|
if (status_ == Collapsed || status_ == Inlined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
status(bv, Collapsed);
|
status(Collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,15 +88,15 @@ public:
|
|||||||
///
|
///
|
||||||
ERTStatus status() const { return status_; }
|
ERTStatus status() const { return status_; }
|
||||||
///
|
///
|
||||||
void open(BufferView *);
|
void open();
|
||||||
///
|
///
|
||||||
void close(BufferView *) const;
|
void close() const;
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
/// set the status of the inset
|
/// set the status of the inset
|
||||||
void status(BufferView *, ERTStatus const st) const;
|
void status(ERTStatus const st) const;
|
||||||
///
|
///
|
||||||
bool showInsetDialog(BufferView *) const;
|
bool showInsetDialog(BufferView *) const;
|
||||||
///
|
///
|
||||||
@ -130,7 +130,7 @@ private:
|
|||||||
///
|
///
|
||||||
void set_latex_font(BufferView *);
|
void set_latex_font(BufferView *);
|
||||||
/// update status on button
|
/// update status on button
|
||||||
void updateStatus(BufferView *, bool = false) const;
|
void updateStatus(bool = false) const;
|
||||||
///
|
///
|
||||||
void edit(BufferView * bv, bool left);
|
void edit(BufferView * bv, bool left);
|
||||||
///
|
///
|
||||||
|
@ -361,8 +361,6 @@ void RowPainter::paintFromPos(pos_type & vpos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
paintForeignMark(orig_x, orig_font);
|
paintForeignMark(orig_x, orig_font);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ void LyXText::toggleInset()
|
|||||||
if (inset_owner && inset_owner->owner()
|
if (inset_owner && inset_owner->owner()
|
||||||
&& inset_owner->owner()->isOpen()) {
|
&& inset_owner->owner()->isOpen()) {
|
||||||
finishUndo();
|
finishUndo();
|
||||||
inset_owner->owner()->close(bv());
|
inset_owner->owner()->close();
|
||||||
bv()->getLyXText()->cursorRight(true);
|
bv()->getLyXText()->cursorRight(true);
|
||||||
bv()->updateParagraphDialog();
|
bv()->updateParagraphDialog();
|
||||||
}
|
}
|
||||||
@ -269,11 +269,9 @@ void LyXText::toggleInset()
|
|||||||
recUndo(cursor.par());
|
recUndo(cursor.par());
|
||||||
|
|
||||||
if (inset->isOpen())
|
if (inset->isOpen())
|
||||||
inset->close(bv());
|
inset->close();
|
||||||
else
|
else
|
||||||
inset->open(bv());
|
inset->open();
|
||||||
|
|
||||||
bv()->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user