mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Implement option to set a global default output format for dics with non-tex fonts (#8706)
This commit is contained in:
parent
a0798ff37a
commit
8f287f5ffa
@ -2316,7 +2316,6 @@ string BufferParams::getDefaultOutputFormat() const
|
||||
&& default_output_format != "default")
|
||||
return default_output_format;
|
||||
if (isDocBook()
|
||||
|| useNonTeXFonts
|
||||
|| encoding().package() == Encoding::japanese) {
|
||||
vector<Format const *> const formats = exportableFormats(true);
|
||||
if (formats.empty())
|
||||
@ -2324,6 +2323,8 @@ string BufferParams::getDefaultOutputFormat() const
|
||||
// return the first we find
|
||||
return formats.front()->name();
|
||||
}
|
||||
if (useNonTeXFonts)
|
||||
return lyxrc.default_otf_view_format;
|
||||
return lyxrc.default_view_format;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,7 @@ LexerKeyword lyxrcTags[] = {
|
||||
{ "\\def_file", LyXRC::RC_DEFFILE },
|
||||
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
|
||||
{ "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
|
||||
{ "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
|
||||
{ "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
|
||||
{ "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
|
||||
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
|
||||
@ -255,6 +256,7 @@ void LyXRC::setDefaults()
|
||||
document_path.erase();
|
||||
view_dvi_paper_option.erase();
|
||||
default_view_format = "pdf2";
|
||||
default_otf_view_format = "pdf4";
|
||||
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
|
||||
bibtex_command = "bibtex";
|
||||
fontenc = "default";
|
||||
@ -1162,6 +1164,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
||||
break;
|
||||
}
|
||||
|
||||
case RC_DEFAULT_OTF_VIEW_FORMAT:
|
||||
lexrc >> default_otf_view_format;
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
lexrc >> default_view_format;
|
||||
break;
|
||||
@ -2807,6 +2813,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
}
|
||||
case RC_DEFAULT_OTF_VIEW_FORMAT:
|
||||
if (ignore_system_lyxrc ||
|
||||
default_otf_view_format != system_lyxrc.default_otf_view_format) {
|
||||
os << "\\default_otf_view_format " << default_otf_view_format << '\n';
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
if (ignore_system_lyxrc ||
|
||||
default_view_format != system_lyxrc.default_view_format) {
|
||||
@ -2929,6 +2942,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
||||
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
|
||||
case LyXRC::RC_DATE_INSERT_FORMAT:
|
||||
case LyXRC::RC_GUI_LANGUAGE:
|
||||
case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
|
||||
case LyXRC::RC_DEFAULT_VIEW_FORMAT:
|
||||
case LyXRC::RC_DEFFILE:
|
||||
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
|
||||
@ -3162,6 +3176,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
||||
str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_OTF_VIEW_FORMAT:
|
||||
str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
|
||||
break;
|
||||
|
||||
case RC_DEFAULT_VIEW_FORMAT:
|
||||
str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
|
||||
break;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
RC_DATE_INSERT_FORMAT,
|
||||
RC_DEFAULT_DECIMAL_POINT,
|
||||
RC_DEFAULT_LENGTH_UNIT,
|
||||
RC_DEFAULT_OTF_VIEW_FORMAT,
|
||||
RC_DEFAULT_VIEW_FORMAT,
|
||||
RC_DEFFILE,
|
||||
RC_DIALOGS_ICONIFY_WITH_MAIN,
|
||||
@ -420,6 +421,8 @@ public:
|
||||
///
|
||||
std::string gui_language;
|
||||
///
|
||||
std::string default_otf_view_format;
|
||||
///
|
||||
std::string default_view_format;
|
||||
/// all available viewers
|
||||
Alternatives viewer_alternatives;
|
||||
|
@ -1893,6 +1893,8 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
|
||||
this, SIGNAL(changed()));
|
||||
connect(defaultFormatCB, SIGNAL(activated(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(defaultOTFFormatCB, SIGNAL(activated(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(viewerCO, SIGNAL(activated(int)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(editorCO, SIGNAL(activated(int)),
|
||||
@ -1920,6 +1922,9 @@ void PrefFileformats::apply(LyXRC & rc) const
|
||||
QString const default_format = defaultFormatCB->itemData(
|
||||
defaultFormatCB->currentIndex()).toString();
|
||||
rc.default_view_format = fromqstr(default_format);
|
||||
QString const default_otf_format = defaultOTFFormatCB->itemData(
|
||||
defaultOTFFormatCB->currentIndex()).toString();
|
||||
rc.default_otf_view_format = fromqstr(default_otf_format);
|
||||
}
|
||||
|
||||
|
||||
@ -1930,9 +1935,12 @@ void PrefFileformats::update(LyXRC const & rc)
|
||||
bool const init = defaultFormatCB->currentText().isEmpty();
|
||||
updateView();
|
||||
if (init) {
|
||||
int const pos =
|
||||
int pos =
|
||||
defaultFormatCB->findData(toqstr(rc.default_view_format));
|
||||
defaultFormatCB->setCurrentIndex(pos);
|
||||
pos = defaultOTFFormatCB->findData(toqstr(rc.default_otf_view_format));
|
||||
defaultOTFFormatCB->setCurrentIndex(pos);
|
||||
defaultOTFFormatCB->setCurrentIndex(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1941,35 +1949,48 @@ void PrefFileformats::updateView()
|
||||
{
|
||||
QString const current = formatsCB->currentText();
|
||||
QString const current_def = defaultFormatCB->currentText();
|
||||
QString const current_def_otf = defaultOTFFormatCB->currentText();
|
||||
|
||||
// update comboboxes with formats
|
||||
formatsCB->blockSignals(true);
|
||||
defaultFormatCB->blockSignals(true);
|
||||
defaultOTFFormatCB->blockSignals(true);
|
||||
formatsCB->clear();
|
||||
defaultFormatCB->clear();
|
||||
defaultOTFFormatCB->clear();
|
||||
form_->formats().sort();
|
||||
Formats::const_iterator cit = form_->formats().begin();
|
||||
Formats::const_iterator end = form_->formats().end();
|
||||
for (; cit != end; ++cit) {
|
||||
formatsCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(form_->formats().getNumber(cit->name())));
|
||||
if (form_->converters().isReachable("latex", cit->name())
|
||||
if (cit->viewer().empty())
|
||||
continue;
|
||||
if (form_->converters().isReachable("xhtml", cit->name())
|
||||
|| form_->converters().isReachable("dviluatex", cit->name())
|
||||
|| form_->converters().isReachable("pdflatex", cit->name())
|
||||
|| form_->converters().isReachable("luatex", cit->name())
|
||||
|| form_->converters().isReachable("xetex", cit->name()))
|
||||
|| form_->converters().isReachable("xetex", cit->name())) {
|
||||
defaultFormatCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(toqstr(cit->name())));
|
||||
defaultOTFFormatCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(toqstr(cit->name())));
|
||||
} else if (form_->converters().isReachable("latex", cit->name())
|
||||
|| form_->converters().isReachable("pdflatex", cit->name()))
|
||||
defaultFormatCB->addItem(qt_(cit->prettyname()),
|
||||
QVariant(toqstr(cit->name())));
|
||||
}
|
||||
|
||||
// restore selection
|
||||
// restore selections
|
||||
int item = formatsCB->findText(current, Qt::MatchExactly);
|
||||
formatsCB->setCurrentIndex(item < 0 ? 0 : item);
|
||||
on_formatsCB_currentIndexChanged(item < 0 ? 0 : item);
|
||||
item = defaultFormatCB->findText(current_def, Qt::MatchExactly);
|
||||
defaultFormatCB->setCurrentIndex(item < 0 ? 0 : item);
|
||||
item = defaultOTFFormatCB->findText(current_def_otf, Qt::MatchExactly);
|
||||
defaultOTFFormatCB->setCurrentIndex(item < 0 ? 0 : item);
|
||||
formatsCB->blockSignals(false);
|
||||
defaultFormatCB->blockSignals(false);
|
||||
defaultOTFFormatCB->blockSignals(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PrefFileformatsUi</class>
|
||||
<widget class="QWidget" name="PrefFileformatsUi">
|
||||
@ -6,16 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>386</width>
|
||||
<height>381</height>
|
||||
<height>417</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="8" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="editorED"/>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="formatsLA">
|
||||
<property name="text">
|
||||
@ -26,6 +24,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="formatsCB">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAtCurrent</enum>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="formatNewPB">
|
||||
<property name="text">
|
||||
@ -40,6 +54,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="documentCB">
|
||||
<property name="text">
|
||||
@ -116,6 +143,16 @@
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="shortcutED"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="editorLA">
|
||||
<property name="text">
|
||||
<string>Ed&itor:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editorCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="editorCO">
|
||||
<property name="sizeAdjustPolicy">
|
||||
@ -123,6 +160,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="editorED"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="viewerLA">
|
||||
<property name="text">
|
||||
@ -162,26 +202,30 @@
|
||||
<string>Specify the default output format when using (PDF)LaTeX</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Default Format</string>
|
||||
<string>Default Output Formats</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="defaultFormatLA">
|
||||
<property name="text">
|
||||
<string>De&fault Output Format:</string>
|
||||
<string>With &TeX fonts:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>defaultFormatCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="defaultFormatCB"/>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="defaultFormatCB">
|
||||
<property name="toolTip">
|
||||
<string>The default output format for documents (except with non-TeX fonts)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -194,6 +238,36 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="defaultOTFFormatLA">
|
||||
<property name="text">
|
||||
<string>With n&on-TeX fonts:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>defaultFormatCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="defaultOTFFormatCB">
|
||||
<property name="toolTip">
|
||||
<string>The default output format for documents using non-TeX fonts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>148</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -210,45 +284,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="editorLA">
|
||||
<property name="text">
|
||||
<string>Ed&itor:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>editorCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="formatsCB">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAtCurrent</enum>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
Loading…
Reference in New Issue
Block a user