[LyX/master] Fix broken mark with multiple citations

2020-05-02 Thread Juergen Spitzmueller
commit 3d630f49c44d879a0e3a9ab400c040b3c9587b97
Author: Juergen Spitzmueller 
Date:   Sat May 2 08:55:58 2020 +0200

Fix broken mark with multiple citations

Patch by Patrick De Visschere (modified by me)
---
 src/insets/InsetCitation.cpp |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 3fa8245..4d1bb68 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -369,17 +369,28 @@ docstring InsetCitation::complexLabel(bool for_xhtml) 
const
BiblioInfo const & biblist = buf.masterBibInfo();
 
// mark broken citations
-   if (biblist.empty() || biblist.find(key) == biblist.end())
-   setBroken(true);
-   else
-   setBroken(false);
+   setBroken(false);
 
-   if (biblist.empty())
+   if (biblist.empty()) {
+   setBroken(true);
return docstring();
+   }
 
if (key.empty())
return _("No citations selected!");
 
+   // check all citations
+   // we only really want the last 'false', to suppress trimming, but
+   // we need to give the other defaults, too, to set it.
+   vector keys =
+   getVectorFromString(key, from_ascii(","), false, false);
+   for (auto k : keys) {
+   if (biblist.find(k) == biblist.end()) {
+   setBroken(true);
+   break;
+   }
+   }
+   
string cite_type = getCmdName();
bool const uppercase = isUpperCase(cite_type[0]);
if (uppercase)
@@ -399,10 +410,6 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
buffer().params().documentClass().addCiteMacro("!textafter", 
to_utf8(after));
*/
docstring label;
-   // we only really want the last 'false', to suppress trimming, but
-   // we need to give the other defaults, too, to set it.
-   vector keys =
-   getVectorFromString(key, from_ascii(","), false, false);
CitationStyle cs = getCitationStyle(buffer().masterParams(),
cite_type, buffer().masterParams().citeStyles());
bool const qualified = cs.hasQualifiedList
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Perl script (for developpers) to select desired system font names.

2020-05-02 Thread Kornel Benko
commit 4d7c7f1e74387f2778f5d9ec0ee5fc23efc6d0c7
Author: Kornel Benko 
Date:   Sat May 2 13:20:53 2020 +0200

Perl script (for developpers) to select desired system font names.

Needed font-config (so that this script is probably OK on unix systems only)
Probably needed module for Getopt::Mixed.
On debian systems it is contained in package libgetopt-mixed-perl
---
 lib/scripts/GetOptions.pm   |  176 
 lib/scripts/listFontWithLang.pl |  601 +++
 2 files changed, 777 insertions(+), 0 deletions(-)

