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.
This commit is contained in:
Gautier Hattenberger
2012-05-21 08:12:33 -07:00
2 changed files with 40 additions and 2 deletions
+5 -1
View File
@@ -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
+35 -1
View File
@@ -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">
@@ -36,6 +36,20 @@
<property name="y_options"></property>
</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>
@@ -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>