Index: mscore/pagesettings.cpp
===================================================================
--- mscore/pagesettings.cpp	(revision 4704)
+++ mscore/pagesettings.cpp	(working copy)
@@ -66,18 +66,18 @@
       connect(twosided,             SIGNAL(toggled(bool)),        SLOT(twosidedToggled(bool)));
       connect(pageHeight,           SIGNAL(valueChanged(double)), SLOT(pageHeightChanged(double)));
       connect(pageWidth,            SIGNAL(valueChanged(double)), SLOT(pageWidthChanged(double)));
-      connect(printableWidth,       SIGNAL(valueChanged(double)), SLOT(pwChanged(double)));
+      //connect(printableWidth,       SIGNAL(valueChanged(double)), SLOT(pwChanged(double)));
       connect(oddPageTopMargin,     SIGNAL(valueChanged(double)), SLOT(otmChanged(double)));
       connect(oddPageBottomMargin,  SIGNAL(valueChanged(double)), SLOT(obmChanged(double)));
       connect(oddPageLeftMargin,    SIGNAL(valueChanged(double)), SLOT(olmChanged(double)));
       connect(oddPageRightMargin,   SIGNAL(valueChanged(double)), SLOT(ormChanged(double)));
       connect(evenPageTopMargin,    SIGNAL(valueChanged(double)), SLOT(etmChanged(double)));
       connect(evenPageBottomMargin, SIGNAL(valueChanged(double)), SLOT(ebmChanged(double)));
-      connect(evenPageLeftMargin,   SIGNAL(valueChanged(double)), SLOT(elmChanged(double)));
-      connect(evenPageRightMargin,  SIGNAL(valueChanged(double)), SLOT(ermChanged(double)));
+      /*connect(evenPageLeftMargin,   SIGNAL(valueChanged(double)), SLOT(elmChanged(double)));
+      connect(evenPageRightMargin,  SIGNAL(valueChanged(double)), SLOT(ermChanged(double)));*/
       connect(pageGroup,            SIGNAL(activated(int)),       SLOT(pageFormatSelected(int)));
       connect(spatiumEntry,         SIGNAL(valueChanged(double)), SLOT(spatiumChanged(double)));
-	connect(pageOffsetEntry,      SIGNAL(valueChanged(int)),    SLOT(pageOffsetChanged(int)));
+      connect(pageOffsetEntry,      SIGNAL(valueChanged(int)),    SLOT(pageOffsetChanged(int)));
       }
 
 //---------------------------------------------------------
@@ -135,8 +135,8 @@
       spatiumEntry->blockSignals(true);
       pageWidth->blockSignals(true);
       pageHeight->blockSignals(true);
-	pageOffsetEntry->blockSignals(true);
-      printableWidth->blockSignals(true);
+      pageOffsetEntry->blockSignals(true);
+      //printableWidth->blockSignals(true);
 
       const char* suffix = mm ? "mm" : "in";
       oddPageTopMargin->setSuffix(suffix);
@@ -150,13 +150,13 @@
       spatiumEntry->setSuffix(suffix);
       pageWidth->setSuffix(suffix);
       pageHeight->setSuffix(suffix);
-      printableWidth->setSuffix(suffix);
+      //printableWidth->setSuffix(suffix);
 
       PageFormat* pf = sc->pageFormat();
 
       QString s;
 
-      qreal printableWidthValue = pf->printableWidth();
+      //qreal printableWidthValue = pf->printableWidth();
       qreal widthValue = pf->width();
       if (mm) {
             oddPageTopMargin->setValue(pf->oddTopMargin() * INCH);
@@ -172,7 +172,7 @@
             spatiumEntry->setValue(cs->spatium()/DPMM);
             pageHeight->setValue(pf->height() * INCH);
             widthValue          *= INCH;
-            printableWidthValue *= INCH;
+            //printableWidthValue *= INCH;
             }
       else {
             oddPageTopMargin->setValue(pf->oddTopMargin());
@@ -189,24 +189,33 @@
             pageHeight->setValue(pf->height());
             }
       pageWidth->setValue(widthValue);