diff --git a/lib/scripts/GetOptions.pm b/lib/scripts/GetOptions.pm
new file mode 100644
index 000..81be0e5
--- /dev/null
+++ b/lib/scripts/GetOptions.pm
@@ -0,0 +1,176 @@
+#! /usr/bin/env perl
+# -*- mode: perl; -*-
+
+# file GetOptions.pm
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING
+# or at http://www.lyx.org/about/licence.php
+#
+# author Kornel Benko
+# Full author contact details are available in the file CREDITS
+# or at https://www.lyx.org/Credits
+#
+# Used as wrapper for Getopt::Mixed
+# as
+#use GetOptions;
+#...
+#my %optionsDef = (
+#...
+#);
+#my %options = %{(\%optionsDef)};
+
+package GetOptions;
+
+use strict;
+our(@EXPORT, @ISA);
+
+sub handleOptions($);
+
+BEGIN {
+  use Exporter   ();
+  @ISA= qw(Exporter);
+  @EXPORT = qw(handleOptions);
+}
+
+use warnings;
+use Getopt::Mixed;
+
+sub makeOpts();# Create option spec for Getopt::Mixed::init()
+sub makeHelp();# Create help-string to describe options
+
+# Following fields for a parameter can be defined:
+# fieldname: Name of entry in %options
+# type:  [:=][sif], ':' = optional, '=' = required, 's' = string, 
'i' = integer, 'f' = float
+# alias: reference to a list of aliases e.g. ["alias1", "alias2", 
... ]
+# listsep:   Separator for multiple data
+# comment:   Parameter description
+
+my %optionsDef = ();
+#option|param|type|aliases|comment
+my $helpFormat = "  %-8s|%-9s|%-7s|%-17s|%s\n";
+
+sub handleOptions($)
+{
+  %optionsDef = %{$_[0]};
+  $optionsDef{h}->{fieldname} = "help";
+  $optionsDef{h}->{alias} = ["help"];
+  $optionsDef{v}->{fieldname} = "verbose";
+  $optionsDef{v}->{alias} = ["verbose"];
+
+  my %options = ("help" => 0);
+  my $opts = ();
+
+  Getopt::Mixed::init($opts);
+  while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption()) {
+if (defined($optionsDef{$option})) {
+  my $fieldname = $optionsDef{$option}->{fieldname};
+  if ($option eq "h") {
+print "Syntax: $0 options  ...\n";
+print "Available options:\n";
+printf($helpFormat, "option", "param", "type", "aliases", "comment");
+print "  " . "-" x 90 . "\n";
+my $optx = ();
+print "$optx";
+$options{$fieldname} = 1;
+  }
+  else {
+if (defined($optionsDef{$option}->{listsep})) {
+  my @list = split($optionsDef{$option}->{listsep}, $value);
+  $options{$fieldname} = \@list;
+}
+else {
+  $options{$fieldname} = $value;
+}
+  }
+}
+  }
+
+  Getopt::Mixed::cleanup();
+  if (exists($options{verbose})) {
+printf("Found following options:\n%-16soptvalue\n", "option");
+print "" . "-" x 32 . "\n";
+for my $k (sort keys %options) {
+  if (defined($options{$k})) {
+printf("%-16s%s\n", $k, $options{$k});
+  }
+  else {
+print "$k\n";
+  }
+}
+  }
+  if ($options{help}) {
+exit 0;
+  }
+  return \%options;
+}
+
+#
+
+# Create option spec for Getopt::Mixed::init()
+sub makeOpts()
+{
+  my $first = 1;
+  my $opts = "";
+  for my $ex (sort keys %optionsDef) {
+my $e = $optionsDef{$ex};
+if (! $first) {
+  $opts .= " ";
+}
+$first = 0;
+$opts .= $ex;
+if (defined($e->{type})) {
+  my $tp = $e->{type};
+  $opts .= $tp;
+}
+if (defined($e->{alias})) {
+  for my $a (@{$e->{alias}}) {
+$opts .= " $a>$ex";
+  }
+}
+  }
+  return($opts);
+}
+
+# Create help-string to describe options
+sub makeHelp()
+{
+  my $opts = "";
+  my %modifier = (
+":" => "optional",
+"=" => "required",
+"s" => "string",
+"i" => "integer",
+"f" => "float",
+  );
+  for my $ex (sort keys %optionsDef) {
+my $e = $optionsDef{$ex};
+my $type = "";
+my $needed = "";
+my $partype = "";
+my $aliases = "";
+my $comment = "";
+if (defined($e->{type})) {
+  my $tp = $e->{type};
+  if ($tp =~ /^([:=])([sif])$/) {
+$needed = $modifier{$1};
+$partype = $modifier{$2};
+  }
+  else {
+print "wrong option type: $tp\n";
+exit(1);
+  }
+}
+if (defined($e->{alias})) {
+  $aliases = join(',', @{$e->{alias}});
+}
+if 

[LyX/master] Moving lib/scripts/{GetOptions.pm, listFontWithLang.pl} to development/tools

2020-05-02 Thread Kornel Benko
commit b55f735afe11b211ed601ee3373066b0d2f6b72a
Author: Kornel Benko 
Date:   Sat May 2 13:40:26 2020 +0200

Moving lib/scripts/{GetOptions.pm,listFontWithLang.pl} to development/tools
---
 development/tools/GetOptions.pm   |  176 ++
 development/tools/listFontWithLang.pl |  601 +
 lib/scripts/GetOptions.pm |  176 --
 lib/scripts/listFontWithLang.pl   |  601 -
 4 files changed, 777 insertions(+), 777 deletions(-)

diff --git a/development/tools/GetOptions.pm b/development/tools/GetOptions.pm
new file mode 100644
index 000..81be0e5
--- /dev/null
+++ b/development/tools/GetOptions.pm
@@ -0,0 +1,176 @@
+#! /usr/bin/env perl
+# -*- mode: perl; -*-
+
+# file GetOptions.pm
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING
+# or at http://www.lyx.org/about/licence.php
+#
+# author Kornel Benko
+# Full author contact details are available in the file CREDITS
+# or at https://www.lyx.org/Credits
+#
+# Used as wrapper for Getopt::Mixed
+# as
+#use GetOptions;
+#...
+#my %optionsDef = (
+#...
+#);
+#my %options = %{(\%optionsDef)};
+
+package GetOptions;
+
+use strict;
+our(@EXPORT, @ISA);
+
+sub handleOptions($);
+
+BEGIN {
+  use Exporter   ();
+  @ISA= qw(Exporter);
+  @EXPORT = qw(handleOptions);
+}
+
+use warnings;
+use Getopt::Mixed;
+
+sub makeOpts();# Create option spec for Getopt::Mixed::init()
+sub makeHelp();# Create help-string to describe options
+
+# Following fields for a parameter can be defined:
+# fieldname: Name of entry in %options
+# type:  [:=][sif], ':' = optional, '=' = required, 's' = string, 
'i' = integer, 'f' = float
+# alias: reference to a list of aliases e.g. ["alias1", "alias2", 
... ]
+# listsep:   Separator for multiple data
+# comment:   Parameter description
+
+my %optionsDef = ();
+#option|param|type|aliases|comment
+my $helpFormat = "  %-8s|%-9s|%-7s|%-17s|%s\n";
+
+sub handleOptions($)
+{
+  %optionsDef = %{$_[0]};
+  $optionsDef{h}->{fieldname} = "help";
+  $optionsDef{h}->{alias} = ["help"];
+  $optionsDef{v}->{fieldname} = "verbose";
+  $optionsDef{v}->{alias} = ["verbose"];
+
+  my %options = ("help" => 0);
+  my $opts = ();
+
+  Getopt::Mixed::init($opts);
+  while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption()) {
+if (defined($optionsDef{$option})) {
+  my $fieldname = $optionsDef{$option}->{fieldname};
+  if ($option eq "h") {
+print "Syntax: $0 options  ...\n";
+print "Available options:\n";
+printf($helpFormat, "option", "param", "type", "aliases", "comment");
+print "  " . "-" x 90 . "\n";
+my $optx = ();
+print "$optx";
+$options{$fieldname} = 1;
+  }
+  else {
+if (defined($optionsDef{$option}->{listsep})) {
+  my @list = split($optionsDef{$option}->{listsep}, $value);
+  $options{$fieldname} = \@list;
+}
+else {
+  $options{$fieldname} = $value;
+}
+  }
+}
+  }
+
+  Getopt::Mixed::cleanup();
+  if (exists($options{verbose})) {
+printf("Found following options:\n%-16soptvalue\n", "option");
+print "" . "-" x 32 . "\n";
+for my $k (sort keys %options) {
+  if (defined($options{$k})) {
+printf("%-16s%s\n", $k, $options{$k});
+  }
+  else {
+print "$k\n";
+  }
+}
+  }
+  if ($options{help}) {
+exit 0;
+  }
+  return \%options;
+}
+
+#
+
+# Create option spec for Getopt::Mixed::init()
+sub makeOpts()
+{
+  my $first = 1;
+  my $opts = "";
+  for my $ex (sort keys %optionsDef) {
+my $e = $optionsDef{$ex};
+if (! $first) {
+  $opts .= " ";
+}
+$first = 0;
+$opts .= $ex;
+if (defined($e->{type})) {
+  my $tp = $e->{type};
+  $opts .= $tp;
+}
+if (defined($e->{alias})) {
+  for my $a (@{$e->{alias}}) {
+$opts .= " $a>$ex";
+  }
+}
+  }
+  return($opts);
+}
+
+# Create help-string to describe options
+sub makeHelp()
+{
+  my $opts = "";
+  my %modifier = (
+":" => "optional",
+"=" => "required",
+"s" => "string",
+"i" => "integer",
+"f" => "float",
+  );
+  for my $ex (sort keys %optionsDef) {
+my $e = $optionsDef{$ex};
+my $type = "";
+my $needed = "";
+my $partype = "";
+my $aliases = "";
+my $comment = "";
+if (defined($e->{type})) {
+  my $tp = $e->{type};
+  if ($tp =~ /^([:=])([sif])$/) {
+$needed = $modifier{$1};
+$partype = $modifier{$2};
+  }
+  else {
+print "wrong option type: $tp\n";
+exit(1);
+  }
+}
+if (defined($e->{alias})) {
+  $aliases = join(',', @{$e->{alias}});
+}
+if (defined($e->{comment})) {
+  $comment = 

[LyX/master] Use GuiNames for counters.

2020-05-02 Thread Richard Kimberly Heck
commit 666f90cdbb15b33d2f3f0b643e3bd66512f7b852
Author: Richard Kimberly Heck 
Date:   Sat May 2 23:00:17 2020 -0400

Use GuiNames for counters.
---
 src/Counters.cpp|   24 +++-
 src/Counters.h  |6 ++
 src/frontends/qt/GuiCounter.cpp |   15 +--
 3 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/src/Counters.cpp b/src/Counters.cpp
index 830c7e0..42e10e8 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -56,12 +56,14 @@ bool Counter::read(Lexer & lex)
CT_LABELSTRING_APPENDIX,
CT_PRETTYFORMAT,
CT_INITIALVALUE,
+   CT_GUINAME,
CT_END
};
 
LexerKeyword counterTags[] = {
{ "end", CT_END },
- { "initialvalue", CT_INITIALVALUE},
+   { "guiname", CT_GUINAME },
+   { "initialvalue", CT_INITIALVALUE},
{ "labelstring", CT_LABELSTRING },
{ "labelstringappendix", CT_LABELSTRING_APPENDIX },
{ "prettyformat", CT_PRETTYFORMAT },
@@ -112,6 +114,10 @@ bool Counter::read(Lexer & lex)
lex.next();
labelstringappendix_ = lex.getDocString();
break;
+   case CT_GUINAME:
+   lex.next();
+   guiname_ = lex.getDocString();
+   break;
case CT_END:
getout = true;
break;
@@ -349,6 +355,22 @@ void Counters::step(docstring const & ctr, UpdateType 
utype)
 }
 
 
+docstring const & Counters::guiName(docstring const & cntr) const
+{
+   CounterList::const_iterator it = counterList_.find(cntr);
+   if (it == counterList_.end()) {
+   lyxerr << "step: Counter does not exist: "
+  << to_utf8(cntr) << endl;
+   return empty_docstring();
+   }
+
+   docstring const & guiname = it->second.guiName();
+   if (guiname.empty())
+   return cntr;
+   return guiname;
+}
+
+
 void Counters::reset()
 {
appendix_ = false;
diff --git a/src/Counters.h b/src/Counters.h
index 77e1f11..92643c1 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -67,6 +67,8 @@ public:
/// Similar, but used for formatted references in XHTML output.
/// E.g., for a section counter it might be "section \thesection"
docstring const & prettyFormat() const { return prettyformat_; }
+   ///
+   docstring const & guiName() const { return guiname_; }
 
/// Returns a map of LaTeX-like strings to format the counter.
/** For each language, the string is similar to what one gets
@@ -97,6 +99,8 @@ private:
docstring labelstringappendix_;
/// Similar, but used for formatted references in XHTML output
docstring prettyformat_;
+   ///
+   docstring guiname_;
/// Cache of the labelstring with \\the expressions expanded,
/// indexed by language
mutable StringMap flatlabelstring_;
@@ -174,6 +178,8 @@ public:
/// format given by Counter::prettyFormat().
docstring prettyCounter(docstring const & cntr,
   std::string const & lang) const;
+   ///
+   docstring const & guiName(docstring const & cntr) const;
/// Are we in appendix?
bool appendix() const { return appendix_; }
/// Set the state variable indicating whether we are in appendix.
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index c3e3265..9b8fbb6 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -59,7 +59,7 @@ GuiCounter::GuiCounter(GuiView & lv, QWidget * parent) :
 void GuiCounter::processParams(InsetCommandParams const & params)
 {
QString const & counter = toqstr(params["counter"]);
-   int c = counterCB->findText(counter);
+   int c = counterCB->findData(counter);
counterCB->setCurrentIndex(c);
 
QString cmd = toqstr(params.getCmdName());
@@ -85,10 +85,13 @@ void GuiCounter::fillCombos()
if (!bv)
return;

-   std::vector counts = 
-   
bv->buffer().params().documentClass().counters().listOfCounters();
-   for (auto const & c : counts)
-   counterCB->addItem(toqstr(c));
+   Counters const & cntrs =
+   bv->buffer().params().documentClass().counters();
+   std::vector counts = cntrs.listOfCounters();
+   for (auto const & c : counts) {
+   docstring const & guiname = cntrs.guiName(c);
+   counterCB->addItem(toqstr(guiname), toqstr(c));
+   }
 }
 
 
@@ -118,7 +121,7 @@ docstring GuiCounter::dialogToParams() const
 {
InsetCommandParams params(insetCode());
 
-   params["counter"] = 

[LyX/master] Add GuiNames to counter declarations.

2020-05-02 Thread Richard Kimberly Heck
commit a7e26710cbc91353c417fc8ce30c6b1565958b32
Author: Richard Kimberly Heck 
Date:   Sat May 2 22:37:18 2020 -0400

Add GuiNames to counter declarations.
---
 lib/layouts/AEA.layout |4 
 lib/layouts/IEEEtran.layout|1 +
 lib/layouts/aastex62.layout|3 +++
 lib/layouts/acmart.layout  |1 +
 lib/layouts/agu_stdcounters.inc|6 ++
 lib/layouts/aguplus.inc|2 ++
 lib/layouts/broadway.layout|2 ++
 lib/layouts/copernicus.layout  |3 +++
 lib/layouts/db_stdcounters.inc |5 +
 lib/layouts/ectaart.layout |1 +
 lib/layouts/elsart.layout  |3 +++
 lib/layouts/endnotes.module|1 +
 lib/layouts/enotez.module  |1 +
 lib/layouts/eqs-within-sections.module |1 +
 lib/layouts/ijmpc.layout   |2 ++
 lib/layouts/ijmpd.layout   |   10 ++
 lib/layouts/knitr.module   |1 +
 lib/layouts/linguistics.module |3 +++
 lib/layouts/litinsets.inc  |1 +
 lib/layouts/memoir.layout  |1 +
 lib/layouts/numarticle.inc |1 +
 lib/layouts/numreport.inc  |4 
 lib/layouts/powerdot.layout|8 
 lib/layouts/scrbook.layout |1 +
 lib/layouts/scrclass.inc   |1 +
 lib/layouts/stdcounters.inc|   16 
 lib/layouts/svmono.layout  |   14 ++
 lib/layouts/sweave.module  |1 +
 lib/layouts/theorems-ams-bytype.inc|   13 +
 lib/layouts/theorems-ams-bytype.module |   13 +
 lib/layouts/theorems-ams-chap-bytype.inc   |   13 +
 lib/layouts/theorems-ams-chap-bytype.module|   13 +
 lib/layouts/theorems-ams-extended-bytype.module|   11 +++
 .../theorems-ams-extended-chap-bytype.module   |   11 +++
 lib/layouts/theorems-ams.module|1 +
 lib/layouts/theorems-bytype.module |   13 +
 lib/layouts/theorems-case.inc  |4 
 lib/layouts/theorems-chap-bytype.module|   12 
 lib/layouts/theorems-chap.module   |1 +
 lib/layouts/theorems-sec-bytype.module |   12 
 lib/layouts/theorems-sec.module|1 +
 lib/layouts/theorems-std.module|1 +
 lib/layouts/theorems-without-preamble.inc  |   18 ++
 lib/layouts/tufte-book.layout  |2 ++
 44 files changed, 237 insertions(+), 0 deletions(-)

diff --git a/lib/layouts/AEA.layout b/lib/layouts/AEA.layout
index 2fd4514..a83684d 100644
--- a/lib/layouts/AEA.layout
+++ b/lib/layouts/AEA.layout
@@ -314,10 +314,14 @@ Style Proof
 End
 
 Counter case
+   GuiName Case
 End
 Counter remark
+   GuiName Remark
 End
 Counter summary
+   GuiName Summary
 End
 Counter solution
+   GuiName Solution
 End
diff --git a/lib/layouts/IEEEtran.layout b/lib/layouts/IEEEtran.layout
index d0c5ca2..4d5c0c4 100644
--- a/lib/layouts/IEEEtran.layout
+++ b/lib/layouts/IEEEtran.layout
@@ -45,6 +45,7 @@ Style Standard
 End
 
 Countertheorem
+   GuiName Theorem
 End
 
 Input stdcounters.inc
diff --git a/lib/layouts/aastex62.layout b/lib/layouts/aastex62.layout
index 01a1b8e..83a1758 100644
--- a/lib/layouts/aastex62.layout
+++ b/lib/layouts/aastex62.layout
@@ -224,6 +224,7 @@ Style Acknowledgements
 End
 
 Counter appendix
+   GuiName Appendix
Within  "none"
 End
 
@@ -239,6 +240,7 @@ Style Section_Appendix
 End
 
 Counter subappendix
+   GuiName Subappendix
Within  "appendix"
 End
 
@@ -254,6 +256,7 @@ Style Subsection_Appendix
 End
 
 Counter subsubappendix
+   GuiName Subsubappendix
Within  subappendix
 End
 
diff --git a/lib/layouts/acmart.layout b/lib/layouts/acmart.layout
index f76c1c5..d5da691 100644
--- a/lib/layouts/acmart.layout
+++ b/lib/layouts/acmart.layout
@@ -539,6 +539,7 @@ End
 OutlinerName thm "Definitions & Theorems"
 
 Counter theorem
+   GuiName Theorem
Withinsection
 End
 
diff --git a/lib/layouts/agu_stdcounters.inc b/lib/layouts/agu_stdcounters.inc
index f52bc2f..c2c863e 100644
--- a/lib/layouts/agu_stdcounters.inc
+++ b/lib/layouts/agu_stdcounters.inc
@@ -6,24 +6,30 @@
 
 Format 80
 Counter sect1
+   GuiName "Section Level 1"
Within   section
 End
 
 Counter sect2
+   

[LyX/master] GuiNames for float counters.

2020-05-02 Thread Richard Kimberly Heck
commit 0f4b60c642fe891037b2b1af72047e84b12a6b05
Author: Richard Kimberly Heck 
Date:   Sat May 2 23:11:53 2020 -0400

GuiNames for float counters.
---
 src/Counters.cpp  |   10 ++
 src/Counters.h|5 +++--
 src/TextClass.cpp |8 +---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/Counters.cpp b/src/Counters.cpp
index 42e10e8..15cede1 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -41,8 +41,9 @@ Counter::Counter()
 
 
 Counter::Counter(docstring const & mc, docstring const & ls,
-docstring const & lsa)
-   : initial_value_(0), master_(mc), labelstring_(ls), 
labelstringappendix_(lsa)
+   docstring const & lsa, docstring const & guiname)
+   : initial_value_(0), master_(mc), labelstring_(ls),
+ labelstringappendix_(lsa), guiname_(guiname)
 {
reset();
 }
@@ -211,7 +212,8 @@ Counters::Counters() : appendix_(false), subfloat_(false), 
longtable_(false)
 void Counters::newCounter(docstring const & newc,
  docstring const & masterc,
  docstring const & ls,
- docstring const & lsa)
+ docstring const & lsa,
+ docstring const & guiname)
 {
if (!masterc.empty() && !hasCounter(masterc)) {
lyxerr << "Master counter does not exist: "
@@ -219,7 +221,7 @@ void Counters::newCounter(docstring const & newc,
   << endl;
return;
}
-   counterList_[newc] = Counter(masterc, ls, lsa);
+   counterList_[newc] = Counter(masterc, ls, lsa, guiname);
 }
 
 
diff --git a/src/Counters.h b/src/Counters.h
index 92643c1..ffc091b 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -35,7 +35,7 @@ public:
Counter();
///
Counter(docstring const & mc, docstring const & ls,
-   docstring const & lsa);
+   docstring const & lsa, docstring const & guiname);
/// \return true on success
bool read(Lexer & lex);
///
@@ -124,7 +124,8 @@ public:
void newCounter(docstring const & newc,
docstring const & masterc,
docstring const & ls,
-   docstring const & lsa);
+   docstring const & lsa,
+   docstring const & guiname);
/// Checks whether the given counter exists.
bool hasCounter(docstring const & c) const;
/// reads the counter name
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index c8fbfaf..c34f5ca 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -913,7 +913,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, 
ReadType rt)
// If we do not succeed, then it was not there, which means that
// the textclass did not provide the definitions of the standard
// insets. So we need to try to load them.
-   int erased = provides_.erase("stdinsets");
+   size_type const erased = provides_.erase("stdinsets");
if (!erased) {
FileName tmp = libFileSearch("layouts", "stdinsets.inc");
 
@@ -1569,11 +1569,13 @@ bool TextClass::readFloat(Lexer & lexrc)
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
- docstring(), docstring());
+   docstring(), docstring(),
+   bformat(_("%1$s (Float)"), from_ascii(name)));
// also define sub-float counters
docstring const subtype = "sub-" + from_ascii(type);
counters_.newCounter(subtype, from_ascii(type),
- "\\alph{" + subtype + "}", docstring());
+   "\\alph{" + subtype + "}", docstring(),
+bformat(_("Sub-%1$s (Float)"), 
from_ascii(name)));
}
return getout;
 }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] More polishing of counter dialog. Thanks to Jürgen for help.

2020-05-02 Thread Richard Kimberly Heck
commit c37500050d267177ace194ba8a95f67c6b0f15c2
Author: Richard Kimberly Heck 
Date:   Sat May 2 20:33:03 2020 -0400

More polishing of counter dialog. Thanks to Jürgen for help.

Also, remove the 'display value' option. We will move this to InsetInfo
at some point.
---
 lib/lyx2lyx/lyx_2_4.py   |6 --
 src/frontends/qt/GuiCounter.cpp  |   25 +-
 src/frontends/qt/ui/CounterUi.ui |  107 +-
 src/insets/InsetCounter.cpp  |   79 ++--
 src/insets/InsetCounter.h|2 -
 5 files changed, 76 insertions(+), 143 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index 98173df..d32ff79 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -3730,12 +3730,6 @@ def revert_counter_inset(document):
 ert = put_cmd_in_ert("\\addtocounter{%s}{%s}" % (cnt, val))
 elif cmd == "reset":
 ert = put_cmd_in_ert("\\setcounter{%s}{0}" % (cnt))
-elif cmd == "value":
-vty = get_quoted_value(document.body, "vtype", i, j)
-if not vty:
-document.warning("Can't convert counter inset at line %d!" % i)
-else:
-ert = put_cmd_in_ert("\\%s{%s}" % (vty, cnt))
 elif cmd == "save":
 needed_counters[cnt] = 1
 savecnt = "LyXSave" + cnt
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index 6deed4b..c3e3265 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -42,8 +42,6 @@ GuiCounter::GuiCounter(GuiView & lv, QWidget * parent) :
this, SIGNAL(changed()));
connect(valueSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
-   connect(vtypeCB, SIGNAL(currentIndexChanged(int)),
-   this, SIGNAL(changed()));
connect(lyxonlyXB, SIGNAL(clicked()),
this, SIGNAL(changed()));
 
@@ -55,15 +53,6 @@ GuiCounter::GuiCounter(GuiView & lv, QWidget * parent) :
docstring guistring = translateIfPossible(from_ascii(c.second));
actionCB->addItem(toqstr(guistring), toqstr(c.first));
}
-
-   std::map const & vt =
-   InsetCounter::valueTable;
-   vtypeCB->clear();
-   vtypeCB->addItem("", "");
-   for (auto const & v : vt) {
-   docstring guistring = translateIfPossible(from_ascii(v.second));
-   vtypeCB->addItem(toqstr(guistring), toqstr(v.first));
-   }
 }
 
 
@@ -84,13 +73,6 @@ void GuiCounter::processParams(InsetCommandParams const & 
params)
int val = convert(params["value"]);
valueSB->setValue(val);
 
-   cmd = toqstr(params["vtype"]);
-   c = cmd.isEmpty() ? 0 : vtypeCB->findData(cmd);
-   if (c < 0) {
-   c = 0;
-   LYXERR0("Unable to find " << cmd << " in GuiCounter!");
-   }
-   vtypeCB->setCurrentIndex(c);
lyxonlyXB->setChecked(support::lowercase(params["lyxonly"]) == "true");
 }
 
@@ -139,7 +121,6 @@ docstring GuiCounter::dialogToParams() const
params["counter"] = qstring_to_ucs4(counterCB->currentText());
params["value"] = convert(valueSB->value());

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,7 +128,6 @@ docstring GuiCounter::dialogToParams() const
 
 bool GuiCounter::checkWidgets(bool readonly) const
 {
-   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);
@@ -157,13 +137,10 @@ bool GuiCounter::checkWidgets(bool readonly) const
valueSB->setRange(-1, 1);
else
valueSB->setRange(0, 1);
-   vtypeLA->setEnabled(!readonly && cmdIsValue);
-   vtypeCB->setEnabled(!readonly && cmdIsValue);
 
return InsetParamsWidget::checkWidgets() && !readonly &&
!counterCB->currentText().isEmpty() &&
-   !actionCB->currentText().isEmpty() &&
-   !(cmdIsValue && vtypeCB->currentText().isEmpty());
+   !actionCB->currentText().isEmpty();
 }
 
 
diff --git a/src/frontends/qt/ui/CounterUi.ui b/src/frontends/qt/ui/CounterUi.ui
index 16300a8..72370d2 100644
--- a/src/frontends/qt/ui/CounterUi.ui
+++ b/src/frontends/qt/ui/CounterUi.ui
@@ -13,10 +13,10 @@
   

   
-  
-   
-
- 
+  
+   
+
+ 
   

 Counter:

[LyX/master] Increment layout format.

2020-05-02 Thread Richard Kimberly Heck
commit 9bcb243ec65fe3af355d0e3ed8b61ab823f8afe5
Author: Richard Kimberly Heck 
Date:   Sat May 2 23:14:19 2020 -0400

Increment layout format.
---
 lib/scripts/layout2layout.py |7 +--
 src/TextClass.cpp|2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 333ef1b..5b7b4ff 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 80
+currentFormat = 81
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -268,6 +268,9 @@ currentFormat = 80
 # Incremented to format 80, 12 August 2019 by spitz
 # New float option Requires
 
+# Incremented to format 80, 12 August 2019 by rikiheck
+# New tag GuiName for counters
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -517,7 +520,7 @@ def convert(lines, end_format):
 i += 1
 continue
 
-if format >= 65 and format <= 79:
+if format >= 65 and format <= 80:
 # nothing to do.
 i += 1
 continue
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 4058815..c8fbfaf 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -62,7 +62,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 80; // spitz: Requires for floats
+int const LAYOUT_FORMAT = 81; // rikiheck: GuiName for counters
 
 
 // Layout format for the current lyx file format. Controls which format is
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Somehow this got corrupted...

2020-05-02 Thread Richard Kimberly Heck
commit 32a5436108f49a2fd7815f7c41f4957faff0e3e4
Author: Richard Kimberly Heck 
Date:   Sat May 2 22:05:02 2020 -0400

Somehow this got corrupted...
---
 lib/layouts/agu_stdcounters.inc |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/layouts/agu_stdcounters.inc b/lib/layouts/agu_stdcounters.inc
index 4063576..f52bc2f 100644
--- a/lib/layouts/agu_stdcounters.inc
+++ b/lib/layouts/agu_stdcounters.inc
@@ -25,5 +25,5 @@ Counter sect5
Within   sect4
 End
 
-Counter p
+Counter para
 End
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Remove unused counter

2020-05-02 Thread Richard Kimberly Heck
commit 6580c5753dea88ac7de6058923870193e7a77fa9
Author: Richard Kimberly Heck 
Date:   Sat May 2 22:09:45 2020 -0400

Remove unused counter
---
 lib/layouts/linguistics.module |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/lib/layouts/linguistics.module b/lib/layouts/linguistics.module
index 959eca9..359c500 100644
--- a/lib/layouts/linguistics.module
+++ b/lib/layouts/linguistics.module
@@ -29,11 +29,6 @@ Counter subexample
LabelString  "\theexamplei (\alph{subexample})"
 End
 
-Counter subexamplei
-   Within   examplei
-   LabelString  "\theexamplei (\alph{subexamplei})"
-End
-
 
 #
 # Numbered Examples
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Remove obsolete comment.

2020-05-02 Thread Richard Kimberly Heck
commit a38408419c613674f1538b77429dd7bd4463dc3a
Author: Richard Kimberly Heck 
Date:   Sun May 3 00:50:53 2020 -0400

Remove obsolete comment.

We assert (or worse) if pos < 0.
---
 src/Paragraph.h |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/Paragraph.h b/src/Paragraph.h
index d5c02e4..3b5f2b8 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -341,12 +341,8 @@ public:
///
Font const & getFirstFontSettings(BufferParams const &) const;
 
-   /** Get fully instantiated font. If pos == -1, use the layout
-   font attached to this paragraph.
-   If pos == -2, use the label font of the layout attached here.
-   In all cases, the font is instantiated, i.e. does not have any
-   attributes with values FONT_INHERIT, FONT_IGNORE or
-   FONT_TOGGLE.
+   /** Get fully instantiated font, i.e., one that does not have any
+   attributes with values FONT_INHERIT, FONT_IGNORE or FONT_TOGGLE.
*/
Font const getFont(BufferParams const &, pos_type pos,
  Font const & outerfont) const;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs