]> git.sur5r.net Git - glabels/commitdiff
Added support for elliptical labels to template designer.
authorJim Evins <evins@snaught.com>
Sun, 24 Oct 2010 21:05:16 +0000 (17:05 -0400)
committerJim Evins <evins@snaught.com>
Sun, 24 Oct 2010 21:05:16 +0000 (17:05 -0400)
data/ui/template-designer.ui
src/template-designer.c

index 751edcf30bc1c117db9ff6cb6613e5440da8e14b..9e66fe06f68c946405189bda6322d6178a57b4b0 100644 (file)
@@ -31,6 +31,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="name_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label1">
@@ -261,6 +262,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="pg_size_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label43">
@@ -445,6 +447,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="shape_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label13">
@@ -461,6 +464,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             <child>
               <object class="GtkVBox" id="vbox7">
                 <property name="visible">True</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkRadioButton" id="shape_rect_radio">
@@ -493,6 +497,21 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkRadioButton" id="shape_ellipse_radio">
+                    <property name="label" translatable="yes">Elliptical</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">shape_rect_radio</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
                 <child>
                   <object class="GtkRadioButton" id="shape_cd_radio">
                     <property name="label" translatable="yes">CD/DVD (including credit card CDs)</property>
@@ -506,7 +525,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </object>
@@ -533,6 +552,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="rect_size_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label14">
@@ -848,10 +868,249 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             <property name="tab_fill">False</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkVBox" id="ellipse_size_page">
+            <property name="visible">True</property>
+            <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">24</property>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Please enter the following size parameters of a single label or card in your template.</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkTable" id="table5">
+                    <property name="visible">True</property>
+                    <property name="n_rows">4</property>
+                    <property name="n_columns">3</property>
+                    <property name="column_spacing">12</property>
+                    <property name="row_spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">1. Width:</property>
+                      </object>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">2. Height:</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label7">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">3. Waste (overprint allowed):</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="ellipse_w_units_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">inches</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="ellipse_h_units_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">inches</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="ellipse_waste_units_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">inches</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="ellipse_w_spin">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">adjustment3</property>
+                        <property name="climb_rate">0.0099999997764800008</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="ellipse_h_spin">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">adjustment4</property>
+                        <property name="climb_rate">0.0099999997764800008</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="ellipse_waste_spin">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">adjustment6</property>
+                        <property name="climb_rate">0.0099999997764800008</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label8">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">4. Margin</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="ellipse_margin_spin">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">adjustment8</property>
+                        <property name="climb_rate">0.0099999997764800008</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="ellipse_margin_units_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">inches</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="ellipse_image">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="yalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">5</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">ellipse_page</property>
+          </object>
+          <packing>
+            <property name="position">10</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkVBox" id="round_size_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label23">
@@ -1025,7 +1284,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             </child>
           </object>
           <packing>
-            <property name="position">5</property>
+            <property name="position">6</property>
           </packing>
         </child>
         <child type="tab">
@@ -1034,7 +1293,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             <property name="label">round_size_page</property>
           </object>
           <packing>
-            <property name="position">5</property>
+            <property name="position">6</property>
             <property name="tab_fill">False</property>
           </packing>
         </child>
@@ -1042,6 +1301,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="cd_size_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label32">
@@ -1344,7 +1604,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             </child>
           </object>
           <packing>
-            <property name="position">6</property>
+            <property name="position">7</property>
           </packing>
         </child>
         <child type="tab">
@@ -1353,7 +1613,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
             <property name="label">cd_size_page</property>
           </object>
           <packing>
-            <property name="position">6</property>
+            <property name="position">7</property>
             <property name="tab_fill">False</property>
           </packing>
         </child>
@@ -1361,6 +1621,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
           <object class="GtkVBox" id="nlayouts_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">24</property>
             <child>
               <object class="GtkLabel" id="label9">
@@ -1385,6 +1646,7 @@ The second example illustrates when two layouts are needed.</property>
                 <child>
                   <object class="GtkVBox" id="vbox4">
                     <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkImage" id="nlayouts_image1">
                         <property name="visible">True</property>
@@ -1414,6 +1676,7 @@ one layout.</property>
                 <child>
                   <object class="GtkVBox" id="vbox5">
                     <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkImage" id="nlayouts_image2">
                         <property name="visible">True</property>
@@ -1487,7 +1750,7 @@ two layouts.</property>
             </child>
           </object>
           <packing>
