]> git.lyx.org Git - features.git/commitdiff
* GuiDocument:
authorUwe Stöhr <uwestoehr@web.de>
Tue, 18 May 2010 02:56:36 +0000 (02:56 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Tue, 18 May 2010 02:56:36 +0000 (02:56 +0000)
- fix #6699; use_geometry now only means that the user don't want to have custom margins; that geometry also needs to be loaded for some paper formats is already done in BufferParams.cpp
- remove portraitChanged() because this was useless - A4 landscape is still A4 and still uses the default margins

* BufferParams.cpp: only output the margins if the option "Default margins" is not checked - this was a bug in the margins UI

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

src/BufferParams.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h

index d944c744a60340f2e20a2082b8d1cfca3c0fb2d0..a23bfd2d6d4c5653c3ff3dd1979bc24a0c842e5a 100644 (file)
@@ -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");
        }
index 8426b492823a1fa3545f6935ac16e389f917851d..427b383163fcc24233ad5498286968329b03515b 100644 (file)
@@ -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);
index 29eaa49a98ba1de0594beb670ff88b8ea716fe1f..61d6031f9d599fea297ee6866b1c5f8f90b9cba2 100644 (file)
@@ -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();