]> git.lyx.org Git - features.git/commitdiff
Add default output format for pLaTeX
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 9 Sep 2017 06:53:08 +0000 (08:53 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 9 Sep 2017 06:53:08 +0000 (08:53 +0200)
Fixes: #10747
lib/RELEASE-NOTES
lib/scripts/prefs2prefs_prefs.py
src/BufferParams.cpp
src/LyXRC.cpp
src/LyXRC.h
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/ui/PrefFileformatsUi.ui

index f5d91f5ae4dc535da76a614ad1929277101351cc..126f7c541e8875ecb88ccc948c78d06fbdfe83a1 100644 (file)
 * \pygmentize_command
   holds the name of the driver command used by the Pygments python module.
 
+* \default_platex_view_format
+  Determine the default output format for Japanese documents that use the
+  pLaTeX backend [default: "pdf3" == "PDF (dvipdfm)"]
+
 
 !!!The following pref variables were changed in 2.3:
 
 
 !!!The following new LyX functions have been introduced in 2.3:
 
+* buffer-zoom
+  Zooms the screen fonts to a given value or resets to the default zoom
+  when no argument is given.
+
 * branch-invert
   Toggles inversion status of branch inset.
 
index 68b4d837dc2bdd01e6702999c3d6cd4c4e0c5a9c..77f3fd8106a711e46eb8b36b42cb617225f3377b 100644 (file)
 #   Add pygmentize_command for the python pygments syntax highlighter
 #   No conversion necessary.
 
+# Incremented to format 23, by spitz
+#   Add default_platex_view_format, a default output format for
+#   Japanese documents via pLaTeX.
+#   No conversion necessary.
+
 # NOTE: The format should also be updated in LYXRC.cpp and
 # in configure.py.
 
@@ -364,6 +369,18 @@ def remove_print_support(line):
 # End conversions for LyX 2.1 to 2.2
 ####################################
 
+#################################
+# Conversions from LyX 2.2 to 2.3
+
+# Only format changes that don't require conversion
+
+# End conversions for LyX 2.2 to 2.3
+####################################
+
+
+############################################################
+# Format-conversion map. Also add empty format changes here.
+
 conversions = [
        [  1, [ # there were several conversions for format 1
                export_menu,
@@ -392,5 +409,6 @@ conversions = [
        [ 19, [remove_print_support]],
        [ 20, []],
        [ 21, []],
-       [ 22, []]
+       [ 22, []],
+       [ 23, []]
 ]
index 5e8f6126dd613378bf01215b32ded8ff8895ee88..060d9e411c1ae79a9d1972a3f2d75eeb6aa4a825 100644 (file)
@@ -2695,14 +2695,15 @@ string BufferParams::getDefaultOutputFormat() const
        if (!default_output_format.empty()
            && default_output_format != "default")
                return default_output_format;
-       if (isDocBook()
-           || encoding().package() == Encoding::japanese) {
+       if (isDocBook()) {
                FormatList const & formats = exportableFormats(true);
                if (formats.empty())
                        return string();
                // return the first we find
                return formats.front()->name();
        }
+       if (encoding().package() == Encoding::japanese)
+               return lyxrc.default_platex_view_format;
        if (useNonTeXFonts)
                return lyxrc.default_otf_view_format;
        return lyxrc.default_view_format;
index 431f4a40d65d5870a3a2e236b6bd5159d160c99f..e98eae5cf08cd3110e510e2e4d4c3df965a9d030 100644 (file)
@@ -59,7 +59,7 @@ namespace {
 
 // The format should also be updated in configure.py, and conversion code
 // should be added to prefs2prefs_prefs.py.
-static unsigned int const LYXRC_FILEFORMAT = 22; // ef: pygmentize_command
+static unsigned int const LYXRC_FILEFORMAT = 23; // spitz: default_platex_view_format
 
 // when adding something to this array keep it sorted!
 LexerKeyword lyxrcTags[] = {
@@ -98,6 +98,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\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_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_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 },
@@ -237,6 +238,7 @@ void LyXRC::setDefaults()
        view_dvi_paper_option.erase();
        default_view_format = "pdf2";
        default_otf_view_format = "pdf4";
+       default_platex_view_format = "pdf3";
        chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
        bibtex_command = "automatic";
        fontenc = "default";
@@ -1082,6 +1084,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                        lexrc >> default_otf_view_format;
                        break;
 
+               case RC_DEFAULT_PLATEX_VIEW_FORMAT:
+                       lexrc >> default_platex_view_format;
+                       break;
+
                case RC_DEFAULT_VIEW_FORMAT:
                        lexrc >> default_view_format;
                        break;
@@ -2786,6 +2792,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
                // fall through
+       case RC_DEFAULT_PLATEX_VIEW_FORMAT:
+               if ((ignore_system_lyxrc ||
+                    default_platex_view_format != system_lyxrc.default_platex_view_format)
+                   && !default_platex_view_format.empty()) {
+                       os << "\\default_platex_view_format " << default_platex_view_format << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
+               // fall through
        case RC_DEFAULT_VIEW_FORMAT:
                if (ignore_system_lyxrc ||
                    default_view_format != system_lyxrc.default_view_format) {
@@ -2912,6 +2927,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_DATE_INSERT_FORMAT:
        case LyXRC::RC_GUI_LANGUAGE:
        case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
+       case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
        case LyXRC::RC_DEFAULT_VIEW_FORMAT:
        case LyXRC::RC_DEFFILE:
        case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
index 8ac70c1bca9949f37b2283b26cc8cc81d9bc8ba8..f2b0ab73e6eb6588724cddd4d349b201df8d2545 100644 (file)
@@ -70,6 +70,7 @@ public:
                RC_DEFAULT_DECIMAL_POINT,
                RC_DEFAULT_LENGTH_UNIT,
                RC_DEFAULT_OTF_VIEW_FORMAT,
+               RC_DEFAULT_PLATEX_VIEW_FORMAT,
                RC_DEFAULT_VIEW_FORMAT,
                RC_DEFFILE,
                RC_DIALOGS_ICONIFY_WITH_MAIN,
@@ -392,6 +393,8 @@ public:
        ///
        std::string default_otf_view_format;
        ///
+       std::string default_platex_view_format;
+       ///
        std::string default_view_format;
        /// all available viewers
        Alternatives viewer_alternatives;
index 212d19f6019ed23665391d5fae02490e8a615986..7f55a4d4351a3d26b6e448e56afa307c41fc09aa 100644 (file)
@@ -2033,6 +2033,8 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(defaultOTFFormatCB, SIGNAL(activated(QString)),
                this, SIGNAL(changed()));
+       connect(defaultPlatexFormatCB, SIGNAL(activated(QString)),
+               this, SIGNAL(changed()));
        connect(viewerCO, SIGNAL(activated(int)),
                this, SIGNAL(changed()));
        connect(editorCO, SIGNAL(activated(int)),
@@ -2063,6 +2065,9 @@ void PrefFileformats::applyRC(LyXRC & rc) const
        QString const default_otf_format = defaultOTFFormatCB->itemData(
                defaultOTFFormatCB->currentIndex()).toString();
        rc.default_otf_view_format = fromqstr(default_otf_format);
+       QString const default_platex_format = defaultPlatexFormatCB->itemData(
+               defaultPlatexFormatCB->currentIndex()).toString();
+       rc.default_platex_view_format = fromqstr(default_platex_format);
 }
 
 
@@ -2079,6 +2084,9 @@ void PrefFileformats::updateRC(LyXRC const & rc)
                pos = defaultOTFFormatCB->findData(toqstr(rc.default_otf_view_format));
                                defaultOTFFormatCB->setCurrentIndex(pos);
                defaultOTFFormatCB->setCurrentIndex(pos);
+               pos = defaultPlatexFormatCB->findData(toqstr(rc.default_platex_view_format));
+                               defaultPlatexFormatCB->setCurrentIndex(pos);
+               defaultPlatexFormatCB->setCurrentIndex(pos);
        }
 }
 
@@ -2088,14 +2096,17 @@ void PrefFileformats::updateView()
        QString const current = formatsCB->currentText();
        QString const current_def = defaultFormatCB->currentText();
        QString const current_def_otf = defaultOTFFormatCB->currentText();
+       QString const current_def_platex = defaultPlatexFormatCB->currentText();
 
        // update comboboxes with formats
        formatsCB->blockSignals(true);
        defaultFormatCB->blockSignals(true);
        defaultOTFFormatCB->blockSignals(true);
+       defaultPlatexFormatCB->blockSignals(true);
        formatsCB->clear();
        defaultFormatCB->clear();
        defaultOTFFormatCB->clear();
+       defaultPlatexFormatCB->clear();
        form_->formats().sort();
        for (Format const & f : form_->formats()) {
                QString const prettyname = toqstr(translateIfPossible(f.prettyname()));
@@ -2111,10 +2122,15 @@ void PrefFileformats::updateView()
                                        QVariant(toqstr(f.name())));
                        defaultOTFFormatCB->addItem(prettyname,
                                        QVariant(toqstr(f.name())));
-               } else if (form_->converters().isReachable("latex", f.name())
-                          || form_->converters().isReachable("pdflatex", f.name()))
-                       defaultFormatCB->addItem(prettyname,
+               } else {
+                       if (form_->converters().isReachable("latex", f.name())
+                           || form_->converters().isReachable("pdflatex", f.name()))
+                               defaultFormatCB->addItem(prettyname,
                                        QVariant(toqstr(f.name())));
+                       if (form_->converters().isReachable("platex", f.name()))
+                                       defaultPlatexFormatCB->addItem(prettyname,
+                                               QVariant(toqstr(f.name())));
+               }
        }
 
        // restore selections
@@ -2125,9 +2141,12 @@ void PrefFileformats::updateView()
        defaultFormatCB->setCurrentIndex(item < 0 ? 0 : item);
        item = defaultOTFFormatCB->findText(current_def_otf, Qt::MatchExactly);
        defaultOTFFormatCB->setCurrentIndex(item < 0 ? 0 : item);
+       item = defaultPlatexFormatCB->findText(current_def_platex, Qt::MatchExactly);
+       defaultPlatexFormatCB->setCurrentIndex(item < 0 ? 0 : item);
        formatsCB->blockSignals(false);
        defaultFormatCB->blockSignals(false);
        defaultOTFFormatCB->blockSignals(false);
+       defaultPlatexFormatCB->blockSignals(false);
 }
 
 
index faa24e42a3a500f07591b890c89fb0437d9e398b..942c31af700b6a9266d4e2f8a1e3e406823a6a65 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>386</width>
-    <height>417</height>
+    <width>496</width>
+    <height>584</height>
    </rect>
   </property>
   <property name="windowTitle">
    <item row="11" column="0" colspan="5">
     <widget class="QGroupBox" name="defaultFormatGB">
      <property name="toolTip">
-      <string>Specify the default output format when using (PDF)LaTeX</string>
+      <string>Specification of the default output formats when using specific LaTeX variants</string>
      </property>
      <property name="title">
       <string>Default Output Formats</string>
       <bool>true</bool>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QLabel" name="defaultFormatLA">
-        <property name="text">
-         <string>With &amp;TeX fonts:</string>
-        </property>
-        <property name="buddy">
-         <cstring>defaultFormatCB</cstring>
-        </property>
-       </widget>
-      </item>
-      <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 row="0" column="3">
        <spacer name="horizontalSpacer">
         <property name="orientation">
         </property>
        </spacer>
       </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="defaultOTFFormatLA">
-        <property name="text">
-         <string>With n&amp;on-TeX fonts:</string>
+      <item row="2" column="3">
+       <spacer name="horizontalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
         </property>
-        <property name="buddy">
-         <cstring>defaultFormatCB</cstring>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>148</width>
+          <height>20</height>
+         </size>
         </property>
-       </widget>
+       </spacer>
       </item>
-      <item row="1" column="1">
+      <item row="2" column="1" colspan="2">
        <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">
+      <item row="0" column="6">
+       <spacer name="horizontalSpacer_4">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         </property>
        </spacer>
       </item>
+      <item row="0" column="1" colspan="2">
+       <widget class="QComboBox" name="defaultFormatCB">
+        <property name="toolTip">
+         <string>This is the default output format for LyX documents, except for DocBook classes, documents that use non-TeX fonts and Japanese documents</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="5">
+       <widget class="QComboBox" name="defaultPlatexFormatCB">
+        <property name="toolTip">
+         <string>The default output format for Japanese documents (using pLaTeX)</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="defaultOTFFormatLA">
+        <property name="text">
+         <string>With n&amp;on-TeX fonts:</string>
+        </property>
+        <property name="buddy">
+         <cstring>defaultFormatCB</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="defaultFormatLA">
+        <property name="text">
+         <string>With &amp;TeX fonts:</string>
+        </property>
+        <property name="buddy">
+         <cstring>defaultFormatCB</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="4">
+       <widget class="QLabel" name="defaultPLatexFormatLA">
+        <property name="text">
+         <string>&amp;Japanese:</string>
+        </property>
+        <property name="buddy">
+         <cstring>defaultPlatexFormatCB</cstring>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
-   <item row="12" column="1" colspan="2">
+   <item row="12" column="1" colspan="3">
     <spacer>
      <property name="orientation">
       <enum>Qt::Vertical</enum>