PDFOptions: Pavel's final touches patch

PDFSupportUi.ui: recreated dialog to fix the appearance in the dialog settings dialog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20881 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-10-10 00:34:23 +00:00
parent 392ddbfdbd
commit 38dfe36093
4 changed files with 298 additions and 312 deletions

View File

@ -47,14 +47,14 @@ bool PDFOptions::empty() const
&& pdfborder == x.pdfborder
&& colorlinks == x.colorlinks
&& backref == x.backref
&& pagebackref == x.pagebackref ;
&& pagebackref == x.pagebackref
&& pdfusetitle == x.pdfusetitle;
}
void PDFOptions::writeFile(ostream & os) const
{
os << "\\use_hyperref " << convert<string>(use_hyperref) << '\n';
os << "\\pdf_store_options " << convert<string>(store_options) << '\n';
if (!use_hyperref && !store_options)
if (!use_hyperref && empty())
return;
if (!title.empty() )
@ -77,6 +77,7 @@ void PDFOptions::writeFile(ostream & os) const
os << "\\pdf_colorlinks " << convert<string>(colorlinks) << '\n';
os << "\\pdf_backref " << convert<string>(backref) << '\n';
os << "\\pdf_pagebackref " << convert<string>(pagebackref) << '\n';
os << "\\pdf_pdfusetitle " << convert<string>(pdfusetitle) << '\n';
if (!pagemode.empty())
os << "\\pdf_pagemode " << pagemode << '\n';
@ -99,10 +100,10 @@ void PDFOptions::writeLaTeX(odocstringstream &os) const
// try to extract author and title from document when none is
// explicitely given
if (title.empty() && author.empty())
opt += "pdfusetitle,\n ";
else
if (pdfusetitle && title.empty() && author.empty())
opt += "pdfusetitle,";
opt += "\n ";
opt += "bookmarks=" + convert<string>(bookmarks) + ',';
if (bookmarks) {
opt += "bookmarksnumbered=" + convert<string>(bookmarksnumbered) + ',';
@ -181,12 +182,14 @@ string PDFOptions::readToken(Lexer &lex, string const & token)
lex >> backref;
} else if (token == "\\pdf_pagebackref") {
lex >> pagebackref;
} else if (token == "\\pdf_pdfusetitle") {
lex >> pdfusetitle;
} else if (token == "\\pdf_pagemode") {
lex >> pagemode;
} else if (token == "\\pdf_quoted_options") {
lex >> quoted_options;
} else if (token == "\\pdf_store_options") {
lex >> store_options;
//leftover from previous option; intended for later removal
} else {
return token;
}
@ -194,13 +197,13 @@ string PDFOptions::readToken(Lexer &lex, string const & token)
}
//prepared for check
// prepared for check
string PDFOptions::quoted_options_get() const
{
return quoted_options;
}
// Keep implicit hyperref settings
// set implicit settings for hyperref
void PDFOptions::clear()
{
use_hyperref = false;
@ -219,7 +222,7 @@ void PDFOptions::clear()
pagebackref = false;
pagemode.clear();
quoted_options.clear();
store_options = false;
pdfusetitle = true; //in contrast with hyperref
}
} // namespace lyx

View File