-      printableWidth->setValue(printableWidthValue);
-      printableWidth->setMaximum(widthValue);
-      qreal maxBorder = widthValue - printableWidthValue;
+      //printableWidth->setValue(printableWidthValue);
+      //printableWidth->setMaximum(widthValue);
+      //qreal maxBorder = widthValue - printableWidthValue;
 
-      oddPageLeftMargin->setMaximum(maxBorder);
-      oddPageRightMargin->setMaximum(maxBorder);
-      evenPageLeftMargin->setMaximum(maxBorder);
-      evenPageRightMargin->setMaximum(maxBorder);
+      oddPageLeftMargin->setMaximum(widthValue);
+      oddPageRightMargin->setMaximum(widthValue);
+      evenPageLeftMargin->setMaximum(widthValue);
+      evenPageRightMargin->setMaximum(widthValue);
 
       evenPageTopMargin->setEnabled(pf->twosided());
       evenPageBottomMargin->setEnabled(pf->twosided());
-      evenPageLeftMargin->setEnabled(pf->twosided());
-      evenPageRightMargin->setEnabled(pf->twosided());
+      evenPageLeftMargin->setEnabled(false);
+      evenPageRightMargin->setEnabled(false);
+      
+      if(twosided->isChecked()) {
+            evenPageRightMargin->setValue(oddPageLeftMargin->value());
+            evenPageLeftMargin->setValue(oddPageRightMargin->value());
+            }
+      else {
+            evenPageRightMargin->setValue(oddPageRightMargin->value());
+            evenPageLeftMargin->setValue(oddPageLeftMargin->value());
+      }
 
       landscape->setChecked(pf->landscape());
       twosided->setChecked(pf->twosided());
 
-	pageOffsetEntry->setValue(sc->pageNumberOffset() + 1);
+      pageOffsetEntry->setValue(sc->pageNumberOffset() + 1);
 
       pageWidth->blockSignals(false);
       pageHeight->blockSignals(false);
@@ -219,8 +228,8 @@
       evenPageLeftMargin->blockSignals(false);
       evenPageRightMargin->blockSignals(false);
       spatiumEntry->blockSignals(false);
-	pageOffsetEntry->blockSignals(false);
-      printableWidth->blockSignals(false);
+      pageOffsetEntry->blockSignals(false);
+      //printableWidth->blockSignals(false);
 	}
 
 //---------------------------------------------------------
@@ -279,7 +288,7 @@
       pf.setSize(pageGroup->currentIndex());
       pf.setWidth(pageWidth->value() * f);
       pf.setHeight(pageHeight->value() * f);
-      pf.setPrintableWidth(printableWidth->value() * f);
+      pf.setPrintableWidth((pageWidth->value() - oddPageLeftMargin->value() - oddPageRightMargin->value())  * f);
       pf.setEvenTopMargin(evenPageTopMargin->value() * f);
       pf.setEvenBottomMargin(evenPageBottomMargin->value() * f);
       pf.setEvenLeftMargin(evenPageLeftMargin->value() * f);
@@ -349,16 +358,20 @@
       if (mmUnit)
             val /= INCH;
 
+      if(twosided->isChecked()) {
+            evenPageRightMargin->blockSignals(true);
+            evenPageRightMargin->setValue(val * (mmUnit ? INCH : 1.0));
+            evenPageRightMargin->blockSignals(false);
+            }
+      else{
+            evenPageLeftMargin->blockSignals(true);
+            evenPageLeftMargin->setValue(val * (mmUnit ? INCH : 1.0));
+            evenPageLeftMargin->blockSignals(false);
+            }
       PageFormat* pf = preview->score()->pageFormat();
