Set values in stylesheet editor
authorThomas White <taw@bitwiz.me.uk>
Thu, 25 Oct 2018 21:28:33 +0000 (23:28 +0200)
committerThomas White <taw@bitwiz.me.uk>
Thu, 25 Oct 2018 21:39:30 +0000 (23:39 +0200)
data/stylesheeteditor.ui
src/stylesheet.c
src/stylesheet_editor.c
src/stylesheet_editor.h

index 6e61d79..bfe08b6 100644 (file)
@@ -2,6 +2,96 @@
 <!-- Generated with glade 3.20.4 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment10">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment11">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment12">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment13">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment14">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment15">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment16">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment17">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment18">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment3">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment4">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment5">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment6">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment7">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment8">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment9">
+    <property name="upper">2000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <template class="StylesheetEditor" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Stylesheet editor</property>
                           <item id="flat" translatable="yes">Flat colour</item>
                           <item id="horiz" translatable="yes">Horizontal gradient</item>
                           <item id="vert" translatable="yes">Vertical gradient</item>
+                          <item id="none" translatable="yes">None</item>
                         </items>
                         <signal name="changed" handler="narrative_bggrad_sig" swapped="no"/>
                       </object>
                       <object class="GtkAlignment">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
+                        <property name="margin_right">40</property>
+                        <property name="margin_top">8</property>
+                        <property name="margin_bottom">8</property>
                         <child>
-                          <object class="GtkBox">
+                          <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_right">4</property>
-                            <property name="margin_bottom">4</property>
-                            <property name="orientation">vertical</property>
+                            <property name="row_spacing">8</property>
+                            <property name="column_spacing">8</property>
+                            <property name="column_homogeneous">True</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Left:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Top:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Right:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">0</property>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Left:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Right:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Top:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">1</property>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Bottom:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Bottom:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">2</property>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_paraspace_l">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment1</property>
+                                <signal name="change-value" handler="narrative_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_paraspace_t">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment2</property>
+                                <signal name="change-value" handler="narrative_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_paraspace_r">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment3</property>
+                                <signal name="change-value" handler="narrative_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_paraspace_b">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment4</property>
+                                <signal name="change-value" handler="narrative_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                           </object>
                       <object class="GtkAlignment">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
+                        <property name="margin_right">40</property>
+                        <property name="margin_top">8</property>
+                        <property name="margin_bottom">8</property>
                         <child>
-                          <object class="GtkBox">
+                          <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_right">4</property>
-                            <property name="margin_bottom">4</property>
-                            <property name="orientation">vertical</property>
+                            <property name="row_spacing">8</property>
+                            <property name="column_spacing">8</property>
+                            <property name="column_homogeneous">True</property>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Top:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Left:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">0</property>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Left:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Right:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Right:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">1</property>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Bottom:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Top:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">2</property>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Bottom:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_padding_l">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment5</property>
+                                <signal name="change-value" handler="narrative_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_padding_t">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment6</property>
+                                <signal name="change-value" handler="narrative_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_padding_r">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment7</property>
+                                <signal name="change-value" handler="narrative_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="narrative_style_padding_b">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment8</property>
+                                <signal name="change-value" handler="narrative_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                           </object>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton">
+                      <object class="GtkSpinButton" id="slide_size_w">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="width_chars">6</property>
+                        <property name="adjustment">adjustment17</property>
                         <property name="numeric">True</property>
                         <property name="value">1024</property>
+                        <signal name="change-value" handler="slide_size_sig" swapped="no"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton">
+                      <object class="GtkSpinButton" id="slide_size_h">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="width_chars">6</property>
+                        <property name="adjustment">adjustment18</property>
                         <property name="numeric">True</property>
                         <property name="value">768</property>
+                        <signal name="change-value" handler="slide_size_sig" swapped="no"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkSeparator">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Slides</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">8</property>
+                <property name="margin_right">8</property>
+                <property name="margin_top">8</property>
+                <property name="margin_bottom">8</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">8</property>
                 <child>
                   <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Frames within slides</property>
+                    <property name="label" translatable="yes">This refers to the boxes you create within slides</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="padding">4</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="padding">4</property>
-                    <property name="position">4</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="padding">4</property>
-                    <property name="position">5</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
                 <child>
                       <object class="GtkAlignment">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
+                        <property name="margin_right">40</property>
+                        <property name="margin_top">8</property>
+                        <property name="margin_bottom">8</property>
                         <child>