-            <property name="position">7</property>
+            <property name="position">8</property>
           </packing>
         </child>
         <child type="tab">
@@ -1496,7 +1759,7 @@ two layouts.</property>
             <property name="label">nlayouts_page</property>
           </object>
           <packing>
-            <property name="position">7</property>
+            <property name="position">8</property>
             <property name="tab_fill">False</property>
           </packing>
         </child>
@@ -1504,6 +1767,7 @@ two layouts.</property>
           <object class="GtkVBox" id="layout_page">
             <property name="visible">True</property>
             <property name="border_width">18</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkLabel" id="label48">
@@ -1906,6 +2170,7 @@ two layouts.</property>
                     <child>
                       <object class="GtkVBox" id="vbox15">
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkVBox" id="mini_preview_vbox">
@@ -1954,7 +2219,7 @@ two layouts.</property>
             </child>
           </object>
           <packing>
-            <property name="position">8</property>
+            <property name="position">9</property>
           </packing>
         </child>
         <child type="tab">
@@ -1963,7 +2228,7 @@ two layouts.</property>
             <property name="label">layout_page</property>
           </object>
           <packing>
-            <property name="position">8</property>
+            <property name="position">9</property>
             <property name="tab_fill">False</property>
           </packing>
         </child>
@@ -1979,7 +2244,7 @@ Otherwise, you may click "Cancel" to abandon your design
 or "Back" to continue editing this design.</property>
           </object>
           <packing>
-            <property name="position">9</property>
+            <property name="position">10</property>
           </packing>
         </child>
         <child type="tab">
@@ -1988,7 +2253,7 @@ or "Back" to continue editing this design.</property>
             <property name="label">finish_page</property>
           </object>
           <packing>
-            <property name="position">9</property>
+            <property name="position">10</property>
             <property name="tab_fill">False</property>
           </packing>
         </child>
index a7a4572b7e99371b312079eb7281d6889de217d1..f6ec6958b3943858c8b4d21c4a0d022471cf9164 100644 (file)
 #define DEFAULT_RECT_R        0.0
 #define DEFAULT_RECT_WASTE    0.0 /* Should never exceed 1/2 the distance between items. */
 
+#define DEFAULT_ELLIPSE_W      252.0
+#define DEFAULT_ELLIPSE_H      144.0
+#define DEFAULT_ELLIPSE_WASTE    0.0 /* Should never exceed 1/2 the distance between items. */
+
 #define DEFAULT_ROUND_R      72.0
 #define DEFAULT_ROUND_WASTE   0.0 /* Should never exceed 1/2 the distance between items. */
 
@@ -78,6 +82,7 @@ struct _glTemplateDesignerPrivate
        GtkWidget       *pg_size_page;
        GtkWidget       *shape_page;
        GtkWidget       *rect_size_page;
+       GtkWidget       *ellipse_size_page;
        GtkWidget       *round_size_page;
        GtkWidget       *cd_size_page;
        GtkWidget       *nlayouts_page;
@@ -100,6 +105,7 @@ struct _glTemplateDesignerPrivate
 
        /* Shape page controls */
        GtkWidget       *shape_rect_radio;
+       GtkWidget       *shape_ellipse_radio;
        GtkWidget       *shape_round_radio;
        GtkWidget       *shape_cd_radio;
 
@@ -118,6 +124,17 @@ struct _glTemplateDesignerPrivate
        GtkWidget       *rect_y_waste_units_label;
        GtkWidget       *rect_margin_units_label;
 
+       /* Label size (elliptical) page controls */
+       GtkWidget       *ellipse_image;
+       GtkWidget       *ellipse_w_spin;
+       GtkWidget       *ellipse_h_spin;
+       GtkWidget       *ellipse_waste_spin;
+       GtkWidget       *ellipse_margin_spin;
+       GtkWidget       *ellipse_w_units_label;
+       GtkWidget       *ellipse_h_units_label;
+       GtkWidget       *ellipse_waste_units_label;
+       GtkWidget       *ellipse_margin_units_label;
+
        /* Label size (round) page controls */
        GtkWidget       *round_image;
        GtkWidget       *round_r_spin;
