[LyX/master] Fix Ui layouts.

2020-05-01 Thread Juergen Spitzmueller
commit a05b3228bc08f091bb89ef55d05e36ee65628a9e
Author: Juergen Spitzmueller 
Date:   Fri May 1 10:10:27 2020 +0200

Fix Ui layouts.
---
 src/frontends/qt/ui/CounterUi.ui |  170 +-
 1 files changed, 112 insertions(+), 58 deletions(-)

diff --git a/src/frontends/qt/ui/CounterUi.ui b/src/frontends/qt/ui/CounterUi.ui
index 93298e4..c4b8aeb 100644
--- a/src/frontends/qt/ui/CounterUi.ui
+++ b/src/frontends/qt/ui/CounterUi.ui
@@ -6,70 +6,124 @@

 0
 0
-290
-197
+289
+235

   
   

   
-  
-   
-
- 
-  Value Type
- 
-
-   
-   
-
- 
-  Value
- 
-
-   
-   
-
-   
+  

-
- 
-  Counter
- 
-
-   
-   
-
-   
-   
-
- 
-  1
- 
-
-   
-   
-
- 
-  Action
- 
-
-   
-   
-
-   
-   
-
- 
-  Affect counters only in LyX, not in output
- 
- 
-  Qt::RightToLeft
- 
- 
-  LyX Only
- 
-
+
+ 
+  
+   
+Counter:
+   
+   
+counterCB
+   
+  
+ 
+ 
+  
+   
+
+ 0
+ 0
+
+   
+  
+ 
+ 
+  
+   
+Action:
+   
+   
+actionCB
+   
+  
+ 
+ 
+  
+   
+
+ 0
+ 0
+
+   
+  
+ 
+ 
+  
+   
+Value:
+   
+   
+valueSB
+   
+  
+ 
+ 
+  
+   
+
+ 
+  1
+ 
+
+   
+   
+
+ 
+  Qt::Horizontal
+ 
+ 
+  
+   13
+   39
+  
+ 
+
+   
+  
+ 
+ 
+  
+   
+Value Type:
+   
+   
+vtypeCB
+   
+  
+ 
+ 
+  
+   
+
+ 0
+ 0
+
+   
+  
+ 
+ 
+  
+   
+Affect counters only in LyX, not in output
+   
+   
+Qt::LeftToRight
+   
+   
+LyX Only
+   
+  
+ 
+

   
  
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Fix build with qt4

2020-05-01 Thread Juergen Spitzmueller
commit 4d3a08bf860baca24211e91a6b8569f01bc94a4f
Author: Juergen Spitzmueller 
Date:   Fri May 1 10:17:04 2020 +0200

Fix build with qt4
---
 src/frontends/qt/GuiCounter.cpp |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index 7470e0d..3103055 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -138,8 +138,8 @@ docstring GuiCounter::dialogToParams() const
 
params["counter"] = qstring_to_ucs4(counterCB->currentText());
params["value"] = convert(valueSB->value());
-   params.setCmdName(fromqstr(actionCB->currentData().toString()));
-   params["vtype"] = qstring_to_ucs4(vtypeCB->currentData().toString());
+   
params.setCmdName(fromqstr(actionCB->itemData(actionCB->currentIndex()).toString()));
+   params["vtype"] = 
qstring_to_ucs4(vtypeCB->itemData(vtypeCB->currentIndex()).toString());
params["lyxonly"] = from_ascii(lyxonlyXB->isChecked() ? "true" : 
"false");
return from_utf8(InsetCounter::params2string(params));
 }
