On Sat, Sep 28, 2024 at 09:55:04PM +0200, Pavel Sanda wrote:
> On Sun, Sep 22, 2024 at 07:11:36PM +0300, Udicoudco wrote:
> > The "cololinks" option in the hyperref package disables the borders
> > at the beginning of the document. If you want both you need to add the
> > following to the preamble after enabling colored links
> > 
> > \AtBeginDocument{\hypersetup{pdfborder=0 0 1}}
> > 
> > Its a question of whether the GUI should indicate
> > things similar to the LaTeX implementation or not.
> 
> I think we could indicate this in the UI pane (either 
> disabling border option when colorlinks are enabled
> or enhance the tooltip).

This option like the attached.

Second option would be to actually use the proposed workaround
and allow frames with colors.  The cons:
1) not clear how our hack will work in future 
  (might be better to ask upstream if we really aim for this)
2) even more complex code wrt the use of \AtBeginDocument & \hypersetup
3) will change output for checked color links option only,
   so we should probably wait for 2.5 to introduce this


I favour option 1. Opinions?

Pavel
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 4eb945e1af..a98680b9a5 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1784,6 +1784,8 @@ GuiDocument::GuiDocument(GuiView & lv)
 		this, SLOT(change_adaptor()));
 	connect(pdfSupportModule->pdfborderCB, SIGNAL(toggled(bool)),
 		this, SLOT(change_adaptor()));
+	connect(pdfSupportModule->colorlinksCB, SIGNAL(toggled(bool)),
+		this, SLOT(colorlinksCB_adaptor(bool)));
 	connect(pdfSupportModule->colorlinksCB, SIGNAL(toggled(bool)),
 		this, SLOT(change_adaptor()));
 	connect(pdfSupportModule->backrefCO, SIGNAL(activated(int)),
@@ -3152,6 +3154,12 @@ void GuiDocument::classChanged_adaptor()
 }
 
 
+void GuiDocument::colorlinksCB_adaptor(bool enabled)
+{
+	pdfSupportModule->pdfborderCB->setEnabled(!enabled);
+}
+
+
 void GuiDocument::classChanged()
 {
 	int idx = latexModule->classCO->currentIndex();
@@ -4879,6 +4887,10 @@ void GuiDocument::paramsToDialog()
 	pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
 	pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
 
+	//hyperref considers colorlinks to be mutually exlusive to borders
+	//for workaround see manuals
+	pdfSupportModule->pdfborderCB->setEnabled(!pdf.colorlinks);
+
 	nn = findToken(backref_opts, pdf.backref);
 	if (nn >= 0)
 		pdfSupportModule->backrefCO->setCurrentIndex(nn);
diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h
index 3e49fa663d..8ff27f5670 100644
--- a/src/frontends/qt/GuiDocument.h
+++ b/src/frontends/qt/GuiDocument.h
@@ -146,6 +146,7 @@ private Q_SLOTS:
 	void browseMaster();
 	void classChanged();
 	void classChanged_adaptor();
+	void colorlinksCB_adaptor(bool);
 	void languagePackageChanged(int);
 	void biblioChanged();
 	void rescanBibFiles();
diff --git a/src/frontends/qt/ui/PDFSupportUi.ui b/src/frontends/qt/ui/PDFSupportUi.ui
index b3ea170e31..8be13ef86a 100644
--- a/src/frontends/qt/ui/PDFSupportUi.ui
+++ b/src/frontends/qt/ui/PDFSupportUi.ui
@@ -281,6 +281,9 @@
             </item>
             <item>
              <widget class="QCheckBox" name="colorlinksCB">
+              <property name="toolTip">
+               <string>Mutually exclusive with frames around links, see manual.</string>
+              </property>
               <property name="text">
                <string>C&amp;olor links</string>
               </property>
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to