@@ -187,6 +204,7 @@ enum {
         PG_SIZE_PAGE_NUM,
         SHAPE_PAGE_NUM,
         RECT_SIZE_PAGE_NUM,
+        ELLIPSE_SIZE_PAGE_NUM,
         ROUND_SIZE_PAGE_NUM,
         CD_SIZE_PAGE_NUM,
         NLAYOUTS_PAGE_NUM,
@@ -222,6 +240,9 @@ static void     construct_shape_page              (glTemplateDesigner      *dial
 static void     construct_rect_size_page          (glTemplateDesigner      *dialog,
                                                   GdkPixbuf               *logo);
 
+static void     construct_ellipse_size_page       (glTemplateDesigner      *dialog,
+                                                  GdkPixbuf               *logo);
+
 static void     construct_round_size_page         (glTemplateDesigner      *dialog,
                                                   GdkPixbuf               *logo);
 
@@ -252,6 +273,8 @@ static void     pg_size_page_changed_cb           (glTemplateDesigner      *dial
 
 static void     rect_size_page_prepare_cb         (glTemplateDesigner      *dialog);
 
+static void     ellipse_size_page_prepare_cb      (glTemplateDesigner      *dialog);
+
 static void     round_size_page_prepare_cb        (glTemplateDesigner      *dialog);
 
 static void     cd_size_page_prepare_cb           (glTemplateDesigner      *dialog);
@@ -291,6 +314,7 @@ gl_template_designer_init (glTemplateDesigner *dialog)
                                             "pg_size_page",
                                             "shape_page",
                                             "rect_size_page",
+                                            "ellipse_size_page",
                                             "round_size_page",
                                             "cd_size_page",
                                             "nlayouts_page",
@@ -413,6 +437,7 @@ gl_template_designer_construct (glTemplateDesigner *dialog)
        construct_pg_size_page (dialog, logo);
        construct_shape_page (dialog, logo);
        construct_rect_size_page (dialog, logo);
+       construct_ellipse_size_page (dialog, logo);
        construct_round_size_page (dialog, logo);
        construct_cd_size_page (dialog, logo);
        construct_nlayouts_page (dialog, logo);
@@ -599,10 +624,11 @@ construct_shape_page (glTemplateDesigner      *dialog,
        gl_debug (DEBUG_TEMPLATE, "START");
 
         gl_builder_util_get_widgets (dialog->priv->builder,
-                                     "shape_page",        &dialog->priv->shape_page,
-                                     "shape_rect_radio",  &dialog->priv->shape_rect_radio,
-                                     "shape_round_radio", &dialog->priv->shape_round_radio,
-                                     "shape_cd_radio",    &dialog->priv->shape_cd_radio,
+                                     "shape_page",          &dialog->priv->shape_page,
+                                     "shape_rect_radio",    &dialog->priv->shape_rect_radio,
+                                     "shape_ellipse_radio", &dialog->priv->shape_ellipse_radio,
+                                     "shape_round_radio",   &dialog->priv->shape_round_radio,
+                                     "shape_cd_radio",      &dialog->priv->shape_cd_radio,
                                      NULL);
 
 
@@ -728,6 +754,91 @@ construct_rect_size_page (glTemplateDesigner      *dialog,
 }
 
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Construct ellipse size page.                                   */
+/*--------------------------------------------------------------------------*/
+static void
+construct_ellipse_size_page (glTemplateDesigner      *dialog,
+                             GdkPixbuf               *logo)
+{
+        gchar           *pixbuf_filename;
+       GdkPixbuf       *pixbuf;
+
+       gl_debug (DEBUG_TEMPLATE, "START");
+
+        gl_builder_util_get_widgets (dialog->priv->builder,
+                                     "ellipse_size_page",           &dialog->priv->ellipse_size_page,
+                                     "ellipse_image",               &dialog->priv->ellipse_image,
+                                     "ellipse_w_spin",              &dialog->priv->ellipse_w_spin,
+                                     "ellipse_h_spin",              &dialog->priv->ellipse_h_spin,
+                                     "ellipse_waste_spin",          &dialog->priv->ellipse_waste_spin,
+                                     "ellipse_margin_spin",         &dialog->priv->ellipse_margin_spin,
+                                     "ellipse_w_units_label",       &dialog->priv->ellipse_w_units_label,
+                                     "ellipse_h_units_label",       &dialog->priv->ellipse_h_units_label,
+                                     "ellipse_waste_units_label",   &dialog->priv->ellipse_waste_units_label,
+                                     "ellipse_margin_units_label",  &dialog->priv->ellipse_margin_units_label,
+                                     NULL);
+
+
+        gtk_assistant_append_page (GTK_ASSISTANT (dialog),
+                                   dialog->priv->ellipse_size_page);
+
+        gtk_assistant_set_page_title (GTK_ASSISTANT (dialog),
+                                      dialog->priv->ellipse_size_page,
+                                      _("Label or Card Size"));
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (dialog),
+                                             dialog->priv->ellipse_size_page,
+                                             logo);
+        gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
+                                         dialog->priv->ellipse_size_page,
+                                         TRUE);
+
+       /* Initialize illustration. */
+        pixbuf_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "ex-ellipse-size.png", NULL);
+       pixbuf = gdk_pixbuf_new_from_file (pixbuf_filename, NULL);
+        g_free (pixbuf_filename);
+       gtk_image_set_from_pixbuf (GTK_IMAGE(dialog->priv->ellipse_image), pixbuf);
+
+       /* Apply units to spinbuttons and units labels. */
+        gtk_spin_button_set_digits (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin),
+                                   dialog->priv->digits);
+        gtk_spin_button_set_increments (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin),
+                                        dialog->priv->climb_rate, 10.0*dialog->priv->climb_rate);
+        gtk_label_set_text (GTK_LABEL(dialog->priv->ellipse_w_units_label),
+                           dialog->priv->units_string);
+        gtk_spin_button_set_digits (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin),
+                                   dialog->priv->digits);
+        gtk_spin_button_set_increments (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin),
+                                        dialog->priv->climb_rate, 10.0*dialog->priv->climb_rate);
+        gtk_label_set_text (GTK_LABEL(dialog->priv->ellipse_h_units_label),
+                           dialog->priv->units_string);
+        gtk_spin_button_set_digits (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin),
+                                   dialog->priv->digits);
+        gtk_spin_button_set_increments (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin),
+                                        dialog->priv->climb_rate, 10.0*dialog->priv->climb_rate);
+        gtk_label_set_text (GTK_LABEL(dialog->priv->ellipse_waste_units_label),
+                           dialog->priv->units_string);
+        gtk_spin_button_set_digits (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin),
+                                   dialog->priv->digits);
+        gtk_spin_button_set_increments (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin),
+                                        dialog->priv->climb_rate, 10.0*dialog->priv->climb_rate);
+        gtk_label_set_text (GTK_LABEL(dialog->priv->ellipse_margin_units_label),
+                           dialog->priv->units_string);
+
+       /* Load some realistic defaults. */
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin),
+                                  DEFAULT_ELLIPSE_W * dialog->priv->units_per_point);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin),
+                                  DEFAULT_ELLIPSE_H * dialog->priv->units_per_point);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin),
+                                  DEFAULT_ELLIPSE_WASTE * dialog->priv->units_per_point);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin),
+                                  DEFAULT_MARGIN * dialog->priv->units_per_point);
+
+       gl_debug (DEBUG_TEMPLATE, "END");
+}
+
+
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Construct round size page.                                     */
 /*--------------------------------------------------------------------------*/