@ -19,18 +19,6 @@ namespace lyx {
class Lexer;
/// Options for PDF generation
/*
Possible cleanups, left for next fileformat change:
- bookmarksopenlevel is stored in .lyx as string;
after change to spinbox it would be appropriate
change to int.
- store_options flag can be completely replaced by
function store_options() doing essentialy the same
as empty() now.
*/
class PDFOptions {
public:
///
@ -43,7 +31,7 @@ public:
void writeLaTeX(odocstringstream &) const;
/// read tokens from lyx header
std::string readToken(Lexer &lex, std::string const & token);
/// keep implicit hyperref settings
/// set implicit settings for hyperref
void clear();
///
@ -128,6 +116,15 @@ public:
* dialog -> PDFOptions.pagemode .
*/
std::string pagemode;
/**
* Flag indicating whether hyperref tries to derive the values for
* pdftitle and pdfauthor from \title and \author.
* pdfusetitle boolean false
*
* Note that we use true as default value instead. The option is also
* used in latex output only when title and author is not filled.
*/
bool pdfusetitle;
///latex string
static const std::string pagemode_fullscreen;
/**

View File

@ -653,6 +653,8 @@ GuiDocument::GuiDocument(LyXView & lv)
this, SLOT(change_adaptor()));
connect(pdfSupportModule->backrefCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
connect(pdfSupportModule->pdfusetitleCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
connect(pdfSupportModule->pagebackrefCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
connect(pdfSupportModule->fullscreenCB, SIGNAL(toggled(bool)),
@ -1248,6 +1250,7 @@ void GuiDocument::apply(BufferParams & params)
pdf.breaklinks = pdfSupportModule->breaklinksCB->isChecked();
pdf.pdfborder = pdfSupportModule->pdfborderCB->isChecked();
pdf.pdfusetitle = pdfSupportModule->pdfusetitleCB->isChecked();
pdf.colorlinks = pdfSupportModule->colorlinksCB->isChecked();
pdf.backref = pdfSupportModule->backrefCB->isChecked();
pdf.pagebackref = pdfSupportModule->pagebackrefCB->isChecked();
@ -1256,8 +1259,6 @@ void GuiDocument::apply(BufferParams & params)
else
pdf.pagemode.clear();
pdf.quoted_options = fromqstr(pdfSupportModule->optionsLE->text());
if (pdf.use_hyperref || !pdf.empty())
pdf.store_options = true;
}
@ -1555,6 +1556,7 @@ void GuiDocument::updateParams(BufferParams const & params)
pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
pdfSupportModule->backrefCB->setChecked(pdf.backref);
pdfSupportModule->pagebackrefCB->setChecked(pdf.pagebackref);

View File

@ -5,21 +5,18 @@
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>394</height>
<width>427</width>
<height>398</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="use_hyperrefGB" >
<property name="geometry" >
<rect>
<x>2</x>
<y>2</y>
<width>423</width>
<height>381</height>
</rect>
</property>
<property name="toolTip" >
<string>Enable clickable crossreferences and header informations</string>
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
<property name="title" >
<string>&amp;Use hyperref support</string>
@ -30,83 +27,70 @@
<property name="checked" >
<bool>false</bool>
</property>
<widget class="QGroupBox" name="groupBox_4" >
<property name="geometry" >
<rect>
<x>186</x>
<y>170</y>
<width>231</width>
<height>148</height>
</rect>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Links</string>
<string>Header Information</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<widget class="QCheckBox" name="colorlinksCB" >
<item row="0" column="0" >
<widget class="QLabel" name="titleL" >
<property name="text" >
<string>Color links</string>
<string>&amp;Title:</string>
</property>
<property name="buddy" >
<cstring>titleLE</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="titleLE" />
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="pdfborderCB" >
<widget class="QLabel" name="authorL" >
<property name="text" >
<string>No frames around links</string>
<string>&amp;Author:</string>
</property>
<property name="tristate" >
<bool>false</bool>
<property name="buddy" >
<cstring>authorLE</cstring>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="breaklinksCB" >
<property name="toolTip" >
<string>Allows link text to break across lines.</string>
</property>
<item row="1" column="1" >
<widget class="QLineEdit" name="authorLE" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="subjectL" >
<property name="text" >
<string>Break links over lines</string>
<string>&amp;Subject:</string>
</property>
<property name="buddy" >
<cstring>subjectLE</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="subjectLE" />
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="backrefCB" >
<property name="toolTip" >
<string>Adds "backlink" text to the end of each item in the bibliography</string>
</property>
<widget class="QLabel" name="keywordsL" >
<property name="text" >
<string>&amp;Bibliographical backreferences</string>
<string>&amp;Keywords:</string>
</property>
<property name="buddy" >
<cstring>keywordsLE</cstring>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="pagebackrefCB" >
<property name="toolTip" >
<string>Adds "backlink" text to the end of each item in the bibliography</string>
</property>
<property name="text" >
<string>Backreference by pa&amp;ge number</string>
</property>
</widget>
<item row="3" column="1" >
<widget class="QLineEdit" name="keywordsLE" />
</item>
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="bookmarksGB" >
<property name="geometry" >
<rect>
<x>6</x>
<y>170</y>
<width>171</width>
<height>112</height>
</rect>
</property>
<property name="title" >
<string>Generate Bookmarks</string>
</property>
@ -117,10 +101,22 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
@ -135,6 +131,9 @@
<property name="title" >
<string>Open bookmarks</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
@ -174,15 +173,78 @@
</item>
</layout>
</widget>
<widget class="QCheckBox" name="fullscreenCB" >
<property name="geometry" >
<rect>
<x>10</x>
<y>300</y>
<width>161</width>
<height>21</height>
</rect>
</item>
<item rowspan="3" row="1" column="1" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Links</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="breaklinksCB" >
<property name="toolTip" >
<string>Allows link text to break across lines.</string>
</property>
<property name="text" >
<string>Break links over lines</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="pdfborderCB" >
<property name="text" >
<string>No frames around links</string>
</property>
<property name="tristate" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="colorlinksCB" >
<property name="text" >
<string>Color links</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="backrefCB" >
<property name="toolTip" >
<string>Adds "backlink" text to the end of each item in the bibliography</string>
</property>
<property name="text" >
<string>&amp;Bibliographical backreferences</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="pagebackrefCB" >
<property name="toolTip" >
<string>Adds "backlink" text to the end of each item in the bibliography</string>
</property>
<property name="text" >
<string>Backreference by pa&amp;ge number</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="pdfusetitleCB" >
<property name="toolTip" >
<string>If not stated explicitly, fill title and author from appropriate environments</string>
</property>
<property name="text" >
<string>Automatically fill header</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="fullscreenCB" >
<property name="toolTip" >
<string>Enable fullscreen PDF presentation</string>
</property>
@ -190,93 +252,14 @@
<string>Load in &amp;fullscreen mode</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2" >
<property name="geometry" >
<rect>
<x>6</x>
<y>20</y>
<width>411</width>
<height>141</height>
</rect>
</property>
<property name="title" >
<string>Header Information</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QLineEdit" name="authorLE" />
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="titleLE" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="titleL" >
<property name="text" >
<string>&amp;Title:</string>
</property>
<property name="buddy" >
<cstring>titleLE</cstring>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="authorL" >
<property name="text" >
<string>&amp;Author:</string>
</property>
<property name="buddy" >
<cstring>authorLE</cstring>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="subjectL" >
<property name="text" >
<string>&amp;Subject:</string>
</property>
<property name="buddy" >
<cstring>subjectLE</cstring>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="keywordsL" >
<property name="text" >
<string>&amp;Keywords:</string>
</property>
<property name="buddy" >
<cstring>keywordsLE</cstring>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="keywordsLE" />
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="subjectLE" />
</item>
</layout>
</widget>
<item row="4" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="geometry" >
<rect>
<x>6</x>
<y>330</y>
<width>411</width>
<height>54</height>
</rect>
</property>
<property name="title" >
<string>Additional o&amp;ptions for hyperref</string>
</property>
<property name="flat" >
<bool>true</bool>
<bool>false</bool>
</property>
<property name="checkable" >
<bool>false</bool>
@ -285,14 +268,14 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLineEdit" name="optionsLE" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>eg: pdfstartview=XYZ, plainpages=false, pdfpagelabels</string>
</property>
@ -300,11 +283,12 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<resources/>
<connections/>
</ui>