diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index d944c744a6..a23bfd2d6d 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1397,7 +1397,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, texrow.newline(); } if (!tclass.provides("geometry") - && (use_geometry || nonstandard_papersize)) { + && (use_geometry || nonstandard_papersize)) { odocstringstream ods; if (!getGraphicsDriver("geometry").empty()) ods << getGraphicsDriver("geometry"); @@ -1536,25 +1536,28 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, os << '[' << g_options << ']'; os << "{geometry}\n"; texrow.newline(); - os << "\\geometry{verbose"; - if (!topmargin.empty()) - os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString()); - if (!bottommargin.empty()) - os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString()); - if (!leftmargin.empty()) - os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString()); - if (!rightmargin.empty()) - os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString()); - if (!headheight.empty()) - os << ",headheight=" << from_ascii(Length(headheight).asLatexString()); - if (!headsep.empty()) - os << ",headsep=" << from_ascii(Length(headsep).asLatexString()); - if (!footskip.empty()) - os << ",footskip=" << from_ascii(Length(footskip).asLatexString()); - if (!columnsep.empty()) - os << ",columnsep=" << from_ascii(Length(columnsep).asLatexString()); - os << "}\n"; - texrow.newline(); + // output this if only use_geometry is true + if (use_geometry) { + os << "\\geometry{verbose"; + if (!topmargin.empty()) + os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString()); + if (!bottommargin.empty()) + os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString()); + if (!leftmargin.empty()) + os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString()); + if (!rightmargin.empty()) + os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString()); + if (!headheight.empty()) + os << ",headheight=" << from_ascii(Length(headheight).asLatexString()); + if (!headsep.empty()) + os << ",headsep=" << from_ascii(Length(headsep).asLatexString()); + if (!footskip.empty()) + os << ",footskip=" << from_ascii(Length(footskip).asLatexString()); + if (!columnsep.empty()) + os << ",columnsep=" << from_ascii(Length(columnsep).asLatexString()); + os << "}\n"; + texrow.newline(); + } } else if (orientation == ORIENTATION_LANDSCAPE) { features.require("papersize"); } diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 8426b49282..427b383163 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -721,7 +721,7 @@ GuiDocument::GuiDocument(GuiView & lv) connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(papersizeChanged(int))); connect(pageLayoutModule->portraitRB, SIGNAL(clicked()), - this, SLOT(portraitChanged())); + this, SLOT(change_adaptor())); connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString &)), @@ -1297,13 +1297,7 @@ void GuiDocument::enableSkip(bool skip) } -void GuiDocument::portraitChanged() -{ - setMargins(pageLayoutModule->papersizeCO->currentIndex()); -} - - -void GuiDocument::setMargins(bool custom) +void GuiDocument::setMargins() { bool const extern_geometry = documentClass().provides("geometry"); @@ -1313,8 +1307,12 @@ void GuiDocument::setMargins(bool custom) setCustomMargins(true); return; } - marginsModule->marginCB->setChecked(custom); - setCustomMargins(custom); + bool custom = false; + // only check marginCB when there are no custom margins set + if (bp_.use_geometry) + custom = true; + marginsModule->marginCB->setChecked(!custom); + setCustomMargins(!custom); } @@ -2353,12 +2351,6 @@ void GuiDocument::applyView() bp_.papersize = PAPER_SIZE( pageLayoutModule->papersizeCO->currentIndex()); - // only custom, A4, B4, B5 and the US sizes don't need the LaTeX- - // package gegeometry - int psize = pageLayoutModule->papersizeCO->currentIndex(); - bool geom_papersize = (psize != 1 && psize != 2 && psize != 3 - && psize != 4 && psize != 9 && psize != 10 && psize != 17); - bp_.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE, pageLayoutModule->paperwidthUnitCO); @@ -2376,8 +2368,7 @@ void GuiDocument::applyView() bp_.orientation = ORIENTATION_PORTRAIT; // margins - bp_.use_geometry = !marginsModule->marginCB->isChecked() - || geom_papersize; + bp_.use_geometry = !marginsModule->marginCB->isChecked(); Ui::MarginsUi const * m = marginsModule; @@ -2822,7 +2813,7 @@ void GuiDocument::paramsToDialog() // margins Ui::MarginsUi * m = marginsModule; - setMargins(!bp_.use_geometry); + setMargins(); lengthToWidgets(m->topLE, m->topUnit, bp_.topmargin, defaultUnit); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 29eaa49a98..61d6031f9d 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -88,7 +88,7 @@ private Q_SLOTS: void saveDefaultClicked(); void useDefaultsClicked(); void setLSpacing(int); - void setMargins(bool); + void setMargins(); void papersizeChanged(int); void setColSep(); void setCustomMargins(bool); @@ -100,7 +100,6 @@ private Q_SLOTS: void enableIndent(bool); void setSkip(int); void enableSkip(bool); - void portraitChanged(); void browseLayout(); void browseMaster(); void classChanged();