[LyX/master] Improve comments

2020-01-14 Thread Juergen Spitzmueller
commit 8bd47bda8c27b0b0fc379a02dba81cdc67c79f70
Author: Juergen Spitzmueller 
Date:   Wed Jan 15 08:40:51 2020 +0100

Improve comments
---
 src/insets/InsetTabular.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 2b23c89..1c4ed5d 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4474,7 +4474,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) 
const
 
idx_type idx = 0;

-   // Save change status
+   // Save tabular change status
Change tab_change = pi.change;
 
int yy = y + tabular.offsetVAlignment();
@@ -4491,8 +4491,9 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) 
const
continue;
}
 
-   // Mark deleted rows/columns
pi.selected |= isCellSelected(cur, r, c);
+
+   // Mark deleted rows/columns
if (tabular.column_info[c].change.changed())
pi.change = tabular.column_info[c].change;
else if (tabular.row_info[r].change.changed())
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Cross out ct-deleted tabular rows/columns in workarea

2020-01-14 Thread Juergen Spitzmueller
commit a940e9d709c16cefca66c473a3ea6f62f39f7565
Author: Juergen Spitzmueller 
Date:   Wed Jan 15 08:37:35 2020 +0100

Cross out ct-deleted tabular rows/columns in workarea
---
 src/insets/InsetTabular.cpp |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index dc8645a..2b23c89 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4473,6 +4473,9 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) 
const
bool const original_selection_state = pi.selected;
 
idx_type idx = 0;
+   
+   // Save change status
+   Change tab_change = pi.change;
 
int yy = y + tabular.offsetVAlignment();
for (row_type r = 0; r < tabular.nrows(); ++r) {
@@ -4488,7 +4491,15 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) 
const
continue;
}
 
+   // Mark deleted rows/columns
pi.selected |= isCellSelected(cur, r, c);
+   if (tabular.column_info[c].change.changed())
+   pi.change = tabular.column_info[c].change;
+   else if (tabular.row_info[r].change.changed())
+   pi.change = tabular.row_info[r].change;
+   else
+   pi.change = tab_change;
+
int const cx = nx + tabular.textHOffset(idx);
int const cy = yy + tabular.textVOffset(idx);
// Cache the Inset position.
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] endl needs ostream header here.

2020-01-14 Thread Pavel Sanda
commit 8c4d6bbba68d0913ae4a7ec3beefea0e9ff4d8ea
Author: Pavel Sanda 
Date:   Tue Jan 14 21:59:05 2020 +0100

endl needs ostream header here.
---
 src/boost.cpp |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/boost.cpp b/src/boost.cpp
index ce1fb27..646d4e4 100644
--- a/src/boost.cpp
+++ b/src/boost.cpp
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace std;
 using lyx::lyxerr;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] * lib/RELEASE-NOTES

2020-01-14 Thread Pavel Sanda
commit b9bf39240bf6bfd6e002870a08ce84459a078da2
Author: Pavel Sanda 
Date:   Tue Jan 14 22:12:35 2020 +0100

* lib/RELEASE-NOTES
---
 lib/RELEASE-NOTES |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 0b4efec..421ec9a 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -131,7 +131,7 @@
 * The Qt5 libraries are now used by default. In order to link against
   Qt4 the configure option --disable-qt5 has to be used.
 
-* The pplatex/dvipost program is no longer used.
+* The dependency on pplatex/dvipost was dropped.
 
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Whitespace

2020-01-14 Thread Juergen Spitzmueller
commit 218731c3eb35c39858665d28ab5b3b5969d24a56
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 16:23:09 2020 +0100

Whitespace
---
 src/insets/InsetTabular.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index d06090c..dc8645a 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -2582,7 +2582,7 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns,
