[LyX/master] Simplify Length

2020-11-20 Thread Yuriy Skalko
commit 916ceeba1284ba9b248f3575c6c64d4fa8c361e7
Author: Yuriy Skalko 
Date:   Thu Nov 19 15:53:33 2020 +0200

Simplify Length
---
 src/support/Length.cpp |   97 
 src/support/Length.h   |   46 --
 2 files changed, 25 insertions(+), 118 deletions(-)

diff --git a/src/support/Length.cpp b/src/support/Length.cpp
index d3aa434..e433995 100644
--- a/src/support/Length.cpp
+++ b/src/support/Length.cpp
@@ -39,18 +39,7 @@ namespace lyx {
 //
 /
 
-Length::Length()
-   : val_(0), unit_(Length::UNIT_NONE)
-{}
-
-
-Length::Length(double v, Length::UNIT u)
-   : val_(v), unit_(u)
-{}
-
-
 Length::Length(string const & data)
-   : val_(0), unit_(Length::UNIT_NONE)
 {
Length tmp;
 
@@ -161,42 +150,6 @@ string const Length::asHTMLString() const
 }
 
 
-double Length::value() const
-{
-   return val_;
-}
-
-
-Length::UNIT Length::unit() const
-{
-   return unit_;
-}
-
-
-void Length::value(double v)
-{
-   val_ = v;
-}
-
-
-void Length::unit(Length::UNIT u)
-{
-   unit_ = u;
-}
-
-
-bool Length::zero() const
-{
-   return val_ == 0.0;
-}
-
-
-bool Length::empty() const
-{
-   return unit_ == Length::UNIT_NONE;
-}
-
-
 int Length::inPixels(int text_width, int em_width_base) const
 {
// Zoom factor specified by user in percent
@@ -325,37 +278,12 @@ Length::UNIT Length::defaultUnit()
 }
 
 
-
-bool operator==(Length const & l1, Length const & l2)
-{
-   return l1.value() == l2.value() && l1.unit() == l2.unit();
-}
-
-
-bool operator!=(Length const & l1, Length const & l2)
-{
-   return !(l1 == l2);
-}
-
-
 /
 //
 // GlueLength
 //
 /
 
-
-GlueLength::GlueLength(Length const & len)
-   : len_(len)
-{}
-
-
-GlueLength::GlueLength(Length const & len, Length const & plus,
-   Length const & minus)
-   : len_(len), plus_(plus), minus_(minus)
-{}
-
-
 GlueLength::GlueLength(string const & data)
 {
if (!isValidGlueLength(data, this))
@@ -429,24 +357,6 @@ string const GlueLength::asLatexString() const
 }
 
 
-Length const & GlueLength::len() const
-{
-   return len_;
-}
-
-
-Length const & GlueLength::plus() const
-{
-   return plus_;
-}
-
-
-Length const & GlueLength::minus() const
-{
-   return minus_;
-}
-
-
 bool operator==(GlueLength const & l1, GlueLength const & l2)
 {
return l1.len() == l2.len()
@@ -454,11 +364,4 @@ bool operator==(GlueLength const & l1, GlueLength const & 
l2)
 && l1.minus() == l2.minus();
 }
 
-
-bool operator!=(GlueLength const & l1, GlueLength const & l2)
-{
-   return !(l1 == l2);
-}
-
-
 } // namespace lyx
diff --git a/src/support/Length.h b/src/support/Length.h
index aaf1923..03b4d36 100644
--- a/src/support/Length.h
+++ b/src/support/Length.h
@@ -61,25 +61,25 @@ public:
};
 
///
-   Length();
+   Length() = default;
///
-   Length(double v, Length::UNIT u);
+   Length(double v, Length::UNIT u) : val_(v), unit_(u) {}
 
/// "data" must be a decimal number, followed by a unit
explicit Length(std::string const & data);
 
///
-   double value() const;
+   double value() const { return val_; };
///
-   Length::UNIT unit() const;
+   Length::UNIT unit() const { return unit_; };
///
-   void value(double);
+   void value(double val) { val_ = val; }
///
-   void unit(Length::UNIT unit);
+   void unit(Length::UNIT unit) { unit_ = unit; }
///
-   bool zero() const;
+   bool zero() const { return val_ == 0.0; }
///
-   bool empty() const;
+   bool empty() const { return unit_ == Length::UNIT_NONE; }
/// return string representation
std::string const asString() const;
/// return string representation
@@ -109,15 +109,18 @@ private:
/// Convert value to inch for text width and em width given in inch
double inInch(double text_width, double em_width) const;
///
-   double val_;
+   double val_ = 0;
///
-   Length::UNIT unit_;
+   Length::UNIT unit_ = UNIT_NONE;
 };
 
 ///
-bool operator==(Length const & l1, Length const & l2);
+inline bool operator==(Length const & l1, Length const & l2)
+   { return l1.value() == l2.value() && l1.unit() == l2.unit(); }
 ///
