Fix the external dialog screwup (sorry JMarc !)

Apply the TOC fix


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@6550 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-20 16:58:29 +00:00
parent 31a37ba49b
commit fce31fccd7
8 changed files with 28 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2003-03-19 John Levon <levon@movementarian.org>
* toc.h:
* toc.C: store a par id not Paragraph * to avoid
TOC dialog crash on deleted par
2003-03-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ispell.C: add an include for <sys/time.h>

View File

@ -34,7 +34,7 @@ QExternalDialog::QExternalDialog(QExternal * form)
{
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(okPB, SIGNAL(clicked()),
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));

View File

@ -1,3 +1,8 @@
2003-03-19 John Levon <levon@movementarian.org>
* insetfloat.C:
* insetwrap.C: ToCItem takes par id not par
2003-01-27 Allan Rae <rae@lyx.org>
* insetinclude.C (loadIfNeeded): included files might be under

View File

@ -352,7 +352,7 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
string const str =
tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
toc::TocItem const item(tmp, 0 , str);
toc::TocItem const item(tmp->id(), 0 , str);
toclist[name].push_back(item);
}
}

View File

@ -264,7 +264,7 @@ void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
string const str =
tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
toc::TocItem const item(tmp, 0 , str);
toc::TocItem const item(tmp->id(), 0 , str);
toclist[name].push_back(item);
}
tmp = tmp->next();

View File

@ -46,7 +46,7 @@ string const TocItem::asString() const
void TocItem::goTo(LyXView & lv_) const
{
string const tmp = tostr(par->id());
string const tmp = tostr(id_);
lv_.dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
}
@ -54,7 +54,7 @@ void TocItem::goTo(LyXView & lv_) const
int TocItem::action() const
{
return lyxaction.getPseudoAction(LFUN_GOTO_PARAGRAPH,
tostr(par->id()));
tostr(id_));
}
@ -90,7 +90,7 @@ TocList const getTocList(Buffer const * buf)
&& labeltype <= LABEL_COUNTER_CHAPTER + buf->params.tocdepth) {
// insert this into the table of contents
const int depth = max(0, labeltype - textclass.maxcounter());
TocItem const item(par, depth,
TocItem const item(par->id(), depth,
par->asString(buf, true));
toclist["TOC"].push_back(item);
}

View File

@ -39,17 +39,17 @@ namespace toc
///
struct TocItem {
TocItem(Paragraph const * p, int d, string const & s)
: par(p), depth(d), str(s) {}
TocItem(int par_id, int d, string const & s)
: id_(par_id), depth(d), str(s) {}
///
string const asString() const;
/// set cursor in LyXView to this TocItem
void goTo(LyXView & lv_) const;
/// the action corresponding to the goTo above
int action() const;
///
Paragraph const * par;
///
/// Paragraph ID containing this item
int id_;
/// nesting depth
int depth;
///
string str;
@ -73,21 +73,18 @@ void asciiTocList(string const &, Buffer const *, std::ostream &);
by ControlToc::getContents() */
string const getType(string const & cmdName);
///
inline
bool operator==(TocItem const & a, TocItem const & b)
{
return a.par == b.par && a.str == b.str;
return a.id_ == b.id_ && a.str == b.str;
// No need to compare depth.
}
///
inline
bool operator!=(TocItem const & a, TocItem const & b)
{
return !(a == b);
// No need to compare depth.
}

View File

@ -40,6 +40,11 @@ What's new
** Bug fixes
- attempting to navigate to deleted text via the TOC dialog crashed
[bug #913]
- fix a new crash in 1.3.1 on OK in External dialog [Qt only]
- fix loading of included files that are under revision control
- fix support for \framebox macro: the argument is handled as text,