-                          <object class="GtkBox">
+                          <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_right">4</property>
-                            <property name="margin_bottom">4</property>
-                            <property name="orientation">vertical</property>
+                            <property name="row_spacing">8</property>
+                            <property name="column_spacing">8</property>
+                            <property name="column_homogeneous">True</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Left:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Top:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Right:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">0</property>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Left:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Right:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Top:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">1</property>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Bottom:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Bottom:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_paraspace_l">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment9</property>
+                                <signal name="change-value" handler="frame_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_paraspace_t">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment10</property>
+                                <signal name="change-value" handler="frame_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_paraspace_r">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment11</property>
+                                <signal name="change-value" handler="frame_paraspace_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_paraspace_b">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment12</property>
+                                <signal name="change-value" handler="frame_paraspace_sig" swapped="no"/>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">2</property>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                           </object>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="padding">4</property>
-                    <property name="position">6</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
                       <object class="GtkAlignment">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
+                        <property name="margin_right">40</property>
+                        <property name="margin_top">8</property>
+                        <property name="margin_bottom">8</property>
                         <child>
-                          <object class="GtkBox">
+                          <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_right">4</property>
-                            <property name="margin_bottom">4</property>
-                            <property name="orientation">vertical</property>
+                            <property name="row_spacing">8</property>
+                            <property name="column_spacing">8</property>
+                            <property name="column_homogeneous">True</property>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Top:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Left:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">0</property>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Left:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Right:</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="pack_type">end</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Right:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">1</property>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="margin_right">5</property>
-                                    <property name="label" translatable="yes">Bottom:</property>
-                                    <property name="xalign">1</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child type="center">
-                                  <object class="GtkSpinButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
+                                <property name="label" translatable="yes">Top:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Bottom:</property>
+                                <property name="justify">right</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_padding_l">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment13</property>
+                                <signal name="change-value" handler="frame_padding_sig" swapped="no"/>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="padding">5</property>
-                                <property name="position">2</property>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_padding_t">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment14</property>
+                                <signal name="change-value" handler="frame_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_padding_r">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment15</property>
+                                <signal name="change-value" handler="frame_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="frame_style_padding_b">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">adjustment16</property>
+                                <signal name="change-value" handler="frame_padding_sig" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                           </object>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="padding">4</property>
-                    <property name="position">7</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Slides</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
-                <property name="margin_right">8</property>
-                <property name="margin_top">8</property>
-                <property name="margin_bottom">8</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">8</property>
-                <child>
-                  <object class="GtkComboBoxText">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="active">0</property>
-                    <items>
-                      <item translatable="yes">Presentation title</item>
-                      <item translatable="yes">Slide title</item>
-                    </items>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkFrame">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <object class="GtkAlignment">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkTextView">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="margin_top">8</property>
-                            <property name="margin_bottom">8</property>
-                            <property name="wrap_mode">char</property>
-                            <property name="left_margin">12</property>
-                            <property name="right_margin">12</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Storycode</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="padding">4</property>
-                    <property name="position">1</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
               </object>
               <object class="GtkLabel">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Style definitions</property>
+                <property name="label" translatable="yes">Frames</property>
               </object>
               <packing>
                 <property name="position">2</property>
               </packing>
             </child>
             <child>
-              <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
-                <property name="margin_right">8</property>
-                <property name="margin_top">8</property>
-                <property name="margin_bottom">8</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">8</property>
-                <child>
-                  <object class="GtkComboBoxText">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="active">0</property>
-                    <items>
-                      <item translatable="yes">Presentation title</item>
-                      <item translatable="yes">Slide title</item>
-                    </items>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkFrame">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <object class="GtkAlignment">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
-                        <property name="right_padding">12</property>
-                        <child>
-                          <object class="GtkTextView">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="margin_top">8</property>
-                            <property name="margin_bottom">8</property>
-                            <property name="wrap_mode">char</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Storycode</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="padding">4</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">3</property>
-              </packing>
+              <placeholder/>
             </child>
             <child type="tab">
-              <object class="GtkLabel">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Templates</property>
-              </object>
-              <packing>
-                <property name="position">3</property>
-                <property name="tab_fill">False</property>
-              </packing>
+              <placeholder/>
             </child>
           </object>
           <packing>
index ed84905..12beb69 100644 (file)
@@ -92,7 +92,10 @@ char *stylesheet_lookup(Stylesheet *ss, const char *path)
        }
 
        v = json_array_get_string_element(array, 0);
-       if ( v == NULL ) return NULL;
+       if ( v == NULL ) {
+               printf("%s not a string\n", path);
+               return NULL;
+       }
 
        ret = strdup(v);
        json_node_unref(node);
index 2b9d21e..03eac36 100644 (file)
@@ -33,6 +33,8 @@
 #include "stylesheet_editor.h"
 #include "presentation.h"
 #include "sc_interp.h"
+#include "stylesheet.h"
+#include "utils.h"
 
 
 G_DEFINE_TYPE_WITH_CODE(StylesheetEditor, stylesheet_editor,
@@ -45,9 +47,200 @@ struct _sspriv
 };
 
 
+static int colour_duo_parse(const char *a, GdkRGBA *col1, GdkRGBA *col2)
+{
+       char *acopy;
+       char *n2;
+
+       acopy = strdup(a);
+       if ( acopy == NULL ) return 1;
+
+       n2 = strchr(acopy, ',');
+       if ( n2 == NULL ) {
+               fprintf(stderr, _("Invalid bg gradient spec '%s'\n"), a);
+               return 1;
+       }
+
+       n2[0] = '\0';
+
+       if ( gdk_rgba_parse(col1, acopy) != TRUE ) {
+               fprintf(stderr, _("Failed to parse colour: %s\n"), acopy);
+       }
+       if ( gdk_rgba_parse(col2, &n2[1]) != TRUE ) {
+               fprintf(stderr, _("Failed to parse colour: %s\n"), &n2[1]);
+       }
+
+       free(acopy);
+       return 0;
+}
+
+
+static void set_font_from_ss(Stylesheet *ss, const char *path, GtkWidget *w)
+{
+       char *result = stylesheet_lookup(ss, path);
+       if ( result != NULL ) {
+               gtk_font_button_set_font_name(GTK_FONT_BUTTON(w), result);
+       }
+}
+
+
+static void set_col_from_ss(Stylesheet *ss, const char *path, GtkWidget *w)
+{
+       char *result = stylesheet_lookup(ss, path);
+       if ( result != NULL ) {
+               GdkRGBA rgba;
+               if ( gdk_rgba_parse(&rgba, result) == TRUE ) {
+                       gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(w), &rgba);
+               }
+       }
+}
+
+
+static void set_vals_from_ss(Stylesheet *ss, const char *path,
+                             GtkWidget *wl, GtkWidget *wr,
+                             GtkWidget *wt, GtkWidget *wb)
+{
+       char *result = stylesheet_lookup(ss, path);
+       if ( result != NULL ) {
+               float v[4];
+               if ( parse_tuple(result, v) == 0 ) {
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl), v[0]);
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(wr), v[1]);
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(wt), v[2]);
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(wb), v[3]);
+               } else {
+                       fprintf(stderr, _("Failed to parse quad: %s\n"), result);
+               }
+       } else {
+               printf("Not found %s\n", path);
+       }
+}
+
+
+static void set_size_from_ss(Stylesheet *ss, const char *path,
+                             GtkWidget *ww, GtkWidget *wh)
+{
+       char *result = stylesheet_lookup(ss, path);
+       if ( result != NULL ) {
+               float v[2];
+               if ( parse_double(result, v) == 0 ) {
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(ww), v[0]);
+                       gtk_spin_button_set_value(GTK_SPIN_BUTTON(wh), v[1]);
+               } else {
+                       fprintf(stderr, _("Failed to parse double: %s\n"), result);
+               }
+       } else {
+               printf("Not found %s\n", path);
+       }
+}
+
+static void set_bg_from_ss(Stylesheet *ss, const char *path, GtkWidget *wcol,
+                           GtkWidget *wcol2, GtkWidget *wgrad)
+{
+       char *result;
+       char fullpath[256];
+       int found = 0;
+
+       strcpy(fullpath, path);
+       strcat(fullpath, ".bgcol");
+       result = stylesheet_lookup(ss, fullpath);
+       if ( result != NULL ) {
+               GdkRGBA rgba;
+               found = 1;
+               if ( gdk_rgba_parse(&rgba, result) == TRUE ) {
+                       if ( rgba.alpha == 0.0 ) {
+                               gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "none");
+                               gtk_widget_set_sensitive(wcol, FALSE);
+                               gtk_widget_set_sensitive(wcol2, FALSE);
+                       } else {
+                               gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol), &rgba);
+                               gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "flat");
+                               gtk_widget_set_sensitive(wcol, TRUE);
+                               gtk_widget_set_sensitive(wcol2, FALSE);
+                       }
+               } else {
+                       fprintf(stderr, _("Failed to parse colour: %s\n"), result);
+               }
+       }
+
+       strcpy(fullpath, path);
+       strcat(fullpath, ".bggradv");
+       result = stylesheet_lookup(ss, fullpath);
+       if ( result != NULL ) {
+               GdkRGBA rgba1, rgba2;
+               found = 1;
+               if ( colour_duo_parse(result, &rgba1, &rgba2) == 0 ) {
+                       gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol), &rgba1);
+                       gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol2), &rgba2);
+                       gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "vert");
+                               gtk_widget_set_sensitive(wcol, TRUE);
+                               gtk_widget_set_sensitive(wcol2, TRUE);
+               }
+       }
+
+       strcpy(fullpath, path);
+       strcat(fullpath, ".bggradh");
+       result = stylesheet_lookup(ss, fullpath);
+       if ( result != NULL ) {
+               GdkRGBA rgba1, rgba2;
+               found = 1;
+               if ( colour_duo_parse(result, &rgba1, &rgba2) == 0 ) {
+                       gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol), &rgba1);
+                       gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol2), &rgba2);
+                       gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "horiz");
+                       gtk_widget_set_sensitive(wcol, TRUE);
+                       gtk_widget_set_sensitive(wcol2, TRUE);
+               }
+       }
+
+       if ( !found ) {
+               gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "none");
+               gtk_widget_set_sensitive(wcol, FALSE);
+               gtk_widget_set_sensitive(wcol2, FALSE);
+       }
+}
+
+
 static void set_values_from_presentation(StylesheetEditor *se)
 {
-       /* FIXME: From JSON */
+       Stylesheet *ss = se->priv->p->stylesheet;
+
+       /* Narrative */
+       set_font_from_ss(ss, "$.narrative.font", se->narrative_style_font);
+       set_col_from_ss(ss, "$.narrative.fgcol", se->narrative_style_fgcol);
+       set_bg_from_ss(ss, "$.narrative", se->narrative_style_bgcol,
+                                         se->narrative_style_bgcol2,
+                                         se->narrative_style_bggrad);
+       set_vals_from_ss(ss, "$.narrative.pad", se->narrative_style_padding_l,
+                                               se->narrative_style_padding_r,
+                                               se->narrative_style_padding_t,
+                                               se->narrative_style_padding_b);
+       set_vals_from_ss(ss, "$.narrative.paraspace", se->narrative_style_paraspace_l,
+                                                     se->narrative_style_paraspace_r,
+                                                     se->narrative_style_paraspace_t,
+                                                     se->narrative_style_paraspace_b);
+
+       /* Slides */
+       set_size_from_ss(ss, "$.slide.size", se->slide_size_w, se->slide_size_h);
+       set_bg_from_ss(ss, "$.slide", se->slide_style_bgcol,
+                                     se->slide_style_bgcol2,
+                                     se->slide_style_bggrad);
+
+
+       /* Frames */
+       set_font_from_ss(ss, "$.slide.frame.font", se->frame_style_font);
+       set_col_from_ss(ss, "$.slide.frame.fgcol", se->frame_style_fgcol);
+       set_bg_from_ss(ss, "$.slide.frame", se->frame_style_bgcol,
+                                           se->frame_style_bgcol2,
+                                           se->frame_style_bggrad);
+       set_vals_from_ss(ss, "$.slide.frame.pad", se->frame_style_padding_l,
+                                                 se->frame_style_padding_r,
+                                                 se->frame_style_padding_t,
+                                                 se->frame_style_padding_b);
+       set_vals_from_ss(ss, "$.slide.frame.paraspace", se->frame_style_paraspace_l,
+                                                       se->frame_style_paraspace_r,
+                                                       se->frame_style_paraspace_t,
+                                                       se->frame_style_paraspace_b);
 }
 
 