-bool operator!=(Length const & l1, Length const & l2);
+inline bool operator!=(Length const & l1, Length const & l2)
+   { return !(l1 == l2); }
+
 /** Test whether \p data represents a valid length.
  *
  * \returns whether \p data is a valid length
@@ -142,13 +145,12 @@ char const * stringFromUnit(int unit);
 class GlueLength {
 public:
///
-   GlueLength() {}
+   GlueLength() = default;
///
-   explicit Glue

[LyX/master] Remove unused header

2020-11-20 Thread Yuriy Skalko
commit 09eba40418b3398636f860f40872ac0d7af98dd8
Author: Yuriy Skalko 
Date:   Thu Nov 19 14:51:00 2020 +0200

Remove unused header
---
 src/mathed/InsetMathSymbol.cpp |1 -
 src/mathed/MathSupport.cpp |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathSymbol.cpp b/src/mathed/InsetMathSymbol.cpp
index 471ee75..a87b046 100644
--- a/src/mathed/InsetMathSymbol.cpp
+++ b/src/mathed/InsetMathSymbol.cpp
@@ -23,7 +23,6 @@
 
 #include "support/debug.h"
 #include "support/docstream.h"
-#include "support/lyxlib.h"
 #include "support/textutils.h"
 #include "support/unique_ptr.h"
 
diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp
index 732c5ac..acc9523 100644
--- a/src/mathed/MathSupport.cpp
+++ b/src/mathed/MathSupport.cpp
@@ -32,7 +32,6 @@
 #include "support/docstream.h"
 #include "support/lassert.h"
 #include "support/Length.h"
-#include "support/lyxlib.h"
 
 #include 
 #include 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Add more `override` specifiers

2020-11-20 Thread Yuriy Skalko
commit 2941bc01981f151df9360312594bd0517ecc7d3a
Author: Yuriy Skalko 
Date:   Thu Nov 19 15:40:14 2020 +0200

Add more `override` specifiers
---
 src/frontends/qt/GuiClickableLabel.h |2 +-
 src/frontends/qt/GuiFontExample.h|4 +-
 src/frontends/qt/GuiIdListModel.h|   15 
 src/frontends/qt/GuiImage.h  |   12 +++---
 src/frontends/qt/GuiPainter.h|   64 +-
 src/frontends/qt/LaTeXHighlighter.h  |2 +-
 src/frontends/qt/TocModel.h  |2 +-
 7 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/src/frontends/qt/GuiClickableLabel.h 
b/src/frontends/qt/GuiClickableLabel.h
index 4ae4905..b14ba15 100644
--- a/src/frontends/qt/GuiClickableLabel.h
+++ b/src/frontends/qt/GuiClickableLabel.h
@@ -27,7 +27,7 @@ Q_SIGNALS:
void clicked();
 
 protected:
-   void mouseReleaseEvent(QMouseEvent *);
+   void mouseReleaseEvent(QMouseEvent *) override;
 };
 
 }
diff --git a/src/frontends/qt/GuiFontExample.h 
b/src/frontends/qt/GuiFontExample.h
index f0592fd..57862e9 100644
--- a/src/frontends/qt/GuiFontExample.h
+++ b/src/frontends/qt/GuiFontExample.h
@@ -27,10 +27,10 @@ public:
 
void set(QFont const & font, QString const & text);
 
-   virtual QSize sizeHint() const;
+   QSize sizeHint() const override;
 
 protected:
-   virtual void paintEvent(QPaintEvent * p);
+   void paintEvent(QPaintEvent * p) override;
 
 private:
QFont font_;
diff --git a/src/frontends/qt/GuiIdListModel.h 
b/src/frontends/qt/GuiIdListModel.h
index a63b40d..53da3ec 100644
--- a/src/frontends/qt/GuiIdListModel.h
+++ b/src/frontends/qt/GuiIdListModel.h
@@ -44,23 +44,22 @@ public:
// Methods overridden from QAbstractListModel
//
///
-   int rowCount(QModelIndex const & = QModelIndex()) const
+   int rowCount(QModelIndex const & = QModelIndex()) const override
{ return int(userData_.size()); }
 
///
-   virtual QVariant data(QModelIndex const & index,
- int role = Qt::DisplayRole) const;
+   QVariant data(QModelIndex const & index, int role = Qt::DisplayRole) 
const override;
///
-   bool insertRows(int row, int count, QModelIndex const & parent = 
QModelIndex());
+   bool insertRows(int row, int count, QModelIndex const & parent = 
QModelIndex()) override;
///
-   bool removeRows(int row, int count, QModelIndex const & parent = 
QModelIndex());
+   bool removeRows(int row, int count, QModelIndex const & parent = 
QModelIndex()) override;
///
void clear() { removeRows(0, rowCount()); }
///
-   virtual bool setData (QModelIndex const & index,
-   const QVariant & value, int role = Qt::EditRole );
+   bool setData (QModelIndex const & index,
+   const QVariant & value, int role = Qt::EditRole) 
override;
///
-   virtual QMap itemData(QModelIndex const & index ) const;
+   QMap itemData(QModelIndex const & index ) const override;
//
// New methods
//
diff --git a/src/frontends/qt/GuiImage.h b/src/frontends/qt/GuiImage.h
index 6f60644..075c4e9 100644
--- a/src/frontends/qt/GuiImage.h
+++ b/src/frontends/qt/GuiImage.h
@@ -34,24 +34,24 @@ public:
 
 private:
/// Create a copy
-   Image * clone() const;
+   Image * clone() const override;
/// Get the image width
-   unsigned int width() const;
+   unsigned int width() const override;
/// Get the image height
-   unsigned int height() const;
+   unsigned int height() const override;
// FIXME Is the image drawable ?
-   bool isDrawable() const { return true; }
+   bool isDrawable() const override { return true; }
/**
 * Load the image file into memory.
 */
-   bool load(support::FileName const & filename);
+   bool load(support::FileName const & filename) override;
bool load();
/**
 * Finishes the process of modifying transformed_, using
 * \c params to decide on color, grayscale etc.
 * \returns true if successful.
 */
-   bool setPixmap(Params const & params);
+   bool setPixmap(Params const & params) override;
 
/// Clip the image using params.
bool clip(Params const & params);
diff --git a/src/frontends/qt/GuiPainter.h b/src/frontends/qt/GuiPainter.h
index 2e2a7f2..bffcd9a 100644
--- a/src/frontends/qt/GuiPainter.h
+++ b/src/frontends/qt/GuiPainter.h
@@ -36,15 +36,15 @@ public:
virtual ~GuiPainter();
 
/// This painter paints
-   virtual bool isNull() const { return false; }
+   bool isNull() const override { return false; }
 
/// draw a line

[LyX/master] amend 2c6537ff for C++11 compatibility

2020-11-20 Thread Thibaut Cuvelier
commit 2bbfc726c4840f491c8299101143cecd107948c2
Author: Thibaut Cuvelier 
Date:   Fri Nov 20 21:59:22 2020 +0100

amend 2c6537ff for C++11 compatibility
---
 src/output_docbook.cpp |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index df27a64..95d6aaa 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -805,7 +805,9 @@ std::set 
gatherInfo(ParagraphList::const_iterator par)
} else {
auto subpar = inset->paragraphs().begin();
while (subpar != inset->paragraphs().end()) {
-   values.merge(gatherInfo(subpar));
+   auto subinfos = gatherInfo(subpar);
+   for (auto & subinfo: subinfos)
+   values.insert(subinfo);
++subpar;
}
}
@@ -905,7 +907,9 @@ void outputDocBookInfo(
auto oldPar = paragraphs.iterator_at(p);
auto newPar = makeAny(text, buf, xs2, rp, 
oldPar);
 
-   infoInsets.merge(gatherInfo(oldPar));
+   auto subinfos = gatherInfo(oldPar);
+   for (auto & subinfo: subinfos)
+   infoInsets.insert(subinfo);
 
// Insert the indices of all the paragraphs 
that were just generated (typically, one).
// **Make the hypothesis that, when an abstract 
has a list, all its items are consecutive.**
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] DocBook: ensure that -related insets in the abstract are not generated in the abstract.

2020-11-20 Thread Thibaut Cuvelier
commit 2c6537ff6635cb7e023b284be16705ea2ff87a10
Author: Thibaut Cuvelier 
Date:   Wed Nov 18 01:51:05 2020 +0100

DocBook: ensure that -related insets in the abstract are not 
generated in the abstract.

This helps generate more conformant DocBook files.

Also implement wrapper tags for InsetText.
---
 autotests/export/docbook/svglo.lyx |  215 
 autotests/export/docbook/svglo.xml |   19 +++
 lib/layouts/svglobal3.layout   |5 +
 src/OutputParams.h |3 +
 src/Paragraph.cpp  |2 +-
 src/insets/InsetLayout.cpp |   22 +++-
 src/insets/InsetLayout.h   |4 +
 src/insets/InsetText.cpp   |   37 +--
 src/output_docbook.cpp |  135 +++
 9 files changed, 381 insertions(+), 61 deletions(-)

diff --git a/autotests/export/docbook/svglo.lyx 
b/autotests/export/docbook/svglo.lyx
new file mode 100644
index 000..397f144
--- /dev/null
+++ b/autotests/export/docbook/svglo.lyx
@@ -0,0 +1,215 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 599
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass svglobal3
+\begin_preamble
+\RequirePackage{fix-cm}
+
+\smartqed  % flush right qed marks, e.g. at end of proof
+\end_preamble
+\use_default_options true
+\maintain_unincluded_children no
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "default" "default"
+\font_sans "default" "default"
+\font_typewriter "default" "default"
+\font_math "auto" "auto"
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_roman_osf false
+\font_sans_osf false
+\font_typewriter_osf false
+\font_sf_scale 100 100
+\font_tt_scale 100 100
+\use_microtype false
+\use_dash_ligatures false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command bibtex
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package cancel 1
+\use_package esint 1
+\use_package mathdots 1
+\use_package mathtools 1
+\use_package mhchem 1
+\use_package stackrel 1
+\use_package stmaryrd 1
+\use_package undertilde 1
+\cite_engine basic
+\cite_engine_type default
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\use_lineno 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\is_math_indent 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tablestyle default
+\tracking_changes false
+\output_changes false
+\change_bars false
+\postpone_fragile_content false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\docbook_table_output 0
+\end_header
+
+\begin_body
+
+\begin_layout Title
+Title
+\end_layout
+
+\begin_layout Abstract
+Abstract text.
+ 
+\begin_inset Flex Keywords
+status open
+
+\begin_layout Plain Layout
+First keyword 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+Second keyword 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+More
+\end_layout
+
+\end_inset
+
+ 
+\begin_inset Flex PACS
+status open
+
+\begin_layout Plain Layout
+PACS code1 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+PACS code2 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+more
+\end_layout
+
+\end_inset
+
+ 
+\begin_inset Flex Subclass
+status open
+
+\begin_layout Plain Layout
+MSC code1 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+MSC code2 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+and 
+\end_layout
+
+\end_inset
+
+more
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Your text comes here.
+ Separate text sections with
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/svglo.xml 
b/autotests/export/docbook/svglo.xml
new file mode 100644
index 000..9615ca9
--- /dev/null
+++ b/autotests/export/docbook/svglo.xml
@@ -0,0 +1,19 @@
+
+
+http://docbook.org/ns/docbook"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:m="http://www.w3.org/1998/Math/MathML"; 
xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2">
+
+Title
+PACS code1 
+PACS code2 
+moreMSC code1 
+MSC code2 
+moreFirst keyword 
+Second keyword 
+More
+Abstract text.   
+
+
+
+Your text comes here. Separate text secti

[LyX/master] DocBook: InsetText supports items and wrappers.

2020-11-20 Thread Thibaut Cuvelier
commit f426e458c4b0167c32abf4198d676fcd072b14ca
Author: Thibaut Cuvelier 
Date:   Wed Nov 18 04:34:58 2020 +0100

DocBook: InsetText supports items and wrappers.
---
 autotests/export/docbook/svglo.lyx |2 +-
 autotests/export/docbook/svglo.xml |8 ++--
 lib/layouts/stdinsets.inc  |1 +
 lib/layouts/svglobal3.layout   |   36 ++---
 src/insets/InsetERT.cpp|5 +++
 src/insets/InsetLayout.cpp |   62 
 src/insets/InsetLayout.h   |   32 --
 src/insets/InsetText.cpp   |   12 +++
 8 files changed, 137 insertions(+), 21 deletions(-)

diff --git a/autotests/export/docbook/svglo.lyx 
b/autotests/export/docbook/svglo.lyx
index 397f144..8ffc7f9 100644
--- a/autotests/export/docbook/svglo.lyx
+++ b/autotests/export/docbook/svglo.lyx
@@ -208,7 +208,7 @@ more
 
 \begin_layout Standard
 Your text comes here.
- Separate text sections with
+ 
 \end_layout
 
 \end_body
diff --git a/autotests/export/docbook/svglo.xml 
b/autotests/export/docbook/svglo.xml
index 9615ca9..47c242a 100644
--- a/autotests/export/docbook/svglo.xml
+++ b/autotests/export/docbook/svglo.xml
@@ -4,16 +4,16 @@
 http://docbook.org/ns/docbook"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:m="http://www.w3.org/1998/Math/MathML"; 
xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2">
 
 Title
-PACS code1 
+PACS code1 
 PACS code2 
-moreMSC code1 
+moreMSC code1 
 MSC code2 
-moreFirst keyword 
+moreFirst keyword 

 Second keyword 
 More
 Abstract text.   
 
 
 
-Your text comes here. Separate text sections with
+Your text comes here. 
 
\ No newline at end of file
diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index 1147fa5..2a842ab 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -89,6 +89,7 @@ InsetLayout Foot
AddToToc  footnote
IsTocCaption  true
DocBookTagfootnote
+   DocBookTagTypeinline
 End
 
 InsetLayout Foot:InTitle
