mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
bug 2092: branches not propagated to child documents
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10577 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6e1863bc69
commit
409037f1bb
@ -1,3 +1,12 @@
|
|||||||
|
2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
|
* text3.C (getStatus):
|
||||||
|
* MenuBackend.C (expandBranches): take the branch list from the
|
||||||
|
master document (bug 2092).
|
||||||
|
|
||||||
|
* MenuBackend.C (expandBranches):
|
||||||
|
* bufferparams.C (writeFile): use BranchList type.
|
||||||
|
|
||||||
2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* text3.C (dispatch, getStatus):
|
* text3.C (dispatch, getStatus):
|
||||||
|
@ -737,10 +737,10 @@ void expandBranches(Menu & tomenu, LyXView const * view)
|
|||||||
if (!view || !view->buffer())
|
if (!view || !view->buffer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BufferParams const & params = view->buffer()->params();
|
BufferParams const & params = view->buffer()->getMasterBuffer()->params();
|
||||||
|
|
||||||
std::list<Branch>::const_iterator cit = params.branchlist().begin();
|
BranchList::const_iterator cit = params.branchlist().begin();
|
||||||
std::list<Branch>::const_iterator end = params.branchlist().end();
|
BranchList::const_iterator end = params.branchlist().end();
|
||||||
|
|
||||||
for (int ii = 1; cit != end; ++cit, ++ii) {
|
for (int ii = 1; cit != end; ++cit, ++ii) {
|
||||||
string label = cit->getBranch();
|
string label = cit->getBranch();
|
||||||
|
@ -596,8 +596,8 @@ void BufferParams::writeFile(ostream & os) const
|
|||||||
<< "\n\\paperorientation " << string_orientation[orientation]
|
<< "\n\\paperorientation " << string_orientation[orientation]
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
|
||||||
std::list<Branch>::const_iterator it = branchlist().begin();
|
BranchList::const_iterator it = branchlist().begin();
|
||||||
std::list<Branch>::const_iterator end = branchlist().end();
|
BranchList::const_iterator end = branchlist().end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
os << "\\branch " << it->getBranch()
|
os << "\\branch " << it->getBranch()
|
||||||
<< "\n\\selected " << it->getSelected()
|
<< "\n\\selected " << it->getSelected()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
|
* insetbranch.C (isBranchSelected): take a buffer as argument.
|
||||||
|
adapt to work with child documents (bug 2092).
|
||||||
|
|
||||||
2005-10-21 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
2005-10-21 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* insettabular.C (doDispatch): get rid of annoying debug message.
|
* insettabular.C (doDispatch): get rid of annoying debug message.
|
||||||
|
@ -145,9 +145,7 @@ void InsetBranch::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_INSET_TOGGLE:
|
case LFUN_INSET_TOGGLE:
|
||||||
if (cmd.argument == "assign" || cmd.argument.empty()) {
|
if (cmd.argument == "assign" || cmd.argument.empty()) {
|
||||||
// The branch inset uses "assign".
|
// The branch inset uses "assign".
|
||||||
BranchList const & branchlist =
|
if (isBranchSelected(cur.buffer())) {
|
||||||
cur.buffer().params().branchlist();
|
|
||||||
if (isBranchSelected(branchlist)) {
|
|
||||||
if (status() != Open)
|
if (status() != Open)
|
||||||
setStatus(cur, Open);
|
setStatus(cur, Open);
|
||||||
else
|
else
|
||||||
@ -185,9 +183,7 @@ bool InsetBranch::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
flag.enabled(true);
|
flag.enabled(true);
|
||||||
else if (cmd.argument == "assign"
|
else if (cmd.argument == "assign"
|
||||||
|| cmd.argument.empty()) {
|
|| cmd.argument.empty()) {
|
||||||
BranchList const & branchlist =
|
if (isBranchSelected(cur.buffer()))
|
||||||
cur.buffer().params().branchlist();
|
|
||||||
if (isBranchSelected(branchlist))
|
|
||||||
flag.enabled(status() != Open);
|
flag.enabled(status() != Open);
|
||||||
else
|
else
|
||||||
flag.enabled(status() != Collapsed);
|
flag.enabled(status() != Collapsed);
|
||||||
@ -202,8 +198,10 @@ bool InsetBranch::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetBranch::isBranchSelected(BranchList const & branchlist) const
|
bool InsetBranch::isBranchSelected(Buffer const & buffer) const
|
||||||
{
|
{
|
||||||
|
Buffer const & realbuffer = *buffer.getMasterBuffer();
|
||||||
|
BranchList const & branchlist = realbuffer.params().branchlist();
|
||||||
BranchList::const_iterator const end = branchlist.end();
|
BranchList::const_iterator const end = branchlist.end();
|
||||||
BranchList::const_iterator it =
|
BranchList::const_iterator it =
|
||||||
std::find_if(branchlist.begin(), end,
|
std::find_if(branchlist.begin(), end,
|
||||||
@ -217,7 +215,7 @@ bool InsetBranch::isBranchSelected(BranchList const & branchlist) const
|
|||||||
int InsetBranch::latex(Buffer const & buf, ostream & os,
|
int InsetBranch::latex(Buffer const & buf, ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
return isBranchSelected(buf.params().branchlist()) ?
|
return isBranchSelected(buf) ?
|
||||||
InsetText::latex(buf, os, runparams) : 0;
|
InsetText::latex(buf, os, runparams) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +223,7 @@ int InsetBranch::latex(Buffer const & buf, ostream & os,
|
|||||||
int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os,
|
int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
return isBranchSelected(buf.params().branchlist()) ?
|
return isBranchSelected(buf) ?
|
||||||
InsetText::linuxdoc(buf, os, runparams) : 0;
|
InsetText::linuxdoc(buf, os, runparams) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +231,7 @@ int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os,
|
|||||||
int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
return isBranchSelected(buf.params().branchlist()) ?
|
return isBranchSelected(buf) ?
|
||||||
InsetText::docbook(buf, os, runparams) : 0;
|
InsetText::docbook(buf, os, runparams) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +239,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
|||||||
int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
|
int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
return isBranchSelected(buf.params().branchlist()) ?
|
return isBranchSelected(buf) ?
|
||||||
InsetText::plaintext(buf, os, runparams): 0;
|
InsetText::plaintext(buf, os, runparams): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "insetcollapsable.h"
|
#include "insetcollapsable.h"
|
||||||
|
|
||||||
class BranchList;
|
class Buffer;
|
||||||
|
|
||||||
|
|
||||||
class InsetBranchParams {
|
class InsetBranchParams {
|
||||||
@ -72,9 +72,9 @@ public:
|
|||||||
void setParams(InsetBranchParams const & params) { params_ = params; }
|
void setParams(InsetBranchParams const & params) { params_ = params; }
|
||||||
|
|
||||||
/** \returns true if params_.branch is listed as 'selected' in
|
/** \returns true if params_.branch is listed as 'selected' in
|
||||||
\c branchlist.
|
\c buffer. This handles the case of child documents.
|
||||||
*/
|
*/
|
||||||
bool isBranchSelected(BranchList const & branchlist) const;
|
bool isBranchSelected(Buffer const & buffer) const;
|
||||||
///
|
///
|
||||||
bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
|
bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
|
||||||
|
|
||||||
|
@ -1676,7 +1676,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
case LFUN_INSERT_BRANCH:
|
case LFUN_INSERT_BRANCH:
|
||||||
code = InsetBase::BRANCH_CODE;
|
code = InsetBase::BRANCH_CODE;
|
||||||
if (buf->params().branchlist().empty())
|
if (buf->getMasterBuffer()->params().branchlist().empty())
|
||||||
enable = false;
|
enable = false;
|
||||||
break;
|
break;
|
||||||
case LFUN_INSERT_LABEL:
|
case LFUN_INSERT_LABEL:
|
||||||
|
Loading…
Reference in New Issue
Block a user