some nicer margins and some small cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8925 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-08-14 15:55:22 +00:00
parent 5a153a4961
commit d20f0af816
15 changed files with 149 additions and 122 deletions

View File

@ -177,7 +177,6 @@ src/mathed/formulamacro.C
src/mathed/math_hullinset.C src/mathed/math_hullinset.C
src/mathed/math_macrotemplate.C src/mathed/math_macrotemplate.C
src/mathed/math_nestinset.C src/mathed/math_nestinset.C
src/mathed/math_parboxinset.C
src/mathed/ref_inset.C src/mathed/ref_inset.C
src/output.C src/output.C
src/output_docbook.C src/output_docbook.C

View File

@ -1,10 +1,30 @@
2004-08-14 Lars Gullik Bjonnes <larsbj@lyx.org>
* text3.C: use Debug::DEBUG a bit more
* text.C (leftMargin): try to simplify a tiny bit change var x to
l_margin. Dont output the wide margins always.
(rightMargin): no margin in inner texts
* rowpainter.h (nestMargin): new func
(changebarMargin): new func
(rightMargin): new func
* rowpainter.C (paintDepthBar): changebarMargin and nestMargin is
now functions.
(paintLast): ditto
* factory.C (createInset): modify setDrawFrame
* cursor.C: use Debug::DEBUG a bit more
2004-08-14 André Pönitz <poenitz@gmx.net> 2004-08-14 André Pönitz <poenitz@gmx.net>
* coordcache.[Ch]: * coordcache.[Ch]:
* Makefile.am: new files to accomodate an 'external' (x,y)-position * Makefile.am: new files to accomodate an 'external' (x,y)-position
cache for all insets in (at least partially) visible (top-level) cache for all insets in (at least partially) visible (top-level)
paragraphs. paragraphs.
* BufferView_pimpl.C: reset external coord cache before every update. * BufferView_pimpl.C: reset external coord cache before every update.
This means the coord cache only contains valid entries. This means the coord cache only contains valid entries.

View File

