mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +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>
|
||||
|
||||
|
@ -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 end = list.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it->inset && it->inset->lyxCode() == InsetOld::BRANCH_CODE) {
|
||||
InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
|
||||
if (bp.branchlist().selected(inset->params().branch)) {
|
||||
inset->open(bv);
|
||||
if (buf.params().branchlist().selected(inset->params().branch)) {
|
||||
inset->open();
|
||||
} else {
|
||||
inset->close(bv);
|
||||
inset->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
class InsetOld;
|
||||
class BufferView;
|
||||
class Buffer;
|
||||
|
||||
|
||||
///
|
||||
@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
void decreasePosAfterPos(lyx::pos_type pos);
|
||||
///
|
||||
void insetsOpenCloseBranch(BufferView * bv);
|
||||
void insetsOpenCloseBranch(Buffer const & buf);
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -229,11 +229,9 @@ InsetOld * createInset(FuncRequest const & cmd)
|
||||
return new InsetCitation(icp);
|
||||
|
||||
} else if (name == "ert") {
|
||||
InsetERT * inset = new InsetERT(params);
|
||||
InsetERT::ERTStatus s;
|
||||
InsetERTMailer::string2params(cmd.argument, s);
|
||||
inset->status(bv, s);
|
||||
return inset;
|
||||
return new InsetERT(params, s);
|
||||
|
||||
} else if (name == "external") {
|
||||
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>
|
||||
|
||||
* ControlSpellchecker.C (isLetter): skip ert
|
||||
|
@ -90,7 +90,7 @@ void ControlDocument::apply()
|
||||
ParIterator pit = buffer()->par_iterator_begin();
|
||||
ParIterator pend = buffer()->par_iterator_end();
|
||||
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>
|
||||
|
||||
|
@ -233,9 +233,9 @@ public:
|
||||
// is the inset open?
|
||||
virtual bool isOpen() const { return false; }
|
||||
/// open the inset
|
||||
virtual void open(BufferView *) {}
|
||||
virtual void open() {}
|
||||
/// close the inset
|
||||
virtual void close(BufferView *) const {}
|
||||
virtual void close() const {}
|
||||
/// check if the font of the char we want inserting is correct
|
||||
/// and modify it if it is not.
|
||||
virtual bool checkInsertChar(LyXFont &);
|
||||
|
@ -264,7 +264,7 @@ void InsetCollapsable::edit(BufferView * bv, bool left)
|
||||
{
|
||||
lyxerr << "InsetCollapsable: edit left/right" << endl;
|
||||
inset.edit(bv, left);
|
||||
open(bv);
|
||||
open();
|
||||
bv->cursor().push(this);
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ LyXText * InsetCollapsable::getText(int i) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::open(BufferView *)
|
||||
void InsetCollapsable::open()
|
||||
{
|
||||
if (!collapsed_)
|
||||
return;
|
||||
@ -389,7 +389,7 @@ void InsetCollapsable::open(BufferView *)
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::close(BufferView * bv) const
|
||||
void InsetCollapsable::close() const
|
||||
{
|
||||
if (collapsed_)
|
||||
return;
|
||||
|
@ -108,9 +108,9 @@ public:
|
||||
///
|
||||
bool isOpen() const;
|
||||
///
|
||||
void open(BufferView *);
|
||||
void open();
|
||||
///
|
||||
void close(BufferView *) const;
|
||||
void close() const;
|
||||
///
|
||||
void markErased();
|
||||
///
|
||||
|
@ -119,12 +119,12 @@ void InsetERT::read(Buffer const & buf, LyXLex & lex)
|
||||
string const tmp_token = lex.getString();
|
||||
|
||||
if (tmp_token == "Inlined") {
|
||||
status(0, Inlined);
|
||||
status(Inlined);
|
||||
} else if (tmp_token == "Collapsed") {
|
||||
status(0, Collapsed);
|
||||
status(Collapsed);
|
||||
} else {
|
||||
// leave this as default!
|
||||
status(0, Open);
|
||||
status(Open);
|
||||
}
|
||||
|
||||
token_found = true;
|
||||
@ -154,9 +154,9 @@ void InsetERT::read(Buffer const & buf, LyXLex & lex)
|
||||
|
||||
if (!token_found) {
|
||||
if (isOpen())
|
||||
status(0, Open);
|
||||
status(Open);
|
||||
else
|
||||
status(0, Collapsed);
|
||||
status(Collapsed);
|
||||
}
|
||||
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 (isOpen())
|
||||
status(bv, swap ? Collapsed : Open);
|
||||
status(swap ? Collapsed : Open);
|
||||
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)) {
|
||||
updateStatus(bv, true);
|
||||
updateStatus(true);
|
||||
} else {
|
||||
FuncRequest cmd1 = cmd;
|
||||
#warning metrics?
|
||||
@ -409,7 +409,7 @@ void InsetERT::edit(BufferView * bv, bool left)
|
||||
InsetCollapsable::edit(bv, left);
|
||||
}
|
||||
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: {
|
||||
InsetERT::ERTStatus status_;
|
||||
InsetERTMailer::string2params(cmd.argument, status_);
|
||||
status(bv, status_);
|
||||
status(status_);
|
||||
bv->update();
|
||||
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(BufferView * bv, ERTStatus const st) const
|
||||
void InsetERT::status(ERTStatus const st) const
|
||||
{
|
||||
if (st == status_)
|
||||
return;
|
||||
|
||||
status_ = st;
|
||||
|
||||
switch (st) {
|
||||
case Inlined:
|
||||
break;
|
||||
@ -554,16 +554,8 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
|
||||
case Collapsed:
|
||||
setCollapsed(true);
|
||||
setButtonLabel();
|
||||
#ifdef LOCK
|
||||
if (bv)
|
||||
bv->unlockInset();
|
||||
#endif
|
||||
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())
|
||||
status(bv, Open);
|
||||
status(Open);
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::close(BufferView * bv) const
|
||||
void InsetERT::close() const
|
||||
{
|
||||
if (status_ == Collapsed || status_ == Inlined)
|
||||
return;
|
||||
|
||||
status(bv, Collapsed);
|
||||
status(Collapsed);
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,15 +88,15 @@ public:
|
||||
///
|
||||
ERTStatus status() const { return status_; }
|
||||
///
|
||||
void open(BufferView *);
|
||||
void open();
|
||||
///
|
||||
void close(BufferView *) const;
|
||||
void close() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
/// set the status of the inset
|
||||
void status(BufferView *, ERTStatus const st) const;
|
||||
void status(ERTStatus const st) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
@ -130,7 +130,7 @@ private:
|
||||
///
|
||||
void set_latex_font(BufferView *);
|
||||
/// update status on button
|
||||
void updateStatus(BufferView *, bool = false) const;
|
||||
void updateStatus(bool = false) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool left);
|
||||
///
|
||||
|
@ -361,8 +361,6 @@ void RowPainter::paintFromPos(pos_type & vpos)
|
||||
}
|
||||
|
||||
paintForeignMark(orig_x, orig_font);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ void LyXText::toggleInset()
|
||||
if (inset_owner && inset_owner->owner()
|
||||
&& inset_owner->owner()->isOpen()) {
|
||||
finishUndo();
|
||||
inset_owner->owner()->close(bv());
|
||||
inset_owner->owner()->close();
|
||||
bv()->getLyXText()->cursorRight(true);
|
||||
bv()->updateParagraphDialog();
|
||||
}
|
||||
@ -269,11 +269,9 @@ void LyXText::toggleInset()
|
||||
recUndo(cursor.par());
|
||||
|
||||
if (inset->isOpen())
|
||||
inset->close(bv());
|
||||
inset->close();
|
||||
else
|
||||
inset->open(bv());
|
||||
|
||||
bv()->update();
|
||||
inset->open();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user