diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-04-15 23:12:37 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-04-15 23:12:37 +0200 |
commit | 03c25960764a6b168739f6b799f84b800fd0e12a (patch) | |
tree | 2003ac16c6a64cd3397ec757af322b5f0e17b726 | |
parent | 0f1501a4e5eb1fb1ff7024b6b2f4fd092519ba2c (diff) |
Initial stylesheet editor
-rw-r--r-- | data/stylesheeteditor.ui | 2078 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | src/narrative_window.c | 18 | ||||
-rw-r--r-- | src/stylesheet_editor.c | 482 | ||||
-rw-r--r-- | src/stylesheet_editor.h | 94 |
5 files changed, 992 insertions, 1682 deletions
diff --git a/data/stylesheeteditor.ui b/data/stylesheeteditor.ui index 626d3a5..dba28b5 100644 --- a/data/stylesheeteditor.ui +++ b/data/stylesheeteditor.ui @@ -1,67 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.4 --> +<!-- Generated with glade 3.22.1 --> <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="adjustment19"> <property name="upper">5000</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="adjustment20"> <property name="upper">5000</property> <property name="step_increment">1</property> @@ -112,52 +57,21 @@ <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="adjustment30"> <property name="upper">100</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> + <object class="GtkListStore" id="element_tree"/> <template class="StylesheetEditor" parent="GtkDialog"> <property name="can_focus">False</property> <property name="title" translatable="yes">Stylesheet editor</property> <property name="window_position">center-on-parent</property> <property name="destroy_with_parent">True</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox"> <property name="can_focus">False</property> @@ -207,1178 +121,270 @@ </packing> </child> <child> - <object class="GtkNotebook"> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can_focus">False</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="GtkBox"> + <object class="GtkComboBox" id="element_selector"> <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">This style will be used in the narrative editor</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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">Text:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFontButton" id="narrative_style_font"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="font">Sans 12</property> - <property name="preview_text">Preview text</property> - <signal name="font-set" handler="narrative_font_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="narrative_style_fgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="narrative_fgcol_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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">Background:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="narrative_style_bggrad"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <items> - <item id="flat" translatable="yes">Flat colour</item> - <item id="horiz" translatable="yes">Horizontal gradient</item> - <item id="vert" translatable="yes">Vertical gradient</item> - </items> - <signal name="changed" handler="narrative_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="narrative_style_bgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="narrative_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="narrative_style_bgcol2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="narrative_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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">Alignment:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="narrative_style_alignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <property name="active_id">left</property> - <items> - <item id="left" translatable="yes">Left</item> - <item id="center" translatable="yes">Center</item> - <item id="right" translatable="yes">Right</item> - </items> - <signal name="changed" handler="narrative_alignment_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">2</property> - <property name="position">3</property> - </packing> - </child> + <property name="model">element_tree</property> + </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">out</property> <child> - <object class="GtkFrame"> + <object class="GtkAlignment"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">out</property> + <property name="margin_top">8</property> + <property name="margin_bottom">8</property> <child> - <object class="GtkAlignment"> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_right">40</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> + <property name="row_spacing">8</property> + <property name="column_spacing">8</property> + <property name="column_homogeneous">True</property> <child> - <object class="GtkGrid"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Right:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <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="narrative_style_paraspace_l"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - <signal name="value-changed" 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="value-changed" 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="value-changed" 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="value-changed" handler="narrative_paraspace_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> + <property name="label" translatable="yes">Width:</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> - </object> - </child> - <child type="label"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Paragraph spacing</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">4</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">out</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">40</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> <child> - <object class="GtkGrid"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Right:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <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="narrative_style_padding_l"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment5</property> - <signal name="value-changed" 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="value-changed" 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="value-changed" 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="value-changed" handler="narrative_padding_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> + <property name="label" translatable="yes">Height:</property> + <property name="justify">right</property> + <property name="xalign">1</property> </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Corner x:</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">Corner y:</property> + <property name="justify">right</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="w"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment19</property> + <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="x"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment20</property> + <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="h"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment21</property> + <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="y"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment22</property> + <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="h_units"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="active">0</property> + <items> + <item id="percent" translatable="yes">% slide</item> + <item id="units" translatable="yes">units</item> + </items> + <signal name="changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">5</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="w_units"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="active">0</property> + <items> + <item id="percent" translatable="yes">% slide</item> + <item id="units" translatable="yes">units</item> + </items> + <signal name="changed" handler="furniture_dims_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> </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">Padding</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">5</property> - </packing> - </child> - </object> - </child> - <child type="tab"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Narrative</property> - </object> - <packing> - <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="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="spacing">8</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Slide width:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <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="value-changed" handler="slide_size_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Slide height:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <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="value-changed" handler="slide_size_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(arbitrary units)</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">0</property> - </packing> </child> - <child> - <object class="GtkBox"> + <child type="label"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</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">Background:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="slide_style_bggrad"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <items> - <item id="flat" translatable="yes">Flat colour</item> - <item id="horiz" translatable="yes">Horizontal gradient</item> - <item id="vert" translatable="yes">Vertical gradient</item> - </items> - <signal name="changed" handler="slide_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="slide_style_bgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="slide_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="slide_style_bgcol2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="slide_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> + <property name="label" translatable="yes">Geometry</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">1</property> - </packing> </child> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> <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">This refers to the boxes you create within slides</property> + <property name="label" translatable="yes">Text:</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkFontButton" id="font"> <property name="visible">True</property> - <property name="can_focus">False</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">Text:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFontButton" id="frame_style_font"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="font">Sans 12</property> - <property name="preview_text">Preview text</property> - <signal name="font-set" handler="frame_font_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="frame_style_fgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="frame_fgcol_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="font">Sans 12</property> + <property name="preview_text">Preview text</property> + <signal name="font-set" handler="furniture_font_sig" swapped="no"/> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkColorButton" id="fgcol"> <property name="visible">True</property> - <property name="can_focus">False</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">Background:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="frame_style_bggrad"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <items> - <item id="flat" translatable="yes">Flat colour</item> - <item id="horiz" translatable="yes">Horizontal gradient</item> - <item id="vert" translatable="yes">Vertical gradient</item> - </items> - <signal name="changed" handler="frame_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="frame_style_bgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="frame_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="frame_style_bgcol2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="frame_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_alpha">True</property> + <property name="title" translatable="yes">Foreground colour</property> + <signal name="color-set" handler="furniture_fgcol_sig" swapped="no"/> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">2</property> </packing> </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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">Alignment:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="frame_style_alignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <property name="active_id">left</property> - <items> - <item id="left" translatable="yes">Left</item> - <item id="center" translatable="yes">Center</item> - <item id="right" translatable="yes">Right</item> - </items> - <signal name="changed" handler="frame_alignment_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">2</property> - <property name="position">3</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">out</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">40</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Right:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <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_paraspace_l"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment9</property> - <signal name="value-changed" 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="value-changed" 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="value-changed" 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="value-changed" handler="frame_paraspace_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> - </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">Paragraph spacing</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">4</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">out</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">40</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Right:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <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="value-changed" handler="frame_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="frame_style_padding_t"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment14</property> - <signal name="value-changed" 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="value-changed" 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="value-changed" handler="frame_padding_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> - </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">Padding</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">5</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</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">Frames</property> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> <property name="position">2</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" id="furniture_selector"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="active">0</property> - <property name="active_id">$.slide.slidetitle</property> - <items> - <item id="$.slide.prestitle" translatable="yes">Presentation title</item> - <item id="$.slide.author" translatable="yes">Presentation author</item> - <item id="$.slide.slidetitle" translatable="yes">Slide title</item> - <item id="$.slide.footer" translatable="yes">Slide footer</item> - <item id="$.slide.credit" translatable="yes">Slide credit</item> - </items> - <signal name="changed" handler="furniture_selector_change_sig" swapped="no"/> + <property name="label" translatable="yes">Background:</property> </object> <packing> <property name="expand">False</property> @@ -1387,509 +393,120 @@ </packing> </child> <child> - <object class="GtkFrame"> + <object class="GtkComboBoxText" id="bggrad"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">out</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</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">Width:</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Height:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Corner x:</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">Corner y:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="furniture_w"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment19</property> - <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="furniture_x"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment20</property> - <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="furniture_h"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment21</property> - <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">4</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="furniture_y"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment22</property> - <signal name="value-changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">4</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="furniture_h_units"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">8</property> - <property name="active">0</property> - <items> - <item id="percent" translatable="yes">% slide</item> - <item id="units" translatable="yes">units</item> - </items> - <signal name="changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">5</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="furniture_w_units"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <items> - <item id="percent" translatable="yes">% slide</item> - <item id="units" translatable="yes">units</item> - </items> - <signal name="changed" handler="furniture_dims_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </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">Geometry</property> - </object> - </child> + <items> + <item id="flat" translatable="yes">Flat colour</item> + <item id="horiz" translatable="yes">Horizontal gradient</item> + <item id="vert" translatable="yes">Vertical gradient</item> + </items> + <signal name="changed" handler="furniture_bg_sig" swapped="no"/> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkColorButton" id="bgcol"> <property name="visible">True</property> - <property name="can_focus">False</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">Text:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFontButton" id="furniture_font"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="font">Sans 12</property> - <property name="preview_text">Preview text</property> - <signal name="font-set" handler="furniture_font_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="furniture_fgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="furniture_fgcol_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_alpha">True</property> + <property name="title" translatable="yes">Background first colour</property> + <signal name="color-set" handler="furniture_bg_sig" swapped="no"/> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">2</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkColorButton" id="bgcol2"> <property name="visible">True</property> - <property name="can_focus">False</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">Background:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="furniture_bggrad"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <items> - <item id="flat" translatable="yes">Flat colour</item> - <item id="horiz" translatable="yes">Horizontal gradient</item> - <item id="vert" translatable="yes">Vertical gradient</item> - </items> - <signal name="changed" handler="furniture_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="furniture_bgcol"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="furniture_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkColorButton" id="furniture_bgcol2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_alpha">True</property> - <signal name="color-set" handler="furniture_bg_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_alpha">True</property> + <property name="title" translatable="yes">Background second colour</property> + <signal name="color-set" handler="furniture_bg_sig" swapped="no"/> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> <property name="position">3</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">8</property> <child> - <object class="GtkBox"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</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">Alignment:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="furniture_alignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <property name="active_id">left</property> - <items> - <item id="left" translatable="yes">Left</item> - <item id="center" translatable="yes">Center</item> - <item id="right" translatable="yes">Right</item> - </items> - <signal name="changed" handler="furniture_alignment_sig" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="label" translatable="yes">Alignment:</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">2</property> - <property name="position">4</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkFrame"> + <object class="GtkComboBoxText" id="alignment"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">out</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <child> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">40</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="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Right:</property> - <property name="justify">right</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <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="furniture_padding_l"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment23</property> - <signal name="value-changed" handler="furniture_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="furniture_padding_t"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment24</property> - <signal name="value-changed" handler="furniture_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="furniture_padding_r"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment25</property> - <signal name="value-changed" handler="furniture_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="furniture_padding_b"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment26</property> - <signal name="value-changed" handler="furniture_padding_sig" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> - </packing> - </child> - </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">Padding</property> - </object> - </child> + <property name="active">0</property> + <property name="active_id">left</property> + <items> + <item id="left" translatable="yes">Left</item> + <item id="center" translatable="yes">Center</item> + <item id="right" translatable="yes">Right</item> + </items> + <signal name="changed" handler="furniture_alignment_sig" swapped="no"/> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">5</property> + <property name="position">1</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">2</property> + <property name="position">4</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">out</property> <child> - <object class="GtkExpander"> + <object class="GtkAlignment"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can_focus">False</property> + <property name="margin_top">8</property> + <property name="margin_bottom">8</property> <child> <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">8</property> - <property name="margin_right">40</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> <property name="row_spacing">8</property> <property name="column_spacing">8</property> <property name="column_homogeneous">True</property> @@ -1946,12 +563,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="furniture_paraspace_l"> + <object class="GtkSpinButton" id="padding_l"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment27</property> - <signal name="value-changed" handler="furniture_paraspace_sig" swapped="no"/> + <property name="adjustment">adjustment23</property> + <signal name="value-changed" handler="furniture_padding_sig" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -1959,12 +576,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="furniture_paraspace_t"> + <object class="GtkSpinButton" id="padding_t"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment28</property> - <signal name="value-changed" handler="furniture_paraspace_sig" swapped="no"/> + <property name="adjustment">adjustment24</property> + <signal name="value-changed" handler="furniture_padding_sig" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -1972,12 +589,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="furniture_paraspace_r"> + <object class="GtkSpinButton" id="padding_r"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment29</property> - <signal name="value-changed" handler="furniture_paraspace_sig" swapped="no"/> + <property name="adjustment">adjustment25</property> + <signal name="value-changed" handler="furniture_padding_sig" swapped="no"/> </object> <packing> <property name="left_attach">3</property> @@ -1985,12 +602,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="furniture_paraspace_b"> + <object class="GtkSpinButton" id="padding_b"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="text" translatable="yes">0</property> - <property name="adjustment">adjustment30</property> - <signal name="value-changed" handler="furniture_paraspace_sig" swapped="no"/> + <property name="adjustment">adjustment26</property> + <signal name="value-changed" handler="furniture_padding_sig" swapped="no"/> </object> <packing> <property name="left_attach">3</property> @@ -1999,48 +616,165 @@ </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">Paragraph spacing</property> - </object> - </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">6</property> - </packing> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Padding</property> + </object> </child> </object> <packing> - <property name="position">3</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> + <property name="position">5</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel"> + <child> + <object class="GtkExpander"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Slide furniture</property> + <property name="can_focus">True</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">8</property> + <property name="margin_bottom">8</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="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Right:</property> + <property name="justify">right</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <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="paraspace_l"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment27</property> + <signal name="value-changed" handler="furniture_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="paraspace_t"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment28</property> + <signal name="value-changed" handler="furniture_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="paraspace_r"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment29</property> + <signal name="value-changed" handler="furniture_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="paraspace_b"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment30</property> + <signal name="value-changed" handler="furniture_paraspace_sig" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">1</property> + </packing> + </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">Paragraph spacing</property> + </object> + </child> </object> <packing> - <property name="position">3</property> - <property name="tab_fill">False</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">6</property> </packing> </child> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">1</property> </packing> </child> </object> </child> - <child> - <placeholder/> - </child> </template> <object class="GtkListStore" id="liststore1"/> </interface> diff --git a/meson.build b/meson.build index 0d6e70b..12a7ec8 100644 --- a/meson.build +++ b/meson.build @@ -114,7 +114,7 @@ executable('colloquium', 'src/slide_window.c', 'src/testcard.c', 'src/print.c', -# 'src/stylesheet_editor.c', + 'src/stylesheet_editor.c', ], gresources, dependencies : [gtk_dep, mdep, libstorycode_dep, libgtkstorycode_dep], diff --git a/src/narrative_window.c b/src/narrative_window.c index 2e557a6..f8d9127 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -44,7 +44,7 @@ #include "pr_clock.h" #include "slideshow.h" #include "print.h" -//#include "stylesheet_editor.h" +#include "stylesheet_editor.h" struct _narrative_window { @@ -271,14 +271,14 @@ static void stylesheet_changed_sig(GtkWidget *da, NarrativeWindow *nw) static void edit_ss_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) { -// NarrativeWindow *nw = vp; -// StylesheetEditor *se; -// -// se = stylesheet_editor_new(nw->n); -// gtk_window_set_transient_for(GTK_WINDOW(se), GTK_WINDOW(nw->window)); -// g_signal_connect(G_OBJECT(se), "changed", -// G_CALLBACK(stylesheet_changed_sig), nw); -// gtk_widget_show_all(GTK_WIDGET(se)); + NarrativeWindow *nw = vp; + StylesheetEditor *se; + + se = stylesheet_editor_new(nw->n); + gtk_window_set_transient_for(GTK_WINDOW(se), GTK_WINDOW(nw->window)); + g_signal_connect(G_OBJECT(se), "changed", + G_CALLBACK(stylesheet_changed_sig), nw); + gtk_widget_show_all(GTK_WIDGET(se)); } diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c new file mode 100644 index 0000000..efff646 --- /dev/null +++ b/src/stylesheet_editor.c @@ -0,0 +1,482 @@ +/* + * stylesheet_editor.c + * + * Copyright © 2013-2019 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <gtk/gtk.h> + +#include <narrative.h> +#include <stylesheet.h> + +#include "stylesheet_editor.h" + + +G_DEFINE_TYPE_WITH_CODE(StylesheetEditor, stylesheet_editor, + GTK_TYPE_DIALOG, NULL) + + +struct _sspriv +{ + Stylesheet *stylesheet; + enum style_element el; +}; + + +static void set_font_fgcol_align_from_ss(Stylesheet *ss, enum style_element el, + GtkWidget *wfont, + GtkWidget *wfgcol, + GtkWidget *walign) +{ + const char *font; + struct colour fgcol; + enum alignment align; + + font = stylesheet_get_font(ss, el, &fgcol, &align); + if ( font != NULL ) { + + GdkRGBA rgba; + + gtk_font_chooser_set_font(GTK_FONT_CHOOSER(wfont), font); + + rgba.red = fgcol.rgba[0]; + rgba.green = fgcol.rgba[1]; + rgba.blue = fgcol.rgba[2]; + rgba.alpha = fgcol.rgba[3]; + gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wfgcol), &rgba); + + switch ( align ) { + + case ALIGN_LEFT : + gtk_combo_box_set_active_id(GTK_COMBO_BOX(walign), "left"); + break; + + case ALIGN_CENTER : + gtk_combo_box_set_active_id(GTK_COMBO_BOX(walign), "center"); + break; + + case ALIGN_RIGHT : + gtk_combo_box_set_active_id(GTK_COMBO_BOX(walign), "right"); + break; + + default : + gtk_combo_box_set_active_id(GTK_COMBO_BOX(walign), "left"); + break; + + } + + } +} + + +static void set_padding_from_ss(Stylesheet *ss, enum style_element el, + GtkWidget *wl, GtkWidget *wr, + GtkWidget *wt, GtkWidget *wb) +{ + struct length padding[4]; + + if ( stylesheet_get_padding(ss, el, padding) ) return; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl), padding[0].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wr), padding[1].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wt), padding[2].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wb), padding[3].len); + /* FIXME: units */ +} + + +static void set_paraspace_from_ss(Stylesheet *ss, enum style_element el, + GtkWidget *wl, GtkWidget *wr, + GtkWidget *wt, GtkWidget *wb) +{ + struct length paraspace[4]; + + if ( stylesheet_get_paraspace(ss, el, paraspace) ) return; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wl), paraspace[0].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wr), paraspace[1].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wt), paraspace[2].len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wb), paraspace[3].len); + /* FIXME: units */ +} + + +static void set_geom_from_ss(Stylesheet *ss, enum style_element el, + GtkWidget *ww, GtkWidget *wh, + GtkWidget *wx, GtkWidget *wy, + GtkWidget *wwu, GtkWidget *whu) +{ + struct frame_geom geom; + + if ( stylesheet_get_geometry(ss, el, &geom) ) return; + + if ( geom.x.unit == LENGTH_FRAC ) { + geom.w.len *= 100; + gtk_combo_box_set_active_id(GTK_COMBO_BOX(wwu), "percent"); + } else { + gtk_combo_box_set_active_id(GTK_COMBO_BOX(wwu), "units"); + } + if ( geom.y.unit == LENGTH_FRAC ) { + geom.h.len *= 100; + gtk_combo_box_set_active_id(GTK_COMBO_BOX(whu), "percent"); + } else { + gtk_combo_box_set_active_id(GTK_COMBO_BOX(whu), "units"); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(ww), geom.w.len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wh), geom.h.len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wx), geom.x.len); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(wy), geom.y.len); +} + + +static void set_bg_from_ss(Stylesheet *ss, enum style_element el, + GtkWidget *wcol, GtkWidget *wcol2, GtkWidget *wgrad) +{ + struct colour bgcol; + struct colour bgcol2; + enum gradient bggrad; + GdkRGBA rgba; + + if ( stylesheet_get_background(ss, el, &bggrad, &bgcol, &bgcol2) ) return; + + rgba.red = bgcol.rgba[0]; + rgba.green = bgcol.rgba[1]; + rgba.blue = bgcol.rgba[2]; + rgba.alpha = bgcol.rgba[3]; + gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol), &rgba); + + rgba.red = bgcol2.rgba[0]; + rgba.green = bgcol2.rgba[1]; + rgba.blue = bgcol2.rgba[2]; + rgba.alpha = bgcol2.rgba[3]; + gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(wcol2), &rgba); + + switch ( bggrad ) { + + case GRAD_NONE: + gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "flat"); + gtk_widget_set_sensitive(wcol, TRUE); + gtk_widget_set_sensitive(wcol2, FALSE); + break; + + case GRAD_HORIZ: + gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "horiz"); + gtk_widget_set_sensitive(wcol, TRUE); + gtk_widget_set_sensitive(wcol2, TRUE); + break; + + case GRAD_VERT: + gtk_combo_box_set_active_id(GTK_COMBO_BOX(wgrad), "vert"); + gtk_widget_set_sensitive(wcol, TRUE); + gtk_widget_set_sensitive(wcol2, TRUE); + break; + + } + +} + + +static void set_values_from_presentation(StylesheetEditor *se) +{ + set_geom_from_ss(se->priv->stylesheet, se->priv->el, + se->w, se->h, se->x, se->y, se->w_units, se->h_units); + + set_padding_from_ss(se->priv->stylesheet, se->priv->el, + se->padding_l, se->padding_r, se->padding_t, se->padding_b); + + set_paraspace_from_ss(se->priv->stylesheet, se->priv->el, + se->paraspace_l, se->paraspace_r, se->paraspace_t, se->paraspace_b); + + set_font_fgcol_align_from_ss(se->priv->stylesheet, se->priv->el, + se->font, se->fgcol, se->alignment); + set_bg_from_ss(se->priv->stylesheet, se->priv->el, + se->bgcol, se->bgcol2, se->bggrad); +} + + +static enum gradient id_to_gradtype(const gchar *id) +{ + assert(id != NULL); + if ( strcmp(id, "flat") == 0 ) return GRAD_NONE; + if ( strcmp(id, "horiz") == 0 ) return GRAD_HORIZ; + if ( strcmp(id, "vert") == 0 ) return GRAD_VERT; + return GRAD_NONE; +} + + +static void update_bg(Stylesheet *ss, enum style_element el, + GtkWidget *bggradw, GtkWidget *col1w, GtkWidget *col2w) +{ + enum gradient g; + const gchar *id; + GdkRGBA rgba; + struct colour bgcol, bgcol2; + + id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(bggradw)); + g = id_to_gradtype(id); + + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col1w), &rgba); + if ( rgba.alpha < 0.000001 ) rgba.alpha = 0.0; + bgcol.rgba[0] = rgba.red; + bgcol.rgba[1] = rgba.green; + bgcol.rgba[2] = rgba.blue; + bgcol.rgba[3] = rgba.alpha; + + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col2w), &rgba); + if ( rgba.alpha < 0.000001 ) rgba.alpha = 0.0; + bgcol2.rgba[0] = rgba.red; + bgcol2.rgba[1] = rgba.green; + bgcol2.rgba[2] = rgba.blue; + bgcol2.rgba[3] = rgba.alpha; + + stylesheet_set_background(ss, el, g, bgcol, bgcol2); +} + + +static char units_id_to_char(const char *id) +{ + if ( strcmp(id, "units") == 0 ) return 'u'; + if ( strcmp(id, "percent") == 0 ) return 'f'; + return 'u'; +} + + +static void update_ss_dims(Stylesheet *ss, const char *style_name, + const char *key, GtkWidget *ww, GtkWidget *wh, + GtkWidget *wx, GtkWidget *wy, + GtkWidget *wwu, GtkWidget *whu) +{ +#if 0 + float w, h, x, y; + char w_units, h_units; + const gchar *uid; + char tmp[256]; + + w = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ww)); + h = gtk_spin_button_get_value(GTK_SPIN_BUTTON(wh)); + x = gtk_spin_button_get_value(GTK_SPIN_BUTTON(wx)); + y = gtk_spin_button_get_value(GTK_SPIN_BUTTON(wy)); + uid = gtk_combo_box_get_active_id(GTK_COMBO_BOX(wwu)); + w_units = units_id_to_char(uid); + uid = gtk_combo_box_get_active_id(GTK_COMBO_BOX(whu)); + h_units = units_id_to_char(uid); + + if ( w_units == 'f' ) w /= 100.0; + if ( h_units == 'f' ) h /= 100.0; + + if ( snprintf(tmp, 256, "%.2f%cx%.2f%c+%.0f+%0.f", + w, w_units, h, h_units, x, y) >= 256 ) + { + fprintf(stderr, "Spacing too long\n"); + } else { + stylesheet_set(p->stylesheet, style_name, key, tmp); + } +#endif +} + + +static void revert_sig(GtkButton *button, StylesheetEditor *se) +{ + /* FIXME: implement */ + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +} + + +static void set_font(GtkFontButton *widget, StylesheetEditor *se, + const char *style_name) +{ +#if 0 + const gchar *font; + font = gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget)); + + stylesheet_set(se->priv->p->stylesheet, style_name, "font", font); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + + +static void set_col(GtkColorButton *widget, StylesheetEditor *se, + const char *style_name, const char *col_name) +{ +#if 0 + GdkRGBA rgba; + gchar *col; + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &rgba); + col = gdk_rgba_to_string(&rgba); + stylesheet_set(se->priv->p->stylesheet, style_name, "fgcol", col); + g_free(col); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + + +static void paraspace_sig(GtkSpinButton *widget, StylesheetEditor *se) +{ +#if 0 + update_spacing(se->priv->p, se->priv->furniture, "pad", + se->furniture_padding_l, + se->furniture_padding_r, + se->furniture_padding_t, + se->furniture_padding_b); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + + +static void padding_sig(GtkSpinButton *widget, StylesheetEditor *se) +{ +#if 0 + update_spacing(se->priv->p, se->priv->furniture, "pad", + se->furniture_padding_l, + se->furniture_padding_r, + se->furniture_padding_t, + se->furniture_padding_b); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + + +static void alignment_sig(GtkComboBoxText *widget, StylesheetEditor *se) +{ +#if 0 + const gchar *id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widget)); + stylesheet_set(se->priv->p->stylesheet, se->priv->furniture, + "alignment", id); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + + +static void dims_sig(GtkSpinButton *widget, StylesheetEditor *se) +{ +#if 0 + update_ss_dims(se->priv->p, se->priv->furniture, "geometry", + se->furniture_w, se->furniture_h, + se->furniture_x, se->furniture_y, + se->furniture_w_units, se->furniture_h_units); + set_values_from_presentation(se); + g_signal_emit_by_name(se, "changed"); +#endif +} + +static void font_sig(GtkFontButton *widget, StylesheetEditor *se) +{ +} + + +static void fgcol_sig(GtkColorButton *widget, StylesheetEditor *se) +{ +} + +static void bg_sig(GtkColorButton *widget, StylesheetEditor *se) +{ +} + +static void selector_change_sig(GtkComboBoxText *widget, StylesheetEditor *se) +{ + //se->priv->el = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widget)); + //set_furniture(se, se->priv->el); +} + + +static void stylesheet_editor_finalize(GObject *obj) +{ + G_OBJECT_CLASS(stylesheet_editor_parent_class)->finalize(obj); +} + + +static void stylesheet_editor_init(StylesheetEditor *se) +{ + se->priv = G_TYPE_INSTANCE_GET_PRIVATE(se, COLLOQUIUM_TYPE_STYLESHEET_EDITOR, + StylesheetEditorPrivate); + gtk_widget_init_template(GTK_WIDGET(se)); +} + + +#define SE_BIND_CHILD(a, b) \ + gtk_widget_class_bind_template_child(widget_class, StylesheetEditor, a); \ + gtk_widget_class_bind_template_callback(widget_class, b); + +void stylesheet_editor_class_init(StylesheetEditorClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gtk_widget_class_set_template_from_resource(widget_class, + "/uk/me/bitwiz/Colloquium/stylesheeteditor.ui"); + + g_type_class_add_private(gobject_class, sizeof(StylesheetEditorPrivate)); + gobject_class->finalize = stylesheet_editor_finalize; + + /* Furniture */ + SE_BIND_CHILD(selector, selector_change_sig); + SE_BIND_CHILD(paraspace_l, paraspace_sig); + SE_BIND_CHILD(paraspace_r, paraspace_sig); + SE_BIND_CHILD(paraspace_t, paraspace_sig); + SE_BIND_CHILD(paraspace_b, paraspace_sig); + SE_BIND_CHILD(padding_l, padding_sig); + SE_BIND_CHILD(padding_r, padding_sig); + SE_BIND_CHILD(padding_t, padding_sig); + SE_BIND_CHILD(padding_b, padding_sig); + SE_BIND_CHILD(font, font_sig); + SE_BIND_CHILD(fgcol, fgcol_sig); + SE_BIND_CHILD(bgcol, bg_sig); + SE_BIND_CHILD(bgcol2, bg_sig); + SE_BIND_CHILD(bggrad, bg_sig); + SE_BIND_CHILD(alignment, alignment_sig); + SE_BIND_CHILD(w, dims_sig); + SE_BIND_CHILD(h, dims_sig); + SE_BIND_CHILD(x, dims_sig); + SE_BIND_CHILD(y, dims_sig); + SE_BIND_CHILD(w_units, dims_sig); + SE_BIND_CHILD(h_units, dims_sig); + + gtk_widget_class_bind_template_callback(widget_class, revert_sig); + + g_signal_new("changed", COLLOQUIUM_TYPE_STYLESHEET_EDITOR, + G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0); +} + + +StylesheetEditor *stylesheet_editor_new(Stylesheet *ss) +{ + StylesheetEditor *se; + + se = g_object_new(COLLOQUIUM_TYPE_STYLESHEET_EDITOR, NULL); + if ( se == NULL ) return NULL; + + se->priv->stylesheet = ss; + se->priv->el = 0;//gtk_combo_box_get_active_id(GTK_COMBO_BOX(se->furniture_selector)); + set_values_from_presentation(se); + + return se; +} + diff --git a/src/stylesheet_editor.h b/src/stylesheet_editor.h new file mode 100644 index 0000000..338981d --- /dev/null +++ b/src/stylesheet_editor.h @@ -0,0 +1,94 @@ +/* + * stylesheet_editor.h + * + * Copyright © 2013-2019 Thomas White <taw@bitwiz.org.uk> + * + * This file is part of Colloquium. + * + * Colloquium is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef STYLESHEET_EDITOR_H +#define STYLESHEET_EDITOR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gtk/gtk.h> + +#include <narrative.h> + +#define COLLOQUIUM_TYPE_STYLESHEET_EDITOR (stylesheet_editor_get_type()) + +#define COLLOQUIUM_STYLESHEET_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditor)) + +#define COLLOQUIUM_IS_STYLESHEET_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR)) + +#define COLLOQUIUM_STYLESHEET_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditorClass)) + +#define COLLOQUIUM_IS_STYLESHEET_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR)) + +#define COLLOQUIUM_STYLESHEET_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ + COLLOQUIUM_TYPE_STYLESHEET_EDITOR, \ + StylesheetEditorClass)) + + +typedef struct _sspriv StylesheetEditorPrivate; + +struct _stylesheeteditor +{ + GtkDialog parent_instance; + GtkWidget *selector; + GtkWidget *paraspace_l; + GtkWidget *paraspace_r; + GtkWidget *paraspace_t; + GtkWidget *paraspace_b; + GtkWidget *padding_l; + GtkWidget *padding_r; + GtkWidget *padding_t; + GtkWidget *padding_b; + GtkWidget *font; + GtkWidget *fgcol; + GtkWidget *bgcol; + GtkWidget *bgcol2; + GtkWidget *bggrad; + GtkWidget *alignment; + GtkWidget *w; + GtkWidget *h; + GtkWidget *x; + GtkWidget *y; + GtkWidget *w_units; + GtkWidget *h_units; + StylesheetEditorPrivate *priv; +}; + +struct _stylesheeteditorclass +{ + GtkDialogClass parent_class; +}; + +typedef struct _stylesheeteditor StylesheetEditor; +typedef struct _stylesheeteditorclass StylesheetEditorClass; + +extern StylesheetEditor *stylesheet_editor_new(Stylesheet *ss); + +#endif /* STYLESHEET_EDITOR_H */ |