[LyX/master] Simplify InsetMathGrid structs

Yuriy Skalko yuriy.skalko at gmail.com
Wed Dec 2 22:09:57 UTC 2020


commit efaffb897d44258182739a2cc27ac4f6325af9f3
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date:   Wed Dec 2 14:45:14 2020 +0200

    Simplify InsetMathGrid structs
---
 src/mathed/InsetMathGrid.cpp |   26 --------------------------
 src/mathed/InsetMathGrid.h   |   37 ++++++++++++++-----------------------
 2 files changed, 14 insertions(+), 49 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 7158df2..260d61e 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -78,41 +78,15 @@ static void resetGrid(InsetMathGrid & grid)
 }
 
 
-
-//////////////////////////////////////////////////////////////
-
-
-InsetMathGrid::CellInfo::CellInfo()
-	: multi(CELL_NORMAL)
-{}
-
-
-
 //////////////////////////////////////////////////////////////
 
 
-InsetMathGrid::RowInfo::RowInfo()
-	: descent(0), ascent(0), lines(0), skip(0),
-	  allow_newpage(true)
-{}
-
-
-
 int InsetMathGrid::RowInfo::skipPixels(MetricsInfo const & mi) const
 {
 	return mi.base.inPixels(crskip);
 }
 
 
-
-//////////////////////////////////////////////////////////////
-
-
-InsetMathGrid::ColInfo::ColInfo()
-	: align('c'), width(0), offset(0), lines(0), skip(0)
-{}
-
-
 //////////////////////////////////////////////////////////////
 
 
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index df83449..cf24dcf 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -39,54 +39,45 @@ public:
 	};
 
 	/// additional per-cell information
-	class CellInfo {
-	public:
-		///
-		CellInfo();
+	struct CellInfo {
 		/// multicolumn flag
-		Multicolumn multi;
+		Multicolumn multi = CELL_NORMAL;
 		/// special multi columns alignment
 		docstring align;
 	};
 
 	/// additional per-row information
-	class RowInfo {
-	public:
-		///
-		RowInfo();
+	struct RowInfo {
 		///
 		int skipPixels(MetricsInfo const & mi) const;
 		/// cached descent
-		mutable int descent;
+		mutable int descent = 0;
 		/// cached ascent
-		mutable int ascent;
+		mutable int ascent = 0;
 		/// cached offset for each bufferview
 		mutable std::map<BufferView const *, int> offset;
 		/// how many hlines above this row?
-		unsigned int lines;
+		unsigned int lines = 0;
 		/// parameter to the line break
 		Length crskip;
 		/// extra distance between lines
-		int skip;
+		int skip = 0;
 		/// Is a page break allowed after this row?
-		bool allow_newpage;
+		bool allow_newpage = true;
 	};
 
 	// additional per-row information
-	class ColInfo {
-	public:
-		///
-		ColInfo();
+	struct ColInfo {
 		/// currently possible: 'l', 'c', 'r'
-		char align;
+		char align = 'c';
 		/// cached width
-		mutable int width;
+		mutable int width = 0;
 		/// cached offset
-		mutable int offset;
+		mutable int offset = 0;
 		/// how many lines to the left of this column?
-		unsigned int lines;
+		unsigned int lines = 0;
 		/// additional amount to the right to be skipped when drawing
-		int skip;
+		int skip = 0;
 		/// Special alignment.
 		/// This does also contain align_ and lines_ if it is nonempty.
 		/// It needs to be in sync with align_ and lines_ because some


More information about the lyx-cvs mailing list