Permalink
Browse files

Merge pull request #194 from scdwyer/papget_colour

Text papget color

This solution works, but the default color in black is annoying. Unfortunately I can't find any function to test if the color is valid or not.
A long term solution could be to use a GTK color selection dialog box.

An other possibility is when you set the papget by hand in your GCS layout file, you can specify the "color" property.
  • Loading branch information...
2 parents aa06dbe + 70fcefc commit e1795b6fc8d4d62b78f48869e68e434edd411d2e @gautierhattenberger gautierhattenberger committed May 21, 2012
Showing with 40 additions and 2 deletions.
  1. +5 −1 sw/lib/ocaml/papget_renderer.ml
  2. +35 −1 sw/lib/ocaml/widgets.glade
@@ -73,14 +73,18 @@ class canvas_text = fun ?(config=[]) canvas_group x y ->
(* Initialize the entries *)
text_editor#entry_format#set_text format;
text_editor#spinbutton_size#set_value size;
+ text_editor#comboboxentry_color#set_active 0;
(* Connect the entries *)
let callback = fun () ->
format <- text_editor#entry_format#text in
ignore (text_editor#entry_format#connect#activate ~callback);
let callback = fun () ->
- size <- text_editor#spinbutton_size#value in
+ size <- text_editor#spinbutton_size#value in
ignore (text_editor#spinbutton_size#connect#value_changed ~callback);
+ let callback = fun () ->
+ color <- text_editor#comboboxentry_color#entry#text in
+ ignore (text_editor#comboboxentry_color#connect#changed ~callback);
end
View
@@ -9,7 +9,7 @@
<child>
<widget class="GtkTable" id="table_text_editor">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label39">
@@ -37,6 +37,20 @@
</packing>
</child>
<child>
+ <widget class="GtkLabel" id="label45">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Color</property>
+ <property name="justify">right</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkEntry" id="entry_format">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -63,6 +77,26 @@
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <widget class="GtkComboBoxEntry" id="comboboxentry_color">
+ <property name="visible">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Colors defined in X11 rgb.txt</property>
+ <property name="items" translatable="yes">green
+red
+blue
+yellow
+orange
+white</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
</child>
</widget>

0 comments on commit e1795b6

Please sign in to comment.