本文整理汇总了C++中GIMP_DIALOG函数的典型用法代码示例。如果您正苦于以下问题:C++ GIMP_DIALOG函数的具体用法?C++ GIMP_DIALOG怎么用?C++ GIMP_DIALOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GIMP_DIALOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: border_dialog
static gboolean
border_dialog (gint32 image_ID,
GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_hbox;
GtkWidget *middle_vbox;
GtkWidget *right_vbox;
GtkWidget *label;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new ("Simple Border", PLUG_IN_ROLE,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gimp_window_set_transient (GTK_WINDOW (dialog));
gtk_widget_show (dialog);
main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
main_hbox, TRUE, TRUE, 0);
gtk_widget_show (main_hbox);
middle_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (middle_vbox), 12);
gtk_box_pack_start (GTK_BOX (main_hbox), middle_vbox, TRUE, TRUE, 0);
gtk_widget_show (middle_vbox);
right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 12);
gtk_widget_set_size_request (right_vbox, 320, -1);
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
gtk_widget_show (right_vbox);
/* preview */
label = gtk_label_new ("Preview");
gtk_box_pack_start (GTK_BOX (middle_vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
preview_image = gimp_image_duplicate(image_ID);
preview = gtk_image_new();
preview_update (preview);
gtk_box_pack_start (GTK_BOX (middle_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
/* textures */
label = gtk_label_new ("Textures");
gtk_box_pack_start (GTK_BOX (right_vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
GtkWidget *notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (right_vbox), notebook, FALSE, FALSE, 0);
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_widget_show (notebook);
create_texture_page (GTK_NOTEBOOK (notebook), "Top", textures, G_N_ELEMENTS (textures));
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例2: exchange_dialog
//.........这里部分代码省略.........
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&xargs.threshold.g);
g_signal_connect (adj, "value-changed",
G_CALLBACK (scale_callback),
&xargs.threshold);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
}
/* Blue */
image = gtk_image_new_from_stock (GIMP_STOCK_CHANNEL_BLUE,
GTK_ICON_SIZE_BUTTON);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
gtk_table_attach (GTK_TABLE (table), image,
0, 1, row, row + 1 + (framenumber ? 0 : 1),
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (image);
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, row++,
_("_Blue:"), SCALE_WIDTH, 0,
framenumber ? xargs.to.b : xargs.from.b,
0.0, 1.0, 0.01, 0.1, 3,
TRUE, 0, 0,
NULL, NULL);
g_object_set_data (G_OBJECT (adj), "colorbutton", colorbutton);
g_object_set_data (G_OBJECT (colorbutton), "blue", adj);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
framenumber ? &xargs.to.b : &xargs.from.b);
g_signal_connect (adj, "value-changed",
G_CALLBACK (scale_callback),
framenumber ? &xargs.to : &xargs.from);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
if (! framenumber)
{
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, row++,
_("B_lue threshold:"), SCALE_WIDTH, 0,
xargs.threshold.b,
0.0, 1.0, 0.01, 0.1, 3,
TRUE, 0, 0,
NULL, NULL);
g_object_set_data (G_OBJECT (adj), "colorbutton", threshold);
g_object_set_data (G_OBJECT (threshold), "blue", adj);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&xargs.threshold.b);
g_signal_connect (adj, "value-changed",
G_CALLBACK (scale_callback),
&xargs.threshold);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
}
if (! framenumber)
{
GtkWidget *button;
button = gtk_check_button_new_with_mnemonic (_("Lock _thresholds"));
gtk_table_attach (GTK_TABLE (table), button, 2, 4, row, row + 1,
GTK_FILL, 0, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
lock_threshold);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (gimp_toggle_button_update),
&lock_threshold);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gimp_preview_invalidate),
preview);
}
}
g_object_unref (group);
/* show everything */
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例3: save_dialog
//.........这里部分代码省略.........
gimp_window_set_transient (GTK_WINDOW (dlg));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
/* table */
table = gtk_table_new (5, 2, FALSE);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 12);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
/* Filename entry */
entry = gtk_entry_new ();
gtk_widget_set_size_request (entry, 200, -1);
gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1);
gtk_entry_set_text (GTK_ENTRY (entry), mail_info.filename);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Filename:"), 0.0, 0.5,
entry, 1, FALSE);
g_signal_connect (entry, "changed",
G_CALLBACK (mail_entry_callback),
mail_info.filename);
/* To entry */
entry = gtk_entry_new ();
gtk_widget_set_size_request (entry, 200, -1);
gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1);
gtk_entry_set_text (GTK_ENTRY (entry), mail_info.receipt);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_To:"), 0.0, 0.5,
entry, 1, FALSE);
g_signal_connect (entry, "changed",
G_CALLBACK (mail_entry_callback),
mail_info.receipt);
gtk_widget_grab_focus (entry);
/* From entry */
entry = gtk_entry_new ();
gtk_widget_set_size_request (entry, 200, -1);
gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1);
gtk_entry_set_text (GTK_ENTRY (entry), mail_info.from);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_From:"), 0.0, 0.5,
entry, 1, FALSE);
g_signal_connect (entry, "changed",
G_CALLBACK (mail_entry_callback),
mail_info.from);
/* Subject entry */
entry = gtk_entry_new ();
gtk_widget_set_size_request (entry, 200, -1);
gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1);
gtk_entry_set_text (GTK_ENTRY (entry), mail_info.subject);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("S_ubject:"), 0.0, 0.5,
entry, 1, FALSE);
g_signal_connect (entry, "changed",
G_CALLBACK (mail_entry_callback),
mail_info.subject);
/* Body */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (main_vbox), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
text_buffer = gtk_text_buffer_new (NULL);
g_signal_connect (text_buffer, "changed",
G_CALLBACK (mesg_body_callback),
NULL);
gtk_text_buffer_set_text (text_buffer, mail_info.comment, -1);
text_view = gtk_text_view_new_with_buffer (text_buffer);
g_object_unref (text_buffer);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
gtk_widget_show (text_view);
gtk_widget_show (dlg);
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dlg);
return run;
}
示例4: neon_dialog
static gboolean
neon_dialog (GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
GtkWidget *table;
GtkObject *scale_data;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new (_("Neon Detection"), PLUG_IN_ROLE,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
g_signal_connect (preview, "invalidated",
G_CALLBACK (neon_preview_update),
NULL);
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* Label, scale, entry for evals.radius */
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("_Radius:"), 100, 8,
evals.radius, 0.0, 64.0, 1, 10, 2,
FALSE, 0.0,
8 * MAX (drawable->width, drawable->height),
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&evals.radius);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
/* Label, scale, entry for evals.amount */
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("_Amount:"), 100, 8,
evals.amount, 0.0, 1.0, 0.01, 0.1, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&evals.amount);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例5: ripple_dialog
//.........这里部分代码省略.........
_("_Wrap"), WRAP, &wrap,
_("_Smear"), SMEAR, &smear,
_("_Blank"), BLANK, &blank,
NULL);
gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 1, 2,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
gtk_widget_show (frame);
g_object_bind_property (toggle, "active",
frame, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
g_signal_connect_swapped (wrap, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
g_signal_connect_swapped (smear, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
g_signal_connect_swapped (blank, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
/* Wave toggle box */
frame = gimp_int_radio_group_new (TRUE, _("Wave Type"),
G_CALLBACK (gimp_radio_button_update),
&rvals.waveform, rvals.waveform,
_("Saw_tooth"), SAWTOOTH, &sawtooth,
_("S_ine"), SINE, &sine,
NULL);
gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 1, 2,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
gtk_widget_show (frame);
g_signal_connect_swapped (sawtooth, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
g_signal_connect_swapped (sine, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (table);
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
/* Period */
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("_Period:"), SCALE_WIDTH, 0,
rvals.period, 1, 200, 1, 10, 0,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
G_CALLBACK (gimp_int_adjustment_update),
&rvals.period);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
/* Amplitude */
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("A_mplitude:"), SCALE_WIDTH, 0,
rvals.amplitude, 0, 200, 1, 10, 0,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
G_CALLBACK (gimp_int_adjustment_update),
&rvals.amplitude);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
/* Phase Shift */
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
_("Phase _shift:"), SCALE_WIDTH, 0,
rvals.phase_shift, 0, 360, 1, 15, 0,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
G_CALLBACK (gimp_int_adjustment_update),
&rvals.phase_shift);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (frame);
gtk_widget_show (table);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例6: spread_dialog
static gboolean
spread_dialog (gint32 image_ID,
GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
GtkWidget *frame;
GtkWidget *size;
GimpUnit unit;
gdouble xres;
gdouble yres;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new (_("Spread"), PLUG_IN_BINARY,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
frame = gimp_frame_new (_("Spread Amount"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* Get the image resolution and unit */
gimp_image_get_resolution (image_ID, &xres, &yres);
unit = gimp_image_get_unit (image_ID);
/* sizeentries */
size = gimp_coordinates_new (unit, "%a", TRUE, FALSE, -1,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
spvals.spread_amount_x == spvals.spread_amount_y,
FALSE,
_("_Horizontal:"), spvals.spread_amount_x, xres,
0, MAX (drawable->width, drawable->height),
0, 0,
_("_Vertical:"), spvals.spread_amount_y, yres,
0, MAX (drawable->width, drawable->height),
0, 0);
gtk_container_add (GTK_CONTAINER (frame), size);
gtk_widget_show (size);
g_signal_connect (preview, "invalidated",
G_CALLBACK (spread_preview_update),
size);
g_signal_connect_swapped (size, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (dialog);
spread_preview_update (GIMP_PREVIEW (preview), size);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (run)
{
spvals.spread_amount_x =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 0);
spvals.spread_amount_y =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 1);
}
gtk_widget_destroy (dialog);
return run;
}
示例7: load_dialog
//.........这里部分代码省略.........
(gdouble) GIMP_MIN_IMAGE_SIZE / (gdouble) svg_height,
(gdouble) GIMP_MAX_IMAGE_SIZE / (gdouble) svg_height,
0.01, 0.1, 0,
0.01, 4);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
gtk_table_attach_defaults (GTK_TABLE (table2), spinbutton, 0, 1, 1, 2);
gtk_widget_show (spinbutton);
g_signal_connect (yadj, "value-changed",
G_CALLBACK (load_dialog_ratio_callback),
NULL);
label = gtk_label_new_with_mnemonic (_("_Y ratio:"));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
/* the constrain ratio chainbutton */
constrain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (constrain), TRUE);
gtk_table_attach_defaults (GTK_TABLE (table2), constrain, 1, 2, 0, 2);
gtk_widget_show (constrain);
gimp_help_set_help_data (GIMP_CHAIN_BUTTON (constrain)->button,
_("Constrain aspect ratio"), NULL);
gtk_widget_show (table2);
/* Resolution */
label = gtk_label_new (_("Resolution:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
res = gimp_size_entry_new (1, GIMP_UNIT_INCH, _("pixels/%a"),
FALSE, FALSE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gtk_table_set_col_spacing (GTK_TABLE (res), 1, 6);
gtk_table_attach (GTK_TABLE (table), res, 1, 2, 4, 5,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (res);
/* don't let the resolution become too small, librsvg tends to
crash with very small resolutions */
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (res), 0,
5.0, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (res), 0, load_vals.resolution);
g_signal_connect (res, "value-changed",
G_CALLBACK (load_dialog_resolution_callback),
(gpointer) filename);
/* Path Import */
toggle = gtk_check_button_new_with_mnemonic (_("Import _paths"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), load_vals.import);
gtk_table_attach (GTK_TABLE (table), toggle, 0, 2, 5, 6,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (toggle);
gimp_help_set_help_data (toggle,
_("Import path elements of the SVG so they "
"can be used with the GIMP path tool"),
NULL);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&load_vals.import);
toggle2 = gtk_check_button_new_with_mnemonic (_("Merge imported paths"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle2), load_vals.merge);
gtk_table_attach (GTK_TABLE (table), toggle2, 0, 2, 6, 7,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (toggle2);
g_signal_connect (toggle2, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&load_vals.merge);
g_object_bind_property (toggle, "active",
toggle2, "sensitive",
G_BINDING_SYNC_CREATE);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (run)
{
load_vals.width = ROUND (gimp_size_entry_get_refval (size, 0));
load_vals.height = ROUND (gimp_size_entry_get_refval (size, 1));
}
gtk_widget_destroy (dialog);
return run ? GIMP_PDB_SUCCESS : GIMP_PDB_CANCEL;
}
示例8: dog_dialog
//.........这里部分代码省略.........
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new (_("DoG Edge Detect"), PLUG_IN_ROLE,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, FALSE, FALSE, 0);
gtk_widget_show (preview);
g_signal_connect (preview, "invalidated",
G_CALLBACK (preview_update_preview),
drawable);
frame = gimp_frame_new (_("Smoothing Parameters"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* Get the image resolution and unit */
gimp_image_get_resolution (image_ID, &xres, &yres);
unit = gimp_image_get_unit (image_ID);
coord = gimp_coordinates_new (unit, "%a", TRUE, FALSE, -1,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
FALSE,
TRUE,
_("_Radius 1:"), dogvals.inner, xres,
0, 8 * MAX (drawable->width, drawable->height),
0, 0,
_("R_adius 2:"), dogvals.outer, yres,
0, 8 * MAX (drawable->width, drawable->height),
0, 0);
gtk_container_add (GTK_CONTAINER (frame), coord);
gtk_widget_show (coord);
gimp_size_entry_set_pixel_digits (GIMP_SIZE_ENTRY (coord), 1);
g_signal_connect (coord, "value-changed",
G_CALLBACK (change_radius_callback),
preview);
button = gtk_check_button_new_with_mnemonic (_("_Normalize"));
gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), dogvals.normalize);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&dogvals.normalize);
g_signal_connect_swapped (button, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (button);
button = gtk_check_button_new_with_mnemonic (_("_Invert"));
gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), dogvals.invert);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&dogvals.invert);
g_signal_connect_swapped (button, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (button);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (run)
{
dogvals.inner = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (coord), 0);
dogvals.outer = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (coord), 1);
}
gtk_widget_destroy (dialog);
return run;
}
示例9: film_dialog
static gboolean
film_dialog (gint32 image_ID)
{
GtkWidget *dlg;
GtkWidget *main_vbox;
GtkWidget *notebook;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, TRUE);
dlg = gimp_dialog_new (_("Filmstrip"), PLUG_IN_ROLE,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dlg));
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
create_selection_tab (notebook, image_ID);
create_advanced_tab (notebook);
gtk_widget_show (notebook);
gtk_widget_show (dlg);
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
if (run)
{
gint num_images = 0;
gboolean iter_valid;
GtkTreeIter iter;
for (iter_valid = gtk_tree_model_get_iter_first (filmint.image_list_film,
&iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (filmint.image_list_film,
&iter))
{
gint image_ID;
gtk_tree_model_get (filmint.image_list_film, &iter,
0, &image_ID,
-1);
if ((image_ID >= 0) && (num_images < MAX_FILM_PICTURES))
filmvals.image[num_images++] = image_ID;
}
filmvals.num_images = num_images;
}
gtk_widget_destroy (dlg);
return run;
}
示例10: sobel_dialog
static gboolean
sobel_dialog (GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
GtkWidget *toggle;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new (_("Sobel Edge Detection"), PLUG_IN_BINARY,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
g_signal_connect (preview, "invalidated",
G_CALLBACK (sobel_preview_update),
NULL);
toggle = gtk_check_button_new_with_mnemonic (_("Sobel _horizontally"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&bvals.horizontal);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic (_("Sobel _vertically"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&bvals.vertical);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic (_("_Keep sign of result "
"(one direction only)"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.keep_sign);
gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&bvals.keep_sign);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例11: koi_dialog
//.........这里部分代码省略.........
printf("############## GUI init ##############\n");
gimp_ui_init ("Koi", FALSE);
dialog = gimp_dialog_new ("Koi", "Koi", NULL, 0, gimp_standard_help_func, "Koi", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
//create plugins and link them into the list
create_clone_plugin();
plugin[0] = &clone_plugin;
create_grain_plugin();
plugin[1] = &grain_plugin;
create_texture_plugin();
plugin[2] = &texture_plugin;
create_speckle_plugin();
plugin[3] = &speckle_plugin;
create_mosaic_plugin();
plugin[4] = &mosaic_plugin;
create_jpeg_plugin();
plugin[5] = &jpeg_plugin;
main_vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, (gboolean *)TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
frame = gtk_frame_new (NULL);
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (frame), alignment);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 6, 6, 6);
main_hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (main_hbox);
gtk_container_add (GTK_CONTAINER (alignment), main_hbox);
//######################################3
//this is where im make my notebook tabs
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
gtk_widget_show (notebook);
printf("creating tabs\n");
for(ii = 0; ii< NUM_PLUGINS; ii++)
{
// should make a checkbox with its name will do that later
//add the page to the notbook
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), plugin[ii]->create_gui(), plugin[ii]->label);
}
printf("all tabs created\n");
gtk_box_pack_start (GTK_BOX (main_hbox), notebook, FALSE, FALSE, 6);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox);
label = gtk_label_new ("Thread count");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
thread_count_spinbutton = gimp_spin_button_new (&thread_count_spinbutton_value, NUM_THREADS, 0, 16, 1, 1, 0, 1, 0);
gtk_widget_show (thread_count_spinbutton);
gtk_box_pack_start (GTK_BOX (vbox), thread_count_spinbutton, FALSE, FALSE, 0);
// thread_count_spinbutton = gimp_spin_button_new (&thread_count_spinbutton_value, gui_options.threads, 1, 8, 1, 1, 1, 1, 0);
// gtk_box_pack_start (GTK_BOX (vbox), thread_count_spinbutton, FALSE, FALSE, 0);
// gtk_widget_show (thread_count_spinbutton);
gtk_box_pack_start (GTK_BOX (main_hbox), vbox, FALSE, FALSE, 0);
g_signal_connect_swapped (preview, "invalidated",G_CALLBACK (koi), drawable);
koi (drawable, GIMP_PREVIEW (preview));
// g_signal_connect (clone_check_button, "clicked", G_CALLBACK (cb_clone_check_button), &gui_options);
g_signal_connect (thread_count_spinbutton_value, "value_changed", G_CALLBACK (gimp_int_adjustment_update), &NUM_THREADS);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例12: oval_dialog
static gboolean
oval_dialog (GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *main_hbox;
GtkWidget *frame;
GtkWidget *width_label;
GtkWidget *alignment;
GtkWidget *spinbutton;
GtkWidget *spinbutton2;
GtkWidget *spinbutton3;
GtkObject *spinbutton_adj;
GtkWidget *frame_label;
gboolean run;
//This function initializes GTK+ with gtk_init() and initializes GDK's image rendering subsystem (GdkRGB) to follow the GIMP main program's colormap allocation/installation policy.
gimp_ui_init ("oval", FALSE);
//Creates a new GimpDialog widget
dialog = gimp_dialog_new ("My Oval", "myoval",
NULL, 0,
gimp_standard_help_func, "plug-in-oval",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
//returns a new gtkvbox
main_vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); //struct to contain widgets
gtk_widget_show (main_vbox);
//Creates a new GtkFrame, with optional label label. If label is NULL, the label is omitted.
frame = gtk_frame_new (NULL);
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0); //Adds widgets to box, packed with reference to the start of box
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
alignment = gtk_alignment_new (0.5, 0.5, 1, 1); //params are xalign, yalign, xscale, yscale
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (frame), alignment);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 6, 6, 6); //Gets the padding on the different sides of the widget.
main_hbox = gtk_hbox_new (FALSE, 0); //creates a new gtkhbox
gtk_widget_show (main_hbox);
gtk_container_add (GTK_CONTAINER (alignment), main_hbox);
width_label = gtk_label_new_with_mnemonic ("Xcord/Ycord:"); // Creates a new GtkLabel, containing the text in str.
gtk_widget_show (width_label);
gtk_box_pack_start (GTK_BOX (main_hbox), width_label, FALSE, FALSE, 6);
gtk_label_set_justify (GTK_LABEL (width_label), GTK_JUSTIFY_RIGHT);
spinbutton_adj = gtk_adjustment_new (10, 0, 100, 1, 5, 5);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
gtk_widget_show (spinbutton);
gtk_box_pack_start (GTK_BOX (main_hbox), spinbutton, FALSE, FALSE, 6);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
frame_label = gtk_label_new ("<b>Modify oval</b>");
gtk_widget_show (frame_label);
gtk_frame_set_label_widget (GTK_FRAME (frame), frame_label);
gtk_label_set_use_markup (GTK_LABEL (frame_label), TRUE);
g_signal_connect (spinbutton_adj, "value_changed", //Connects a GCallback function to a signal for a particular object. Params are instance, detailed_signal, c_handler, data
G_CALLBACK (gimp_int_adjustment_update),
&vals.xcord);
spinbutton_adj = gtk_adjustment_new (10, 0, 100, 1, 5, 5); //initial value, min value, max value, step increment, page increment, page size
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
gtk_widget_show (spinbutton2);
gtk_box_pack_start (GTK_BOX (main_hbox), spinbutton2, FALSE, FALSE, 6);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
g_signal_connect (spinbutton_adj, "value_changed",
G_CALLBACK (gimp_int_adjustment_update),
&vals.ycord);
spinbutton_adj = gtk_adjustment_new (0, 0, 4, 1, 5, 5);
spinbutton3 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
gtk_widget_show (spinbutton3);
gtk_box_pack_start (GTK_BOX (main_hbox), spinbutton3, FALSE, FALSE, 6);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton3), TRUE);
g_signal_connect (spinbutton_adj, "value_changed",
G_CALLBACK (gimp_int_adjustment_update),
&vals.framecolor);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例13: dialog
//.........这里部分代码省略.........
gtk_combo_box_append_text(GTK_COMBO_BOX(interface_vals.mask_type_widget),"Selection");
if (num_vectors > 0)
gtk_combo_box_append_text(GTK_COMBO_BOX(interface_vals.mask_type_widget),"Selection With Stop Path");
gtk_combo_box_append_text(GTK_COMBO_BOX(interface_vals.mask_type_widget),"Binary Mask");
if (num_vectors > 0)
gtk_combo_box_append_text(GTK_COMBO_BOX(interface_vals.mask_type_widget),"Binary Mask With Stop Path");
gtk_combo_box_append_text(GTK_COMBO_BOX(interface_vals.mask_type_widget),"Mask Including Ordering");
if (interface_vals.mask_type == SELECTION) {
int mt_index = 0 + (vals->stop_path_id > 0);
gtk_combo_box_set_active(GTK_COMBO_BOX(interface_vals.mask_type_widget),mt_index);
} else if (interface_vals.mask_type == BINARY_MASK) {
int mt_index = 1 + (num_vectors > 0) + (vals->stop_path_id > 0);
gtk_combo_box_set_active(GTK_COMBO_BOX(interface_vals.mask_type_widget),mt_index);
} else {
int mt_index = 2 + 2*(num_vectors > 0);
gtk_combo_box_set_active(GTK_COMBO_BOX(interface_vals.mask_type_widget),mt_index);
}
g_signal_connect (interface_vals.mask_type_widget, "changed",
G_CALLBACK(maskTypeChangedCallback), vals);
maskTypeChangedCallback(GTK_COMBO_BOX(interface_vals.mask_type_widget),vals);
gtk_table_attach (GTK_TABLE (table), interface_vals.mask_type_widget, 1, 3, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (interface_vals.mask_type_widget);
// Create the parameter table
// table = gtk_table_new (5, 3, FALSE);
// gtk_table_set_col_spacings (GTK_TABLE (table), 6);
// gtk_table_set_row_spacings (GTK_TABLE (table), 6);
// gtk_container_set_border_width (GTK_CONTAINER (table), 12);
// gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
//
// gtk_widget_show (table);
interface_vals.threshold_scale = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,"_Mask Threshold:", SCALE_WIDTH, 0,vals->threshold, 0, 255, 0.1, 0.2, EPS_DIGITS,TRUE, 0, 0,NULL, NULL);
g_signal_connect (interface_vals.threshold_scale, "value_changed", G_CALLBACK(dialogThresholdChanged), vals);
GtkWidget *separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 5);
gtk_widget_show (separator);
table = gtk_table_new (5, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
//gtk_table_set_row_spacing (GTK_TABLE (table), 1, 12);
//gtk_table_set_row_spacing (GTK_TABLE (table), 3, 12);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
interface_vals.epsilon_scale = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,"_Pixel neighborhood (epsilon):", SCALE_WIDTH, 0,vals->epsilon, 1, SCALE_MAX, 0.5, 0.2, EPS_DIGITS,TRUE, 0, 0,NULL, NULL);
g_signal_connect (interface_vals.epsilon_scale, "value_changed", G_CALLBACK(gimp_float_adjustment_update), &vals->epsilon);
interface_vals.kappa_scale = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, "_Sharpness (kappa in %):", SCALE_WIDTH, 0, vals->kappa, 0, CONV_MAX, 1, 0.1, KAPPA_DIGITS,TRUE, 0, 0,NULL, NULL);
g_signal_connect (interface_vals.kappa_scale, "value_changed", G_CALLBACK(gimp_float_adjustment_update), &vals->kappa);
interface_vals.sigma_scale = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, "_Pre-smoothing (sigma):", SCALE_WIDTH, 0, vals->sigma, 0, SCALE_MAX, 0.1, 0.1, SMOOTH_DIGITS,TRUE, 0, 0,NULL, NULL);
g_signal_connect (interface_vals.sigma_scale, "value_changed", G_CALLBACK(gimp_float_adjustment_update), &vals->sigma);
interface_vals.rho_scale = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, "_Post-smoothing (rho):", SCALE_WIDTH, 0, vals->rho, 0.001, SCALE_MAX, 0.1, 0.1, SMOOTH_DIGITS,TRUE, 0, 0,NULL, NULL);
g_signal_connect (interface_vals.rho_scale, "value_changed", G_CALLBACK(gimp_float_adjustment_update), &vals->rho);
// // test extra button
// GtkWidget *togglebutton = gtk_check_button_new_with_label("Inpaint Animation");
// gtk_toggle_button_set_active( (GtkToggleButton *) togglebutton, ui_vals->anim_mode);
// gtk_widget_show(togglebutton);
//
// gimp_table_attach_aligned(GTK_TABLE (table),0,4,NULL,0,0,togglebutton,1,TRUE);
//
// g_signal_connect (togglebutton, "toggled", G_CALLBACK(gimp_toggle_button_update), &ui_vals->anim_mode);
GtkWidget *default_param_button = gtk_button_new_with_label("Default Parameters");
gtk_widget_show(default_param_button);
gtk_table_attach((GtkTable *)table,default_param_button,0,1,4,5,GTK_EXPAND,GTK_EXPAND,0,0);
g_signal_connect (default_param_button, "clicked", G_CALLBACK(set_default_param), NULL);
//test end
// Display dialog
gtk_widget_show(dlg);
renderPreview(vals);
GtkResponseType status = gimp_dialog_run (GIMP_DIALOG (dlg));
while (status == GTK_RESPONSE_APPLY) {
render (vals);
gimp_displays_flush ();
status = gimp_dialog_run (GIMP_DIALOG (dlg));
}
ui_vals->mask_type = interface_vals.mask_type;
destroy();
gtk_widget_destroy (dlg);
return (status == GTK_RESPONSE_OK);
}
示例14: waves_dialog
//.........这里部分代码省略.........
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
preview = gimp_zoom_preview_new (drawable);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
g_signal_connect_swapped (preview, "invalidated",
G_CALLBACK (waves_preview),
drawable);
frame = gimp_int_radio_group_new (TRUE, _("Mode"),
G_CALLBACK (gimp_radio_button_update),
&wvals.type, wvals.type,
_("_Smear"), MODE_SMEAR, &smear,
_("_Blacken"), MODE_BLACKEN, &blacken,
NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
g_signal_connect_swapped (smear, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
g_signal_connect_swapped (blacken, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic ( _("_Reflective"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.reflective);
gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&wvals.reflective);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("_Amplitude:"), 140, 6,
wvals.amplitude, 0.0, 101.0, 1.0, 5.0, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&wvals.amplitude);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("_Phase:"), 140, 6,
wvals.phase, 0.0, 360.0, 2.0, 5.0, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&wvals.phase);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
_("_Wavelength:"), 140, 6,
wvals.wavelength, 0.1, 50.0, 1.0, 5.0, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&wvals.wavelength);
g_signal_connect_swapped (adj, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}
示例15: colorify_dialog
static gboolean
colorify_dialog (GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
GtkWidget *label;
GtkWidget *button;
GtkWidget *table;
GtkWidget *color_area;
gint i;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, TRUE);
dialog = gimp_dialog_new (_("Colorify"), PLUG_IN_BINARY,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
preview = gimp_zoom_preview_new (drawable);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
g_signal_connect_swapped (preview, "invalidated",
G_CALLBACK (colorify),
drawable);
table = gtk_table_new (2, 7, TRUE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
label = gtk_label_new (_("Custom color:"));
gtk_table_attach (GTK_TABLE (table), label, 4, 6, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
custom_color_button = gimp_color_button_new (_("Colorify Custom Color"),
COLOR_SIZE, COLOR_SIZE,
&cvals.color,
GIMP_COLOR_AREA_FLAT);
g_signal_connect (custom_color_button, "color-changed",
G_CALLBACK (gimp_color_button_get_color),
&cvals.color);
g_signal_connect_swapped (custom_color_button, "color-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_table_attach (GTK_TABLE (table), custom_color_button, 6, 7, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (custom_color_button);
for (i = 0; i < 7; i++)
{
button = gtk_button_new ();
color_area = gimp_color_area_new (&button_color[i],
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON2_MASK);
gtk_widget_set_size_request (GTK_WIDGET (color_area),
COLOR_SIZE, COLOR_SIZE);
gtk_container_add (GTK_CONTAINER (button), color_area);
g_signal_connect (button, "clicked",
G_CALLBACK (predefined_color_callback),
&button_color[i]);
gtk_widget_show (color_area);
gtk_table_attach (GTK_TABLE (table), button, i, i + 1, 1, 2,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (button);
}
gtk_widget_show (dialog);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return run;
}