- get rid of the cached Dimension. Text inset dimensions are saved in ParagraphMetrics and mathed maintain their own dimension where needed.
- width(), ascent(), descent(): deleted.
- dimension(): now needs a valid BufferView.
- metrics(): now void.
* BufferView::getCoveringInset(): simplify.
* ParagraphMetrics(): now cache inset dimensions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20420 a592a061-630c-0410-9148-cb99ea01b6c8
- Modifier on return type ignored
- Ambigous else
- Ambigous logical operators
- Semi-colon instead of empty block
- Missing header files
- Missing using std::XX
- Initialization out of order
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20304 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView:
- new scroll(), scrollDown() and scrollUp() method for pixel scrolling.
- new LFUN_SCREEN_UP/DOWN handling.
* TextMetrics: new helper and access methods.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20283 a592a061-630c-0410-9148-cb99ea01b6c8
* Row:
- setSelection(): set selection begin and end for this row.
- sel_beg, sel_end: new public members.
* BufferView::draw()
- do not trigger a full repaint for selection.
- use TextMetrics::draw() instead of hand calling TextMetrics::drawParagraph().
* InsetText::draw(): don't call TextMetrics::drawSelection().
* InsetMathMBox::drawSelection(): remove.
* TextMetrics:
- drawSelection(): simplify a bit. Now private.
- redoParagraph(): memorize Row selection status.
- x2pos(): fix crash when selecting with PageDown.
- draw(): fill-in the ParPos cache before everything else and not in drawParagraph().
- drawParagraph(): take care of row selection painting.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20066 a592a061-630c-0410-9148-cb99ea01b6c8
do the work, unless we really have a reason not to (fixes bug 4133)
* mathed/InsetMathNest.cpp (lfunMousePress): refactor the code to use
BufferView::mouseSetCursor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19506 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetMathOverset.cpp (draw): fix drawing when the first argument
has a non-zero descent.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19060 a592a061-630c-0410-9148-cb99ea01b6c8
- we don't require wasysym any more. Either esint or amsmath is used, depending if esint is installed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18857 a592a061-630c-0410-9148-cb99ea01b6c8
* Moreover the marker metrics calls are removed as they are not drawn anyway.
(fixes#3705)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18792 a592a061-630c-0410-9148-cb99ea01b6c8
up/down to tell the insets that the cursor left them. The
notifyCursorLeaves methods can set updateFlags to trigger a redraw.
* leave mathed with cursor up/down and get the math redrawn for the
decorations
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18773 a592a061-630c-0410-9148-cb99ea01b6c8
for translating keystrokes. Up until now, the switching was done in advance
in all kinds of situations, but not just before translating was actually done
--- which resulted in the KeyMap not always being switched on time...
This solves bug #3811 (http://bugzilla.lyx.org/show_bug.cgi?id=3811)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18744 a592a061-630c-0410-9148-cb99ea01b6c8
Only newly created inset were entered everytime.
* Derived classes of CommandInset do not draw all cells, so return false.
(fixes http://bugzilla.lyx.org/show_bug.cgi?id=3715)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18742 a592a061-630c-0410-9148-cb99ea01b6c8
It also solve a crash with non disconnect boost::signal and gcc-3.3 or 3.4.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18592 a592a061-630c-0410-9148-cb99ea01b6c8
dispatchers in mathed and text only do local work, i.e. only try to
move the cursor with their local knowledge, not globally as before in
the Cursor::goUpDown function before. The old approach used one of
brutefind functions as a last way out to really move the cursor up or
down. The result was some strange behavior that the nearest inset was
selected when jumping from math to text, not one in the next line.
2. removed LFUN_FINISHED_UP/DOWN, as there seem to be no effect and it
seems to be obsolete.
3. target_x is working again, mainly by adding a textTargetOffset_
member to the Cursor which keeps the difference between the target_x
and the actual position of the cursor on screen. As long as
pos+offset=target is fulfilled the target_x is not touched and the
cursor keep the column while going up/down.
4. moved the text cursor up/down code to the Cursor class, in analogy
to the mathed code.
5. For 1 it is necessary to know the cursor position before the
dispatch. So this data is added to the Cursor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18569 a592a061-630c-0410-9148-cb99ea01b6c8
* only update the representation if anything was changed (this gives a
huge speedup), fixes#2452
* minor cleanup of the code, especially setting up the coordinate
cache. Without this can lead to crashes if the macros do not mention
all the arguments.
* And a last fix included makes sure that the metrics are always in
sync with the drawing. Before it was possible to go into the macro
with the cursor in a way that the metrics were for the viewing mode,
but the drawing was done for editing.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18489 a592a061-630c-0410-9148-cb99ea01b6c8
* Sqrt and Root draw their vertical horizontal line with a single line command to make them showup non-antialiased.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18419 a592a061-630c-0410-9148-cb99ea01b6c8
Please note that method B_ (translate text to buffer language) is presently broken (at least on Windows)!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18143 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetMath::name(): deleted.
* buffer_funcs.cpp:setCaptions() fix potential bug by using docstring copy instead of reference while using Inset::name.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18119 a592a061-630c-0410-9148-cb99ea01b6c8
This commit avoids unnecessary metrics recalculations by caching the last LyXFont used. I had to cleanup the width(), ascent() and descend() redundancies by transferring that to InsetBase.
InsetMathDim should go now as it is not really needed.
* InsetBase: properly handle inset Dimension.
* InsetOld: get rid of redundant width(), ascent() and descent()
* InsetMathDim: ditto
* InsetMathChar::metrics(): avoid metrics recalculation if font is unchanged.
* InsetMathSymbol::metrics(): ditto
* InsetMathKern: use InsetBase::dim_ instead of local ones.
* InsetMathSpace:
- use InsetBase::dim_ instead of local ones.
- space to width transformation transferred to anonymous namespace.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17899 a592a061-630c-0410-9148-cb99ea01b6c8
some code is moved from QMath
to QDelimiterDialog and QMathMatrixDialog
for the rest pretty mechanical
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17872 a592a061-630c-0410-9148-cb99ea01b6c8
Locking counter added to MacroData: it is increased before drawing/
metric calculations and decreased afterwards in InsetMathMacro. If a
macro is already locked at that point, "Self reference: \foo" is
drawn instead of the macro definition to avoid endless loops.
Moreover inside of the arguments of the macro the counter is
temporarily decreased as those cases do not cause loops. (fixes bug
#1395)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17841 a592a061-630c-0410-9148-cb99ea01b6c8
Locking counter added to MacroData: it is increased before drawing/
metric calculations and decreased afterwards in InsetMathMacro. If a
macro is already locked at that point, "Self reference: \foo" is
drawn instead of the macro definition to avoid endless loops.
Moreover inside of the arguments of the macro the counter is
temporarily decreased as those cases do not cause loops. (fixes bug
#1395)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17836 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=3449
One problem was no metric calculation was done for insets on cursor movement. Of course scrolling or entering character caused the missing metric calls, hence the described behavior in the bug report. This is fixed by re-implementing idxLast(), idxFirst() and notifyCursorLeaves().
Another problem was that 'a' and '1' were drawn at the same position because of a mis-calculation of the x-position in InsetMathMacro::draw().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17826 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathSupport.C:
add "slash" to the decoration table.
* src/mathed/InsetMathBig.C
(InsetMathBig::draw): don't remove backslash delimiter.
(InsetMathBig::isBigInsetDelim): add "\\" and "\slash" to
the delimiters table.
* src/frontends/qt4/QDelimiterDialog.C
(fix_name): return "\\" instead of "\backslash" as that now
works after the fixes above.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17771 a592a061-630c-0410-9148-cb99ea01b6c8
InsetCommandParams)
* src/mathed/InsetMathCommand.[Ch]
(CommandInset::createDialogStr): Move to InsetMathRef, since it is
no longer generic.
* src/mathed/MathFactory.C
(createInsetMath_fromDialogStr): Use InsetCommandMailer instead of
manual parsing. This ensures that the syntax is correct.
* src/mathed/InsetMathRef.[Ch]
(InsetMathRef::createDialogStr): Moved here from InsetMathCommand,
but use InsetCommandMailer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17738 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=3408http://bugzilla.lyx.org/show_bug.cgi?id=3409
The missing redraw was introduced with "Draw only decoration" optimisation in mathed. Setting the flags to Update::Force in case of Preview mode fixes the problem.
* InsetMathHull::notifyCursorLeaves(): set the cursor flags to 'Force'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17718 a592a061-630c-0410-9148-cb99ea01b6c8
isdigit from ctype.h, because the latter are locale dependant and do not
work with char_type.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17698 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathScript.C
(InsetMathScript::dy01): Make sure that the subscript is placed
not higher than when it appears alone.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17602 a592a061-630c-0410-9148-cb99ea01b6c8
The string representation of math data stored in an undo could not be
read back. Now we store the math directly and do not convert to and from
a string.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17591 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathData.C
(MathArray::metrics): Explicitly initialize kerning_ as it may
contain random data when the nucleus is an empty MathFont inset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17560 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathScript.C
(isAlphaSymbol): New. Return true if nucleus is a letter or a
symbol whose type is mathord or mathalpha.
(InsetMathScript::dy01): Apply rule 18a accounting for nucleus type.
* src/mathed/MathData.C
(MathArray::metrics): Account for the fact that some fonts (eg.
mathcal) do not have a lower case x glyph.
* src/mathed/InsetMathSymbol.[Ch]
(InsetMathSymbol::isOrdAlpha): New. Return true if type of symbol
is mathord or mathalpha.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17518 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathSupport.[Ch]
(mathed_char_kerning): New. Compute right kerning for the given
font and character as the difference between right bearing and
logical width.
* src/mathed/InsetMathScript.[Ch]
(InsetMathScript::dx1, InsetMathScript::metrics): Account for
nucleus right kerning.
(InsetMathScript::nker): New. Return the nucleus right kerning
if positive, zero otherwise.
* src/mathed/MathData.[Ch]
(MathArray::metrics): Cache the nucleus right kerning value.
(MathArray::kerning): New. Return cached right kerning.
* src/mathed/InsetMathChar.[Ch]
(InsetMathChar::metrics): Cache the character right kerning.
(InsetMathChar::kerning): New. Return cached right kerning.
* src/mathed/InsetMath.h
(InsetMath::kerning): New virtual method.
* src/mathed/InsetMathSymbol.[Ch]
(InsetMathSymbol::metrics): Cache the symbol right kerning.
(InsetMathSymbol::kerning): New. Return cached right kerning.
* src/mathed/InsetMathFont.[Ch]
(InsetMathFont::kerning): New. Return cached right kerning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17497 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathGrid.[Ch]
(InsetMathGrid::allow_pagebreak_): New member
* src/mathed/InsetMathGrid.C
(InsetMathGrid::eolString): Output \\* if allow_pagebreak_ is false
* src/mathed/MathParser.C
(addRow): Set allow_pagebreak_ in rowinfo if needed
(Parser::parse1): Parse '\\*' correctly
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17484 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathScript.[Ch]
(InsetMathScript::dy01): new, jointly account for both superscript
and subscript according to the rules in Appendix G of the TeXbook.
(InsetMathScript::dy0, InsetMathScript::dy1): set ascent and descent
values using dy01 for non-limits super/subscripts.
(InsetMathScript::metrics): account for the new super/subscript
placement rules when setting ascent and descent values.
* src/mathed/MathData.[Ch]
(MathArray::metrics): cache parameters needed for super/subscript
placement. When nucleus is not empty, set its ascent value to zero
such that it is correctly computed later, otherwise ascent values
less than that of an 'I' are not reported.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17471 a592a061-630c-0410-9148-cb99ea01b6c8
* src/insets/insetcaption.C
(InsetCaption::latex): Copy back encoding to runparams_in
* src/insets/insetfoot.C
(InsetFoot::latex): ditto
* src/insets/insetnote.C
(InsetNote::latex): ditto
* src/exporter.C
(Exporter::Export): Create runparams with document encoding
* src/converter.C
(bool Converters::convert): ditto
* src/buffer.C
(Buffer::writeLaTeXSource): Copy back encoding to runparams_in
(Buffer::runChktex): Create runparams with document encoding
(Buffer::changeRefsIfUnique): ditto
* src/outputparams.[Ch]
(encoding): New member
* src/lyxfont.C
(LyXFont::latexWriteStartChanges): Don't switch the encoding anymore.
This is now done in Paragraph::simpleTeXOnePar.
(LyXFont::latexWriteEndChanges): Ditto
* src/output_latex.C
(TeXOnePar): Ditto
* src/paragraph.C
(Paragraph::simpleTeXOnePar): Switch the encoding between font
changes if needed.
* All other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17470 a592a061-630c-0410-9148-cb99ea01b6c8