annotate src/paranormal/cfg.c @ 1819:1f1de580fd1d

pls: mk2
author William Pitcock <nenolod@atheme.org>
date Mon, 24 Sep 2007 13:10:23 -0500
parents 626f9f4d79a8
children 15e7d3473974
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
1 /* FIXME: prevent the user from dragging something above the root
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
2 actuator */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
3
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
4 #ifdef HAVE_CONFIG_H
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
5 # include <config.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
6 #endif
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
7
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
8 #include <glib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
9 #include <gtk/gtk.h>
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
10 #include <audacious/configdb.h>
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
11
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
12 #include "paranormal.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
13 #include "actuators.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
14 #include "containers.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
15 #include "presets.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
16
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
17 /* DON'T CALL pn_fatal_error () IN HERE!!! */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
18
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
19 /* Actuator page stuffs */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
20 static GtkWidget *cfg_dialog, *actuator_tree, *option_frame, *actuator_option_table;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
21 static GtkWidget *actuator_add_opmenu, *actuator_add_button, *actuator_remove_button;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
22 static GtkCTreeNode *selected_actuator_node;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
23 static GtkTooltips *actuator_tooltips;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
24
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
25 /* This is used so that actuator_row_data_destroyed_cb won't free
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
26 the actuator associated w/ the node since we're going to be using it */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
27 gboolean destroy_row_data = TRUE;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
28
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
29 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
30 actuator_row_data_destroyed_cb (struct pn_actuator *a)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
31 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
32 if (a && destroy_row_data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
33 destroy_actuator (a);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
34 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
35
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
36 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
37 add_actuator (struct pn_actuator *a, GtkCTreeNode *parent, gboolean copy)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
38 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
39 GtkCTreeNode *node;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
40 GSList *l;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
41
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
42 g_assert (cfg_dialog);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
43 g_assert (actuator_tree);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
44 g_assert (actuator_option_table);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
45
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
46 node = gtk_ctree_insert_node (GTK_CTREE (actuator_tree), parent,
156
f52e866d7d8e [svn] - use user-friendly names in most places
nenolod
parents: 152
diff changeset
47 NULL, (gchar**)&a->desc->dispname, 0,
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
48 NULL, NULL, NULL, NULL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
49 a->desc->flags & ACTUATOR_FLAG_CONTAINER
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
50 ? FALSE : TRUE,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
51 TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
52
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
53 if (a->desc->flags & ACTUATOR_FLAG_CONTAINER)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
54 for (l=*(GSList **)a->data; l; l = l->next)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
55 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
56 add_actuator (l->data, node, copy);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
57 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
58
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
59 if (copy)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
60 a = copy_actuator (a);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
61 else if (a->desc->flags & ACTUATOR_FLAG_CONTAINER)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
62 container_unlink_actuators (a);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
63
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
64 gtk_ctree_node_set_row_data_full (GTK_CTREE (actuator_tree), node, a,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
65 ((GtkDestroyNotify) actuator_row_data_destroyed_cb));
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
66 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
67
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
68 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
69 int_changed_cb (GtkSpinButton *sb, int *i)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
70 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
71 *i = gtk_spin_button_get_value_as_int (sb);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
72 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
73
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
74 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
75 float_changed_cb (GtkSpinButton *sb, float *f)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
76 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
77 *f = gtk_spin_button_get_value_as_float (sb);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
78 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
79
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
80 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
81 string_changed_cb (GtkEditable *t, char **s)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
82 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
83 if (*s != gtk_object_get_data (GTK_OBJECT (t), "DEFAULT_OP_STRING"))
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
84 g_free (*s);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
85
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
86 *s = gtk_editable_get_chars (t, 0, -1);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
87 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
88
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
89 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
90 color_changed_cb (GtkSpinButton *sb, guchar *c)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
91 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
92 *c = gtk_spin_button_get_value_as_int (sb);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
93 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
94
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
95 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
96 boolean_changed_cb (GtkToggleButton *tb, gboolean *b)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
97 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
98 *b = gtk_toggle_button_get_active (tb);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
99 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
100
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
101 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
102 row_select_cb (GtkCTree *ctree, GtkCTreeNode *node,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
103 gint column, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
104 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
105 struct pn_actuator *a;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
106 int opt_count = 0, i, j;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
107 GtkWidget *w;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
108 GtkObject *adj;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
109
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
110 a = (struct pn_actuator *)gtk_ctree_node_get_row_data (ctree, node);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
111
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
112 /* count the actuator's options (plus one) */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
113 if (a->desc->option_descs)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
114 while (a->desc->option_descs[opt_count++].name);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
115 else
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
116 opt_count = 1;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
117
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
118 gtk_table_resize (GTK_TABLE (actuator_option_table), opt_count, 2);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
119
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
120 /* Actuator name */
156
f52e866d7d8e [svn] - use user-friendly names in most places
nenolod
parents: 152
diff changeset
121 gtk_frame_set_label (GTK_FRAME (option_frame), a->desc->dispname);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
122
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
123 /* Actuator description */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
124 w = gtk_label_new (a->desc->doc);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
125 gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
126 gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
127 gtk_misc_set_alignment (GTK_MISC (w), 0, .5);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
128 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
129 gtk_table_attach (GTK_TABLE (actuator_option_table), w, 0, 2, 0, 1,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
130 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
131 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
132
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
133 /* now add the options */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
134 for (i=1, j=0; i<opt_count; j++, i++)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
135 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
136 w = gtk_label_new (a->desc->option_descs[j].name);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
137 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
138 gtk_table_attach (GTK_TABLE (actuator_option_table), w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
139 0, 1, i, i+1,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
140 GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
141 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
142 switch (a->desc->option_descs[j].type)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
143 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
144 case OPT_TYPE_INT:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
145 adj = gtk_adjustment_new (a->options[j].val.ival,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
146 G_MININT, G_MAXINT,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
147 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
148 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
149 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
150 GTK_SIGNAL_FUNC (int_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
151 &a->options[j].val.ival);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
152 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
153 case OPT_TYPE_FLOAT:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
154 adj = gtk_adjustment_new (a->options[j].val.fval,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
155 -G_MAXFLOAT, G_MAXFLOAT,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
156 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
157 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 5);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
158 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
159 GTK_SIGNAL_FUNC (float_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
160 &a->options[j].val.fval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
161 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
162 case OPT_TYPE_STRING:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
163 w = gtk_entry_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
164 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
165 gtk_entry_set_text (GTK_ENTRY (w), a->options[j].val.sval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
166 gtk_object_set_data (GTK_OBJECT (w), "DEFAULT_OP_STRING",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
167 (gpointer)a->desc->option_descs[j].default_val.sval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
168 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
169 GTK_SIGNAL_FUNC (string_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
170 &a->options[j].val.sval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
171 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
172 case OPT_TYPE_COLOR:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
173 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
174 /* FIXME: add some color preview */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
175 GtkWidget *hbox;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
176 hbox = gtk_hbox_new (FALSE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
177 adj = gtk_adjustment_new (a->options[j].val.cval.r,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
178 0, 255,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
179 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
180 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
181 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
182 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
183 GTK_SIGNAL_FUNC (color_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
184 &a->options[j].val.cval.r);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
185 gtk_tooltips_set_tip (actuator_tooltips, w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
186 a->desc->option_descs[j].doc, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
187 gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
188 adj = gtk_adjustment_new (a->options[j].val.cval.g,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
189 0, 255,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
190 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
191 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
192 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
193 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
194 GTK_SIGNAL_FUNC (color_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
195 &a->options[j].val.cval.g);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
196 gtk_tooltips_set_tip (actuator_tooltips, w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
197 a->desc->option_descs[j].doc, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
198 gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 6);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
199 adj = gtk_adjustment_new (a->options[j].val.cval.b,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
200 0, 255,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
201 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
202 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
203 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
204 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
205 GTK_SIGNAL_FUNC (color_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
206 &a->options[j].val.cval.b);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
207 gtk_tooltips_set_tip (actuator_tooltips, w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
208 a->desc->option_descs[j].doc, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
209 gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
210 w = hbox;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
211 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
212 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
213 case OPT_TYPE_COLOR_INDEX:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
214 adj = gtk_adjustment_new (a->options[j].val.ival,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
215 0, 255,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
216 1, 2, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
217 w = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
218 gtk_signal_connect (GTK_OBJECT (w), "changed",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
219 GTK_SIGNAL_FUNC (int_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
220 &a->options[j].val.ival);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
221 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
222 case OPT_TYPE_BOOLEAN:
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
223 w = gtk_check_button_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
224 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
225 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
226 a->options[j].val.bval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
227 gtk_signal_connect (GTK_OBJECT (w), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
228 GTK_SIGNAL_FUNC (boolean_changed_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
229 &a->options[j].val.bval);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
230 break;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
231 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
232 gtk_widget_show (w);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
233 gtk_tooltips_set_tip (actuator_tooltips, w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
234 a->desc->option_descs[j].doc, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
235 gtk_table_attach (GTK_TABLE (actuator_option_table), w,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
236 1, 2, i, i+1,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
237 GTK_EXPAND | GTK_SHRINK | GTK_FILL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
238 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
239 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
240 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
241
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
242 gtk_widget_set_sensitive (actuator_remove_button, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
243 gtk_widget_set_sensitive (actuator_add_button, a->desc->flags & ACTUATOR_FLAG_CONTAINER
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
244 ? TRUE : FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
245
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
246 selected_actuator_node = node;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
247 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
248
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
249 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
250 table_remove_all_cb (GtkWidget *widget, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
251 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
252 gtk_container_remove (GTK_CONTAINER (actuator_option_table),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
253 widget);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
254 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
255
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
256 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
257 row_unselect_cb (GtkCTree *ctree, GList *node, gint column,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
258 gpointer user_data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
259 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
260 gtk_frame_set_label (GTK_FRAME (option_frame), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
261
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
262 gtk_container_foreach (GTK_CONTAINER (actuator_option_table),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
263 table_remove_all_cb, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
264
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
265 /* Can't remove something if nothing's selected */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
266 gtk_widget_set_sensitive (actuator_remove_button, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
267
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
268 selected_actuator_node = NULL;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
269 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
270
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
271 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
272 add_actuator_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
273 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
274 char *actuator_name;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
275 struct pn_actuator *a;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
276
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
277 gtk_label_get (GTK_LABEL (GTK_BIN (actuator_add_opmenu)->child),
156
f52e866d7d8e [svn] - use user-friendly names in most places
nenolod
parents: 152
diff changeset
278 &actuator_name);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
279
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
280 a = create_actuator (actuator_name);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
281 g_assert (a);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
282
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
283 add_actuator (a, selected_actuator_node, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
284 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
285
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
286 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
287 remove_actuator_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
288 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
289 if (selected_actuator_node)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
290 gtk_ctree_remove_node (GTK_CTREE (actuator_tree),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
291 selected_actuator_node);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
292 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
293
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
294 /* Connect a node to its parent and replace the row data with
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
295 a copy of the node */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
296 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
297 connect_actuators_cb (GtkCTree *ctree, GtkCTreeNode *node,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
298 struct pn_actuator **root_ptr)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
299 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
300 struct pn_actuator *actuator, *parent, *copy;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
301
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
302 actuator = (struct pn_actuator *) gtk_ctree_node_get_row_data (ctree, node);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
303 if (GTK_CTREE_ROW (node)->parent)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
304 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
305 /* Connect it to the parent */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
306 parent = (struct pn_actuator *)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
307 gtk_ctree_node_get_row_data (ctree, GTK_CTREE_ROW (node)->parent);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
308 container_add_actuator (parent, actuator);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
309 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
310 else
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
311 /* This is the root node; still gotta copy it, but we need to
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
312 save the original to *root_ptr */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
313 *root_ptr = actuator;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
314
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
315 /* we don't want our copy getting destroyed */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
316 destroy_row_data = FALSE;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
317
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
318 copy = copy_actuator (actuator);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
319 gtk_ctree_node_set_row_data_full (ctree, node, copy,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
320 ((GtkDestroyNotify)actuator_row_data_destroyed_cb));
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
321
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
322 /* Ok, now you can destroy it */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
323 destroy_row_data = TRUE;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
324 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
325
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
326 /* Extract (and connect) the actuators in the tree */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
327 static struct pn_actuator *
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
328 extract_actuator (void)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
329 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
330 GtkCTreeNode *root, *selected;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
331 struct pn_actuator *root_actuator = NULL;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
332
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
333 root = gtk_ctree_node_nth (GTK_CTREE (actuator_tree), 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
334 if (root)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
335 gtk_ctree_post_recursive (GTK_CTREE (actuator_tree), root,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
336 GTK_CTREE_FUNC (connect_actuators_cb),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
337 &root_actuator);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
338
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
339 if (selected_actuator_node)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
340 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
341 selected = selected_actuator_node;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
342 gtk_ctree_unselect (GTK_CTREE (actuator_tree), GTK_CTREE_NODE (selected));
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
343 gtk_ctree_select (GTK_CTREE (actuator_tree), GTK_CTREE_NODE (selected));
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
344 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
345
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
346 return root_actuator;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
347 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
348
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
349 /* If selector != NULL, then it's 'OK', otherwise it's 'Cancel' */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
350 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
351 load_sel_cb (GtkButton *button, GtkFileSelection *selector)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
352 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
353 if (selector)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
354 {
332
626f9f4d79a8 [svn] Remove old-style is_our_file() where a new-style is_our_fd() exists
kiyoshi
parents: 307
diff changeset
355 static const char *fname;
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
356 struct pn_actuator *a;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
357 GtkCTreeNode *root;
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
358 ConfigDb *db;
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
359
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
360 db = bmp_cfg_db_open();
279
1983383db0f5 [svn] build fixes:
yaz
parents: 267
diff changeset
361 fname = (char *) gtk_file_selection_get_filename (selector);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
362 a = load_preset (fname);
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
363 bmp_cfg_db_set_string(db, "paranormal", "last_path", (char*)fname);
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
364 bmp_cfg_db_close(db);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
365 if (! a)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
366 pn_error ("Unable to load file: \"%s\"", fname);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
367 else
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
368 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
369 if ((root = gtk_ctree_node_nth (GTK_CTREE (actuator_tree), 0)))
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
370 gtk_ctree_remove_node (GTK_CTREE (actuator_tree), root);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
371 add_actuator (a, NULL, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
372 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
373 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
374
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
375 gtk_widget_set_sensitive (cfg_dialog, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
376 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
377
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
378 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
379 load_button_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
380 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
381 GtkWidget *selector;
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
382 ConfigDb *db;
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
383 gchar *last_path;
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
384
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
385 db = bmp_cfg_db_open();
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
386 selector = gtk_file_selection_new ("Load Preset");
307
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
387 if(bmp_cfg_db_get_string(db, "paranormal", "last_path", &last_path)) {
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
388 gtk_file_selection_set_filename(GTK_FILE_SELECTION(selector), last_path);
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
389 }
5648731be0fd [svn] Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
chainsaw
parents: 279
diff changeset
390 bmp_cfg_db_close(db);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
391
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
392 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
393 "clicked", GTK_SIGNAL_FUNC (load_sel_cb), selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
394 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (selector)->cancel_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
395 "clicked", GTK_SIGNAL_FUNC (load_sel_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
396
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
397 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
398 "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
399 (gpointer) selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
400 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (selector)->cancel_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
401 "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
402 (gpointer) selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
403
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
404 gtk_widget_set_sensitive (cfg_dialog, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
405 gtk_widget_show (selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
406 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
407
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
408 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
409 save_sel_cb (GtkButton *button, GtkFileSelection *selector)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
410 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
411 if (selector)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
412 {
267
89e1003e5e84 [svn] gtk_file_selection_get_filename wanted a const char, but was afraid to ask.
chainsaw
parents: 168
diff changeset
413 const char *fname;
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
414 struct pn_actuator *a;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
415
279
1983383db0f5 [svn] build fixes:
yaz
parents: 267
diff changeset
416 fname = (char *) gtk_file_selection_get_filename (selector);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
417 a = extract_actuator ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
418
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
419 if (! save_preset (fname, a))
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
420 pn_error ("unable to save preset to file: %s", fname);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
421 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
422
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
423 gtk_widget_set_sensitive (cfg_dialog, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
424 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
425
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
426 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
427 save_button_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
428 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
429 GtkWidget *selector;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
430
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
431 selector = gtk_file_selection_new ("Save Preset");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
432
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
433 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
434 "clicked", GTK_SIGNAL_FUNC (save_sel_cb), selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
435 gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (selector)->cancel_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
436 "clicked", GTK_SIGNAL_FUNC (save_sel_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
437
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
438 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
439 "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
440 (gpointer) selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
441 gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (selector)->cancel_button),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
442 "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
443 (gpointer) selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
444
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
445 gtk_widget_set_sensitive (cfg_dialog, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
446 gtk_widget_show (selector);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
447 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
448
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
449 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
450 apply_settings (void)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
451 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
452 struct pn_rc rc;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
453
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
454 rc.actuator = extract_actuator ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
455
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
456 pn_set_rc (&rc);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
457 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
458
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
459 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
460 apply_button_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
461 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
462 apply_settings ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
463 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
464
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
465 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
466 ok_button_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
467 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
468 apply_settings ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
469 gtk_widget_hide (cfg_dialog);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
470 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
471
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
472 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
473 cancel_button_cb (GtkButton *button, gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
474 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
475 gtk_widget_destroy (cfg_dialog);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
476 cfg_dialog = NULL;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
477 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
478
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
479 void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
480 pn_configure (void)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
481 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
482 GtkWidget *notebook, *label, *scrollwindow, *menu, *menuitem;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
483 GtkWidget *paned, *vbox, *table, *bbox, *button;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
484 int i;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
485
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
486
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
487 if (! cfg_dialog)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
488 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
489 /* The dialog */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
490 cfg_dialog = gtk_dialog_new ();
152
7b8588691a95 [svn] - don't replace our configuration
nenolod
parents: 149
diff changeset
491 gtk_window_set_title (GTK_WINDOW (cfg_dialog), "Paranormal Visualization Studio - Editor (PNS " VERSION ")");
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
492 gtk_widget_set_usize (cfg_dialog, 530, 370);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
493 gtk_container_border_width (GTK_CONTAINER (cfg_dialog), 8);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
494 gtk_signal_connect_object (GTK_OBJECT (cfg_dialog), "delete-event",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
495 GTK_SIGNAL_FUNC (gtk_widget_hide),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
496 GTK_OBJECT (cfg_dialog));
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
497
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
498 /* The notebook */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
499 notebook = gtk_notebook_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
500 gtk_widget_show (notebook);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
501 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cfg_dialog)->vbox), notebook,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
502 TRUE, TRUE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
503
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
504 /* Actuator page */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
505 paned = gtk_hpaned_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
506 gtk_widget_show (paned);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
507 label = gtk_label_new ("Actuators");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
508 gtk_widget_show (label);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
509 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), paned, label);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
510 vbox = gtk_vbox_new (FALSE, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
511 gtk_widget_show (vbox);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
512 gtk_paned_pack1 (GTK_PANED (paned), vbox, TRUE, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
513 scrollwindow = gtk_scrolled_window_new (NULL, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
514 gtk_widget_show (scrollwindow);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
515 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
516 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
517 gtk_box_pack_start (GTK_BOX (vbox), scrollwindow, TRUE, TRUE, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
518 actuator_tree = gtk_ctree_new (1, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
519 gtk_widget_show (actuator_tree);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
520 gtk_ctree_set_reorderable (GTK_CTREE (actuator_tree), TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
521 gtk_signal_connect (GTK_OBJECT (actuator_tree), "tree-select-row",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
522 GTK_SIGNAL_FUNC (row_select_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
523 gtk_signal_connect (GTK_OBJECT (actuator_tree), "tree-unselect-row",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
524 GTK_SIGNAL_FUNC (row_unselect_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
525 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrollwindow),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
526 actuator_tree);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
527 table = gtk_table_new (3, 2, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
528 gtk_widget_show (table);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
529 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
530 actuator_add_opmenu = gtk_option_menu_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
531 gtk_widget_show (actuator_add_opmenu);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
532 menu = gtk_menu_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
533 gtk_widget_show (menu);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
534 for (i=0; builtin_table[i]; i++)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
535 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
536 /* FIXME: Add actuator group support */
168
e094aa00fdee [svn] - support lookup of actuator templates by their display name
nenolod
parents: 156
diff changeset
537 menuitem = gtk_menu_item_new_with_label (builtin_table[i]->dispname);
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
538 gtk_widget_show (menuitem);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
539 gtk_menu_append (GTK_MENU (menu), menuitem);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
540 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
541 gtk_option_menu_set_menu (GTK_OPTION_MENU (actuator_add_opmenu), menu);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
542 gtk_table_attach (GTK_TABLE (table), actuator_add_opmenu,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
543 0, 2, 0, 1,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
544 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
545 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
546 actuator_add_button = gtk_button_new_with_label ("Add");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
547 gtk_widget_show (actuator_add_button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
548 gtk_signal_connect (GTK_OBJECT (actuator_add_button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
549 GTK_SIGNAL_FUNC (add_actuator_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
550 gtk_table_attach (GTK_TABLE (table), actuator_add_button,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
551 0, 1, 1, 2,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
552 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
553 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
554 actuator_remove_button = gtk_button_new_with_label ("Remove");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
555 gtk_widget_set_sensitive (actuator_remove_button, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
556 gtk_widget_show (actuator_remove_button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
557 gtk_signal_connect (GTK_OBJECT (actuator_remove_button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
558 GTK_SIGNAL_FUNC (remove_actuator_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
559 gtk_table_attach (GTK_TABLE (table), actuator_remove_button,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
560 1, 2, 1, 2,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
561 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
562 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
563 button = gtk_button_new_with_label ("Load");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
564 gtk_widget_show (button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
565 gtk_signal_connect (GTK_OBJECT (button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
566 GTK_SIGNAL_FUNC (load_button_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
567 gtk_table_attach (GTK_TABLE (table), button,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
568 0, 1, 2, 3,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
569 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
570 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
571 button = gtk_button_new_with_label ("Save");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
572 gtk_widget_show (button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
573 gtk_signal_connect (GTK_OBJECT (button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
574 GTK_SIGNAL_FUNC (save_button_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
575 gtk_table_attach (GTK_TABLE (table), button,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
576 1, 2, 2, 3,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
577 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
578 3, 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
579
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
580 /* Option table */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
581 option_frame = gtk_frame_new (NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
582 gtk_widget_show (option_frame);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
583 gtk_container_set_border_width (GTK_CONTAINER (option_frame), 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
584 gtk_paned_pack2 (GTK_PANED (paned), option_frame, TRUE, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
585 scrollwindow = gtk_scrolled_window_new (NULL, NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
586 gtk_widget_show (scrollwindow);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
587 gtk_container_set_border_width (GTK_CONTAINER (scrollwindow), 3);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
588 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
589 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
590 gtk_container_add (GTK_CONTAINER (option_frame), scrollwindow);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
591 actuator_option_table = gtk_table_new (0, 2, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
592 gtk_widget_show (actuator_option_table);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
593 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrollwindow),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
594 actuator_option_table);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
595 gtk_paned_set_position (GTK_PANED (paned), 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
596 actuator_tooltips = gtk_tooltips_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
597 gtk_tooltips_enable (actuator_tooltips);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
598
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
599 /* Build the initial actuator actuator_tree */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
600 if (pn_rc->actuator)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
601 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
602 add_actuator (pn_rc->actuator, NULL, TRUE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
603 gtk_widget_set_sensitive (actuator_add_button, FALSE);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
604 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
605
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
606 /* OK / Apply / Cancel */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
607 bbox = gtk_hbutton_box_new ();
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
608 gtk_widget_show (bbox);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
609 gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
610 gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 8);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
611 gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 64, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
612 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cfg_dialog)->action_area),
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
613 bbox, FALSE, FALSE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
614 button = gtk_button_new_with_label ("OK");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
615 gtk_widget_show (button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
616 gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
617 gtk_signal_connect (GTK_OBJECT (button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
618 GTK_SIGNAL_FUNC (ok_button_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
619 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
620 button = gtk_button_new_with_label ("Apply");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
621 gtk_widget_show (button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
622 gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
623 gtk_signal_connect (GTK_OBJECT (button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
624 GTK_SIGNAL_FUNC (apply_button_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
625 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
626 button = gtk_button_new_with_label ("Cancel");
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
627 gtk_widget_show (button);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
628 gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
629 gtk_signal_connect (GTK_OBJECT (button), "clicked",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
630 GTK_SIGNAL_FUNC (cancel_button_cb), NULL);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
631 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
632 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
633
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
634 gtk_widget_show (cfg_dialog);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
635 gtk_widget_grab_focus (cfg_dialog);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
636 }