diff --git a/lib/layouts/svglobal3.layout b/lib/layouts/svglobal3.layout
index 7a9083a..3e9503d 100644
--- a/lib/layouts/svglobal3.layout
+++ b/lib/layouts/svglobal3.layout
@@ -72,10 +72,14 @@ InsetLayout Flex:PACS
CopyStyle   Flex:Keywords
LatexName   PACS
LabelString "PACS"
-   DocBookTag  subject
-   DocBookTagType  paragraph
-   DocBookWrapperTag   subjectset
-   DocBookWrapperAttr  role='pacs'
+   DocBookTag  subjectset
+   DocBookAttr role='pacs'
+   DocBookItemWrapperTag  subject
+   DocBookItemWrapperTagType  paragraph
+   DocBookItemTag  subjectterm
+   DocBookItemTagType  inline
+   DocBookWrapperTag   NONE
+   DocBookWrapperAttr  ""
DocBookInInfo   always
 End
 
@@ -83,10 +87,14 @@ InsetLayout Flex:Subclass
CopyStyle   Flex:Keywords
LatexName   subclass
LabelString "Mathematics Subject Classification"
-   DocBookTag  subject
-   DocBookTagType  paragraph
-   DocBookWrapperTag   subjectset
-   DocBookWrapperAttr  role='mcs'
+   DocBookTag  subjectset
+   DocBookAttr role='mcs'
+   DocBookItemWrapperTag  subject
+   DocBookItemWrapperTagType  paragraph
+   DocBookItemTag  subjectterm
+   DocBookItemTagType  inline
+   DocBookWrapperTag   NONE
+   DocBookWrapperAttr  ""
DocBookInInfo   always
 End
 
@@ -94,10 +102,14 @@ InsetLayout Flex:CRSC
CopyStyle   Flex:PACS
LatexName   CRclass
LabelString "CR Subject Classification"
-   DocBookTag  subject
-   DocBookTagType  paragraph
-   DocBookWrapperTag   subjectset
-   DocBookWrapperAttr  role='crsc'
+   DocBookTag  subjectset
+   DocBookAttr role='crsc'
+   DocBookItemWrapperTag  subject
+   DocBookItemWrapperTagType  paragraph
+   DocBookItemTag  subjectterm
+   DocBookItemTagType  inline
+   DocBookWrapperTag   NONE
+   DocBookWrapperAttr  ""
DocBookInInfo   always
 End
 
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index 1af67e1..e86724d 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -122,6 +122,11 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const 
& runparams) const
break;
}
 
+// // Implement the special case of \and: split the current item.
+// if (os.str() == "\\and" || os.str() == "\\and ") {
+// auto lay = getLayout();
+// }
+
// Output the ERT as a comment with the appropriate escaping.
xs << XMLStream::ESCAPE_NONE << "

[LyX/master] XML: move higher-level tag-opening and closing functions to xml namespace.

2020-11-20 Thread Thibaut Cuvelier
commit 3a02251bfa44a769d80838f77f00f9b7f31cd64d
Author: Thibaut Cuvelier 
Date:   Wed Nov 18 05:38:25 2020 +0100

XML: move higher-level tag-opening and closing functions to xml namespace.
---
 src/output_docbook.cpp |  178 ++--
 src/xml.cpp|  142 ++
 src/xml.h  |   44 
 3 files changed, 222 insertions(+), 142 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 76d1cdc..df27a64 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -167,116 +167,6 @@ string fontToAttribute(xml::FontTypes type) {
 }
 
 
-// Convenience functions to open and close tags. First, very low-level ones to 
ensure a consistent new-line behaviour.
-// Block style:
-//   Content before
-//   
-// Contents of the block.
-//   
-//   Content after
-// Paragraph style:
-//   Content before
-// Contents of the paragraph.
-//   Content after
-// Inline style:
-//Content beforeContents of the paragraph.Content 
after
-
-void openInlineTag(XMLStream & xs, const std::string & tag, const std::string 
& attr)
-{
-   xs << xml::StartTag(tag, attr);
-}
-
-
-void closeInlineTag(XMLStream & xs, const std::string & tag)
-{
-   xs << xml::EndTag(tag);
-}
-
-
-void openParTag(XMLStream & xs, const std::string & tag, const std::string & 
attr)
-{
-   if (!xs.isLastTagCR())
-   xs << xml::CR();
-   xs << xml::StartTag(tag, attr);
-}
-
-
-void closeParTag(XMLStream & xs, const std::string & tag)
-{
-   xs << xml::EndTag(tag);
-   xs << xml::CR();
-}
-
-
-void openBlockTag(XMLStream & xs, const std::string & tag, const std::string & 
attr)
-{
-   if (!xs.isLastTagCR())
-   xs << xml::CR();
-   xs << xml::StartTag(tag, attr);
-   xs << xml::CR();
-}
-
-
-void closeBlockTag(XMLStream & xs, const std::string & tag)
-{
-   if (!xs.isLastTagCR())
-   xs << xml::CR();
-   xs << xml::EndTag(tag);
-   xs << xml::CR();
-}
-
-
-void openTag(XMLStream & xs, const std::string & tag, const std::string & 
attr, const std::string & tagtype)
-{
-   if (tag.empty() || tag == "NONE") // Common check to be performed 
elsewhere, if it was not here.
-   return;
-
-   if (tag == "para" || tagtype == "paragraph") // Special case for 
: always considered as a paragraph.
-   openParTag(xs, tag, attr);
-   else if (tagtype == "block")
-   openBlockTag(xs, tag, attr);
-   else if (tagtype == "inline")
-   openInlineTag(xs, tag, attr);
-   else
-   xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + 
tag + " " + attr + "'");
-}
-
-
-void closeTag(XMLStream & xs, const std::string & tag, const std::string & 
tagtype)
-{
-   if (tag.empty() || tag == "NONE")
-   return;
-
-   if (tag == "para" || tagtype == "paragraph") // Special case for 
: always considered as a paragraph.
-   closeParTag(xs, tag);
-   else if (tagtype == "block")
-   closeBlockTag(xs, tag);
-   else if (tagtype == "inline")
-   closeInlineTag(xs, tag);
-   else
-   xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + 
tag + "'");
-}
-
-
-void compTag(XMLStream & xs, const std::string & tag, const std::string & 
attr, const std::string & tagtype)
-{
-   if (tag.empty() || tag == "NONE")
-   return;
-
-   // Special case for : always considered as a paragraph.
-   if (tag == "para" || tagtype == "paragraph" || tagtype == "block") {
-   if (!xs.isLastTagCR())
-   xs << xml::CR();
-   xs << xml::CompTag(tag, attr);
-   xs << xml::CR();
-   } else if (tagtype == "inline") {
-   xs << xml::CompTag(tag, attr);
-   } else {
-   xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + 
tag + "'");
-   }
-}
-
-
 // Higher-level convenience functions.
 
 void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * 
