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
method is never invoked (and tell why)
* src/mathed/InsetMathFormulaMacro.C:
* src/mathed/InsetMathHull.C: plaintext(): fix return value
(= number of output characters)
* src/mathed/InsetMathFormulaMacro.h
* src/mathed/InsetMathHull.h: WS changes
* src/mathed/InsetMathDim.C: implement plaintext() for math macros
and add a FIXME that this code shouldn't needed!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17319 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView::mouseSetCursor(): do not call setTargetX() here because this needs the mathed coordcache which is not ensured to be up to date. Because of this, cursor movement might need some adjustment.
* InsetMathNest::lfunMousePress(): revert commit 17027.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17028 a592a061-630c-0410-9148-cb99ea01b6c8
* src/CutAndPaste.h/C: add selectionBuffer to save selected text
* src/text3.C: proper handling of paste
* src/lyxfind.C: save selection
* src/BufferView.C: save selection
* src/text.C: save selection
* src/cursor.C: save selection
* src/insets/insettabular.C: save selection
* src/mathed/InsetMathGrid.C: save selection
* src/mathed/InsetMathHull.C: save selection
* src/mathed/InsetMathNest.C: save selection
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17022 a592a061-630c-0410-9148-cb99ea01b6c8
* metricsinfo.h:
- ScreenUpdateStrategy: new enum describing the screen update strategy (replace singlepar boolean).
* UpdateFlags.h:
new Update::Decoration flag.
* BufferView.C
- update(): takes Decoration flag into account (CoordCache is not cleared out). Fills in metrics_info_.update_strategy
* mathed/InsetMathNest.C: adjust the cursor flags to new strategy.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16774 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetBase::drawDecoration(): new method.
* all other files: implement drawDecoration().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16772 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathExtern.C:
(captureOutput): redirect stdin from a file.
(pipeThroughMaxima, pipeThroughOctave, pipeThroughMathematica): use
"output:" instead of "out:" in the informational messages in order to
better match the "input:" message from captureOutput.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16709 a592a061-630c-0410-9148-cb99ea01b6c8
LyX instances. This re-enables copy/paste from the internal clipboard on
OS X (currently broken since Clipboard::isInternal() always returns false for
some reason).
* src/insets/insettabular.C
(InsetTabular::doDispatch): adjust to clipboard interface change
(InsetTabular::copySelection): ditto
* src/mathed/InsetMathGrid.C
(InsetMathGrid::doDispatch): ditto
* src/mathed/InsetMathNest.C
(InsetMathNest::doDispatch): ditto
* src/buffer.[Ch]
(Buffer::readString): New method: Read document from a string
(Buffer::readFile): Change return value from bool to enum (needed
for readString). Return wrongversion if we are reading from a string
and the version does not match.
(Buffer::do_writeFile): make public and rename to write
* src/CutAndPaste.C
(putClipboard): New helper, put stuff to the system clipboard
(void copySelectionHelper): Use putClipboard instead of
theClipboard().put()
(void copySelection): ditto
(void pasteClipboard): new method for pasting in text
(void pasteParagraphList):
* src/frontends/Clipboard.h
(Clipboard::get): Rename to getAsText
(Clipboard::getAsLyX): New method for getting the system clipboard
in LyX format
(Clipboard::hasLyXContents): New method telling whether there is LyX
contents in the clipboard
* src/frontends/qt4/GuiClipboard.[Ch]: Implement the new methods
* src/text3.C
(LyXText::dispatch): Use pasteClipboard for pasting the system
clipboard
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16669 a592a061-630c-0410-9148-cb99ea01b6c8
we got a consensus on this on the list.
Some calls of haveSelection are still missing, but we need to decide the
"persistent selection" question before those can be implemented properly.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16572 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathExtern.C
(pipeThroughOctave): take into account that the output from octave
may contain ansi control sequences.
* src/mathed/InsetMathRoot.[Ch]
(InsetMathRoot::mathematica): new virtual method to output n-th
roots in mathematica syntax.
* src/mathed/InsetMathRoot.C
(InsetMathRoot::octave): octave has not a root() command.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16559 a592a061-630c-0410-9148-cb99ea01b6c8
after selecting something with the mouse
* src/insets/insettabular.C
(InsetTabular::doDispatch): Set the X selection if there is a
selection after release of the left mouse button
* src/mathed/InsetMathNest.C
(InsetMathNest::doDispatch): Set the X selection after double and
triple click of the left mouse button
(InsetMathNest::lfunMouseRelease): Set the X selection if there is a
selection after release of the left mouse button
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16530 a592a061-630c-0410-9148-cb99ea01b6c8
* src/insets/insettabular.C
(InsetTabular::doDispatch): Only paste the tabular clipboard if the
system clipboard is not newer, else let the current cell paste the
system clipboard
(InsetTabular::getStatus): Only decide whether to enable LFUN_PASTE
if the tabular clipboard is not empty and the system clipboard is
not newer, else let the current cell decide.
* src/mathed/InsetMathGrid.C
(InsetMathGrid::doDispatch): Use the system clipboard for LFUN_PASTE
if it is newer.
* src/mathed/InsetMathNest.C
(InsetMathNest::doDispatch): Use the system clipboard for LFUN_PASTE
if it is newer.
* src/text3.C
(doInsertInset): Add a "0" argument to LFUN_PASTE, because we always
want to use the internal clipboard here
(LyXText::dispatch): ditto (when handling mouse button 2 press)
(LyXText::dispatch): Use the system clipboard for LFUN_PASTE if it
is newer.
(LyXText::getStatus): Also enable LFUN_PASTE if the system clipboard
is owned by another application
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16498 a592a061-630c-0410-9148-cb99ea01b6c8
(InsetMathNest::lfunMouseRelease): Remove commented call of
theSelection->put(), since that should never be called from the kernel
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16491 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathNest.C :
unreachable code
* src/aspell_local.h :
aspell is a Clibrary, no class keyword available
* src/texrow.h :
could not generate standard constructor
* development/cmake/CMakeLists.txt :
- disable same warnings
- all size_t/int related warnings are disabled
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16446 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathGrid.C: Don't declare mathed_parse_normal,
include MathParser.h instead
(InsetMathGrid::doDispatch): remove to_utf8, mathed_parse_normal
takes now a docstring
* src/mathed/MathMacroTemplate.C
(MathMacroTemplate::read): restore the version of 1.4.x, since
the new one did only work for macros without whitespace
* src/mathed/MathParser.[Ch]
(Parser): Add constructor from a docstring
(mathed_parse_cell): Create the parser directly from the string,
since the istream variant of tokenize() does only work if reading
from the .lyx file
(mathed_parse_normal): ditto
(mathed_parse_normal): Delete the istream variant (unused)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16334 a592a061-630c-0410-9148-cb99ea01b6c8
* other files: use FontMetrics::dimension() method instead of old Dimension interface.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16167 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=2900
The only drawback is that it requires about 20Mo extra-memory when loading the UserGuide. If it turns out to be too much, we can switch to a QHash based solution instead of a table.
* dimension.[Ch]:
- Dimension(LyXFont const, char_typec): new ctor
- set(LyXFont const & font, char_type c): new method.
* frontends/FontMetrics.h:
- width(char_type): is now a pure virtual method.
* GuiFontMetrics:
- CharMetrics: new structure;
- the metrics cache now also cache ascent and descent. This is especially useful for mathed.
* MathSupport.[Ch]:
- mathed_char_dim(): deleted. We now use Dimension::set() directly instead.
* rowpainter.C: fixe empty space.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16124 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetMathNest::lfunMousePress(): Disable optimization introduced in revision 16006. This is because we need the box corners when navigating inside formulas.
* InsetMathNest::doDispatch(): ditto.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16011 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetMathNest.C: adjust update flags in order to avoid unneeded screen redrawing.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16006 a592a061-630c-0410-9148-cb99ea01b6c8
* src/cursor.C: remove nested empty math box
* src/mathed/InsetMathNest.C: remove the whole empty math box if it
can not be deleted from within
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15990 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathFactory.C
(initSymbols): skip a line when it is empty or a comment.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15961 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathScript.C
(InsetMathScript::write): Do not add braces to the nucleus
* src/mathed/MathParser.C
(Parser::parse1): Do not remove brace insets from the nucleus of
script insets
* src/mathed/InsetMathNest.C
(InsetMathNest::script): ditto
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15859 a592a061-630c-0410-9148-cb99ea01b6c8
(InsetMathSymbol::draw): Remove obsolete FIXME
(InsetMathSymbol::draw): Microoptimization: Do not copy the string
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15789 a592a061-630c-0410-9148-cb99ea01b6c8
(Parser::parse1): Fix special handling of {}-bases to not destroy
\xxx{\vec{H}}_0 where \xxx is an unknown command
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15712 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathStream.C
(isAlpha): new, test whether a lyx::char_type is an ascii letter.
(operator<<): output a space if pendingSpace() is true and what follows
begins with an ascii letter. Also update the number of lines written.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15645 a592a061-630c-0410-9148-cb99ea01b6c8
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
* Painter: new ctor that sets drawing_enabled_ to true.
* setDrawingEnabled(), isDrawingEnabled(): new methods.
* QLPainter.C: only draw if drawing is enabled.
* nullpainter.h: deleted.
* rawpainter.C::paintPar(): only draw if we are inside the Paragraph.
* InsetTabular::draw(): use new Painter method instead of a NullPainter.
* InsetMathNest::drawSelection(): ditto.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15613 a592a061-630c-0410-9148-cb99ea01b6c8
* mathed/InsetMathXYArrow.C:
* mathed/InsetMathMBox.C: do not include non-existing MathMLStream.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15477 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathParser.C
(parse1): behave correctly when a wrong delimiter is specified.
* src/mathed/InsetMathBig.C
(write): don't write a space before delimiter.
* src/frontends/qt4/QDelimiterDialog.C
(QDelimiterDialog): make translatable the string "Variable size".
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15397 a592a061-630c-0410-9148-cb99ea01b6c8
Known problems:
- No space is output after a \hfill. I probably broke this with the
InsetCommand patch. I'll have a look later.
- Although the encoding is now UTF8 the arguments of the inputenc package
are still the old ones, so LaTeX will not run.
- Labels and references with non-ASCII characters are broken. This needs to
be fixed in lyx::support::escape(), but this is a file format change.
- Something seems to be wrong with index entries, but this is probably also
due to the InsetCommand changes.
Have fun!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15378 a592a061-630c-0410-9148-cb99ea01b6c8
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
CoordCache & coord_cache = sl.text()->bv()->coordCache();
As you can see, I used this indirection to access the BufferView::CoordCache(). Bad luck, the passed CursorSlice was not completely valid inside a mathed inset, hence the crash. My solution is to pass BufferView to InsetBase::cursorPos() and all its derivative.
* InsetBase::cursorPos(): pass BufferView const &
* bufferview_funcs::coordOffset(): ditto.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15356 a592a061-630c-0410-9148-cb99ea01b6c8
The coordcahce is for up/down navigation and vconverting mouseclicks to text positions. It is not for pure display/export which
is what drawT is about. It was a simple oversight not to remove it after some copying from the 'real' draw() method.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15347 a592a061-630c-0410-9148-cb99ea01b6c8
* lyx_main.h: define "extern bool lyx::use_gui" here.
* NoGuiFontMetrics.h: new class for command-line LyX
* NoGuiFontLoader.h: new class for command-line LyX
* Application.C:
- theFontMetrics(): returns the above dummy FontMetrics when use_gui is false.
- theFontLoader(): returns the above dummy FontLoader when use_gui is false.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15339 a592a061-630c-0410-9148-cb99ea01b6c8
* MathFactory.C:
- initMath(): revert change from r15327 because initSymbols() is needed for proper math parsing.
- math_font_available(): return false if lyx::use_gui is false.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15331 a592a061-630c-0410-9148-cb99ea01b6c8
* lyx_main.C:
- parse_export(): set lyx::use_gui to false.
* MathFactory.C:
- initMath(): initSymbols() only if lyx::use_gui is true.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15327 a592a061-630c-0410-9148-cb99ea01b6c8
theCoords is now a thing of the past and all CoordCache accesses are done via BufferView::coordCache() now. I had to modify a number of methods to pass BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15324 a592a061-630c-0410-9148-cb99ea01b6c8
export (e.g. the ToC) and the navigate menu.
* src/insets/insetbase.h
(InsetBase::plaintext): output to a docstream
(InsetBase::textString): ditto
* src/mathed/TextPainter.h
(TextPainter::show): ditto
* src/support/docstream.[Ch] New file and string streams for
docstring. The file streams convert to UTF8 on the fly.
* many more files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15301 a592a061-630c-0410-9148-cb99ea01b6c8
* lyxfunc.h:
- theLyXFunc(): new function in the global namespace.
- lyx::dispatch(): new function in the lyx namespace.
- lyx::getStatus(): new function in the lyx namespace.
* bufferlist.h:
- theBufferList(): new function in the global namespace.
* Clipboard.h:
- theClipboard(): new function in the global namespace.
* Selection.h:
- theSelection(): new function in the global namespace.
* FontLoader.h:
- theFontLoader(): new function in the global namespace.
* FontMetrics.h:
- theFontMetrics(LyXFont const &): new function in the global namespace.
* Application.C: implements the functions defined above.
* LyXView.h:
- getLyXFunc(): deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15298 a592a061-630c-0410-9148-cb99ea01b6c8
* buffer.[Ch] (changeRefsIfUnique): extend to handle bibitems
as well (the function takes a InsetCode argument now);
clean up by using InsetIterator.
* InsetMathHull.C (doDispatch): changeRefsIfUnique needs a
InsetCode argument now (bug 2744).
* insetlabel (doDispatch): changeRefsIfUnique needs a
InsetCode argument now.
* insetbibitem (doDispatch): use changeRefsIfUnique
(actual fix for bug 2744).
* insetcommand.[Ch]:
* insetcite.[Ch]: implement replaceContents, which is
used by changeRefsIfUnique.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15289 a592a061-630c-0410-9148-cb99ea01b6c8
Basically, I replaced all methods in the font_metrics namespace by a proper virtual interface FontMetrics. The FontLoader is _the_ container for FontMetrics.
This patch should also bring some optimizations in a number of place in the code. This is because we do not need any more to search for the LyXFont at each font_metrics call. In effect, the speed advantage is not as sensible and this is a bit deceiving considering that this was my primary motivation behind the patch. But I like the patch anyway as it cleans up the relation and interfacing between fonts, metrics and frontends.
* frontends/FontMetrics.h: new virtual interface. Renamed from font_metrics.h
* qt4/GuiFontMetrics: corresponding qt4 implememtation. Renamed from qfont_metrics.C. The smallCaps particular case treatment has been transfered here as well as the width cache for MacOSX and Windows.
* qt4/QLPainter.C: the smallCapsText has been reworked to return the width of the drawn text.C
all other files: replace font_metric helper function call with corresponding FontMetrics method calls.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15265 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathSplit.C
(InsetMathSplit::validate): Only require amsmath for AMS stuff
* src/mathed/MathFactory.C
(createInsetMath): create InsetMathSplit if the latexkey is "split"
* src/mathed/MathParser.C
(Parser::parse1): remove "gathered" and "aligned", since these are
now handled via lib/symbols
(Parser::parse1): create InsetMathSplit if the latexkey is "split"
* lib/symbols: Add aligned, gathered, lgathered and rgathered
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15224 a592a061-630c-0410-9148-cb99ea01b6c8
* frontends/FontLoader.h: new interface class.
* frontends/Application.h: new FontLoader() pure virtual method
* frontends/lyx_gui: update_fonts() and font_available() methods deleted
* [qt3/qt4/gtk]/GuiApplication: implement the new interface
* qt4/GuiFontLoader:
- renamed from FontLoader
- now derives from FontLoader
- now in the lyx::frontend namespace
* qt3/qfont_loader
- now derives from FontLoader
* gtk/xftFontLoader
- now derives from FontLoader
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15220 a592a061-630c-0410-9148-cb99ea01b6c8
Now we write again \begin{align} instead of \begin{4} to .lyx and .tex.
* src/mathed/InsetMathHull.C
(InsetMathHull::header_write): write type name, not type_.
Use switch instead of if for better readability.
(InsetMathHull::footer_write): ditto
(InsetMathHull::mutate): write type name, not type_
(InsetMathHull::normalize): ditto
(InsetMathHull::infoize): ditto
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15204 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): move code for ref insert to InsetMathNest
(InsetMathHull::getStatus): move code for ref insert to InsetMathNest
* src/mathed/InsetMathNest.C
(InsetMathNest::doDispatch): move code from InsetMathHull here
(InsetMathNest::getStatus): move code from InsetMathHull here
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15189 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView
- layoutChanged: new boost signal.
- LyXView owner(), owner_: deleted
* text3.C
- emit BufferView::layoutChanged instead of calling LyXView::setLayout directly
- LFUN_MOUSE_RELEASE: delete LyXView updateMenubar() and updateToolbars() direct calls.
The update is of both bars is done in WorkArea::dispatch().
* WorkArea.C
- dispatch(): add LyXView updateMenubar() call.
* LyXView
- connects to BufferView::layoutChanged directly to Toolbars::setLayout()
- setLayout(): deleted.
* qt4/GuiImplementation: modify BufferView construction (without LyXView).
All other files: cleanup header declaration of LyXView.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15153 a592a061-630c-0410-9148-cb99ea01b6c8
The associated WorkArea is then responsible to connect these signals to its LyXView parent.
* BufferView:
- showDialog, showDialogWithData, showInsetDialog: new boost signals
* LyXView:
- connectBufferView(), disconnectBufferView(): new method in charge of the connection/disconnection of the above signal to associate private methods (showDialog(), etc).
* WorkArea
- setBufferView(): will connect/disconnect the BufferView to its LyXView parent.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15068 a592a061-630c-0410-9148-cb99ea01b6c8
* src/frontends/qt[34]/qt_helpers.[Ch]
(toqstr): add variant for docstring
(qstring_to_ucs4): Use docstring and port from qt4 to qt3
* Many other files: Many std::string -> lyx::docstring conversions
* src/support/lstrings.[Ch]
(subst): Add variant for docstring and char_type
(externalLineEnding): std::string -> lyx::docstring
(internalLineEnding): std::string -> lyx::docstring
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14871 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/math_symbolinset.C
(void MathSymbolInset::maxima):
- newer maxima versions use inf instead of INF
- add support for greek pi
(void MathSymbolInset::mathematica):
- add support for \cdot
* src/mathed/math_stringinset.h
- account for the const version of asStringInset()
* src/mathed/math_extern.C
(bool extractScript):
- added bool superscript to formal parameters in order
to only extract superscripts
(MathArray::iterator extractArgument):
- leave out delimiters and a possible superscript
for function arguments
(bool isKnownFunction):
(bool extractFunctionName):
- recognize standard and user defined function names
(void splitScripts):
- correctly split scripts as expected by other functions
(MathAtom replaceDelims):
- ranamed as replaceParenDelims
(bool testOpenBracket):
(bool testCloseBracket):
- test for "[" and "]", respectively
(MathAtom replaceBracketDelims):
- replace something delimited by "[" and "]" with a
proper DelimInset
(void extractDelims):
- create a DelimInset for "[" and "]" delimiters, too
(void extractFunctions):
- improved recognition of function names
(bool testTermDelimiter):
- test for '+' or '-' as term delimiters
(MathArray::iterator extractTerm):
- extract a "term", i.e., something delimited by '+' or '-'
(bool testDiffItem):
- improved recognition of a "differential fraction"
(void extractDiff):
- call splitScripts() on numerator and denominator of a
differential fraction before analyzing them
(void extractLims):
- improved recognition of a limit function
(void extractStructure):
- reorganized order of searches
(MathArray pipeThroughMaxima):
- newer versions of maxima use simpsum instead of SIMPSUM
(string fromMathematicaName):
- translates from mathematica names
(MathArray pipeThroughMathematica):
- calls mathematica and collects its output
(MathArray pipeThroughExtern):
- add support for mathematica
* src/mathed/math_numberinset.C
* src/mathed/math_numberinset.h
(void MathNumberInset::mathematica):
- add support for mathematica
* src/mathed/math_matrixinset.C
* src/mathed/math_matrixinset.h
(void MathMatrixInset::mathematica):
- add support for mathematica
* src/mathed/math_diffinset.C
* src/mathed/math_diffinset.h
(void MathDiffInset::maxima):
- add support for maxima
(void MathDiffInset::mathematica):
- mathematica uses "D" and not "Dt" for normal derivatives
* src/mathed/math_liminset.C
* src/mathed/math_liminset.h
(void MathLimInset::maxima):
- add support for maxima
(void MathLimInset::mathematica):
- mathematica uses "Limit" and not "Lim" for limits
* src/mathed/math_exfuncinset.C
(string asMathematicaName):
- added some more function names
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14865 a592a061-630c-0410-9148-cb99ea01b6c8
* src/support/docstring.[Ch]
(from_ascii): new conversion function
(from_utf8): new conversion function
(to_utf8): new conversion function
(operator==) new, compare docstring and ASCII C string
(operator!=) new, compare docstring and ASCII C string
* src/support/Makefile.am: add new file docstring.C
* development/scons/scons_manifest.py: ditto
* src/funcrequest.[Ch]
(argument): change name to argument_ and type to docstring,
add an accessor
(FuncRequest): Add two new constructors taking a docstring argument
* all other files: adjust to the FuncRequest changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14861 a592a061-630c-0410-9148-cb99ea01b6c8
element (like {a'}^{2}). (froward port from 14802)
* src/mathed/math_nestinset.C (script): when creating a script
inset, handle specially previous atom if it is a MathBraceInset
(this is used in interactive input).
* src/mathed/math_parser.C (parse1): when creating a script inset,
handle specially previous atom if it is a MathBraceInset (this is
used in parsing phase).
* src/mathed/math_scriptinset.C (write): put nucleus into braces
if it contains more than one element or is itself a script inset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14819 a592a061-630c-0410-9148-cb99ea01b6c8
in the text.
* src/insets/insetbase.h (notifyCursorLeaves): return a bool
indicating whether cursor is invalidated.
* src/mathed/math_nestinset.C (notifyCursorLeaves):
* src/mathed/math_hullinset.C (notifyCursorLeaves): adapt to
prototype change.
* src/mathed/math_scriptinset.[Ch] (notifyCursorLeaves): return
true when an inset has been deleted.
* src/BufferView.C (mouseSetCursor): do not call dEPM when cursor
is invalidated by notifyCursorLeaves.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14796 a592a061-630c-0410-9148-cb99ea01b6c8
* math_scriptinset.C (notifyCursorLeaves): call recordUndoInset
before deleting a cell; if the nucleus does not have scripts
anymore, delete it and replace it by its contents at enclosing
level.
(write): output scripts even when they are empry.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14793 a592a061-630c-0410-9148-cb99ea01b6c8
- src/support/unicode.[Ch]: new files with functions for converting
to and fro ucs4, ucs2 and utf8.
- src/support/docstring.h: specialization of basic_string that
holds a uint32_t internally.
- Several functions changed to use char_type instead of char or unsigned char.
- Qt3 and Qt4 sends ucs2 on to core
- Gtk sends ucs4 on to core
- Read and write utf-8 .lyx files.
- font_metrics and painter updated to handle ucs4 chars as input.
- Quite a bit of ugly compability code, conversion string->docstring, etc.
- Have fun...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14661 a592a061-630c-0410-9148-cb99ea01b6c8
* src/BufferView_pimpl.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved from
LyXText.
* src/text3.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved to
BufferView::Pimpl, since this should work in mathed too.
* src/mathed/math_nestinset.C (doDispatch/LFUN_INSET_TOGGLE): do not try to
do the work which belongs to LFUN_NEXT_INSET_TOGGLE (bug 2756).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14617 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/math_factory.C
(createMathInset): Create a MathFracInset of kind OVER for \over
* src/mathed/math_fracinset.C
(MathFracInset::draw): handle kind OVER
(MathFracInset::drawT): ditto
(MathFracInset::write): ditto
(MathFracInset::name): ditto
(MathFracInset::extraBraces): ditto
* src/mathed/math_fracinset.h
(Kind): New kind OVER
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14487 a592a061-630c-0410-9148-cb99ea01b6c8
* src/LyXAction.C
(LyXAction::init): handle new LFUN_CLIPBOARD_PASTE
* src/insets/insettabular.C
(InsetTabular::doDispatch): ditto
* src/insets/insetbox.C
(InsetBox::doDispatch): ditto
* src/insets/insetert.C
(InsetERT::doDispatch): ditto
(InsetERT::getStatus): ditto
* src/insets/insetcharstyle.C
(InsetCharStyle::doDispatch): ditto
* src/BufferView_pimpl.C
(BufferView::Pimpl::selectionRequest): stuff selection, not clipboard
* src/mathed/math_nestinset.C
(MathNestInset::lfunMousePress): get stuff selection, not clipboard
(MathNestInset::lfunMouseRelease): clipboard -> selection in
commented code
* src/CutAndPaste.C
(cutSelection): ditto
* src/frontends/{qt3,gtk}/GuiImplementation.C
(GuiImplementation::newWorkArea): create new selection, not clipboard,
since the clipboard is now an object
(GuiImplementation::destroyWorkArea): destroy selection, not clipboard
* src/frontends/{qt4,qt3,gtk}/GuiSelection.h: new, copied from
GuiClipboard.h
* src/frontends/{qt4,qt3,gtk}/GuiSelection.C: new, copied from
GuiClipboard.C
* src/frontends/{qt3,gtk}/GuiImplementation.h
(selection): new accessor for selection_
(selection_): new, the global selection object
* src/frontends/{qt4,qt3,gtk}/Makefile.am: add GuiSelection.C and
GuiSelection.h
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.C
(GuiClipboard::get): return clipboard, not selection
(GuiClipboard::put): stuff clipboard, not selection
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.h
(haveSelection): remove (this is now in GuiSelection)
* src/frontends/{qt3,gtk}/GuiClipboard.h
(old_work_area_): remove, since it is not needed anymore
* src/frontends/gtk/ghelpers.C
(getGTKStockIcon): handle LFUN_CLIPBOARD_PASTE
* src/frontends/Clipboard.h
(haveSelection): remove (this is now in Selection)
* src/frontends/qt4/GuiImplementation.[Ch]
(GuiImplementation::selection): new accessor for selection_
* src/frontends/Gui.h
(selection): New accessor for the global selection object
* src/frontends/Selection.h; new, copied from Clipboard.h
* src/frontends/Makefile.am: add Selection.h
* src/text3.C
(various): s/clipboard().haveSelection/selection().haveSelection/
(LyXText::dispatch): handle LFUN_CLIPBOARD_PASTE
(LyXText::getStatus): ditto
* src/lfuns.h: new lfun LFUN_CLIPBOARD_PASTE
* lib/ui/stdmenus.ui: add new lfun LFUN_CLIPBOARD_PASTE
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14408 a592a061-630c-0410-9148-cb99ea01b6c8
- Change unsigned -> signed
- Change signed -> unsigned
- Add a cast or two (really few of those)
- Remove/comment out unused variables
- Comment out unused arguments
- Add missing cases to switches.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14344 a592a061-630c-0410-9148-cb99ea01b6c8
(doDispatch): fix off by one error when checking cur.idx() (bug 2655)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14185 a592a061-630c-0410-9148-cb99ea01b6c8
adjust some commands according to the LyX naming conventions
(toggle-tooltip => tooltip-toggle, *-change(s) => change(s)-*)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13811 a592a061-630c-0410-9148-cb99ea01b6c8
* src/cursor.C
(LCursor::plainInsert): Move special \bigl stuff from here to
MathNestInset::interpret
(LCursor::macroModeClose): try to intepret the current macro before
it is simply inserted
* src/mathed/math_nestinset.C
(MathNestInset::doDispatch): try to intepret the argument of
LFUN_SELFINSERT also if it is longer than one character
* src/mathed/math_nestinset.[Ch]
(MathNestInset::interpret): new, moved from LCursor::plainInsert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13786 a592a061-630c-0410-9148-cb99ea01b6c8
(infoize2): Implement to show name if the cursor is to the right
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13757 a592a061-630c-0410-9148-cb99ea01b6c8
* src/cursor.C
(LCursor::plainInsert): combine the previous math atom with the new
one to a MathBigInset if possible
* src/mathed/math_biginset.[Ch]
(MathBigInset::name): implement
(MathBigInset::isBigInsetDelim): new, test whether a given token is
a valid MathBigInset delimiter
* src/mathed/math_biginset.C
(MathBigInset::size): handle Big, Bigg and Biggg
(MathBigInset::increase): ditto
(MathBigInset::draw): fix deco drawing
(MathBigInset::write): append space if necessary
* src/mathed/math_factory.C
(createMathInset): handle l->inset == "big"
* src/mathed/math_parser.C
(Token::asInput): return a token as input, stolen from tex2lyx
(void Parser::parse1): Create a MathBigInset when needed
* src/mathed/math_support.C:
(deco_table): add lbrace and rbrace
* src/mathed/math_nestinset.C
(MathNestInset::interpret): combine the previous math atom with the
new character to a MathBigInset if possible
* src/ParagraphParameters.C
(findToken): move from here
* src/support/lstrings.[Ch]
(findToken): to here
* lib/symbols: add MathBigInset symbols
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13700 a592a061-630c-0410-9148-cb99ea01b6c8
(MathNestInset::doDispatch): replace recordUndo by recordUndoInset for
LFUN_DELETE, to fix undo behaviour
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13658 a592a061-630c-0410-9148-cb99ea01b6c8