@@ -147,9 +147,9 @@ docstring GuiCounter::dialogToParams() const
 
 bool GuiCounter::checkWidgets(bool readonly) const
 {
-   bool const cmdIsValue = actionCB->currentData().toString() == "value";
-   bool const cmdIsSet = actionCB->currentData().toString() == "set";
-   bool const cmdIsAddTo = actionCB->currentData().toString() == "addto";
+   bool const cmdIsValue = 
actionCB->itemData(actionCB->currentIndex()).toString() == "value";
+   bool const cmdIsSet = 
actionCB->itemData(actionCB->currentIndex()).toString() == "set";
+   bool const cmdIsAddTo = 
actionCB->itemData(actionCB->currentIndex()).toString() == "addto";
counterCB->setEnabled(!readonly);
actionCB->setEnabled(!readonly);
valueSB->setEnabled(!readonly && (cmdIsSet || cmdIsAddTo));
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


Re: [LyX/master] Revert last three commits.

2020-05-01 Thread Jean-Marc Lasgouttes

Le 26/04/2020 à 08:49, Richard Kimberly Heck a écrit :

commit 7b9dc7bc9e26b26d15ca4c3e5b2d0383ea97733f
Author: Richard Kimberly Heck 
Date:   Sun Apr 26 03:08:35 2020 -0400

 Revert last three commits.
 
 There are other issues here. The big one is in TextMetrics::getPitNearY,

 where -1 is used as a 'special' return value for pit.


This special value of -1 is nothing else than the "npos" that we get in 
STL for things like strings. We could define a value lyx::npos which is 
this special value for pit_type and pos_type and get rid of the signedness.


What were the other issues?

JMarc



---
  src/BufferView.cpp   |5 +
  src/Compare.cpp  |6 +++---
  src/RowPainter.cpp   |3 ++-
  src/support/lstrings.cpp |8 
  src/support/lstrings.h   |2 --
  src/support/types.h  |2 +-
  6 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index ca59fcb..621b58e 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2860,7 +2860,7 @@ void BufferView::updateMetrics(Update::flags & 
update_flags)
int y1 = d->anchor_ypos_ - anchor_pm.ascent();
// We are now just above the anchor paragraph.
pit_type pit1 = d->anchor_pit_ - 1;
-   while (y1 >= 0) {
+   for (; pit1 >= 0 && y1 >= 0; --pit1) {
tm.redoParagraph(pit1);
ParagraphMetrics & pm = tm.par_metrics_[pit1];
y1 -= pm.descent();
@@ -2868,9 +2868,6 @@ void BufferView::updateMetrics(Update::flags & 
update_flags)
pm.setPosition(y1);
tm.updatePosCache(pit1);
y1 -= pm.ascent();
-   if (pit1 == 0)
-   break;
-   --pit1;
}
  
  	// Redo paragraphs below the anchor if necessary.

diff --git a/src/Compare.cpp b/src/Compare.cpp
index 931fe76..60a0b65 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -881,10 +881,10 @@ void Compare::Impl::writeToDestBuffer(DocRange const & 
range,
  
  void Compare::Impl::writeToDestBuffer(ParagraphList const & pars) const

  {
+   pit_type const pit = dest_pars_->size() - 1;
dest_pars_->insert(dest_pars_->end(), pars.begin(), pars.end());
-   pit_type pit = dest_pars_->size();
-   if (pit > 0)
-   mergeParagraph(dest_buf_->params(), *dest_pars_, pit - 1);
+   if (pit >= 0)
+   mergeParagraph(dest_buf_->params(), *dest_pars_, pit);
  }
  
  
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp

index a392c02..6e4cf31 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -60,7 +60,8 @@ RowPainter::RowPainter(PainterInfo & pi,
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ 
<< endl;
//row_.dump();
  
-	LBUFERR(row.pit() < text.paragraphs().size());

+   LBUFERR(row.pit() >= 0);
+   LBUFERR(row.pit() < int(text.paragraphs().size()));
  }
  
  
diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp

index 8c15d9b..55e66ce 100644
--- a/src/support/lstrings.cpp
+++ b/src/support/lstrings.cpp
@@ -1507,14 +1507,6 @@ docstring bformat(docstring const & fmt, unsigned int 
arg1)
  }
  
  
-docstring bformat(docstring const & fmt, pit_type arg1)

-{
-   LATTEST(contains(fmt, from_ascii("%1$d")));
-   docstring const str = subst(fmt, from_ascii("%1$d"), 
convert(arg1));
-   return subst(str, from_ascii("%%"), from_ascii("%"));
-}
-
-
  docstring bformat(docstring const & fmt, docstring const & arg1)
  {
LATTEST(contains(fmt, from_ascii("%1$s")));
diff --git a/src/support/lstrings.h b/src/support/lstrings.h
index 0662769..f661fc5 100644
--- a/src/support/lstrings.h
+++ b/src/support/lstrings.h
@@ -17,7 +17,6 @@
  #define LSTRINGS_H
  
  #include "support/docstring.h"

-#include "support/types.h"
  
  #include 
  
@@ -370,7 +369,6 @@ docstring bformat(docstring const & fmt, long arg1);

  docstring bformat(docstring const & fmt, long long arg1);
  #endif
  docstring bformat(docstring const & fmt, unsigned int arg1);
-docstring bformat(docstring const & fmt, pit_type arg1);
  docstring bformat(docstring const & fmt, docstring const & arg1);
  docstring bformat(docstring const & fmt, char * arg1);
  docstring bformat(docstring const & fmt, docstring const & arg1, docstring const 
& arg2);
diff --git a/src/support/types.h b/src/support/types.h
index 75ccec0..c9cf349 100644
--- a/src/support/types.h
+++ b/src/support/types.h
@@ -40,7 +40,7 @@ namespace lyx {
 */
// FIXME: should be unsigned as well.
// however, simply changing it breaks a downward loop somewhere...
-   typedef size_t pit_type;
+   typedef ptrdiff_t  pit_type;
  
  	/// a type for the nesting depth of a paragraph

typedef size_t depth_type;



--
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


Re: [LyX/master] Revert last three commits.

2020-05-01 Thread Richard Kimberly Heck
On 5/1/20 5:52 AM, Jean-Marc Lasgouttes wrote:
> Le 26/04/2020 à 08:49, Richard Kimberly Heck a écrit :
>> commit 7b9dc7bc9e26b26d15ca4c3e5b2d0383ea97733f
>> Author: Richard Kimberly Heck 
>> Date:   Sun Apr 26 03:08:35 2020 -0400
>>
>>  Revert last three commits.
>>   There are other issues here. The big one is in
>> TextMetrics::getPitNearY,
>>  where -1 is used as a 'special' return value for pit.
>
> This special value of -1 is nothing else than the "npos" that we get
> in STL for things like strings. We could define a value lyx::npos
> which is this special value for pit_type and pos_type and get rid of
> the signedness.

Worth a shot, I suppose. We could define it as UNIT_MAX - 1 or something.


> What were the other issues?

I can't recall, other than that boatloads of warnings suddenly appeared.
I'll have a look.

Riki


-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Polish the counter UI a bit and add some to the documentation.

2020-05-01 Thread Richard Kimberly Heck
commit bc4ca12ab5911c901a3715e434cafd1d9b997ffa
Author: Richard Kimberly Heck 
Date:   Fri May 1 19:03:54 2020 -0400

Polish the counter UI a bit and add some to the documentation.
---
 lib/doc/UserGuide.lyx|   57 -
 lib/ui/stdmenus.inc  |2 +-
 src/frontends/qt/GuiCounter.cpp  |6 ++--
 src/frontends/qt/ui/CounterUi.ui |8 -
 src/insets/InsetCounter.cpp  |   16 +-
 5 files changed, 74 insertions(+), 15 deletions(-)

diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index 2108016..ca92802 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -147,7 +147,7 @@ logicalmkup
 \papersides 2
 \paperpagestyle default
 \tablestyle default
-\tracking_changes false
+\tracking_changes true
 \output_changes false
 \change_bars false
 \postpone_fragile_content false
@@ -29903,7 +29903,7 @@ lyxonly "false"
 \end_inset
 
 
-\change_inserted -584632292 1588304519
+\change_inserted -584632292 1588374084
 ).
  Mostly, this is handled automatically, but there are times one wants to
  modify counters directly.
@@ -29917,6 +29917,59 @@ lyxonly "false"
  
 \end_layout
 
+\begin_layout Standard
+
+\change_inserted -584632292 1588374095
+There are six commands you can use:
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374116
+Set Counter: Allows you to assign a specific value to a counter
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374135
+Add to Counter: Allows you to add some specified amount to a counter (or
+ to subtract, if you choose a negative number)
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374149
+Reset to 0: Sets the value of the counter to 0.
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374169
+Save Value of Counter: Saves the value of the counter so that it can later
+ be restored.
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374185
+Restore Value of Counter: Restores the previously saved value.
+\end_layout
+
+\begin_layout Enumerate
+
+\change_inserted -584632292 1588374203
+Display Value of Counter: Shows the value of the counter (in the output).
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -584632292 1588374230
+The dialog allows you to choose which counter you wish to modify from all
+ those that are available in the current document class.
+\change_unchanged
+
+\end_layout
+
 \begin_layout Section
 Appendices
 \begin_inset Index idx
diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc
index 29fdcef..2b4277b 100644
--- a/lib/ui/stdmenus.inc
+++ b/lib/ui/stdmenus.inc
@@ -123,6 +123,7 @@ Menuset
Item "Paragraph Settings...|P" "layout-paragraph"
Submenu "Text Properties|x" "edit_textprops"
OptSubmenu "Custom Text Styles|S" "edit_textstyles"
+   Item "Manage Counter Values" "dialog-show-new-inset counter"
LanguageSelector
Separator
 # Mathed b0rkage means these don't work properly
@@ -398,7 +399,6 @@ Menuset
Item "URL|U" "flex-insert URL"
Item "Hyperlink...|k" "href-insert"
Item "Footnote|F" "footnote-insert"
-   Item "Counter" "dialog-show-new-inset counter"
Item "Marginal Note|M" "marginalnote-insert"
Item "Program Listing[[Menu]]" "listing-insert"
Separator
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index 3103055..6deed4b 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -157,10 +157,10 @@ bool GuiCounter::checkWidgets(bool readonly) const
valueSB->setRange(-1, 1);
else
valueSB->setRange(0, 1);
+   vtypeLA->setEnabled(!readonly && cmdIsValue);
vtypeCB->setEnabled(!readonly && cmdIsValue);
-   if (!InsetParamsWidget::checkWidgets())
-   return false;
-   return !readonly &&
+
+   return InsetParamsWidget::checkWidgets() && !readonly &&
!counterCB->currentText().isEmpty() &&
!actionCB->currentText().isEmpty() &&
!(cmdIsValue && vtypeCB->currentText().isEmpty());
diff --git a/src/frontends/qt/ui/CounterUi.ui b/src/frontends/qt/ui/CounterUi.ui
index c4b8aeb..16300a8 100644
--- a/src/frontends/qt/ui/CounterUi.ui
+++ b/src/frontends/qt/ui/CounterUi.ui
@@ -34,6 +34,9 @@
  0
 

+   
+Select counter to modify
+   
   
  
  
@@ -54,6 +57,9 @@
  0
 

+   
+SET counter value; ADD TO (or subtract from) counter value; 
RESET counter to zero; SAVE counter value; RESTORE previously saved counter 
value; DISPLAY counter value
+   
   
  
  
@@ -93,7 +99,7 @@
  
   

-Value Type:
+Display Format
 

[LyX/master] Fix typo.

2020-05-01 Thread Richard Kimberly Heck
commit 8a4bb40c7ee360c02768776654668eb5eeabfc15
Author: Richard Kimberly Heck 
Date:   Fri May 1 19:25:27 2020 -0400

Fix typo.
---
 src/insets/InsetTabular.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index dc8be28..b87ab34 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -620,7 +620,7 @@ InsetTableCell splitCell(InsetTableCell & head, docstring 
const & align_d, bool
DocIterator const dit = separatorPos(, align_d);
hassep = (bool)dit;
if (hassep) {
-   pit_type const psize = head.paragraphs().front().size();
+   pos_type const psize = head.paragraphs().front().size();
head.paragraphs().front().eraseChars(dit.pos(), psize, false);
tail.paragraphs().front().eraseChars(0,
dit.pos() < psize ? dit.pos() + 1 : psize, false);
@@ -4377,7 +4377,7 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & 
dim) const
docstring const align_d = 
tabular.column_info[c].decimal_point;
dit = separatorPos(, align_d);
 
-   pit_type const psize = 
tail.paragraphs().front().size();
+   pos_type const psize = 
tail.paragraphs().front().size();
if (dit) {
tail.paragraphs().front().eraseChars(0,
dit.pos() < psize ? dit.pos() + 
1 : psize, false);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs