From fcc8201d2c1d41da89d90df610f0b36bbb1b6f01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 20 Jul 2009 08:09:32 +0000 Subject: [PATCH] Document Dialog: move the listings settings to its own pane. 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 | 1 + src/frontends/qt4/GuiDocument.cpp | 60 ++-- src/frontends/qt4/GuiDocument.h | 2 + src/frontends/qt4/Makefile.am | 1 + src/frontends/qt4/ui/ListingsSettingsUi.ui | 97 +++++++ src/frontends/qt4/ui/TextLayoutUi.ui | 323 +++++++++------------ 6 files changed, 271 insertions(+), 213 deletions(-) create mode 100644 src/frontends/qt4/ui/ListingsSettingsUi.ui diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index ada004755b..33b5b977a9 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -926,6 +926,7 @@ src_frontends_qt4_ui_files = Split(''' LaTeXUi.ui LanguageUi.ui ListingsUi.ui + ListingsSettingsUi.ui LogUi.ui MarginsUi.ui MathMatrixUi.ui diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index e14c0111d0..011d0f2faa 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -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; + 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(); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 161f48f6f6..ea9924effc 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -34,6 +34,7 @@ #include "ui_PDFSupportUi.h" #include "ui_ModulesUi.h" #include "ui_OutputUi.h" +#include "ui_ListingsSettingsUi.h" #include #include @@ -124,6 +125,7 @@ private: UiWidget *pdfSupportModule; UiWidget *modulesModule; UiWidget *outputModule; + UiWidget *listingsModule; PreambleModule * preambleModule; GuiBranches * branchesModule; diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 9dd823d8de..4f1fc0c2ed 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -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 index 0000000000..3a1b1ce2fb --- /dev/null +++ b/src/frontends/qt4/ui/ListingsSettingsUi.ui @@ -0,0 +1,97 @@ + + ListingsSettingsUi + + + + 0 + 0 + 219 + 185 + + + + + + + + 9 + + + 6 + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 201 + 21 + + + + + + + + + 7 + 5 + 0 + 0 + + + + Input here the listings parameters + + + + + + + + 7 + 5 + 0 + 0 + + + + false + + + Feedback window + + + QFrame::Box + + + QFrame::Plain + + + false + + + + + + + Check it to enter parameters that are not recognizable by LyX + + + &Bypass validation + + + + + + + qt_i18n.h + + + + diff --git a/src/frontends/qt4/ui/TextLayoutUi.ui b/src/frontends/qt4/ui/TextLayoutUi.ui index d4005027bd..5bbee9b207 100644 --- a/src/frontends/qt4/ui/TextLayoutUi.ui +++ b/src/frontends/qt4/ui/TextLayoutUi.ui @@ -6,7 +6,7 @@ 0 0 421 - 416 + 310 @@ -20,192 +20,6 @@ 6 - - - - 0 - 0 - 0 - 0 - - - - Qt::LeftToRight - - - Listing settings - - - true - - - - 9 - - - 6 - - - - - Check it to enter parameters that are not recognizable by LyX - - - &Bypass validation - - - - - - - - 0 - 0 - 0 - 0 - - - - false - - - Feedback window - - - QFrame::Box - - - QFrame::Plain - - - false - - - - - - - - 0 - 0 - 0 - 0 - - - - Input here the listings parameters - - - - - - - - - - - 0 - 0 - 0 - 0 - - - - - 0 - 0 - - - - Spacing - - - true - - - false - - - - 9 - - - 6 - - - - - - 0 - 0 - 0 - 0 - - - - - 91 - 18 - - - - &Line spacing: - - - lspacingCO - - - - - - - - 0 - 0 - 0 - 0 - - - - Spacing type - - - false - - - - - - - false - - - - 0 - 0 - 0 - 0 - - - - Number of lines - - - - - - - Format text into two columns - - - Two-&column document - - - - - - - Qt::Vertical @@ -215,8 +29,8 @@ - 401 - 16 + 403 + 21 @@ -393,6 +207,137 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + 0 + 0 + + + + + 0 + 0 + + + + Spacing + + + true + + + false + + + + 9 + + + 6 + + + + + + 0 + 0 + 0 + 0 + + + + + 91 + 18 + + + + &Line spacing: + + + lspacingCO + + + + + + + + 0 + 0 + 0 + 0 + + + + Spacing type + + + false + + + + + + + false + + + + 0 + 0 + 0 + 0 + + + + Number of lines + + + + + + + Format text into two columns + + + Two-&column document + + + -- 2.39.5