@@ -1170,6 +1281,10 @@ gl_template_designer_set_from_name (glTemplateDesigner *dialog,
                         break;
 
                 case LGL_TEMPLATE_FRAME_SHAPE_ELLIPSE:
+                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->shape_ellipse_radio), TRUE);
+                        gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin),     frame->rect.w*upp);
+                        gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin),     frame->rect.h*upp);
+                        gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin), frame->rect.y_waste*upp);
                         break;
 
                 case LGL_TEMPLATE_FRAME_SHAPE_ROUND:
@@ -1195,6 +1310,7 @@ gl_template_designer_set_from_name (glTemplateDesigner *dialog,
                         if ( markup->type == LGL_TEMPLATE_MARKUP_MARGIN )
                         {
                                 gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->rect_margin_spin),  markup->margin.size*upp);
+                                gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin),  markup->margin.size*upp);
                                 gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->round_margin_spin), markup->margin.size*upp);
                                 gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->cd_margin_spin),    markup->margin.size*upp);
                         }
@@ -1314,6 +1430,10 @@ prepare_cb (glTemplateDesigner      *dialog,
                 rect_size_page_prepare_cb (dialog);
                 break;
 
+        case ELLIPSE_SIZE_PAGE_NUM:
+                ellipse_size_page_prepare_cb (dialog);
+                break;
+
         case ROUND_SIZE_PAGE_NUM:
                 round_size_page_prepare_cb (dialog);
                 break;
@@ -1358,6 +1478,9 @@ forward_page_function (gint     current_page,
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_rect_radio))) {
                         return RECT_SIZE_PAGE_NUM;
                }
