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> 2003-03-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ispell.C: add an include for <sys/time.h> * ispell.C: add an include for <sys/time.h>

View File

@ -34,7 +34,7 @@ QExternalDialog::QExternalDialog(QExternal * form)
{ {
connect(okPB, SIGNAL(clicked()), connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK())); form, SLOT(slotOK()));
connect(okPB, SIGNAL(clicked()), connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply())); form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose())); 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> 2003-01-27 Allan Rae <rae@lyx.org>
* insetinclude.C (loadIfNeeded): included files might be under * 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 = string const str =
tostr(toclist[name].size() + 1) tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false); + ". " + tmp->asString(buf, false);
toc::TocItem const item(tmp, 0 , str); toc::TocItem const item(tmp->id(), 0 , str);
toclist[name].push_back(item); toclist[name].push_back(item);
} }
} }

View File

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

View File

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

View File

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

View File

@ -40,6 +40,11 @@ What's new
** Bug fixes ** 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 loading of included files that are under revision control
- fix support for \framebox macro: the argument is handled as text, - fix support for \framebox macro: the argument is handled as text,