This is a kind of hack. This allows InsetMathHull to state that it
needs some elbow room beyond its width, in order to fit the numbering
and/or the left margin (with left alignment), which are outside of the
inset itself.
To this end, InsetMathHull::metrics() sets a value in
MetricsInfo::extrawidth and this value is added later to the width of
the row that contains the inset (when this row is tight or shorter
than the max allowed width).
Fixes bug #12320.
Until now only the color of the text could be changed by using
the text properties dialog. This commit allows changing all
other properties except for strikethrough. It is possible to
also add underlining with the limitation that the changes
accumulate. This requires other work but I think that underlining
and strikethrough are not so important in mathed and can be
refined at a later time.
Fixes#12958
Some text-in-math environments such as \text, \mbox, \fbox, and
\makebox, inherit the outer text font. This commit reflects this
in the on-screen representation.
Fixes#12950.
This is a kind of hack. This allows InsetMathHull to state that it
needs some elbow room beyond its width, in order to fit the numbering
and/or the left margin (with left alignment), which are outside of the
inset itself.
To this end, InsetMathHull::metrics() sets a value in
MetricsInfo::extrawidth and this value is recorded later in the
corresponding row element's `extra' field.
The code could be reorganized to be simpler, in particular by
computing metrics in tokenizeRow, or after tokenizeRow. However the
choice here is to produce a simple patch, fit for 2.4.0.
Fixes bug #12320.
This requires the introduction of the booleans selected_left and
selected_right in PainterInfo. These tell whether the selection
continues at the left/right of the inset.
This information allows to
1/ paint equation number in the right color: either current text color
or selection text color.
2/ before that, paint a small background rectangle of the correct color.
This allows to avoid painting a large rectangle of an arbitrary color
that was the cause of the bug.
Fixes bug #12319.
This extra spacing was missing and is important for detecting extra
par breaks before equations (which are most of the times not wanted).
To do that, add a new member vmode to MetricsInfo which is equivalent
to LaTeX's \ifvmode (start of paragraph).
If in vmode, add the equivalent of an empty line before a display math inset.
At the same time, tweak value of \(above|below)displayskip, which was
12pt, whereas LaTeX uses 10pt in 10pt size (our reference).
Fixes bug #11891.
74540c98 was a fixup of d207e85c, which avoided using inset background
as inset label background.
d207e85c introduced a background under inset labels to avoid fake bold
effect.
Hopefully, this last variation will be the right one !
This is the first (easiest) step in fixing bugs 10668 and 11333.
The numbering is now drawn outside of the insets, which solves the
alignment problems and make editing easier.
What does not work yet:
- long labels will overwrite equations. To fix this, we need to
implement the same algorithm as LaTeX and put labels on their own
row when required.
- previews may need to be adapted similarly to fit the whole screen width
A basic class like Length should not depend on something from
frontend.
This change allows to remove several dummy implementations of
theFontMetrics().
The trick is to remember in BufferView what has been done at the
previous draw, so that the row that contained the caret can be
repainted if needed.
To this end, add an argument paint_caret to BufferView, although
painting the caret is not the job of the BufferView (at this point).
BufferView::needRepaint will act as an interface with
TextMetrics::drawParagraph to know whether the painting of a given
row should be forced.
Currently everything is done at the top row level, so that, if the
caret is in a large table, the whole table will have to be repainted.
It is not clear yet that this is necessary.
About removing the changeEnsureMath in MathMacro::{metrics,draw} : as it is only
called in edition mode, it only happened for user macros for which no ensureMath
is needed anyway. ChangeEnsureMath should indeed be applied for global macros,
but since they are linearized there is no obvious place to call it.
In fact having an extra parameter "bool cond" is no longer useful because it can
now always be emulated with a ternary operator:
Changers dummy = cond ? do_change() : Changer();
Move math style to FontInfo and compute the font sizes for scriptstyle and
scriptscriptstyle according to standard proportions: 0.73 and 0.55.
This is simpler and more accurate. It also fixes the font size of
${\scriptscriptstyle {\textstyle A}}A$ which exposed the limitations of the
previous approach.
There is no reason to reserve pixel space in macros replacement text,
which is not editable. This makes macros more compact and eases the
writing of lib/symbols.
* introduce new InsetMath::drawMarkers and friends that do nothing
when nested inside a macro. This required to move macro_nesting
inside MetricsBase, and to pass MetricsInfo & to metricsMarkers.
* keep track of nesting when drawing rows or macros.
Empty insets should use a minimal amount of space, especially when
they are part of a built-in macro in lib/symbols.
With this change, blue rectangles signal actually editable places.
Empty macros in editable data are shown as grey boxes, but they do not
appear when further nested.
This is done by adding a new type BOX of MathRow::Element object and a
MetricsInfo::macro_nesting that keeps track of macros (and is reset to
0 in editable macro arguments).
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
* Inset::canTrackChange() had two meanings: can it deal with change tracking?
Will it paint its own CT status? The latter information is now given by
Inset::canPaintChange().
* Line thickness computation is moved from RowPainter to MetricsBase.
* Painting function for Changes moved to lyx::Change. (One new, that strikes
diagonally.)
RefChanger temporarily assigns a value to a non-const reference of any
kind. RefChanger provides a flexible and uniform generalisation of the various
scope guards previously derived from the old Changer class in MetricsInfo.h.
As before, a temporary assignment lasts as long as the Changer object lives. But
the new Changer is movable. In particular, contorsions are no longer needed to
change a private field. Special code can be moved into the appropriate classes,
and it is no longer necessary to create a new class for each specific use.
Syntax change:
FontSetChanger dummy(mi.base, value);
-> Changer dummy = mi.base.changeFontSet(value);
New function for generating arbitrary Changers:
Changer dummy = make_change(ref, val, condition);
Bugfix:
* Fix the display of \displaystyle{\substack{\frac{xyz}{}}} (missing style
change).
This popped up in cmake monolithic build once. It looks like BufferView is
included indirectly by some of the other headers (otherwise we would have seen
compile errors for other build configurations as well), bu I'll keep the
forward declaration since we don't want to depend on this indirect header
inclusion.
The document iterator now skips math insets and insets like notes where spell check is disabled.
The continuous spell checking is part of the row painter drawing and the spell check disabled state
has to be passed down recursively while doing the inset painting.
selection and chage tracking state
InsetTabular::drawCellLines: use the above function to draw properly tabular lines after a selection.
This method can be used easily for other insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35268 a592a061-630c-0410-9148-cb99ea01b6c8
\mathbb{\underbar{a}} is not correctly rendered on screen.
We really have to change the font set, but not always.
This cannot be done using an "if" statement, as when
the FontSetChanger scope ends, everything is restored,
defeating our change. Thus, this has to be done in the
FontSetChanger class itself. This is easily accomplished
by introducing a boolean with a default value of true
for really changing a font set.
This will also be useful in other cases that I am discovering.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34312 a592a061-630c-0410-9148-cb99ea01b6c8
* ParagraphMetrics::computeRowSignature(): Integrate row's dimensions and selection status in the row signature.
* TextMetrics::drawParagraph(): compute the row signature here and rely on that to decide if a redraw is needed or not.
* BufferView::Private: get rid of the ViewMetricsInfo member. Just keep the ScreenUpdateStrategy.
* BufferView::draw(): full screen update even for singlePar case because the row signature will detect if something needs to be redrawn.
* Text3.cpp: get rid of hack following architecture update.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21650 a592a061-630c-0410-9148-cb99ea01b6c8
hope there are only conforming implementaions out there ;-}
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21312 a592a061-630c-0410-9148-cb99ea01b6c8
* Font::FontBits -> FontInfo
* Font::FONT_XXX -> all enums transfered to FontEnums.h and renamed to FontXxx
I've replaced Font uses with FontInfo were the language() member was not needed, basically all draw() and metrics methods. There's one problematic cases with InsetQuotes which I solved by taking the Buffer main language.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21240 a592a061-630c-0410-9148-cb99ea01b6c8