[LyX/master] Fix typo (spotted by Kornel)

2025-02-21 Thread Juergen Spitzmueller
commit f2275a0990669d4432fcb3db85ca16a31e11cdd2
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 15:24:29 2025 +0100

Fix typo (spotted by Kornel)
---
 src/frontends/qt/ui/ColorUi.ui | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt/ui/ColorUi.ui b/src/frontends/qt/ui/ColorUi.ui
index 976336a23d..5ababa0846 100644
--- a/src/frontends/qt/ui/ColorUi.ui
+++ b/src/frontends/qt/ui/ColorUi.ui
@@ -470,7 +470,7 @@
 
  
   
-   Enter the name of the desired color (only ASCII characters 
ans no space allowed) and hit "Add"
+   Enter the name of the desired color (only ASCII characters 
and no space allowed) and hit "Add"
   
  
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] We don't need the whole params, just the custom colors

2025-02-21 Thread Juergen Spitzmueller
commit 87bdf11a28ffa38ef186a995754853b60a4c9386
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 16:01:13 2025 +0100

We don't need the whole params, just the custom colors
---
 src/frontends/qt/ColorsCombo.cpp  | 7 +++
 src/frontends/qt/ColorsCombo.h| 4 ++--
 src/frontends/qt/GuiCharacter.cpp | 4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt/ColorsCombo.cpp b/src/frontends/qt/ColorsCombo.cpp
index 6bcb6110a0..2fb0798a76 100644
--- a/src/frontends/qt/ColorsCombo.cpp
+++ b/src/frontends/qt/ColorsCombo.cpp
@@ -28,7 +28,6 @@ namespace frontend {
 
 ColorsCombo::ColorsCombo(QWidget * parent)
: CategorizedCombo(parent),
- params_(BufferParams()),
  has_ignore_(false), has_inherit_(false)
 {
setLeftMargin(32);
@@ -99,9 +98,9 @@ void ColorsCombo::addItemSort(QString const & item, QString 
const & guiname,
 }
 
 
-void ColorsCombo::setBufferParams(BufferParams const params)
+void ColorsCombo::setCustomColors(std::map const 
custom_colors)
 {
-   params_ = params;
+   custom_colors_ = custom_colors;
fillComboColor();
 }
 
@@ -119,7 +118,7 @@ void ColorsCombo::fillComboColor()
addItemSort(QString("inherit"), qt_("(Without)[[color]]"),
QString());
// now custom colors
-   for (auto const & lc : params_.custom_colors) {
+   for (auto const & lc : custom_colors_) {
QString const lyxname = toqstr(lc.first);
QString const guiname = toqstr(lc.first);
QString const category = qt_("Custom Colors");
diff --git a/src/frontends/qt/ColorsCombo.h b/src/frontends/qt/ColorsCombo.h
index 6f7d443d9e..085fcfa922 100644
--- a/src/frontends/qt/ColorsCombo.h
+++ b/src/frontends/qt/ColorsCombo.h
@@ -39,7 +39,7 @@ public:
void addItemSort(QString const & item, QString const & guiname,
 QString const & category, QString color = QString());
/// Set BufferParams to access custom colors
-   void setBufferParams(BufferParams const params);
+   void setCustomColors(std::map const 
custom_colors);
/// Add "ignore" color entry?
void hasIgnore(bool const b) { has_ignore_ = b; }
/// Add "inherit" color entry?
@@ -51,7 +51,7 @@ private:
///
void fillComboColor();
///
-   BufferParams params_;
+   std::map custom_colors_;
///
bool has_ignore_;
///
diff --git a/src/frontends/qt/GuiCharacter.cpp 
b/src/frontends/qt/GuiCharacter.cpp
index 980f852083..c3d01c36ec 100644
--- a/src/frontends/qt/GuiCharacter.cpp
+++ b/src/frontends/qt/GuiCharacter.cpp
@@ -201,7 +201,7 @@ GuiCharacter::GuiCharacter(GuiView & lv)
fillCombo(langCO, language);
colorCO->hasIgnore(true);
colorCO->hasInherit(true);
-   colorCO->setBufferParams(buffer().masterParams());
+   colorCO->setCustomColors(buffer().masterParams().custom_colors);
custom_colors_cache_ = buffer().masterParams().custom_colors;
 
colorCO->setToolTip(qt_("You can also directly type on the list to 
filter on color names."));
@@ -489,7 +489,7 @@ void GuiCharacter::updateContents()
 
// Update custom colors if needed
if (custom_colors_cache_ != buffer().masterParams().custom_colors) {
-   colorCO->setBufferParams(buffer().masterParams());
+   colorCO->setCustomColors(buffer().masterParams().custom_colors);
custom_colors_cache_ = buffer().masterParams().custom_colors;
}
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] We don't need the whole params, just the custom colors

2025-02-21 Thread Juergen Spitzmueller
commit dbfa9e7c43ee9bafc269299bb4ae540b16680998
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 16:01:13 2025 +0100

We don't need the whole params, just the custom colors
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Auto-open color dialog when new custom color is added

2025-02-21 Thread Juergen Spitzmueller
commit 565756e2d6e9ddae625d7728967cb0c51c542001
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 16:22:38 2025 +0100

Auto-open color dialog when new custom color is added
---
 src/frontends/qt/GuiDocument.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 04862a6615..f20caa795c 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -5745,6 +5745,16 @@ void GuiDocument::addCustomColor()
custom_colors_[new_color] = toqstr("#ffbfbf");
colorModule->newColorLE->clear();
updateCustomColors();
+   // select new color
+   QList twis =
+   
colorModule->customColorsTW->findItems(new_color, Qt::MatchExactly);
+   if (!twis.empty()) {
+   QTreeWidgetItem * item = twis.first();
+   colorModule->customColorsTW->setCurrentItem(item);
+   item->setSelected(true);
+   }
+   // and open color dialog
+   alterCustomColor();
}
 }
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] tex2lyx: fix assertion if no argument

2025-02-21 Thread Scott Kostyshak
commit a02ab22c4a8ca407251f1a57e0c66450ffdf9e94
Author: Scott Kostyshak 
Date:   Fri Feb 21 23:05:09 2025 +0100

tex2lyx: fix assertion if no argument

If no argument, show usage output and exit with error.

Since 2e45185c, exiting is handled inside the function that gives
the error message. Since a5115d4e, we have separate helper functions
to (1) display debug output without exiting and to (2) display an
error message and exit. This present commit changes the case of
having no argument from category (1) to (2).

Issue reported on the ML here:

  
https://www.mail-archive.com/search?l=mid&q=vpam5l%24na2%241%40ciao.gmane.io
---
 src/tex2lyx/tex2lyx.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 21301034aa..9abb491785 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -1157,7 +1157,7 @@ int TeX2LyXApp::run()
easyParse();
 
if (argc_ <= 1)
-   error_message("Not enough arguments.");
+   error_with_message("Not enough arguments.");
 
try {
init_package(internal_path(os::utf8_argv(0)),
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Whitespace

2025-02-21 Thread Scott Kostyshak
commit ca5a93d9963c630ff990198ce19051b4f8162723
Author: Scott Kostyshak 
Date:   Fri Feb 21 23:16:18 2025 +0100

Whitespace
---
 src/tex2lyx/tex2lyx.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 9abb491785..663c0bb2e7 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -440,9 +440,9 @@ bool checkModule(string const & name, bool command)
if (found_module.empty()) {
// take one of the second row
if (!potential_modules.empty())
-   found_module = potential_modules.front();  
+   found_module = potential_modules.front();
}
-   
+
if (!found_module.empty()) {
vector v;
LayoutModuleList mods;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Add dedicated ColorsCombo, subclassed from CategorizedCombo

2025-02-21 Thread Juergen Spitzmueller
commit 2c1b49b450a6d91d891d48206766eedb2a85d0fe
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 11:00:57 2025 +0100

Add dedicated ColorsCombo, subclassed from CategorizedCombo

We will need this sort of combo in several places, provide it with
colors filled and all
---
 src/frontends/qt/CategorizedCombo.cpp |  60 -
 src/frontends/qt/CategorizedCombo.h   |  10 ++-
 src/frontends/qt/ColorsCombo.cpp  | 156 ++
 src/frontends/qt/ColorsCombo.h|  65 ++
 src/frontends/qt/GuiCharacter.cpp |  57 +++--
 src/frontends/qt/GuiCharacter.h   |   4 +-
 src/frontends/qt/Makefile.am  |   2 +
 src/frontends/qt/ui/CharacterUi.ui|   6 +-
 8 files changed, 264 insertions(+), 96 deletions(-)

diff --git a/src/frontends/qt/CategorizedCombo.cpp 
b/src/frontends/qt/CategorizedCombo.cpp
index 106c901d94..4200ddafab 100644
--- a/src/frontends/qt/CategorizedCombo.cpp
+++ b/src/frontends/qt/CategorizedCombo.cpp
@@ -91,13 +91,11 @@ struct CategorizedCombo::Private
// 2nd: raw names
// 3rd: category
// 4th: availability (bool)
-   // 5th: color
-   model_(new QStandardItemModel(0, 5, p)),
+   model_(new QStandardItemModel(0, 4, p)),
filterModel_(new CCFilterModel(p)),
lastSel_(-1),
CCItemDelegate_(new CCItemDelegate(parent)),
-   visibleCategories_(0), inShowPopup_(false),
-   has_colors_(false)
+   visibleCategories_(0), inShowPopup_(false)
{
filterModel_->setSourceModel(model_);
}
@@ -115,7 +113,6 @@ struct CategorizedCombo::Private
 * 2nd column: raw item name,
 * 3rd column: category,
 * 4th column: availability
-* 5th column: color
**/
QStandardItemModel * model_;
/// the proxy model filtering \c model_
@@ -130,8 +127,6 @@ struct CategorizedCombo::Private
unsigned visibleCategories_;
///
bool inShowPopup_;
-   ///
-   bool has_colors_;
 };
 
 
@@ -141,12 +136,6 @@ static QString categoryCC(QAbstractItemModel const & 
model, int row)
 }
 
 
-static QString colorCC(QAbstractItemModel const & model, int row)
-{
-   return model.data(model.index(row, 4), Qt::DisplayRole).toString();
-}
-
-
 static int headerHeightCC(QStyleOptionViewItem const & opt)
 {
return opt.fontMetrics.height();
@@ -162,7 +151,6 @@ void CCItemDelegate::paint(QPainter * painter, 
QStyleOptionViewItem const & opti
painter->fillRect(opt.rect, opt.palette.color(QPalette::Base));
 
QString cat = categoryCC(*index.model(), index.row());
-   QString col = colorCC(*index.model(), index.row());
 
// not the same as in the previous line?
if (cc_->d->visibleCategories_ > 0
@@ -211,8 +199,8 @@ void CCItemDelegate::drawDisplay(QPainter * painter, 
QStyleOptionViewItem const
 
QTextFrameFormat fmt = doc.rootFrame()->frameFormat();
fmt.setMargin(0);
-   if (cc_->d->has_colors_)
-   fmt.setLeftMargin (34);
+   if (cc_->left_margin_ != -1)
+   fmt.setLeftMargin(cc_->left_margin_);

doc.rootFrame()->setFrameFormat(fmt);
 
@@ -474,7 +462,7 @@ bool CategorizedCombo::set(QString const & item, bool const 
report_missing)
QList r = d->model_->findItems(item, Qt::MatchExactly, 
1);
if (r.empty()) {
if (report_missing)
-   LYXERR0("Trying to select non existent layout type " << 
item);
+   LYXERR0("Trying to select non existent entry " << item);
return false;
}
 
@@ -483,27 +471,10 @@ bool CategorizedCombo::set(QString const & item, bool 
const report_missing)
 }
 
 
-void CategorizedCombo::setColorIcon(int const i, QString const color)
-{
-   if (color.isEmpty())
-   return;
-
-   QPixmap pixmap(32, 20);
-   QColor col(color);
-   pixmap.fill(col);
-   QPainter painter(&pixmap);
-   QRect pixmapRect = QRect(0, 0, 31, 19);
-   painter.drawPixmap(pixmapRect.x(), pixmapRect.y(), pixmap);
-   painter.drawRect(pixmapRect);
-
-   setItemIcon(i, QIcon(pixmap));
-}
-
-
 void CategorizedCombo::addItemSort(QString const & item, QString const & 
guiname,
   QString const & category, QString const & 
tooltip,
   bool sorted, bool sortedByCat, bool sortCats,
-  bool available, bool nocategories, QString 
const color)
+  bool available, bool nocategories)
 {
QString titem = available ? guiname
  : toqstr(bformat(_("Unavailable: %1$s"),
@@ -519,16 +490,11 @@ void CategorizedCombo::addItemSort(QString const & item, 
QString const & guiname
row.append(new QStandardItem(item));
  

[LyX/master] Fix sorting in ColorsCombo

2025-02-21 Thread Juergen Spitzmueller
commit 9cabc3f36aba1dd22e2c825ec68240d24be79ed4
Author: Juergen Spitzmueller 
Date:   Fri Feb 21 13:19:33 2025 +0100

Fix sorting in ColorsCombo
---
 src/frontends/qt/ColorsCombo.cpp | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/frontends/qt/ColorsCombo.cpp b/src/frontends/qt/ColorsCombo.cpp
index 6517f58500..6bcb6110a0 100644
--- a/src/frontends/qt/ColorsCombo.cpp
+++ b/src/frontends/qt/ColorsCombo.cpp
@@ -61,7 +61,6 @@ void ColorsCombo::addItemSort(QString const & item, QString 
const & guiname,
  QString const & category, QString const color)
 {
QString titem = guiname;
-   bool const uncategorized = category.isEmpty();
 
QList row;
QStandardItem * gui = new QStandardItem(titem);
@@ -83,10 +82,7 @@ void ColorsCombo::addItemSort(QString const & item, QString 
const & guiname,
// find category
int i = 0;
// Sort categories alphabetically, uncategorized at the end.
-   while (i < end && model()->item(i, 2)->text() != category
-  && ((!uncategorized && model()->item(i, 
2)->text().localeAwareCompare(category) < 0
-  && model()->item(i, 2)->text() != qt_("Uncategorized"))
-  || (uncategorized && model()->item(i, 2)->text() != 
qt_("Uncategorized"
+   while (i < end && model()->item(i, 2)->text() != category)
++i;
 
// find row to insert the item, after the separator if it exists
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Fix make check for autotools

2025-02-21 Thread Pavel Sanda
commit 13a1b7064edc508f864cafa3ddb9e8664a6e4633
Author: Pavel Sanda 
Date:   Fri Feb 21 23:57:14 2025 +0100

Fix make check for autotools
---
 src/Makefile.am | 3 ++-
 src/tests/dummy4checklayout.cpp | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index a965a27d3c..7117232822 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -696,7 +696,8 @@ check_layout_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
 check_layout_SOURCES = \
tests/boost.cpp \
tests/check_layout.cpp \
-   tests/dummy_functions.cpp
+   tests/dummy_functions.cpp \
+   tests/dummy4checklayout.cpp
 check_layout_LYX_OBJS = \
insets/InsetLayout.o \
support/Lexer.o \
diff --git a/src/tests/dummy4checklayout.cpp b/src/tests/dummy4checklayout.cpp
index afdcb490dc..2be7e51fcf 100644
--- a/src/tests/dummy4checklayout.cpp
+++ b/src/tests/dummy4checklayout.cpp
@@ -18,7 +18,7 @@
 
 #include 
 
-#include "tex2lyx.h"
+#include "../tex2lyx/tex2lyx.h"
 #include "LaTeXColors.h"
 #include "LaTeXFeatures.h"
 #include "LyXRC.h"
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] cmake adaptation per Kornel's request

2025-02-21 Thread Pavel Sanda
commit 753f1524ae79f6e8841ef1d1e2def7ed0c3003e3
Author: Pavel Sanda 
Date:   Fri Feb 21 23:58:00 2025 +0100

cmake adaptation per Kornel's request
---
 src/tests/CMakeLists.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 93acfd4aa9..d921dbb7c3 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -13,7 +13,6 @@ foreach(_f insets/InsetLayout.cpp CiteEnginesList.cpp 
Color.cpp Counters.cpp Flo
 endforeach()
 
 include_directories(${TOP_SRC_DIR}/src/support/tests)
-include_directories(${TOP_SRC_DIR}/src/tex2lyx)
 
 add_executable(check_layout ${check_layout_SOURCES})
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Uneeded header

2025-02-21 Thread Pavel Sanda
commit 3fe60011ce685db2cf8aa121a9b7f7a5acfc8e48
Author: Pavel Sanda 
Date:   Fri Feb 21 23:55:41 2025 +0100

Uneeded header
---
 src/mathed/MathStream.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 080f9eaf05..28471ce715 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -13,7 +13,6 @@
 #define MATH_MATHSTREAM_H
 
 #include "InsetMath.h"
-#include "FontInfo.h"
 
 #include "TexRow.h"
 #include "texstream.h"
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Option to flag default color in ColorsCombo

2025-02-21 Thread Juergen Spitzmueller
commit 2654e2bbb4b082ea38893196e49e00946b1a83cf
Author: Juergen Spitzmueller 
Date:   Sat Feb 22 08:20:12 2025 +0100

Option to flag default color in ColorsCombo
---
 src/frontends/qt/ColorsCombo.cpp | 11 ---
 src/frontends/qt/ColorsCombo.h   |  6 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/ColorsCombo.cpp b/src/frontends/qt/ColorsCombo.cpp
index 2fb0798a76..9086f797c2 100644
--- a/src/frontends/qt/ColorsCombo.cpp
+++ b/src/frontends/qt/ColorsCombo.cpp
@@ -14,6 +14,7 @@
 #include "LaTeXColors.h"
 
 #include "support/gettext.h"
+#include "support/lstrings.h"
 #include "qt_helpers.h"
 
 #include "support/qstring_helpers.h"
@@ -59,7 +60,10 @@ void ColorsCombo::setColorIcon(int const i, QString const 
color)
 void ColorsCombo::addItemSort(QString const & item, QString const & guiname,
  QString const & category, QString const color)
 {
-   QString titem = guiname;
+   QString titem = (item != default_color_)
+   ? guiname
+   : toqstr(bformat(_("%1$s (= Default[[color]])"),
+qstring_to_ucs4(guiname)));;
 
QList row;
QStandardItem * gui = new QStandardItem(titem);
@@ -112,8 +116,9 @@ void ColorsCombo::fillComboColor()
if (has_ignore_)
addItemSort(QString("ignore"), qt_("No change"),
QString());
-   addItemSort(QString("none"), qt_("Default"),
-   QString());
+   if (default_color_.isEmpty())
+   addItemSort(QString("none"), qt_("Default"),
+   QString());
if (has_inherit_)
addItemSort(QString("inherit"), qt_("(Without)[[color]]"),
QString());
diff --git a/src/frontends/qt/ColorsCombo.h b/src/frontends/qt/ColorsCombo.h
index 085fcfa922..e4345b6329 100644
--- a/src/frontends/qt/ColorsCombo.h
+++ b/src/frontends/qt/ColorsCombo.h
@@ -13,7 +13,7 @@
 #define LYX_COLORSCOMBO_H
 
 #include "CategorizedCombo.h"
-#include "BufferParams.h"
+#include "support/qstring_helpers.h"
 
 #include 
 
@@ -44,6 +44,8 @@ public:
void hasIgnore(bool const b) { has_ignore_ = b; }
/// Add "inherit" color entry?
void hasInherit(bool const b) { has_inherit_ = b; }
+   /// Flag a color as default. This will also omit the "none" entry
+   void setDefaultColor(std::string const & col) { default_color_ = 
toqstr(col); }
 
 private:
///
@@ -56,6 +58,8 @@ private:
bool has_ignore_;
///
bool has_inherit_;
+   ///
+   QString default_color_;
 };
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Add tooltip

2025-02-21 Thread Juergen Spitzmueller
commit fba26627f1d602bebfbf15b23b3a8eaef0cda7f2
Author: Juergen Spitzmueller 
Date:   Sat Feb 22 07:47:16 2025 +0100

Add tooltip
---
 src/frontends/qt/GuiDocument.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index f20caa795c..3ae1cbcb86 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1399,6 +1399,7 @@ GuiDocument::GuiDocument(GuiView & lv)
colorModule->customColorsTW->headerItem()->setText(0, qt_("Name"));
colorModule->customColorsTW->headerItem()->setText(1, qt_("Color"));
colorModule->customColorsTW->setSortingEnabled(true);
+   colorModule->customColorsTW->setToolTip(qt_("You can double-click on an 
item to change its color"));
QRegularExpression ascii_re("[A-Za-z0-9]+");
colorModule->newColorLE->setValidator(new 
QRegularExpressionValidator(ascii_re, colorModule->newColorLE));
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] GuiBibitem: hide year in numeric natbib mode

2025-02-21 Thread Juergen Spitzmueller
commit 04a9748e7ecd9518298594c98dd8200aae9cc0f3
Author: Juergen Spitzmueller 
Date:   Sat Feb 22 08:37:25 2025 +0100

GuiBibitem: hide year in numeric natbib mode
---
 src/frontends/qt/GuiBibitem.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/GuiBibitem.cpp b/src/frontends/qt/GuiBibitem.cpp
index ccbbf95b20..a832375cb6 100644
--- a/src/frontends/qt/GuiBibitem.cpp
+++ b/src/frontends/qt/GuiBibitem.cpp
@@ -53,14 +53,19 @@ void GuiBibitem::paramsToDialog(Inset const * inset)
literalCB->setChecked(params["literal"] == "true");
QString const label = toqstr(params["label"]);
if (inset->buffer().masterParams().citeEngine() == "natbib") {
-   yearED->setHidden(false);
-   yearLA->setHidden(false);
+   bool const numeric = 
inset->buffer().masterParams().citeEngineType() == ENGINE_TYPE_NUMERICAL;
+   yearED->setHidden(numeric);
+   yearLA->setHidden(numeric);
allAuthorsED->setHidden(false);
allAuthorsLA->setHidden(false);
labelLA->setText(qt_("Author &Names:"));
labelLA->setMaximumWidth(labelLA->sizeHint().width());
-   labelED->setToolTip(qt_("Insert the author name(s) for the 
author-year reference here. "
-   "If you use an abbreviated list (with 
`et al.'), the full list can go below."));
+   if (numeric)
+   labelED->setToolTip(qt_("Insert the author name(s) for 
the author-number reference here. "
+   "If you use an abbreviated list 
(with `et al.'), the full list can go below."));
+   else
+   labelED->setToolTip(qt_("Insert the author name(s) for 
the author-year reference here. "
+   "If you use an abbreviated list 
(with `et al.'), the full list can go below."));
allAuthorsLA->setText(qt_("A&ll Author Names:"));
allAuthorsLA->setMaximumWidth(allAuthorsLA->sizeHint().width());
literalCB->setToolTip(qt_("Pass content of the `Author', `Year' 
and `All Authors' fields literally to LaTeX. "
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Amend 04a9748e7ecd once more

2025-02-21 Thread Juergen Spitzmueller
commit 3160c04449e1d403641c0ba8cf6544f59e12c1da
Author: Juergen Spitzmueller 
Date:   Sat Feb 22 08:58:47 2025 +0100

Amend 04a9748e7ecd once more

the (empty) year must be passed even if we have no long author list
---
 src/frontends/qt/GuiBibitem.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiBibitem.cpp b/src/frontends/qt/GuiBibitem.cpp
index 244f304364..ed2e9bf6af 100644
--- a/src/frontends/qt/GuiBibitem.cpp
+++ b/src/frontends/qt/GuiBibitem.cpp
@@ -105,7 +105,7 @@ docstring GuiBibitem::dialogToParams() const
 {
InsetCommandParams params(insetCode());
QString label = labelED->text();
-   if (!allAuthorsED->text().isEmpty())
+   if (!allAuthorsED->isHidden() && !label.isEmpty())
label += "(" + yearED->text() + ")" + allAuthorsED->text();
params["key"] = qstring_to_ucs4(keyED->text());
params["label"] = qstring_to_ucs4(label);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Amend 04a9748e7ecd

2025-02-21 Thread Juergen Spitzmueller
commit d96cfb0662e3745cb043cfc5572288444b76e67c
Author: Juergen Spitzmueller 
Date:   Sat Feb 22 08:50:32 2025 +0100

Amend 04a9748e7ecd

Also in natbib-numeric, a (empty) year must be passed to the \bibitem
option, as the natbib parser relies on it
---
 src/frontends/qt/GuiBibitem.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiBibitem.cpp b/src/frontends/qt/GuiBibitem.cpp
index a832375cb6..244f304364 100644
--- a/src/frontends/qt/GuiBibitem.cpp
+++ b/src/frontends/qt/GuiBibitem.cpp
@@ -105,7 +105,7 @@ docstring GuiBibitem::dialogToParams() const
 {
InsetCommandParams params(insetCode());
QString label = labelED->text();
-   if (!yearED->isHidden())
+   if (!allAuthorsED->text().isEmpty())
label += "(" + yearED->text() + ")" + allAuthorsED->text();
params["key"] = qstring_to_ucs4(keyED->text());
params["label"] = qstring_to_ucs4(label);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs