bugs 1013, 1017

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6728 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-07 20:32:29 +00:00
parent 5d67f7c617
commit 0003b5e76c
4 changed files with 21 additions and 44 deletions

View File

@ -1,3 +1,13 @@
2003-04-07 John Levon <levon@movementarian.org>
* paragraph.C: remove dead comment
* text.C: remove troublesome depth-fiddling code
in leftMargin() and rightMargin() (bug 1017)
* text2.C (updateCounters): fix up depth values
(bug 1013)
2003-04-07 John Levon <levon@movementarian.org>
* BufferView_pimpl.C: clear message when doc finishes resizing,

View File

@ -433,8 +433,6 @@ LyXFont const Paragraph::getFirstFontSettings() const
// The difference is that this one is used for generating the LaTeX file,
// and thus cosmetic "improvements" are disallowed: This has to deliver
// the true picture of the buffer. (Asger)
// If position is -1, we get the layout font of the paragraph.
// If position is -2, we get the font of the manual label of the paragraph.
LyXFont const Paragraph::getFont(BufferParams const & bparams,
pos_type pos) const
{

View File

@ -543,7 +543,7 @@ int LyXText::leftMargin(Row const & row) const
Paragraph * newpar = row.par()->outerHook();
// make a corresponding row. Needed to call LeftMargin()
// make a corresponding row. Needed to call leftMargin()
// check wether it is a sufficent paragraph
if (newpar && newpar->layout()->isEnvironment()) {
@ -551,12 +551,6 @@ int LyXText::leftMargin(Row const & row) const
dummyrow.par(newpar);
dummyrow.pos(newpar->size());
x = leftMargin(dummyrow);
} else {
// this is no longer an error, because this function
// is used to clear impossible depths after changing
// a layout. Since there is always a redo,
// LeftMargin() is always called
row.par()->params().depth(0);
}
if (newpar && row.par()->layout() == tclass.defaultLayout()) {
@ -717,38 +711,6 @@ int LyXText::rightMargin(Buffer const & buf, Row const & row) const
+ font_metrics::signedWidth(tclass.rightmargin(),
tclass.defaultfont());
// this is the way, LyX handles the LaTeX-Environments.
// I have had this idea very late, so it seems to be a
// later added hack and this is true
if (row.par()->getDepth()) {
// find the next level paragraph
ParagraphList::iterator newpit = row.par();
do {
--newpit;
} while (newpit != ownerParagraphs().begin()
&& newpit->getDepth() >= row.par()->getDepth());
// make a corresponding row. Needed to call LeftMargin()
// check wether it is a sufficent paragraph
if (newpit != ownerParagraphs().begin() &&
newpit->layout()->isEnvironment()) {
Row dummyrow;
dummyrow.par(newpit);
dummyrow.pos(0);
x = rightMargin(buf, dummyrow);
} else {
// this is no longer an error, because this function
// is used to clear impossible depths after changing
// a layout. Since there is always a redo,
// LeftMargin() is always called
row.par()->params().depth(0);
}
}
//lyxerr << "rightmargin: " << layout->rightmargin << endl;
x += font_metrics::signedWidth(layout->rightmargin,
tclass.defaultfont())
* 4 / (row.par()->getDepth() + 4);
@ -841,9 +803,6 @@ LyXText::rowBreakPoint(Row const & row) const
getLabelFont(bv()->buffer(), &*pit));
if (pit->isLineSeparator(i - 1))
thiswidth -= singleWidth(&*pit, i - 1);
int left_margin = labelEnd(row);
if (thiswidth < left_margin)
thiswidth = left_margin;
}
x += thiswidth;

View File

@ -519,7 +519,10 @@ bool LyXText::changeDepth(bv_funcs::DEPTH_CHANGE type, bool test_only)
setCursor(selection.end.par(), selection.end.pos());
}
// this handles the counter labels, and also fixes up
// depth values for follow-on (child) paragraphs
updateCounters();
setSelection();
setCursor(tmpcursor.par(), tmpcursor.pos());
@ -1237,6 +1240,13 @@ void LyXText::updateCounters()
string const oldLabel = pit->params().labelString();
int maxdepth = 0;
if (pit != ownerParagraphs().begin())
maxdepth = boost::prior(pit)->getMaxDepthAfter();
if (pit->params().depth() > maxdepth)
pit->params().depth(maxdepth);
// setCounter can potentially change the labelString.
setCounter(bv()->buffer(), &*pit);