diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-09-12 20:23:43 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-09-12 20:23:43 +0000 |
commit | 3823ab23beb83e6f5b679994325865e1e30c8f26 (patch) | |
tree | 30d655380623a7167d26da6d783347f8c52bb9ff /gtk | |
parent | 7b2ff4bfe92078932c2270debe5b41564992dc26 (diff) | |
download | wireshark-3823ab23beb83e6f5b679994325865e1e30c8f26.tar.gz wireshark-3823ab23beb83e6f5b679994325865e1e30c8f26.tar.bz2 wireshark-3823ab23beb83e6f5b679994325865e1e30c8f26.zip |
Add a "Expand all levels"/"Print as displayed" pair of radio buttons to
the "File/Print" dialog box; "Expand all levels" means that all levels
of the protocol tree should be printed, while "Print as displayed" means
that only those levels shown in the display should be printed.
Free the table of column widths once printing is done.
svn path=/trunk/; revision=671
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/keys.h | 19 | ||||
-rw-r--r-- | gtk/print_dlg.c | 50 | ||||
-rw-r--r-- | gtk/proto_draw.c | 22 |
3 files changed, 65 insertions, 26 deletions
diff --git a/gtk/keys.h b/gtk/keys.h index 514e602856..68b3b61e42 100644 --- a/gtk/keys.h +++ b/gtk/keys.h @@ -1,7 +1,7 @@ /* keys.h * Key definitions for various objects * - * $Id: keys.h,v 1.3 1999/09/12 06:11:50 guy Exp $ + * $Id: keys.h,v 1.4 1999/09/12 20:23:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -28,14 +28,15 @@ /* Keys for gtk_object_set_data */ -#define E_DFILTER_TE_KEY "display_filter_te" -#define E_RFILTER_TE_KEY "read_filter_te" +#define E_DFILTER_TE_KEY "display_filter_te" +#define E_RFILTER_TE_KEY "read_filter_te" -#define PRINT_CMD_LB_KEY "printer_command_label" -#define PRINT_CMD_TE_KEY "printer_command_entry" -#define PRINT_FILE_BT_KEY "printer_file_button" -#define PRINT_FILE_TE_KEY "printer_file_entry" -#define PRINT_DEST_RB_KEY "printer_destination_radio_button" -#define PRINT_SUMMARY_RB_KEY "printer_summary_radio_button" +#define PRINT_CMD_LB_KEY "printer_command_label" +#define PRINT_CMD_TE_KEY "printer_command_entry" +#define PRINT_FILE_BT_KEY "printer_file_button" +#define PRINT_FILE_TE_KEY "printer_file_entry" +#define PRINT_DEST_RB_KEY "printer_destination_radio_button" +#define PRINT_SUMMARY_RB_KEY "printer_summary_radio_button" +#define PRINT_EXPAND_ALL_RB_KEY "printer_expand_all_radio_button" #endif diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c index 302653d94b..8709da5a19 100644 --- a/gtk/print_dlg.c +++ b/gtk/print_dlg.c @@ -1,7 +1,7 @@ /* print_dlg.c * Dialog boxes for printing * - * $Id: print_dlg.c,v 1.4 1999/09/12 06:11:51 guy Exp $ + * $Id: print_dlg.c,v 1.5 1999/09/12 20:23:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -77,8 +77,11 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data) GtkWidget *cmd_lb, *cmd_te; GtkWidget *file_bt_hb, *file_bt, *file_te; GSList *dest_grp; - GtkWidget *summary_rb, *detail_rb; + GtkWidget *options_hb; + GtkWidget *summary_vb, *summary_rb, *detail_rb; GSList *summary_grp; + GtkWidget *expand_vb, *expand_all_rb, *as_displayed_rb; + GSList *expand_grp; GtkWidget *bbox, *ok_bt, *cancel_bt; /* XXX - don't pop up one if there's already one open; instead, @@ -190,17 +193,49 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data) gtk_signal_connect(GTK_OBJECT(file_bt), "clicked", GTK_SIGNAL_FUNC(print_file_cb), GTK_OBJECT(file_te)); + /* Horizontal box into which to put two vertical boxes of option + buttons. */ + options_hb = gtk_hbox_new(FALSE, 0); + gtk_container_border_width(GTK_CONTAINER(options_hb), 5); + gtk_container_add(GTK_CONTAINER(main_vb), options_hb); + gtk_widget_show(options_hb); + + /* Vertical box into which to put the "Print summary"/"Print detail" + radio buttons. */ + summary_vb = gtk_vbox_new(FALSE, 5); + gtk_container_border_width(GTK_CONTAINER(summary_vb), 5); + gtk_container_add(GTK_CONTAINER(options_hb), summary_vb); + gtk_widget_show(summary_vb); + /* "Print summary"/"Print detail" radio buttons */ summary_rb = gtk_radio_button_new_with_label(NULL, "Print summary"); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(summary_rb), FALSE); summary_grp = gtk_radio_button_group(GTK_RADIO_BUTTON(summary_rb)); - gtk_container_add(GTK_CONTAINER(main_vb), summary_rb); + gtk_container_add(GTK_CONTAINER(summary_vb), summary_rb); gtk_widget_show(summary_rb); detail_rb = gtk_radio_button_new_with_label(summary_grp, "Print detail"); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(detail_rb), TRUE); - gtk_container_add(GTK_CONTAINER(main_vb), detail_rb); + gtk_container_add(GTK_CONTAINER(summary_vb), detail_rb); gtk_widget_show(detail_rb); + /* Vertical box into which to put the "Expand all levels"/"Print as displayed" + radio buttons. */ + expand_vb = gtk_vbox_new(FALSE, 5); + gtk_container_border_width(GTK_CONTAINER(expand_vb), 5); + gtk_container_add(GTK_CONTAINER(options_hb), expand_vb); + gtk_widget_show(expand_vb); + + /* "Expand all levels"/"Print as displayed" radio buttons */ + expand_all_rb = gtk_radio_button_new_with_label(NULL, "Expand all levels"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(expand_all_rb), TRUE); + expand_grp = gtk_radio_button_group(GTK_RADIO_BUTTON(expand_all_rb)); + gtk_container_add(GTK_CONTAINER(expand_vb), expand_all_rb); + gtk_widget_show(expand_all_rb); + as_displayed_rb = gtk_radio_button_new_with_label(expand_grp, "Print as displayed"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(as_displayed_rb), FALSE); + gtk_container_add(GTK_CONTAINER(expand_vb), as_displayed_rb); + gtk_widget_show(as_displayed_rb); + /* Button row: OK and Cancel buttons */ bbox = gtk_hbutton_box_new(); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); @@ -213,6 +248,7 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data) gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_CMD_TE_KEY, cmd_te); gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_FILE_TE_KEY, file_te); gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_SUMMARY_RB_KEY, summary_rb); + gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_EXPAND_ALL_RB_KEY, expand_all_rb); gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked", GTK_SIGNAL_FUNC(print_ok_cb), GTK_OBJECT(print_w)); GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT); @@ -316,6 +352,10 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w) PRINT_SUMMARY_RB_KEY); print_args.print_summary = GTK_TOGGLE_BUTTON (button)->active; + button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(ok_bt), + PRINT_EXPAND_ALL_RB_KEY); + print_args.expand_all = GTK_TOGGLE_BUTTON (button)->active; + gtk_widget_destroy(GTK_WIDGET(parent_w)); #if 0 display_opt_window_active = FALSE; @@ -381,7 +421,7 @@ file_print_packet_cmd_cb(GtkWidget *widget, gpointer data) { } print_preamble(fh); - proto_tree_print(TRUE, (GNode*) cf.protocol_tree, cf.pd, cf.fd, fh); + proto_tree_print(TRUE, TRUE, (GNode*) cf.protocol_tree, cf.pd, cf.fd, fh); print_finale(fh); close_print_dest(prefs.pr_dest == PR_DEST_FILE, fh); } diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 2a49b8311e..ae23393b43 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* gtkpacket.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.2 1999/09/11 12:38:18 deniel Exp $ + * $Id: proto_draw.c,v 1.3 1999/09/12 20:23:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -52,8 +52,6 @@ extern GtkWidget *byte_view; extern GdkFont *m_r_font, *m_b_font; -static gint tree_type[NUM_TREE_TYPES]; - static void proto_tree_draw_node(GNode *node, gpointer data); @@ -124,7 +122,7 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen) { void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { int i; for(i=0; i < NUM_TREE_TYPES; i++) { - tree_type[i] = 1; + tree_is_expanded[i] = TRUE; } gtk_tree_clear_items(GTK_TREE(tree_view), 0, -1); proto_tree_draw(protocol_tree, tree_view); @@ -133,7 +131,7 @@ void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { int i; for(i=0; i < NUM_TREE_TYPES; i++) { - tree_type[i] = 0; + tree_is_expanded[i] = FALSE; } gtk_tree_clear_items(GTK_TREE(tree_view), 0, -1); proto_tree_draw(protocol_tree, tree_view); @@ -141,14 +139,14 @@ void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { static void expand_tree(GtkWidget *w, gpointer data) { - gint *val = (gint *) data; - *val = 1; + gboolean *val = (gint *) data; + *val = TRUE; } static void collapse_tree(GtkWidget *w, gpointer data) { - gint *val = (gint *) data; - *val = 0; + gboolean *val = (gint *) data; + *val = FALSE; } static void @@ -195,12 +193,12 @@ proto_tree_draw_node(GNode *node, gpointer data) if (g_node_n_children(node) > 0) { subtree = gtk_tree_new(); gtk_tree_item_set_subtree(GTK_TREE_ITEM(ti), GTK_WIDGET(subtree)); - if (tree_type[fi->tree_type]) + if (tree_is_expanded[fi->tree_type]) gtk_tree_item_expand(GTK_TREE_ITEM(ti)); gtk_signal_connect(GTK_OBJECT(ti), "expand", (GtkSignalFunc) expand_tree, - (gpointer) &tree_type[fi->tree_type]); + (gpointer) &tree_is_expanded[fi->tree_type]); gtk_signal_connect(GTK_OBJECT(ti), "collapse", (GtkSignalFunc) collapse_tree, - (gpointer) &tree_type[fi->tree_type]); + (gpointer) &tree_is_expanded[fi->tree_type]); g_node_children_foreach(node, G_TRAVERSE_ALL, proto_tree_draw_node, subtree); |