+      pf->setPrintableWidth(pf->width() - pf->oddRightMargin() - val);
       pf->setOddLeftMargin(val);
-
-      // right margin depends, as score width is identical
-      // for even and odd pages
-      oddPageRightMargin->blockSignals(true);
-      oddPageRightMargin->setValue(pf->oddRightMargin() * (mmUnit ? INCH : 1.0));
-      evenPageRightMargin->blockSignals(false);
-
-      updatePreview(1);
+      updatePreview(0);
       }
 
 //---------------------------------------------------------
@@ -372,13 +385,19 @@
 
       PageFormat* pf = preview->score()->pageFormat();
 
-      // left margin depends, as score width is identical
-      // for even and odd pages
-      oddPageLeftMargin->blockSignals(true);
-      oddPageLeftMargin->setValue((pf->width() - pf->printableWidth() - val) * (mmUnit ? INCH : 1.0));
-      evenPageRightMargin->blockSignals(false);
-
-      updatePreview(1);
+      if(twosided->isChecked()) {
+            evenPageLeftMargin->blockSignals(true);
+            evenPageLeftMargin->setValue(val * (mmUnit ? INCH : 1.0));
+            evenPageLeftMargin->blockSignals(false);
+            }
+      else {
+            evenPageRightMargin->blockSignals(true);
+            evenPageRightMargin->setValue(val * (mmUnit ? INCH : 1.0));
+            evenPageRightMargin->blockSignals(false);
+            }
+            
+      pf->setPrintableWidth(pf->width() - pf->oddLeftMargin() - val);
+      updatePreview(0);
       }
 
 //---------------------------------------------------------
@@ -409,7 +428,7 @@
 //   elmChanged
 //---------------------------------------------------------
 
-void PageSettings::elmChanged(double val)
+/*void PageSettings::elmChanged(double val)
       {
       if (mmUnit)
             val /= INCH;
@@ -424,13 +443,13 @@
       evenPageRightMargin->blockSignals(false);
 
       updatePreview(1);
-      }
+      }*/
 
 //---------------------------------------------------------
 //   ermChanged
 //---------------------------------------------------------
 
-void PageSettings::ermChanged(double val)
+/*void PageSettings::ermChanged(double val)
       {
       if (mmUnit)
             val /= INCH;
@@ -444,7 +463,7 @@
       evenPageLeftMargin->blockSignals(false);
 
       updatePreview(1);
-      }
+      }*/
 
 //---------------------------------------------------------
 //   ebmChanged
@@ -544,7 +563,7 @@
 //   pwChanged
 //---------------------------------------------------------
 
-void PageSettings::pwChanged(double val)
+/*void PageSettings::pwChanged(double val)
       {
       if (mmUnit)
             val /= INCH;
@@ -559,5 +578,5 @@
 
       updateValues();
       updatePreview(0);
-      }
+      }*/
 
Index: mscore/pagesettings.h
===================================================================
--- mscore/pagesettings.h	(revision 4704)
+++ mscore/pagesettings.h	(working copy)
@@ -48,7 +48,7 @@
       void ok();
       void done(int val);
 
-      void pwChanged(double val);
+      //void pwChanged(double val);
       void twosidedToggled(bool);
       void landscapeToggled(bool);
       void otmChanged(double val);
@@ -57,8 +57,8 @@
       void ormChanged(double val);
       void etmChanged(double val);
       void ebmChanged(double val);
-      void elmChanged(double val);
-      void ermChanged(double val);
+      // elmChanged(double val);
+      // void ermChanged(double val);
       void spatiumChanged(double val);
       void pageHeightChanged(double);
       void pageWidthChanged(double);
Index: mscore/pagesettings.ui
===================================================================
--- mscore/pagesettings.ui	(revision 4704)
+++ mscore/pagesettings.ui	(working copy)
@@ -70,8 +70,21 @@
      </item>
     </layout>
    </item>
+   <item row="1" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item row="0" column="0">
-    <layout class="QVBoxLayout">
+    <layout class="QVBoxLayout" stretch="0,0,0,0">
      <property name="spacing">
       <number>6</number>
      </property>
@@ -274,6 +287,24 @@
      </item>
     </layout>
    </item>
+   <item row="0" column="2" rowspan="2">
+    <widget class="QGroupBox" name="previewGroup">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title">
+      <string>Preview</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item row="0" column="1">
     <layout class="QVBoxLayout">
      <property name="spacing">
@@ -284,79 +315,30 @@
      </property>
      <item>
       <widget class="QGroupBox" name="groupBox_5">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
        <property name="title">
         <string>Printable Area</string>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_2">
         <item>
-         <layout class="QFormLayout" name="formLayout">
-          <property name="fieldGrowthPolicy">
-           <enum>QFormLayout::ExpandingFieldsGrow</enum>
-          </property>
-          <property name="horizontalSpacing">
-           <number>6</number>
-          </property>
-          <property name="verticalSpacing">
-           <number>6</number>
-          </property>
-          <property name="margin">
-           <number>8</number>
-          </property>
-          <item row="0" column="0">
-           <widget class="QLabel" name="label_14">
-            <property name="text">
-             <string>Width:</string>
-            </property>
-            <property name="textFormat">
-             <enum>Qt::PlainText</enum>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="1">
-           <widget class="QDoubleSpinBox" name="printableWidth">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="maximum">
-             <double>20000.000000000000000</double>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <widget class="QGroupBox" name="groupBox_3">
+         <widget class="QGroupBox" name="groupBox_4">
           <property name="title">
-           <string>Even Page Margins</string>
+           <string>Odd Page Margins</string>
           </property>
-          <layout class="QFormLayout" name="formLayout_2">
-           <property name="horizontalSpacing">
-            <number>6</number>
-           </property>
-           <property name="verticalSpacing">
-            <number>6</number>
-           </property>
+          <layout class="QGridLayout" name="gridLayout_2">
            <property name="margin">
             <number>8</number>
            </property>
-           <item row="0" column="0">
-            <widget class="QLabel" name="label_4">
-             <property name="text">
-              <string>Left margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>evenPageLeftMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="1">
-            <widget class="QDoubleSpinBox" name="evenPageLeftMargin">
+           <property name="spacing">
+            <number>6</number>
+           </property>
+           <item row="2" column="0">
+            <widget class="QDoubleSpinBox" name="oddPageLeftMargin">
              <property name="sizePolicy">
               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
@@ -368,23 +350,10 @@
              </property>
             </widget>
            </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_5">
-             <property name="text">
-              <string>Right margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>evenPageRightMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QDoubleSpinBox" name="evenPageRightMargin">
+           <item row="4" column="1">
+            <widget class="QDoubleSpinBox" name="oddPageBottomMargin">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -394,23 +363,10 @@
              </property>
             </widget>
            </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="label_6">
-             <property name="text">
-              <string>Top margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>evenPageTopMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="1">
-            <widget class="QDoubleSpinBox" name="evenPageTopMargin">
+           <item row="1" column="1">
+            <widget class="QDoubleSpinBox" name="oddPageTopMargin">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -420,21 +376,21 @@
              </property>
             </widget>
            </item>
-           <item row="3" column="0">
-            <widget class="QLabel" name="label_7">
-             <property name="text">
-              <string>Bottom margin:</string>
+           <item row="2" column="1">
+            <spacer name="horizontalSpacer_2">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
              </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>20</width>
+               <height>20</height>
+              </size>
              </property>
-             <property name="buddy">
-              <cstring>evenPageBottomMargin</cstring>
-             </property>
-            </widget>
+            </spacer>
            </item>