prevpar)
@@ -305,7 +195,7 @@ void openParTag(XMLStream & xs, const Paragraph * par, 
const Paragraph * prevpar
 
// Main logic.
if (openWrapper)
-   openTag(xs, lay.docbookwrappertag(), lay.docbookwrapperattr(), 
lay.docbookwrappertagtype());
+   xml::openTag(xs, lay.docbookwrappertag(), 
lay.docbookwrapperattr(), lay.docbookwrappertagtype());
 
const string & tag = lay.docbooktag();
if (tag != "NONE") {
@@ -313,13 +203,13 @@ void openParTag(XMLStream & xs, const Paragraph * par, 
const Paragraph * prevpar
if (!xs.isTagOpen(xmltag, 1)) { // Don't nest a paragraph 
directly in a paragraph.
// TODO: required or not?
// TODO: avoid creating a ParTag object just for this 
query...
- 

[LyX/master] DocBook: make InsetText respect tag types.

2020-11-20 Thread Thibaut Cuvelier
commit 1176fab1d479b21a2cc0d165cf341c99ad0661c1
Author: Thibaut Cuvelier 
Date:   Wed Nov 18 05:54:08 2020 +0100

DocBook: make InsetText respect tag types.
---
 autotests/export/docbook/svglo.xml  |   19 ++-
 development/autotests/invertedTests |1 +
 lib/layouts/svglobal3.layout|3 +++
 src/insets/InsetText.cpp|   16 
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/autotests/export/docbook/svglo.xml 
b/autotests/export/docbook/svglo.xml
index 47c242a..c7d3a40 100644
--- a/autotests/export/docbook/svglo.xml
+++ b/autotests/export/docbook/svglo.xml
@@ -4,13 +4,22 @@
 http://docbook.org/ns/docbook"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:m="http://www.w3.org/1998/Math/MathML"; 
xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2">
 
 Title
-PACS code1 
+
+PACS code1 
 PACS code2 
-moreMSC code1 
-MSC code2 
-moreFirst keyword 

+more
+
+
+First keyword 
 Second keyword 
-More
+More
+
+
+MSC code1 
+MSC code2 
+more
+
+
 Abstract text.   
 
 
diff --git a/development/autotests/invertedTests 
b/development/autotests/invertedTests
index 754bea3..fe3aad4 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -443,6 +443,7 @@ 
export/examples/Articles/American_Astronomical_Society_%28AASTeX_v._6.2%29_docbo
 #   - Springer. (The svmono_light should still pass.)
 export/templates/Books/Springer.*/.*_docbook5
 !export/export/docbook/svmono_light_docbook5
+!export/export/docbook/svglo_docbook5
 export/export/docbook/sv.*_docbook5
 #   - scrbook with too many customisations.
 export/templates/Theses/PhD_Thesis/.*_docbook5
diff --git a/lib/layouts/svglobal3.layout b/lib/layouts/svglobal3.layout
index 3e9503d..25d146a 100644
--- a/lib/layouts/svglobal3.layout
+++ b/lib/layouts/svglobal3.layout
@@ -74,6 +74,7 @@ InsetLayout Flex:PACS
LabelString "PACS"
DocBookTag  subjectset
DocBookAttr role='pacs'
+   DocBookTagType  block
DocBookItemWrapperTag  subject
DocBookItemWrapperTagType  paragraph
DocBookItemTag  subjectterm
@@ -89,6 +90,7 @@ InsetLayout Flex:Subclass
LabelString "Mathematics Subject Classification"
DocBookTag  subjectset
DocBookAttr role='mcs'
+   DocBookTagType  block
DocBookItemWrapperTag  subject
DocBookItemWrapperTagType  paragraph
DocBookItemTag  subjectterm
@@ -104,6 +106,7 @@ InsetLayout Flex:CRSC
LabelString "CR Subject Classification"
DocBookTag  subjectset
DocBookAttr role='crsc'
+   DocBookTagType  block
DocBookItemWrapperTag  subject
DocBookItemWrapperTagType  paragraph
DocBookItemTag  subjectterm
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index d33a43b..fe3d160 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -625,7 +625,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const 
& rp, XHTMLOptions op
// Start outputting this inset.
if (opts & WriteOuterTag) {
if (!il.docbookwrappertag().empty() && il.docbookwrappertag() 
!= "NONE" && il.docbookwrappertag() != "IGNORE")
-   xs << xml::StartTag(il.docbookwrappertag(), 
il.docbookwrapperattr());
+   xml::openTag(xs, il.docbookwrappertag(), 
il.docbookwrapperattr(), il.docbookwrappertagtype());
 
if (!il.docbooktag().empty() && il.docbooktag() != "NONE" && 
il.docbooktag() != "IGNORE") {
docstring attrs = docstring();
@@ -633,14 +633,14 @@ void InsetText::docbook(XMLStream & xs, OutputParams 
const & rp, XHTMLOptions op
attrs += from_ascii(il.docbookattr());
if (il.docbooktag() == "link")
attrs += from_ascii(" xlink:href=\"") + 
text_.asString() + from_ascii("\"");
-   xs << xml::StartTag(il.docbooktag(), attrs);
+   xml::openTag(xs, il.docbooktag(), attrs, 
il.docbooktagtype());
}
 
if (!il.docbookitemwrappertag().empty() && 
il.docbookitemwrappertag() != "NONE" && il.docbookitemwrappertag() != "IGNORE")
-   xs << xml::StartTag(il.docbookitemwrappertag(), 
il.docbookitemwrapperattr());
+   xml::openTag(xs, il.docbookitemwrappertag(), 
il.docbookitemwrapperattr(), il.docbookitemwrappertagtype());
 
if (!il.docbookitemtag().empty() && il.docbookitemtag() != 
"NONE" && il.docbookitemtag() != "IGNORE")
-   xs << xml::StartTag(il.docbookitemtag(), 
il.docbookitemattr());
+   xml::openTag(xs, il.docbookitemtag(), 
il.docbookitemattr(), il.docbookitemtagtype());
}
 
// No need for labels that are generated from counters. They should be 
handled by 

[LyX/master] XML: add tag-type information in XML tags. It is not yet used.

2020-11-20 Thread Thibaut Cuvelier
commit 0fe3d05344c3680c090c6a57a776ef7a49d4ab2b
Author: Thibaut Cuvelier 
Date:   Wed Nov 18 05:29:26 2020 +0100

XML: add tag-type information in XML tags. It is not yet used.
---
 src/mathed/InsetMathHull.cpp |6 ++--
 src/xml.h|   48 -
 2 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 6c0d2cf..91b3c6d 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2663,9 +2663,9 @@ docstring InsetMathHull::xhtml(XMLStream & xs, 
OutputParams const & op) const
string const tag = (getType() == hullSimple) ? "span" : 
"div";
xs << xml::CR()
   << xml::StartTag(tag, "style = \"text-align: 
center;\"")
-<< xml::CompTag("img", "src=\"" + filename + 
"\" alt=\"Mathematical Equation\"")
-<< xml::EndTag(tag)
-<< xml::CR();
+  << xml::CompTag("img", "src=\"" + filename + "\" 
alt=\"Mathematical Equation\"")
+  << xml::EndTag(tag)
+  << xml::CR();
success = true;
}
}
diff --git a/src/xml.h b/src/xml.h
index 4fa19aa..6da53ad 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -174,23 +174,23 @@ struct EndFontTag;
 struct StartTag
 {
///
-   explicit StartTag(std::string const & tag) : tag_(from_ascii(tag)), 
keepempty_(false) {}
+   explicit StartTag(std::string const & tag) : tag_(from_ascii(tag)), 
keepempty_(false), tagtype_("none") {}
///
-   explicit StartTag(docstring const & tag) : tag_(tag), keepempty_(false) 
{}
+   explicit StartTag(docstring const & tag) : tag_(tag), 
keepempty_(false), tagtype_("none") {}
///
explicit StartTag(docstring const & tag, docstring const & attr,
- bool keepempty = false)
-   : tag_(tag), attr_(attr), keepempty_(keepempty) {}
+ bool keepempty = false, std::string 
const & tagtype = "none")
+   : tag_(tag), attr_(attr), keepempty_(keepempty), 
tagtype_(tagtype) {}
///
explicit StartTag(std::string const & tag, std::string const & attr,
- bool keepempty = false)
-   : tag_(from_ascii(tag)), attr_(from_utf8(attr)), 
keepempty_(keepempty) {}
+ bool keepempty = false, std::string 
const & tagtype = "none")
+   : tag_(from_ascii(tag)), attr_(from_utf8(attr)), 
keepempty_(keepempty), tagtype_(tagtype) {}
///
explicit StartTag(std::string const & tag, docstring const & attr,
- bool keepempty = false)
-   : tag_(from_ascii(tag)), attr_(attr), 
keepempty_(keepempty) {}
+ bool keepempty = false, std::string 
const & tagtype = "none")
+   : tag_(from_ascii(tag)), attr_(attr), 
keepempty_(keepempty), tagtype_(tagtype) {}
///
-   virtual ~StartTag() {}
+   virtual ~StartTag() = default;
/// 
virtual docstring writeTag() const;
/// 
@@ -212,6 +212,8 @@ struct StartTag
/// whether to keep things like "" or discard them
/// you would want this for td, e.g, but maybe not for a div
bool keepempty_;
+   /// Type of tag for new-line behaviour. Either "paragraph", "inline", 
"block", or "none" (default).
+   std::string tagtype_;
 };
 
 
