]> git.lyx.org Git - lyx.git/commitdiff
Document Dialog: move the listings settings to its own pane.
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 20 Jul 2009 08:09:32 +0000 (08:09 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 20 Jul 2009 08:09:32 +0000 (08:09 +0000)
This shrinks the dialog to a somewhat reasonable size.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30706 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/ListingsSettingsUi.ui [new file with mode: 0644]
src/frontends/qt4/ui/TextLayoutUi.ui

index ada004755b91f786476e92b38e2fc3d606f919c3..33b5b977a96023c95d83587bb64f6d2e9e0bfbbb 100644 (file)
@@ -926,6 +926,7 @@ src_frontends_qt4_ui_files = Split('''
     LaTeXUi.ui
     LanguageUi.ui
     ListingsUi.ui
+    ListingsSettingsUi.ui
     LogUi.ui
     MarginsUi.ui
     MathMatrixUi.ui
index e14c0111d058d8e94477eb85c8be53cc9731a259..011d0f2faa7f500609c413533b6f72a3bf768936 100644 (file)
@@ -590,16 +590,7 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
                this, SLOT(setColSep()));
-       connect(textLayoutModule->listingsED, SIGNAL(textChanged()),
-               this, SLOT(change_adaptor()));
-       connect(textLayoutModule->bypassCB, SIGNAL(clicked()), 
-               this, SLOT(change_adaptor()));
-       connect(textLayoutModule->bypassCB, SIGNAL(clicked()), 
-               this, SLOT(setListingsMessage()));
-       connect(textLayoutModule->listingsED, SIGNAL(textChanged()),
-               this, SLOT(setListingsMessage()));
-       textLayoutModule->listingsTB->setPlainText(
-               qt_("Input listings parameters on the right. Enter ? for a list of parameters."));
+
        textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
                textLayoutModule->lspacingLE));
        textLayoutModule->indentLE->setValidator(unsignedLengthValidator(
@@ -1041,6 +1032,19 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(floatModule, SIGNAL(changed()),
                this, SLOT(change_adaptor()));
 
+       // listings
+       listingsModule = new UiWidget<Ui::ListingsSettingsUi>;
+       connect(listingsModule->listingsED, SIGNAL(textChanged()),
+               this, SLOT(change_adaptor()));
+       connect(listingsModule->bypassCB, SIGNAL(clicked()), 
+               this, SLOT(change_adaptor()));
+       connect(listingsModule->bypassCB, SIGNAL(clicked()), 
+               this, SLOT(setListingsMessage()));
+       connect(listingsModule->listingsED, SIGNAL(textChanged()),
+               this, SLOT(setListingsMessage()));
+       listingsModule->listingsTB->setPlainText(
+               qt_("Input listings parameters below. Enter ? for a list of parameters."));
+
        docPS->addPanel(latexModule, qt_("Document Class"));
        docPS->addPanel(modulesModule, qt_("Modules"));
        docPS->addPanel(fontModule, qt_("Fonts"));
@@ -1054,6 +1058,7 @@ GuiDocument::GuiDocument(GuiView & lv)
        docPS->addPanel(pdfSupportModule, qt_("PDF Properties"));
        docPS->addPanel(mathsModule, qt_("Math Options"));
        docPS->addPanel(floatModule, qt_("Float Placement"));
+       docPS->addPanel(listingsModule, qt_("Listings"));
        docPS->addPanel(bulletsModule, qt_("Bullets"));
        docPS->addPanel(branchesModule, qt_("Branches"));
        docPS->addPanel(outputModule, qt_("Output"));
@@ -1098,10 +1103,10 @@ QString GuiDocument::validateListingsParameters()
        static string param_cache;
        static QString msg_cache;
        
-       if (textLayoutModule->bypassCB->isChecked())
+       if (listingsModule->bypassCB->isChecked())
                return QString();
 
-       string params = fromqstr(textLayoutModule->listingsED->toPlainText());
+       string params = fromqstr(listingsModule->listingsED->toPlainText());
        if (params != param_cache) {
                param_cache = params;
                msg_cache = toqstr(InsetListingsParams(params).validate());
@@ -1119,13 +1124,13 @@ void GuiDocument::setListingsMessage()
                        return;
                isOK = true;
                // listingsTB->setTextColor("black");
-               textLayoutModule->listingsTB->setPlainText(
-                       qt_("Input listings parameters on the right. "
+               listingsModule->listingsTB->setPlainText(
+                       qt_("Input listings parameters below. "
                 "Enter ? for a list of parameters."));
        } else {
                isOK = false;
                // listingsTB->setTextColor("red");
-               textLayoutModule->listingsTB->setPlainText(msg);
+               listingsModule->listingsTB->setPlainText(msg);
        }
 }
 
@@ -1883,6 +1888,7 @@ void GuiDocument::applyView()
        // Modules
        modulesToParams(bp_);
 
+       // Math
        if (mathsModule->amsautoCB->isChecked()) {
                bp_.use_amsmath = BufferParams::package_auto;
        } else {
@@ -1901,6 +1907,7 @@ void GuiDocument::applyView()
                        bp_.use_esint = BufferParams::package_off;
        }
 
+       // Page Layout
        if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
                bp_.pagestyle = "default";
        else {
@@ -1910,6 +1917,7 @@ void GuiDocument::applyView()
                                bp_.pagestyle = pagestyles[i].first;
        }
 
+       // Text Layout
        switch (textLayoutModule->lspacingCO->currentIndex()) {
        case 0:
                bp_.spacing().set(Spacing::Single);
@@ -1931,10 +1939,6 @@ void GuiDocument::applyView()
        else
                bp_.columns = 1;
 
-       // text should have passed validation
-       bp_.listings_params =
-               InsetListingsParams(fromqstr(textLayoutModule->listingsED->toPlainText())).params();
-
        if (textLayoutModule->indentRB->isChecked()) {
                // if paragraphs are separated by an indentation
                bp_.paragraph_separation = BufferParams::ParagraphIndentSeparation;
@@ -1996,8 +2000,14 @@ void GuiDocument::applyView()
        else
                bp_.master = string();
 
+       // Float Placement
        bp_.float_placement = floatModule->get();
 
+       // Listings
+       // text should have passed validation
+       bp_.listings_params =
+               InsetListingsParams(fromqstr(listingsModule->listingsED->toPlainText())).params();
+
        // output
        bp_.defaultOutputFormat = fromqstr(outputModule->defaultFormatCO->itemData(
                outputModule->defaultFormatCO->currentIndex()).toString());
@@ -2314,11 +2324,6 @@ void GuiDocument::paramsToDialog()
        textLayoutModule->twoColumnCB->setChecked(
                bp_.columns == 2);
 
-       // break listings_params to multiple lines
-       string lstparams =
-               InsetListingsParams(bp_.listings_params).separatedParams();
-       textLayoutModule->listingsED->setPlainText(toqstr(lstparams));
-
        if (!bp_.options.empty()) {
                latexModule->optionsLE->setText(
                        toqstr(bp_.options));
@@ -2359,8 +2364,15 @@ void GuiDocument::paramsToDialog()
                latexModule->childDocGB->setChecked(false);
        }
 
+       // Float Settings
        floatModule->set(bp_.float_placement);
 
+       // ListingsSettings
+       // break listings_params to multiple lines
+       string lstparams =
+               InsetListingsParams(bp_.listings_params).separatedParams();
+       listingsModule->listingsED->setPlainText(toqstr(lstparams));
+
        // Output
        // update combobox with formats
        updateDefaultFormat();
index 161f48f6f66de9eca18954540c78545d8528b46c..ea9924effccaf172720296d881d87027d54ed42c 100644 (file)
@@ -34,6 +34,7 @@
 #include "ui_PDFSupportUi.h"
 #include "ui_ModulesUi.h"
 #include "ui_OutputUi.h"
+#include "ui_ListingsSettingsUi.h"
 
 #include <list>
 #include <map>
@@ -124,6 +125,7 @@ private:
        UiWidget<Ui::PDFSupportUi> *pdfSupportModule;
        UiWidget<Ui::ModulesUi> *modulesModule;
        UiWidget<Ui::OutputUi> *outputModule;
+       UiWidget<Ui::ListingsSettingsUi> *listingsModule;
        PreambleModule * preambleModule;
        
        GuiBranches * branchesModule;
index 9dd823d8de4fda33eeff4fcb83384856787ad7f7..4f1fc0c2ed79137cafec10dfb24b13c38f94f11e 100644 (file)
@@ -270,6 +270,7 @@ UIFILES = \
        LanguageUi.ui \
        LaTeXUi.ui \
        ListingsUi.ui \
+       ListingsSettingsUi.ui \
        LogUi.ui \
        MarginsUi.ui \
        MathMatrixUi.ui \
diff --git a/src/frontends/qt4/ui/ListingsSettingsUi.ui b/src/frontends/qt4/ui/ListingsSettingsUi.ui
new file mode 100644 (file)
index 0000000..3a1b1ce
--- /dev/null
@@ -0,0 +1,97 @@
+<ui version="4.0" >
+ <class>ListingsSettingsUi</class>
+ <widget class="QWidget" name="ListingsSettingsUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>219</width>
+    <height>185</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="3" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>201</width>
+       <height>21</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QTextEdit" name="listingsED" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>7</hsizetype>
+       <vsizetype>5</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Input here the listings parameters</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" >
+    <widget class="QTextBrowser" name="listingsTB" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>7</hsizetype>
+       <vsizetype>5</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="acceptDrops" >
+      <bool>false</bool>
+     </property>
+     <property name="toolTip" >
+      <string>Feedback window</string>
+     </property>
+     <property name="frameShape" >
+      <enum>QFrame::Box</enum>
+     </property>
+     <property name="frameShadow" >
+      <enum>QFrame::Plain</enum>
+     </property>
+     <property name="acceptRichText" >
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QCheckBox" name="bypassCB" >
+     <property name="toolTip" >
+      <string>Check it to enter parameters that are not recognizable by LyX</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Bypass validation</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <includes>
+  <include location="local" >qt_i18n.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
index d4005027bd9b1c90d38f3ddfcf0c0874273d6aa0..5bbee9b207d60fdd2b7f95d836538b32bc763d2e 100644 (file)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>421</width>
-    <height>416</height>
+    <height>310</height>
    </rect>
   </property>
   <property name="windowTitle" >
     <number>6</number>
    </property>
    <item row="2" column="0" >
-    <widget class="QGroupBox" name="listingsGB" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>0</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="layoutDirection" >
-      <enum>Qt::LeftToRight</enum>
-     </property>
-     <property name="title" >
-      <string>Listing settings</string>
-     </property>
-     <property name="flat" >
-      <bool>true</bool>
-     </property>
-     <layout class="QGridLayout" >
-      <property name="margin" >
-       <number>9</number>
-      </property>
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <item row="1" column="0" >
-       <widget class="QCheckBox" name="bypassCB" >
-        <property name="toolTip" >
-         <string>Check it to enter parameters that are not recognizable by LyX</string>
-        </property>
-        <property name="text" >
-         <string>&amp;Bypass validation</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="0" >
-       <widget class="QTextBrowser" name="listingsTB" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>0</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="acceptDrops" >
-         <bool>false</bool>
-        </property>
-        <property name="toolTip" >
-         <string>Feedback window</string>
-        </property>
-        <property name="frameShape" >
-         <enum>QFrame::Box</enum>
-        </property>
-        <property name="frameShadow" >
-         <enum>QFrame::Plain</enum>
-        </property>
-        <property name="acceptRichText" >
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1" >
-       <widget class="QTextEdit" name="listingsED" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>0</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="toolTip" >
-         <string>Input here the listings parameters</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="1" column="0" >
-    <widget class="QGroupBox" name="spacingGB" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>0</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize" >
-      <size>
-       <width>0</width>
-       <height>0</height>
-      </size>
-     </property>
-     <property name="title" >
-      <string>Spacing</string>
-     </property>
-     <property name="flat" >
-      <bool>true</bool>
-     </property>
-     <property name="checkable" >
-      <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="QLabel" name="lspacingL" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>0</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="minimumSize" >
-         <size>
-          <width>91</width>
-          <height>18</height>
-         </size>
-        </property>
-        <property name="text" >
-         <string>&amp;Line spacing:</string>
-        </property>
-        <property name="buddy" >
-         <cstring>lspacingCO</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1" >
-       <widget class="QComboBox" name="lspacingCO" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>0</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="toolTip" >
-         <string>Spacing type</string>
-        </property>
-        <property name="duplicatesEnabled" >
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="2" >
-       <widget class="QLineEdit" name="lspacingLE" >
-        <property name="enabled" >
-         <bool>false</bool>
-        </property>
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>0</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="toolTip" >
-         <string>Number of lines</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0" colspan="2" >
-       <widget class="QCheckBox" name="twoColumnCB" >
-        <property name="toolTip" >
-         <string>Format text into two columns</string>
-        </property>
-        <property name="text" >
-         <string>Two-&amp;column document</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="3" column="0" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>401</width>
-       <height>16</height>
+       <width>403</width>
+       <height>21</height>
       </size>
      </property>
     </spacer>
         </property>
        </widget>
       </item>
+      <item row="1" column="3" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="3" column="3" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QGroupBox" name="spacingGB" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>0</hsizetype>
+       <vsizetype>0</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Spacing</string>
+     </property>
+     <property name="flat" >
+      <bool>true</bool>
+     </property>
+     <property name="checkable" >
+      <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="QLabel" name="lspacingL" >
+        <property name="sizePolicy" >
+         <sizepolicy>
+          <hsizetype>0</hsizetype>
+          <vsizetype>0</vsizetype>
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize" >
+         <size>
+          <width>91</width>
+          <height>18</height>
+         </size>
+        </property>
+        <property name="text" >
+         <string>&amp;Line spacing:</string>
+        </property>
+        <property name="buddy" >
+         <cstring>lspacingCO</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="QComboBox" name="lspacingCO" >
+        <property name="sizePolicy" >
+         <sizepolicy>
+          <hsizetype>0</hsizetype>
+          <vsizetype>0</vsizetype>
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="toolTip" >
+         <string>Spacing type</string>
+        </property>
+        <property name="duplicatesEnabled" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2" >
+       <widget class="QLineEdit" name="lspacingLE" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+        <property name="sizePolicy" >
+         <sizepolicy>
+          <hsizetype>0</hsizetype>
+          <vsizetype>0</vsizetype>
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="toolTip" >
+         <string>Number of lines</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" colspan="2" >
+       <widget class="QCheckBox" name="twoColumnCB" >
+        <property name="toolTip" >
+         <string>Format text into two columns</string>
+        </property>
+        <property name="text" >
+         <string>Two-&amp;column document</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>