Beispiel #1
0
/* Create a filter dialog for constructing a capture filter.

   This is to be used as a callback for a button next to a text entry box,
   which, when clicked, pops up this dialog to allow you to construct a
   display filter by browsing the list of saved filters (the dialog
   for constructing expressions assumes display filter syntax, not
   capture filter syntax).  The "OK" button sets the text entry box to the
   constructed filter and activates that text entry box (which should have
   no effect in the main capture dialog); this dialog is then dismissed. */
void
capture_filter_construct_cb(GtkWidget *w, gpointer user_data _U_)
{
    GtkWidget *filter_browse_w;
    GtkWidget *parent_filter_te;
    /* No Apply button, and "OK" just sets our text widget, it doesn't
       activate it (i.e., it doesn't cause us to try to open the file). */
    static construct_args_t args = {
        "Wireshark: Capture Filter",
        FALSE,
        FALSE,
        FALSE
    };

    /* Has a filter dialog box already been opened for that button? */
    filter_browse_w = (GtkWidget *)g_object_get_data(G_OBJECT(w), E_FILT_DIALOG_PTR_KEY);

    if (filter_browse_w != NULL) {
        /* Yes.  Just re-activate that dialog box. */
        reactivate_window(filter_browse_w);
        return;
    }

    /* No.  Get the text entry attached to the button. */
    parent_filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(w), E_FILT_TE_PTR_KEY);

    /* Now create a new dialog, without an "Add Expression..." button. */
    filter_dialog_new(w, parent_filter_te, CFILTER_LIST, &args);
}
Beispiel #2
0
/* Create a filter dialog for constructing a display filter.

   This is to be used as a callback for a button next to a text entry box,
   which, when clicked, pops up this dialog to allow you to construct a
   display filter by browsing the list of saved filters and/or by adding
   test expressions constructed with another dialog.  The "OK" button
   sets the text entry box to the constructed filter and activates that
   text entry box, causing the filter to be used; this dialog is then
   dismissed.

   If "wants_apply_button" is non-null, we add an "Apply" button that
   acts like "OK" but doesn't dismiss this dialog. */
void
display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
{
    construct_args_t *construct_args = (construct_args_t *)construct_args_ptr;
    GtkWidget *filter_browse_w;
    GtkWidget *parent_filter_te;

    /* Has a filter dialog box already been opened for the button? */
    filter_browse_w = (GtkWidget *)g_object_get_data(G_OBJECT(w), E_FILT_DIALOG_PTR_KEY);

    if (filter_browse_w != NULL) {
        /* Yes.  Just re-activate that dialog box. */
        reactivate_window(filter_browse_w);
        return;
    }

    /* No.  Get the text entry attached to the button. */
    parent_filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(w), E_FILT_TE_PTR_KEY);

    /* Now create a new dialog, possibly with an "Apply" button, and
       definitely with an "Add Expression..." button. */
    filter_dialog_new(w, parent_filter_te, DFILTER_LIST, construct_args);
}
Beispiel #3
0
gpointer hf_options_dialog_new(GtkWidget *window,
		GtkWidget *creation_container,
		GtkTooltips *tooltips, 
		gpointer widget_list, 
		gpointer data,
		stack_struct *stack,
		gchar *doc_type, gpointer all_docs,
		GList *(*get_doc_list_from_type) (gpointer all_docs, gchar *doc_type)) {
	// Options structure related to the tools dialog,
	// initialized once for all the documents
	// doc_type, all_docs, get_doc_list_from_type:  required for building a list of other available open documents
	gint i;
	hf_options_struct *hf_options;
	hf_options = (hf_options_struct *) x_malloc(sizeof(hf_options_struct), "hf_options_struct");
	hf_options->creation_container = creation_container;
	hf_options->tools_window = window;
	hf_options->tools_dialog = NULL;
	hf_options->hfw_ptr_ptr = data;
	hf_options->creation_widgets = (hf_creation_wdg_struct *) widget_list;
	hf_options->all_docs = all_docs;
	hf_options->doc_type = doc_type;
	hf_options->get_doc_list_from_type = get_doc_list_from_type;
	hf_options->current_tools = NULL;
	hf_options->context = TRANSFORM_CONTEXT;
	hf_options->last_creation_action = NULL;
	hf_options->tooltips = tooltips;
	hf_options->current_callb = NULL;
	hf_options->current_calculation = NULL;
	hf_options->current_options = NULL;
	hf_options->current_dialog = NULL ;
	hf_options->subdiv1_dialog = NULL;
	hf_options->subdiv2_dialog = NULL;
	hf_options->subdiv2_direct_upd = TRUE;
	hf_options->waves_dialog = NULL;
	hf_options->surfadd_dialog = NULL;
	hf_options->uniform_value = (hf_type *) x_malloc(sizeof(hf_type), "hf_type (hf_options->uniform_value)");
	(*hf_options->uniform_value) = 32767;
	hf_options->uniform_dialog = NULL;
	hf_options->subdiv1_options = NULL;
	hf_options->subdiv2_options = NULL;
	hf_options->surfadd_options = NULL;
	hf_options->waves_options = NULL;
	hf_options->wide_filter = NULL;
	hf_options->medium_filter1 = NULL;
	hf_options->medium_filter2 = NULL;
	hf_options->sharp_filter = NULL;
	hf_options->image_filter = NULL;
	hf_options->gauss_filter = NULL;
	hf_options->dist_matrix = dist_matrix_new(0);
	hf_options->creation_fd_struct = filter_dialog_new(window,tooltips,data);
	hf_options->fd_struct = hf_options->creation_fd_struct;
	hf_options->doc_list = NULL;
//	The default is to add the main filters dialog to the creation container
	if (creation_container)
		gtk_box_pack_start(GTK_BOX(creation_container), hf_options->fd_struct->filter_dialog, FALSE, FALSE, 0);
	hf_options->flag_uniform_done = FALSE;
	set_filter_defaults(hf_options->fd_struct);

	hf_options->draw = NULL;

// 	Cursors
	hf_options->default_cursor = gdk_cursor_new(GDK_LEFT_PTR);
	hf_options->current_cursor = hf_options->default_cursor;
	hf_options->pencil_cursor = gdk_cursor_new(GDK_PENCIL);
	hf_options->watch_cursor = gdk_cursor_new(GDK_WATCH);
	hf_options->fleur_cursor = gdk_cursor_new(GDK_FLEUR);
	hf_options->hf_size = 0;	// Initialized by hf_wrapper_new and size_callb
	hf_options->img = NULL;
	hf_options->need_tmp_buf = FALSE;	// Flag:  if we need temp buffer for brightness / contrast
						// useful after an undo...

//	OpenGL preview
	hf_options->gl_defaults = gl_defaults_init ( );

	for (i=0; i<GAUSS_LIST_LENGTH; i++)
		hf_options->gauss_list[i] = NULL;

	// Context management functions and data
	// The pointer field is inherited from app.h
	hf_options->stack = stack;

	hf_options->primit_surf = NULL;
	hf_options->fourier = fourier_dialog_new();
	hf_options->render_str = render_struct_new();

	set_stack_specific_fn (hf_options->stack, (gpointer) hf_specific_commit_or_reset);

	return (gpointer) hf_options;
}