@@ -149,6 +342,11 @@ static void narrative_bggrad_sig(GtkComboBox *widget, StylesheetEditor *se)
 }
 
 
+static void slide_size_sig(GtkSpinButton *widget, StylesheetEditor *se)
+{
+}
+
+
 static void slide_bgcol_sig(GtkColorButton *widget, StylesheetEditor *se)
 {
        gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget),
@@ -236,6 +434,26 @@ static void frame_bggrad_sig(GtkComboBox *widget, StylesheetEditor *se)
 }
 
 
+static void frame_padding_sig(GtkSpinButton *widget, StylesheetEditor *se)
+{
+}
+
+
+static void frame_paraspace_sig(GtkSpinButton *widget, StylesheetEditor *se)
+{
+}
+
+
+static void narrative_padding_sig(GtkSpinButton *widget, StylesheetEditor *se)
+{
+}
+
+
+static void narrative_paraspace_sig(GtkSpinButton *widget, StylesheetEditor *se)
+{
+}
+
+
 static void stylesheet_editor_init(StylesheetEditor *se)
 {
        se->priv = G_TYPE_INSTANCE_GET_PRIVATE(se, COLLOQUIUM_TYPE_STYLESHEET_EDITOR,
@@ -265,8 +483,18 @@ void stylesheet_editor_class_init(StylesheetEditorClass *klass)
        SE_BIND_CHILD(narrative_style_bgcol, narrative_bgcol_sig);
        SE_BIND_CHILD(narrative_style_bgcol2, narrative_bgcol2_sig);
        SE_BIND_CHILD(narrative_style_bggrad, narrative_bggrad_sig);
+       SE_BIND_CHILD(narrative_style_paraspace_l, narrative_paraspace_sig);
+       SE_BIND_CHILD(narrative_style_paraspace_r, narrative_paraspace_sig);
+       SE_BIND_CHILD(narrative_style_paraspace_t, narrative_paraspace_sig);
+       SE_BIND_CHILD(narrative_style_paraspace_b, narrative_paraspace_sig);
+       SE_BIND_CHILD(narrative_style_padding_l, narrative_padding_sig);
+       SE_BIND_CHILD(narrative_style_padding_r, narrative_padding_sig);
+       SE_BIND_CHILD(narrative_style_padding_t, narrative_padding_sig);
+       SE_BIND_CHILD(narrative_style_padding_b, narrative_padding_sig);
 
        /* Slide style */
+       SE_BIND_CHILD(slide_size_w, slide_size_sig);
+       SE_BIND_CHILD(slide_size_h, slide_size_sig);
        SE_BIND_CHILD(slide_style_bgcol, slide_bgcol_sig);
        SE_BIND_CHILD(slide_style_bgcol2, slide_bgcol2_sig);
        SE_BIND_CHILD(slide_style_bggrad, slide_bggrad_sig);
@@ -277,6 +505,14 @@ void stylesheet_editor_class_init(StylesheetEditorClass *klass)
        SE_BIND_CHILD(frame_style_bgcol, frame_bgcol_sig);
        SE_BIND_CHILD(frame_style_bgcol2, frame_bgcol2_sig);
        SE_BIND_CHILD(frame_style_bggrad, frame_bggrad_sig);
+       SE_BIND_CHILD(frame_style_paraspace_l, frame_paraspace_sig);
+       SE_BIND_CHILD(frame_style_paraspace_r, frame_paraspace_sig);
+       SE_BIND_CHILD(frame_style_paraspace_t, frame_paraspace_sig);
+       SE_BIND_CHILD(frame_style_paraspace_b, frame_paraspace_sig);
+       SE_BIND_CHILD(frame_style_padding_l, frame_padding_sig);
+       SE_BIND_CHILD(frame_style_padding_r, frame_padding_sig);
+       SE_BIND_CHILD(frame_style_padding_t, frame_padding_sig);
+       SE_BIND_CHILD(frame_style_padding_b, frame_padding_sig);
 
        gtk_widget_class_bind_template_callback(widget_class, revert_sig);
 
index 480bd8a..849a9f8 100644 (file)
@@ -63,6 +63,16 @@ struct _stylesheeteditor
        GtkWidget *narrative_style_bgcol;
        GtkWidget *narrative_style_bgcol2;
        GtkWidget *narrative_style_bggrad;
+       GtkWidget *narrative_style_paraspace_l;
+       GtkWidget *narrative_style_paraspace_r;
+       GtkWidget *narrative_style_paraspace_t;
+       GtkWidget *narrative_style_paraspace_b;
+       GtkWidget *narrative_style_padding_l;
+       GtkWidget *narrative_style_padding_r;
+       GtkWidget *narrative_style_padding_t;
+       GtkWidget *narrative_style_padding_b;
+       GtkWidget *slide_size_w;
+       GtkWidget *slide_size_h;
        GtkWidget *slide_style_bgcol;
        GtkWidget *slide_style_bgcol2;
        GtkWidget *slide_style_bggrad;
@@ -71,6 +81,14 @@ struct _stylesheeteditor
        GtkWidget *frame_style_bgcol;
        GtkWidget *frame_style_bgcol2;
        GtkWidget *frame_style_bggrad;
+       GtkWidget *frame_style_paraspace_l;
+       GtkWidget *frame_style_paraspace_r;
+       GtkWidget *frame_style_paraspace_t;
+       GtkWidget *frame_style_paraspace_b;
+       GtkWidget *frame_style_padding_l;
+       GtkWidget *frame_style_padding_r;
+       GtkWidget *frame_style_padding_t;
+       GtkWidget *frame_style_padding_b;
        StylesheetEditorPrivate *priv;
 
        GdkRGBA       narrative_bgcol;