Download document (10.35 MB) - Escuela Superior de Informática ...

Download document (10.35 MB) - Escuela Superior de Informática ... Download document (10.35 MB) - Escuela Superior de Informática ...

11.07.2015 Views

158 Capítulo D. Código fuente593 * Funcion: key_press_event594 * Descripcion: Manejador de eventos de teclado en la Interfaz.595 * Entradas: widget --> Puntero al widget GtkGlExt596 * event --> Puntero con caracteristicas del evento ocurrido597 * data --> Puntero con datos que se le pasan como parametros598 * Salidas: Devuelve TRUE si no se produjo error.599 ********************************************************************/600 gboolean key_press_event (GtkWidget *widget, GdkEventKey *event,601 gpointer data){602603 GtkWidget *sec_video_frames;604 GtkWidget *notebook_edicion;605 GtkWidget *show_tools_panel;606 GtkWidget *show_preprocess_video;607608 show_tools_panel = glade_xml_get_widget(gxml, "show_tools_panel");609 show_preprocess_video = glade_xml_get_widget(gxml,610 "show_preprocess_video");611612 sec_video_frames = glade_xml_get_widget (gxml, "sec_video_frames");613 notebook_edicion = glade_xml_get_widget (gxml, "notebook_edicion");614615 switch (event->keyval) {616 case GDK_plus:617 escala += 0.01;618 calculaProyeccion();619 break;620 case GDK_minus:621 escala -= 0.01;622 calculaProyeccion();623 break;624 case GDK_F1:625 if(GTK_WIDGET_VISIBLE (sec_video_frames)) {626 //˜ gtk_widget_hide(sec_video_frames);627 gtk_check_menu_item_set_active(show_preprocess_video, FALSE);628 }else {629 //˜ gtk_widget_show(sec_video_frames);630 gtk_check_menu_item_set_active(show_preprocess_video, TRUE);631 }632 break;633 case GDK_F2:634 if(GTK_WIDGET_VISIBLE (notebook_edicion)) {635 //˜ gtk_widget_hide(notebook_edicion);636 gtk_check_menu_item_set_active(show_tools_panel, FALSE);637 }else {638 //˜ gtk_widget_show(notebook_edicion);639 gtk_check_menu_item_set_active(show_tools_panel, TRUE);640 }641 break;642 case GDK_F3:643 break;644 default:645 return FALSE;646 }647648 gtk_widget_queue_draw(GTK_WIDGET((GtkWidget *)data));649650 return TRUE;651 }652

D.2. Código fuente de los módulos más relevantes. 159653 /************************************************************************654 * Funcion: abrir_fichero_bon655 * Descripcion: Realiza la apertura del fichero de configuración de las656 * marcas y huesos de los brazos, y los carga en su estructura657 * de datos marcas y huesos.658 * Entradas: fichero --> Puntero al nombre del fichero a abrir.659 * Salidas: Devuelve -1 si hubo algun error. 0 en caso contrario.660 ***********************************************************************/661 int abrir_fichero_bon (char *nombre)662 {663 FILE *ficheroBON;664 int num_marcas, num_huesos;665 int i;666667 if ((ficheroBON = fopen (nombre, "rw"))==NULL) return 1;668 else {669670 fscanf (ficheroBON, " %d\t %d", &num_marcas, &num_huesos);671 if (num_marcas != (InfoFichero.num_canales/3)){672 mostrar_popup ("El fichero de Esqueleto NO es valido.\n673 Causa: Diferente numero de canales",674 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE);675 return 1;676 };677678 for (i=0; i

158 Capítulo D. Código fuente593 * Funcion: key_press_event594 * Descripcion: Manejador <strong>de</strong> eventos <strong>de</strong> teclado en la Interfaz.595 * Entradas: widget --> Puntero al widget GtkGlExt596 * event --> Puntero con caracteristicas <strong>de</strong>l evento ocurrido597 * data --> Puntero con datos que se le pasan como parametros598 * Salidas: Devuelve TRUE si no se produjo error.599 ********************************************************************/600 gboolean key_press_event (GtkWidget *widget, GdkEventKey *event,601 gpointer data){602603 GtkWidget *sec_vi<strong>de</strong>o_frames;604 GtkWidget *notebook_edicion;605 GtkWidget *show_tools_panel;606 GtkWidget *show_preprocess_vi<strong>de</strong>o;607608 show_tools_panel = gla<strong>de</strong>_xml_get_widget(gxml, "show_tools_panel");609 show_preprocess_vi<strong>de</strong>o = gla<strong>de</strong>_xml_get_widget(gxml,610 "show_preprocess_vi<strong>de</strong>o");611612 sec_vi<strong>de</strong>o_frames = gla<strong>de</strong>_xml_get_widget (gxml, "sec_vi<strong>de</strong>o_frames");613 notebook_edicion = gla<strong>de</strong>_xml_get_widget (gxml, "notebook_edicion");614615 switch (event->keyval) {616 case GDK_plus:617 escala += 0.01;618 calculaProyeccion();619 break;620 case GDK_minus:621 escala -= 0.01;622 calculaProyeccion();623 break;624 case GDK_F1:625 if(GTK_WIDGET_VISIBLE (sec_vi<strong>de</strong>o_frames)) {626 //˜ gtk_widget_hi<strong>de</strong>(sec_vi<strong>de</strong>o_frames);627 gtk_check_menu_item_set_active(show_preprocess_vi<strong>de</strong>o, FALSE);628 }else {629 //˜ gtk_widget_show(sec_vi<strong>de</strong>o_frames);630 gtk_check_menu_item_set_active(show_preprocess_vi<strong>de</strong>o, TRUE);631 }632 break;633 case GDK_F2:634 if(GTK_WIDGET_VISIBLE (notebook_edicion)) {635 //˜ gtk_widget_hi<strong>de</strong>(notebook_edicion);636 gtk_check_menu_item_set_active(show_tools_panel, FALSE);637 }else {638 //˜ gtk_widget_show(notebook_edicion);639 gtk_check_menu_item_set_active(show_tools_panel, TRUE);640 }641 break;642 case GDK_F3:643 break;644 <strong>de</strong>fault:645 return FALSE;646 }647648 gtk_widget_queue_draw(GTK_WIDGET((GtkWidget *)data));649650 return TRUE;651 }652

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!