From: arif Date: Mon, 3 Mar 2008 15:37:41 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: LAST_LIBGRAPH~32^2~4607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58a5a278eb03731f5f3d4a167087895088b2f6fd;p=graphviz *** empty log message *** --- diff --git a/cmd/smyrna/gui/callbacks.c b/cmd/smyrna/gui/callbacks.c new file mode 100755 index 000000000..130b63a23 --- /dev/null +++ b/cmd/smyrna/gui/callbacks.c @@ -0,0 +1,323 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#define _CRT_SECURE_NO_DEPRECATE 1 +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include "callbacks.h" +#include "viewport.h" + + + +//Menu Items + + + +void +new_graph_clicked (GtkWidget *widget, + gpointer user_data) +{ + g_print ("new graph button fired\n"); +} + +void +open_graph_clicked (GtkWidget *widget, + gpointer user_data) + +{ + + +} +void +save_graph_clicked (GtkWidget *widget, + gpointer user_data) +{ + if(view->activeGraph > -1) + save_graph(view->g[view->activeGraph],NULL); +} + + +void +save_as_graph_clicked (GtkWidget *widget, + gpointer user_data) + +{ + GtkWidget *dialog; + dialog = gtk_file_chooser_dialog_new ("Save File", + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); + gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + char *filename; + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + save_graph(view->g[view->activeGraph],filename); + g_free (filename); + } + gtk_widget_destroy (dialog); + + + +} +void +remove_graph_clicked (GtkWidget *widget, + gpointer user_data) + + { + g_print ("remove graph button fired\n"); +} + + +void +btn_dot_clicked (GtkWidget *widget, + gpointer user_data) + +{ + GdkCursor* cursor; + GdkWindow* w; + Dlg = (GtkMessageDialog*)gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "This will change the graph layout\n all your position changes will be lost\n Are you sure?"); + + respond=gtk_dialog_run (Dlg); + if (respond == GTK_RESPONSE_YES) + do_graph_layout(view->g[view->activeGraph],0,0); + gtk_object_destroy (Dlg); + + cursor = gdk_cursor_new(GDK_HAND2); + w=glade_xml_get_widget(xml, "frmMain"); +// gdk_window_set_cursor(w, cursor); + gdk_window_set_cursor ((GTK_WIDGET(view->drawing_area)->window), cursor); +// gdk_window_set_title((GTK_WIDGET(widget)->window),"adasdasdasdassada"); + gdk_cursor_destroy(cursor); + + + +} + +void +btn_neato_clicked (GtkWidget *widget, + gpointer user_data) + +{ + Dlg = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "This will change the graph layout\n all your position changes will be lost\n Are you sure?"); + + respond=gtk_dialog_run (Dlg); + if (respond == GTK_RESPONSE_YES) + do_graph_layout(view->g[view->activeGraph],1,0); + gtk_object_destroy (Dlg); + gtk_button_set_image(GTK_BUTTON(glade_xml_get_widget(xml, "btn_neato")), gtk_image_new_from_file("c:\fonts.png")); + +} + +void +btn_twopi_clicked (GtkWidget *widget, + gpointer user_data) + +{ + Dlg = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "This will change the graph layout\n all your position changes will be lost\n Are you sure?"); + + respond=gtk_dialog_run (Dlg); + if (respond == GTK_RESPONSE_YES) + do_graph_layout(view->g[view->activeGraph],2,0); + gtk_object_destroy (Dlg); + +} + +void +btn_circo_clicked (GtkWidget *widget, + gpointer user_data) + +{ + Dlg = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "This will change the graph layout\n all your position changes will be lost\n Are you sure?"); + + respond=gtk_dialog_run (Dlg); + if (respond == GTK_RESPONSE_YES) + do_graph_layout(view->g[view->activeGraph],3,0); + gtk_object_destroy (Dlg); +} + +void +btn_fdp_clicked (GtkWidget *widget, + gpointer user_data) + +{ + int ind=0; + + Dlg = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "This will change the graph layout\n all your position changes will be lost\n Are you sure?"); + + respond=gtk_dialog_run (Dlg); + if (respond == GTK_RESPONSE_YES) + do_graph_layout(view->g[view->activeGraph],4,0); + gtk_object_destroy (Dlg); + + +} + + + + + +//test call back function delete later + + +static void callback( GtkWidget *widget, + gpointer data ) +{ + g_print ("Hello again - %s was pressed\n", (char *) data); +} + + +void +on_newNode (GtkWidget *button, + gpointer user_data) +{ + int* a; + int* b; + a=(int*) malloc (sizeof(int)); + b=(int*) malloc (sizeof(int)); + if(gdk_gl_query_version(a,b)) + { + printf ("min ver:%i\n",a); + printf ("min ver:%i\n",b); + + + } +} + + +void dlgOpenGraph_OK_Clicked( GtkWidget *button, + gpointer data ) +{ + g_print ("ok is pressed - %i was pressed\n",*(int*)data); + + +} + + +void graph_select_change (GtkWidget *widget, + gpointer user_data) +{ + gint active_graph; + + + if(!view->SignalBlock) + { + active_graph=gtk_combo_box_get_active(widget); + + if (active_graph > -1) + { + view->activeGraph=active_graph; + refreshControls(view); + } + } +} + +//dlgOpenGraph btnOK clicked +void on_dlgOpenGraph_btnOK_clicked (GtkWidget *widget, + + gpointer user_data) + +{ + +/* GTK_RESPONSE_OK = -5, + GTK_RESPONSE_CANCEL = -6, + GTK_RESPONSE_CLOSE = -7, + GTK_RESPONSE_YES = -8, + GTK_RESPONSE_NO = -9, + GTK_RESPONSE_APPLY = -10, + GTK_RESPONSE_HELP = -11 */ + + if(update_graph_properties(view->g[view->activeGraph])) + gtk_dialog_response(glade_xml_get_widget(xml, "dlgOpenGraph"),GTK_RESPONSE_OK); +} +//dlgOpenGraph btncancelclicked +void on_dlgOpenGraph_btncancel_clicked (GtkWidget *widget, + gpointer user_data) +{ + gtk_dialog_response(glade_xml_get_widget(xml, "dlgOpenGraph"),GTK_RESPONSE_CANCEL); + +} + + + + + + + +void attr_widgets_modifiedSlot(GtkWidget *widget,gpointer user_data) +{ + attr_widgets_modified[(int)user_data]=1; + g_print("attr changed signal..incoming data : %i\n",(int)user_data); + +} + + + +void frmObject_set_scroll (GtkWidget *widget,gpointer user_data) +{ + g_print("scroll resize required\n"); + +} + +void frmObjectBtnOK_clicked (GtkWidget *widget,gpointer user_data) +{ + //call function to update object values + update_object_properties(frmObjectTypeIndex,frmObjectg); + if(((custom_graph_data*)AGDATA(view->g[view->activeGraph]))->TopView == 0) + do_graph_layout(view->g[view->activeGraph],0,1); + else + { + set_update_required(&view->Topview); + deselect_all(view->g[view->activeGraph]); + } + + gtk_widget_hide(glade_xml_get_widget(xml, "frmObject")); +} +void frmObjectBtnCancel_clicked (GtkWidget *widget,gpointer user_data) +{ + gtk_widget_hide(glade_xml_get_widget(xml, "frmObject")); + +} + + + + + diff --git a/cmd/smyrna/gui/callbacks.h b/cmd/smyrna/gui/callbacks.h new file mode 100755 index 000000000..7495e7abe --- /dev/null +++ b/cmd/smyrna/gui/callbacks.h @@ -0,0 +1,67 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#include +#include "toolboxcallbacks.h" +#include "gui.h" + + + + + +#ifdef WIN32 //this shit is needed on WIN32 to get libglade see the callback +#define _BB __declspec(dllexport) +#else +#define _BB +#endif + +_BB void new_graph_clicked (GtkWidget *widget,gpointer user_data); +_BB void open_graph_clicked (GtkWidget *widget,gpointer user_data); +_BB void save_graph_clicked (GtkWidget *widget,gpointer user_data); +_BB void save_as_graph_clicked (GtkWidget *widget,gpointer user_data); +_BB void remove_graph_clicked (GtkWidget *widget,gpointer user_data); +void on_newNode (GtkWidget *button,gpointer user_data); +void dlgOpenGraph_OK_Clicked( GtkWidget *button,gpointer data ); +_BB void btn_dot_clicked(GtkWidget *widget,gpointer user_data); +_BB void btn_neato_clicked(GtkWidget *widget,gpointer user_data); +_BB void btn_twopi_clicked(GtkWidget *widget,gpointer user_data); +_BB void btn_circo_clicked(GtkWidget *widget,gpointer user_data); +_BB void btn_fdp_clicked (GtkWidget *widget,gpointer user_data); + +_BB void graph_select_change (GtkWidget *widget,gpointer user_data); +_BB void mGraphPropertiesSlot (GtkWidget *widget,gpointer user_data); + + +//dlgOpenGraph btnOK clicked +_BB void on_dlgOpenGraph_btnOK_clicked (GtkWidget *widget,gpointer user_data); +//dlgOpenGraph btncancelclicked +_BB void on_dlgOpenGraph_btncancel_clicked (GtkWidget *widget,gpointer user_data); + +//MENU + + +//frm Object OK button +//hides frmObject , set changed values to selected objects +_BB void frmObjectBtnOK_clicked (GtkWidget *widget,gpointer user_data); + +//frm Object Cancel button +//hides frmObject , ignores changed values + +_BB void frmObjectBtnCancel_clicked (GtkWidget *widget,gpointer user_data); + + +_BB void attr_widgets_modifiedSlot(GtkWidget *widget,gpointer user_data); + diff --git a/cmd/smyrna/gui/datalistcallbacks.c b/cmd/smyrna/gui/datalistcallbacks.c new file mode 100755 index 000000000..23a6e1d34 --- /dev/null +++ b/cmd/smyrna/gui/datalistcallbacks.c @@ -0,0 +1,142 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#include "datalistcallbacks.h" +#include "tvnodes.h" +void btnTVEdit_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + printf("btnTVEdit_clicked_cb\n"); +} +void btnTVDelete_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + printf("btnTVDelete_clicked_cb\n"); +} +void btnTVFilter_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + int respond; + int selected,visible,highlighted; + +// gtk_dialog_set_response_sensitive (glade_xml_get_widget(xml, "dlgOpenGraph"),1,1); +// gtk_dialog_set_response_sensitive (glade_xml_get_widget(xml, "dlgOpenGraph"),2,1); + respond=gtk_dialog_run (glade_xml_get_widget(xml, "dlgTVFilter")); +// respond=gtk_dialog_run (glade_xml_get_widget(xml, "dlgFilters")); + gtk_widget_hide(glade_xml_get_widget(xml, "dlgTVFilter")); + if(respond == 1) + apply_filter_from_gui(); +} +void btnTVFirst_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + tv_nodes_first_page(); +} +void btnTVPrevious_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + tv_nodes_prior_page(); +} +void btnTVNext_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + tv_nodes_next_page(); +} +void btnTVLast_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + tv_nodes_last_page(); +} +void btnTVGotopage_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + GtkSpinButton* spn; + int p; + spn=glade_xml_get_widget(xml, "spnTVGotopage"); + p=gtk_spin_button_get_value_as_int(spn); + tv_nodes_goto_page(p-1); +} +void btnTVCancel_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + printf("btnTVCancel_clicked_cb\n"); +} +void btnTVOK_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + update_TV_data_from_gui(); + gtk_widget_hide(glade_xml_get_widget(xml, "frmTVNodes")); +} +void btnTVReverse_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + printf("btnTVEdit_clicked_cb\n"); +} +void cgbTVSelect_toggled_cb (GtkWidget *widget,gpointer user_data) +{ + printf("btnTVEdit_clicked_cb\n"); +} + + + +void btnTVFilterApply_clicked_cb (GtkWidget *widget,gpointer user_data) +{ +/* GTK_RESPONSE_OK = -5, + GTK_RESPONSE_CANCEL = -6, + GTK_RESPONSE_CLOSE = -7, + GTK_RESPONSE_YES = -8, + GTK_RESPONSE_NO = -9, + GTK_RESPONSE_APPLY = -10, + GTK_RESPONSE_HELP = -11 */ + + gtk_dialog_response(glade_xml_get_widget(xml, "dlgTVFilter"),GTK_RESPONSE_OK); + +} +void btnTVFilterClear_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + gtk_entry_set_text (glade_xml_get_widget(xml,"edtTVFilterMinData1"),"" ); + gtk_entry_set_text ( glade_xml_get_widget(xml,"edtTVFilterMaxData1"),"" ); + gtk_entry_set_text ( glade_xml_get_widget(xml,"edtTVFilterMinData2"),"" ); + gtk_entry_set_text ( glade_xml_get_widget(xml,"edtTVFilterMaxData2"),"" ); + gtk_entry_set_text ( glade_xml_get_widget(xml,"edtTVFilterString"),"" ); + + + gtk_toggle_button_set_active(glade_xml_get_widget(xml,"rbTVFilterHigh1"),1); + gtk_toggle_button_set_active(glade_xml_get_widget(xml,"rbTVFilterSel1"),1); + gtk_toggle_button_set_active(glade_xml_get_widget(xml,"rbTVFilterVisible1"),1); + apply_filter_from_gui(); +} + +void btnTVSelectAll_clicked_cb (GtkWidget *widget,gpointer user_data) +{ + tv_select_all(); +} +void btnTVUnselectAll_clicked_cb(GtkWidget *widget,gpointer user_data) +{ + tv_unselect_all(); +} +void btnTVHighlightAll_clicked_cb(GtkWidget *widget,gpointer user_data) +{ + tv_highligh_all(); +} +void btnTVUnhighlightAll_clicked_cb(GtkWidget *widget,gpointer user_data) +{ + tv_unhighligh_all(); +} + + +void btnTVShowAll_clicked_cb(GtkWidget *widget,gpointer user_data) +{ + tv_show_all(); +} +void btnTVHideAll_clicked_cb(GtkWidget *widget,gpointer user_data) +{ + tv_hide_all(); +} + + + + + diff --git a/cmd/smyrna/gui/datalistcallbacks.h b/cmd/smyrna/gui/datalistcallbacks.h new file mode 100755 index 000000000..73c836040 --- /dev/null +++ b/cmd/smyrna/gui/datalistcallbacks.h @@ -0,0 +1,53 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#ifndef DATALISTCALLBACKS_H +#define DATALISTCALLBACKS_H + + +#include "gui.h" +#include "tvnodes.h" + + + + +_BB void btnTVEdit_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVDelete_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVFilter_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVFirst_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVPrevious_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVNext_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVLast_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVGotopage_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVCancel_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVOK_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVReverse_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void cgbTVSelect_toggled_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVFilterApply_clicked_cb(GtkWidget *widget,gpointer user_data); +_BB void btnTVFilterClear_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVSelectAll_clicked_cb (GtkWidget *widget,gpointer user_data); +_BB void btnTVUnselectAll_clicked_cb(GtkWidget *widget,gpointer user_data); +_BB void btnTVHighlightAll_clicked_cb(GtkWidget *widget,gpointer user_data); +_BB void btnTVUnhighlightAll_clicked_cb(GtkWidget *widget,gpointer user_data); +_BB void cgbTVSelect_toggled_cb(GtkWidget *widget,gpointer user_data); +_BB void cgbTVVisible_toggled_cb(GtkWidget *widget,gpointer user_data); +_BB void cgbTVHighlighted_toggled_cb(GtkWidget *widget,gpointer user_data); +_BB void btnTVShowAll_clicked_cb(GtkWidget *widget,gpointer user_data); +_BB void btnTVHideAll_clicked_cb(GtkWidget *widget,gpointer user_data); + + + +#endif