[LyX/master] Update documented command for running tex2lyx tests.
commit 3eefb8cfa65d573cf1f1bf0eeb886360b045374d Author: Enrico Forestieri <for...@lyx.org> Date: Mon May 12 23:54:50 2014 +0200 Update documented command for running tex2lyx tests. diff --git a/lib/doc/Development.lyx b/lib/doc/Development.lyx index 1acc703..7427992 100644 --- a/lib/doc/Development.lyx +++ b/lib/doc/Development.lyx @@ -699,7 +699,7 @@ make test status collapsed \begin_layout Plain Layout -make check +make alltests \end_layout \end_inset
[LyX/master] Output a parbreak after a command.
commit 7d5b1fb8409a8c7ac3c75056ee80aec6cba13195 Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 14 22:25:15 2014 +0200 Output a parbreak after a command. This is what LyX was previously doing. It has no effect on vertical spacing but, for example, sectioning commands stand out on the output. The parbreak is not output if an environment follows or the alignment of the current or next paragraph is changed. Also remove some superfluous code. diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 03822b5..f461ba2 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -288,21 +288,6 @@ void TeXEnvironment(Buffer const & buf, Text const & text, if (!style.isEnvironment()) { // This is a standard paragraph, no need to call TeXEnvironment. TeXOnePar(buf, text, pit, os, runparams); - // Unless the current or following paragraph are inside - // \begin..\end tags and the nesting layout is not of - // an itemize kind, we have to output a paragraph break - // (we already are at the beginning of a new line) - if (pit + 1 < runparams.par_end) { - ParagraphList::const_iterator nextpar = - paragraphs.constIterator(pit + 1); - if (nextpar->layout() == current_layout - && nextpar->getDepth() == current_depth - && current_layout.latextype != LATEX_ITEM_ENVIRONMENT - && current_layout.latextype != LATEX_LIST_ENVIRONMENT - && par->getAlign() == style.align - && nextpar->getAlign() == nextpar->layout().align) - os << '\n'; - } continue; } @@ -1026,27 +1011,39 @@ void TeXOnePar(Buffer const & buf, if (nextpar && !par.isEnvSeparator(par.size() - 1)) { // Make sure to start a new line os << breakln; - // Here we now try to avoid spurious empty lines by outputting - // a paragraph break only if: (case 1) the paragraph style - // allows parbreaks and no \begin, \end or \item tags are - // going to follow (i.e., if the next isn't the first - // or the current isn't the last paragraph of an environment - // or itemize) and the depth and alignment of the following - // paragraph is unchanged, or (case 2) the following is a - // non-environment paragraph whose depth is increased but - // whose alignment is unchanged. Layout const & next_layout = nextpar->layout(); - if ((style == next_layout -&& !style.parbreak_is_newline -&& style.latextype != LATEX_ITEM_ENVIRONMENT -&& style.latextype != LATEX_LIST_ENVIRONMENT -&& style.align == par.getAlign() -&& nextpar->getDepth() == par.getDepth() -&& nextpar->getAlign() == par.getAlign()) - || (!next_layout.isEnvironment() - && nextpar->getDepth() > par.getDepth() - && nextpar->getAlign() == par.getAlign())) { - os << '\n'; + // A newline '\n' is always output before a command, + // so avoid doubling it. + if (!next_layout.isCommand()) { + // Here we now try to avoid spurious empty lines by + // outputting a paragraph break only if: (case 1) the + // paragraph style allows parbreaks and no \begin, \end + // or \item tags are going to follow (i.e., if the next + // isn't the first or the current isn't the last + // paragraph of an environment or itemize) and the + // depth and alignment of the following paragraph is + // unchanged, or (case 2) the following is a + // non-environment paragraph whose depth is increased + // but whose alignment is unchanged, or (case 3) the + // paragraph is a command not followed by an environment + // and the alignment of the current and next paragraph + // is unchanged. + if ((style == next_layout +
[LyX/master] Make use of otexstream also in external::writeExternal
commit 15e1f5eb39951351cc50beec9e1db21b74535e13 Author: Enrico Forestieri <for...@lyx.org> Date: Fri May 16 14:21:48 2014 +0200 Make use of otexstream also in external::writeExternal This was not necessary when LyX was generously outputting newlines. As it may happen that the output produced by writeExternal (the result of an external inset) starts right at the beginning of a line, if otexstream does not know that something is already on the line, the iomanip-like variable 'breakln' fails to actually break the line. diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp index aa6f51c..6d009a5 100644 --- a/src/insets/ExternalSupport.cpp +++ b/src/insets/ExternalSupport.cpp @@ -333,23 +333,23 @@ string const substituteOptions(InsetExternalParams const & params, } // namespace anon -int writeExternal(InsetExternalParams const & params, - string const & format, - Buffer const & buffer, odocstream & os, - ExportData & exportdata, - bool external_in_tmpdir, - bool dryrun) +void writeExternal(InsetExternalParams const & params, + string const & format, + Buffer const & buffer, otexstream & os, + ExportData & exportdata, + bool external_in_tmpdir, + bool dryrun) { Template const * const et_ptr = getTemplatePtr(params); if (!et_ptr) - return 0; + return; Template const & et = *et_ptr; Template::Formats::const_iterator cit = et.formats.find(format); if (cit == et.formats.end()) { LYXERR(Debug::EXTERNAL, "External template format '" << format << "' not specified in template " << params.templatename()); - return 0; + return; } if (!dryrun || contains(cit->second.product, "$$Contents")) @@ -383,7 +383,7 @@ int writeExternal(InsetExternalParams const & params, str = substituteOptions(params, str, format); // FIXME UNICODE os << from_utf8(str); - return int(count(str.begin(), str.end(),'\n')); + return; } namespace { diff --git a/src/insets/ExternalSupport.h b/src/insets/ExternalSupport.h index 9c282e8..79b4e1b 100644 --- a/src/insets/ExternalSupport.h +++ b/src/insets/ExternalSupport.h @@ -60,13 +60,13 @@ std::string const doSubstitution(InsetExternalParams const & params, If \p external_in_tmpdir == true, then the generated file is place in the buffer's temporary directory. */ -int writeExternal(InsetExternalParams const &, - std::string const & format, - Buffer const &, - odocstream &, - ExportData &, - bool external_in_tmpdir, - bool dryrun); +void writeExternal(InsetExternalParams const &, + std::string const & format, + Buffer const &, + otexstream &, + ExportData &, + bool external_in_tmpdir, + bool dryrun); } // namespace external } // namespace lyx diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 9d4d6c1..278168a 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -673,21 +673,19 @@ void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const et.formats.find("PDFLaTeX"); if (cit != et.formats.end()) { - int l = external::writeExternal(params_, "PDFLaTeX", - buffer(), os.os(), - *(runparams.exportdata), - external_in_tmpdir, - dryrun); - os.texrow().newlines(l); + external::writeExternal(params_, "PDFLaTeX", + buffer(), os, + *(runparams.exportdata), + external_in_tmpdir, + dryrun); return; } } - int l = external::writeExternal(params_, "LaTeX", buffer(), os.os(), - *(runparams.exportdata), - external_in_tmpdir, - dryrun); - os.texrow().newlines(l); + external::writeExternal(params_, "LaTeX", buffer(), os, +
[LyX/master] Fix an on-screen representation glitch.
commit 95787a0a4c3f6c037b22cb4ba8c98f2e8fa988de Author: Enrico Forestieri <for...@lyx.org> Date: Fri May 16 15:11:08 2014 +0200 Fix an on-screen representation glitch. If a layout has NextNoIndent set to true, the following paragraph is not indented on screen. LyX checks the previous layout for that style parameter to decide whether to indent or not. Of course, what matters is the latex output and the on-screen representation should match this output. Now, when a layout has NextNoIndent==true, the latex output is correctly not indented, while the on-screen representation may fail to match this output. This can occur when, for example, a standard paragraph is nested in the previous layout, because LyX would check the property of the nested layout instead of the container layout. Thus, LyX should check the property of a previous layout at the same depth for correctly deciding whether a paragraph has to be indented or not. See also http://www.lyx.org/trac/ticket/9055#comment:12 for an example document where the previous scenario actually occurs. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 790d706..0be9058 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1907,12 +1907,13 @@ int TextMetrics::leftMargin(int max_width, } } - // This happens after sections in standard classes. The 1.3.x - // code compared depths too, but it does not seem necessary - // (JMarc) - if (tclass.isDefaultLayout(par.layout()) - && pit > 0 && pars[pit - 1].layout().nextnoindent) - parindent.erase(); + // This happens after sections or environments in standard classes. + // We have to check the previous layout at same depth. + if (tclass.isDefaultLayout(par.layout()) && pit > 0) { + pit_type prev = text_->depthHook(pit, par.getDepth()); + if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) + parindent.erase(); + } FontInfo const labelfont = text_->labelFont(par); FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
[LyX/master] Adapt output to the on-screen representation.
commit 936773c4f71a795179ea63f2d5b6f521ef9d97f8 Author: Enrico Forestieri <for...@lyx.org> Date: Fri May 16 15:39:33 2014 +0200 Adapt output to the on-screen representation. LyX assumes that a standard paragraph following an aligned one or a layout with NextNoIndent==false has to be indented on screen. This means that in the latex output a blank line has to follow. In this case there should be no problem as regards extra vertical space and it simpler and more elegant to simply uncheck "Indent Paragraph" in the Paragraph settings pane rather than changing the current logic and allowing to insert a parbreak separator. diff --git a/src/output_latex.cpp b/src/output_latex.cpp index f461ba2..4f8f14a 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -202,8 +202,10 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } -static void finishEnvironment(otexstream & os, OutputParams const & runparams, - TeXEnvironmentData const & data) +static void finishEnvironment(Buffer const & buf, Text const & text, + pit_type nextpit, otexstream & os, + OutputParams const & runparams, + TeXEnvironmentData const & data) { if (open_encoding_ == CJK && data.cjk_nested) { // We need to close the encoding even if it does not change @@ -232,6 +234,14 @@ static void finishEnvironment(otexstream & os, OutputParams const & runparams, os << setEncoding(data.prev_encoding->iconvName()); } } + + // Check whether we should output a blank line after the environment + DocumentClass const & tclass = buf.params().documentClass(); + ParagraphList const & pars = text.paragraphs(); + bool next_style_is_default = (nextpit >= runparams.par_end) ? false + : tclass.isDefaultLayout(pars.constIterator(nextpit)->layout()); + if (!data.style->nextnoindent && next_style_is_default) + os << '\n'; } @@ -296,7 +306,7 @@ void TeXEnvironment(Buffer const & buf, Text const & text, prepareEnvironment(buf, text, par, os, runparams); // Recursive call to TeXEnvironment! TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(os, runparams, data); + finishEnvironment(buf, text, pit + 1, os, runparams, data); } if (pit != runparams.par_end) @@ -785,7 +795,7 @@ void TeXOnePar(Buffer const & buf, bool const useSetSpace = bparams.documentClass().provides("SetSpace"); if (par.allowParagraphCustomization()) { if (par.params().startOfAppendix()) { - os << "\\appendix\n"; + os << "\n\\appendix\n"; } if (!par.params().spacing().isDefault() @@ -1027,7 +1037,9 @@ void TeXOnePar(Buffer const & buf, // but whose alignment is unchanged, or (case 3) the // paragraph is a command not followed by an environment // and the alignment of the current and next paragraph - // is unchanged. + // is unchanged, or (case 4) the current alignment is + // changed and a standard paragraph follows. + DocumentClass const & tclass = bparams.documentClass(); if ((style == next_layout && !style.parbreak_is_newline && style.latextype != LATEX_ITEM_ENVIRONMENT @@ -1041,7 +1053,9 @@ void TeXOnePar(Buffer const & buf, || (style.isCommand() && !next_layout.isEnvironment() && style.align == par.getAlign() - && next_layout.align == nextpar->getAlign())) { + && next_layout.align == nextpar->getAlign()) + || (style.align != par.getAlign() + && tclass.isDefaultLayout(next_layout))) { os << '\n'; } } @@ -1163,7 +1177,7 @@ void latexParagraphs(Buffer const & buf, prepareEnvironment(buf, text, par, os, runparams); // pit can be changed in TeXEnvironment. TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(os, runparams, data); + finishEnvironment(buf, text, pit + 1, os, runparams, data); } if (pit == runparams.par_end) {
[LyX/2.1.x] Fix an on-screen representation glitch.
commit f5a246b185540e853a48147e75e5688d38b4cd46 Author: Enrico Forestieri <for...@lyx.org> Date: Fri May 16 21:58:21 2014 +0200 Fix an on-screen representation glitch. If a layout has NextNoIndent set to true, the following paragraph is not indented on screen. LyX checks the previous layout for that style parameter to decide whether to indent or not. Of course, what matters is the latex output and the on-screen representation should match this output. Now, when a layout has NextNoIndent==true, the latex output is correctly not indented, while the on-screen representation may fail to match this output. This can occur when, for example, a standard paragraph is nested in the previous layout, because LyX would check the property of the nested layout instead of the container layout. Thus, LyX should check the property of a previous layout at the same depth for correctly deciding whether a paragraph has to be indented or not. See also http://www.lyx.org/trac/ticket/9055#comment:12 for an example document where the previous scenario actually occurs. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index e122d6a..9e34839 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1903,12 +1903,13 @@ int TextMetrics::leftMargin(int max_width, } } - // This happens after sections in standard classes. The 1.3.x - // code compared depths too, but it does not seem necessary - // (JMarc) - if (tclass.isDefaultLayout(par.layout()) - && pit > 0 && pars[pit - 1].layout().nextnoindent) - parindent.erase(); + // This happens after sections or environments in standard classes. + // We have to check the previous layout at same depth. + if (tclass.isDefaultLayout(par.layout()) && pit > 0) { + pit_type prev = text_->depthHook(pit, par.getDepth()); + if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) + parindent.erase(); + } FontInfo const labelfont = text_->labelFont(par); FontMetrics const & labelfont_metrics = theFontMetrics(labelfont); diff --git a/status.21x b/status.21x index 9f32d4f..5e7c88f 100644 --- a/status.21x +++ b/status.21x @@ -119,6 +119,8 @@ What's new - Fix problem with drawing of background in math when selection is active. +- Fix wrong on-screen indentation of a paragraph occurring in some cases. + * INTERNALS
[LyX/2.1.x] Adapt output to the on-screen representation.
commit 1fa06296b66bc562ba8d21b6e5e97e87fd495977 Author: Enrico Forestieri <for...@lyx.org> Date: Sat May 17 22:05:07 2014 +0200 Adapt output to the on-screen representation. LyX assumes that a standard paragraph following a layout with NextNoIndent==false has to be indented on screen, so output the necessary blank line to make it so also in the output. diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 31211d1..1fd387c 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -198,8 +198,10 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } -static void finishEnvironment(otexstream & os, OutputParams const & runparams, - TeXEnvironmentData const & data) +static void finishEnvironment(Buffer const & buf, Text const & text, + pit_type nextpit, otexstream & os, + OutputParams const & runparams, + TeXEnvironmentData const & data) { if (open_encoding_ == CJK && data.cjk_nested) { // We need to close the encoding even if it does not change @@ -227,6 +229,14 @@ static void finishEnvironment(otexstream & os, OutputParams const & runparams, os << setEncoding(data.prev_encoding->iconvName()); } } + + // Check whether we should output a blank line after the environment + DocumentClass const & tclass = buf.params().documentClass(); + ParagraphList const & pars = text.paragraphs(); + bool next_style_is_default = (nextpit >= runparams.par_end) ? false + : tclass.isDefaultLayout(pars.constIterator(nextpit)->layout()); + if (!data.style->nextnoindent && next_style_is_default) + os << '\n'; } @@ -306,7 +316,7 @@ void TeXEnvironment(Buffer const & buf, Text const & text, prepareEnvironment(buf, text, par, os, runparams); // Recursive call to TeXEnvironment! TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(os, runparams, data); + finishEnvironment(buf, text, pit + 1, os, runparams, data); } if (pit != runparams.par_end) @@ -1142,7 +1152,7 @@ void latexParagraphs(Buffer const & buf, prepareEnvironment(buf, text, par, os, runparams); // pit can be changed in TeXEnvironment. TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(os, runparams, data); + finishEnvironment(buf, text, pit + 1, os, runparams, data); } if (pit == runparams.par_end) { diff --git a/status.21x b/status.21x index 5e7c88f..f08a5ca 100644 --- a/status.21x +++ b/status.21x @@ -80,6 +80,8 @@ What's new - Fix table cell rotation conversion from 2.1 to 2.0 format. +- Honor the NextNoIndent layout parameter also in the exported output. + * USER INTERFACE
[LyX/master] Take into account that a blank line is always output before a command.
commit a919cd8c685905071049eecbdb9c6af96a294c27 Author: Enrico Forestieri <for...@lyx.org> Date: Sun May 18 17:30:01 2014 +0200 Take into account that a blank line is always output before a command. diff --git a/src/Text3.cpp b/src/Text3.cpp index 7350618..286d5bb 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1076,6 +1076,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) && ((prevpar.getDepth() > par.getDepth() && !par.layout().isEnvironment()) || (prevpar.layout() != par.layout() + && !par.layout().isCommand() && prevpar.layout().isEnvironment( { if (par.layout().isEnvironment()) { docstring const layout = par.layout().name();
[LyX/master] Disregard font properties changes when inserting a separator.
commit 0616c8fe329d79a914a5944dc2a42b98cdcec990 Author: Enrico Forestieri <for...@lyx.org> Date: Sun May 18 17:34:11 2014 +0200 Disregard font properties changes when inserting a separator. This allows to output a simple blank line instead of strange constructs. diff --git a/src/Text3.cpp b/src/Text3.cpp index 286d5bb..b12f094 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1089,6 +1089,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) lyx::dispatch(FuncRequest(LFUN_SEPARATOR_INSERT, "parbreak")); breakParagraph(cur); } + Font const f(inherit_font, cur.current_font.language()); + pars_[cur.pit() - 1].resetFonts(f); } else { breakParagraph(cur, cmd.argument() == "inverse"); }
[LyX/master] Don't allow inserting two consecutive separators.
commit 10d5897327bfe6d7f2768e1f7fa4d7beb8f556e4 Author: Enrico Forestieri <for...@lyx.org> Date: Sun May 18 18:02:25 2014 +0200 Don't allow inserting two consecutive separators. diff --git a/src/Text3.cpp b/src/Text3.cpp index b12f094..2c2cba4 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1073,6 +1073,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) Paragraph const & par = pars_[pit]; Paragraph const & prevpar = pit > 0 ? pars_[pit - 1] : par; if (pit > 0 && cur.pos() == par.beginOfBody() + && !par.isEnvSeparator(cur.pos()) && ((prevpar.getDepth() > par.getDepth() && !par.layout().isEnvironment()) || (prevpar.layout() != par.layout()
[LyX/master] Extend the otexstream class to also report about paragraph breaks.
commit ee9ff6cb0cd7d8b0ef3c18e5bd166e12580a3bf4 Author: Enrico Forestieri <for...@lyx.org> Date: Sun May 18 22:46:33 2014 +0200 Extend the otexstream class to also report about paragraph breaks. The new method afterParbreak() returns true if a blank line was just output and we are at the beginning of the next line, false otherwise. diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp index e8839e0..38cabc4 100644 --- a/src/support/docstream.cpp +++ b/src/support/docstream.cpp @@ -414,12 +414,9 @@ void otexstream::put(char_type const & c) protectspace_ = false; } os_.put(c); - lastchar_ = c; - if (c == '\n') { + lastChar(c); + if (c == '\n') texrow_.newline(); - canbreakline_ = false; - } else - canbreakline_ = true; } @@ -432,7 +429,6 @@ otexstream & operator<<(otexstream & ots, BreakLine) if (ots.canBreakLine()) { ots.os().put('\n'); ots.lastChar('\n'); - ots.canBreakLine(false); ots.texrow().newline(); } ots.protectSpace(false); @@ -445,7 +441,6 @@ otexstream & operator<<(otexstream & ots, SafeBreakLine) if (ots.canBreakLine()) { ots.os() << "%\n"; ots.lastChar('\n'); - ots.canBreakLine(false); ots.texrow().newline(); } ots.protectSpace(false); @@ -503,9 +498,10 @@ otexstream & operator<<(otexstream & ots, docstring const & s) } else ots.os() << s; + if (len > 1) + ots.canBreakLine(s[len - 2] != '\n'); ots.lastChar(s[len - 1]); ots.texrow().newlines(count(s.begin(), s.end(), '\n')); - ots.canBreakLine(s[len - 1] != '\n'); return ots; } @@ -535,7 +531,6 @@ otexstream & operator<<(otexstream & ots, char c) ots.lastChar(c); if (c == '\n') ots.texrow().newline(); - ots.canBreakLine(c != '\n'); return ots; } @@ -545,7 +540,6 @@ otexstream & operator<<(otexstream & ots, Type value) { ots.os() << value; ots.lastChar(0); - ots.canBreakLine(true); ots.protectSpace(false); return ots; } diff --git a/src/support/docstream.h b/src/support/docstream.h index 6da05e3..e2f56f9 100644 --- a/src/support/docstream.h +++ b/src/support/docstream.h @@ -90,15 +90,16 @@ typedef odocstream & (*odocstream_manip)(odocstream &); they were iomanip's to ensure that the next output will start at the beginning of a line. Using "breakln", a '\n' char will be output if needed, while using "safebreakln", "%\n" will be output if needed. -The class also records the last output character. +The class also records the last output character and can tell whether +a paragraph break was just output. */ class otexstream { public: /// otexstream(odocstream & os, TexRow & texrow) - : os_(os), texrow_(texrow), - canbreakline_(false), protectspace_(false), lastchar_(0) {} + : os_(os), texrow_(texrow), canbreakline_(false), + protectspace_(false), parbreak_(true), lastchar_(0) {} /// odocstream & os() { return os_; } /// @@ -114,9 +115,16 @@ public: /// bool protectSpace() const { return protectspace_; } /// - void lastChar(char_type const & c) { lastchar_ = c; } + void lastChar(char_type const & c) + { + parbreak_ = (!canbreakline_ && c == '\n'); + canbreakline_ = (c != '\n'); + lastchar_ = c; + } /// char_type lastChar() const { return lastchar_; } + /// + bool afterParbreak() const { return parbreak_; } private: /// odocstream & os_; @@ -127,6 +135,8 @@ private: /// bool protectspace_; /// + bool parbreak_; + /// char_type lastchar_; };
[LyX/master] Fix reversion of beamer documents.
commit cda00d8329a98f912036436b3e0dcfef7cdb24e3 Author: Enrico Forestieri <for...@lyx.org> Date: Mon May 19 19:39:51 2014 +0200 Fix reversion of beamer documents. Beamer documents do not have a "--Separator--" layout but a "Separator" one. Also fix a thinko causing the deletion of "\end_layout" tags in some cases. diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index 99236ff..64ff108 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -144,7 +144,13 @@ def convert_separator(document): def revert_separator(document): " Revert separator insets to layout separators " -parsep = ["\\begin_layout --Separator--", "", "\\end_layout", ""] +beamer_classes = ["beamer", "article-beamer", "scrarticle-beamer"] +if document.textclass in beamer_classes: +beglaysep = "\\begin_layout Separator" +else: +beglaysep = "\\begin_layout --Separator--" + +parsep = [beglaysep, "", "\\end_layout", ""] comert = ["\\begin_inset ERT", "status collapsed", "", "\\begin_layout Plain Layout", "%", "\\end_layout", "", "\\end_inset", ""] @@ -222,15 +228,18 @@ def revert_separator(document): and not check_token(document.body[k], "\\end_deeper") \ and not check_token(document.body[k], "\\begin_deeper"): if layoutname == "Standard": -document.body[beg:j+1] = ["\\begin_layout --Separator--"] +document.body[beg:j+1] = [beglaysep] i = i + 1 else: -document.body[beg:j+1] = ["\\begin_deeper", "\\begin_layout --Separator--"] +document.body[beg:j+1] = ["\\begin_deeper", beglaysep] end = end + 2 - (j + 1 - beg) document.body[end+1:end+1] = ["", "\\end_deeper", ""] i = i + 3 else: -del document.body[i:end+1] +if something_before: +del document.body[i:end+1] +else: +del document.body[i:end-1] i = i + 1
[LyX/master] Fix compilation after afc34c7a
commit 480f8d3115fd918472068ef344e7f9d56ede9eb1 Author: Enrico Forestieri <for...@lyx.org> Date: Tue May 20 00:43:46 2014 +0200 Fix compilation after afc34c7a diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index a2487f8..a43feeb 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -25,6 +25,7 @@ #include #include #include +#include using namespace std;
[LyX/master] Generalize control on double blank lines.
commit 7145863466c38080db9bdfba6ee7bb7583ffb862 Author: Enrico Forestieri <for...@lyx.org> Date: Tue May 20 21:52:29 2014 +0200 Generalize control on double blank lines. We can now tell whether a blank line was just output and so can avoid outputting another one. diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 2b6b9a3..12615e6 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -402,6 +402,8 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const runparams.encoding); wi.canBreakLine(os.canBreakLine()); write(wi); + // Reset parbreak status after a math inset. + os.lastChar(0); os.canBreakLine(wi.canBreakLine()); int lf = wi.line(); diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 1f47ca7..7995f65 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -856,7 +856,7 @@ void TeXOnePar(Buffer const & buf, case LATEX_LIST_ENVIRONMENT: if (nextpar && (par.params().depth() < nextpar->params().depth()) - && !par.isEnvSeparator(par.size() - 1)) + && !os.afterParbreak()) pending_newline = true; break; case LATEX_ENVIRONMENT: { @@ -872,7 +872,7 @@ void TeXOnePar(Buffer const & buf, default: // we don't need it for the last paragraph!!! // or if the last thing is an environment separator - if (nextpar && par.size() > 0 && !par.isEnvSeparator(par.size() - 1)) + if (nextpar && !os.afterParbreak()) pending_newline = true; } @@ -1018,7 +1018,7 @@ void TeXOnePar(Buffer const & buf, // we don't need a newline for the last paragraph!!! // Note from JMarc: we will re-add a \n explicitly in // TeXEnvironment, because it is needed in this case - if (nextpar && par.size() > 0 && !par.isEnvSeparator(par.size() - 1)) { + if (nextpar && !os.afterParbreak()) { // Make sure to start a new line os << breakln; Layout const & next_layout = nextpar->layout();
[LyX/master] Add a required paragraph break.
commit 27e0bf54f5c9dad3c58182d3958856bdfb3fd06a Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 21 21:08:11 2014 +0200 Add a required paragraph break. This is necessary, for example, if a standard paragraph is nested in an environment and the environment does not end immediately after. To be strictly correct, the layout of the following paragraph should be compared to the layout of the nesting environment, otherwise, if they are not the same, an empty line is nevertheless output. However, this is harmless because an "\end{layout}" tag immediately follows. diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 1cf63fb..c862733 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -1048,9 +1048,11 @@ void TeXOnePar(Buffer const & buf, // unchanged, or (case 2) the following is a // non-environment paragraph whose depth is increased // but whose alignment is unchanged, or (case 3) the + // paragraph is not an environment and the next one is a + // non-itemize-like env at lower depth, or (case 4) the // paragraph is a command not followed by an environment // and the alignment of the current and next paragraph - // is unchanged, or (case 4) the current alignment is + // is unchanged, or (case 5) the current alignment is // changed and a standard paragraph follows. DocumentClass const & tclass = bparams.documentClass(); if ((style == next_layout @@ -1063,6 +1065,9 @@ void TeXOnePar(Buffer const & buf, || (!next_layout.isEnvironment() && nextpar->getDepth() > par.getDepth() && nextpar->getAlign() == par.getAlign()) + || (!style.isEnvironment() + && next_layout.latextype == LATEX_ENVIRONMENT + && nextpar->getDepth() < par.getDepth()) || (style.isCommand() && !next_layout.isEnvironment() && style.align == par.getAlign()
[LyX/master] Fix wrong indentation on screen.
commit a17710e4995584932fe6d1540927e58f526477f8 Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 21 21:47:01 2014 +0200 Fix wrong indentation on screen. LyX fails to indent on screen a standard paragraph when it is nested into an environment. The fix is a one-liner but the diff is larger because it also fixes a previous wrong indentantion in the source ;) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 0be9058..226f842 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1909,10 +1909,11 @@ int TextMetrics::leftMargin(int max_width, // This happens after sections or environments in standard classes. // We have to check the previous layout at same depth. - if (tclass.isDefaultLayout(par.layout()) && pit > 0) { - pit_type prev = text_->depthHook(pit, par.getDepth()); - if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) - parindent.erase(); + if (tclass.isDefaultLayout(par.layout()) && pit > 0 + && pars[pit - 1].getDepth() >= par.getDepth()) { + pit_type prev = text_->depthHook(pit, par.getDepth()); + if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) + parindent.erase(); } FontInfo const labelfont = text_->labelFont(par);
[LyX/2.1.x] Fix wrong indentation on screen.
commit 956f50340144370fac4e76d4d500bbcf55e23e29 Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 21 23:59:53 2014 +0200 Fix wrong indentation on screen. LyX fails to indent on screen a standard paragraph when it is nested into an environment. The fix is a one-liner but the diff is larger because it also fixes a previous wrong indentantion in the source ;) No status line needed because this is an extension of f5a246b1. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 9e34839..9635388 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1905,10 +1905,11 @@ int TextMetrics::leftMargin(int max_width, // This happens after sections or environments in standard classes. // We have to check the previous layout at same depth. - if (tclass.isDefaultLayout(par.layout()) && pit > 0) { - pit_type prev = text_->depthHook(pit, par.getDepth()); - if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) - parindent.erase(); + if (tclass.isDefaultLayout(par.layout()) && pit > 0 + && pars[pit - 1].getDepth() >= par.getDepth()) { + pit_type prev = text_->depthHook(pit, par.getDepth()); + if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) + parindent.erase(); } FontInfo const labelfont = text_->labelFont(par);
[LyX/master] Fix potential crash.
commit 2c613d5686e0a391a92e8e2c4a93b784e2e891e5 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 22 11:41:23 2014 +0200 Fix potential crash. Use the lfun for breaking the paragraph here, such that the metrics are updated before the call to the next dispatch. diff --git a/src/Text3.cpp b/src/Text3.cpp index 2c2cba4..9fc8d6f 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1084,7 +1084,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) DocumentClass const & tc = bv->buffer().params().documentClass(); lyx::dispatch(FuncRequest(LFUN_LAYOUT, tc.plainLayout().name())); lyx::dispatch(FuncRequest(LFUN_SEPARATOR_INSERT, "parbreak")); - breakParagraph(cur, true); + lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK, "inverse")); lyx::dispatch(FuncRequest(LFUN_LAYOUT, layout)); } else { lyx::dispatch(FuncRequest(LFUN_SEPARATOR_INSERT, "parbreak"));
[LyX/master] Correct the check for a command.
commit 52ebcd6280078e591e463f9b54c6badefc1cf9e4 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 22 11:51:21 2014 +0200 Correct the check for a command. diff --git a/src/Text3.cpp b/src/Text3.cpp index 9fc8d6f..31e0826 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1074,10 +1074,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) Paragraph const & prevpar = pit > 0 ? pars_[pit - 1] : par; if (pit > 0 && cur.pos() == par.beginOfBody() && !par.isEnvSeparator(cur.pos()) + && !par.layout().isCommand() && ((prevpar.getDepth() > par.getDepth() && !par.layout().isEnvironment()) || (prevpar.layout() != par.layout() - && !par.layout().isCommand() && prevpar.layout().isEnvironment( { if (par.layout().isEnvironment()) { docstring const layout = par.layout().name();
[LyX/master] Simplify the test for inserting a parbreak separator.
commit 02e7bc18a7bb03a2799d98353adafe036e4fb340 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 22 21:47:10 2014 +0200 Simplify the test for inserting a parbreak separator. Instead of simply taking into account the layout of the previous paragraph, it is better considering the layout of the environment in which the previous paragraph may be nested. This makes the test simpler and, at the same time, more robust. diff --git a/src/Text3.cpp b/src/Text3.cpp index 31e0826..707a4e2 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1071,14 +1071,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cap::replaceSelection(cur); pit_type pit = cur.pit(); Paragraph const & par = pars_[pit]; - Paragraph const & prevpar = pit > 0 ? pars_[pit - 1] : par; - if (pit > 0 && cur.pos() == par.beginOfBody() + pit_type prev = + pit > 0 && pars_[pit - 1].getDepth() >= par.getDepth() ? + depthHook(pit, par.getDepth()) : pit; + if (prev < pit && cur.pos() == par.beginOfBody() && !par.isEnvSeparator(cur.pos()) && !par.layout().isCommand() - && ((prevpar.getDepth() > par.getDepth() -&& !par.layout().isEnvironment()) - || (prevpar.layout() != par.layout() - && prevpar.layout().isEnvironment( { + && pars_[prev].layout() != par.layout() + && pars_[prev].layout().isEnvironment()) { if (par.layout().isEnvironment()) { docstring const layout = par.layout().name(); DocumentClass const & tc = bv->buffer().params().documentClass();
[LyX/master] Fix another glitch with on-screen indentation.
commit a596736d76c318f94c36135756b1d1376c042539 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 22 23:47:38 2014 +0200 Fix another glitch with on-screen indentation. If a new paragraph is created just before a nested environment, the indentation of the nested environment is not computed correctly because the parindent of the previous layout would also be erroneously taken into account. This would cause the nested environment to move back and forth when something is added to the new paragraph. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 226f842..de414ea 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1896,6 +1896,13 @@ int TextMetrics::leftMargin(int max_width, if (newpar != pit_type(pars.size())) { if (pars[newpar].layout().isEnvironment()) { l_margin = leftMargin(max_width, newpar); + // Remove the parindent that has been added + // if the paragraph was empty. + if (pars[newpar].empty()) { + docstring pi = pars[newpar].layout().parindent; + l_margin -= theFontMetrics( + buffer.params().getFont()).signedWidth(pi); + } } if (tclass.isDefaultLayout(par.layout()) || tclass.isPlainLayout(par.layout())) {
[LyX/2.1.x] Fix another glitch with on-screen indentation.
commit f40adfd4862ccb6e4de3181780a6cc321a57f36d Author: Enrico Forestieri <for...@lyx.org> Date: Sat May 24 02:12:56 2014 +0200 Fix another glitch with on-screen indentation. If a new paragraph is created just before a nested environment, the indentation of the nested environment is not computed correctly because the parindent of the previous layout would also be erroneously taken into account. This would cause the nested environment to move back and forth when something is added to the new paragraph. A proper status line covering this change is already present. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 9635388..96c34aa 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1892,6 +1892,13 @@ int TextMetrics::leftMargin(int max_width, if (newpar != pit_type(pars.size())) { if (pars[newpar].layout().isEnvironment()) { l_margin = leftMargin(max_width, newpar); + // Remove the parindent that has been added + // if the paragraph was empty. + if (pars[newpar].empty()) { + docstring pi = pars[newpar].layout().parindent; + l_margin -= theFontMetrics( + buffer.params().getFont()).signedWidth(pi); + } } if (tclass.isDefaultLayout(par.layout()) || tclass.isPlainLayout(par.layout())) {
[LyX/master] Allow inserting a blank line also after a nested environment.
commit d4c21b42dd09875720ed90d8dcabcc486a4a38a4 Author: Enrico Forestieri <for...@lyx.org> Date: Mon May 26 21:29:33 2014 +0200 Allow inserting a blank line also after a nested environment. diff --git a/src/Text3.cpp b/src/Text3.cpp index 707a4e2..b78ba15 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1071,15 +1071,20 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cap::replaceSelection(cur); pit_type pit = cur.pit(); Paragraph const & par = pars_[pit]; - pit_type prev = - pit > 0 && pars_[pit - 1].getDepth() >= par.getDepth() ? - depthHook(pit, par.getDepth()) : pit; + pit_type prev = pit; + if (pit > 0) { + if (!pars_[pit - 1].layout().isEnvironment()) + prev = depthHook(pit, par.getDepth()); + else if (pars_[pit - 1].getDepth() >= par.getDepth()) + prev = pit - 1; + } if (prev < pit && cur.pos() == par.beginOfBody() && !par.isEnvSeparator(cur.pos()) && !par.layout().isCommand() && pars_[prev].layout() != par.layout() && pars_[prev].layout().isEnvironment()) { - if (par.layout().isEnvironment()) { + if (par.layout().isEnvironment() + && pars_[prev].getDepth() == par.getDepth()) { docstring const layout = par.layout().name(); DocumentClass const & tc = bv->buffer().params().documentClass(); lyx::dispatch(FuncRequest(LFUN_LAYOUT, tc.plainLayout().name()));
[LyX/master] Fix indentation of paragraphs after an environment.
commit c85dbfea98787d46d59f900d30c7e3092cc5e750 Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 28 01:07:47 2014 +0200 Fix indentation of paragraphs after an environment. When deciding whether a paragraph should be indented or not, LyX only takes into account default layouts. This is wrong, because an environment could be nested into another one and thus a following paragraph would not be "default". With this patch all paragraphs after an environment are correctly indented, independently of whether their layouts are "default" or not. The latex output (which was modeled following the previous wrong assumption) is also correspondingly adapted. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index de414ea..e67d071 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1898,7 +1898,9 @@ int TextMetrics::leftMargin(int max_width, l_margin = leftMargin(max_width, newpar); // Remove the parindent that has been added // if the paragraph was empty. - if (pars[newpar].empty()) { + if (pars[newpar].empty() && + buffer.params().paragraph_separation == + BufferParams::ParagraphIndentSeparation) { docstring pi = pars[newpar].layout().parindent; l_margin -= theFontMetrics( buffer.params().getFont()).signedWidth(pi); @@ -1916,10 +1918,16 @@ int TextMetrics::leftMargin(int max_width, // This happens after sections or environments in standard classes. // We have to check the previous layout at same depth. - if (tclass.isDefaultLayout(par.layout()) && pit > 0 - && pars[pit - 1].getDepth() >= par.getDepth()) { + if (buffer.params().paragraph_separation == + BufferParams::ParagraphSkipSeparation) + parindent.erase(); + else if (pit > 0 && pars[pit - 1].getDepth() >= par.getDepth()) { pit_type prev = text_->depthHook(pit, par.getDepth()); - if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent) + if (par.layout() == pars[prev].layout()) { + if (prev != pit - 1 + && pars[pit - 1].layout().nextnoindent) + parindent.erase(); + } else if (pars[prev].layout().nextnoindent) parindent.erase(); } diff --git a/src/output_latex.cpp b/src/output_latex.cpp index c862733..735b898 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -202,9 +202,7 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } -static void finishEnvironment(Buffer const & buf, Text const & text, - pit_type nextpit, otexstream & os, - OutputParams const & runparams, +static void finishEnvironment(otexstream & os, OutputParams const & runparams, TeXEnvironmentData const & data) { if (open_encoding_ == CJK && data.cjk_nested) { @@ -236,11 +234,7 @@ static void finishEnvironment(Buffer const & buf, Text const & text, } // Check whether we should output a blank line after the environment - DocumentClass const & tclass = buf.params().documentClass(); - ParagraphList const & pars = text.paragraphs(); - bool next_style_is_default = (nextpit >= runparams.par_end) ? false - : tclass.isDefaultLayout(pars.constIterator(nextpit)->layout()); - if (!data.style->nextnoindent && next_style_is_default) + if (!data.style->nextnoindent) os << '\n'; } @@ -306,7 +300,7 @@ void TeXEnvironment(Buffer const & buf, Text const & text, prepareEnvironment(buf, text, par, os, runparams); // Recursive call to TeXEnvironment! TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(buf, text, pit + 1, os, runparams, data); + finishEnvironment(os, runparams, data); } if (pit != runparams.par_end) @@ -1195,7 +1189,7 @@ void latexParagraphs(Buffer const & buf, prepareEnvironment(buf, text, par, os, runparams); // pit can be changed in TeXEnvironment. TeXEnvironment(buf, text, runparams, pit, os); - finishEnvironment(buf, text, pit + 1, os, runparams, data); + finishEnvironment(os, runparams, data); } if (pit == runparams.par_end) {
[LyX/master] Avoid an assertion.
commit 061509bf756193d1bc0a754e0cf8dab62869ea9d Author: Enrico Forestieri <for...@lyx.org> Date: Wed May 28 20:50:45 2014 +0200 Avoid an assertion. Do not assert if an inset separator is the only item of a List environment. Although it is a weird thing to do, both GUI and latex output can deal with it. diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index e8053cb..1b434a5 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -695,13 +695,13 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const Paragraph const & par = text_->getPar(pit); pos_type last = par.beginOfBody(); - LBUFERR(last > 0); + LBUFERR(last > 0 || par.isEnvSeparator(0)); // -1 because a label ends with a space that is in the label --last; // a separator at this end does not count - if (par.isLineSeparator(last)) + if (last >= 0 && par.isLineSeparator(last)) --last; int w = 0;
[LyX/master] Fix reversion of box insets.
commit da75d3194824c87e2b2fc92fa4644e080aeaf962 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 29 10:44:02 2014 +0200 Fix reversion of box insets. diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 4999368..6752eb9 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -4365,7 +4365,7 @@ def revert_mbox_fbox(document): i += 1 continue BeginLayout = find_token(document.body, "\\begin_layout Plain Layout", j) -EndLayout = find_token(document.body, "\\end_layout", BeginLayout) +EndLayout = find_end_of_layout(document.body, BeginLayout) # replace if width is "" if (width == '""'): document.body[EndLayout:k + 1] = put_cmd_in_ert("}")
[LyX/master] Fix an off-by-one error in the reversion of beamer documents.
commit dbd4d781dcbe73d347a76fed9ca51faf2841e133 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 29 10:55:30 2014 +0200 Fix an off-by-one error in the reversion of beamer documents. diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 6752eb9..a94ef52 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -3789,12 +3789,12 @@ def revert_newframes(document): continue endseq = j subst = ["\\begin_layout %s" % frame_dict[val]] -esubst = ["\\begin_layout EndFrame", "", "\\end_layout"] +esubst = ["", "\\begin_layout EndFrame", "", "\\end_layout"] endseq = endseq + len(esubst) - len(document.body[j : j]) if document.body[j] == "\\end_deeper": -document.body[j : j] = [""] + esubst -else: document.body[j : j] = esubst +else: +document.body[j+1 : j+1] = esubst for q in range(i, j): if document.body[q] == "\\begin_layout %s" % val: document.body[q] = "\\begin_layout %s" % document.default_layout
[LyX/master] Avoid processing multiple times the same paragraph when converting latex arguments.
commit 00802019771bd1b9779d3b39899089abfc38201f Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 29 11:05:34 2014 +0200 Avoid processing multiple times the same paragraph when converting latex arguments. diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index a94ef52..ae95841 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1584,7 +1584,7 @@ def convert_latexargs(document): if argnr > allowed_opts and argnr < first_req: argnr = first_req document.body[p] = "\\begin_inset Argument %d" % argnr -i += 1 +i = parend + 1 def revert_latexargs(document):
[LyX/master] Cleanup seminar.layout after the upgrade to format 50.
commit 00547009c293151dcadb53c93242dca5404813f6 Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 29 22:07:37 2014 +0200 Cleanup seminar.layout after the upgrade to format 50. diff --git a/lib/layouts/seminar.layout b/lib/layouts/seminar.layout index 982512d..34fd4dc 100644 --- a/lib/layouts/seminar.layout +++ b/lib/layouts/seminar.layout @@ -84,22 +84,8 @@ End # It is recommended to use the custom insets instead of paragraph styles. Style LandscapeSlide - Category MainText - KeepEmpty 1 - MarginDynamic - LatexType Paragraph - LatexName dummy - ParIndent MM - Align Block - LabelType Static - LabelString "--- Separate Environment ---" - LabelFont - Family Roman - Series Medium - SizeNormal - Color Blue - EndFont - HTMLLabel NONE + CategoryMainText + KeepEmpty 1 LatexType Environment LatexName slide NextNoIndent1 @@ -107,9 +93,18 @@ Style LandscapeSlide LeftMargin N ParIndent "" TopSep 0.4 + Align Block LabelType Above LabelString "Landscape Slide:" + LabelFont + FamilyRoman + SeriesMedium + Size Normal + Color Blue + EndFont + HTMLLabel NONE End + Style Slide Obsoletedby LandscapeSlide End @@ -123,35 +118,27 @@ Style Slide* ObsoletedBy PortraitSlide End -# EndOfSlide was a dummy style whose main purpose is to separate subsequent -# Slide environments. Nowadays lyx has the special --Separator-- style as -# workaround: - Style ListOfSlides - Category MainText - KeepEmpty 1 - MarginDynamic - LatexType Paragraph - LatexName dummy - ParIndent MM - Align Block - LabelType Static - LabelString "--- Separate Environment ---" - LabelFont - Family Roman - Series Medium - SizeNormal - Color Blue - EndFont - HTMLLabel NONE + CategoryMainText + KeepEmpty 1 LatexType Command LatexName listofslides + Margin Dynamic + ParIndent MM TopSep 0.5 BottomSep 0.5 Align Center -# BottomSep 0 + LabelType Static LabelString "[List Of Slides]" + LabelFont + FamilyRoman + SeriesMedium + Size Normal + Color Blue + EndFont + HTMLLabel NONE End + Style SlideContents CopyStyle ListOfSlides LatexName slidecontents
[LyX/master] Fix compilation on Solaris after last boost upgrade.
commit bc001595302ee63f0c1a4c07a6e15f04ec7143eb Author: Enrico Forestieri <for...@lyx.org> Date: Thu May 29 22:31:16 2014 +0200 Fix compilation on Solaris after last boost upgrade. diff --git a/boost/boost/predef/architecture/sparc.h b/boost/boost/predef/architecture/sparc.h index 30207a0..0faa9d4 100644 --- a/boost/boost/predef/architecture/sparc.h +++ b/boost/boost/predef/architecture/sparc.h @@ -37,7 +37,7 @@ http://www.boost.org/LICENSE_1_0.txt) # if !defined(BOOST_ARCH_SPARC) && defined(__sparcv8) # define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER(8,0,0) # endif -# if !defined(BOOST_ARCH_SPARC) && +# if !defined(BOOST_ARCH_SPARC) # define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_AVAILABLE # endif #endif diff --git a/configure.ac b/configure.ac index a3d699d..9b87677 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,12 @@ char * strerror(int n); # define BOOST_POSIX_PATH 1 #endif +#ifdef __sparc__ +# ifndef __BIG_ENDIAN__ +#define __BIG_ENDIAN__ 1 +# endif +#endif + #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 # define USE_WCHAR_T #endif
[LyX/master] Fix bug #9146.
commit 7d31194085d8665fd10cc2e8fe4a6330b3cd338f Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jun 5 17:33:25 2014 +0200 Fix bug #9146. If LyX does not know about a given file format, it may easily happen that the format is recognized as "latex" and this causes bug #9146. This patch limits the check for a latex format to non-binary files. The strategy for deciding that a file has binary content is the same as that adopted by the "less" program. diff --git a/src/Format.cpp b/src/Format.cpp index e2d23b5..ff7fb34 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -241,12 +241,17 @@ string guessFormatFromContents(FileName const & fn) int const max_count = 50; int count = 0; + // Maximum number of binary chars allowed for latex detection + int const max_bin = 5; + string str; string format; bool firstLine = true; bool backslash = false; + bool maybelatex = false; + int binchars = 0; int dollars = 0; - while ((count++ < max_count) && format.empty()) { + while ((count++ < max_count) && format.empty() && binchars <= max_bin) { if (ifs.eof()) break; @@ -364,16 +369,20 @@ string guessFormatFromContents(FileName const & fn) contains(str, "$$") || contains(str, "\\[") || contains(str, "\\]")) - format = "latex"; + maybelatex = true; else { if (contains(str, '\\')) backslash = true; dollars += count_char(str, '$'); + if (backslash && dollars > 1) + // inline equation + maybelatex = true; } + + binchars += count_bin_chars(str); } - if (format.empty() && backslash && dollars > 1) - // inline equation + if (format.empty() && binchars <= max_bin && maybelatex) format = "latex"; if (format.empty()) { diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index a43feeb..8508e4e 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -943,6 +943,31 @@ int count_char(docstring const & str, docstring::value_type chr) } +int count_bin_chars(string const & str) +{ + QString const qstr = toqstr(str).simplified(); + int count = 0; + QString::const_iterator cit = qstr.begin(); + QString::const_iterator end = qstr.end(); + for (; cit != end; ++cit) { + switch (cit->category()) { + case QChar::Separator_Line: + case QChar::Separator_Paragraph: + case QChar::Other_Control: + case QChar::Other_Format: + case QChar::Other_Surrogate: + case QChar::Other_PrivateUse: + case QChar::Other_NotAssigned: + ++count; + break; + default: + break; + } + } + return count; +} + + docstring const trim(docstring const & a, char const * p) { LASSERT(p, return a); diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 02b5cf2..0d21e95 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -199,6 +199,14 @@ int count_char(std::string const & str, char chr); /// Count all occurences of char \a chr inside \a str int count_char(docstring const & str, docstring::value_type chr); +/** Count all occurences of binary chars inside \a str. +It is assumed that \a str is utf-8 encoded and that a binary char +belongs to the unicode class names Zl, Zp, Cc, Cf, Cs, Co, or Cn +(excluding white space characters such as '\t', '\n', '\v', '\f', '\r'). +See http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt +*/ +int count_bin_chars(std::string const & str); + /** Trims characters off the end and beginning of a string. \code trim("ccabccc", "c") == "ab".
[LyX/master] Fix bug #9151 (Wrong reverse search for images and tables).
commit 44e09b223e0efad3346180ea13f9dfc8d3a58a49 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jun 5 23:46:18 2014 +0200 Fix bug #9151 (Wrong reverse search for images and tables). If the reverse position corresponds to an inset, its paragraph id does not follow the main text numbering. Typically, an inset has only a few paragraph, so that we would jump near the beginning of the document. In this way we at least jump at the beginning of the inset. diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ba0df6e..afc29be 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2295,7 +2295,12 @@ void BufferView::setCursorFromRow(int row) DocIterator const dit = buffer_.getParFromID(tmpid); if (dit == doc_iterator_end(_)) posvalid = false; - else { + else if (dit.depth() > 1) { + // We are an inset. + setCursor(dit); + recenter(); + return; + } else { newpit = dit.pit(); // now have to check pos. newpos = tmppos;
[LyX/master] Fix bug #9153 (Using mathpanel to insert matrix creates extra space on top)
commit ba603db9427d208793a73c67cb97d5c09c91fdee Author: Enrico Forestieri <for...@lyx.org> Date: Fri Jun 6 16:14:24 2014 +0200 Fix bug #9153 (Using mathpanel to insert matrix creates extra space on top) The code was setting the current index before filling the combo box items. diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp index 8106629..457b749 100644 --- a/src/frontends/qt4/GuiMathMatrix.cpp +++ b/src/frontends/qt4/GuiMathMatrix.cpp @@ -63,6 +63,11 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv) { setupUi(this); + for (int i = 0; *VertAligns[i]; ++i) + valignCO->addItem(qt_(VertAligns[i])); + for (int i = 0; *DecoChars[i]; ++i) + decorationCO->addItem(qt_(DecoChars[i])); + table->setMinimumSize(100, 100); rowsSB->setValue(5); columnsSB->setValue(5); @@ -91,11 +96,6 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv) connect(decorationCO, SIGNAL(activated(int)), this, SLOT(decorationChanged(int))); - for (int i = 0; *VertAligns[i]; ++i) - valignCO->addItem(qt_(VertAligns[i])); - for (int i = 0; *DecoChars[i]; ++i) - decorationCO->addItem(qt_(DecoChars[i])); - bc().setPolicy(ButtonPolicy::IgnorantPolicy); }
[LyX/2.1.x] Fix bug #9153 (Using mathpanel to insert matrix creates extra space on top)
commit 970da7c5e275c7bed3bf14aadd4f7c5bed4b1850 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jun 8 23:59:59 2014 +0200 Fix bug #9153 (Using mathpanel to insert matrix creates extra space on top) The code was setting the current index before filling the combo box items. diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp index 8106629..457b749 100644 --- a/src/frontends/qt4/GuiMathMatrix.cpp +++ b/src/frontends/qt4/GuiMathMatrix.cpp @@ -63,6 +63,11 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv) { setupUi(this); + for (int i = 0; *VertAligns[i]; ++i) + valignCO->addItem(qt_(VertAligns[i])); + for (int i = 0; *DecoChars[i]; ++i) + decorationCO->addItem(qt_(DecoChars[i])); + table->setMinimumSize(100, 100); rowsSB->setValue(5); columnsSB->setValue(5); @@ -91,11 +96,6 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv) connect(decorationCO, SIGNAL(activated(int)), this, SLOT(decorationChanged(int))); - for (int i = 0; *VertAligns[i]; ++i) - valignCO->addItem(qt_(VertAligns[i])); - for (int i = 0; *DecoChars[i]; ++i) - decorationCO->addItem(qt_(DecoChars[i])); - bc().setPolicy(ButtonPolicy::IgnorantPolicy); } diff --git a/status.21x b/status.21x index 97fc377..c86f5da 100644 --- a/status.21x +++ b/status.21x @@ -155,6 +155,9 @@ We have fixed several significant issues involving conversion of 2.0 - Fix keyborad input of cyrillic characters in program listings (bug 9102). +- Fix default vertical alignment when inserting a math matrix through the + math toolbar or context menu (bug 9153). + * INTERNALS
[LyX/master] Set the default locale at startup.
commit 82faa6619239c2e57fba9128899bafe29d728e51 Author: Enrico Forestieri <for...@lyx.org> Date: Wed Jun 11 18:23:44 2014 +0200 Set the default locale at startup. On startup, the default locale is "C", meaning that all system functions assume an ascii codeset. The environment's locale settings should be selected by calling setlocale(LC_ALL,""). This is done by Qt during the QCoreApplication initialization but this inizialization is never performed for batch processing and, as a result, LyX is not able to process files whose names contain non-ascii characters. This is not an issue on Windows, where the file names are always stored as UTF-16, so the call is only performed for unix-like platforms (this also includes cygwin, due to its own filenames management that allows using characters which are forbidden to native programs). diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 92cbf15..4179d49 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -215,6 +215,9 @@ void init(int argc, char * argv[]) argc_ = argc; argv_ = argv; + // Set environment's default locale + setlocale(LC_ALL, ""); + // Make sure that the TEMP variable is set // and sync the Windows environment. setenv("TEMP", "/tmp", false); diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index b85bdb2..03dfb38 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -46,6 +46,9 @@ void init(int argc, char * argv[]) { argc_ = argc; argv_ = argv; + + // Set environment's default locale + setlocale(LC_ALL, ""); }
[LyX/2.1.x] Set the default locale at startup.
commit 32e42f2f81c9eca4119b2483505452a8fba57844 Author: Enrico Forestieri <for...@lyx.org> Date: Wed Jun 11 19:08:44 2014 +0200 Set the default locale at startup. On startup, the default locale is "C", meaning that all system functions assume an ascii codeset. The environment's locale settings should be selected by calling setlocale(LC_ALL,""). This is done by Qt during the QCoreApplication initialization but this inizialization is never performed for batch processing and, as a result, LyX is not able to process files whose names contain non-ascii characters. This is not an issue on Windows, where the file names are always stored as UTF-16, so the call is only performed for unix-like platforms (this also includes cygwin, due to its own filenames management that allows using characters which are forbidden to native programs). diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 92cbf15..4179d49 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -215,6 +215,9 @@ void init(int argc, char * argv[]) argc_ = argc; argv_ = argv; + // Set environment's default locale + setlocale(LC_ALL, ""); + // Make sure that the TEMP variable is set // and sync the Windows environment. setenv("TEMP", "/tmp", false); diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index b85bdb2..03dfb38 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -46,6 +46,9 @@ void init(int argc, char * argv[]) { argc_ = argc; argv_ = argv; + + // Set environment's default locale + setlocale(LC_ALL, ""); } diff --git a/status.21x b/status.21x index c86f5da..b4501a6 100644 --- a/status.21x +++ b/status.21x @@ -79,6 +79,9 @@ What's new - Output arguments required by arguments with DefaultArg or PresetArg (bug 9128). +- Fix export from command line when included files have names with non-ascii + characters. + * LYX2LYX
[LyX/master] Make binary file detection more robust.
commit f439609304371eb3dd7ac238f39c470743261597 Author: Enrico Forestieri <for...@lyx.org> Date: Wed Jun 11 23:04:39 2014 +0200 Make binary file detection more robust. The magic library can detect the charset used by a file. While this detection is not full proof, actually the library seems to be infallible as regards the binary nature of a file. So, use libmagic for the detection and fallback to the previous method if the library is not installed or its database cannot be loaded. diff --git a/src/Format.cpp b/src/Format.cpp index 44e3f63..063b683 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -241,17 +241,13 @@ string guessFormatFromContents(FileName const & fn) int const max_count = 50; int count = 0; - // Maximum number of binary chars allowed for latex detection - int const max_bin = 5; - string str; string format; bool firstLine = true; bool backslash = false; bool maybelatex = false; - int binchars = 0; int dollars = 0; - while ((count++ < max_count) && format.empty() && binchars <= max_bin) { + while ((count++ < max_count) && format.empty() && !maybelatex) { if (ifs.eof()) break; @@ -378,17 +374,9 @@ string guessFormatFromContents(FileName const & fn) // inline equation maybelatex = true; } - - // Note that this is formally not correct, since count_bin_chars - // expects utf8, and str can be anything: plain text in any - // encoding, or really binary data. In practice it works, since - // QString::fromUtf8() drops invalid utf8 sequences, and while - // the exact number may not be correct, we still get a high - // number for truly binary files. - binchars += count_bin_chars(str); } - if (format.empty() && binchars <= max_bin && maybelatex) + if (format.empty() && maybelatex && !isBinaryFile(fn)) format = "latex"; if (format.empty()) { diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index b9c7e7f..d167d6a 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -43,6 +43,9 @@ #include "support/regex.h" #include +#ifdef HAVE_MAGIC_H +#include +#endif #include #include @@ -91,6 +94,60 @@ bool isValidDVIFileName(string const & filename) } +bool isBinaryFile(FileName const & filename) +{ + bool isbinary = false; + if (filename.empty() || !filename.exists()) + return isbinary; + +#ifdef HAVE_MAGIC_H + magic_t magic_cookie = magic_open(MAGIC_MIME_ENCODING); + if (magic_cookie) { + bool detected = true; + if (magic_load(magic_cookie, NULL) != 0) { + LYXERR(Debug::FILES, "isBinaryFile: " + "Could not load magic database - " + << magic_error(magic_cookie)); + detected = false; + } else { + char const *charset = magic_file(magic_cookie, + filename.toFilesystemEncoding().c_str()); + isbinary = contains(charset, "binary"); + } + magic_close(magic_cookie); + if (detected) + return isbinary; + } +#endif + // Try by looking for binary chars at the beginning of the file. + // Note that this is formally not correct, since count_bin_chars + // expects utf8, and the passed string can be anything: plain text + // in any encoding, or really binary data. In practice it works, + // since QString::fromUtf8() drops invalid utf8 sequences, and + // while the exact number may not be correct, we still get a high + // number for truly binary files. + + ifstream ifs(filename.toFilesystemEncoding().c_str()); + if (!ifs) + return isbinary; + + // Maximum strings to read + int const max_count = 50; + + // Maximum number of binary chars allowed + int const max_bin = 5; + + int count = 0; + int binchars = 0; + string str; + while (count++ < max_count && !ifs.eof()) { + getline(ifs, str); + binchars += count_bin_chars(str); + } + return binchars > max_bin; +} + + string const latex_path(string const & original_path, latex_path_extension extension, latex_path_dots dots) diff --git a/src/support/filetools.h b/src/support/filetools.h index fbc14f8..9d91f33 100644 --- a/src/support/filetools.h +++ b/src/sup
[LyX/master] Fix make check.
commit 60a1b3b83c1c535e2cc4a9963ab4c32dc238a931 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Jul 11 11:14:02 2014 +0200 Fix make check. diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 708d19d..76035c4 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -159,21 +159,21 @@ if INSTALL_MACOSX ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit -framework ApplicationServices endif -check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) +check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@ check_convert_LDFLAGS = $(QT4_LDFLAGS) $(ADD_FRAMEWORKS) check_convert_SOURCES = \ tests/check_convert.cpp \ tests/dummy_functions.cpp \ tests/boost.cpp -check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) +check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@ check_filetools_LDFLAGS = $(QT4_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_filetools_SOURCES = \ tests/check_filetools.cpp \ tests/dummy_functions.cpp \ tests/boost.cpp -check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) +check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) $(QT4_CORE_LIBS) $(LIBSHLWAPI) @LIBS@ check_lstrings_LDFLAGS = $(QT4_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_lstrings_SOURCES = \ tests/check_lstrings.cpp \
[LyX/master] Fix import of latex documents with scaled fonts.
commit b60b505fd82866dc57d4522b3ff73ae5bd337612 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Jul 11 11:21:45 2014 +0200 Fix import of latex documents with scaled fonts. diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 4179d49..e0c0bd1 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -217,6 +217,7 @@ void init(int argc, char * argv[]) // Set environment's default locale setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); // Make sure that the TEMP variable is set // and sync the Windows environment. diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index 03dfb38..b298a7d 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -49,6 +49,7 @@ void init(int argc, char * argv[]) // Set environment's default locale setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); } diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index d9c823f..934420a 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -424,7 +424,8 @@ bool scale_as_percentage(string const & scale, string & percentage) if (pos != string::npos) { string value = scale.substr(pos + 1); if (isStrDbl(value)) { - percentage = convert(100 * convert(value)); + percentage = convert( + static_cast(100 * convert(value))); return true; } }
[LyX/master] Fix scale parameter for fonts.
commit 6a5aa1cab18fb5c7e71c798771e6230d539a509a Author: Enrico Forestieri <for...@lyx.org> Date: Fri Jul 11 16:12:08 2014 +0200 Fix scale parameter for fonts. When a font is scaled by a certain percentage in the document settings, LyX was outputting a ridiculous parameter value. For example, if the font is scaled 90%, the corresponding parameter was "scaled=0.89976". The patch avoids this and, in the previous case, one gets "scaled=0.9". This is not only cosmetic, because in roundtrip conversions the parameter would be continuosly changing. This commit and b60b505f should be backported to the 2.1.x branch, where reimporting with tex2lyx an exported document produces wrong results (also in version 2.1.0). diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index 676179f..9010615 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -259,8 +259,9 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool && providesScale(ot1, complete, nomath)) { if (!os.str().empty()) os << ','; - os << subst(to_ascii(scaleoption_), "$$val", - convert(float(scale) / 100)); + ostringstream value; + value << float(scale) / 100; + os << subst(to_ascii(scaleoption_), "$$val", value.str()); } return os.str(); }
[LyX/master] Fix compatibility issue with 64-bit cygwin.
commit b3735501c7952ec53600f94d90ae8e164300ca76 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Jul 11 16:49:10 2014 +0200 Fix compatibility issue with 64-bit cygwin. diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index e0c0bd1..572273c 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -449,7 +449,7 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode, // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows; char const * action = (mode == VIEW) ? "open" : "edit"; - bool success = reinterpret_cast(ShellExecute(NULL, action, + bool success = reinterpret_cast(ShellExecute(NULL, action, win_path.c_str(), NULL, NULL, 1)) > 32; if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
[LyX/master] Fix bug #9193: Spacing modification not exact
commit 5bd14af8871b8f87c2c73ca8392b7c72217ad72d Author: Enrico Forestieri <for...@lyx.org> Date: Sat Jul 12 19:12:08 2014 +0200 Fix bug #9193: Spacing modification not exact The conversion from floating point to string performed by boost:lexical_cast does not allow specifying a precision and, for example, values such as 0.9 are resturned as 0.89976. The standard C++ way for performing the conversion is using std::ostringstream which is exempt from this problem, even if less efficient. For the sake of accuracy, boost::lexical_cast is ditched in favor of the ostrinsgstream implementation. In C++11 another option would be using std::to_string, but I think it is not as efficient as the boost way and not worth implementing through #ifdef's. Incidentally, this patch would have also fixed #9190 and all similar cases involving the use of convert(float|double). diff --git a/src/support/convert.cpp b/src/support/convert.cpp index 70cd91e..6b985f5 100644 --- a/src/support/convert.cpp +++ b/src/support/convert.cpp @@ -17,6 +17,7 @@ #include #include +#include //needed for Mac OSX 10.5.2 Leopard #include @@ -106,14 +107,18 @@ docstring convert(long l) template<> string convert(float f) { - return lexical_cast(f); + std::ostringstream val; + val << f; + return val.str(); } template<> string convert(double d) { - return lexical_cast(d); + std::ostringstream val; + val << d; + return val.str(); }
[LyX/master] Revert 6a5aa1ca
commit 2af17f8f89e81b1be98748a354454b079b8b65d3 Author: Enrico Forestieri <for...@lyx.org> Date: Sat Jul 12 19:52:12 2014 +0200 Revert 6a5aa1ca That commit is obsoleted by 5bd14af8. diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index 9010615..676179f 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -259,9 +259,8 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool && providesScale(ot1, complete, nomath)) { if (!os.str().empty()) os << ','; - ostringstream value; - value << float(scale) / 100; - os << subst(to_ascii(scaleoption_), "$$val", value.str()); + os << subst(to_ascii(scaleoption_), "$$val", + convert(float(scale) / 100)); } return os.str(); }
[LyX/master] Use getent instead of grepping /etc/passwd.
commit ff506c8e427e71b36759d09a012076cf59369e7e Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jul 13 14:39:05 2014 +0200 Use getent instead of grepping /etc/passwd. Forthcoming versions of cygwin will use a different mechanism for obtaining passwd/group information based on /etc/nsswitch.conf. Thus, it will not be guaranteed that the files /etc/passwd and /etc/group even exist. The recommended way for obtaining those info is by using the getent command, which already works in current versions. diff --git a/development/cygwin/lyxprofile b/development/cygwin/lyxprofile index f51bd55..afa21be 100644 --- a/development/cygwin/lyxprofile +++ b/development/cygwin/lyxprofile @@ -1,7 +1,7 @@ # Set up the home directory if not already set in the system environment. if [ -z "${HOME}" ]; then USER=`id -un` - HOME=`grep "^${USER}:" /etc/passwd | cut -d: -f6` + HOME=`getent passwd "${USER}" | cut -d: -f6` if [ -z "${HOME}" -o ! -d "${HOME}" ]; then HOME="/home/${USER}" test -d "${HOME}" || HOME=/tmp
[LyX/master] Add some postscript and pdf viewers for Unix and Windows.
commit d5210c555a4b51fa73eb447f2d86172185562a11 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jul 13 19:59:31 2014 +0200 Add some postscript and pdf viewers for Unix and Windows. For Windows: AcroRd32 and gsview (both 32 and 64 bit versions). For Unix: qpdfview. Qpdfview is a nice alternative to Okular for KDE users and a superior alternative to Evince for Gnome users, due to its complete synctex support. It only depends on Qt libraries for the graphical interface. diff --git a/lib/configure.py b/lib/configure.py index c8e8267..db2df66 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -646,15 +646,15 @@ def checkFormatEntries(dtl_tools): # #checkProg('a Postscript interpreter', ['gs'], # rc_entry = [ r'\ps_command "%%"' ]) -checkViewer('a Postscript previewer', ['kghostview', 'okular', 'evince', 'gv', 'ghostview -swap'], +checkViewer('a Postscript previewer', ['kghostview', 'okular', 'qpdfview --unique', 'evince', 'gv', 'ghostview -swap', 'gsview64', 'gsview32'], rc_entry = [r'''\Format epseps EPS"" "%%" "" "vector""image/x-eps" \Format eps2 eps"EPS (uncropped)" "" "%%" "" "vector""" \Format eps3 eps"EPS (cropped)" "" "%%" "" "document,menu=export" "" \Format ps ps Postscript t "%%" "" "document,vector,menu=export" "application/postscript"''']) # for xdg-open issues look here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg151818.html # the MIME type is set for pdf6, because that one needs to be autodetectable by libmime -checkViewer('a PDF previewer', ['pdfview', 'kpdf', 'okular', 'evince', 'kghostview', 'xpdf', 'SumatraPDF', 'acrobat', 'acroread', 'mupdf', \ - 'gv', 'ghostview'], +checkViewer('a PDF previewer', ['pdfview', 'kpdf', 'okular', 'qpdfview --unique', 'evince', 'kghostview', 'xpdf', 'SumatraPDF', 'acrobat', 'acroread', 'mupdf', \ + 'gv', 'ghostview', 'AcroRd32', 'gsview64', 'gsview32'], rc_entry = [r'''\Format pdfpdf"PDF (ps2pdf)" P "%%" "" "document,vector,menu=export" "" \Format pdf2 pdf"PDF (pdflatex)"F "%%" "" "document,vector,menu=export" "" \Format pdf3 pdf"PDF (dvipdfm)" m "%%" "" "document,vector,menu=export" ""
[LyX/master] Add forward search command for qpdfview.
commit 294d08b1bfd58452fe4f43049b957fb145d4fb52 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jul 13 20:08:43 2014 +0200 Add forward search command for qpdfview. Also update docs explaining how to activate reverse search in qpdfview. diff --git a/lib/doc/Additional.lyx b/lib/doc/Additional.lyx index 2d76f55..fdf693f 100644 --- a/lib/doc/Additional.lyx +++ b/lib/doc/Additional.lyx @@ -131,11 +131,12 @@ End \papercolumns 1 \papersides 2 \paperpagestyle headings -\tracking_changes false +\tracking_changes true \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict true +\author 711066561 "Enrico Forestieri" \end_header \begin_body @@ -5252,7 +5253,47 @@ lyxpipe" \end_inset - on Windows (but any working path can be used). + on Windows ( +\change_deleted 711066561 1405258697 +but +\change_inserted 711066561 1405258701 +where +\change_unchanged + any working path +\change_inserted 711066561 1405258613 +instead of lyxpipe +\change_unchanged +can be used +\change_inserted 711066561 1405258962 +, for example +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted 711066561 1405258868 +" +\backslash + +\backslash +. +\backslash +pipe +\backslash +my +\backslash +lyx +\backslash +pipe" +\change_unchanged + +\end_layout + +\end_inset + + would also work +\change_unchanged +). You \emph on must @@ -5341,13 +5382,20 @@ lyx -dbg lyxserver \end_layout \begin_layout Standard -You can find a complete example client written in C in the source distribution - as +You can find a complete example client written in C +\change_inserted 711066561 1405258366 +++ +\change_unchanged + in the source distribution as \begin_inset Flex Code status collapsed \begin_layout Plain Layout development/lyxserver/server_monitor.c +\change_inserted 711066561 1405258386 +pp +\change_unchanged + \end_layout \end_inset @@ -5356,7 +5404,11 @@ development/lyxserver/server_monitor.c \end_layout \begin_layout Standard -Another useful tool is the command-line based clientfound in +Another useful tool is the command-line based client +\change_inserted 711066561 1405258403 + +\change_unchanged +found in \begin_inset Flex Code status collapsed @@ -5696,8 +5748,11 @@ Some DVI/PDF viewers status collapsed \begin_layout Plain Layout -The following viewers offer the reverse PDF search feature: Okular on KDE/Linux, - Skim on Mac OSX and SumatraPDF on Windows. +The following viewers offer the reverse PDF search feature: Okular on KDE/Linux +\change_inserted 711066561 1405273809 +, Qpdfview on Unix +\change_unchanged +, Skim on Mac OSX and SumatraPDF on Windows. \end_layout \end_inset @@ -5842,7 +5897,13 @@ synctex=-1 \end_layout \begin_layout Standard -Please aöso note that including the +Please a +\change_deleted 711066561 1405259326 +ö +\change_inserted 711066561 1405259326 +l +\change_unchanged +so note that including the \begin_inset Flex Code status collapsed @@ -6154,8 +6215,11 @@ The generation of the required info can be forced by changing the converter \end_inset . - Also note that only a few PDF viewers (Skim on the Mac, SumatraPDF on Windows) - already provide SyncTeX support. + Also note that only a few PDF viewers ( +\change_inserted 711066561 1405273879 +Okular and Qpdfview on Unix, +\change_unchanged +Skim on the Mac, SumatraPDF on Windows) already provide SyncTeX support. \end_layout \begin_layout Standard @@ -6636,6 +6700,68 @@ lyxclient -g %f %l \begin_layout Standard Reverse search is triggered by SHIFT-click. +\change_inserted 711066561 1405259853 + +\end_layout + +\begin_layout Subsubsection* + +\change_inserted 711066561 1405273730 +Qpdfview (Unix) +\end_layout + +\begin_layout Standard + +\change_inserted 711066561 1405263147 +Qpdfview supports SyncTeX since version 0.3.5. + Go to +\begin_inset Flex MenuItem +status collapsed + +\begin_layout Plain Layout + +\change_inserted 711066561 1405260331 +Edit\SpecialChar \menuseparator +Settings\SpecialChar \ldots{} +\SpecialChar \menuseparator +Behavior +\change_unchanged + +\end_layout + +\end_inset + +, click on the input field of the +\begin_inset Quotes eld +\end_inset + +Source editor +\begin_inset Quotes erd +\end_inset + + item and add the command +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted 711066561 1405260473 +lyxclient -g %1 %2 +\change_unchanged + +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Standard + +\change_inserted 711066561 1405260506 +Reverse search is triggered by double-click. +\change_unchanged + \end_layout \begin_layout Subsubsection* @@ -7181,7 +7307,7 @@ $$o Note that only some of the viewers provide full forward search functionality, among them yap, xdvi, okular \begin_inset Foot -status open +status collapsed \begin_layout Plain Layout You might want to set @@ -7216,15 +7342,35 @@ Formats
[LyX/master] Fix build on FreeBSD.
commit 4342411297de880ddd4c950c45b91258c78b8635 Author: Enrico Forestieri <for...@lyx.org> Date: Wed Jul 16 22:25:49 2014 +0200 Fix build on FreeBSD. Notified by Raphael Kubo da Costa. diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index b298a7d..2635d67 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -23,6 +23,7 @@ #include "support/lassert.h" #include +#include #include #ifdef __APPLE__
[LyX/master] Update autotools for building with Qt5.
commit 4bdeae27334536164cb7e37da9a9e491075fd682 Author: Enrico Forestieri <for...@lyx.org> Date: Sat Jul 19 03:34:28 2014 +0200 Update autotools for building with Qt5. The option --enable-qt5 allows configuring for Qt5. The default is Qt4. Nothing special is done with respect to Qt4, apart from pulling in the correct libraries. Indeed, other than the core and gui libraries, now also the concurrent and widgets libraries are needed. diff --git a/INSTALL b/INSTALL index a330a0b..2c36846 100644 --- a/INSTALL +++ b/INSTALL @@ -14,8 +14,8 @@ These four steps will compile, test and install LyX: distribution). 1) ./configure configures LyX according to your system. You - may have to set --with-qt4-dir= - (for example, "--with-qt4-dir=/usr/share/qt4/") if the + may have to set --with-qt-dir= + (for example, "--with-qt-dir=/usr/share/qt4/") if the environment variable QTDIR is not set and pkg-config is not available. diff --git a/INSTALL.MacOSX b/INSTALL.MacOSX index 666e4a7..3acceb6 100644 --- a/INSTALL.MacOSX +++ b/INSTALL.MacOSX @@ -166,10 +166,10 @@ adjust some environment variables to do so. The required compiler flags to compile a Qt4 application has to be provided. - export QT4_CORE_CFLAGS="-FQtCore" - export QT4_CORE_LIBS="-framework QtCore" - export QT4_FRONTEND_CFLAGS="-FQtGui" - export QT4_FRONTEND_LIBS="-framework QtGui" + export QT_CORE_CFLAGS="-FQtCore" + export QT_CORE_LIBS="-framework QtCore" + export QT_FRONTEND_CFLAGS="-FQtGui" + export QT_FRONTEND_LIBS="-framework QtGui" Depending on the architecture and target os add the compiler flags: @@ -202,7 +202,7 @@ adjust some environment variables to do so. --with-libiconv-prefix=/usr \ --with-x=no \ --prefix=/path/to/LyX.app \ - --with-qt4-dir=/path/to/Qt4 + --with-qt-dir=/path/to/Qt4 make make install-strip @@ -224,7 +224,7 @@ Instead of the instructions above, do the following: --with-x=no \ --disable-stdlib-debug \ --prefix=/path/to/LyX.app \ - --with-qt4-dir=/path/to/Qt4 + --with-qt-dir=/path/to/Qt4 make make install-strip @@ -239,7 +239,7 @@ Please read the script if you're about to make a distributable disk image. To use it, cd to the top of the LyX source hierarchy, and enter: - sh development/LyX-Mac-binary-release.sh --with-qt4-dir=/path/to/Qt4 + sh development/LyX-Mac-binary-release.sh --with-qt-dir=/path/to/Qt4 This script automates all steps of the build process. It detects the sources for Qt4, Aspell and Hunspell when placed in a diff --git a/config/qt4.m4 b/config/qt4.m4 index 58edd85..d31f321 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -1,5 +1,5 @@ dnl check a particular libname -AC_DEFUN([QT4_TRY_LINK], +AC_DEFUN([QT_TRY_LINK], [ SAVE_LIBS="$LIBS" LIBS="$LIBS $1" @@ -13,60 +13,69 @@ AC_DEFUN([QT4_TRY_LINK], break_me_(\\\); #endif ], - qt4_cv_libname=$1, + qt_cv_libname=$1, ) LIBS="$SAVE_LIBS" ]) dnl check we can do a compile -AC_DEFUN([QT4_CHECK_COMPILE], +AC_DEFUN([QT_CHECK_COMPILE], [ - AC_MSG_CHECKING([for Qt 4 library name]) + AC_MSG_CHECKING([for Qt library name]) - AC_CACHE_VAL(qt4_cv_libname, + AC_CACHE_VAL(qt_cv_libname, [ AC_LANG_CPLUSPLUS SAVE_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $QT4_INCLUDES $QT4_LDFLAGS" - for libname in -lQtCore -lQtCore4 '-framework QtCore' + CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS" + qt_corelibs="-lQtCore -lQtCore4" + qt_guilibs="'-lQtCore -lQtGui' '-lQtCore4 -lQtGui4'" + if test $USE_QT5 = "yes" ; then + qt_corelibs="-lQt5Core" + qt_guilibs="-lQt5Core -lQt5Concurrent -lQt5Gui -lQt5Widgets" + fi + for libname in $qt_corelibs '-framework QtCore' do - QT4_TRY_LINK($libname) - if test -n "$qt4_cv_libname"; then - QT4_CORE_LIB="$qt4_cv_libname" + QT_TRY_LINK($libname) + if test -n "$qt_cv_libname"; then + QT_CORE_LIB="$qt_cv_libname" break; fi done - qt4_cv_libname= - for libname in '-lQtCore -lQtGui' \ - '-lQtCore4 -lQtGui4' \ + qt_cv_libname= + for libname in $qt_guilibs \
[LyX/2.1.x] Fix bugs 9190 and 9193.
commit 5f7948e5a52b7c6e375b5fbe676578a8b8117de0 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Jul 28 00:33:13 2014 +0200 Fix bugs 9190 and 9193. The conversion from floating point to string performed by boost:lexical_cast does not allow specifying a precision and, for example, values such as 0.9 are returned as 0.89976. The standard C++ way for performing the conversion is using std::ostringstream which is exempt from this problem, even if less efficient. For the sake of accuracy, boost::lexical_cast is ditched in favor of the ostrinsgstream implementation. In C++11 another option would be using std::to_string, but I think it is not as efficient as the boost way and not worth implementing through #ifdef's. diff --git a/src/support/convert.cpp b/src/support/convert.cpp index 70cd91e..6b985f5 100644 --- a/src/support/convert.cpp +++ b/src/support/convert.cpp @@ -17,6 +17,7 @@ #include #include +#include //needed for Mac OSX 10.5.2 Leopard #include @@ -106,14 +107,18 @@ docstring convert(long l) template<> string convert(float f) { - return lexical_cast(f); + std::ostringstream val; + val << f; + return val.str(); } template<> string convert(double d) { - return lexical_cast(d); + std::ostringstream val; + val << d; + return val.str(); } diff --git a/status.21x b/status.21x index be981c2..e5b2cc3 100644 --- a/status.21x +++ b/status.21x @@ -87,6 +87,9 @@ What's new - Fix potential bug spotted by cppcheck. +- Fix problems arising when converting floating point values to the + corresponding string representation (bugs 9190 and 9193). + * DOCUMENTATION AND LOCALIZATION
[LyX/2.1.x] Fix bug #9151 (Wrong reverse search for images and tables).
commit 2a0b22ba9e650ee8be3cd76a636c61656501f90f Author: Enrico Forestieri <for...@lyx.org> Date: Sun Aug 3 16:47:22 2014 +0200 Fix bug #9151 (Wrong reverse search for images and tables). If the reverse position corresponds to an inset, its paragraph id does not follow the main text numbering. Typically, an inset has only a few paragraphs, so that we would jump near the beginning of the document. Now the cursor in LyX jumps to the right spot. diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ae3b640..324c65d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2290,10 +2290,17 @@ void BufferView::setCursorFromRow(int row) // we need to make sure that the row and position // we got back are valid, because the buffer may well // have changed since we last generated the LaTeX. - DocIterator const dit = buffer_.getParFromID(tmpid); + DocIterator dit = buffer_.getParFromID(tmpid); if (dit == doc_iterator_end(_)) posvalid = false; - else { + else if (dit.depth() > 1) { + // We are in an inset. + pos_type lastpos = dit.lastpos(); + dit.pos() = tmppos > lastpos ? lastpos : tmppos; + setCursor(dit); + recenter(); + return; + } else { newpit = dit.pit(); // now have to check pos. newpos = tmppos; diff --git a/status.21x b/status.21x index 02b4cd8..5f3fc62 100644 --- a/status.21x +++ b/status.21x @@ -80,6 +80,8 @@ What's new - Fix listings validator with regard to aboveskip and belowskip (bug 7373). +- Fix reverse search in insets (figures, tables, branches, etc.) (bug 9151). + * INTERNALS
[LyX/2.1.x] Fix import of latex documents with scaled fonts.
commit 154cd4111964b6e009f323c3d55249b52d03cebd Author: Enrico Forestieri <for...@lyx.org> Date: Sun Aug 3 18:42:04 2014 +0200 Fix import of latex documents with scaled fonts. diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 4179d49..e0c0bd1 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -217,6 +217,7 @@ void init(int argc, char * argv[]) // Set environment's default locale setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); // Make sure that the TEMP variable is set // and sync the Windows environment. diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index 03dfb38..b298a7d 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -49,6 +49,7 @@ void init(int argc, char * argv[]) // Set environment's default locale setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); } diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 0676cad..c87b766 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -424,7 +424,8 @@ bool scale_as_percentage(string const & scale, string & percentage) if (pos != string::npos) { string value = scale.substr(pos + 1); if (isStrDbl(value)) { - percentage = convert(100 * convert(value)); + percentage = convert( + static_cast(100 * convert(value))); return true; } } diff --git a/status.21x b/status.21x index d58771c..7997e0f 100644 --- a/status.21x +++ b/status.21x @@ -57,6 +57,8 @@ What's new - Fix wrong line spacing in last paragraph of a document if the font size is non-normal (bug 9231). +- Fix import of latex documents with scaled fonts. + * LYX2LYX
[LyX/2.1.x] Fix compatibility issue with 64-bit cygwin.
commit 47e263fa7f58af4da004447257c88a0db9d3a724 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Aug 3 18:53:33 2014 +0200 Fix compatibility issue with 64-bit cygwin. diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index e0c0bd1..572273c 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -449,7 +449,7 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode, // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows; char const * action = (mode == VIEW) ? "open" : "edit"; - bool success = reinterpret_cast(ShellExecute(NULL, action, + bool success = reinterpret_cast(ShellExecute(NULL, action, win_path.c_str(), NULL, NULL, 1)) > 32; if (!path.empty() && !lyxrc.texinputs_prefix.empty()) { diff --git a/status.21x b/status.21x index 7997e0f..4528411 100644 --- a/status.21x +++ b/status.21x @@ -44,6 +44,8 @@ What's new * BUILD/INSTALLATION +- Fix compatibility issue with 64-bit cygwin. + ** Bug fixes:
[LyX/2.1.x] Use getent instead of grepping /etc/passwd.
commit 64cc8a1c1ee26aff2e51c6126e75d870c5e89bc7 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Aug 3 18:59:54 2014 +0200 Use getent instead of grepping /etc/passwd. Forthcoming versions of cygwin will use a different mechanism for obtaining passwd/group information based on /etc/nsswitch.conf. Thus, it will not be guaranteed that the files /etc/passwd and /etc/group even exist. The recommended way for obtaining those info is by using the getent command, which already works in current versions. diff --git a/development/cygwin/lyxprofile b/development/cygwin/lyxprofile index f51bd55..afa21be 100644 --- a/development/cygwin/lyxprofile +++ b/development/cygwin/lyxprofile @@ -1,7 +1,7 @@ # Set up the home directory if not already set in the system environment. if [ -z "${HOME}" ]; then USER=`id -un` - HOME=`grep "^${USER}:" /etc/passwd | cut -d: -f6` + HOME=`getent passwd "${USER}" | cut -d: -f6` if [ -z "${HOME}" -o ! -d "${HOME}" ]; then HOME="/home/${USER}" test -d "${HOME}" || HOME=/tmp diff --git a/status.21x b/status.21x index 4528411..716e014 100644 --- a/status.21x +++ b/status.21x @@ -46,6 +46,9 @@ What's new - Fix compatibility issue with 64-bit cygwin. +- On Cygwin, use getent instead of grepping /etc/passwd for determining + the user's home directory when launching LyX through the gui wrapper. + ** Bug fixes:
[LyX/2.1.x] Add some postscript and pdf viewers for Unix and Windows.
commit a8b7e0a18b38d67594836cb7295b6e2e21aa9c15 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Aug 3 19:26:34 2014 +0200 Add some postscript and pdf viewers for Unix and Windows. For Windows: AcroRd32, SumatraPDF and gsview (both 32 and 64 bit versions). For Unix: qpdfview. Qpdfview is a nice alternative to Okular for KDE users and a superior alternative to Evince for Gnome users, due to its complete synctex support. It only depends on Qt libraries for the graphical interface. diff --git a/lib/configure.py b/lib/configure.py index 30cb407..5fdd1e6 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -646,15 +646,15 @@ def checkFormatEntries(dtl_tools): # #checkProg('a Postscript interpreter', ['gs'], # rc_entry = [ r'\ps_command "%%"' ]) -checkViewer('a Postscript previewer', ['kghostview', 'okular', 'evince', 'gv', 'ghostview -swap'], +checkViewer('a Postscript previewer', ['kghostview', 'okular', 'qpdfview --unique', 'evince', 'gv', 'ghostview -swap', 'gsview64', 'gsview32'], rc_entry = [r'''\Format epseps EPS"" "%%" "" "vector""image/x-eps" \Format eps2 eps"EPS (uncropped)" "" "%%" "" "vector""" \Format eps3 eps"EPS (cropped)" "" "%%" "" "document,menu=export" "" \Format ps ps Postscript t "%%" "" "document,vector,menu=export" "application/postscript"''']) # for xdg-open issues look here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg151818.html # the MIME type is set for pdf6, because that one needs to be autodetectable by libmime -checkViewer('a PDF previewer', ['pdfview', 'kpdf', 'okular', 'evince', 'kghostview', 'xpdf', 'acrobat', 'acroread', 'mupdf', \ - 'gv', 'ghostview'], +checkViewer('a PDF previewer', ['pdfview', 'kpdf', 'okular', 'qpdfview --unique', 'evince', 'kghostview', 'xpdf', 'SumatraPDF', 'acrobat', 'acroread', 'mupdf', \ + 'gv', 'ghostview', 'AcroRd32', 'gsview64', 'gsview32'], rc_entry = [r'''\Format pdfpdf"PDF (ps2pdf)" P "%%" "" "document,vector,menu=export" "" \Format pdf2 pdf"PDF (pdflatex)"F "%%" "" "document,vector,menu=export" "" \Format pdf3 pdf"PDF (dvipdfm)" m "%%" "" "document,vector,menu=export" "" diff --git a/lib/doc/Additional.lyx b/lib/doc/Additional.lyx index 2d76f55..fdf693f 100644 --- a/lib/doc/Additional.lyx +++ b/lib/doc/Additional.lyx @@ -131,11 +131,12 @@ End \papercolumns 1 \papersides 2 \paperpagestyle headings -\tracking_changes false +\tracking_changes true \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict true +\author 711066561 "Enrico Forestieri" \end_header \begin_body @@ -5252,7 +5253,47 @@ lyxpipe" \end_inset - on Windows (but any working path can be used). + on Windows ( +\change_deleted 711066561 1405258697 +but +\change_inserted 711066561 1405258701 +where +\change_unchanged + any working path +\change_inserted 711066561 1405258613 +instead of lyxpipe +\change_unchanged +can be used +\change_inserted 711066561 1405258962 +, for example +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted 711066561 1405258868 +" +\backslash + +\backslash +. +\backslash +pipe +\backslash +my +\backslash +lyx +\backslash +pipe" +\change_unchanged + +\end_layout + +\end_inset + + would also work +\change_unchanged +). You \emph on must @@ -5341,13 +5382,20 @@ lyx -dbg lyxserver \end_layout \begin_layout Standard -You can find a complete example client written in C in the source distribution - as +You can find a complete example client written in C +\change_inserted 711066561 1405258366 +++ +\change_unchanged + in the source distribution as \begin_inset Flex Code status collapsed \begin_layout Plain Layout development/lyxserver/server_monitor.c +\change_inserted 711066561 1405258386 +pp +\change_unchanged + \end_layout \end_inset @@ -5356,7 +5404,11 @@ development/lyxserver/server_monitor.c \end_layout \begin_layout Standard -Another useful tool is the command-line based clientfound in +Another useful tool is the command-line based client +\change_inserted 711066561 1405258403 + +\change_unchanged +found in \begin_inset Flex Code status collapsed @@ -5696,8 +5748,11 @@ Some DVI/PDF viewers status collapsed \begin_layout Plain Layout -The
[LyX/2.1.x] Fix bug #9146 (Graphics conversion problem).
commit e2d834e8d07a73c5e4fa49ca3e7aff651e2c0b8a Author: Enrico Forestieri <for...@lyx.org> Date: Mon Aug 4 18:52:20 2014 +0200 Fix bug #9146 (Graphics conversion problem). If LyX does not know about a given file format, it may easily happen that the format is recognized as "latex" and this causes bug #9146. This patch limits the check for a latex format to non-binary files. The strategy for deciding that a file has binary content is the same as that adopted by the "less" program. This is a stripped down backport of the more complex fix in master. diff --git a/src/Format.cpp b/src/Format.cpp index 93383ac..71437de 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -238,12 +238,17 @@ string guessFormatFromContents(FileName const & fn) int const max_count = 50; int count = 0; + // Maximum number of binary chars allowed for latex detection + int const max_bin = 5; + string str; string format; bool firstLine = true; bool backslash = false; + bool maybelatex = false; + int binchars = 0; int dollars = 0; - while ((count++ < max_count) && format.empty()) { + while ((count++ < max_count) && format.empty() && binchars <= max_bin) { if (ifs.eof()) break; @@ -359,16 +364,26 @@ string guessFormatFromContents(FileName const & fn) contains(str, "$$") || contains(str, "\\[") || contains(str, "\\]")) - format = "latex"; + maybelatex = true; else { if (contains(str, '\\')) backslash = true; dollars += count_char(str, '$'); + if (backslash && dollars > 1) + // inline equation + maybelatex = true; } + + // Note that this is formally not correct, since count_bin_chars + // expects utf8, and str can be anything: plain text in any + // encoding, or really binary data. In practice it works, since + // QString::fromUtf8() drops invalid utf8 sequences, and while + // the exact number may not be correct, we still get a high + // number for truly binary files. + binchars += count_bin_chars(str); } - if (format.empty() && backslash && dollars > 1) - // inline equation + if (format.empty() && binchars <= max_bin && maybelatex) format = "latex"; if (format.empty()) { diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index d4b1ccf..103976a 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -917,6 +917,31 @@ int count_char(docstring const & str, docstring::value_type chr) } +int count_bin_chars(string const & str) +{ + QString const qstr = toqstr(str).simplified(); + int count = 0; + QString::const_iterator cit = qstr.begin(); + QString::const_iterator end = qstr.end(); + for (; cit != end; ++cit) { + switch (cit->category()) { + case QChar::Separator_Line: + case QChar::Separator_Paragraph: + case QChar::Other_Control: + case QChar::Other_Format: + case QChar::Other_Surrogate: + case QChar::Other_PrivateUse: + case QChar::Other_NotAssigned: + ++count; + break; + default: + break; + } + } + return count; +} + + docstring const trim(docstring const & a, char const * p) { LASSERT(p, return a); diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 576a5b9..20a73c4 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -196,6 +196,14 @@ int count_char(std::string const & str, char chr); /// Count all occurences of char \a chr inside \a str int count_char(docstring const & str, docstring::value_type chr); +/** Count all occurences of binary chars inside \a str. +It is assumed that \a str is utf-8 encoded and that a binary char +belongs to the unicode class names Zl, Zp, Cc, Cf, Cs, Co, or Cn +(excluding white space characters such as '\t', '\n', '\v', '\f', '\r'). +See http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt +*/ +int count_bin_chars(std::string const & str); + /** Trims characters off the end and beginning of a string. \code trim("ccabccc", "c") == "ab". diff --git a/status.21x b/status.21x index 012fb1d..4bd5f69 1006
[LyX/master] Do not allow copying a separator without a following par end.
commit 39492b0cd78ab1f9517c556b36236066e86b18ba Author: Enrico Forestieri <for...@lyx.org> Date: Wed Aug 6 02:21:18 2014 +0200 Do not allow copying a separator without a following par end. This makes virtually impossible copying a separator inset whithout also copying the end of paragraph. These insets are not supposed to be directly inserted by users. For example, the parbreak version represents a LaTeX paragraph break, not a LyX one. So, if it is possible to copy and paste it by alone, an unsespecting user may be surprised to see a paragraph break in the output but not on the LyX screen (because of the lack of indentation, for example). In this way, it also becomes a LyX par break from a user point of view, not any more useful than simply introducing a par break by hitting (except in those cases where it makes a difference, in which case they are automatically inserted by LyX). diff --git a/src/Row.cpp b/src/Row.cpp index 023286e..aeede91 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -47,7 +47,7 @@ double Row::Element::pos2x(pos_type const i) const double w = 0; //handle first the two bounds of the element - if (i == endpos) + if (i == endpos && !(inset && inset->lyxCode() == SEPARATOR_CODE)) w = rtl ? 0 : width(); else if (i == pos || type != STRING) w = rtl ? width() : 0;
[LyX/master] Fix the -geometry command line argument for Windows.
commit 565260126eb106ab00049285627417e73736bb96 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Aug 25 18:35:15 2014 +0200 Fix the -geometry command line argument for Windows. The command line argument -geometry WIDTHxHEIGHT±XOFF±YOFF specifies a preferred size and location for the main window. Currently, this is semi-broken on Windows. Indeed, only specifying WIDTH and HEIGHT places the main window such that the left and top borders are invisible such that the window cannot be moved. Moreover, the XOFF and YOFF parts (when present) are used to specify the distance of the window from the left and top or right and bottom edges of the screen, when using '+' or '-', respectively. However, -geometry 800x600-20-20, instead of placing the window such that its bottom and right edges are at a distance of 20 pixels from the corresponding screen edges, places the window such that its left and top borders are out of the screen. This is corrected by this commit, which also addresses the fact that Qt5 does not define Q_WS_WIN anymore. diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 56cbd60..64c645d 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -2193,16 +2194,40 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow, } if (!geometry_arg.isEmpty()) { -#ifdef Q_WS_WIN +#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) int x, y; int w, h; - QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" ); + QChar sx, sy; + QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" ); re.indexIn(geometry_arg); w = re.cap(1).toInt(); h = re.cap(2).toInt(); x = re.cap(3).toInt(); y = re.cap(4).toInt(); + sx = re.cap(3).isEmpty() ? '+' : re.cap(3).at(0); + sy = re.cap(4).isEmpty() ? '+' : re.cap(4).at(0); + // Set initial geometry such that we can get the frame size. view->setGeometry(x, y, w, h); + int framewidth = view->geometry().x() - view->x(); + int titleheight = view->geometry().y() - view->y(); + // Negative displacements must be interpreted as distances + // from the right or bottom screen borders. + if (sx == '-' || sy == '-') { + QRect rec = QApplication::desktop()->screenGeometry(); + if (sx == '-') + x += rec.width() - w - framewidth; + if (sy == '-') + y += rec.height() - h - titleheight; + view->setGeometry(x, y, w, h); + } + // Make sure that the left and top frame borders are visible. + if (view->x() < 0 || view->y() < 0) { + if (view->x() < 0) + x = framewidth; + if (view->y() < 0) + y = titleheight; + view->setGeometry(x, y, w, h); + } #endif } view->setFocus();
[LyX/2.1.x] Fix the -geometry command line argument for Windows.
commit 43c669fb13fafe6d551db68380d0b6382c551806 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Aug 25 20:55:03 2014 +0200 Fix the -geometry command line argument for Windows. The command line argument -geometry WIDTHxHEIGHT±XOFF±YOFF specifies a preferred size and location for the main window. Currently, this is semi-broken on Windows. Indeed, only specifying WIDTH and HEIGHT places the main window such that the left and top borders are invisible such that the window cannot be moved. Moreover, the XOFF and YOFF parts (when present) are used to specify the distance of the window from the left and top or right and bottom edges of the screen, when using '+' or '-', respectively. However, -geometry 800x600-20-20, instead of placing the window such that its bottom and right edges are at a distance of 20 pixels from the corresponding screen edges, places the window such that its left and top borders are out of the screen. This is corrected by this commit. diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index b4960b2..88dd884 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -86,6 +86,7 @@ #include #include #include +#include #include #include #include @@ -2211,13 +2212,37 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow, #ifdef Q_WS_WIN int x, y; int w, h; - QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" ); + QChar sx, sy; + QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" ); re.indexIn(geometry_arg); w = re.cap(1).toInt(); h = re.cap(2).toInt(); x = re.cap(3).toInt(); y = re.cap(4).toInt(); + sx = re.cap(3).isEmpty() ? '+' : re.cap(3).at(0); + sy = re.cap(4).isEmpty() ? '+' : re.cap(4).at(0); + // Set initial geometry such that we can get the frame size. view->setGeometry(x, y, w, h); + int framewidth = view->geometry().x() - view->x(); + int titleheight = view->geometry().y() - view->y(); + // Negative displacements must be interpreted as distances + // from the right or bottom screen borders. + if (sx == '-' || sy == '-') { + QRect rec = QApplication::desktop()->screenGeometry(); + if (sx == '-') + x += rec.width() - w - framewidth; + if (sy == '-') + y += rec.height() - h - titleheight; + view->setGeometry(x, y, w, h); + } + // Make sure that the left and top frame borders are visible. + if (view->x() < 0 || view->y() < 0) { + if (view->x() < 0) + x = framewidth; + if (view->y() < 0) + y = titleheight; + view->setGeometry(x, y, w, h); + } #endif } view->setFocus(); diff --git a/status.21x b/status.21x index 4086261..f8bd25d 100644 --- a/status.21x +++ b/status.21x @@ -98,6 +98,8 @@ What's new - Fix on-screen display of images whose type is not known to LyX (bug 9146). +- Fix the -geometry command line argument for Windows. + * INTERNALS
[LyX/master] Fix export of xfig external insets (bug #9244).
commit 90b6920083acf8d271106fea81221ec8de39b4c1 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Aug 29 10:13:25 2014 +0200 Fix export of xfig external insets (bug #9244). The check for a latex format is very fragile. Both libmagic and our guessing from contents cannot distinguish the pstex and pdftex formats used by the xfig external inset. Moreover, it may also happen that lyx files are mistaken as latex ones. Thus, when the guessed format is latex, the only solution is to give precedence to the format determined by the file extension. diff --git a/src/Format.cpp b/src/Format.cpp index 1637bed..e29cdee 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -403,11 +403,11 @@ string Formats::getFormatFromFile(FileName const & filename) const return string(); string psformat; + string format; #ifdef HAVE_MAGIC_H if (filename.exists()) { magic_t magic_cookie = magic_open(MAGIC_MIME); if (magic_cookie) { - string format; if (magic_load(magic_cookie, NULL) != 0) { LYXERR(Debug::GRAPHICS, "Formats::getFormatFromFile\n" << "\tCouldn't load magic database - " @@ -442,35 +442,49 @@ string Formats::getFormatFromFile(FileName const & filename) const } } magic_close(magic_cookie); - if (!format.empty()) + // libmagic recognizes as latex also some formats of ours + // such as pstex and pdftex. Therefore we have to perform + // additional checks in this case (bug 9244). + if (!format.empty() && format != "latex") return format; } } #endif - // libmagic does not distinguish eps and ps. - // Therefore we need to use our own detection here, but only if it - // recognizes either ps or eps. Otherwise the libmagic guess will - // be better (bug 9146). - string const format = guessFormatFromContents(filename); - if (!psformat.empty()) { - if (isPostScriptFileFormat(format)) + string const ext = getExtension(filename.absFileName()); + if (format.empty()) { + // libmagic does not distinguish eps and ps. + // Therefore we need to use our own detection here, but only if it + // recognizes either ps or eps. Otherwise the libmagic guess will + // be better (bug 9146). + format = guessFormatFromContents(filename); + if (!psformat.empty()) { + if (isPostScriptFileFormat(format)) + return format; + else + return psformat; + } + + if (isZippedFileFormat(format) && !ext.empty()) { + string const & fmt_name = formats.getFormatFromExtension(ext); + if (!fmt_name.empty()) { + Format const * p_format = formats.getFormat(fmt_name); + if (p_format && p_format->zippedNative()) + return p_format->name(); + } + } + // Don't simply return latex (bug 9244). + if (!format.empty() && format != "latex") return format; - else - return psformat; } - string const ext = getExtension(filename.absFileName()); - if (isZippedFileFormat(format) && !ext.empty()) { - string const & fmt_name = formats.getFormatFromExtension(ext); - if (!fmt_name.empty()) { - Format const * p_format = formats.getFormat(fmt_name); - if (p_format && p_format->zippedNative()) - return p_format->name(); - } + // Both libmagic and our guessing from contents may return as latex + // also lyx files and our pstex and pdftex formats. In this case we + // give precedence to the format determined by the extension. + if (format == "latex") { + format = getFormatFromExtension(ext); + return format.empty() ? "latex" : format; } - if (!format.empty()) - return format; // try to find a format from the file extension. return getFormatFromExtension(ext);
[LyX/master] it.po tweaks
commit eb1ba93a1b9bd1f283a026fd7166baa3023a8378 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Oct 12 19:25:48 2014 +0200 it.po tweaks diff --git a/po/it.gmo b/po/it.gmo index ecc4a0d..e34d8ab 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index 2a130a3..fc20ba1 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2014-10-12 12:21+0200\n" -"PO-Revision-Date: 2014-10-12 18:59+0100\n" +"PO-Revision-Date: 2014-10-12 19:23+0100\n" "Last-Translator: Enrico Forestieri <for...@lyx.org>\n" "Language-Team: italiano <i...@li.org>\n" "Language: it\n" @@ -10993,19 +10993,19 @@ msgstr "Mastodontico" #: lib/layouts/a0poster.layout:68 #: lib/layouts/beamerposter.layout:80 msgid "Giant Snippet" -msgstr "Brano grandissimo" +msgstr "Testo colossale" #: lib/layouts/sciposter.layout:138 #: lib/layouts/a0poster.layout:82 #: lib/layouts/beamerposter.layout:94 msgid "More Giant Snippet" -msgstr "Brano enorme" +msgstr "Testo più colossale" #: lib/layouts/sciposter.layout:144 #: lib/layouts/a0poster.layout:88 #: lib/layouts/beamerposter.layout:100 msgid "Most Giant Snippet" -msgstr "Brano gigantesco" +msgstr "Testo mastodontico" #: lib/layouts/book.layout:3 msgid "Book (Standard Class)"
[LyX/master] Tweak the shape of the parbreak separator.
commit 498ab8ff238626498e5eb3f9aed1cd1188e727d0 Author: Enrico Forestieri <for...@lyx.org> Date: Sat Oct 25 23:38:52 2014 +0200 Tweak the shape of the parbreak separator. The shape of the parbreak separator is slightly changed in order to better distinguish it from the forced newline. This allows using the same color of the plain version without risk of confusion. diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index 221da4a..7906aa9 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -64,6 +64,13 @@ public: line_onoffdash //< dashes with spaces }; + /// possible fill styles + enum fill_style { + fill_none, + fill_oddeven, + fill_winding + }; + /// possible character styles of preedit string. /// This is used for CJK input method support. enum preedit_style { @@ -85,7 +92,8 @@ public: * @param np size of the points array */ virtual void lines(int const * xp, int const * yp, int np, Color, - line_style = line_solid, float line_width = thin_line) = 0; + fill_style = fill_none, line_style = line_solid, + float line_width = thin_line) = 0; /// draw a rectangle virtual void rectangle(int x, int y, int w, int h, Color, diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 0071581..5730819 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -196,6 +196,7 @@ void GuiPainter::line(int x1, int y1, int x2, int y2, void GuiPainter::lines(int const * xp, int const * yp, int np, Color col, + fill_style fs, line_style ls, float lw) { @@ -215,10 +216,19 @@ void GuiPainter::lines(int const * xp, int const * yp, int np, if (i != 0) antialias |= xp[i-1] != xp[i] && yp[i-1] != yp[i]; } - setQPainterPen(computeColor(col), ls, lw); + QColor const color = computeColor(col); + setQPainterPen(color, ls, lw); bool const text_is_antialiased = renderHints() & TextAntialiasing; setRenderHint(Antialiasing, antialias && text_is_antialiased); - drawPolyline(points.data(), np); + if (fs == fill_none) { + drawPolyline(points.data(), np); + } else { + QBrush const oldbrush = brush(); + setBrush(QBrush(color)); + drawPolygon(points.data(), np, fs == fill_oddeven ? + Qt::OddEvenFill : Qt::WindingFill); + setBrush(oldbrush); + } setRenderHint(Antialiasing, false); } diff --git a/src/frontends/qt4/GuiPainter.h b/src/frontends/qt4/GuiPainter.h index e9c6fdf..9cbb29a 100644 --- a/src/frontends/qt4/GuiPainter.h +++ b/src/frontends/qt4/GuiPainter.h @@ -55,6 +55,7 @@ public: int const * yp, int np, Color, + fill_style fs = fill_none, line_style ls = line_solid, float lw = thin_line); diff --git a/src/insets/InsetSeparator.cpp b/src/insets/InsetSeparator.cpp index 05aa456..1ec73c2 100644 --- a/src/insets/InsetSeparator.cpp +++ b/src/insets/InsetSeparator.cpp @@ -30,6 +30,7 @@ #include "support/docstring.h" using namespace std; +using namespace lyx::frontend; namespace lyx { @@ -126,15 +127,6 @@ bool InsetSeparator::getStatus(Cursor & cur, FuncRequest const & cmd, ColorCode InsetSeparator::ColorName() const { - switch (params_.kind) { - case InsetSeparatorParams::PLAIN: - return Color_latex; - break; - case InsetSeparatorParams::PARBREAK: - return Color_pagebreak; - break; - } - // not really useful, but to avoids gcc complaints return Color_latex; } @@ -212,9 +204,9 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) const pi.pain.lines(xp, yp, 2, ColorName()); } else { - yp[0] = int(y - 0.875 * asc * 0.75); - yp[1] = int(y - 0.500 * asc * 0.75); - yp[2] = int(y - 0.125 * asc * 0.75); + yp[0] = int(y - 0.875 * asc * 0.5); + yp[1] = int(y - 0.500 * asc * 0.5); + yp[2] = int(y - 0.125 * asc * 0.5); if (pi.ltr_pos) { xp[0] = int(x + wid * 0.375); @@ -226,11 +218,11 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) const xp[2] = int(x + wid * 0.625); } - pi.pain.lines(xp, yp, 3, ColorName()); + pi.pain.lines(xp, yp, 3, ColorName(), Painter::fill_oddeven); - yp[0] = int(y - 0.500 * asc * 0.75); - yp[1] = int(y - 0.500 *
[LyX/master] Fix bug #7970: space disappears from equation when reopening LyX file.
commit 77b0452a30f0b8968d7a0bc660bb0855d043e3fa Author: Enrico Forestieri <for...@lyx.org> Date: Tue Nov 4 21:27:55 2014 +0100 Fix bug #7970: space disappears from equation when reopening LyX file. diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index 2933c09..21621a3 100644 --- a/src/mathed/MathParser.cpp +++ b/src/mathed/MathParser.cpp @@ -2084,7 +2084,8 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags, //} for (InsetMath::idx_type i = start; i < at->nargs(); ++i) { parse(at.nucleus()->cell(i), FLAG_ITEM, m); - skipSpaces(); + if (mode == InsetMath::MATH_MODE) + skipSpaces(); } cell->push_back(at); }
[LyX/master] Fix bug #9319: Problems with space inside math and textrm.
commit d1858b89d0828c3fe8f4e898f609aaed9d33 Author: Enrico Forestieri <for...@lyx.org> Date: Tue Nov 4 21:36:10 2014 +0100 Fix bug #9319: Problems with space inside math and textrm. diff --git a/src/mathed/InsetMathSpace.cpp b/src/mathed/InsetMathSpace.cpp index f961224..2a3b6f4 100644 --- a/src/mathed/InsetMathSpace.cpp +++ b/src/mathed/InsetMathSpace.cpp @@ -273,7 +273,7 @@ void InsetMathSpace::write(WriteStream & os) const os << space_info[space_].name.c_str(); if (space_info[space_].custom) os << '{' << length_.asLatexString().c_str() << '}'; - else if (space_info[space_].escape && space_info[space_].name != " ") + else if (space_info[space_].escape && space_info[space_].name.length() > 1) os.pendingSpace(true); }
[LyX/master] Fix issue with CAS.
commit 9f613a5f7eb69cb658e2f97a996270db4129a12e Author: Enrico Forestieri <for...@lyx.org> Date: Sun Nov 9 02:19:00 2014 +0100 Fix issue with CAS. See http://thread.gmane.org/gmane.editors.lyx.devel/153516 This regression was due to a thinko in [43f6b167/lyxgit]. diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 4b9e0ce..55185a2 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1354,7 +1354,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) MathData ar; if (cur.inMathed() && cur.selection()) { asArray(grabAndEraseSelection(cur), ar); - } else if (!pos == cur.cell().empty()) { + } else if (pos == cur.cell().size()) { ar = cur.cell(); lyxerr << "use whole cell: " << ar << endl; } else {
[LyX/2.1.x] Fix issue with CAS.
commit 564447057640dbf63e4368fde8efc523c3132703 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Nov 9 21:33:53 2014 +0100 Fix issue with CAS. See http://thread.gmane.org/gmane.editors.lyx.devel/153516 This regression was due to a thinko in [43f6b167/lyxgit]. diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index daf43fe..9657475 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1346,7 +1346,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) MathData ar; if (cur.inMathed() && cur.selection()) { asArray(grabAndEraseSelection(cur), ar); - } else if (!pos == cur.cell().empty()) { + } else if (pos == cur.cell().size()) { ar = cur.cell(); lyxerr << "use whole cell: " << ar << endl; } else { diff --git a/status.21x b/status.21x index c38e3b4..36f2469 100644 --- a/status.21x +++ b/status.21x @@ -96,6 +96,8 @@ What's new - Disallow to insert program listings to footnotes and margin notes (bug 9321). +- Fix computer algebra system computations in formulas with '=' signs. + * INTERNALS
[LyX/master] Fix CAS computation of a selected subformula.
commit 29cebc7fb0bb3ab5acf2759ff4b964657ad59495 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Nov 9 21:56:40 2014 +0100 Fix CAS computation of a selected subformula. Invoking a computer algebra system program for computing a selected subformula has never worked (checked with all LyX versions back to 1.3) and, moreover, in the presence of a selection things go awry. This commit allows this computation by replacing the selected subformula with the result of the computation. diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 55185a2..538eee1 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -66,6 +66,7 @@ using namespace lyx::support; namespace lyx { using cap::grabAndEraseSelection; +using cap::reduceSelectionToOneCell; namespace { @@ -1324,14 +1325,14 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) extra = from_ascii("noextra"); string const lang = to_ascii(dlang); - // FIXME: temporarily disabled - //if (cur.selection()) { - // MathData ar; - // selGet(cur.ar); - // lyxerr << "use selection: " << ar << endl; - // insert(pipeThroughExtern(lang, extra, ar)); - // return; - //} + // replace selection with result of computation + if (reduceSelectionToOneCell(cur)) { + MathData ar; + asArray(grabAndEraseSelection(cur), ar); + lyxerr << "use selection: " << ar << endl; + cur.insert(pipeThroughExtern(lang, extra, ar)); + return; + } // only inline, display or eqnarray math is allowed if (getType() > hullEqnArray) { @@ -1352,9 +1353,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) if (getType() == hullSimple) { size_type pos = cur.cell().find_last(eq); MathData ar; - if (cur.inMathed() && cur.selection()) { - asArray(grabAndEraseSelection(cur), ar); - } else if (pos == cur.cell().size()) { + if (pos == cur.cell().size()) { ar = cur.cell(); lyxerr << "use whole cell: " << ar << endl; } else {
[LyX/2.1.x] Fix CAS computation of a selected subformula.
commit b16b1ddb58bab10f62837162bde5de3a50d4b71a Author: Enrico Forestieri <for...@lyx.org> Date: Mon Nov 10 00:47:50 2014 +0100 Fix CAS computation of a selected subformula. Invoking a computer algebra system program for computing a selected subformula has never worked (checked with all LyX versions back to 1.3) and, moreover, in the presence of a selection things go awry. This commit allows this computation by replacing the selected subformula with the result of the computation. diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 9657475..20787e2 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -66,6 +66,7 @@ using namespace lyx::support; namespace lyx { using cap::grabAndEraseSelection; +using cap::reduceSelectionToOneCell; namespace { @@ -1316,14 +1317,14 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) extra = from_ascii("noextra"); string const lang = to_ascii(dlang); - // FIXME: temporarily disabled - //if (cur.selection()) { - // MathData ar; - // selGet(cur.ar); - // lyxerr << "use selection: " << ar << endl; - // insert(pipeThroughExtern(lang, extra, ar)); - // return; - //} + // replace selection with result of computation + if (reduceSelectionToOneCell(cur)) { + MathData ar; + asArray(grabAndEraseSelection(cur), ar); + lyxerr << "use selection: " << ar << endl; + cur.insert(pipeThroughExtern(lang, extra, ar)); + return; + } // only inline, display or eqnarray math is allowed if (getType() > hullEqnArray) { @@ -1344,9 +1345,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) if (getType() == hullSimple) { size_type pos = cur.cell().find_last(eq); MathData ar; - if (cur.inMathed() && cur.selection()) { - asArray(grabAndEraseSelection(cur), ar); - } else if (pos == cur.cell().size()) { + if (pos == cur.cell().size()) { ar = cur.cell(); lyxerr << "use whole cell: " << ar << endl; } else { diff --git a/status.21x b/status.21x index 36f2469..16c763b 100644 --- a/status.21x +++ b/status.21x @@ -46,6 +46,8 @@ What's new - References no longer truncated in outliner (bug 9312). +- Allow computing selected subformulas with computer algebra systems. + * DOCUMENTATION AND LOCALIZATION
[LyX/master] Fix bug #9342: LaTeX build get stuck for unconventional path name
commit 11b7b7234e42ad46add882df914037930c6dd438 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Nov 27 21:59:09 2014 +0100 Fix bug #9342: LaTeX build get stuck for unconventional path name The reason being that the TEXINPUTS path list was not quoted on Windows. This was no problem with spaces but some special characters are interpreted by the shell and can cause problems. In this particular case, the '&' character was being interpreted as a command separator. diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 8efa780..f145122 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -703,8 +703,15 @@ string latexEnvCmdPrefix(string const & path) return "env TEXINPUTS=\"." + sep + texinputs_prefix + sep + texinputs + "\" "; else - return "cmd /d /c set TEXINPUTS=." + sep + texinputs_prefix - + sep + texinputs + "&"; +#ifndef USE_QPROCESS + return "cmd /d /c set \"TEXINPUTS=." + + sep + texinputs_prefix + + sep + texinputs + "\"&"; +#else + return "cmd /d /c set \"\"\"TEXINPUTS=." + + sep + texinputs_prefix + + sep + texinputs + "\"\"\"&"; +#endif }
[LyX/master] Fix bug #9235: LyX 2.2's tex2lyx fails in general on Windows
commit 417c233d07cd5ad2e9b956e4cf459d4b2aaa1b7b Author: Enrico Forestieri <for...@lyx.org> Date: Thu Nov 27 22:35:20 2014 +0100 Fix bug #9235: LyX 2.2's tex2lyx fails in general on Windows The reason being the backslashes in the path. Note that escaping does not work here because the path is being interpreted multiple times (how many times I don't know) and that would be fragile. For this same reason, the change is not limited to Windows. diff --git a/lib/configure.py b/lib/configure.py index 08384bf..341c11f 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -727,10 +727,10 @@ def checkConverterEntries(): # will also have this version suffix. # 4) Otherwise always use tex2lyx. in_binary_subdir = os.path.join(lyx_binary_dir, 'tex2lyx', 'tex2lyx') -in_binary_subdir = os.path.abspath(in_binary_subdir) +in_binary_subdir = os.path.abspath(in_binary_subdir).replace('\\', '/') in_binary_dir = os.path.join(lyx_binary_dir, 'tex2lyx') -in_binary_dir = os.path.abspath(in_binary_dir) +in_binary_dir = os.path.abspath(in_binary_dir).replace('\\', '/') path, t2l = checkProg('a LaTeX/Noweb -> LyX converter', [in_binary_subdir, in_binary_subdir + version_suffix, in_binary_dir, in_binary_dir + version_suffix, 'tex2lyx' + version_suffix, 'tex2lyx'], rc_entry = [r'''\converter latex lyx"%% -f $$i $$o" ""
[LyX/master] Fix bug #9217: [Qt5] QWindowsMime class not available
commit 9126a99e97a23f5045da11dd6b13aa997b23bb44 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Dec 26 16:53:31 2014 +0100 Fix bug #9217: [Qt5] QWindowsMime class not available The support for QWindowsMime has been reintroduced in Qt 5.4.0. The class name has been changed to QWinMime but the interface is exactly the same. diff --git a/CMakeLists.txt b/CMakeLists.txt index 978e63c..5409746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -556,6 +556,7 @@ if(LYX_USE_QT MATCHES "QT5") find_package(Qt5MacExtras REQUIRED) endif() find_package(Qt5X11Extras QUIET) + find_package(Qt5WinExtras QUIET) set(QTVERSION ${Qt5Core_VERSION}) macro (qt_use_modules) qt5_use_modules(${ARGN}) diff --git a/config/qt4.m4 b/config/qt4.m4 index bb909f9..10d9546 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -201,6 +201,11 @@ AC_DEFUN([QT_DO_PKG_CONFIG], if test "x$USE_QT5" != "xno" ; then qt_corelibs="Qt5Core" qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Widgets" + lyx_use_winextras=false + PKG_CHECK_EXISTS(Qt5WinExtras, [lyx_use_winextras=true], []) + if $lyx_use_winextras; then + qt_guilibs="$qt_guilibs Qt5WinExtras" + fi fi PKG_CHECK_MODULES(QT_CORE, $qt_corelibs,,[:]) if test "$pkg_failed" = "no" ; then diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake index 0290c4d..0d07311 100644 --- a/development/cmake/ConfigureChecks.cmake +++ b/development/cmake/ConfigureChecks.cmake @@ -175,6 +175,13 @@ if(LYX_USE_QT MATCHES "QT5") " QT_USES_X11) endif() + if (Qt5WinExtras_FOUND) +get_target_property(_winextra_prop Qt5::WinExtras IMPORTED_CONFIGURATIONS) +get_target_property(_winextra_link_libraries Qt5::WinExtras IMPORTED_LOCATION_${_winextra_prop}) +set(CMAKE_REQUIRED_LIBRARIES ${_winextra_link_libraries}) +set(CMAKE_REQUIRED_INCLUDES ${Qt5WinExtras_INCLUDE_DIRS}) +set(CMAKE_REQUIRED_FLAGS ${Qt5WinExtras_EXECUTABLE_COMPILE_FLAGS}) + endif() elseif(LYX_USE_QT MATCHES "QT4") set(CMAKE_REQUIRED_LIBRARIES ${QT_QTGUI_LIBRARY}) set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) diff --git a/src/frontends/qt4/CMakeLists.txt b/src/frontends/qt4/CMakeLists.txt index 7203ec7..3af2e86 100644 --- a/src/frontends/qt4/CMakeLists.txt +++ b/src/frontends/qt4/CMakeLists.txt @@ -58,7 +58,11 @@ set_target_properties(frontend_qt PROPERTIES FOLDER "applications/LyX") if(Qt5Core_FOUND AND APPLE) qt_use_modules(frontend_qt Core Gui Widgets Concurrent MacExtras) else() - qt_use_modules(frontend_qt Core Gui Widgets Concurrent) + if (Qt5WinExtras_FOUND) + qt_use_modules(frontend_qt Core Gui Widgets Concurrent WinExtras) + else() + qt_use_modules(frontend_qt Core Gui Widgets Concurrent) + endif() endif() target_link_libraries(frontend_qt frontends diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 0fbba74..5cf11b7 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -124,13 +124,21 @@ #undef None #endif -#ifdef Q_WS_WIN +#if (QT_VERSION < 0x05) || (QT_VERSION >= 0x050400) +#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) +#if (QT_VERSION < 0x05) #include +#define QWINDOWSMIME QWindowsMime +#else +#include +#define QWINDOWSMIME QWinMime +#endif #ifdef Q_CC_GNU #include #endif #include -#endif // Q_WS_WIN +#endif +#endif #ifdef Q_OS_MAC #include @@ -716,7 +724,8 @@ public: // Windows specific stuff goes here... -#ifdef Q_WS_WIN +#if (QT_VERSION < 0x05) || (QT_VERSION >= 0x050400) +#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) // QWindowsMimeMetafile can only be compiled on Windows. static FORMATETC cfFromMime(QString const & mimetype) @@ -736,7 +745,7 @@ static FORMATETC cfFromMime(QString const & mimetype) } -class QWindowsMimeMetafile : public QWindowsMime { +class QWindowsMimeMetafile : public QWINDOWSMIME { public: QWindowsMimeMetafile() {} @@ -813,7 +822,8 @@ public: } }; -#endif // Q_WS_WIN +#endif +#endif /// Allows to check whether ESC was pressed during a long operation @@ -877,10 +887,12 @@ struct GuiApplication::Private Private(): language_model_(0), meta_fake_bit(NoModifier), global_menubar_(0) { - #ifdef Q_WS_WIN + #if (QT_VERSION < 0x05) || (QT_VERSION >= 0x050400) + #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) /// WMF Mime handler for Windows clipboard.
[LyX/master] Fix building with cmake on cygwin.
commit 1b0cbb6932376821ba1848bedcfad476bddb294d Author: Enrico Forestieri <for...@lyx.org> Date: Fri Dec 26 17:00:23 2014 +0100 Fix building with cmake on cygwin. Add required libraries for the link stage. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31b5bfd..c15f098 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -149,6 +149,10 @@ if(MINGW) target_link_libraries(${_lyx} ole32) endif() +if(CYGWIN) + target_link_libraries(${_lyx} gdi32 shlwapi ole32) +endif() + project_source_group("${GROUP_CODE}" lyx_sources lyx_headers) install(TARGETS ${_lyx} diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 926eebc..f1e51a2 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -38,5 +38,9 @@ if(APPLE) target_link_libraries(${_lyxclient} "-framework AppKit") endif() +if(CYGWIN) + target_link_libraries(${_lyxclient} shlwapi) +endif() + install(TARGETS ${_lyxclient} DESTINATION ${LYX_UTILITIES_INSTALL_PATH}) diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt index 2d19989..4e1ff5d 100644 --- a/src/support/tests/CMakeLists.txt +++ b/src/support/tests/CMakeLists.txt @@ -17,6 +17,9 @@ macro(sources _program) ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY} ${ICONV_LIBRARY}) lyx_target_link_libraries(${_program} Magic) +if(CYGWIN) +target_link_libraries(${_program} shlwapi) +endif() endmacro() file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES}) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 52ca1e3..a32499b 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -19,6 +19,9 @@ add_executable(check_layout ${check_layout_SOURCES}) target_link_libraries(check_layout support ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY} ${ICONV_LIBRARY}) +if(CYGWIN) +target_link_libraries(check_layout shlwapi) +endif() lyx_target_link_libraries(check_layout Magic) add_dependencies(lyx_run_tests check_layout) diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt index 38ae574..09bcc2b 100644 --- a/src/tex2lyx/CMakeLists.txt +++ b/src/tex2lyx/CMakeLists.txt @@ -58,6 +58,10 @@ if(WIN32) target_link_libraries(${_tex2lyx} shlwapi ole32 psapi) endif() +if(CYGWIN) + target_link_libraries(${_tex2lyx} shlwapi ole32) +endif() + if(APPLE) target_link_libraries(${_tex2lyx} "-framework AppKit") endif()
[LyX/master] Fix configuring for Qt5 with autotools on non-Mac platforms.
commit ab3259885b989f8053d7af6112293c6a78a83170 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jan 1 18:44:01 2015 +0100 Fix configuring for Qt5 with autotools on non-Mac platforms. diff --git a/config/qt4.m4 b/config/qt4.m4 index aa94ae9..7852c8a 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -206,6 +206,7 @@ AC_DEFUN([QT_DO_PKG_CONFIG], if $lyx_use_winextras; then qt_guilibs="$qt_guilibs Qt5WinExtras" fi + lyx_use_macextras=false PKG_CHECK_EXISTS(Qt5MacExtras, [lyx_use_macextras=true], []) if $lyx_use_macextras; then qt_guilibs="$qt_guilibs Qt5MacExtras"
[LyX/master] Fix typo.
commit 78242f6cd79c19bae4714e853e0ea68ba8433ec2 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Jan 1 19:37:46 2015 +0100 Fix typo. diff --git a/po/it.gmo b/po/it.gmo index e664c1b..459f25a 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index bacd128..8206b2c 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" "POT-Creation-Date: 2015-01-01 19:14+0100\n" -"PO-Revision-Date: 2015-01-01 19:31+0100\n" +"PO-Revision-Date: 2015-01-01 19:36+0100\n" "Last-Translator: Enrico Forestieri <for...@lyx.org>\n" "Language-Team: italiano <i...@li.org>\n" "Language: it\n" @@ -27218,7 +27218,7 @@ msgid "" msgstr "" "LyX è distribuito nella speranza di essere utile ma SENZA NESSUNA GARANZIA, nemmeno la garanzia implicita della COMMERCIABILITÀ o dell'IDONEITÀ AD UNO SCOPO PARTICOLARE.\n" "Consultate la GNU General Public License (GPL) per ulteriori dettagli.\n" -"Dovreste aver ricevuto una copia della GNU General Public License (GPL) insieme a questo programma; se non così non fosse, scrivete alla Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA." +"Dovreste aver ricevuto una copia della GNU General Public License (GPL) insieme a questo programma; se così non fosse, scrivete alla Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA." #: src/frontends/qt4/GuiAbout.cpp:111 msgid "not released yet"
[LyX/master] Adjust autotools default configure options for Qt5.
commit dd2a8b616e36118d16d0b196d18f9fadea1f3802 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jan 4 18:07:11 2015 +0100 Adjust autotools default configure options for Qt5. * Disable concept-checks unless explicitly required (errors out with Qt5). * Add -fPIC to CPPFLAGS for elf targets (required with Qt5). diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 33c5979..f8f01c0 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -62,6 +62,18 @@ AC_MSG_RESULT([$withval]) ]) +dnl Check whether to configure for Qt5. Default is Qt4. +dnl +AC_DEFUN([LYX_CHECK_QT5],[ +AC_MSG_CHECKING([whether Qt5 is requested]) +AC_ARG_ENABLE([qt5], + [ --enable-qt5use Qt5 for building], + USE_QT5=$enableval, USE_QT5=no) +AC_MSG_RESULT([$USE_QT5]) +AC_SUBST([USE_QT5]) +]) + + dnl Usage: LYX_WARNING(message) Displays the warning "message" and sets the dnl flag lyx_warning to yes. AC_DEFUN([LYX_WARNING],[ @@ -219,6 +231,9 @@ AC_ARG_ENABLE(concept-checks, AC_HELP_STRING([--enable-concept-checks],[enable concept checks]),, [AS_CASE([$build_type], [dev*|pre*], [enable_concept_checks=yes], [enable_concept_checks=no])] + if test x$USE_QT5 = xyes ; then + enable_concept_checks=no + fi ) ### set up optimization @@ -285,6 +300,9 @@ if test x$GXX = xyes; then fi fi if test "$ac_env_CPPFLAGS_set" != set; then +if test x$USE_QT5 = xyes ; then +AS_CASE([$host], [*mingw*|*cygwin*], [], [CPPFLAGS="-fPIC $CPPFLAGS"]) +fi if test x$enable_warnings = xyes ; then case $gxx_version in 3.1*|3.2*|3.3*) diff --git a/config/qt4.m4 b/config/qt4.m4 index 7852c8a..1346146 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -112,14 +112,6 @@ EOF dnl start here AC_DEFUN([QT_DO_IT_ALL], [ - AC_MSG_CHECKING([whether Qt5 is requested]) - dnl Default is Qt4 - AC_ARG_ENABLE([qt5], - [ --enable-qt5use Qt5 for building], - USE_QT5=$enableval, USE_QT5=no) - AC_MSG_RESULT([$USE_QT5]) - AC_SUBST([USE_QT5]) - dnl this variable is precious AC_ARG_VAR(QTDIR, [the place where the Qt files are, e.g. /usr/lib/qt4]) diff --git a/configure.ac b/configure.ac index 77fe598..e2e7fb4 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,7 @@ AC_CONFIG_AUX_DIR(config) # First check the version LYX_CHECK_VERSION LYX_VERSION_SUFFIX +LYX_CHECK_QT5 # Check how the files should be packaged AC_CANONICAL_TARGET LYX_USE_PACKAGING
[LyX/2.1.x] Fix bug #7970: space disappears from equation when reopening LyX file.
commit 69179c08e7d66064e04170a2d9f8c9575f4e8286 Author: Enrico Forestieri <for...@lyx.org> Date: Tue Jan 6 19:57:54 2015 +0100 Fix bug #7970: space disappears from equation when reopening LyX file. diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index e740d23..20c1ac6 100644 --- a/src/mathed/MathParser.cpp +++ b/src/mathed/MathParser.cpp @@ -2068,7 +2068,8 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags, //} for (InsetMath::idx_type i = start; i < at->nargs(); ++i) { parse(at.nucleus()->cell(i), FLAG_ITEM, m); - skipSpaces(); + if (mode == InsetMath::MATH_MODE) + skipSpaces(); } cell->push_back(at); } diff --git a/status.21x b/status.21x index 05002a0..0facb6a 100644 --- a/status.21x +++ b/status.21x @@ -111,6 +111,8 @@ What's new - Protect insets when needed in subfloat captions (bug 9346). +- Do not swallow spaces in text-in-math mode (bug 7970). + * LYX2LYX
[LyX/2.1.x] Fix bug #9319: Problems with space inside math and textrm.
commit 855f24e063a7b28f536a1bbced246276f322cbbd Author: Enrico Forestieri <for...@lyx.org> Date: Tue Jan 6 21:50:58 2015 +0100 Fix bug #9319: Problems with space inside math and textrm. diff --git a/src/mathed/InsetMathSpace.cpp b/src/mathed/InsetMathSpace.cpp index f961224..2a3b6f4 100644 --- a/src/mathed/InsetMathSpace.cpp +++ b/src/mathed/InsetMathSpace.cpp @@ -273,7 +273,7 @@ void InsetMathSpace::write(WriteStream & os) const os << space_info[space_].name.c_str(); if (space_info[space_].custom) os << '{' << length_.asLatexString().c_str() << '}'; - else if (space_info[space_].escape && space_info[space_].name != " ") + else if (space_info[space_].escape && space_info[space_].name.length() > 1) os.pendingSpace(true); } diff --git a/status.21x b/status.21x index 0facb6a..409aa2f 100644 --- a/status.21x +++ b/status.21x @@ -113,6 +113,8 @@ What's new - Do not swallow spaces in text-in-math mode (bug 7970). +- Do not insert a protected space after some math-spaces (bug 9319). + * LYX2LYX
[LyX/2.1.x] Fix bug #9342: LaTeX build get stuck for unconventional path name
commit 383334c1fe72d1f8fc20fb1b9a35b7e041266c4a Author: Enrico Forestieri <for...@lyx.org> Date: Tue Jan 6 22:06:46 2015 +0100 Fix bug #9342: LaTeX build get stuck for unconventional path name The reason being that the TEXINPUTS path list was not quoted on Windows. This was no problem with spaces but some special characters are interpreted by the shell and can cause problems. In this particular case, the '&' character was being interpreted as a command separator. diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 92aeaf7..131e177 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -605,8 +605,15 @@ string latexEnvCmdPrefix(string const & path) return "env TEXINPUTS=\"." + sep + texinputs_prefix + sep + texinputs + "\" "; else - return "cmd /d /c set TEXINPUTS=." + sep + texinputs_prefix - + sep + texinputs + "&"; +#ifndef USE_QPROCESS + return "cmd /d /c set \"TEXINPUTS=." + + sep + texinputs_prefix + + sep + texinputs + "\"&"; +#else + return "cmd /d /c set \"\"\"TEXINPUTS=." + + sep + texinputs_prefix + + sep + texinputs + "\"\"\"&"; +#endif } diff --git a/status.21x b/status.21x index 409aa2f..4dc1247 100644 --- a/status.21x +++ b/status.21x @@ -115,6 +115,9 @@ What's new - Do not insert a protected space after some math-spaces (bug 9319). +- Fix problem when some special characters appear in the document directory + name on Windows (bug 9342). + * LYX2LYX
[LyX/master] Adjust preprocessor guards for Qt5/X11.
commit d4428ceb81d12dde60102ad0bb3d1503efc54eda Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jan 11 19:36:41 2015 +0100 Adjust preprocessor guards for Qt5/X11. This fixes the -geometry command line option and restores the "Use icons from system's theme" checkbox in the preferences. There is still code addressing Qt4 and xlib that has to be audited. This code cannot be compiled with Qt5 because the default backend is now xcb and not xlib. I have marked such code with a "FIXME QT5" comment. diff --git a/config/qt4.m4 b/config/qt4.m4 index 1346146..daa1171 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -169,6 +169,19 @@ AC_DEFUN([QT_DO_IT_ALL], [AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version $QTLIB_VERSION has been found.]) ]) + if test x$USE_QT5 = xyes ; then + save_CPPFLAGS=$CPPFLAGS + AC_MSG_CHECKING([whether Qt uses the X Window system]) + CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES" + AC_EGREP_CPP(xcb, + [#include + QT_QPA_DEFAULT_PLATFORM_NAME], + [AC_MSG_RESULT(yes) +AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])], + [AC_MSG_RESULT(no)]) + CPPFLAGS=$save_CPPFLAGS + fi + QT_FIND_TOOL([QT_MOC], [moc]) QT_FIND_TOOL([QT_UIC], [uic]) QT_FIND_TOOL([QT_RCC], [rcc]) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index bcf7d65..d58c9c9 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -115,6 +115,7 @@ #include #include +// FIXME QT5 #ifdef Q_WS_X11 #include #include @@ -167,7 +168,7 @@ namespace lyx { frontend::Application * createApplication(int & argc, char * argv[]) { -#ifndef Q_WS_X11 +#if !defined(Q_WS_X11) && !defined(QPA_XCB) // prune -geometry argument(s) by shifting // the following ones 2 places down. for (int i = 0 ; i < argc ; ++i) { @@ -1007,7 +1008,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv) setupApplescript(); #endif -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) || defined(QPA_XCB) // doubleClickInterval() is 400 ms on X11 which is just too long. // On Windows and Mac OS X, the operating system's value is used. // On Microsoft Windows, calling this function sets the double @@ -2948,6 +2949,7 @@ bool GuiApplication::longOperationStarted() { // // X11 specific stuff goes here... +// FIXME QT5 #ifdef Q_WS_X11 bool GuiApplication::x11EventFilter(XEvent * xev) { diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index e1e5ac3..a5092f3 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -99,6 +99,7 @@ public: //@{ bool notify(QObject * receiver, QEvent * event); void commitData(QSessionManager & sm); + // FIXME QT5 #ifdef Q_WS_X11 bool x11EventFilter(XEvent * ev); #endif diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index c1ea8ea..2004398 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -541,7 +541,7 @@ bool GuiClipboard::hasInternal() const // are notified of changes. However, on Windows ownership is // emulated by Qt through the OleIsCurrentClipboard() API, while // on Mac OS X we deal with this issue by ourself. -#if defined(Q_WS_X11) || defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) +#ifndef Q_OS_MAC return true; #else return false; diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 95ab52a..5718fbb 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -38,7 +38,7 @@ // Set USE_PIXMAP_CACHE to 1 for enabling the use of a Pixmap cache when // drawing text. This is especially useful for older PPC/Mac systems. -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) || defined(QPA_XCB) #define USE_PIXMAP_CACHE 0 #else #define USE_PIXMAP_CACHE 1 diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 9e806c4..937d930 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1046,7 +1046,7 @@ void PrefScreenFonts::updateRC(LyXRC const & rc) updateScreenFontSizes(rc); pixmapCacheCB->setChecked(rc.use_pixmap_cache); -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) || defined(QPA_XCB) pixmapCacheCB->setEnabled(false); #endif @@ -2540,7 +2540,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) iconSetCO->addItem(qt_("Classic"), "classic"); iconSetCO->addItem(qt_("Oxygen"), "oxygen"); -#if (!defined Q_WS_X11 || QT_VERSION < 0x040600) +#if (!(defined Q_WS_X11 || defined(QPA_XCB))
[LyX/master] Fix preferences panel.
commit 35357c122576a061f9ec0b9364d6dbaec49ef91c Author: Enrico Forestieri <for...@lyx.org> Date: Sun Jan 11 20:09:04 2015 +0100 Fix preferences panel. This commit fixes a thinko in [8bab2338/lyxgit] causing the warning: QObject::connect: No such slot lyx::frontend::GuiPreferences::slotApplyRC() in ../../../../src/frontends/qt4/GuiPrefs.cpp:3308 QObject::connect: (sender name: 'applyPB') QObject::connect: (receiver name: 'PrefsUi') diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 937d930..01f2432 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -3305,7 +3305,7 @@ GuiPreferences::GuiPreferences(GuiView & lv) QDialog::setModal(false); connect(savePB, SIGNAL(clicked()), this, SLOT(slotOK())); - connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApplyRC())); + connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
[LyX/master] Adjust indentation after ff42fea8.
commit 10be0c43f20a27a1e6af82241ad5ec6b5cad3eca Author: Enrico Forestieri <for...@lyx.org> Date: Tue Jan 13 18:05:31 2015 +0100 Adjust indentation after ff42fea8. diff --git a/configure.ac b/configure.ac index 3a1db2f..8b48eaf 100644 --- a/configure.ac +++ b/configure.ac @@ -150,7 +150,7 @@ QT_DO_IT_ALL([4.5.0]) AC_SUBST([FRONTENDS_SUBDIRS], [qt4]) FRONTEND_INFO="${FRONTEND_INFO}\ Qt Frontend:\n\ - Qt version:\t\t${QTLIB_VERSION}\n" + Qt version:\t ${QTLIB_VERSION}\n" # fix the value of the prefixes. test "x$prefix" = xNONE && prefix=$default_prefix
[LyX/master] Solve the "soft-hyphen" (0x00ad) symbol problem.
commit f496ec373bafa15beeb4f1709ec22e179df9f099 Author: Enrico Forestieri <for...@lyx.org> Date: Wed Jan 21 13:57:55 2015 +0100 Solve the "soft-hyphen" (0x00ad) symbol problem. After the str-metrics merge, the kludge for displaying symbols whose code point corresponds to a soft-hyphen was not working anymore. The solution is replicating the offending glyphs with index 0x00ad at a different index. They were replicated at 0x00ac, whose glyph was missing in all affected fonts. However, this would not work by alone because, if a system font with same family name exists, it would be picked up instead of the right one (at least on non-Windows platforms). For this reason, the style of the fonts has been changed from "Regular" to "Lyx", so that we can discriminate the right font. However, this requires using at least Qt 4.8. If an older Qt is used *and* a system font with same family name is already available, the affected glyphs will all turn out on screen as the "logical not" symbol. I have also set the executable flag on the font files, because on Windows they are loaded only in this case. This solves #9229. diff --git a/lib/fonts/cmex10.ttf b/lib/fonts/cmex10.ttf old mode 100644 new mode 100755 index e4b468d..aed7e86 Binary files a/lib/fonts/cmex10.ttf and b/lib/fonts/cmex10.ttf differ diff --git a/lib/fonts/cmmi10.ttf b/lib/fonts/cmmi10.ttf old mode 100644 new mode 100755 index af48386..9b2b430 Binary files a/lib/fonts/cmmi10.ttf and b/lib/fonts/cmmi10.ttf differ diff --git a/lib/fonts/cmr10.ttf b/lib/fonts/cmr10.ttf old mode 100644 new mode 100755 index 8bc4496..e405536 Binary files a/lib/fonts/cmr10.ttf and b/lib/fonts/cmr10.ttf differ diff --git a/lib/fonts/cmsy10.ttf b/lib/fonts/cmsy10.ttf old mode 100644 new mode 100755 index e0f4fa8..40cb3a8 Binary files a/lib/fonts/cmsy10.ttf and b/lib/fonts/cmsy10.ttf differ diff --git a/lib/fonts/esint10.ttf b/lib/fonts/esint10.ttf old mode 100644 new mode 100755 index b803a15..deb6e5f Binary files a/lib/fonts/esint10.ttf and b/lib/fonts/esint10.ttf differ diff --git a/lib/fonts/eufm10.ttf b/lib/fonts/eufm10.ttf old mode 100644 new mode 100755 index eb126a0..0e670d4 Binary files a/lib/fonts/eufm10.ttf and b/lib/fonts/eufm10.ttf differ diff --git a/lib/fonts/msam10.ttf b/lib/fonts/msam10.ttf old mode 100644 new mode 100755 index 8a83d1f..3b0cd89 Binary files a/lib/fonts/msam10.ttf and b/lib/fonts/msam10.ttf differ diff --git a/lib/fonts/msbm10.ttf b/lib/fonts/msbm10.ttf old mode 100644 new mode 100755 index 728d1e8..04a4717 Binary files a/lib/fonts/msbm10.ttf and b/lib/fonts/msbm10.ttf differ diff --git a/lib/fonts/rsfs10.ttf b/lib/fonts/rsfs10.ttf old mode 100644 new mode 100755 index 2fa353e..4160bcf Binary files a/lib/fonts/rsfs10.ttf and b/lib/fonts/rsfs10.ttf differ diff --git a/lib/fonts/stmary10.ttf b/lib/fonts/stmary10.ttf old mode 100644 new mode 100755 index 692a30e..bafedc4 Binary files a/lib/fonts/stmary10.ttf and b/lib/fonts/stmary10.ttf differ diff --git a/lib/fonts/wasy10.ttf b/lib/fonts/wasy10.ttf old mode 100644 new mode 100755 index 673085f..a4e32d2 Binary files a/lib/fonts/wasy10.ttf and b/lib/fonts/wasy10.ttf differ diff --git a/lib/symbols b/lib/symbols index f6d59b8..d4a9f65 100644 --- a/lib/symbols +++ b/lib/symbols @@ -261,7 +261,7 @@ Sigma cmr 167 83 mathalpha Upsiloncmr 168 161 mathalpha Phicmr 169 70 mathalpha Psicmr 170 89 mathalpha -Omega cmr 173 87 mathalpha +Omega cmr 172 87 mathalpha aleph cmsy 64 192 mathord imath cmm 123 0 mathord jmath cmm 124 0 mathord @@ -331,7 +331,7 @@ wr cmsy111 0 mathbin divcmsy165 184 mathbin odot cmsy175 0 mathbin oslash cmsy174 198 mathbin -otimes cmsy173 196 mathbin +otimes cmsy172 196 mathbin ominus cmsy170 0 mathbin oplus cmsy169 197 mathbin mp cmsy168 0 mathbin @@ -435,7 +435,7 @@ ulcorner msa 112 0 mathopen urcorner msa 113 0 mathclose llcorner msa 120 0 mathopen lrcorner msa 121 0 mathclose -rightleftharpoons msa 173 0 mathrel +rightleftharpoons msa 172 0 mathrel angle msa 92 208 mathord sqsubset msa 64 0 mathrel sqsupset msa 65 0 mathrel @@ -578,7 +578,7 @@ nprec msb 167 0 mathrel nsucc msb 168 0 mathrel lneqq msb 169 0 mathrel gneqq msb
[LyX/master] Fix bug #9392: Matrix widget keyboard navigation broken
commit e3960ffd0b9ae961431e4a4b7337eb5f0aa9781a Author: Enrico Forestieri <for...@lyx.org> Date: Tue Jan 27 22:59:33 2015 +0100 Fix bug #9392: Matrix widget keyboard navigation broken diff --git a/src/frontends/qt4/ui/MathMatrixUi.ui b/src/frontends/qt4/ui/MathMatrixUi.ui index 0ff1a0a..9666160 100644 --- a/src/frontends/qt4/ui/MathMatrixUi.ui +++ b/src/frontends/qt4/ui/MathMatrixUi.ui @@ -219,7 +219,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - valignCO + decorationCO @@ -287,6 +287,7 @@ columnsSB valignCO halignED + decorationCO okPB closePB
[LyX/master] Correct name of a svg icon.
commit 31a2cb5ed2948ae197ec5c4a2bac5b8270aa23f4 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Feb 16 16:10:53 2015 +0100 Correct name of a svg icon. diff --git a/lib/images/svg/dialog-show-character.svgz b/lib/images/svg/dialog-show-character.svgz deleted file mode 100644 index 814d8e0..000 Binary files a/lib/images/svg/dialog-show-character.svgz and /dev/null differ diff --git a/lib/images/svg/dialog-show_character.svgz b/lib/images/svg/dialog-show_character.svgz new file mode 100644 index 000..814d8e0 Binary files /dev/null and b/lib/images/svg/dialog-show_character.svgz differ
[LyX/master] Add another bunch of missing svg icons.
commit b4b02da31f6821759b36dc919f3c6fe2fd55fbf6 Author: Enrico Forestieri <for...@lyx.org> Date: Tue Mar 3 15:43:10 2015 +0100 Add another bunch of missing svg icons. I also tweaked some existing icons to make them look better at default size. Moreover, some text was replaced with paths, because the required font may not exist on a system and font substitution would take place, making the icons look different on different systems. diff --git a/lib/images/svg/all-changes-accept.svgz b/lib/images/svg/all-changes-accept.svgz new file mode 100644 index 000..64abe1b Binary files /dev/null and b/lib/images/svg/all-changes-accept.svgz differ diff --git a/lib/images/svg/all-changes-reject.svgz b/lib/images/svg/all-changes-reject.svgz new file mode 100644 index 000..340067a Binary files /dev/null and b/lib/images/svg/all-changes-reject.svgz differ diff --git a/lib/images/svg/break-line.svgz b/lib/images/svg/break-line.svgz new file mode 100644 index 000..b2881b3 Binary files /dev/null and b/lib/images/svg/break-line.svgz differ diff --git a/lib/images/svg/buffer-close.svgz b/lib/images/svg/buffer-close.svgz index b7614c2..f07bfd5 100644 Binary files a/lib/images/svg/buffer-close.svgz and b/lib/images/svg/buffer-close.svgz differ diff --git a/lib/images/svg/buffer-export.svgz b/lib/images/svg/buffer-export.svgz new file mode 100644 index 000..c448823 Binary files /dev/null and b/lib/images/svg/buffer-export.svgz differ diff --git a/lib/images/svg/buffer-export_dvi.svgz b/lib/images/svg/buffer-export_dvi.svgz new file mode 100644 index 000..bdba67a Binary files /dev/null and b/lib/images/svg/buffer-export_dvi.svgz differ diff --git a/lib/images/svg/buffer-export_dvi3.svgz b/lib/images/svg/buffer-export_dvi3.svgz new file mode 100644 index 000..bdba67a Binary files /dev/null and b/lib/images/svg/buffer-export_dvi3.svgz differ diff --git a/lib/images/svg/buffer-export_latex.svgz b/lib/images/svg/buffer-export_latex.svgz new file mode 100644 index 000..e4508e0 Binary files /dev/null and b/lib/images/svg/buffer-export_latex.svgz differ diff --git a/lib/images/svg/buffer-export_pdf.svgz b/lib/images/svg/buffer-export_pdf.svgz new file mode 100644 index 000..c94d2fe Binary files /dev/null and b/lib/images/svg/buffer-export_pdf.svgz differ diff --git a/lib/images/svg/buffer-export_pdf2.svgz b/lib/images/svg/buffer-export_pdf2.svgz new file mode 100644 index 000..909ff17 Binary files /dev/null and b/lib/images/svg/buffer-export_pdf2.svgz differ diff --git a/lib/images/svg/buffer-export_pdf3.svgz b/lib/images/svg/buffer-export_pdf3.svgz new file mode 100644 index 000..34a1a54 Binary files /dev/null and b/lib/images/svg/buffer-export_pdf3.svgz differ diff --git a/lib/images/svg/buffer-export_pdf4.svgz b/lib/images/svg/buffer-export_pdf4.svgz new file mode 100644 index 000..6081220 Binary files /dev/null and b/lib/images/svg/buffer-export_pdf4.svgz differ diff --git a/lib/images/svg/buffer-export_pdf5.svgz b/lib/images/svg/buffer-export_pdf5.svgz new file mode 100644 index 000..05a3657 Binary files /dev/null and b/lib/images/svg/buffer-export_pdf5.svgz differ diff --git a/lib/images/svg/buffer-export_ps.svgz b/lib/images/svg/buffer-export_ps.svgz new file mode 100644 index 000..e052c85 Binary files /dev/null and b/lib/images/svg/buffer-export_ps.svgz differ diff --git a/lib/images/svg/buffer-export_text.svgz b/lib/images/svg/buffer-export_text.svgz new file mode 100644 index 000..7765b7d Binary files /dev/null and b/lib/images/svg/buffer-export_text.svgz differ diff --git a/lib/images/svg/buffer-reload.svgz b/lib/images/svg/buffer-reload.svgz new file mode 100644 index 000..ec0b206 Binary files /dev/null and b/lib/images/svg/buffer-reload.svgz differ diff --git a/lib/images/svg/buffer-toggle-output-sync.svgz b/lib/images/svg/buffer-toggle-output-sync.svgz new file mode 100644 index 000..b1618ea Binary files /dev/null and b/lib/images/svg/buffer-toggle-output-sync.svgz differ diff --git a/lib/images/svg/buffer-update.svgz b/lib/images/svg/buffer-update.svgz index d6984b1..e83d1ea 100644 Binary files a/lib/images/svg/buffer-update.svgz and b/lib/images/svg/buffer-update.svgz differ diff --git a/lib/images/svg/buffer-update_dvi.svgz b/lib/images/svg/buffer-update_dvi.svgz new file mode 100644 index 000..6eccf99 Binary files /dev/null and b/lib/images/svg/buffer-update_dvi.svgz differ diff --git a/lib/images/svg/buffer-update_dvi3.svgz b/lib/images/svg/buffer-update_dvi3.svgz new file mode 100644 index 000..6eccf99 Binary files /dev/null and b/lib/images/svg/buffer-update_dvi3.svgz differ diff --git a/lib/images/svg/buffer-update_pdf.svgz b/lib/images/svg/buffer-update_pdf.svgz new file mode 100644 index 000..c9e37ce Binary files /dev/null and b/lib/images/svg/buffer-update_pdf.svgz differ diff --git a/lib/images/svg/buffer-update_pdf2.svgz b/lib/images/svg/buffer-update_pdf2.svgz new file mode
[LyX/master] Update cygwin script.
commit afeae62f3f9653bccc85a4ef20c99908de70d8e5 Author: Enrico Forestieri <for...@lyx.org> Date: Tue Mar 3 18:17:37 2015 +0100 Update cygwin script. Recent versions of the cygwin X11 server come with a startup script that explicitly uses '-nolisten tcp' for improved security. This means that mentioning a host part in the DISPLAY variable precludes correct operation. So, leave blank the host part such that only local connections are attempted. Even if a user can override this setting in the own ~/.lyxprofile, novice users (and even experienced ones, at first) would be probably confused by the "Error: Can't open display: localhost:0" message and thus it is better to make this work out of the box. diff --git a/development/cygwin/lyxprofile b/development/cygwin/lyxprofile index afa21be..f61e941 100644 --- a/development/cygwin/lyxprofile +++ b/development/cygwin/lyxprofile @@ -16,7 +16,7 @@ export HOME export LANG=C.UTF-8 # Set up Hostname/IP address where LyX can find an X-server. -export DISPLAY=localhost:0.0 +export DISPLAY=:0.0 # # Below this line you should not change anything if you're
[LyX/2.1.x] Update cygwin script.
commit 0e274e06d8e65020a972af2102e16c4ff82fdb05 Author: Enrico Forestieri <for...@lyx.org> Date: Thu Mar 5 00:01:40 2015 +0100 Update cygwin script. Recent versions of the cygwin X11 server come with a startup script that explicitly uses '-nolisten tcp' for improved security. This means that mentioning a host part in the DISPLAY variable precludes correct operation. So, leave blank the host part such that only local connections are attempted. Even if a user can override this setting in the own ~/.lyxprofile, novice users (and even experienced ones, at first) would be probably confused by the "Error: Can't open display: localhost:0" message and thus it is better to make this work out of the box. diff --git a/development/cygwin/lyxprofile b/development/cygwin/lyxprofile index afa21be..f61e941 100644 --- a/development/cygwin/lyxprofile +++ b/development/cygwin/lyxprofile @@ -16,7 +16,7 @@ export HOME export LANG=C.UTF-8 # Set up Hostname/IP address where LyX can find an X-server. -export DISPLAY=localhost:0.0 +export DISPLAY=:0.0 # # Below this line you should not change anything if you're diff --git a/status.21x b/status.21x index c74e2ce..336c98f 100644 --- a/status.21x +++ b/status.21x @@ -42,6 +42,9 @@ What's new - Fix some missing symbols in math completer. +- Fix the profile script used on cygwin to comply with the latest cygwin/X + X server which, by default, does not anymore listen to tcp connections. + * DOCUMENTATION AND LOCALIZATION
[LyX/master] Add another bunch of svg icons.
commit 9bcdf14e064814ba927c2a978747a2347a1af79e Author: Enrico Forestieri <for...@lyx.org> Date: Sun Mar 8 20:25:40 2015 +0100 Add another bunch of svg icons. Also tweaked some existing icons for better rendering at default size. diff --git a/lib/images/svg/demote.svgz b/lib/images/svg/demote.svgz new file mode 100644 index 000..8bd4828 Binary files /dev/null and b/lib/images/svg/demote.svgz differ diff --git a/lib/images/svg/dialog-show_vclog.svgz b/lib/images/svg/dialog-show_vclog.svgz new file mode 100644 index 000..98f1660 Binary files /dev/null and b/lib/images/svg/dialog-show_vclog.svgz differ diff --git a/lib/images/svg/down.svgz b/lib/images/svg/down.svgz index 4cf5884..db3a4ab 100644 Binary files a/lib/images/svg/down.svgz and b/lib/images/svg/down.svgz differ diff --git a/lib/images/svg/font-bold.svgz b/lib/images/svg/font-bold.svgz index ebae303..b562a48 100644 Binary files a/lib/images/svg/font-bold.svgz and b/lib/images/svg/font-bold.svgz differ diff --git a/lib/images/svg/font-sans.svgz b/lib/images/svg/font-sans.svgz new file mode 100644 index 000..a134d01 Binary files /dev/null and b/lib/images/svg/font-sans.svgz differ diff --git a/lib/images/svg/font-smallcaps.svgz b/lib/images/svg/font-smallcaps.svgz new file mode 100644 index 000..75fa713 Binary files /dev/null and b/lib/images/svg/font-smallcaps.svgz differ diff --git a/lib/images/svg/info-insert_buffer_vcs-revision.svgz b/lib/images/svg/info-insert_buffer_vcs-revision.svgz new file mode 100644 index 000..63c5e87 Binary files /dev/null and b/lib/images/svg/info-insert_buffer_vcs-revision.svgz differ diff --git a/lib/images/svg/layout-document.svgz b/lib/images/svg/layout-document.svgz new file mode 100644 index 000..ce97a73 Binary files /dev/null and b/lib/images/svg/layout-document.svgz differ diff --git a/lib/images/svg/layout_LyX-Code.svgz b/lib/images/svg/layout_LyX-Code.svgz new file mode 100644 index 000..428a083 Binary files /dev/null and b/lib/images/svg/layout_LyX-Code.svgz differ diff --git a/lib/images/svg/layout_Section.svgz b/lib/images/svg/layout_Section.svgz new file mode 100644 index 000..65b4335 Binary files /dev/null and b/lib/images/svg/layout_Section.svgz differ diff --git a/lib/images/svg/lyx-quit.svgz b/lib/images/svg/lyx-quit.svgz new file mode 100644 index 000..55809be Binary files /dev/null and b/lib/images/svg/lyx-quit.svgz differ diff --git a/lib/images/svg/promote.svgz b/lib/images/svg/promote.svgz new file mode 100644 index 000..4542492 Binary files /dev/null and b/lib/images/svg/promote.svgz differ diff --git a/lib/images/svg/reload.svgz b/lib/images/svg/reload.svgz new file mode 100644 index 000..614af89 Binary files /dev/null and b/lib/images/svg/reload.svgz differ diff --git a/lib/images/svg/tab-group-close.svgz b/lib/images/svg/tab-group-close.svgz new file mode 100644 index 000..30b1999 Binary files /dev/null and b/lib/images/svg/tab-group-close.svgz differ diff --git a/lib/images/svg/tabular-feature_align-decimal.svgz b/lib/images/svg/tabular-feature_align-decimal.svgz index 123fcaa..7ebac5a 100644 Binary files a/lib/images/svg/tabular-feature_align-decimal.svgz and b/lib/images/svg/tabular-feature_align-decimal.svgz differ diff --git a/lib/images/svg/tabular-feature_append-column.svgz b/lib/images/svg/tabular-feature_append-column.svgz new file mode 100644 index 000..fa622e5 Binary files /dev/null and b/lib/images/svg/tabular-feature_append-column.svgz differ diff --git a/lib/images/svg/tabular-feature_append-row.svgz b/lib/images/svg/tabular-feature_append-row.svgz new file mode 100644 index 000..65ecfed Binary files /dev/null and b/lib/images/svg/tabular-feature_append-row.svgz differ diff --git a/lib/images/svg/tabular-feature_delete-column.svgz b/lib/images/svg/tabular-feature_delete-column.svgz new file mode 100644 index 000..ab8d1d4 Binary files /dev/null and b/lib/images/svg/tabular-feature_delete-column.svgz differ diff --git a/lib/images/svg/tabular-feature_delete-row.svgz b/lib/images/svg/tabular-feature_delete-row.svgz new file mode 100644 index 000..a85d92c Binary files /dev/null and b/lib/images/svg/tabular-feature_delete-row.svgz differ diff --git a/lib/images/svg/tabular-feature_m-align-center.svgz b/lib/images/svg/tabular-feature_m-align-center.svgz index 0ff7e09..9cc3e56 100644 Binary files a/lib/images/svg/tabular-feature_m-align-center.svgz and b/lib/images/svg/tabular-feature_m-align-center.svgz differ diff --git a/lib/images/svg/tabular-feature_m-align-left.svgz b/lib/images/svg/tabular-feature_m-align-left.svgz index bbd89fa..4fe67c8 100644 Binary files a/lib/images/svg/tabular-feature_m-align-left.svgz and b/lib/images/svg/tabular-feature_m-align-left.svgz differ diff --git a/lib/images/svg/tabular-feature_m-align-right.svgz b/lib/images/svg/tabular-feature_m-align-right.svgz index c53a3b1..ca52744 100644 Binary files a/lib/images/svg/tabular-feature_m-align-righ
[LyX/master] Reduce size of some svg icons.
commit a78340e30296467fcbae88bc237d036b7c8ade46 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Mar 9 02:38:12 2015 +0100 Reduce size of some svg icons. The svg files produced by vector editors may end up containing a lot of unused elements that increase their size without any impact on quality. For example, this occurs when copy/pasting between images such that unused effects or shadings simply clutter the files. Removing these elements in some cases may reduce the size to one half or one third of the original one, leaving unmodified the image quality. diff --git a/lib/images/svg/all-changes-accept.svgz b/lib/images/svg/all-changes-accept.svgz index 64abe1b..0f8d4c2 100644 Binary files a/lib/images/svg/all-changes-accept.svgz and b/lib/images/svg/all-changes-accept.svgz differ diff --git a/lib/images/svg/all-changes-reject.svgz b/lib/images/svg/all-changes-reject.svgz index 340067a..3d6ac39 100644 Binary files a/lib/images/svg/all-changes-reject.svgz and b/lib/images/svg/all-changes-reject.svgz differ diff --git a/lib/images/svg/bookmark-goto.svgz b/lib/images/svg/bookmark-goto.svgz index 6aee7b9..8de06cc 100644 Binary files a/lib/images/svg/bookmark-goto.svgz and b/lib/images/svg/bookmark-goto.svgz differ diff --git a/lib/images/svg/bookmark-goto_0.svgz b/lib/images/svg/bookmark-goto_0.svgz index 35885ce..183b515 100644 Binary files a/lib/images/svg/bookmark-goto_0.svgz and b/lib/images/svg/bookmark-goto_0.svgz differ diff --git a/lib/images/svg/box-insert.svgz b/lib/images/svg/box-insert.svgz index 1b16bb3..313e1d4 100644 Binary files a/lib/images/svg/box-insert.svgz and b/lib/images/svg/box-insert.svgz differ diff --git a/lib/images/svg/break-line.svgz b/lib/images/svg/break-line.svgz index b2881b3..fc4ee6c 100644 Binary files a/lib/images/svg/break-line.svgz and b/lib/images/svg/break-line.svgz differ diff --git a/lib/images/svg/buffer-close.svgz b/lib/images/svg/buffer-close.svgz index f07bfd5..624e860 100644 Binary files a/lib/images/svg/buffer-close.svgz and b/lib/images/svg/buffer-close.svgz differ diff --git a/lib/images/svg/buffer-export.svgz b/lib/images/svg/buffer-export.svgz index c448823..02b3a4d 100644 Binary files a/lib/images/svg/buffer-export.svgz and b/lib/images/svg/buffer-export.svgz differ diff --git a/lib/images/svg/buffer-export_dvi.svgz b/lib/images/svg/buffer-export_dvi.svgz index bdba67a..f7e765f 100644 Binary files a/lib/images/svg/buffer-export_dvi.svgz and b/lib/images/svg/buffer-export_dvi.svgz differ diff --git a/lib/images/svg/buffer-export_latex.svgz b/lib/images/svg/buffer-export_latex.svgz index e4508e0..e1d39c7 100644 Binary files a/lib/images/svg/buffer-export_latex.svgz and b/lib/images/svg/buffer-export_latex.svgz differ diff --git a/lib/images/svg/buffer-export_pdf.svgz b/lib/images/svg/buffer-export_pdf.svgz index c94d2fe..3ce629d 100644 Binary files a/lib/images/svg/buffer-export_pdf.svgz and b/lib/images/svg/buffer-export_pdf.svgz differ diff --git a/lib/images/svg/buffer-export_pdf2.svgz b/lib/images/svg/buffer-export_pdf2.svgz index 909ff17..62fd4fe 100644 Binary files a/lib/images/svg/buffer-export_pdf2.svgz and b/lib/images/svg/buffer-export_pdf2.svgz differ diff --git a/lib/images/svg/buffer-export_pdf3.svgz b/lib/images/svg/buffer-export_pdf3.svgz index 34a1a54..72cfc20 100644 Binary files a/lib/images/svg/buffer-export_pdf3.svgz and b/lib/images/svg/buffer-export_pdf3.svgz differ diff --git a/lib/images/svg/buffer-export_pdf4.svgz b/lib/images/svg/buffer-export_pdf4.svgz index 6081220..caec264 100644 Binary files a/lib/images/svg/buffer-export_pdf4.svgz and b/lib/images/svg/buffer-export_pdf4.svgz differ diff --git a/lib/images/svg/buffer-export_pdf5.svgz b/lib/images/svg/buffer-export_pdf5.svgz index 05a3657..ec4bd0d 100644 Binary files a/lib/images/svg/buffer-export_pdf5.svgz and b/lib/images/svg/buffer-export_pdf5.svgz differ diff --git a/lib/images/svg/buffer-export_ps.svgz b/lib/images/svg/buffer-export_ps.svgz index e052c85..5ef5a02 100644 Binary files a/lib/images/svg/buffer-export_ps.svgz and b/lib/images/svg/buffer-export_ps.svgz differ diff --git a/lib/images/svg/buffer-export_text.svgz b/lib/images/svg/buffer-export_text.svgz index 7765b7d..f1c77d4 100644 Binary files a/lib/images/svg/buffer-export_text.svgz and b/lib/images/svg/buffer-export_text.svgz differ diff --git a/lib/images/svg/buffer-new.svgz b/lib/images/svg/buffer-new.svgz index 9005f5b..b1995b5 100644 Binary files a/lib/images/svg/buffer-new.svgz and b/lib/images/svg/buffer-new.svgz differ diff --git a/lib/images/svg/buffer-reload.svgz b/lib/images/svg/buffer-reload.svgz index ec0b206..a1ffbfc 100644 Binary files a/lib/images/svg/buffer-reload.svgz and b/lib/images/svg/buffer-reload.svgz differ diff --git a/lib/images/svg/buffer-toggle-output-sync.svgz b/lib/images/svg/buffer-toggle-output-sync.svgz index b1618ea..01435f9 100644 Binary files a/lib/images/svg/buffer-toggle-output-sync.svgz and
[LyX/master] Make sure a temporary file is always created in the global temporary dir.
commit cbad159ac2de9387e9ef6130568eb2fa97732ad4 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 00:31:08 2015 +0100 Make sure a temporary file is always created in the global temporary dir. diff --git a/src/support/TempFile.cpp b/src/support/TempFile.cpp index 21559e1..6e5a91d 100644 --- a/src/support/TempFile.cpp +++ b/src/support/TempFile.cpp @@ -14,6 +14,7 @@ #include "support/debug.h" #include "support/FileName.h" +#include "support/filetools.h" #include "support/Package.h" #include "support/qstring_helpers.h" @@ -47,14 +48,16 @@ struct TempFile::Private TempFile::TempFile(FileName const & temp_dir, string const & mask) { - QFileInfo tmp_fi(QDir(toqstr(temp_dir.absoluteFilePath())), toqstr(mask)); + QFileInfo tmp_fi(QDir(toqstr(temp_dir.absoluteFilePath())), +toqstr(onlyFileName(mask))); d = new Private(tmp_fi.absoluteFilePath()); } TempFile::TempFile(string const & mask) { - QFileInfo tmp_fi(QDir(toqstr(package().temp_dir().absoluteFilePath())), toqstr(mask)); + QFileInfo tmp_fi(QDir(toqstr(package().temp_dir().absoluteFilePath())), +toqstr(onlyFileName(mask))); d = new Private(tmp_fi.absoluteFilePath()); } diff --git a/src/support/TempFile.h b/src/support/TempFile.h index b99ee75..53e91f0 100644 --- a/src/support/TempFile.h +++ b/src/support/TempFile.h @@ -33,9 +33,9 @@ class TempFile { public: /** *Create a temporary file with the given mask. -* \p mask must be in filesystem encoding, if it contains a -* relative path, the template file will be created in the global -* temporary directory as given by 'package().temp_dir()'. +* \p mask must be in filesystem encoding, the template file +* will be created in the global temporary directory as given +* by 'package().temp_dir()'. * If the mask contains "XX" this portion will be replaced by * a uniquely generated string. If it does not contain this portion, * it will be automatically appended using a dot. Therefore, please
[LyX/master] Properly name an uncompressed sgvz file.
commit bd9f5408cfe588dd68b8d7b011ef4f796477bca5 Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 00:34:53 2015 +0100 Properly name an uncompressed sgvz file. Some tools may rely on the extension and do not actually check whether a svg file is compressed or not. diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 2008838..134dc17 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -872,6 +872,8 @@ string const unzippedFileName(string const & zipped_file) string const ext = getExtension(zipped_file); if (ext == "gz" || ext == "z" || ext == "Z") return changeExtension(zipped_file, string()); + else if (ext == "svgz") + return changeExtension(zipped_file, "svg"); return onlyPath(zipped_file) + "unzipped_" + onlyFileName(zipped_file); }
[LyX/master] Use the nominal theme's icon size for displaying the icon in an info inset.
commit d00dcc2ca7bf1b9a3043d23b1c5b598ff7e46aad Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 00:38:05 2015 +0100 Use the nominal theme's icon size for displaying the icon in an info inset. diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index d914d94..3d35e29 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -31,6 +31,7 @@ #include "frontends/Application.h" +#include "support/convert.h" #include "support/debug.h" #include "support/docstream.h" #include "support/docstring_list.h" @@ -410,6 +411,8 @@ void InsetInfo::updateInfo() InsetGraphics * inset = new InsetGraphics(buffer_); InsetGraphicsParams igp; igp.filename = file; + igp.lyxscale = iconScaleFactor(file); + igp.scale = convert(igp.lyxscale); inset->setParams(igp); clear(); Font const f(inherit_font, buffer().params().language); diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 134dc17..f5cdb27 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -37,6 +37,7 @@ #include "support/qstring_helpers.h" #include +#include #include #include "support/lassert.h" @@ -407,6 +408,24 @@ FileName const imageLibFileSearch(string & dir, string const & name, } +int iconScaleFactor(FileName const & image) +{ + int imgsize = QImage(toqstr(image.absFileName())).height(); + if (imgsize <= 0) + return 100; + + // default icon size + int iconsize = 20; + + string dir = "images"; + FileName const fn = imageLibFileSearch(dir, "iconsize.png"); + if (!fn.empty()) + iconsize = QImage(toqstr(fn.absFileName())).height(); + + return (100 * iconsize + imgsize / 2)/imgsize; +} + + string const commandPrep(string const & command_in) { static string const token_scriptpath = "$$s/"; diff --git a/src/support/filetools.h b/src/support/filetools.h index b041b36..0180f29 100644 --- a/src/support/filetools.h +++ b/src/support/filetools.h @@ -115,6 +115,11 @@ imageLibFileSearch(std::string & dir, std::string const & name, std::string const & ext = std::string(), search_mode mode = must_exist); +/** Returns the percentage factor by which an image has to be +scaled for matching the (theme dependent) nominal icon size + */ +int iconScaleFactor(FileName const & image); + /// How to quote a filename enum quote_style { /** Quote for the (OS dependant) shell. This is needed for command
[LyX/master] Prefer svg icons.
commit 7be2a5d815d84470078773e5329bb6c9870aeb3d Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 00:47:21 2015 +0100 Prefer svg icons. If a compressed svg icon is present, load it instead of a png one. Also introduce two more sizes (huge and giant icons) that should be useful when using hires displays, as svg icons automatically scale to the desired size without loss of quality. diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 6812a2d..39b73cf 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -519,11 +519,11 @@ QString iconName(FuncRequest const & f, bool unknown) search_mode mode = theGuiApp()->imageSearchMode(); for (int i = 0; i < imagedirs.size(); ++i) { QString imagedir = imagedirs.at(i) + path; - FileName fname = imageLibFileSearch(imagedir, name1, "png", mode); + FileName fname = imageLibFileSearch(imagedir, name1, "svgz,png", mode); if (fname.exists()) return toqstr(fname.absFileName()); - fname = imageLibFileSearch(imagedir, name2, "png", mode); + fname = imageLibFileSearch(imagedir, name2, "svgz,png", mode); if (fname.exists()) return toqstr(fname.absFileName()); } @@ -534,25 +534,27 @@ QString iconName(FuncRequest const & f, bool unknown) LYXERR0("Directory " << path << " not found in resource!"); return QString(); } - name1 += ".png"; - if (res.exists(name1)) - return path + name1; + if (res.exists(name1 + ".svgz")) + return path + name1 + ".svgz"; + else if (res.exists(name1 + ".png")) + return path + name1 + ".png"; - name2 += ".png"; - if (res.exists(name2)) - return path + name2; + if (res.exists(name2 + ".svgz")) + return path + name2 + ".svgz"; + else if (res.exists(name2 + ".png")) + return path + name2 + ".png"; LYXERR(Debug::GUI, "Cannot find icon with filename " - << "\"" << name1 << "\"" + << "\"" << name1 << ".{svgz,png}\"" << " or filename " - << "\"" << name2 << "\"" + << "\"" << name2 << ".{svgz,png}\"" << " for command \"" << lyxaction.getActionName(f.action()) << '(' << to_utf8(f.argument()) << ")\""); if (unknown) { QString imagedir = "images/"; - FileName fname = imageLibFileSearch(imagedir, "unknown", "png", mode); + FileName fname = imageLibFileSearch(imagedir, "unknown", "svgz,png", mode); if (fname.exists()) return toqstr(fname.absFileName()); return QString(":/images/unknown.png"); @@ -566,19 +568,23 @@ QPixmap getPixmap(QString const & path, QString const & name, QString const & ex QPixmap pixmap; QString imagedir = path; FileName fname = imageLibFileSearch(imagedir, name, ext, theGuiApp()->imageSearchMode()); - QString path1 = toqstr(fname.absFileName()); - QString path2 = ":/" + path + name + "." + ext; + QString fpath = toqstr(fname.absFileName()); - if (pixmap.load(path1)) { - return pixmap; - } - else if (pixmap.load(path2)) { + if (pixmap.load(fpath)) { return pixmap; + } else { + QStringList exts = ext.split(","); + fpath = ":/" + path + name + "."; + for (int i = 0; i < exts.size(); ++i) { + if (pixmap.load(fpath + exts.at(i))) + return pixmap; + } } + bool const list = ext.contains(","); LYXERR0("Cannot load pixmap \"" - << path << name << '.' << ext - << "\", please verify resource system!"); + << path << name << "." << (list ? "{" : "") << ext + << (list ? "}" : "
[LyX/master] Make sure an unzipped file has correct extension.
commit c057d4e7ee7a64954d0be7ddb544e175de6a904e Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 17:24:09 2015 +0100 Make sure an unzipped file has correct extension. If a mask is missing, the TempFile class appends it to the filename. This may be a problem with applications relying on the extension, so explicitly add a mask. diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 4d18ce0..9fab10d 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -362,7 +362,11 @@ bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from) zipped_ = formats.isZippedFile(filename_); if (zipped_) { - TempFile tempfile(filename_.toFilesystemEncoding()); + string tempname = unzippedFileName(filename_.toFilesystemEncoding()); + string const ext = getExtension(tempname); + if (!ext.empty()) + tempname = changeExtension(tempname, ""); + TempFile tempfile(tempname + "-XX." + ext); tempfile.setAutoRemove(false); unzipped_filename_ = tempfile.name(); if (unzipped_filename_.empty()) {
[LyX/master] Make sure that a generated temporary filename doesn't end with a dot.
commit ee6583ff94497c290898444da5ce3853b89e937d Author: Enrico Forestieri <for...@lyx.org> Date: Fri Mar 13 18:12:08 2015 +0100 Make sure that a generated temporary filename doesn't end with a dot. This may happen if the extension is empty, and a filename ending with a dot may give troubles on Windows. diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 9fab10d..2e8c415 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -364,9 +364,10 @@ bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from) if (zipped_) { string tempname = unzippedFileName(filename_.toFilesystemEncoding()); string const ext = getExtension(tempname); + tempname = changeExtension(tempname, "") + "-XX"; if (!ext.empty()) - tempname = changeExtension(tempname, ""); - TempFile tempfile(tempname + "-XX." + ext); + tempname = addExtension(tempname, ext); + TempFile tempfile(tempname); tempfile.setAutoRemove(false); unzipped_filename_ = tempfile.name(); if (unzipped_filename_.empty()) {
[LyX/master] Squash last icon warnings and improve rendering at default size.
commit a089504663d488cbfec27e1732e5165ce5ed44ee Author: Enrico Forestieri <for...@lyx.org> Date: Sat Mar 14 08:43:58 2015 +0100 Squash last icon warnings and improve rendering at default size. diff --git a/lib/images/math-macro-add-greedy-optional-param.svgz b/lib/images/math-macro-add-greedy-optional-param.svgz index c12ec9a..aa6838c 100644 Binary files a/lib/images/math-macro-add-greedy-optional-param.svgz and b/lib/images/math-macro-add-greedy-optional-param.svgz differ diff --git a/lib/images/math-macro-add-optional-param.svgz b/lib/images/math-macro-add-optional-param.svgz index 57c657d..70cbea4 100644 Binary files a/lib/images/math-macro-add-optional-param.svgz and b/lib/images/math-macro-add-optional-param.svgz differ diff --git a/lib/images/math-macro-add-param.svgz b/lib/images/math-macro-add-param.svgz index 73b5073..ae78f40 100644 Binary files a/lib/images/math-macro-add-param.svgz and b/lib/images/math-macro-add-param.svgz differ diff --git a/lib/images/math-macro-append-greedy-param.svgz b/lib/images/math-macro-append-greedy-param.svgz index 5b588ee..8363403 100644 Binary files a/lib/images/math-macro-append-greedy-param.svgz and b/lib/images/math-macro-append-greedy-param.svgz differ diff --git a/lib/images/math-macro-make-nonoptional.svgz b/lib/images/math-macro-make-nonoptional.svgz index 29a3d54..9abca11 100644 Binary files a/lib/images/math-macro-make-nonoptional.svgz and b/lib/images/math-macro-make-nonoptional.svgz differ diff --git a/lib/images/math-macro-make-optional.svgz b/lib/images/math-macro-make-optional.svgz index 5965140..aead75d 100644 Binary files a/lib/images/math-macro-make-optional.svgz and b/lib/images/math-macro-make-optional.svgz differ diff --git a/lib/images/math-macro-remove-greedy-param.svgz b/lib/images/math-macro-remove-greedy-param.svgz index 7a8a5d3..8ada2fe 100644 Binary files a/lib/images/math-macro-remove-greedy-param.svgz and b/lib/images/math-macro-remove-greedy-param.svgz differ diff --git a/lib/images/math-macro-remove-optional-param.svgz b/lib/images/math-macro-remove-optional-param.svgz index 3ebd0ff..5dc6473 100644 Binary files a/lib/images/math-macro-remove-optional-param.svgz and b/lib/images/math-macro-remove-optional-param.svgz differ diff --git a/lib/images/math-macro-remove-param.svgz b/lib/images/math-macro-remove-param.svgz index 4fce188..5702783 100644 Binary files a/lib/images/math-macro-remove-param.svgz and b/lib/images/math-macro-remove-param.svgz differ diff --git a/lib/images/math/font.svgz b/lib/images/math/font.svgz index 9cbca46..ffc901f 100644 Binary files a/lib/images/math/font.svgz and b/lib/images/math/font.svgz differ diff --git a/lib/images/math/frac-square.svgz b/lib/images/math/frac-square.svgz index 64d4279..bfa5dbb 100644 Binary files a/lib/images/math/frac-square.svgz and b/lib/images/math/frac-square.svgz differ diff --git a/lib/images/math/frac.svgz b/lib/images/math/frac.svgz index 721e727..be54c5a 100644 Binary files a/lib/images/math/frac.svgz and b/lib/images/math/frac.svgz differ diff --git a/lib/images/math/functions.svgz b/lib/images/math/functions.svgz index 3532c8b..416bc2e 100644 Binary files a/lib/images/math/functions.svgz and b/lib/images/math/functions.svgz differ diff --git a/lib/images/math/space.svgz b/lib/images/math/space.svgz index 69d776c..2e0a73e 100644 Binary files a/lib/images/math/space.svgz and b/lib/images/math/space.svgz differ diff --git a/lib/images/math/style.svgz b/lib/images/math/style.svgz index 30695ba..bc7fe9d 100644 Binary files a/lib/images/math/style.svgz and b/lib/images/math/style.svgz differ
[LyX/master] Restore some inadvertently overwritten oxygen icons.
commit a9fb950845914d42c3c24bcee8df987a59f6177e Author: Enrico Forestieri <for...@lyx.org> Date: Sat Mar 14 15:42:38 2015 +0100 Restore some inadvertently overwritten oxygen icons. I did not notice that all icons in math/ are shared and in a0895046 I have overwritten some of them. I am restoring them in the proper subdir. Two of them, namely font.svgz and frac.svgz, give warnings that should be addressed. Anyway, I see that these icons use fonts. They are better substitued with paths (a menu entry in inkscape) because if the fonts are missing on a system, the icons look different and, in general, they may look ugly. diff --git a/lib/images/math/oxygen/font.svgz b/lib/images/math/oxygen/font.svgz new file mode 100644 index 000..9cbca46 Binary files /dev/null and b/lib/images/math/oxygen/font.svgz differ diff --git a/lib/images/math/oxygen/frac-square.svgz b/lib/images/math/oxygen/frac-square.svgz new file mode 100644 index 000..64d4279 Binary files /dev/null and b/lib/images/math/oxygen/frac-square.svgz differ diff --git a/lib/images/math/oxygen/frac.svgz b/lib/images/math/oxygen/frac.svgz new file mode 100644 index 000..721e727 Binary files /dev/null and b/lib/images/math/oxygen/frac.svgz differ diff --git a/lib/images/math/oxygen/functions.svgz b/lib/images/math/oxygen/functions.svgz new file mode 100644 index 000..3532c8b Binary files /dev/null and b/lib/images/math/oxygen/functions.svgz differ diff --git a/lib/images/math/oxygen/space.svgz b/lib/images/math/oxygen/space.svgz new file mode 100644 index 000..69d776c Binary files /dev/null and b/lib/images/math/oxygen/space.svgz differ diff --git a/lib/images/math/oxygen/style.svgz b/lib/images/math/oxygen/style.svgz new file mode 100644 index 000..30695ba Binary files /dev/null and b/lib/images/math/oxygen/style.svgz differ
[LyX/master] Add last missing svg icons.
commit 3fb102fa8a8313469e274a72d810b91a264947fd Author: Enrico Forestieri <for...@lyx.org> Date: Sun Mar 15 02:48:31 2015 +0100 Add last missing svg icons. Also correctly rename an oxygen icon. diff --git a/lib/images/editclear.svgz b/lib/images/editclear.svgz new file mode 100755 index 000..1e27ed9 Binary files /dev/null and b/lib/images/editclear.svgz differ diff --git a/lib/images/layout_Chunk.svgz b/lib/images/layout_Chunk.svgz new file mode 100755 index 000..2461c38 Binary files /dev/null and b/lib/images/layout_Chunk.svgz differ diff --git a/lib/images/math/empty.svgz b/lib/images/math/empty.svgz new file mode 100755 index 000..b99b080 Binary files /dev/null and b/lib/images/math/empty.svgz differ diff --git a/lib/images/math/export-others.svgz b/lib/images/math/export-others.svgz new file mode 100755 index 000..c836ba7 Binary files /dev/null and b/lib/images/math/export-others.svgz differ diff --git a/lib/images/oxygen/dialog-show-character.svgz b/lib/images/oxygen/dialog-show-character.svgz deleted file mode 100644 index 42a5378..000 Binary files a/lib/images/oxygen/dialog-show-character.svgz and /dev/null differ diff --git a/lib/images/oxygen/dialog-show_character.svgz b/lib/images/oxygen/dialog-show_character.svgz new file mode 100644 index 000..42a5378 Binary files /dev/null and b/lib/images/oxygen/dialog-show_character.svgz differ
[LyX/master] Install the svg icons.
commit 8fbe17c4d990dbf60f936dbaffc73128fc5bcb33 Author: Enrico Forestieri <for...@lyx.org> Date: Sun Mar 15 02:52:29 2015 +0100 Install the svg icons. diff --git a/lib/Makefile.am b/lib/Makefile.am index ec7d351..d41e923 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -365,7 +365,6 @@ imagesdir = $(pkgdatadir)/images dist_images_DATA1X = \ images/all-changes-accept.png \ images/all-changes-reject.png \ - images/amssymb.png \ images/banner.png \ images/bookmark-goto.png \ images/bookmark-goto_0.png \ @@ -487,10 +486,6 @@ dist_images_DATA1X = \ images/note-next.png \ images/paste.png \ images/promote.png \ - images/psnfss1.png \ - images/psnfss2.png \ - images/psnfss3.png \ - images/psnfss4.png \ images/redo.png \ images/reload.png \ images/script-insert_subscript.png \ @@ -498,7 +493,6 @@ dist_images_DATA1X = \ images/spelling-continuously.png \ images/view-split_horizontal.png \ images/view-split_vertical.png \ - images/standard.png \ images/tabular-feature_align-decimal.png \ images/tabular-feature_append-column.png \ images/tabular-feature_append-row.png \ @@ -548,6 +542,9 @@ dist_images_DATA1X = \ images/vc-revert.png \ images/view-others.png +dist_images_DATA3X = \ + ${dist_images_DATA1X:%.png=%.svgz} + # possible shortcut for complete set of 2x sized icons #dist_images_DATA2X = \ # ${dist_images_DATA1X:%.png=%@2x.png} @@ -556,11 +553,18 @@ dist_images_DATA2X = \ images/ban...@2x.png dist_images_DATA = \ + images/amssymb.png \ + images/psnfss1.png \ + images/psnfss2.png \ + images/psnfss3.png \ + images/psnfss4.png \ + images/standard.png \ ${dist_images_DATA1X} \ - ${dist_images_DATA2X} + ${dist_images_DATA2X} \ + ${dist_images_DATA3X} imagesmathdir = $(imagesdir)/math -dist_imagesmath_DATA = \ +dist_imagesmath_DATA1X = \ images/math/AC.png \ images/math/acute.png \ images/math/adots.png \ @@ -1408,8 +1412,15 @@ dist_imagesmath_DATA = \ images/math/Yup.png \ images/math/zeta.png +dist_imagesmath_DATA2X = \ + ${dist_imagesmath_DATA1X:%.png=%.svgz} + +dist_imagesmath_DATA = \ + ${dist_imagesmath_DATA1X} \ + ${dist_imagesmath_DATA2X} + imagesipadir = $(imagesdir)/ipa -dist_imagesipa_DATA = \ +dist_imagesipa_DATA1X = \ images/ipa/ipamacro-insert_deco_bottomtiebar.png \ images/ipa/ipamacro-insert_deco_toptiebar.png \ images/ipa/ipamacro-insert_tone-falling.png \ @@ -1585,9 +1596,16 @@ dist_imagesipa_DATA = \ images/ipa/unicode-insert_0xa71b.png \ images/ipa/unicode-insert_0xa71c.png +dist_imagesipa_DATA2X = \ + ${dist_imagesipa_DATA1X:%.png=%.svgz} + +dist_imagesipa_DATA = \ + ${dist_imagesipa_DATA1X} \ + ${dist_imagesipa_DATA2X} + imagesoxygendir = $(imagesdir)/oxygen -dist_imagesoxygen_DATA = \ +dist_imagesoxygen_DATA1X = \ images/oxygen/all-changes-accept.png \ images/oxygen/all-changes-reject.png \ images/oxygen/bookmark-goto.png \ @@ -1646,7 +1664,6 @@ dist_imagesoxygen_DATA = \ images/oxygen/font-emph.png \ images/oxygen/font-noun.png \ images/oxygen/footnote-insert.png \ - images/oxygen/iconsize.png \ images/oxygen/href-insert.png \ images/oxygen/index-insert.png \ images/oxygen/label-insert.png \ @@ -1683,6 +1700,14 @@ dist_imagesoxygen_DATA = \ images/oxygen/vc-revert.png \ images/oxygen/view-others.png +dist_imagesoxygen_DATA2X = \ + ${dist_imagesoxygen_DATA1X:%.png=%.svgz} + +dist_imagesoxygen_DATA = \ + images/oxygen/iconsize.png \ + ${dist_imagesoxygen_DATA1X} \ + ${dist_imagesoxygen_DATA2X} + imagesclassicdir = $(imagesdir)/classic dist_imagesclassic_DATA = \ images/classic/all-changes-accept.png \
[LyX/master] Fix bug #9453
commit 0a5e1f20fc807535dd83ddc52d65a22548e478e8 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Mar 16 00:34:35 2015 +0100 Fix bug #9453 This was due to a problem with the QProcess parser. See #9453 for details. diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 5704aa1..229dd2e 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -733,15 +733,10 @@ string latexEnvCmdPrefix(string const & path) return "env TEXINPUTS=\"." + sep + texinputs_prefix + sep + texinputs + "\" "; else -#ifndef USE_QPROCESS + // NOTE: *any* space in the last string matters! (see bug 9453) return "cmd /d /c set \"TEXINPUTS=." + sep + texinputs_prefix - + sep + texinputs + "\"&"; -#else - return "cmd /d /c set \"\"\"TEXINPUTS=." - + sep + texinputs_prefix - + sep + texinputs + "\"\"\"&"; -#endif + + sep + texinputs + " \" & "; }
[LyX/master] Refine fix for #9453
commit 1af2242c7e9c3dd4edd1ddba5f65e5de5c5e600a Author: Enrico Forestieri <for...@lyx.org> Date: Mon Mar 16 10:50:02 2015 +0100 Refine fix for #9453 It is better to introduce a dummy blank dir in TEXINPUTS rather than appending a blank at the end. Even if I have checked that this is not a problem with MikTeX, some other engine (maybe texlive, but I cannot check) could not ignore this space and take it as the name of a dir. In this case, TEXINPUTS would not end with an empty element and the standard search path would not be inserted there. diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 229dd2e..1f794f2 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -733,10 +733,11 @@ string latexEnvCmdPrefix(string const & path) return "env TEXINPUTS=\"." + sep + texinputs_prefix + sep + texinputs + "\" "; else - // NOTE: *any* space in the last string matters! (see bug 9453) - return "cmd /d /c set \"TEXINPUTS=." + // NOTE: the dummy blank dir is necessary to force the + // QProcess parser to quote the argument (see bug 9453) + return "cmd /d /c set \"TEXINPUTS=." + sep + " " + sep + texinputs_prefix - + sep + texinputs + " \" & "; + + sep + texinputs + "\" & "; }