1 /* vim: set et sts=4 sw=4 fdm=indent fdn=1 fo+=t tw=80 fileencoding=utf-8:
3 * Taller de ProgramaciÃ
\83³n (75.42).
5 * Ejercicio NÃ
\83ºmero 5:
6 * Graficador de figuras.
8 * Copyleft 2003 - Leandro Lucarella <llucare@fi.uba.ar>
9 * Puede copiar, modificar y distribuir este programa bajo los tÃ
\83©rminos de
10 * la licencia GPL (http://www.gnu.org/).
12 * Creado: miÃ
\83© oct 1 23:31:40 ART 2003
17 #include "callbacks.h"
18 #include "interface.h"
21 #include <sys/types.h>
27 #include <gdk/gdkkeysyms.h>
30 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
31 g_object_set_data_full (G_OBJECT (component), name, \
32 gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
34 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
35 g_object_set_data (G_OBJECT (component), name, widget)
38 create_window (Dibujo* dibujo)
42 GtkWidget *hbox_botones;
43 GtkWidget *frame_dibujo;
44 GtkWidget *drawingarea;
45 GtkWidget *label_dibujo;
46 GtkWidget *vbuttonbox_botones;
47 GtkWidget *button_limpiar;
48 GtkWidget *button_actualizar;
49 GtkWidget *button_salir;
51 GtkWidget *frame_figura;
52 GtkWidget *vbox_figura;
53 GtkWidget *radiobutton_linea;
54 GSList *radiobutton_linea_group = NULL;
55 GtkWidget *radiobutton_cuadrado;
56 GtkWidget *radiobutton_rectangulo;
57 GtkWidget *radiobutton_circulo;
58 GtkWidget *label_figura;
59 GtkWidget *vbox_comun;
60 GtkWidget *table_comun;
61 GtkWidget *label_nombre;
62 GtkWidget *label_color;
63 GtkWidget *label_grosor;
64 GtkWidget *entry_nombre;
65 GtkWidget *combo_color;
66 GList *combo_color_items = NULL;
67 GtkWidget *combo_entry;
68 GtkObject *spinbutton_grosor_adj;
69 GtkWidget *spinbutton_grosor;
70 GtkWidget *button_agregar;
71 GtkWidget *vbox_otros;
72 GtkWidget *table_puntos;
73 GtkWidget *label_centro;
74 GtkWidget *label_inicio;
76 GtkWidget *label_puntos;
79 GtkObject *spinbutton_centro_x_adj;
80 GtkWidget *spinbutton_centro_x;
81 GtkObject *spinbutton_centro_y_adj;
82 GtkWidget *spinbutton_centro_y;
83 GtkObject *spinbutton_inicio_x_adj;
84 GtkWidget *spinbutton_inicio_x;
85 GtkObject *spinbutton_inicio_y_adj;
86 GtkWidget *spinbutton_inicio_y;
87 GtkObject *spinbutton_fin_x_adj;
88 GtkWidget *spinbutton_fin_x;
89 GtkObject *spinbutton_fin_y_adj;
90 GtkWidget *spinbutton_fin_y;
91 GtkWidget *table_otros;
92 GtkWidget *label_alto;
93 GtkWidget *label_ancho;
94 GtkWidget *label_radio;
95 GtkObject *spinbutton_alto_adj;
96 GtkWidget *spinbutton_alto;
97 GtkObject *spinbutton_ancho_adj;
98 GtkWidget *spinbutton_ancho;
99 GtkObject *spinbutton_radio_adj;
100 GtkWidget *spinbutton_radio;
102 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
103 gtk_container_set_border_width (GTK_CONTAINER (window), 5);
104 gtk_window_set_title (GTK_WINDOW (window), "Trabajo PrÃ
\83¡ctico V");
106 vbox = gtk_vbox_new (FALSE, 0);
107 gtk_widget_show (vbox);
108 gtk_container_add (GTK_CONTAINER (window), vbox);
110 hbox_botones = gtk_hbox_new (FALSE, 5);
111 gtk_widget_show (hbox_botones);
112 gtk_box_pack_start (GTK_BOX (vbox), hbox_botones, TRUE, TRUE, 0);
114 frame_dibujo = gtk_frame_new (NULL);
115 gtk_widget_show (frame_dibujo);
116 gtk_box_pack_start (GTK_BOX (hbox_botones), frame_dibujo, TRUE, TRUE, 0);
118 drawingarea = gtk_drawing_area_new ();
119 gtk_widget_show (drawingarea);
120 gtk_container_add (GTK_CONTAINER (frame_dibujo), drawingarea);
121 gtk_widget_set_size_request (drawingarea, 200, 200);
123 label_dibujo = gtk_label_new ("Dibujo");
124 gtk_widget_show (label_dibujo);
125 gtk_frame_set_label_widget (GTK_FRAME (frame_dibujo), label_dibujo);
126 gtk_label_set_justify (GTK_LABEL (label_dibujo), GTK_JUSTIFY_LEFT);
128 vbuttonbox_botones = gtk_vbutton_box_new ();
129 gtk_widget_show (vbuttonbox_botones);
130 gtk_box_pack_start (GTK_BOX (hbox_botones), vbuttonbox_botones, FALSE, TRUE, 0);
131 gtk_container_set_border_width (GTK_CONTAINER (vbuttonbox_botones), 5);
132 gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox_botones), GTK_BUTTONBOX_SPREAD);
134 button_limpiar = gtk_button_new_from_stock ("gtk-clear");
135 gtk_widget_show (button_limpiar);
136 gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_limpiar);
137 GTK_WIDGET_SET_FLAGS (button_limpiar, GTK_CAN_DEFAULT);
139 button_actualizar = gtk_button_new_from_stock ("gtk-refresh");
140 gtk_widget_show (button_actualizar);
141 gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_actualizar);
142 GTK_WIDGET_SET_FLAGS (button_actualizar, GTK_CAN_DEFAULT);
144 button_salir = gtk_button_new_from_stock ("gtk-quit");
145 gtk_widget_show (button_salir);
146 gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_salir);
147 GTK_WIDGET_SET_FLAGS (button_salir, GTK_CAN_DEFAULT);
149 hbox = gtk_hbox_new (FALSE, 0);
150 gtk_widget_show (hbox);
151 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
153 frame_figura = gtk_frame_new (NULL);
154 gtk_widget_show (frame_figura);
155 gtk_box_pack_start (GTK_BOX (hbox), frame_figura, FALSE, FALSE, 0);
157 vbox_figura = gtk_vbox_new (FALSE, 0);
158 gtk_widget_show (vbox_figura);
159 gtk_container_add (GTK_CONTAINER (frame_figura), vbox_figura);
161 radiobutton_linea = gtk_radio_button_new_with_mnemonic (NULL, "LÃ
\83Ânea");
162 gtk_widget_show (radiobutton_linea);
163 gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_linea, FALSE, FALSE, 0);
164 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_linea), radiobutton_linea_group);
165 radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_linea));
166 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_linea), TRUE);
168 radiobutton_cuadrado = gtk_radio_button_new_with_mnemonic (NULL, "_Cuadrado");
169 gtk_widget_show (radiobutton_cuadrado);
170 gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_cuadrado, FALSE, FALSE, 0);
171 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_cuadrado), radiobutton_linea_group);
172 radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_cuadrado));
174 radiobutton_rectangulo = gtk_radio_button_new_with_mnemonic (NULL, "_RectÃ
\83¡ngulo");
175 gtk_widget_show (radiobutton_rectangulo);
176 gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_rectangulo, FALSE, FALSE, 0);
177 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_rectangulo), radiobutton_linea_group);
178 radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_rectangulo));
180 radiobutton_circulo = gtk_radio_button_new_with_mnemonic (NULL, "CÃ
\83Ârc_ulo");
181 gtk_widget_show (radiobutton_circulo);
182 gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_circulo, FALSE, FALSE, 0);
183 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_circulo), radiobutton_linea_group);
184 radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_circulo));
186 label_figura = gtk_label_new ("Figura");
187 gtk_widget_show (label_figura);
188 gtk_frame_set_label_widget (GTK_FRAME (frame_figura), label_figura);
189 gtk_label_set_justify (GTK_LABEL (label_figura), GTK_JUSTIFY_LEFT);
191 vbox_comun = gtk_vbox_new (FALSE, 0);
192 gtk_widget_show (vbox_comun);
193 gtk_box_pack_start (GTK_BOX (hbox), vbox_comun, TRUE, TRUE, 0);
195 table_comun = gtk_table_new (3, 2, FALSE);
196 gtk_widget_show (table_comun);
197 gtk_box_pack_start (GTK_BOX (vbox_comun), table_comun, TRUE, TRUE, 0);
198 gtk_container_set_border_width (GTK_CONTAINER (table_comun), 5);
199 gtk_table_set_row_spacings (GTK_TABLE (table_comun), 3);
200 gtk_table_set_col_spacings (GTK_TABLE (table_comun), 5);
202 label_nombre = gtk_label_new ("Nombre");
203 gtk_widget_show (label_nombre);
204 gtk_table_attach (GTK_TABLE (table_comun), label_nombre, 0, 1, 0, 1,
205 (GtkAttachOptions) (GTK_FILL),
206 (GtkAttachOptions) (0), 0, 0);
207 gtk_label_set_justify (GTK_LABEL (label_nombre), GTK_JUSTIFY_LEFT);
208 gtk_misc_set_alignment (GTK_MISC (label_nombre), 0, 0.5);
210 label_color = gtk_label_new ("Color");
211 gtk_widget_show (label_color);
212 gtk_table_attach (GTK_TABLE (table_comun), label_color, 0, 1, 1, 2,
213 (GtkAttachOptions) (GTK_FILL),
214 (GtkAttachOptions) (0), 0, 0);
215 gtk_label_set_justify (GTK_LABEL (label_color), GTK_JUSTIFY_LEFT);
216 gtk_misc_set_alignment (GTK_MISC (label_color), 0, 0.5);
218 label_grosor = gtk_label_new ("Grosor");
219 gtk_widget_show (label_grosor);
220 gtk_table_attach (GTK_TABLE (table_comun), label_grosor, 0, 1, 2, 3,
221 (GtkAttachOptions) (GTK_FILL),
222 (GtkAttachOptions) (0), 0, 0);
223 gtk_label_set_justify (GTK_LABEL (label_grosor), GTK_JUSTIFY_LEFT);
224 gtk_misc_set_alignment (GTK_MISC (label_grosor), 0, 0.5);
226 entry_nombre = gtk_entry_new ();
227 gtk_widget_show (entry_nombre);
228 gtk_table_attach (GTK_TABLE (table_comun), entry_nombre, 1, 2, 0, 1,
229 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
230 (GtkAttachOptions) (GTK_EXPAND), 0, 0);
231 gtk_widget_set_size_request (entry_nombre, 100, -1);
233 combo_color = gtk_combo_new ();
234 g_object_set_data (G_OBJECT (GTK_COMBO (combo_color)->popwin),
235 "GladeParentKey", combo_color);
236 gtk_widget_show (combo_color);
237 gtk_table_attach (GTK_TABLE (table_comun), combo_color, 1, 2, 1, 2,
238 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
239 (GtkAttachOptions) (GTK_EXPAND), 0, 0);
240 gtk_widget_set_size_request (combo_color, 150, -1);
241 gtk_combo_set_value_in_list (GTK_COMBO (combo_color), TRUE, FALSE);
242 combo_color_items = g_list_append (combo_color_items, (gpointer) "Negro");
243 combo_color_items = g_list_append (combo_color_items, (gpointer) "Blanco");
244 combo_color_items = g_list_append (combo_color_items, (gpointer) "Rojo");
245 combo_color_items = g_list_append (combo_color_items, (gpointer) "Verde");
246 combo_color_items = g_list_append (combo_color_items, (gpointer) "Azul");
247 combo_color_items = g_list_append (combo_color_items, (gpointer) "Cian");
248 combo_color_items = g_list_append (combo_color_items, (gpointer) "Magenta");
249 combo_color_items = g_list_append (combo_color_items, (gpointer) "Amarillo");
250 combo_color_items = g_list_append (combo_color_items, (gpointer) "Gris");
251 combo_color_items = g_list_append (combo_color_items, (gpointer) "Rojo Oscuro");
252 combo_color_items = g_list_append (combo_color_items, (gpointer) "Verde Oscuro");
253 combo_color_items = g_list_append (combo_color_items, (gpointer) "Azul Oscuro");
254 combo_color_items = g_list_append (combo_color_items, (gpointer) "Cian Oscuro");
255 combo_color_items = g_list_append (combo_color_items, (gpointer) "Magenta Oscuro");
256 combo_color_items = g_list_append (combo_color_items, (gpointer) "Amarillo Oscuro");
257 combo_color_items = g_list_append (combo_color_items, (gpointer) "Naranja");
258 gtk_combo_set_popdown_strings (GTK_COMBO (combo_color), combo_color_items);
259 g_list_free (combo_color_items);
261 combo_entry = GTK_COMBO (combo_color)->entry;
262 gtk_widget_show (combo_entry);
263 gtk_editable_set_editable (GTK_EDITABLE (combo_entry), FALSE);
264 gtk_entry_set_text (GTK_ENTRY (combo_entry), "Negro");
266 spinbutton_grosor_adj = gtk_adjustment_new (1, 1, 10, 1, 10, 10);
267 spinbutton_grosor = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_grosor_adj), 1, 0);
268 gtk_widget_show (spinbutton_grosor);
269 gtk_table_attach (GTK_TABLE (table_comun), spinbutton_grosor, 1, 2, 2, 3,
270 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
271 (GtkAttachOptions) (GTK_EXPAND), 0, 0);
272 gtk_widget_set_size_request (spinbutton_grosor, 48, -1);
274 button_agregar = gtk_button_new_from_stock ("gtk-add");
275 gtk_widget_show (button_agregar);
276 gtk_box_pack_start (GTK_BOX (vbox_comun), button_agregar, FALSE, FALSE, 0);
278 vbox_otros = gtk_vbox_new (FALSE, 5);
279 gtk_widget_show (vbox_otros);
280 gtk_box_pack_start (GTK_BOX (hbox), vbox_otros, FALSE, FALSE, 0);
281 gtk_container_set_border_width (GTK_CONTAINER (vbox_otros), 5);
283 table_puntos = gtk_table_new (4, 3, FALSE);
284 gtk_widget_show (table_puntos);
285 gtk_box_pack_start (GTK_BOX (vbox_otros), table_puntos, FALSE, FALSE, 0);
286 gtk_table_set_col_spacings (GTK_TABLE (table_puntos), 2);
288 label_centro = gtk_label_new ("Centro");
289 gtk_widget_show (label_centro);
290 gtk_table_attach (GTK_TABLE (table_puntos), label_centro, 0, 1, 1, 2,
291 (GtkAttachOptions) (GTK_FILL),
292 (GtkAttachOptions) (0), 0, 0);
293 gtk_label_set_justify (GTK_LABEL (label_centro), GTK_JUSTIFY_LEFT);
294 gtk_misc_set_alignment (GTK_MISC (label_centro), 0, 0.5);
296 label_inicio = gtk_label_new ("Inicio");
297 gtk_widget_show (label_inicio);
298 gtk_table_attach (GTK_TABLE (table_puntos), label_inicio, 0, 1, 2, 3,
299 (GtkAttachOptions) (GTK_FILL),
300 (GtkAttachOptions) (0), 0, 0);
301 gtk_label_set_justify (GTK_LABEL (label_inicio), GTK_JUSTIFY_LEFT);
302 gtk_misc_set_alignment (GTK_MISC (label_inicio), 0, 0.5);
304 label_fin = gtk_label_new ("Fin");
305 gtk_widget_show (label_fin);
306 gtk_table_attach (GTK_TABLE (table_puntos), label_fin, 0, 1, 3, 4,
307 (GtkAttachOptions) (GTK_FILL),
308 (GtkAttachOptions) (0), 0, 0);
309 gtk_label_set_justify (GTK_LABEL (label_fin), GTK_JUSTIFY_LEFT);
310 gtk_misc_set_alignment (GTK_MISC (label_fin), 0, 0.5);
312 label_puntos = gtk_label_new ("");
313 gtk_widget_show (label_puntos);
314 gtk_table_attach (GTK_TABLE (table_puntos), label_puntos, 0, 1, 0, 1,
315 (GtkAttachOptions) (GTK_FILL),
316 (GtkAttachOptions) (0), 0, 0);
317 gtk_label_set_justify (GTK_LABEL (label_puntos), GTK_JUSTIFY_LEFT);
318 gtk_misc_set_alignment (GTK_MISC (label_puntos), 0, 0.5);
320 label_x = gtk_label_new ("X");
321 gtk_widget_show (label_x);
322 gtk_table_attach (GTK_TABLE (table_puntos), label_x, 1, 2, 0, 1,
323 (GtkAttachOptions) (0),
324 (GtkAttachOptions) (0), 0, 0);
325 gtk_misc_set_alignment (GTK_MISC (label_x), 0, 0.5);
327 label_y = gtk_label_new ("Y");
328 gtk_widget_show (label_y);
329 gtk_table_attach (GTK_TABLE (table_puntos), label_y, 2, 3, 0, 1,
330 (GtkAttachOptions) (GTK_EXPAND),
331 (GtkAttachOptions) (0), 0, 0);
332 gtk_misc_set_alignment (GTK_MISC (label_y), 0, 0.5);
334 spinbutton_centro_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
335 spinbutton_centro_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_centro_x_adj), 1, 0);
336 gtk_widget_show (spinbutton_centro_x);
337 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_centro_x, 1, 2, 1, 2,
338 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
339 (GtkAttachOptions) (0), 0, 0);
341 spinbutton_centro_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
342 spinbutton_centro_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_centro_y_adj), 1, 0);
343 gtk_widget_show (spinbutton_centro_y);
344 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_centro_y, 2, 3, 1, 2,
345 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
346 (GtkAttachOptions) (0), 0, 0);
348 spinbutton_inicio_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
349 spinbutton_inicio_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_inicio_x_adj), 1, 0);
350 gtk_widget_show (spinbutton_inicio_x);
351 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_inicio_x, 1, 2, 2, 3,
352 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
353 (GtkAttachOptions) (0), 0, 0);
355 spinbutton_inicio_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
356 spinbutton_inicio_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_inicio_y_adj), 1, 0);
357 gtk_widget_show (spinbutton_inicio_y);
358 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_inicio_y, 2, 3, 2, 3,
359 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
360 (GtkAttachOptions) (0), 0, 0);
362 spinbutton_fin_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
363 spinbutton_fin_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_fin_x_adj), 1, 0);
364 gtk_widget_show (spinbutton_fin_x);
365 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_fin_x, 1, 2, 3, 4,
366 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
367 (GtkAttachOptions) (0), 0, 0);
369 spinbutton_fin_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
370 spinbutton_fin_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_fin_y_adj), 1, 0);
371 gtk_widget_show (spinbutton_fin_y);
372 gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_fin_y, 2, 3, 3, 4,
373 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
374 (GtkAttachOptions) (0), 0, 0);
376 table_otros = gtk_table_new (3, 2, FALSE);
377 gtk_widget_show (table_otros);
378 gtk_box_pack_start (GTK_BOX (vbox_otros), table_otros, FALSE, FALSE, 0);
379 gtk_table_set_col_spacings (GTK_TABLE (table_otros), 2);
381 label_alto = gtk_label_new ("Alto");
382 gtk_widget_show (label_alto);
383 gtk_table_attach (GTK_TABLE (table_otros), label_alto, 0, 1, 0, 1,
384 (GtkAttachOptions) (GTK_FILL),
385 (GtkAttachOptions) (0), 0, 0);
386 gtk_label_set_justify (GTK_LABEL (label_alto), GTK_JUSTIFY_LEFT);
387 gtk_misc_set_alignment (GTK_MISC (label_alto), 0, 0.5);
389 label_ancho = gtk_label_new ("Ancho");
390 gtk_widget_show (label_ancho);
391 gtk_table_attach (GTK_TABLE (table_otros), label_ancho, 0, 1, 1, 2,
392 (GtkAttachOptions) (GTK_FILL),
393 (GtkAttachOptions) (0), 0, 0);
394 gtk_label_set_justify (GTK_LABEL (label_ancho), GTK_JUSTIFY_LEFT);
395 gtk_misc_set_alignment (GTK_MISC (label_ancho), 0, 0.5);
397 label_radio = gtk_label_new ("Radio");
398 gtk_widget_show (label_radio);
399 gtk_table_attach (GTK_TABLE (table_otros), label_radio, 0, 1, 2, 3,
400 (GtkAttachOptions) (GTK_FILL),
401 (GtkAttachOptions) (0), 0, 0);
402 gtk_label_set_justify (GTK_LABEL (label_radio), GTK_JUSTIFY_LEFT);
403 gtk_misc_set_alignment (GTK_MISC (label_radio), 0, 0.5);
405 spinbutton_alto_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
406 spinbutton_alto = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_alto_adj), 1, 0);
407 gtk_widget_show (spinbutton_alto);
408 gtk_table_attach (GTK_TABLE (table_otros), spinbutton_alto, 1, 2, 0, 1,
409 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
410 (GtkAttachOptions) (0), 0, 0);
411 gtk_widget_set_sensitive (spinbutton_alto, FALSE);
413 spinbutton_ancho_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
414 spinbutton_ancho = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_ancho_adj), 1, 0);
415 gtk_widget_show (spinbutton_ancho);
416 gtk_table_attach (GTK_TABLE (table_otros), spinbutton_ancho, 1, 2, 1, 2,
417 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
418 (GtkAttachOptions) (0), 0, 0);
419 gtk_widget_set_sensitive (spinbutton_ancho, FALSE);
421 spinbutton_radio_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
422 spinbutton_radio = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_radio_adj), 1, 0);
423 gtk_widget_show (spinbutton_radio);
424 gtk_table_attach (GTK_TABLE (table_otros), spinbutton_radio, 1, 2, 2, 3,
425 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
426 (GtkAttachOptions) (0), 0, 0);
427 gtk_widget_set_sensitive (spinbutton_radio, FALSE);
429 g_signal_connect ((gpointer) window, "delete_event",
430 G_CALLBACK (on_window_delete_event),
432 g_signal_connect ((gpointer) drawingarea, "expose_event",
433 G_CALLBACK (on_drawingarea_expose_event),
435 g_signal_connect ((gpointer) button_limpiar, "clicked",
436 G_CALLBACK (on_button_borrar_clicked),
438 g_signal_connect ((gpointer) button_actualizar, "clicked",
439 G_CALLBACK (on_button_graficar_clicked),
441 g_signal_connect ((gpointer) button_salir, "clicked",
442 G_CALLBACK (on_button_salir_clicked),
444 g_signal_connect ((gpointer) button_agregar, "clicked",
445 G_CALLBACK (on_button_agregar_clicked),
448 /* Store pointers to all widgets, for use by lookup_widget(). */
449 GLADE_HOOKUP_OBJECT_NO_REF (window, window, "window");
450 GLADE_HOOKUP_OBJECT (window, vbox, "vbox");
451 GLADE_HOOKUP_OBJECT (window, hbox_botones, "hbox_botones");
452 GLADE_HOOKUP_OBJECT (window, frame_dibujo, "frame_dibujo");
453 GLADE_HOOKUP_OBJECT (window, drawingarea, "drawingarea");
454 GLADE_HOOKUP_OBJECT (window, label_dibujo, "label_dibujo");
455 GLADE_HOOKUP_OBJECT (window, vbuttonbox_botones, "vbuttonbox_botones");
456 GLADE_HOOKUP_OBJECT (window, button_limpiar, "button_limpiar");
457 GLADE_HOOKUP_OBJECT (window, button_actualizar, "button_actualizar");
458 GLADE_HOOKUP_OBJECT (window, button_salir, "button_salir");
459 GLADE_HOOKUP_OBJECT (window, hbox, "hbox");
460 GLADE_HOOKUP_OBJECT (window, frame_figura, "frame_figura");
461 GLADE_HOOKUP_OBJECT (window, vbox_figura, "vbox_figura");
462 GLADE_HOOKUP_OBJECT (window, radiobutton_linea, "radiobutton_linea");
463 GLADE_HOOKUP_OBJECT (window, radiobutton_cuadrado, "radiobutton_cuadrado");
464 GLADE_HOOKUP_OBJECT (window, radiobutton_rectangulo, "radiobutton_rectangulo");
465 GLADE_HOOKUP_OBJECT (window, radiobutton_circulo, "radiobutton_circulo");
466 GLADE_HOOKUP_OBJECT (window, label_figura, "label_figura");
467 GLADE_HOOKUP_OBJECT (window, vbox_comun, "vbox_comun");
468 GLADE_HOOKUP_OBJECT (window, table_comun, "table_comun");
469 GLADE_HOOKUP_OBJECT (window, label_nombre, "label_nombre");
470 GLADE_HOOKUP_OBJECT (window, label_color, "label_color");
471 GLADE_HOOKUP_OBJECT (window, label_grosor, "label_grosor");
472 GLADE_HOOKUP_OBJECT (window, entry_nombre, "entry_nombre");
473 GLADE_HOOKUP_OBJECT (window, combo_color, "combo_color");
474 GLADE_HOOKUP_OBJECT (window, combo_entry, "combo_entry");
475 GLADE_HOOKUP_OBJECT (window, spinbutton_grosor, "spinbutton_grosor");
476 GLADE_HOOKUP_OBJECT (window, button_agregar, "button_agregar");
477 GLADE_HOOKUP_OBJECT (window, vbox_otros, "vbox_otros");
478 GLADE_HOOKUP_OBJECT (window, table_puntos, "table_puntos");
479 GLADE_HOOKUP_OBJECT (window, label_centro, "label_centro");
480 GLADE_HOOKUP_OBJECT (window, label_inicio, "label_inicio");
481 GLADE_HOOKUP_OBJECT (window, label_fin, "label_fin");
482 GLADE_HOOKUP_OBJECT (window, label_puntos, "label_puntos");
483 GLADE_HOOKUP_OBJECT (window, label_x, "label_x");
484 GLADE_HOOKUP_OBJECT (window, label_y, "label_y");
485 GLADE_HOOKUP_OBJECT (window, spinbutton_centro_x, "spinbutton_centro_x");
486 GLADE_HOOKUP_OBJECT (window, spinbutton_centro_y, "spinbutton_centro_y");
487 GLADE_HOOKUP_OBJECT (window, spinbutton_inicio_x, "spinbutton_inicio_x");
488 GLADE_HOOKUP_OBJECT (window, spinbutton_inicio_y, "spinbutton_inicio_y");
489 GLADE_HOOKUP_OBJECT (window, spinbutton_fin_x, "spinbutton_fin_x");
490 GLADE_HOOKUP_OBJECT (window, spinbutton_fin_y, "spinbutton_fin_y");
491 GLADE_HOOKUP_OBJECT (window, table_otros, "table_otros");
492 GLADE_HOOKUP_OBJECT (window, label_alto, "label_alto");
493 GLADE_HOOKUP_OBJECT (window, label_ancho, "label_ancho");
494 GLADE_HOOKUP_OBJECT (window, label_radio, "label_radio");
495 GLADE_HOOKUP_OBJECT (window, spinbutton_alto, "spinbutton_alto");
496 GLADE_HOOKUP_OBJECT (window, spinbutton_ancho, "spinbutton_ancho");
497 GLADE_HOOKUP_OBJECT (window, spinbutton_radio, "spinbutton_radio");