for (col_type j = cstart ; j < c ; ++j)
if (column_info[j].alignment == 
LYX_ALIGN_DECIMAL)
++offset;
-   col_type lastcol =(*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
+   col_type lastcol = (*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
if (toprtrims.find(c) != toprtrims.end()
&& toprtrims.find(c)->second)
trim += "r";
@@ -2655,7 +2655,7 @@ void Tabular::TeXBottomHLine(otexstream & os, row_type 
row, list colum
bottomline[c] = bottomline.find(c)->second || 
topline.find(c)->second;
bottomltrims[c] = (bottomltrims.find(c) != bottomltrims.end() 
&& bottomltrims.find(c)->second)
|| (topltrims.find(c) != topltrims.end() && 
topltrims.find(c)->second);
-   bottomrtrims[c] =(bottomrtrims.find(c) != bottomrtrims.end() && 
bottomrtrims.find(c)->second)
+   bottomrtrims[c] = (bottomrtrims.find(c) != bottomrtrims.end() 
&& bottomrtrims.find(c)->second)
|| (toprtrims.find(c) != toprtrims.end() && 
toprtrims.find(c)->second);
if (bottomline.find(c)->second)
++nset;
@@ -2718,7 +2718,7 @@ void Tabular::TeXBottomHLine(otexstream & os, row_type 
row, list colum
for (col_type j = cstart ; j < c ; ++j)
if (column_info[j].alignment == 
LYX_ALIGN_DECIMAL)
++offset;
-   col_type lastcol =(*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
+   col_type lastcol = (*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
if (bottomrtrims.find(c) != bottomrtrims.end()
&& bottomrtrims.find(c)->second)
trim += "r";
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Account for bidi (swapped columns) when calculation clines

2020-01-14 Thread Juergen Spitzmueller
commit 1e5f2526673ead3c6a07713aaf2dd731cbef265e
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 16:15:49 2020 +0100

Account for bidi (swapped columns) when calculation clines

Fixes #11717
---
 src/insets/InsetTabular.cpp |   69 ++-
 src/insets/InsetTabular.h   |   11 --
 2 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index f6897d6..d06090c 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -2488,7 +2488,8 @@ bool Tabular::isPartOfMultiRow(row_type row, col_type 
column) const
 }
 
 
-void Tabular::TeXTopHLine(otexstream & os, row_type row, list 
columns) const
+void Tabular::TeXTopHLine(otexstream & os, row_type row, list 
columns,
+ list logical_columns) const
 {
// we only output complete row lines and the 1st row here, the rest
// is done in Tabular::TeXBottomHLine(...)
@@ -2541,7 +2542,12 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
} else if (realfirstrow || have_trims) {
string const cline = use_booktabs ? "\\cmidrule" : "\\cline";
col_type c = 0;
-   for (auto & cl : columns) {
+   std::list::const_iterator it1 = 
logical_columns.begin();
+   std::list::const_iterator it2 = columns.begin();
+   // We need to iterate over the logical columns here, but take 
care for
+   // bidi swapping
+   for (; it1 != logical_columns.end() && it2 != columns.end(); 
++it1, ++it2) {
+   col_type cl = *it1;
if (cl < c)
continue;
c = cl;
@@ -2550,7 +2556,8 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
for (col_type j = 0 ; j < c; ++j)
if (column_info[j].alignment == 
LYX_ALIGN_DECIMAL)
++offset;
-   string const firstcol = convert(c + 1 + 
offset);
+   // If the two iterators differ, we are in bidi 
with swapped columns
+   col_type firstcol = (*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
while (isPartOfMultiColumn(row, c))
++c;
string trim;
@@ -2575,7 +2582,7 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
for (col_type j = cstart ; j < c ; ++j)
if (column_info[j].alignment == 
LYX_ALIGN_DECIMAL)
++offset;
-   col_type const lastcol = c + 1 + offset;
+   col_type lastcol =(*it1 == *it2) ? c + 1 + 
offset : columns.size() - c + offset;
if (toprtrims.find(c) != toprtrims.end()
&& toprtrims.find(c)->second)
trim += "r";
@@ -2583,7 +2590,11 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
os << cline;
if (!trim.empty())
os << "(" << trim << ")";
-   os << "{" << firstcol << '-' << lastcol << "}";
+   if (firstcol > lastcol)
+   // This can happen with bidi (swapped 
columns)
+   os << "{" << lastcol << '-' << firstcol 
<< "}";
+   else
+   os << "{" << firstcol << '-' << lastcol 
<< "}";
if (c == columns.size() - 1)
break;
++c;
@@ -2594,7 +2605,8 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
 }
 
 
-void Tabular::TeXBottomHLine(otexstream & os, row_type row, list 
columns) const
+void Tabular::TeXBottomHLine(otexstream & os, row_type row, list 
columns,
+list logical_columns) const
 {
// we output bottomlines of row r and the toplines of row r+1
// if the latter do not span the whole tabular
@@ -2664,7 +2676,12 @@ void Tabular::TeXBottomHLine(otexstream & os, row_type 
row, list colum
} else {
string const cline = use_booktabs ? "\\cmidrule" : "\\cline";
col_type c = 0;
-   for (auto & cl : columns) {
+   std::list::const_iterator it1 = 
logical_columns.begin();
+   std::list::const_iterator it2 = columns.begin();
+   // We need to iterate over the logical 

[LyX/master] Fix typo in tooltip

2020-01-14 Thread Juergen Spitzmueller
commit 78ac0b42669ecd0db1f2027e5ddbd7a35a5e2e11
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 13:02:40 2020 +0100

Fix typo in tooltip
---
 src/frontends/qt/ui/PrefEditUi.ui |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt/ui/PrefEditUi.ui 
b/src/frontends/qt/ui/PrefEditUi.ui
index 69aa6f5..987dc92 100644
--- a/src/frontends/qt/ui/PrefEditUi.ui
+++ b/src/frontends/qt/ui/PrefEditUi.ui
@@ -7,7 +7,7 @@
 0
 0
 494
-583
+614

   
   
@@ -151,7 +151,7 @@
   

 
- If this is checked, deleted and added text in change tracking 
mde will not be resolved on copy/paste operations and when moving content 
from/to insets
+ If this is checked, deleted and added text in change tracking 
mode will not be resolved on copy/paste operations and when moving content 
from/to insets
 
 
  Keep change tracking markup on copy and paste
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Do not output deleted rows columns if show changes in output is false

2020-01-14 Thread Juergen Spitzmueller
commit 66c5d055e776e0cd08fb35c164b49d9ccc7812b7
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 13:03:12 2020 +0100

Do not output deleted rows columns if show changes in output is false
---
 src/insets/InsetTabular.cpp |   62 --
 src/insets/InsetTabular.h   |8 -
 2 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 5095328..f6897d6 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -1647,7 +1647,7 @@ int Tabular::textVOffset(idx_type cell) const
 }
 
 
-Tabular::idx_type Tabular::getFirstCellInRow(row_type row) const
+Tabular::idx_type Tabular::getFirstCellInRow(row_type row, bool const ct) const
 {
col_type c = 0;
idx_type const numcells = numberOfCellsInRow(row);
@@ -1656,26 +1656,52 @@ Tabular::idx_type Tabular::getFirstCellInRow(row_type 
row) const
// is really invalid, i.e., it is NOT the first cell in the row. but
// i do not know what to do here. (rgh)
while (c < numcells - 1
-  && cell_info[row][c].multirow == CELL_PART_OF_MULTIROW)
+  && (cell_info[row][c].multirow == CELL_PART_OF_MULTIROW
+  || (ct && column_info[c].change.deleted(
++c;
return cell_info[row][c].cellno;
 }
 
 
-Tabular::idx_type Tabular::getLastCellInRow(row_type row) const
+Tabular::idx_type Tabular::getLastCellInRow(row_type row, bool const ct) const
 {
col_type c = ncols() - 1;
// of course we check against 0 so we don't crash. but we have the same
// problem as in the previous routine: if all the cells are part of a
// multirow or part of a multi column, then our return value is invalid.
while (c > 0
-  && (cell_info[row][c].multirow == CELL_PART_OF_MULTIROW
-  || cell_info[row][c].multicolumn == 
CELL_PART_OF_MULTICOLUMN))
+  && ((cell_info[row][c].multirow == CELL_PART_OF_MULTIROW
+  || cell_info[row][c].multicolumn == CELL_PART_OF_MULTICOLUMN)
+ || (ct && column_info[c].change.deleted(
--c;
return cell_info[row][c].cellno;
 }
 
 
+Tabular::row_type Tabular::getFirstRow(bool const ct) const
+{
+   row_type r = 0;
+   if (!ct)
+   return r;
+   // exclude deleted rows if ct == true
+   while (r < nrows() && row_info[r].change.deleted())
+   ++r;
+   return r;
+}
+
+
+Tabular::row_type Tabular::getLastRow(bool const ct) const
+{
+   row_type r = nrows() - 1;
+   if (!ct)
+   return r;
+   // exclude deleted rows if ct == true
+   while (r > 0 && row_info[r].change.deleted())
+   --r;
+   return r;
+}
+
+
 Tabular::row_type Tabular::cellRow(idx_type cell) const
 {
if (cell >= numberofcells)
@@ -2497,15 +2523,16 @@ void Tabular::TeXTopHLine(otexstream & os, row_type 
row, list columns)
}
 
// do nothing if empty first row, or incomplete row line after
-   if ((row == 0 && nset == 0) || (row > 0 && nset != ncols()))
+   row_type first = getFirstRow(!buffer().params().output_changes);
+   if ((row == first && nset == 0) || (row > first && nset != 
columns.size()))
return;
 
// Is this the actual first row (excluding longtable caption row)?
-   bool const realfirstrow = (row == 0
-  || (is_long_tabular && row == 1 && 
ltCaption(0)));
+   bool const realfirstrow = (row == first
+  || (is_long_tabular && row == first + 1 && 
ltCaption(first)));
 
// only output complete row lines and the 1st row's clines
-   if (nset == ncols() && !have_trims) {
+   if (nset == columns.size() && !have_trims) {
if (use_booktabs) {
os << (realfirstrow ? "\\toprule " : "\\midrule ");
} else {
@@ -2557,7 +2584,7 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, 
list columns)
if (!trim.empty())
os << "(" << trim << ")";
os << "{" << firstcol << '-' << lastcol << "}";
-   if (c == ncols() - 1)
+   if (c == columns.size() - 1)
break;
++c;
}
@@ -2573,7 +2600,7 @@ void Tabular::TeXBottomHLine(otexstream & os, row_type 
row, list colum
// if the latter do not span the whole tabular
 
// get the bottomlines of row r, and toplines in next row
-   bool lastrow = row == nrows() - 1;
+   bool lastrow = row == getLastRow(!buffer().params().output_changes);
map bottomline, topline, topltrims, toprtrims, 
bottomltrims, bottomrtrims;
bool nextrowset = true;
for (auto const & 

Re: [LyX/master] Add pref to keep ct markup on copy/paste

2020-01-14 Thread Kornel Benko
Am Mon, 13 Jan 2020 15:04:32 +0100 (CET)
schrieb Juergen Spitzmueller :

> commit 5fc2662b1301a8e04db0fa8695e06b363c1de60e
> Author: Juergen Spitzmueller 
> Date:   Mon Jan 13 15:20:48 2020 +0100
> 
> Add pref to keep ct markup on copy/paste
> 
> Fixes #10278, #10128

Typo (mde->mode) in PrefEditUi.ui
If this is checked, deleted and added text in change tracking mde will 
not be
resolved on copy/paste operations and when moving content from/to 
insets

Kornel


pgpF54ezbB0zm.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Rename PainterMetrics::change_ to change

2020-01-14 Thread Jean-Marc Lasgouttes
commit a187cbeb64a9bb02d38d22f8a5249d149a224070
Author: Jean-Marc Lasgouttes 
Date:   Tue Jan 14 11:50:44 2020 +0100

Rename PainterMetrics::change_ to change

This is not a private variable.
---
 src/MetricsInfo.cpp |6 +++---
 src/MetricsInfo.h   |2 +-
 src/RowPainter.cpp  |6 +++---
 src/insets/InsetCollapsible.cpp |   16 
 src/insets/InsetText.cpp|   10 +-
 src/insets/RenderGraphic.cpp|4 ++--
 src/insets/RenderPreview.cpp|4 ++--
 src/mathed/InsetMathHull.cpp|4 ++--
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index 93c6e39..537efd3 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -131,7 +131,7 @@ MetricsInfo::MetricsInfo(BufferView * bv, FontInfo font, 
int textwidth,
 /
 
 PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
-   : pain(painter), ltr_pos(false), change_(), selected(false),
+   : pain(painter), ltr_pos(false), change(), selected(false),
  do_spellcheck(true), full_repaint(true), 
background_color(Color_background),
  leftx(0), rightx(0)
 {
@@ -178,8 +178,8 @@ ColorCode PainterInfo::backgroundColor(Inset const * inset, 
bool sel) const
 
 Color PainterInfo::textColor(Color const & color) const
 {
-   if (change_.changed())
-   return change_.color();
+   if (change.changed())
+   return change.color();
if (selected)
return Color_selectiontext;
return color;
diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h
index 066d87c..3ad59cd 100644
--- a/src/MetricsInfo.h
+++ b/src/MetricsInfo.h
@@ -134,7 +134,7 @@ public:
/// Whether the text at this point is right-to-left (for insets)
bool ltr_pos;
/// The change the parent is part of (change tracking)
-   Change change_;
+   Change change;
/// Whether the parent is selected as a whole
bool selected;
/// Whether the spell checker is enabled for the parent
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index b36fab9..13c3be0 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -95,12 +95,12 @@ void RowPainter::paintInset(Row::Element const & e) const
// requires a full repaint
bool const pi_full_repaint = pi_.full_repaint;
bool const pi_do_spellcheck = pi_.do_spellcheck;
-   Change const pi_change = pi_.change_;
+   Change const pi_change = pi_.change;
 
pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() :
pi_.base.bv->buffer().params().getFont().fontInfo();
pi_.ltr_pos = !e.font.isVisibleRightToLeft();
-   pi_.change_ = pi_.change_.changed() ? pi_.change_ : e.change;
+   pi_.change = pi_.change.changed() ? pi_.change : e.change;
pi_.do_spellcheck &= e.inset->allowSpellCheck();
 
int const x1 = int(x_);
@@ -115,7 +115,7 @@ void RowPainter::paintInset(Row::Element const & e) const
 
// Restore full_repaint status.
pi_.full_repaint = pi_full_repaint;
-   pi_.change_ = pi_change;
+   pi_.change = pi_change;
pi_.do_spellcheck = pi_do_spellcheck;
pi_.selected = pi_selected;
 
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index d07123b..cb9e23a 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -268,7 +268,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) 
const
// Draw the change tracking cue on the label, unless RowPainter 
already
// takes care of it.
if (canPaintChange(bv))
-   pi.change_.paintCue(pi, x, y, x + dimc.width(), 
labelfont);
+   pi.change.paintCue(pi, x, y, x + dimc.width(), 
labelfont);
} else {
view_[].button_dim_.x1 = 0;
view_[].button_dim_.y1 = 0;
@@ -292,8 +292,8 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) 
const
}
// Do not draw the cue for INSERTED -- it is already in the 
button and
// that's enough.
-   Changer cdummy = (pi.change_.type == Change::INSERTED)
-   ? make_change(pi.change_, Change())
+   Changer cdummy = (pi.change.type == Change::INSERTED)
+   ? make_change(pi.change, Change())
: Changer();
InsetText::draw(pi, textx, texty);
break;
@@ -312,7 +312,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) 
const
// We will take care of the frame and the change tracking cue
// ourselves, below.
{
-   Changer cdummy = make_change(pi.change_, Change());
+   Changer 

[LyX/master] Streamline RowPainter a bit

2020-01-14 Thread Jean-Marc Lasgouttes
commit 5bb9ded4d6db8de93f0a17783fc7a635559510dd
Author: Jean-Marc Lasgouttes 
Date:   Tue Jan 14 11:42:01 2020 +0100

Streamline RowPainter a bit
---
 src/RowPainter.cpp |   23 ---
 src/RowPainter.h   |   13 -
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 2216b21..b36fab9 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -10,6 +10,7 @@
  */
 
 #include 
+
 #include 
 
 #include "RowPainter.h"
@@ -26,25 +27,18 @@
 #include "Row.h"
 #include "MetricsInfo.h"
 #include "Paragraph.h"
+#include "ParagraphList.h"
 #include "ParagraphParameters.h"
+#include "Text.h"
 #include "TextMetrics.h"
-#include "VSpace.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-#include "insets/InsetText.h"
-
-#include "mathed/InsetMath.h"
-
 #include "support/debug.h"
 #include "support/gettext.h"
-#include "support/textutils.h"
-
 #include "support/lassert.h"
-#include 
 
-#include 
 
 using namespace std;
 
@@ -58,9 +52,7 @@ RowPainter::RowPainter(PainterInfo & pi,
Text const & text, Row const & row, int x, int y)
: pi_(pi), text_(text),
  tm_(pi_.base.bv->textMetrics()),
- pars_(text.paragraphs()),
  row_(row), par_(text.paragraphs()[row.pit()]),
- change_(pi_.change_),
  xo_(x), yo_(y)
 {
x_ = row_.left_margin + xo_;
@@ -108,7 +100,7 @@ void RowPainter::paintInset(Row::Element const & e) const
pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() :
pi_.base.bv->buffer().params().getFont().fontInfo();
pi_.ltr_pos = !e.font.isVisibleRightToLeft();
-   pi_.change_ = change_.changed() ? change_ : e.change;
+   pi_.change_ = pi_.change_.changed() ? pi_.change_ : e.change;
pi_.do_spellcheck &= e.inset->allowSpellCheck();
 
int const x1 = int(x_);
@@ -316,6 +308,7 @@ void RowPainter::paintAppendix() const
 void RowPainter::paintDepthBar() const
 {
depth_type const depth = par_.getDepth();
+   ParagraphList const & pars = text_.paragraphs();
 
if (depth <= 0)
return;
@@ -325,15 +318,15 @@ void RowPainter::paintDepthBar() const
pit_type pit2 = row_.pit();
if (row_.pos() == 0)
--pit2;
-   prev_depth = pars_[pit2].getDepth();
+   prev_depth = pars[pit2].getDepth();
}
 
depth_type next_depth = 0;
if (!tm_.isLastRow(row_)) {
pit_type pit2 = row_.pit();
-   if (row_.endpos() >= pars_[pit2].size())
+   if (row_.endpos() >= pars[pit2].size())
++pit2;
-   next_depth = pars_[pit2].getDepth();
+   next_depth = pars[pit2].getDepth();
}
 
for (depth_type i = 1; i <= depth; ++i) {
diff --git a/src/RowPainter.h b/src/RowPainter.h
index fc7c36f..d573cb8 100644
--- a/src/RowPainter.h
+++ b/src/RowPainter.h
@@ -14,21 +14,12 @@
 #ifndef ROWPAINTER_H
 #define ROWPAINTER_H
 
-#include "Changes.h"
 #include "Row.h"
 
-#include "support/types.h"
-
 namespace lyx {
 
-class BufferView;
-class Font;
-class FontInfo;
-class Inset;
-class Language;
 class PainterInfo;
 class Paragraph;
-class ParagraphList;
 class Text;
 class TextMetrics;
 
@@ -82,7 +73,6 @@ private:
/// Text for the row
Text const & text_;
TextMetrics const & tm_;
-   ParagraphList const & pars_;
 
/// The row to paint
Row const & row_;
@@ -90,9 +80,6 @@ private:
/// Row's paragraph
Paragraph const & par_;
 
-   /// row changed? (change tracking)
-   Change const change_;
-
// Looks ugly - is
double const xo_;
int const yo_;// current baseline
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Set changed status for changed column/row cells in updateIndexes()

2020-01-14 Thread Juergen Spitzmueller
commit b5856628f1d1b402b83d2e22004fb4f64ec4c89d
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 10:39:42 2020 +0100

Set changed status for changed column/row cells in updateIndexes()
---
 src/insets/InsetTabular.cpp |   40 +---
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 5622e0e..5095328 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -807,9 +807,6 @@ void Tabular::deleteRow(row_type const row, bool const 
force)
bool const ct = force ? false : buffer().params().track_changes;
 
for (col_type c = 0; c < ncols(); ++c) {
-   // mark track changes
-   if (ct)
-   
cell_info[row][c].inset->setChange(Change(Change::DELETED));
// Care about multirow cells
if (row + 1 < nrows() &&
cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW &&
@@ -848,8 +845,6 @@ void Tabular::insertRow(row_type const row, bool copy)
for (col_type c = 0; c < ncols(); ++c) {
cell_info[row + 1].insert(cell_info[row + 1].begin() + c,
copy ? CellData(cell_info[row][c]) : CellData(buffer_));
-   if (buffer().params().track_changes)
-   cell_info[row + 
1][c].inset->setChange(Change(Change::INSERTED));
if (cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW)
cell_info[row + 1][c].multirow = CELL_PART_OF_MULTIROW;
}
@@ -868,12 +863,11 @@ void Tabular::insertRow(row_type const row, bool copy)
setBottomLine(i, true);
setBottomLine(j, false);
}
-   // mark track changes
-   if (buffer().params().track_changes)
-   cellInfo(i).inset->setChange(Change(Change::INSERTED));
}
-   if (buffer().params().track_changes)
+   if (buffer().params().track_changes) {
row_info[row + 1].change.setInserted();
+   updateIndexes();
+   }
 }
 
 
@@ -932,9 +926,6 @@ void Tabular::deleteColumn(col_type const col, bool const 
force)
bool const ct = force ? false : buffer().params().track_changes;
 
for (row_type r = 0; r < nrows(); ++r) {
-   // mark track changes
-   if (ct)
-   
cell_info[r][col].inset->setChange(Change(Change::DELETED));
// Care about multicolumn cells
if (col + 1 < ncols() &&
cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN 
&&
@@ -972,8 +963,6 @@ void Tabular::insertColumn(col_type const col, bool copy)
for (row_type r = 0; r < nrows(); ++r) {
cell_info[r].insert(cell_info[r].begin() + col + 1,
copy ? CellData(cell_info[r][col]) : CellData(buffer_));
-   if (ct)
-   cell_info[r][col + 
1].inset->setChange(Change(Change::INSERTED));
if (cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
cell_info[r][col + 1].multicolumn = 
CELL_PART_OF_MULTICOLUMN;
}
@@ -989,11 +978,11 @@ void Tabular::insertColumn(col_type const col, bool copy)
if (rightLine(i) && rightLine(j)) {
setRightLine(j, false);
}
-   if (ct)
-   cellInfo(i).inset->setChange(Change(Change::INSERTED));
}
-   if (ct)
+   if (ct) {
column_info[col + 1].change.setInserted();
+   updateIndexes();
+   }
 }
 
 
@@ -1016,8 +1005,8 @@ void Tabular::updateIndexes()
rowofcell.resize(numberofcells);
columnofcell.resize(numberofcells);
idx_type i = 0;
-   // reset column and row of cells and update their width and alignment
-   for (row_type row = 0; row < nrows(); ++row)
+   // reset column and row of cells and update their width, alignment and 
ct status
+   for (row_type row = 0; row < nrows(); ++row) {
for (col_type column = 0; column < ncols(); ++column) {
if (isPartOfMultiColumn(row, column)) {

cell_info[row][column].inset->toggleMultiCol(true);
@@ -1038,8 +1027,15 @@ void Tabular::updateIndexes()
cell_info[row][column].inset->toggleMultiRow(false);
cell_info[row][column].inset->setContentAlignment(
getAlignment(cellIndex(row, column)));
+   if (buffer().params().track_changes) {
+   if (row_info[row].change.changed())
+   
cell_info[row][column].inset->setChange(row_info[row].change);
+   if (column_info[column].change.changed())
+   

[LyX/master] Some polishment.

2020-01-14 Thread Juergen Spitzmueller
commit 2a48fbbf7fa594ca8ad2b5f8958e4a7f953b662e
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 09:55:16 2020 +0100

Some polishment.
---
 src/insets/InsetTabular.cpp |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index f305dbc..5622e0e 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -872,9 +872,8 @@ void Tabular::insertRow(row_type const row, bool copy)
if (buffer().params().track_changes)
cellInfo(i).inset->setChange(Change(Change::INSERTED));
}
-   if (buffer().params().track_changes) {
+   if (buffer().params().track_changes)
row_info[row + 1].change.setInserted();
-   }
 }
 
 
@@ -967,13 +966,13 @@ void Tabular::appendColumn(col_type col)
 
 void Tabular::insertColumn(col_type const col, bool copy)
 {
-   BufferParams const & bp = buffer().params();
+   bool const ct = buffer().params().track_changes;
column_info.insert(column_info.begin() + col + 1, 
ColumnData(column_info[col]));
 
for (row_type r = 0; r < nrows(); ++r) {
cell_info[r].insert(cell_info[r].begin() + col + 1,
copy ? CellData(cell_info[r][col]) : CellData(buffer_));
-   if (bp.track_changes)
+   if (ct)
cell_info[r][col + 
1].inset->setChange(Change(Change::INSERTED));
if (cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
cell_info[r][col + 1].multicolumn = 
CELL_PART_OF_MULTICOLUMN;
@@ -990,10 +989,10 @@ void Tabular::insertColumn(col_type const col, bool copy)
if (rightLine(i) && rightLine(j)) {
setRightLine(j, false);
}
-   if (buffer().params().track_changes)
+   if (ct)
cellInfo(i).inset->setChange(Change(Change::INSERTED));
}
-   if (buffer().params().track_changes)
+   if (ct)
column_info[col + 1].change.setInserted();
 }
 
@@ -7160,10 +7159,14 @@ Text * InsetTabular::getText(int idx) const
 
 bool InsetTabular::isChanged() const
 {
-   for (idx_type idx = 0; idx < nargs(); ++idx)
+   for (idx_type idx = 0; idx < nargs(); ++idx) {
if (cell(idx)->isChanged())
return true;
-   // FIXME: shall we look at row/columns changed status?
+   if (tabular.row_info[tabular.cellRow(idx)].change.changed())
+   return true;
+   if 
(tabular.column_info[tabular.cellColumn(idx)].change.changed())
+   return true;
+   }
return false;
 }
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Record change author and time for tracked columns/rows

2020-01-14 Thread Juergen Spitzmueller
commit 33133733ae2365db46bf78ebee7f06744a51065b
Author: Juergen Spitzmueller 
Date:   Tue Jan 14 09:28:36 2020 +0100

Record change author and time for tracked columns/rows

This now uses a real change object
---
 development/FORMAT  |2 +-
 src/insets/InsetTabular.cpp |  142 ++-
 src/insets/InsetTabular.h   |4 +-
 3 files changed, 89 insertions(+), 59 deletions(-)

diff --git a/development/FORMAT b/development/FORMAT
index ee34ef4..fb5e7df 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -8,7 +8,7 @@ changes happened in particular if possible. A good example 
would be
 ---
 
 2020-01-11 Jürgen Spitzmüller 
-   * Format incremented to 592: Add tabular column/row tag 
changed=[added|deleted]
+   * Format incremented to 592: Add tabular column/row tag 
changed="[added|deleted] id time"
   which tracks whether a whole row/column has been inserted/deleted in 
ct.
 
 2020-01-10 Jürgen Spitzmüller 
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 544a407..f305dbc 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -451,18 +451,42 @@ bool getTokenValue(string const & str, char const * 
token, Length & len)
 }
 
 
-bool getTokenValue(string const & str, char const * token, Change::Type & 
change)
+bool getTokenValue(string const & str, char const * token, Change & change, 
BufferParams bp)
 {
-   // set the length to be zero() as default as this it should be if not
+   // set the change to be Change() as default as this it should be if not
// in the file format.
-   change = Change::UNCHANGED;
+   change = Change();
string tmp;
if (getTokenValue(str, token, tmp)) {
-   if (tmp == "inserted") {
-   change = Change::INSERTED;
+   vector const changedata = getVectorFromString(tmp, " ");
+   if (changedata.size() != 3) {
+   Alert::warning(_("Change tracking data incomplete"),
+  _("Change tracking information for 
tabular row/column "
+"is incomplete. I will ignore 
this.\n"));
+   return false;
+   }
+   BufferParams::AuthorMap const & am = bp.author_map_;
+   int aid = convert(changedata[1]);
+   if (am.find(aid) == am.end()) {
+   // FIXME Use ErrorList
+   Alert::warning(_("Change tracking author index 
missing"),
+   bformat(_("A change tracking author information 
for index "
+ "%1$d is missing. This can happen 
after a wrong "
+ "merge by a version control system. 
In this case, "
+ "either fix the merge, or have this 
information "
+ "missing until the corresponding 
tracked changes "
+ "are merged or this user edits the 
file again.\n"),
+   aid));
+   bp.addAuthor(Author(aid));
+   }
+   istringstream is(changedata[2]);
+   time_t ct;
+   is >> ct;
+   if (changedata[0] == "inserted") {
+   change = Change(Change::INSERTED, am.find(aid)->second, 
ct);
return true;
-   } else if (tmp == "deleted") {
-   change = Change::DELETED;
+   } else if (changedata[0] == "deleted") {
+   change = Change(Change::DELETED, am.find(aid)->second, 
ct);
return true;
}
}
@@ -550,13 +574,18 @@ string const write_attribute(string const & name, Length 
const & value)
return value.zero() ? string() : write_attribute(name, 
value.asString());
 }
 
-template <>
-string const write_attribute(string const & name, Change::Type const & type)
+string const write_attribute(string const & name, Change const & change, 
BufferParams const bp)
 {
-   if (type == Change::INSERTED)
-   return write_attribute(name, from_ascii("inserted"));
-   else if (type == Change::DELETED)
-   return write_attribute(name, from_ascii("deleted"));
+   odocstringstream ods;
+   if (change.inserted())
+   ods << from_ascii("inserted");
+   else if (change.deleted())
+   ods << from_ascii("deleted");
+   if (change.changed()) {
+   ods << " " << bp.authors().get(change.author).bufferId()
+   << " " << change.changetime;
+   return write_attribute(name, ods.str());
+   }
return string();
 }
 
@@ -703,7 +732,7 @@ Tabular::RowData::RowData()
  endlastfoot(false),