+               if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_ellipse_radio))) {
+                        return ELLIPSE_SIZE_PAGE_NUM;
+               }
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_round_radio))) {
                         return ROUND_SIZE_PAGE_NUM;
                }
@@ -1367,6 +1490,7 @@ forward_page_function (gint     current_page,
                 break;
 
         case RECT_SIZE_PAGE_NUM:
+        case ELLIPSE_SIZE_PAGE_NUM:
         case ROUND_SIZE_PAGE_NUM:
         case CD_SIZE_PAGE_NUM:
                 return NLAYOUTS_PAGE_NUM;
@@ -1534,6 +1658,41 @@ rect_size_page_prepare_cb (glTemplateDesigner *dialog)
 }
 
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Prepare ellipse size page.                                     */
+/*--------------------------------------------------------------------------*/
+static void
+ellipse_size_page_prepare_cb (glTemplateDesigner *dialog)
+{
+       gdouble max_w, max_h;
+       gdouble w, h, waste, margin;
+
+       /* Limit label size based on already chosen page size. */
+       max_w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->pg_w_spin));
+       max_h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->pg_h_spin));
+
+       w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin));
+       h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin));
+       waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin));
+       margin = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin));
+
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->priv->ellipse_w_spin),
+                                   dialog->priv->climb_rate, max_w);
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->priv->ellipse_h_spin),
+                                   dialog->priv->climb_rate, max_h);
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->priv->ellipse_waste_spin),
+                                   0.0, MIN(max_w, max_h)/4.0);
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->priv->ellipse_margin_spin),
+                                   0.0, MIN(max_w, max_h)/4.0);
+
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin), w);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin), h);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin), waste);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin), margin);
+
+}
+
+
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Prepare round size page.                                       */
 /*--------------------------------------------------------------------------*/
@@ -1635,11 +1794,16 @@ layout_page_prepare_cb (glTemplateDesigner *dialog)
                x_waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_x_waste_spin));
                y_waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_y_waste_spin));
        }
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_ellipse_radio))) {
+               w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin));
+               h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin));
+               y_waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin));
+               y_waste = x_waste;
+       }
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_round_radio))) {
                w = 2*gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_r_spin));
                h = w;
                x_waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_waste_spin));
-               y_waste = x_waste;
        }
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_cd_radio))) {
                w = 2*gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->cd_radius_spin));
@@ -1831,6 +1995,14 @@ build_template (glTemplateDesigner      *dialog)
                margin = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_margin_spin));
        }
 
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_ellipse_radio))) {
+               shape = LGL_TEMPLATE_FRAME_SHAPE_ELLIPSE;
+               w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_w_spin));
+               h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_h_spin));
+               waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_waste_spin));
+               margin = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->ellipse_margin_spin));
+       }
+
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_round_radio))) {
                shape = LGL_TEMPLATE_FRAME_SHAPE_ROUND;
                r = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_r_spin));
@@ -1867,18 +2039,16 @@ build_template (glTemplateDesigner      *dialog)
 
        switch (shape) {
        case LGL_TEMPLATE_FRAME_SHAPE_RECT:
-               frame = lgl_template_frame_rect_new ("0",
-                                                    w/upp, h/upp, r/upp,
-                                                    x_waste/upp, y_waste/upp);
+               frame = lgl_template_frame_rect_new ("0", w/upp, h/upp, r/upp, x_waste/upp, y_waste/upp);
+               break;
+       case LGL_TEMPLATE_FRAME_SHAPE_ELLIPSE:
+               frame = lgl_template_frame_ellipse_new ("0", w/upp, h/upp, waste/upp);
                break;
        case LGL_TEMPLATE_FRAME_SHAPE_ROUND:
                frame = lgl_template_frame_round_new ("0", r/upp, waste/upp);
                break;
        case LGL_TEMPLATE_FRAME_SHAPE_CD:
-               frame = lgl_template_frame_cd_new ("0",
-                                                  radius/upp, hole/upp,
-                                                  w/upp, h/upp,
-                                                  waste/upp);
+               frame = lgl_template_frame_cd_new ("0", radius/upp, hole/upp, w/upp, h/upp, waste/upp);
                break;
         default:
                 g_assert_not_reached ();