@@ -219,11 +221,13 @@ struct StartTag
 struct EndTag
 {
///
-   explicit EndTag(std::string const & tag) : tag_(from_ascii(tag)) {}
+   explicit EndTag(std::string const & tag, std::string const & tagtype = 
"none")
+   : tag_(from_ascii(tag)), tagtype_(tagtype) {}
///
-   explicit EndTag(docstring const & tag) : tag_(tag) {}
+   explicit EndTag(docstring const & tag, std::string const & tagtype = 
"none")
+   : tag_(tag), tagtype_(tagtype) {}
///
-   virtual ~EndTag() {}
+   virtual ~EndTag() = default;
/// 
virtual docstring writeEndTag() const;
///
@@ -233,9 +237,12 @@ struct EndTag
bool operator!=(StartTag const & rhs) const
{ return !(*this == rhs); }
///
-   virtual EndFontTag const * asFontTag() const { return 0; }
+   virtual EndFontTag const * asFontTag() const { return nullptr; }
///
docstring tag_;
+   /// Type of tag for new-line behaviour. Either "paragraph", "inline", 
"block", or "none" (default).
+   /// The value should match that of the corresponding xml::StartTag.
+   std::string tagtype_;
 };
 
 
@@ -246,30 +253,31 @@ struct CompTag
 {
///
   

[LyX/master] Missing '{'

2020-11-20 Thread Kornel Benko
commit 5474c3fb4b565f5c5ac1268d2f902afce22f7e88
Author: Kornel Benko 
Date:   Fri Nov 20 16:32:51 2020 +0100

Missing '{'
---
 src/frontends/qt/GuiView.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 4298fd1..8753a63 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4900,7 +4900,7 @@ void GuiView::hideAll() const
 
 void GuiView::updateDialogs()
 {
-   for(auto const & dlg_p : d.dialogs_)
+   for(auto const & dlg_p : d.dialogs_) {
Dialog * dialog = dlg_p.second.get();
if (dialog) {
if (dialog->needBufferOpen() && !documentBufferView())
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Use range-based loops in GuiView

2020-11-20 Thread Jean-Marc Lasgouttes
commit d8e8a93a582a6dc4bcee1112e7fe7e4f1ace5542
Author: Jean-Marc Lasgouttes 
Date:   Fri Nov 20 15:04:59 2020 +0100

Use range-based loops in GuiView
---
 src/frontends/qt/GuiView.cpp |  102 +++--
 1 files changed, 37 insertions(+), 65 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 0b3999d..4298fd1 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -207,9 +207,9 @@ public:
int wline = 0;
int hline = fm.maxHeight();
QStringList::const_iterator sit;
-   for (sit = titlesegs.constBegin(); sit != titlesegs.constEnd(); 
++sit) {
-   if (fm.width(*sit) > wline)
-   wline = fm.width(*sit);
+   for (QString const & seg : titlesegs) {
+   if (fm.width(seg) > wline)
+   wline = fm.width(seg);
}
// The longest line in the reference font (for English)
// is 180. Calculate scale factor from that.
@@ -831,13 +831,11 @@ void GuiView::saveUISettings() const
QSettings settings;
 
// Save the toolbar private states
-   ToolbarMap::iterator end = d.toolbars_.end();
-   for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
-   it->second->saveSession(settings);
+   for (auto const & tb_p : d.toolbars_)
+   tb_p.second->saveSession(settings);
// Now take care of all other dialogs
-   map::const_iterator it = d.dialogs_.begin();
-   for (; it!= d.dialogs_.end(); ++it)
-   it->second->saveSession(settings);
+   for (auto const & dlg_p : d.dialogs_)
+   dlg_p.second->saveSession(settings);
 }
 
 
@@ -892,12 +890,10 @@ bool GuiView::restoreLayout()
initToolbars();
 
// init the toolbars that have not been restored
-   Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
-   Toolbars::Infos::iterator end = guiApp->toolbars().end();
-   for (; cit != end; ++cit) {
-   GuiToolbar * tb = toolbar(cit->name);
+   for (auto const & tb_p : guiApp->toolbars()) {
+   GuiToolbar * tb = toolbar(tb_p.name);
if (tb && !tb->isRestored())
-   initToolbar(cit->name);
+   initToolbar(tb_p.name);
}
 
// update lock (all) toolbars positions
@@ -932,9 +928,8 @@ void GuiView::updateLockToolbars()
 
 void GuiView::constructToolbars()
 {
-   ToolbarMap::iterator it = d.toolbars_.begin();
-   for (; it != d.toolbars_.end(); ++it)
-   delete it->second;
+   for (auto const & tb_p : d.toolbars_)
+   delete tb_p.second;
d.toolbars_.clear();
 
// I don't like doing this here, but the standard toolbar
@@ -944,20 +939,16 @@ void GuiView::constructToolbars()
d.layout_->move(0,0);
 
// extracts the toolbars from the backend
-   Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
-   Toolbars::Infos::iterator end = guiApp->toolbars().end();
-   for (; cit != end; ++cit)
-   d.toolbars_[cit->name] =  new GuiToolbar(*cit, *this);
+   for (ToolbarInfo const & inf : guiApp->toolbars())
+   d.toolbars_[inf.name] =  new GuiToolbar(inf, *this);
 }
 
 
 void GuiView::initToolbars()
 {
// extracts the toolbars from the backend
-   Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
-   Toolbars::Infos::iterator end = guiApp->toolbars().end();
-   for (; cit != end; ++cit)
-   initToolbar(cit->name);
+   for (ToolbarInfo const & inf : guiApp->toolbars())
+   initToolbar(inf.name);
 }
 
 
@@ -1169,12 +1160,9 @@ void GuiView::dropEvent(QDropEvent * event)
vector found_formats;
 
// Find all formats that have the correct extension.
-   vector const & import_formats
-   = theConverters().importableFormats();
-   vector::const_iterator it = 
import_formats.begin();
-   for (; it != import_formats.end(); ++it)
-   if ((*it)->hasExtension(ext))
-   found_formats.push_back(*it);
+   for (const Format * fmt : theConverters().importableFormats())
+   if (fmt->hasExtension(ext))
+   found_formats.push_back(fmt);
 
FuncRequest cmd;
if (!found_formats.empty()) {
@@ -1405,10 +1393,9 @@ bool GuiView::event(QEvent * e)
if (lyxrc.full_screen_menubar)
menuBar()->hide();
if (lyxrc.full_screen_toolbars) {
-   ToolbarMap::iterator end = d.toolbars_.end();
-   for (ToolbarMap::iterator it = 
d.t

[LyX/master] Typo

2020-11-20 Thread Yuriy Skalko
commit b56a64a8ef56625e1e9fe2ba9c3fc27e79d70af3
Author: Yuriy Skalko 
Date:   Tue Nov 17 20:03:04 2020 +0200

Typo
---
 src/mathed/InsetMathMacro.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathMacro.h b/src/mathed/InsetMathMacro.h
index 38afcf0..794819a 100644
--- a/src/mathed/InsetMathMacro.h
+++ b/src/mathed/InsetMathMacro.h
@@ -159,7 +159,7 @@ public:
/// This is not used for display; however whether it is mathrel 
determines
/// how to split equations intelligently.
MathClass mathClass() const override;
-   /// Override so as to set Buffer for defnition_ member, too.
+   /// Override so as to set Buffer for definition_ member, too.
void setBuffer(Buffer &) override;
 
 protected:
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Simplify constructors

2020-11-20 Thread Yuriy Skalko
commit f953d88c886c39b5075bb271d564b2c9de0c68f9
Author: Yuriy Skalko 
Date:   Thu Nov 19 13:24:04 2020 +0200

Simplify constructors
---
 src/Dimension.h|   28 +++-
 src/graphics/PreviewLoader.cpp |2 +-
 src/mathed/MathData.cpp|3 +--
 src/mathed/MathData.h  |   15 ---
 src/mathed/MathStream.cpp  |7 ++-
 src/mathed/MathStream.h|   34 +-
 6 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/src/Dimension.h b/src/Dimension.h
index 0f7fdab..802b3bb 100644
--- a/src/Dimension.h
+++ b/src/Dimension.h
@@ -18,16 +18,12 @@ namespace lyx {
 class Dimension {
 public:
/// constructor
-   Dimension() : wid(0), asc(0), des(0) {}
+   Dimension() = default;
/// initialize data
Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
+   ///
+   Dimension & operator=(Dimension const & dim) = default;
 
-   Dimension & operator=(Dimension const & dim) {
-   wid = dim.wid;
-   asc = dim.asc;
-   des = dim.des;
-   return *this;
-   }
/// glue horizontally
void operator+=(Dimension const & dim);
/// set to empty box
@@ -59,35 +55,33 @@ public:
///
/// makes the code neither faster nor clearer
/// width
-   int wid;
+   int wid = 0;
/// ascent
-   int asc;
+   int asc = 0;
/// descent
-   int des;
+   int des = 0;
 };
 
 inline
 bool operator==(Dimension const & a, Dimension const & b)
 {
-   return a.wid == b.wid && a.asc == b.asc && a.des == b.des ;
+   return a.wid == b.wid && a.asc == b.asc && a.des == b.des;
 }
 
 
 inline
 bool operator!=(Dimension const & a, Dimension const & b)
 {
-   return a.wid != b.wid || a.asc != b.asc || a.des != b.des ;
+   return !(a == b);
 }
 
 class Point {
 public:
-   Point()
-   : x_(0), y_(0)
-   {}
-
+   Point() = default;
Point(int x, int y);
 
-   int x_, y_;
+   int x_ = 0;
+   int y_ = 0;
 };
 
 } // namespace lyx
diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index f9c0ba9..a7e37f3 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -631,7 +631,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
 
// Set \jobname of previews to the document name (see bug 9627)
of << "\\def\\jobname{"
-  << from_utf8(changeExtension(buffer_.latexName(true), ""))
+  << from_utf8(changeExtension(buffer_.latexName(), ""))
   << "}\n";
 
LYXERR(Debug::LATEX, "Format = " << 
buffer_.params().getDefaultOutputFormat());
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 39d5f80..5372430 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -47,8 +47,7 @@ namespace lyx {
 
 
 MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
-   : base_type(from, to), minasc_(0), mindes_(0), slevel_(0),
- sshift_(0), buffer_(buf)
+   : base_type(from, to), buffer_(buf)
 {}
 
 
diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h
index 3474980..81d6cfc 100644
--- a/src/mathed/MathData.h
+++ b/src/mathed/MathData.h
@@ -68,8 +68,9 @@ public:
 
 public:
///
-   explicit MathData(Buffer * buf = 0) : minasc_(0), mindes_(0), 
slevel_(0),
-sshift_(0), buffer_(buf) {}
+   MathData() = default;
+   ///
+   explicit MathData(Buffer * buf) : buffer_(buf) {}
///
MathData(Buffer * buf, const_iterator from, const_iterator to);
///
@@ -186,11 +187,11 @@ public:
 
 protected:
/// cached values for super/subscript placement
-   mutable int minasc_;
-   mutable int mindes_;
-   mutable int slevel_;
-   mutable int sshift_;
-   Buffer * buffer_;
+   mutable int minasc_ = 0;
+   mutable int mindes_ = 0;
+   mutable int slevel_ = 0;
+   mutable int sshift_ = 0;
+   Buffer * buffer_ = nullptr;
 
 private:
/// is this an exact match at this position?
diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp
index 2f25ce6..588e219 100644
--- a/src/mathed/MathStream.cpp
+++ b/src/mathed/MathStream.cpp
@@ -126,11 +126,8 @@ WriteStream & operator<<(WriteStream & ws, docstring const 
& s)
 
 WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
 OutputType output, Encoding 
const * encoding)
-   : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
- output_(output), pendingspace_(false), pendingbrace_(false),
- textmode_(false), locked_(false), ascii_(false), canbreakline_(true),
- mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
- row_entry_(TexRow::row_none), mathclass_(false)
+   : os_(os), fragile_(fra

[LyX/master] Revert "Limit the -Wall flag to C++ compiler"

2020-11-20 Thread Jean-Marc Lasgouttes
commit ff1ab048f10895c5106469c6b63fe78a290402d8
Author: Jean-Marc Lasgouttes 
Date:   Fri Nov 20 14:38:06 2020 +0100

Revert "Limit the -Wall flag to C++ compiler"

Something is fishy, it breaks compilation.

This reverts commit cbc9a901afd1783a30b4d76663208b0c13530a30.
---
 config/lyxinclude.m4 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index cf58df7..268c501 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -418,7 +418,7 @@ if test x$GXX = xyes; then
   fi
   dnl Warnings are for preprocessor too
   if test x$enable_warnings = xyes ; then
-  AM_CXXFLAGS="$AM_CPPFLAGS -Wall -Wextra"
+  AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra"
   dnl Shut off warning -Wdeprecated-copy, which triggers too much
   dnl note that g++ always accepts -Wno-xxx, even when -Wxxx is an error.
   AC_LANG_PUSH(C++)
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Do not set language from keyboard in passthru setting

2020-11-20 Thread Jean-Marc Lasgouttes
commit a877cdb1963f01d27b4bd0d194de928223cb5ae5
Author: Jean-Marc Lasgouttes 
Date:   Wed Oct 21 18:08:39 2020 +0200

Do not set language from keyboard in passthru setting
---
 src/Cursor.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 39083e5..ee54ace 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -2399,7 +2399,9 @@ bool notifyCursorLeavesOrEnters(Cursor const & old, 
Cursor & cur)
 
 void Cursor::setLanguageFromInput()
 {
-   if (!lyxrc.respect_os_kbd_language)
+   if (!lyxrc.respect_os_kbd_language
+   || !inTexted()
+   || paragraph().isPassThru())
return;
string const & code = theApp()->inputLanguageCode();
Language const * lang = languages.getFromCode(code, 
buffer()->getLanguages());
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Limit the -Wall flag to C++ compiler

2020-11-20 Thread Jean-Marc Lasgouttes
commit cbc9a901afd1783a30b4d76663208b0c13530a30
Author: Jean-Marc Lasgouttes 
Date:   Fri Nov 20 13:41:45 2020 +0100

Limit the -Wall flag to C++ compiler

This avoids tons of warning when compiling code, like libiconv, which is
not prepared to this kind of scrutiny of its code quality...
---
 config/lyxinclude.m4 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index 268c501..cf58df7 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -418,7 +418,7 @@ if test x$GXX = xyes; then
   fi
   dnl Warnings are for preprocessor too
   if test x$enable_warnings = xyes ; then
-  AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra"
+  AM_CXXFLAGS="$AM_CPPFLAGS -Wall -Wextra"
   dnl Shut off warning -Wdeprecated-copy, which triggers too much
   dnl note that g++ always accepts -Wno-xxx, even when -Wxxx is an error.
   AC_LANG_PUSH(C++)
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs