That is a valid point!
Restricting the units and using a CheckedLineEdit are still probably
worthwhile considering, so here are those changes separately.

Best regards,
Chris

On Sun, Oct 30, 2022 at 3:11 PM Jürgen Spitzmüller <jspi...@gmail.com> wrote:
>
> Am Sonntag, dem 30.10.2022 um 11:43 -0400 schrieb Christopher
> Hillenbrand:
> > I am attaching a patch that implements Jean-Marc's checkbox-free UI
> > suggestion and restricts the available units to inches, cm, and
> > %textwidth.
>
> Actually, I find the checkbox helpful. It allows to quickly switch
> on/off the feature without having to re-enter the value.
>
> --
> Jürgen
> --
> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel
From 8c4284fd99bb33caa5c6a4170eda205f065e0363 Mon Sep 17 00:00:00 2001
From: chillenb <chillenb.li...@gmail.com>
Date: Sun, 30 Oct 2022 16:13:30 -0400
Subject: [PATCH] More minor improvements to screen width UI

* Restrict screen width units to inches, cm, and %text width
* Validate the user-provided screen width, just like page margins
---
 src/frontends/qt/GuiPrefs.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 03d630d397..39fce2ade4 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -2827,6 +2827,26 @@ PrefEdit::PrefEdit(GuiPreferences * form)
 		this, SIGNAL(changed()));
 	connect(toggleToolbarsCB, SIGNAL(toggled(bool)),
 		this, SIGNAL(changed()));
+
+	screenWidthLE->setValidator(new LengthValidator(screenWidthLE));
+	form->bc().addCheckedLineEdit(screenWidthLE, screenLimitCB);
+	screenWidthUnitCO->removeUnit(lyx::Length::BP);
+	screenWidthUnitCO->removeUnit(lyx::Length::CC);
+	screenWidthUnitCO->removeUnit(lyx::Length::DD);
+	screenWidthUnitCO->removeUnit(lyx::Length::EM);
+	screenWidthUnitCO->removeUnit(lyx::Length::EX);
+	screenWidthUnitCO->removeUnit(lyx::Length::MM);
+	screenWidthUnitCO->removeUnit(lyx::Length::MU);
+	screenWidthUnitCO->removeUnit(lyx::Length::PC);
+	screenWidthUnitCO->removeUnit(lyx::Length::PT);
+	screenWidthUnitCO->removeUnit(lyx::Length::SP);
+	screenWidthUnitCO->removeUnit(lyx::Length::PCW);
+	screenWidthUnitCO->removeUnit(lyx::Length::PPW);
+	screenWidthUnitCO->removeUnit(lyx::Length::PLW);
+	screenWidthUnitCO->removeUnit(lyx::Length::PTH);
+	screenWidthUnitCO->removeUnit(lyx::Length::PPH);
+	screenWidthUnitCO->removeUnit(lyx::Length::BLS);
+	// This leaves inches, cm, and % text width
 }
 
 
-- 
2.38.1

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

Reply via email to