=== modified file 'src/ui/widget/page-sizer.cpp'
--- src/ui/widget/page-sizer.cpp	2009-11-28 23:40:28 +0000
+++ src/ui/widget/page-sizer.cpp	2009-12-25 10:44:10 +0000
@@ -229,6 +229,10 @@
       _dimensionUnits( _("U_nits:"), "units", _wr ),
       _dimensionWidth( _("_Width:"), _("Width of paper"), "width", _dimensionUnits, _wr ),
       _dimensionHeight( _("_Height:"), _("Height of paper"), "height", _dimensionUnits, _wr ),
+      _marginTop( _("Top:"), _("Top margin"), "marginTop", _dimensionUnits, _wr ),
+      _marginLeft( _("Left:"), _("Left margin"), "marginLeft", _dimensionUnits, _wr),
+      _marginRight( _("Right:"), _("Right margin"), "marginRight", _dimensionUnits, _wr),
+      _marginBottom( _("Bottom:"), _("Bottom margin"), "marginBottom", _dimensionUnits, _wr),
       _widgetRegistry(&_wr)
 {
     //# Set up the Paper Size combo box
@@ -295,23 +299,46 @@
     _orientationBox.pack_end (_portraitButton, false, false, 5);
     _portraitButton.set_group (group);
     _portraitButton.set_active (true);
-
+    
     //## Set up custom size frame
     _customFrame.set_label(_("Custom size"));
     pack_start (_customFrame, false, false, 0);
-    _customTable.resize(2, 2);
+    _customTable.resize(3, 2);
     _customTable.set_border_width (4);
     _customTable.set_row_spacings (4);
     _customTable.set_col_spacings (4);
     _customTable.attach(_dimensionWidth, 0,1,0,1);
     _customTable.attach(_dimensionUnits, 1,2,0,1);
     _customTable.attach(_dimensionHeight, 0,1,1,2);
-    _customTable.attach(_fitPageButton,              1,2,1,2);
+    _customTable.attach(_fitPageButton, 1,2,1,2);
+    _customTable.attach(_fitPageMarginExpander, 0,2,2,3);
     _customFrame.add(_customTable);
 
     _fitPageButton.set_use_underline();
     _fitPageButton.set_label(_("_Fit page to selection"));
     _tips.set_tip(_fitPageButton, _("Resize the page to fit the current selection, or the entire drawing if there is no selection"));
+    
+    _fitPageMarginExpander.set_label(_("Margins (for Fit page to selection):"));
+    _marginTable.resize(3, 2);
+    _marginTable.set_border_width(4);
+    _marginTable.set_row_spacings(4);
+    _marginTable.set_col_spacings(4);
+    _marginTable.attach(_marginTopAlign, 0,2,0,1);
+    _marginTable.attach(_marginLeftAlign, 0,1,1,2);
+    _marginTable.attach(_marginRightAlign, 1,2,1,2);
+    _marginTable.attach(_marginBottomAlign, 0,2,2,3);
+    _fitPageMarginExpander.add(_marginTable);
+    
+    //## Set up margin settings
+    _marginTopAlign.set(0.5, 0.5, 0.0, 1.0);
+    _marginTopAlign.add(_marginTop);
+    _marginLeftAlign.set(0.0, 0.5, 0.0, 1.0);
+    _marginLeftAlign.add(_marginLeft);
+    _marginRightAlign.set(1.0, 0.5, 0.0, 1.0);
+    _marginRightAlign.add(_marginRight);
+    _marginBottomAlign.set(0.5, 0.5, 0.0, 1.0);
+    _marginBottomAlign.add(_marginBottom);
+    
 }
 
 
@@ -454,7 +481,7 @@
 
 
 /**
- * Tell the desktop to change the page size
+ * Tell the desktop to fit the page size to the selection or drawing.
  */
 void
 PageSizer::fire_fit_canvas_to_selection_or_drawing()

=== modified file 'src/ui/widget/page-sizer.h'
--- src/ui/widget/page-sizer.h	2008-02-27 09:35:01 +0000
+++ src/ui/widget/page-sizer.h	2009-12-25 09:37:46 +0000
@@ -183,7 +183,7 @@
     Gtk::HBox           _orientationBox;
     Gtk::Label          _orientationLabel;
     Gtk::RadioButton    _portraitButton;
-	Gtk::RadioButton    _landscapeButton;
+    Gtk::RadioButton    _landscapeButton;
     //callbacks
     void on_portrait();
     void on_landscape();
@@ -195,12 +195,24 @@
     Gtk::Table           _customTable;
     RegisteredUnitMenu   _dimensionUnits;
     RegisteredScalarUnit _dimensionWidth;
-	RegisteredScalarUnit _dimensionHeight;
-	Gtk::Button          _fitPageButton;
+    RegisteredScalarUnit _dimensionHeight;
+    Gtk::Button          _fitPageButton;
+    Gtk::Expander        _fitPageMarginExpander;
+    Gtk::Table           _marginTable;
+    Gtk::Alignment       _marginTopAlign;
+    Gtk::Alignment       _marginLeftAlign;
+    Gtk::Alignment       _marginRightAlign;
+    Gtk::Alignment       _marginBottomAlign;
+    RegisteredScalarUnit _marginTop;
+    RegisteredScalarUnit _marginLeft;
+    RegisteredScalarUnit _marginRight;
+    RegisteredScalarUnit _marginBottom;
+	
+	
     //callback
     void on_value_changed();
     sigc::connection    _changedw_connection;
-	sigc::connection    _changedh_connection;
+    sigc::connection    _changedh_connection;
 
     Registry            *_widgetRegistry;
 
