+/* vim: set et sts=4 sw=4 fdm=indent fdn=1 fo+=t tw=80 fileencoding=utf-8:
+ *
+ * Taller de ProgramaciÃ\83³n (75.42).
+ *
+ * Ejercicio NÃ\83ºmero 5:
+ * Graficador de figuras.
+ *
+ * Copyleft 2003 - Leandro Lucarella <llucare@fi.uba.ar>
+ * Puede copiar, modificar y distribuir este programa bajo los tÃ\83©rminos de
+ * la licencia GPL (http://www.gnu.org/).
+ *
+ * Creado: miÃ\83© oct 1 23:31:40 ART 2003
+ *
+ * $Id$
+ */
+
+#include "callbacks.h"
+#include "interface.h"
+#include "dibujo.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#define GLADE_HOOKUP_OBJECT(component,widget,name) \
+ g_object_set_data_full (G_OBJECT (component), name, \
+ gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
+
+#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
+ g_object_set_data (G_OBJECT (component), name, widget)
+
+GtkWidget*
+create_window (Dibujo* dibujo)
+{
+ GtkWidget *window;
+ GtkWidget *vbox;
+ GtkWidget *hbox_botones;
+ GtkWidget *frame_dibujo;
+ GtkWidget *drawingarea;
+ GtkWidget *label_dibujo;
+ GtkWidget *vbuttonbox_botones;
+ GtkWidget *button_limpiar;
+ GtkWidget *button_actualizar;
+ GtkWidget *button_salir;
+ GtkWidget *hbox;
+ GtkWidget *frame_figura;
+ GtkWidget *vbox_figura;
+ GtkWidget *radiobutton_linea;
+ GSList *radiobutton_linea_group = NULL;
+ GtkWidget *radiobutton_cuadrado;
+ GtkWidget *radiobutton_rectangulo;
+ GtkWidget *radiobutton_circulo;
+ GtkWidget *label_figura;
+ GtkWidget *vbox_comun;
+ GtkWidget *table_comun;
+ GtkWidget *label_nombre;
+ GtkWidget *label_color;
+ GtkWidget *label_grosor;
+ GtkWidget *entry_nombre;
+ GtkWidget *combo_color;
+ GList *combo_color_items = NULL;
+ GtkWidget *combo_entry;
+ GtkObject *spinbutton_grosor_adj;
+ GtkWidget *spinbutton_grosor;
+ GtkWidget *button_agregar;
+ GtkWidget *vbox_otros;
+ GtkWidget *table_puntos;
+ GtkWidget *label_centro;
+ GtkWidget *label_inicio;
+ GtkWidget *label_fin;
+ GtkWidget *label_puntos;
+ GtkWidget *label_x;
+ GtkWidget *label_y;
+ GtkObject *spinbutton_centro_x_adj;
+ GtkWidget *spinbutton_centro_x;
+ GtkObject *spinbutton_centro_y_adj;
+ GtkWidget *spinbutton_centro_y;
+ GtkObject *spinbutton_inicio_x_adj;
+ GtkWidget *spinbutton_inicio_x;
+ GtkObject *spinbutton_inicio_y_adj;
+ GtkWidget *spinbutton_inicio_y;
+ GtkObject *spinbutton_fin_x_adj;
+ GtkWidget *spinbutton_fin_x;
+ GtkObject *spinbutton_fin_y_adj;
+ GtkWidget *spinbutton_fin_y;
+ GtkWidget *table_otros;
+ GtkWidget *label_alto;
+ GtkWidget *label_ancho;
+ GtkWidget *label_radio;
+ GtkObject *spinbutton_alto_adj;
+ GtkWidget *spinbutton_alto;
+ GtkObject *spinbutton_ancho_adj;
+ GtkWidget *spinbutton_ancho;
+ GtkObject *spinbutton_radio_adj;
+ GtkWidget *spinbutton_radio;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+ gtk_window_set_title (GTK_WINDOW (window), "Trabajo PrÃ\83¡ctico V");
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ hbox_botones = gtk_hbox_new (FALSE, 5);
+ gtk_widget_show (hbox_botones);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox_botones, TRUE, TRUE, 0);
+
+ frame_dibujo = gtk_frame_new (NULL);
+ gtk_widget_show (frame_dibujo);
+ gtk_box_pack_start (GTK_BOX (hbox_botones), frame_dibujo, TRUE, TRUE, 0);
+
+ drawingarea = gtk_drawing_area_new ();
+ gtk_widget_show (drawingarea);
+ gtk_container_add (GTK_CONTAINER (frame_dibujo), drawingarea);
+ gtk_widget_set_size_request (drawingarea, 200, 200);
+
+ label_dibujo = gtk_label_new ("Dibujo");
+ gtk_widget_show (label_dibujo);
+ gtk_frame_set_label_widget (GTK_FRAME (frame_dibujo), label_dibujo);
+ gtk_label_set_justify (GTK_LABEL (label_dibujo), GTK_JUSTIFY_LEFT);
+
+ vbuttonbox_botones = gtk_vbutton_box_new ();
+ gtk_widget_show (vbuttonbox_botones);
+ gtk_box_pack_start (GTK_BOX (hbox_botones), vbuttonbox_botones, FALSE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbuttonbox_botones), 5);
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox_botones), GTK_BUTTONBOX_SPREAD);
+
+ button_limpiar = gtk_button_new_from_stock ("gtk-clear");
+ gtk_widget_show (button_limpiar);
+ gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_limpiar);
+ GTK_WIDGET_SET_FLAGS (button_limpiar, GTK_CAN_DEFAULT);
+
+ button_actualizar = gtk_button_new_from_stock ("gtk-refresh");
+ gtk_widget_show (button_actualizar);
+ gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_actualizar);
+ GTK_WIDGET_SET_FLAGS (button_actualizar, GTK_CAN_DEFAULT);
+
+ button_salir = gtk_button_new_from_stock ("gtk-quit");
+ gtk_widget_show (button_salir);
+ gtk_container_add (GTK_CONTAINER (vbuttonbox_botones), button_salir);
+ GTK_WIDGET_SET_FLAGS (button_salir, GTK_CAN_DEFAULT);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ frame_figura = gtk_frame_new (NULL);
+ gtk_widget_show (frame_figura);
+ gtk_box_pack_start (GTK_BOX (hbox), frame_figura, FALSE, FALSE, 0);
+
+ vbox_figura = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox_figura);
+ gtk_container_add (GTK_CONTAINER (frame_figura), vbox_figura);
+
+ radiobutton_linea = gtk_radio_button_new_with_mnemonic (NULL, "LÃ\83Ânea");
+ gtk_widget_show (radiobutton_linea);
+ gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_linea, FALSE, FALSE, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_linea), radiobutton_linea_group);
+ radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_linea));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_linea), TRUE);
+
+ radiobutton_cuadrado = gtk_radio_button_new_with_mnemonic (NULL, "_Cuadrado");
+ gtk_widget_show (radiobutton_cuadrado);
+ gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_cuadrado, FALSE, FALSE, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_cuadrado), radiobutton_linea_group);
+ radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_cuadrado));
+
+ radiobutton_rectangulo = gtk_radio_button_new_with_mnemonic (NULL, "_RectÃ\83¡ngulo");
+ gtk_widget_show (radiobutton_rectangulo);
+ gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_rectangulo, FALSE, FALSE, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_rectangulo), radiobutton_linea_group);
+ radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_rectangulo));
+
+ radiobutton_circulo = gtk_radio_button_new_with_mnemonic (NULL, "CÃ\83Ârc_ulo");
+ gtk_widget_show (radiobutton_circulo);
+ gtk_box_pack_start (GTK_BOX (vbox_figura), radiobutton_circulo, FALSE, FALSE, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_circulo), radiobutton_linea_group);
+ radiobutton_linea_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_circulo));
+
+ label_figura = gtk_label_new ("Figura");
+ gtk_widget_show (label_figura);
+ gtk_frame_set_label_widget (GTK_FRAME (frame_figura), label_figura);
+ gtk_label_set_justify (GTK_LABEL (label_figura), GTK_JUSTIFY_LEFT);
+
+ vbox_comun = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox_comun);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox_comun, TRUE, TRUE, 0);
+
+ table_comun = gtk_table_new (3, 2, FALSE);
+ gtk_widget_show (table_comun);
+ gtk_box_pack_start (GTK_BOX (vbox_comun), table_comun, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (table_comun), 5);
+ gtk_table_set_row_spacings (GTK_TABLE (table_comun), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table_comun), 5);
+
+ label_nombre = gtk_label_new ("Nombre");
+ gtk_widget_show (label_nombre);
+ gtk_table_attach (GTK_TABLE (table_comun), label_nombre, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_nombre), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_nombre), 0, 0.5);
+
+ label_color = gtk_label_new ("Color");
+ gtk_widget_show (label_color);
+ gtk_table_attach (GTK_TABLE (table_comun), label_color, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_color), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_color), 0, 0.5);
+
+ label_grosor = gtk_label_new ("Grosor");
+ gtk_widget_show (label_grosor);
+ gtk_table_attach (GTK_TABLE (table_comun), label_grosor, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_grosor), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_grosor), 0, 0.5);
+
+ entry_nombre = gtk_entry_new ();
+ gtk_widget_show (entry_nombre);
+ gtk_table_attach (GTK_TABLE (table_comun), entry_nombre, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (GTK_EXPAND), 0, 0);
+ gtk_widget_set_size_request (entry_nombre, 100, -1);
+
+ combo_color = gtk_combo_new ();
+ g_object_set_data (G_OBJECT (GTK_COMBO (combo_color)->popwin),
+ "GladeParentKey", combo_color);
+ gtk_widget_show (combo_color);
+ gtk_table_attach (GTK_TABLE (table_comun), combo_color, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (GTK_EXPAND), 0, 0);
+ gtk_widget_set_size_request (combo_color, 150, -1);
+ gtk_combo_set_value_in_list (GTK_COMBO (combo_color), TRUE, FALSE);
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Negro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Blanco");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Rojo");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Verde");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Azul");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Cian");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Magenta");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Amarillo");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Gris");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Rojo Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Verde Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Azul Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Cian Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Magenta Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Amarillo Oscuro");
+ combo_color_items = g_list_append (combo_color_items, (gpointer) "Naranja");
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo_color), combo_color_items);
+ g_list_free (combo_color_items);
+
+ combo_entry = GTK_COMBO (combo_color)->entry;
+ gtk_widget_show (combo_entry);
+ gtk_editable_set_editable (GTK_EDITABLE (combo_entry), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (combo_entry), "Negro");
+
+ spinbutton_grosor_adj = gtk_adjustment_new (1, 1, 10, 1, 10, 10);
+ spinbutton_grosor = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_grosor_adj), 1, 0);
+ gtk_widget_show (spinbutton_grosor);
+ gtk_table_attach (GTK_TABLE (table_comun), spinbutton_grosor, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (GTK_EXPAND), 0, 0);
+ gtk_widget_set_size_request (spinbutton_grosor, 48, -1);
+
+ button_agregar = gtk_button_new_from_stock ("gtk-add");
+ gtk_widget_show (button_agregar);
+ gtk_box_pack_start (GTK_BOX (vbox_comun), button_agregar, FALSE, FALSE, 0);
+
+ vbox_otros = gtk_vbox_new (FALSE, 5);
+ gtk_widget_show (vbox_otros);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox_otros, FALSE, FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox_otros), 5);
+
+ table_puntos = gtk_table_new (4, 3, FALSE);
+ gtk_widget_show (table_puntos);
+ gtk_box_pack_start (GTK_BOX (vbox_otros), table_puntos, FALSE, FALSE, 0);
+ gtk_table_set_col_spacings (GTK_TABLE (table_puntos), 2);
+
+ label_centro = gtk_label_new ("Centro");
+ gtk_widget_show (label_centro);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_centro, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_centro), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_centro), 0, 0.5);
+
+ label_inicio = gtk_label_new ("Inicio");
+ gtk_widget_show (label_inicio);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_inicio, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_inicio), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_inicio), 0, 0.5);
+
+ label_fin = gtk_label_new ("Fin");
+ gtk_widget_show (label_fin);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_fin, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_fin), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_fin), 0, 0.5);
+
+ label_puntos = gtk_label_new ("");
+ gtk_widget_show (label_puntos);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_puntos, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_puntos), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_puntos), 0, 0.5);
+
+ label_x = gtk_label_new ("X");
+ gtk_widget_show (label_x);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_x, 1, 2, 0, 1,
+ (GtkAttachOptions) (0),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_x), 0, 0.5);
+
+ label_y = gtk_label_new ("Y");
+ gtk_widget_show (label_y);
+ gtk_table_attach (GTK_TABLE (table_puntos), label_y, 2, 3, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_y), 0, 0.5);
+
+ spinbutton_centro_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_centro_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_centro_x_adj), 1, 0);
+ gtk_widget_show (spinbutton_centro_x);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_centro_x, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ spinbutton_centro_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_centro_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_centro_y_adj), 1, 0);
+ gtk_widget_show (spinbutton_centro_y);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_centro_y, 2, 3, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ spinbutton_inicio_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_inicio_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_inicio_x_adj), 1, 0);
+ gtk_widget_show (spinbutton_inicio_x);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_inicio_x, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ spinbutton_inicio_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_inicio_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_inicio_y_adj), 1, 0);
+ gtk_widget_show (spinbutton_inicio_y);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_inicio_y, 2, 3, 2, 3,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ spinbutton_fin_x_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_fin_x = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_fin_x_adj), 1, 0);
+ gtk_widget_show (spinbutton_fin_x);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_fin_x, 1, 2, 3, 4,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ spinbutton_fin_y_adj = gtk_adjustment_new (0, 0, 1000, 1, 10, 10);
+ spinbutton_fin_y = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_fin_y_adj), 1, 0);
+ gtk_widget_show (spinbutton_fin_y);
+ gtk_table_attach (GTK_TABLE (table_puntos), spinbutton_fin_y, 2, 3, 3, 4,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ table_otros = gtk_table_new (3, 2, FALSE);
+ gtk_widget_show (table_otros);
+ gtk_box_pack_start (GTK_BOX (vbox_otros), table_otros, FALSE, FALSE, 0);
+ gtk_table_set_col_spacings (GTK_TABLE (table_otros), 2);
+
+ label_alto = gtk_label_new ("Alto");
+ gtk_widget_show (label_alto);
+ gtk_table_attach (GTK_TABLE (table_otros), label_alto, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_alto), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_alto), 0, 0.5);
+
+ label_ancho = gtk_label_new ("Ancho");
+ gtk_widget_show (label_ancho);
+ gtk_table_attach (GTK_TABLE (table_otros), label_ancho, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_ancho), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_ancho), 0, 0.5);
+
+ label_radio = gtk_label_new ("Radio");
+ gtk_widget_show (label_radio);
+ gtk_table_attach (GTK_TABLE (table_otros), label_radio, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_label_set_justify (GTK_LABEL (label_radio), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_radio), 0, 0.5);
+
+ spinbutton_alto_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
+ spinbutton_alto = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_alto_adj), 1, 0);
+ gtk_widget_show (spinbutton_alto);
+ gtk_table_attach (GTK_TABLE (table_otros), spinbutton_alto, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_sensitive (spinbutton_alto, FALSE);
+
+ spinbutton_ancho_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
+ spinbutton_ancho = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_ancho_adj), 1, 0);
+ gtk_widget_show (spinbutton_ancho);
+ gtk_table_attach (GTK_TABLE (table_otros), spinbutton_ancho, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_sensitive (spinbutton_ancho, FALSE);
+
+ spinbutton_radio_adj = gtk_adjustment_new (1, 1, 1000, 1, 10, 10);
+ spinbutton_radio = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_radio_adj), 1, 0);
+ gtk_widget_show (spinbutton_radio);
+ gtk_table_attach (GTK_TABLE (table_otros), spinbutton_radio, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_sensitive (spinbutton_radio, FALSE);
+
+ g_signal_connect ((gpointer) window, "delete_event",
+ G_CALLBACK (on_window_delete_event),
+ NULL);
+ g_signal_connect ((gpointer) drawingarea, "expose_event",
+ G_CALLBACK (on_drawingarea_expose_event),
+ dibujo);
+ g_signal_connect ((gpointer) button_limpiar, "clicked",
+ G_CALLBACK (on_button_borrar_clicked),
+ dibujo);
+ g_signal_connect ((gpointer) button_actualizar, "clicked",
+ G_CALLBACK (on_button_graficar_clicked),
+ drawingarea);
+ g_signal_connect ((gpointer) button_salir, "clicked",
+ G_CALLBACK (on_button_salir_clicked),
+ NULL);
+ g_signal_connect ((gpointer) button_agregar, "clicked",
+ G_CALLBACK (on_button_agregar_clicked),
+ dibujo);
+
+ /* Store pointers to all widgets, for use by lookup_widget(). */
+ GLADE_HOOKUP_OBJECT_NO_REF (window, window, "window");
+ GLADE_HOOKUP_OBJECT (window, vbox, "vbox");
+ GLADE_HOOKUP_OBJECT (window, hbox_botones, "hbox_botones");
+ GLADE_HOOKUP_OBJECT (window, frame_dibujo, "frame_dibujo");
+ GLADE_HOOKUP_OBJECT (window, drawingarea, "drawingarea");
+ GLADE_HOOKUP_OBJECT (window, label_dibujo, "label_dibujo");
+ GLADE_HOOKUP_OBJECT (window, vbuttonbox_botones, "vbuttonbox_botones");
+ GLADE_HOOKUP_OBJECT (window, button_limpiar, "button_limpiar");
+ GLADE_HOOKUP_OBJECT (window, button_actualizar, "button_actualizar");
+ GLADE_HOOKUP_OBJECT (window, button_salir, "button_salir");
+ GLADE_HOOKUP_OBJECT (window, hbox, "hbox");
+ GLADE_HOOKUP_OBJECT (window, frame_figura, "frame_figura");
+ GLADE_HOOKUP_OBJECT (window, vbox_figura, "vbox_figura");
+ GLADE_HOOKUP_OBJECT (window, radiobutton_linea, "radiobutton_linea");
+ GLADE_HOOKUP_OBJECT (window, radiobutton_cuadrado, "radiobutton_cuadrado");
+ GLADE_HOOKUP_OBJECT (window, radiobutton_rectangulo, "radiobutton_rectangulo");
+ GLADE_HOOKUP_OBJECT (window, radiobutton_circulo, "radiobutton_circulo");
+ GLADE_HOOKUP_OBJECT (window, label_figura, "label_figura");
+ GLADE_HOOKUP_OBJECT (window, vbox_comun, "vbox_comun");
+ GLADE_HOOKUP_OBJECT (window, table_comun, "table_comun");
+ GLADE_HOOKUP_OBJECT (window, label_nombre, "label_nombre");
+ GLADE_HOOKUP_OBJECT (window, label_color, "label_color");
+ GLADE_HOOKUP_OBJECT (window, label_grosor, "label_grosor");
+ GLADE_HOOKUP_OBJECT (window, entry_nombre, "entry_nombre");
+ GLADE_HOOKUP_OBJECT (window, combo_color, "combo_color");
+ GLADE_HOOKUP_OBJECT (window, combo_entry, "combo_entry");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_grosor, "spinbutton_grosor");
+ GLADE_HOOKUP_OBJECT (window, button_agregar, "button_agregar");
+ GLADE_HOOKUP_OBJECT (window, vbox_otros, "vbox_otros");
+ GLADE_HOOKUP_OBJECT (window, table_puntos, "table_puntos");
+ GLADE_HOOKUP_OBJECT (window, label_centro, "label_centro");
+ GLADE_HOOKUP_OBJECT (window, label_inicio, "label_inicio");
+ GLADE_HOOKUP_OBJECT (window, label_fin, "label_fin");
+ GLADE_HOOKUP_OBJECT (window, label_puntos, "label_puntos");
+ GLADE_HOOKUP_OBJECT (window, label_x, "label_x");
+ GLADE_HOOKUP_OBJECT (window, label_y, "label_y");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_centro_x, "spinbutton_centro_x");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_centro_y, "spinbutton_centro_y");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_inicio_x, "spinbutton_inicio_x");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_inicio_y, "spinbutton_inicio_y");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_fin_x, "spinbutton_fin_x");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_fin_y, "spinbutton_fin_y");
+ GLADE_HOOKUP_OBJECT (window, table_otros, "table_otros");
+ GLADE_HOOKUP_OBJECT (window, label_alto, "label_alto");
+ GLADE_HOOKUP_OBJECT (window, label_ancho, "label_ancho");
+ GLADE_HOOKUP_OBJECT (window, label_radio, "label_radio");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_alto, "spinbutton_alto");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_ancho, "spinbutton_ancho");
+ GLADE_HOOKUP_OBJECT (window, spinbutton_radio, "spinbutton_radio");
+
+ return window;
+}
+