-           <item row="3" column="1">
-            <widget class="QDoubleSpinBox" name="evenPageBottomMargin">
+           <item row="2" column="2">
+            <widget class="QDoubleSpinBox" name="oddPageRightMargin">
              <property name="sizePolicy">
               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
                <horstretch>0</horstretch>
@@ -450,35 +406,19 @@
          </widget>
         </item>
         <item>
-         <widget class="QGroupBox" name="groupBox_4">
+         <widget class="QGroupBox" name="groupBox_3">
           <property name="title">
-           <string>Odd Page Margins</string>
+           <string>Even Page Margins</string>
           </property>
-          <layout class="QFormLayout" name="formLayout_3">
-           <property name="horizontalSpacing">
-            <number>6</number>
-           </property>
-           <property name="verticalSpacing">
-            <number>6</number>
-           </property>
+          <layout class="QGridLayout" name="gridLayout_3">
            <property name="margin">
             <number>8</number>
            </property>
-           <item row="0" column="0">
-            <widget class="QLabel" name="label_8">
-             <property name="text">
-              <string>Left margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>oddPageLeftMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="1">
-            <widget class="QDoubleSpinBox" name="oddPageLeftMargin">
+           <property name="spacing">
+            <number>6</number>
+           </property>
+           <item row="2" column="0">
+            <widget class="QDoubleSpinBox" name="evenPageLeftMargin">
              <property name="sizePolicy">
               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
@@ -490,21 +430,8 @@
              </property>
             </widget>
            </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_9">
-             <property name="text">
-              <string>Right margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>oddPageRightMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QDoubleSpinBox" name="oddPageRightMargin">
+           <item row="2" column="2">
+            <widget class="QDoubleSpinBox" name="evenPageRightMargin">
              <property name="sizePolicy">
               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
                <horstretch>0</horstretch>
@@ -516,23 +443,10 @@
              </property>
             </widget>
            </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="label_10">
-             <property name="text">
-              <string>Top margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>oddPageTopMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="1">
-            <widget class="QDoubleSpinBox" name="oddPageTopMargin">
+           <item row="3" column="1">
+            <widget class="QDoubleSpinBox" name="evenPageBottomMargin">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -542,23 +456,10 @@
              </property>
             </widget>
            </item>
-           <item row="3" column="0">
-            <widget class="QLabel" name="label_11">
-             <property name="text">
-              <string>Bottom margin:</string>
-             </property>
-             <property name="textFormat">
-              <enum>Qt::PlainText</enum>
-             </property>
-             <property name="buddy">
-              <cstring>oddPageBottomMargin</cstring>
-             </property>
-            </widget>
-           </item>
-           <item row="3" column="1">
-            <widget class="QDoubleSpinBox" name="oddPageBottomMargin">
+           <item row="0" column="1">
+            <widget class="QDoubleSpinBox" name="evenPageTopMargin">
              <property name="sizePolicy">
-              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
@@ -576,37 +477,6 @@
      </item>
     </layout>
    </item>
-   <item row="1" column="0">
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="0" column="2" rowspan="2">
-    <widget class="QGroupBox" name="previewGroup">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title">
-      <string>Preview</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout"/>
-      </item>
-     </layout>
-    </widget>
-   </item>
   </layout>
  </widget>
  <tabstops>
@@ -621,14 +491,6 @@
   <tabstop>spatiumEntry</tabstop>
   <tabstop>mmButton</tabstop>
   <tabstop>inchButton</tabstop>
-  <tabstop>evenPageLeftMargin</tabstop>
-  <tabstop>evenPageRightMargin</tabstop>
-  <tabstop>evenPageTopMargin</tabstop>
-  <tabstop>evenPageBottomMargin</tabstop>
-  <tabstop>oddPageLeftMargin</tabstop>
-  <tabstop>oddPageRightMargin</tabstop>
-  <tabstop>oddPageTopMargin</tabstop>
-  <tabstop>oddPageBottomMargin</tabstop>
  </tabstops>
  <resources/>
  <connections>