@ -44,6 +44,7 @@
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <sstream> #include <sstream>
@ -96,7 +97,7 @@ namespace {
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo); double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position // '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g. '\sum_i a' // this is important for clicking behind \sum in e.g. '\sum_i a'
lyxerr << "i: " << i << " d: " << d << " best: " << best_dist << endl; lyxerr[Debug::DEBUG] << "i: " << i << " d: " << d << " best: " << best_dist << endl;
if (d <= best_dist) { if (d <= best_dist) {
best_dist = d; best_dist = d;
result = it; result = it;
@ -197,8 +198,8 @@ void LCursor::dispatch(FuncRequest const & cmd0)
FuncRequest cmd = cmd0; FuncRequest cmd = cmd0;
LCursor safe = *this; LCursor safe = *this;
for ( ; size(); pop()) { for (; size(); pop()) {
lyxerr << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl; lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
BOOST_ASSERT(pos() <= lastpos()); BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx()); BOOST_ASSERT(idx() <= lastidx());
BOOST_ASSERT(par() <= lastpar()); BOOST_ASSERT(par() <= lastpar());
@ -1001,7 +1002,7 @@ bool LCursor::goUpDown(bool up)
void LCursor::handleFont(string const & font) void LCursor::handleFont(string const & font)
{ {
lyxerr << "LCursor::handleFont: " << font << endl; lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << ": " << font << endl;
string safe; string safe;
if (selection()) { if (selection()) {
macroModeClose(); macroModeClose();
@ -1150,5 +1151,3 @@ void LCursor::noUpdate()
{ {
disp_.update(false); disp_.update(false);
} }

View File

@ -187,7 +187,7 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
if (!up) { if (!up) {
auto_ptr<InsetCaption> inset(new InsetCaption(params)); auto_ptr<InsetCaption> inset(new InsetCaption(params));
inset->setAutoBreakRows(true); inset->setAutoBreakRows(true);
inset->setDrawFrame(InsetText::LOCKED); inset->setDrawFrame(true);
inset->setFrameColor(LColor::captionframe); inset->setFrameColor(LColor::captionframe);
return inset.release(); return inset.release();
} }

View File

@ -1,4 +1,12 @@
2004-08-14 Lars Gullik Bjonnes <larsbj@lyx.org>
* insettext.[Ch] (setDrawFrame): take a bool, get rid of the
DrawFrame enum.
* insetcaption.C (InsetCaption): modify call to setDrawFrame
* insetcollapsable.C (InsetCollapsable): ditto
* insetenv.C (InsetEnvironment): ditto
2004-08-14 André Pönitz <poenitz@gmx.net> 2004-08-14 André Pönitz <poenitz@gmx.net>
* inset.[Ch]: * inset.[Ch]:
@ -9,16 +17,16 @@
* insetoptarg.C (latexOptional): if the optional argument contains * insetoptarg.C (latexOptional): if the optional argument contains
a ']' enclose it in {curly brackets} a ']' enclose it in {curly brackets}
* insettext.C (editXY): * insettext.C (editXY):
* insettabular.C (editXY): * insettabular.C (editXY):
* insetcollapsable.C (editXY): * insetcollapsable.C (editXY):
* insetbase.C (editXY): constify * insetbase.C (editXY): constify
* insetcollapsable.C (priv_dispatch): on a mouse press event, do * insetcollapsable.C (priv_dispatch): on a mouse press event, do
not ask for an update if we did nothing; on a mouse release, make not ask for an update if we did nothing; on a mouse release, make
sure that the cursor is moved to the right position; on a mouse sure that the cursor is moved to the right position; on a mouse
release, exit from the inset instead of invoking a release, exit from the inset instead of invoking a
LFUN_FINISHED_RIGHT. LFUN_FINISHED_RIGHT.
* insetbase.C (dispatch): before invoking dispatch, set cursor * insetbase.C (dispatch): before invoking dispatch, set cursor
result to dispatch=update=true. result to dispatch=update=true.

View File

@ -44,7 +44,7 @@ InsetCaption::InsetCaption(BufferParams const & bp)
: InsetText(bp) : InsetText(bp)
{ {
setAutoBreakRows(true); setAutoBreakRows(true);
setDrawFrame(InsetText::LOCKED); setDrawFrame(true);
setFrameColor(LColor::captionframe); setFrameColor(LColor::captionframe);
} }

View File

@ -55,7 +55,7 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp,
: InsetText(bp), label("Label"), status_(status), openinlined_(false) : InsetText(bp), label("Label"), status_(status), openinlined_(false)
{ {
setAutoBreakRows(true); setAutoBreakRows(true);
setDrawFrame(InsetText::ALWAYS); setDrawFrame(true);
setFrameColor(LColor::collapsableframe); setFrameColor(LColor::collapsableframe);
setInsetName("Collapsable"); setInsetName("Collapsable");
setButtonLabel(); setButtonLabel();
@ -253,16 +253,16 @@ InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd) void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd)
{ {
// lyxerr << "InsetCollapsable::priv_dispatch (begin): cmd: " << cmd // lyxerr << "InsetCollapsable::priv_dispatch (begin): cmd: " << cmd
// << " button y: " << button_dim.y2 // << " button y: " << button_dim.y2
// << " coll/inline/open: " << status_ << endl; // << " coll/inline/open: " << status_ << endl;
switch (cmd.action) { switch (cmd.action) {
case LFUN_MOUSE_PRESS: case LFUN_MOUSE_PRESS:
if (status_ == Inlined) if (status_ == Inlined)
InsetText::priv_dispatch(cur, cmd); InsetText::priv_dispatch(cur, cmd);
else if (status_ == Open && !hitButton(cmd)) else if (status_ == Open && !hitButton(cmd))
InsetText::priv_dispatch(cur, cmd); InsetText::priv_dispatch(cur, cmd);
else else
cur.noUpdate(); cur.noUpdate();
break; break;

View File

@ -32,7 +32,7 @@ InsetEnvironment::InsetEnvironment
{ {
setInsetName(name); setInsetName(name);
setAutoBreakRows(true); setAutoBreakRows(true);
setDrawFrame(ALWAYS); setDrawFrame(true);
} }

View File

@ -69,7 +69,7 @@ using std::vector;
InsetText::InsetText(BufferParams const & bp) InsetText::InsetText(BufferParams const & bp)
: autoBreakRows_(false), drawFrame_(NEVER), : autoBreakRows_(false), drawFrame_(false),
frame_color_(LColor::insetframe), text_(0) frame_color_(LColor::insetframe), text_(0)
{ {
paragraphs().push_back(Paragraph()); paragraphs().push_back(Paragraph());
@ -205,7 +205,7 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
text_.draw(pi, x, y + bv->top_y()); text_.draw(pi, x, y + bv->top_y());
if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED) if (drawFrame_)
drawFrame(pi.pain, x, y); drawFrame(pi.pain, x, y);
} }
@ -306,7 +306,7 @@ void InsetText::edit(LCursor & cur, bool left)
InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
{ {
lyxerr << "InsetText::edit xy" << endl; lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << endl;
old_par = -1; old_par = -1;
return text_.editXY(cur, x, y); return text_.editXY(cur, x, y);
//sanitizeEmptyText(cur.bv()); //sanitizeEmptyText(cur.bv());
@ -448,9 +448,9 @@ void InsetText::setAutoBreakRows(bool flag)
} }
void InsetText::setDrawFrame(DrawFrame how) void InsetText::setDrawFrame(bool flag)
{ {
drawFrame_ = how; drawFrame_ = flag;
} }

View File

@ -38,15 +38,6 @@ class Row;
*/ */
class InsetText : public UpdatableInset { class InsetText : public UpdatableInset {
public: public:
///
enum DrawFrame {
///
NEVER = 0,
///
LOCKED,
///
ALWAYS
};
/// ///
explicit InsetText(BufferParams const &); explicit InsetText(BufferParams const &);
/// ///
@ -102,7 +93,7 @@ public:
/// ///
bool getAutoBreakRows() const { return autoBreakRows_; } bool getAutoBreakRows() const { return autoBreakRows_; }
/// ///
void setDrawFrame(DrawFrame); void setDrawFrame(bool);
/// ///
LColor_color frameColor() const; LColor_color frameColor() const;
/// ///
@ -174,7 +165,7 @@ private:
/// ///
bool autoBreakRows_; bool autoBreakRows_;
/// ///
DrawFrame drawFrame_; bool drawFrame_;
/** We store the LColor::color value as an int to get LColor.h out /** We store the LColor::color value as an int to get LColor.h out
* of the header file. * of the header file.
*/ */

View File

@ -47,9 +47,6 @@ using std::endl;
using std::max; using std::max;
using std::string; using std::string;
extern int NEST_MARGIN;
extern int CHANGEBAR_MARGIN;
namespace { namespace {
@ -129,8 +126,10 @@ RowPainter::RowPainter(BufferView const & bv, Painter & pain,
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo << " yo: " << yo //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo << " yo: " << yo
// << " pit->y: " << pit_->y // << " pit->y: " << pit_->y
// << " row: " << (pars_[pit_].size() ? pars_[pit_].getChar(row_.pos()) : 'X') << endl; // << " row: " << (pars_[pit_].size() ? pars_[pit_].getChar(row_.pos()) : 'X') << endl;
RowMetrics m = text_.computeRowMetrics(pit, row_); RowMetrics m = text_.computeRowMetrics(pit, row_);
x_ = m.x + xo_; x_ = m.x + xo_;
separator_ = m.separator; separator_ = m.separator;
hfill_ = m.hfill; hfill_ = m.hfill;
label_hfill_ = m.label_hfill; label_hfill_ = m.label_hfill;
@ -544,11 +543,12 @@ void RowPainter::paintDepthBar()
} }
for (Paragraph::depth_type i = 1; i <= depth; ++i) { for (Paragraph::depth_type i = 1; i <= depth; ++i) {
int const w = NEST_MARGIN / 5; int const w = nestMargin() / 5;
int x = int(w * i + xo_); int x = xo_ + w * i;
// only consider the changebar space if we're drawing outer left // only consider the changebar space if we're drawing outer left
if (xo_ == 0) if (xo_ == 0)
x += CHANGEBAR_MARGIN; x += changebarMargin();
int const h = yo_ + row_.height() - 1 - (i - next_depth - 1) * 3; int const h = yo_ + row_.height() - 1 - (i - next_depth - 1) * 3;
pain_.line(x, yo_, x, h, LColor::depthbar); pain_.line(x, yo_, x, h, LColor::depthbar);
@ -718,7 +718,7 @@ void RowPainter::paintLast()
LyXFont const font = getLabelFont(); LyXFont const font = getLabelFont();
int const size = int(0.75 * font_metrics::maxAscent(font)); int const size = int(0.75 * font_metrics::maxAscent(font));
int const y = yo_ + row_.baseline() - size; int const y = yo_ + row_.baseline() - size;
int x = is_rtl ? NEST_MARGIN + CHANGEBAR_MARGIN: width_ - size; int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
if (width_ - int(row_.width()) <= size) if (width_ - int(row_.width()) <= size)
x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1); x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1);

View File

@ -29,4 +29,25 @@ void refreshPar(BufferView const & bv, LyXText const & text,
/// paint the rows of a text inset /// paint the rows of a text inset
void paintTextInset(LyXText const & text, PainterInfo & pi); void paintTextInset(LyXText const & text, PainterInfo & pi);
/// some space for drawing the 'nested' markers (in pixel)
inline int nestMargin()
{
return 15;
}
/// margin for changebar
inline int changebarMargin()
{
return 10;
}
/// right margin
inline int rightMargin()
{
return 30;
}
#endif // ROWPAINTER_H #endif // ROWPAINTER_H

View File

@ -377,7 +377,9 @@ void LyXTabular::fixCellNums()
int cellno = 0; int cellno = 0;
for (int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
cell_info[i][j].inset.setDrawFrame(InsetText::LOCKED); // When debugging it can be nice to set
// this to true.
cell_info[i][j].inset.setDrawFrame(false);
cell_info[i][j].cellno = cellno++; cell_info[i][j].cellno = cellno++;
} }
cell_info[i].back().right_line = true; cell_info[i].back().right_line = true;

View File

@ -90,14 +90,6 @@ using std::endl;
using std::string; using std::string;
/// some space for drawing the 'nested' markers (in pixel)
extern int const NEST_MARGIN = 20;
/// margin for changebar
extern int const CHANGEBAR_MARGIN = 10;
/// right margin
extern int const RIGHT_MARGIN = 10;
namespace { namespace {
int numberOfSeparators(Paragraph const & par, Row const & row) int numberOfSeparators(Paragraph const & par, Row const & row)
@ -506,40 +498,26 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
string parindent = layout->parindent; string parindent = layout->parindent;
int x = NEST_MARGIN + CHANGEBAR_MARGIN; int l_margin = 0;
x += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont()); if (xo_ == 0)
l_margin += changebarMargin();
// This is the way LyX handles LaTeX-Environments. l_margin += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
// I have had this idea very late, so it seems to be a
// later added hack and this is true if (pars_[pit].getDepth() != 0) {
if (pars_[pit].getDepth() == 0) { // find the next level paragraph
if (pars_[pit].layout() == tclass.defaultLayout()) { par_type newpar = outerHook(pit, pars_);
// find the previous same level paragraph if (newpar != par_type(pars_.size())) {
if (pit != 0) { if (pars_[newpar].layout()->isEnvironment()) {
par_type newpit = l_margin = leftMargin(newpar);
depthHook(pit, paragraphs(), pars_[pit].getDepth()); }
if (newpit == pit && pars_[newpit].layout()->nextnoindent) if (pars_[pit].layout() == tclass.defaultLayout()) {
parindent.erase(); if (pars_[newpar].params().noindent())
parindent.erase();
else
parindent = pars_[newpar].layout()->parindent;
} }
}
} else {
// find the next level paragraph
par_type newpar = outerHook(pit, pars_);
// Make a corresponding row. Need to call leftMargin()
// to check whether it is a sufficent paragraph.
if (newpar != par_type(pars_.size())
&& pars_[newpar].layout()->isEnvironment()) {
x = leftMargin(newpar);
}
if (newpar != par_type(paragraphs().size())
&& pars_[pit].layout() == tclass.defaultLayout()) {
if (pars_[newpar].params().noindent())
parindent.erase();
else
parindent = pars_[newpar].layout()->parindent;
} }
} }
@ -547,41 +525,41 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
switch (layout->margintype) { switch (layout->margintype) {
case MARGIN_DYNAMIC: case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty()) if (!layout->leftmargin.empty())
x += font_metrics::signedWidth(layout->leftmargin, l_margin += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont()); tclass.defaultfont());
if (!pars_[pit].getLabelstring().empty()) { if (!pars_[pit].getLabelstring().empty()) {
x += font_metrics::signedWidth(layout->labelindent, l_margin += font_metrics::signedWidth(layout->labelindent,
labelfont); labelfont);
x += font_metrics::width(pars_[pit].getLabelstring(), l_margin += font_metrics::width(pars_[pit].getLabelstring(),
labelfont); labelfont);
x += font_metrics::width(layout->labelsep, labelfont); l_margin += font_metrics::width(layout->labelsep, labelfont);
} }
break; break;
case MARGIN_MANUAL: case MARGIN_MANUAL:
x += font_metrics::signedWidth(layout->labelindent, labelfont); l_margin += font_metrics::signedWidth(layout->labelindent, labelfont);
// The width of an empty par, even with manual label, should be 0 // The width of an empty par, even with manual label, should be 0
if (!pars_[pit].empty() && pos >= pars_[pit].beginOfBody()) { if (!pars_[pit].empty() && pos >= pars_[pit].beginOfBody()) {
if (!pars_[pit].getLabelWidthString().empty()) { if (!pars_[pit].getLabelWidthString().empty()) {
x += font_metrics::width(pars_[pit].getLabelWidthString(), l_margin += font_metrics::width(pars_[pit].getLabelWidthString(),
labelfont); labelfont);
x += font_metrics::width(layout->labelsep, labelfont); l_margin += font_metrics::width(layout->labelsep, labelfont);
} }
} }
break; break;
case MARGIN_STATIC: case MARGIN_STATIC:
x += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4 l_margin += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4
/ (pars_[pit].getDepth() + 4); / (pars_[pit].getDepth() + 4);
break; break;
case MARGIN_FIRST_DYNAMIC: case MARGIN_FIRST_DYNAMIC:
if (layout->labeltype == LABEL_MANUAL) { if (layout->labeltype == LABEL_MANUAL) {
if (pos >= pars_[pit].beginOfBody()) { if (pos >= pars_[pit].beginOfBody()) {
x += font_metrics::signedWidth(layout->leftmargin, l_margin += font_metrics::signedWidth(layout->leftmargin,
labelfont); labelfont);
} else { } else {
x += font_metrics::signedWidth(layout->labelindent, l_margin += font_metrics::signedWidth(layout->labelindent,
labelfont); labelfont);
} }
} else if (pos != 0 } else if (pos != 0
@ -589,17 +567,17 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
// theorems (JMarc) // theorems (JMarc)
|| (layout->labeltype == LABEL_STATIC || (layout->labeltype == LABEL_STATIC
&& layout->latextype == LATEX_ENVIRONMENT && layout->latextype == LATEX_ENVIRONMENT
&& !isFirstInSequence(pit, paragraphs()))) { && !isFirstInSequence(pit, pars_))) {
x += font_metrics::signedWidth(layout->leftmargin, l_margin += font_metrics::signedWidth(layout->leftmargin,
labelfont); labelfont);
} else if (layout->labeltype != LABEL_TOP_ENVIRONMENT } else if (layout->labeltype != LABEL_TOP_ENVIRONMENT
&& layout->labeltype != LABEL_BIBLIO && layout->labeltype != LABEL_BIBLIO
&& layout->labeltype != && layout->labeltype !=
LABEL_CENTERED_TOP_ENVIRONMENT) { LABEL_CENTERED_TOP_ENVIRONMENT) {
x += font_metrics::signedWidth(layout->labelindent, l_margin += font_metrics::signedWidth(layout->labelindent,
labelfont); labelfont);
x += font_metrics::width(layout->labelsep, labelfont); l_margin += font_metrics::width(layout->labelsep, labelfont);
x += font_metrics::width(pars_[pit].getLabelstring(), l_margin += font_metrics::width(pars_[pit].getLabelstring(),
labelfont); labelfont);
} }
break; break;
@ -617,19 +595,18 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
for ( ; rit != end; ++rit) for ( ; rit != end; ++rit)
if (rit->fill() < minfill) if (rit->fill() < minfill)
minfill = rit->fill(); minfill = rit->fill();
x += font_metrics::signedWidth(layout->leftmargin, l_margin += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont()); tclass.defaultfont());
x += minfill; l_margin += minfill;
#endif #endif
// also wrong, but much shorter. // also wrong, but much shorter.
x += maxwidth_ / 2; l_margin += maxwidth_ / 2;
break; break;
} }
} }
if (!pars_[pit].params().leftIndent().zero()) if (!pars_[pit].params().leftIndent().zero())
x += pars_[pit].params().leftIndent().inPixels(maxwidth_); l_margin += pars_[pit].params().leftIndent().inPixels(maxwidth_);
LyXAlignment align; LyXAlignment align;
@ -645,20 +622,20 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
|| (layout->labeltype == LABEL_STATIC || (layout->labeltype == LABEL_STATIC
&& layout->latextype == LATEX_ENVIRONMENT && layout->latextype == LATEX_ENVIRONMENT
&& !isFirstInSequence(pit, paragraphs()))) && !isFirstInSequence(pit, pars_)))
&& align == LYX_ALIGN_BLOCK && align == LYX_ALIGN_BLOCK
&& !pars_[pit].params().noindent() && !pars_[pit].params().noindent()
// in tabulars and ert paragraphs are never indented! // in tabulars and ert paragraphs are never indented!
&& (pars_[pit].ownerCode() != InsetOld::TABULAR_CODE && (pars_[pit].ownerCode() != InsetBase::TEXT_CODE
&& pars_[pit].ownerCode() != InsetOld::ERT_CODE) && pars_[pit].ownerCode() != InsetBase::ERT_CODE)
&& (pars_[pit].layout() != tclass.defaultLayout() && (pars_[pit].layout() != tclass.defaultLayout()
|| bv()->buffer()->params().paragraph_separation == || bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT)) BufferParams::PARSEP_INDENT))
{ {
x += font_metrics::signedWidth(parindent, tclass.defaultfont()); l_margin += font_metrics::signedWidth(parindent, tclass.defaultfont());
} }
return x; return l_margin;
} }
@ -666,13 +643,20 @@ int LyXText::rightMargin(Paragraph const & par) const
{ {
LyXTextClass const & tclass = bv()->buffer()->params().getLyXTextClass(); LyXTextClass const & tclass = bv()->buffer()->params().getLyXTextClass();
return // We do not want rightmargins on inner texts.
RIGHT_MARGIN if (bv()->text() != this)
return 0;
int const r_margin =
::rightMargin()
+ font_metrics::signedWidth(tclass.rightmargin(), + font_metrics::signedWidth(tclass.rightmargin(),
tclass.defaultfont()) tclass.defaultfont())
+ font_metrics::signedWidth(par.layout()->rightmargin, + font_metrics::signedWidth(par.layout()->rightmargin,
tclass.defaultfont()) tclass.defaultfont())
* 4 / (par.getDepth() + 4); * 4 / (par.getDepth() + 4);
return r_margin;
} }

View File

@ -186,7 +186,7 @@ string const freefont2string()
// takes absolute x,y coordinates // takes absolute x,y coordinates
InsetBase * LyXText::checkInsetHit(int x, int y) const InsetBase * LyXText::checkInsetHit(int x, int y) const
{ {
par_type pit; par_type pit;
par_type end; par_type end;
@ -196,15 +196,17 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const
bv()->top_y() - yo_ + bv()->workHeight(), bv()->top_y() - yo_ + bv()->workHeight(),
pit, end); pit, end);
lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl; lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
lyxerr << " pit: " << pit << " end: " << end << endl; << ": x: " << x << " y: " << y
<< " pit: " << pit << " end: " << end << endl;
for (; pit != end; ++pit) { for (; pit != end; ++pit) {
InsetList::const_iterator iit = pars_[pit].insetlist.begin(); InsetList::const_iterator iit = pars_[pit].insetlist.begin();
InsetList::const_iterator iend = pars_[pit].insetlist.end(); InsetList::const_iterator iend = pars_[pit].insetlist.end();
for (; iit != iend; ++iit) { for (; iit != iend; ++iit) {
InsetBase * inset = iit->inset; InsetBase * inset = iit->inset;
#if 1 #if 1
lyxerr << "examining inset " << inset << endl; lyxerr[Debug::DEBUG]
<< "examining inset " << inset << endl;
if (theCoords.insets_.has(inset)) if (theCoords.insets_.has(inset))
lyxerr lyxerr
<< " xo: " << inset->xo() << "..." << inset->xo() + inset->width() << " xo: " << inset->xo() << "..." << inset->xo() + inset->width()
@ -214,12 +216,13 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const
lyxerr << " inset has no cached position"; lyxerr << " inset has no cached position";
#endif #endif
if (inset->covers(x, y)) { if (inset->covers(x, y)) {
lyxerr << "Hit inset: " << inset << endl; lyxerr[Debug::DEBUG]
<< "Hit inset: " << inset << endl;
return inset; return inset;
} }
} }
} }
lyxerr << "No inset hit. " << endl; lyxerr[Debug::DEBUG] << "No inset hit. " << endl;
return 0; return 0;
} }
@ -1448,21 +1451,21 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
} }
case LFUN_FINISHED_LEFT: case LFUN_FINISHED_LEFT:
lyxerr << "handle LFUN_FINISHED_LEFT:\n" << cur << endl; lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
break; break;
case LFUN_FINISHED_RIGHT: case LFUN_FINISHED_RIGHT:
lyxerr << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl; lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
++cur.pos(); ++cur.pos();
break; break;
case LFUN_FINISHED_UP: case LFUN_FINISHED_UP:
lyxerr << "handle LFUN_FINISHED_UP:\n" << cur << endl; lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_UP:\n" << cur << endl;
cursorUp(cur); cursorUp(cur);
break; break;
case LFUN_FINISHED_DOWN: case LFUN_FINISHED_DOWN:
lyxerr << "handle LFUN_FINISHED_DOWN:\n" << cur << endl; lyxerr[Debug::DEBUG] << "handle LFUN_FINISHED_DOWN:\n" << cur << endl;
cursorDown(cur); cursorDown(cur);
break; break;