GimpPDBStatusType
script_fu_interface (SFScript  *script,
                     gint       start_arg)
{
  GtkWidget    *dialog;
  GtkWidget    *menu;
  GtkWidget    *vbox;
  GtkWidget    *vbox2;
  GtkSizeGroup *group;
  GSList       *list;
  gchar        *title;
  gint          i;

  static gboolean gtk_initted = FALSE;

  /* Simply return if there is already an interface. This is an
   * ugly workaround for the fact that we can not process two
   * scripts at a time.
   */
  if (sf_interface != NULL)
    {
      gchar *message =
        g_strdup_printf ("%s\n\n%s",
                         _("Script-Fu cannot process two scripts "
                           "at the same time."),
                         _("You are already running the \"%s\" script."));

      g_message (message, sf_interface->title);
      g_free (message);

      return GIMP_PDB_CANCEL;
    }

  g_return_val_if_fail (script != NULL, FALSE);

  if (!gtk_initted)
    {
      INIT_I18N();

      gimp_ui_init ("script-fu", TRUE);

      gtk_initted = TRUE;
    }

  sf_status = GIMP_PDB_SUCCESS;

  sf_interface = g_slice_new0 (SFInterface);

  sf_interface->widgets = g_new0 (GtkWidget *, script->n_args);
  sf_interface->title   = script_fu_script_get_title (script);

  title = g_strdup_printf (_("Script-Fu: %s"), sf_interface->title);

  sf_interface->dialog = dialog =
    gimp_dialog_new (title, "script-fu",
                     NULL, 0,
                     gimp_standard_help_func, script->name,

                     GIMP_STOCK_RESET, RESPONSE_RESET,
                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                     GTK_STOCK_OK,     GTK_RESPONSE_OK,

                     NULL);
  g_free (title);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                           RESPONSE_RESET,
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  gimp_window_set_transient (GTK_WINDOW (dialog));

  g_signal_connect (dialog, "response",
                    G_CALLBACK (script_fu_response),
                    script);

  g_signal_connect_swapped (dialog, "destroy",
                            G_CALLBACK (script_fu_interface_quit),
                            script);

  gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);

  vbox = gtk_vbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                      vbox, TRUE, TRUE, 0);
  gtk_widget_show (vbox);

  /*  The argument table  */
  sf_interface->table = gtk_table_new (script->n_args - start_arg, 3, FALSE);

  gtk_table_set_col_spacings (GTK_TABLE (sf_interface->table), 6);
  gtk_table_set_row_spacings (GTK_TABLE (sf_interface->table), 6);
  gtk_box_pack_start (GTK_BOX (vbox), sf_interface->table, FALSE, FALSE, 0);
  gtk_widget_show (sf_interface->table);

  group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

  for (i = start_arg; i < script->n_args; i++)
    {
      GtkWidget *widget       = NULL;
      GtkObject *adj;
      gchar     *label_text;
      gfloat     label_yalign = 0.5;
      gint      *ID_ptr       = NULL;
      gint       row          = i;
      gboolean   left_align   = FALSE;
      SFArg     *arg          = &script->args[i];

      row -= start_arg;

      /*  we add a colon after the label;
       *  some languages want an extra space here
       */
      label_text = g_strdup_printf (_("%s:"), gettext (arg->label));

      switch (arg->type)
        {
        case SF_IMAGE:
        case SF_DRAWABLE:
        case SF_LAYER:
        case SF_CHANNEL:
        case SF_VECTORS:
          switch (arg->type)
            {
            case SF_IMAGE:
              widget = gimp_image_combo_box_new (NULL, NULL);
              ID_ptr = &arg->value.sfa_image;
              break;

            case SF_DRAWABLE:
              widget = gimp_drawable_combo_box_new (NULL, NULL);
              ID_ptr = &arg->value.sfa_drawable;
              break;

            case SF_LAYER:
              widget = gimp_layer_combo_box_new (NULL, NULL);
              ID_ptr = &arg->value.sfa_layer;
              break;

            case SF_CHANNEL:
              widget = gimp_channel_combo_box_new (NULL, NULL);
              ID_ptr = &arg->value.sfa_channel;
              break;

            case SF_VECTORS:
              widget = gimp_vectors_combo_box_new (NULL, NULL);
              ID_ptr = &arg->value.sfa_vectors;
              break;

            default:
              menu = NULL;
              break;
            }

          gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (widget), *ID_ptr,
                                      G_CALLBACK (gimp_int_combo_box_get_active),
                                      ID_ptr);
          break;

        case SF_COLOR:
          left_align = TRUE;
          widget = gimp_color_button_new (_("Script-Fu Color Selection"),
                                          COLOR_SAMPLE_WIDTH,
                                          COLOR_SAMPLE_HEIGHT,
                                          &arg->value.sfa_color,
                                          GIMP_COLOR_AREA_FLAT);

          gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);

          g_signal_connect (widget, "color-changed",
                            G_CALLBACK (gimp_color_button_get_color),
                            &arg->value.sfa_color);
          break;

        case SF_TOGGLE:
          g_free (label_text);
          label_text = NULL;
          widget = gtk_check_button_new_with_mnemonic (gettext (arg->label));
          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
                                        arg->value.sfa_toggle);

          g_signal_connect (widget, "toggled",
                            G_CALLBACK (gimp_toggle_button_update),
                            &arg->value.sfa_toggle);
          break;

        case SF_VALUE:
        case SF_STRING:
          widget = gtk_entry_new ();
          gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
          gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);

          gtk_entry_set_text (GTK_ENTRY (widget), arg->value.sfa_value);
          break;

        case SF_TEXT:
          {
            GtkWidget     *view;
            GtkTextBuffer *buffer;

            widget = gtk_scrolled_window_new (NULL, NULL);
            gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
                                                 GTK_SHADOW_IN);
            gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
                                            GTK_POLICY_AUTOMATIC,
                                            GTK_POLICY_AUTOMATIC);
            gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);

            view = gtk_text_view_new ();
            gtk_container_add (GTK_CONTAINER (widget), view);
            gtk_widget_show (view);

            buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
            gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);

            gtk_text_buffer_set_text (buffer, arg->value.sfa_value, -1);

            label_yalign = 0.0;
          }
          break;

        case SF_ADJUSTMENT:
          switch (arg->default_value.sfa_adjustment.type)
            {
            case SF_SLIDER:
              arg->value.sfa_adjustment.adj = (GtkAdjustment *)
                gimp_scale_entry_new (GTK_TABLE (sf_interface->table),
                                      0, row,
                                      label_text, SLIDER_WIDTH, -1,
                                      arg->value.sfa_adjustment.value,
                                      arg->default_value.sfa_adjustment.lower,
                                      arg->default_value.sfa_adjustment.upper,
                                      arg->default_value.sfa_adjustment.step,
                                      arg->default_value.sfa_adjustment.page,
                                      arg->default_value.sfa_adjustment.digits,
                                      TRUE, 0.0, 0.0,
                                      NULL, NULL);
              gtk_entry_set_activates_default (GIMP_SCALE_ENTRY_SPINBUTTON (arg->value.sfa_adjustment.adj), TRUE);
              break;

            default:
              g_warning ("unexpected adjustment type: %d",
                         arg->default_value.sfa_adjustment.type);
              /* fallthrough */

            case SF_SPINNER:
              left_align = TRUE;
              widget =
                gimp_spin_button_new (&adj,
                                      arg->value.sfa_adjustment.value,
                                      arg->default_value.sfa_adjustment.lower,
                                      arg->default_value.sfa_adjustment.upper,
                                      arg->default_value.sfa_adjustment.step,
                                      arg->default_value.sfa_adjustment.page,
                                      0, 0,
                                      arg->default_value.sfa_adjustment.digits);
              gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
              arg->value.sfa_adjustment.adj = GTK_ADJUSTMENT (adj);
              break;
            }

          g_signal_connect (arg->value.sfa_adjustment.adj,
                            "value-changed",
                            G_CALLBACK (gimp_double_adjustment_update),
                            &arg->value.sfa_adjustment.value);
          break;

        case SF_FILENAME:
        case SF_DIRNAME:
          if (arg->type == SF_FILENAME)
            widget = gtk_file_chooser_button_new (_("Script-Fu File Selection"),
                                                  GTK_FILE_CHOOSER_ACTION_OPEN);
          else
            widget = gtk_file_chooser_button_new (_("Script-Fu Folder Selection"),
                                                  GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);

          if (arg->value.sfa_file.filename)
            gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
                                           arg->value.sfa_file.filename);

          g_signal_connect (widget, "selection-changed",
                            G_CALLBACK (script_fu_file_callback),
                            &arg->value.sfa_file);
          break;

        case SF_FONT:
          widget = gimp_font_select_button_new (_("Script-Fu Font Selection"),
                                                arg->value.sfa_font);
          g_signal_connect_swapped (widget, "font-set",
                                    G_CALLBACK (script_fu_font_callback),
                                    &arg->value.sfa_font);
          break;

        case SF_PALETTE:
          widget = gimp_palette_select_button_new (_("Script-Fu Palette Selection"),
                                                   arg->value.sfa_palette);
          g_signal_connect_swapped (widget, "palette-set",
                                    G_CALLBACK (script_fu_palette_callback),
                                    &arg->value.sfa_palette);
          break;

        case SF_PATTERN:
          left_align = TRUE;
          widget = gimp_pattern_select_button_new (_("Script-Fu Pattern Selection"),
                                                   arg->value.sfa_pattern);
          g_signal_connect_swapped (widget, "pattern-set",
                                    G_CALLBACK (script_fu_pattern_callback),
                                    &arg->value.sfa_pattern);
          break;

        case SF_GRADIENT:
          left_align = TRUE;
          widget = gimp_gradient_select_button_new (_("Script-Fu Gradient Selection"),
                                                    arg->value.sfa_gradient);
          g_signal_connect_swapped (widget, "gradient-set",
                                    G_CALLBACK (script_fu_gradient_callback),
                                    &arg->value.sfa_gradient);
          break;

        case SF_BRUSH:
          left_align = TRUE;
          widget = gimp_brush_select_button_new (_("Script-Fu Brush Selection"),
                                                 arg->value.sfa_brush.name,
                                                 arg->value.sfa_brush.opacity,
                                                 arg->value.sfa_brush.spacing,
                                                 arg->value.sfa_brush.paint_mode);
          g_signal_connect_swapped (widget, "brush-set",
                                    G_CALLBACK (script_fu_brush_callback),
                                    &arg->value.sfa_brush);
          break;

        case SF_OPTION:
#if GTK_CHECK_VERSION (2, 24, 0)
          widget = gtk_combo_box_text_new ();
#else
          widget = gtk_combo_box_new_text ();
#endif
          for (list = arg->default_value.sfa_option.list;
               list;
               list = g_slist_next (list))
            {
#if GTK_CHECK_VERSION (2, 24, 0)
              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget),
                                              gettext (list->data));
#else
              gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
                                         gettext (list->data));
#endif
            }

          gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
                                    arg->value.sfa_option.history);

          g_signal_connect (widget, "changed",
                            G_CALLBACK (script_fu_combo_callback),
                            &arg->value.sfa_option);
          break;

        case SF_ENUM:
          widget = gimp_enum_combo_box_new (g_type_from_name (arg->default_value.sfa_enum.type_name));

          gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
                                         arg->value.sfa_enum.history);

          g_signal_connect (widget, "changed",
                            G_CALLBACK (gimp_int_combo_box_get_active),
                            &arg->value.sfa_enum.history);
          break;

        case SF_DISPLAY:
          break;
        }

      if (widget)
        {
          if (label_text)
            {
              gimp_table_attach_aligned (GTK_TABLE (sf_interface->table),
                                         0, row,
                                         label_text, 0.0, label_yalign,
                                         widget, 2, left_align);
              g_free (label_text);
            }
          else
            {
              gtk_table_attach (GTK_TABLE (sf_interface->table),
                                widget, 0, 3, row, row + 1,
                                GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
              gtk_widget_show (widget);
            }

          if (left_align)
            gtk_size_group_add_widget (group, widget);
        }

      sf_interface->widgets[i] = widget;
    }

  g_object_unref (group);

  /* the script progress bar */
  vbox2 = gtk_vbox_new (FALSE, 6);
  gtk_box_pack_end (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
  gtk_widget_show (vbox2);

  sf_interface->progress_bar = gimp_progress_bar_new ();
  gtk_box_pack_start (GTK_BOX (vbox2), sf_interface->progress_bar,
                      FALSE, FALSE, 0);
  gtk_widget_show (sf_interface->progress_bar);

  sf_interface->progress_label = gtk_label_new (NULL);
  gtk_misc_set_alignment (GTK_MISC (sf_interface->progress_label), 0.0, 0.5);
  gtk_label_set_ellipsize (GTK_LABEL (sf_interface->progress_label),
                           PANGO_ELLIPSIZE_MIDDLE);
  gimp_label_set_attributes (GTK_LABEL (sf_interface->progress_label),
                             PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
                             -1);
  gtk_box_pack_start (GTK_BOX (vbox2), sf_interface->progress_label,
                      FALSE, FALSE, 0);
  gtk_widget_show (sf_interface->progress_label);

  gtk_widget_show (dialog);

  gtk_main ();

  return sf_status;
}
Ejemplo n.º 2
0
gboolean
dialog (gint32              image_ID,
	GimpDrawable       *drawable,
	PlugInVals         *vals,
	PlugInImageVals    *image_vals,
	PlugInDrawableVals *drawable_vals,
	PlugInUIVals       *ui_vals)
{
#if 1
    // quarl 2007-03-03
    //     No dialog for now.  Shouldn't be called.
    abort();
#else
  GtkWidget *dlg;
  GtkWidget *main_vbox;
  GtkWidget *frame;
  GtkWidget *table;
  GtkWidget *hbox;
  GtkWidget *hbox2;
  GtkWidget *coordinates;
  GtkWidget *combo;
  GtkObject *adj;
  gint       row;
  gboolean   run = FALSE;
  GimpUnit   unit;
  gdouble    xres, yres;

  ui_state = ui_vals;

  gimp_ui_init (PLUGIN_NAME, TRUE);

  dlg = gimp_dialog_new (_("Deskew"), PLUGIN_NAME,
                         NULL, 0,
			 gimp_standard_help_func, "gimp-deskew-plug-in",

			 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			 GTK_STOCK_OK,     GTK_RESPONSE_OK,

			 NULL);

  main_vbox = gtk_vbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), main_vbox);

  /*  gimp_scale_entry_new() examples  */

  frame = gimp_frame_new (_("ScaleEntry Examples"));
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  table = gtk_table_new (3, 3, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_container_add (GTK_CONTAINER (frame), table);
  gtk_widget_show (table);

  row = 0;

  adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
			      _("Dummy 1:"), SCALE_WIDTH, SPIN_BUTTON_WIDTH,
			      vals->dummy1, 0, 100, 1, 10, 0,
			      TRUE, 0, 0,
			      _("Dummy scale entry 1"), NULL);
  g_signal_connect (adj, "value_changed",
                    G_CALLBACK (gimp_int_adjustment_update),
                    &vals->dummy1);

  adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
			      _("Dummy 2:"), SCALE_WIDTH, SPIN_BUTTON_WIDTH,
			      vals->dummy2, 0, 200, 1, 10, 0,
			      TRUE, 0, 0,
			      _("Dummy scale entry 2"), NULL);
  g_signal_connect (adj, "value_changed",
                    G_CALLBACK (gimp_int_adjustment_update),
                    &vals->dummy2);

  adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
			      _("Dummy 3:"), SCALE_WIDTH, SPIN_BUTTON_WIDTH,
			      vals->dummy3, -100, 100, 1, 10, 0,
			      TRUE, 0, 0,
			      _("Dummy scale entry 3"), NULL);
  g_signal_connect (adj, "value_changed",
                    G_CALLBACK (gimp_int_adjustment_update),
                    &vals->dummy3);

  /*  gimp_random_seed_new() example  */

  frame = gimp_frame_new (_("A Random Seed Entry"));
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);
  hbox = gtk_hbox_new (FALSE, 6);
  gtk_container_add (GTK_CONTAINER (frame), hbox);
  gtk_widget_show (hbox);

  hbox2 = gimp_random_seed_new (&vals->seed, &vals->random_seed);
  gtk_widget_set_size_request (GTK_WIDGET (GIMP_RANDOM_SEED_SPINBUTTON (hbox2)),
                               RANDOM_SEED_WIDTH, -1);
  gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
  gtk_widget_show (hbox2);

  /*  gimp_coordinates_new() example  */

  frame = gimp_frame_new (_("A GimpCoordinates Widget\n"
			   "Initialized with the Drawable's Size"));
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  hbox = gtk_hbox_new (FALSE, 4);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
  gtk_container_add (GTK_CONTAINER (frame), hbox);
  gtk_widget_show (hbox);

  unit = gimp_image_get_unit (image_ID);
  gimp_image_get_resolution (image_ID, &xres, &yres);

  coordinates = gimp_coordinates_new (unit, "%p", TRUE, TRUE, SPIN_BUTTON_WIDTH,
				      GIMP_SIZE_ENTRY_UPDATE_SIZE,

				      ui_vals->chain_active, TRUE,

				      _("Width:"), drawable->width, xres,
				      1, GIMP_MAX_IMAGE_SIZE,
				      0, drawable->width,

				      _("Height:"), drawable->height, yres,
				      1, GIMP_MAX_IMAGE_SIZE,
				      0, drawable->height);
  gtk_box_pack_start (GTK_BOX (hbox), coordinates, FALSE, FALSE, 0);
  gtk_widget_show (coordinates);

  /*  Image and drawable menus  */

  frame = gimp_frame_new (_("Image and Drawable Menu Examples"));
  gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  table = gtk_table_new (3, 2, FALSE);
  gtk_container_set_border_width (GTK_CONTAINER (table), 4);
  gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_container_add (GTK_CONTAINER (frame), table);
  gtk_widget_show (table);

  row = 0;

  combo = gimp_layer_combo_box_new (NULL, NULL);
  gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), drawable->drawable_id,
                              G_CALLBACK (gimp_int_combo_box_get_active),
                              &drawable_vals->drawable_id);

  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
			     _("Layers:"), 0.0, 0.5, combo, 1, FALSE);

  combo = gimp_image_combo_box_new (dialog_image_constraint_func, NULL);
  gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), image_ID,
                              G_CALLBACK (gimp_int_combo_box_get_active),
                              &image_vals->image_id);

  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
			     _("RGB Images:"), 0.0, 0.5, combo, 1, FALSE);

  /*  Show the main containers  */

  gtk_widget_show (main_vbox);
  gtk_widget_show (dlg);

  run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);

  if (run)
    {
      /*  Save ui values  */
      ui_state->chain_active =
        gimp_chain_button_get_active (GIMP_COORDINATES_CHAINBUTTON (coordinates));
    }

  gtk_widget_destroy (dlg);

  return run;
#endif
}
Ejemplo n.º 3
0
/* --------------------------
 * p_dialog
 * --------------------------
 */
static gboolean
p_dialog (TransValues *val_ptr, gint32 drawable_id)
{
  GtkWidget *dialog;
  GtkWidget *main_vbox;
  GtkWidget *label;
  GtkWidget *table;
  GtkWidget *combo;
  GtkObject *adj;
  gint       row;
  gboolean   run;
  gboolean   isResynthesizerInstalled;

  gboolean foundResynth;
  gboolean foundResynthS;

  foundResynthS = gap_pdb_procedure_name_available(PLUG_IN_RESYNTHESIZER_WITH_SEED);
  foundResynth = gap_pdb_procedure_name_available(PLUG_IN_RESYNTHESIZER);
  isResynthesizerInstalled = ((foundResynthS) || (foundResynth));
  val_ptr->alt_selection = -1;

  gimp_ui_init (PLUG_IN_BINARY, TRUE);

  if (isResynthesizerInstalled)
  {
    dialog = gimp_dialog_new (_("Smart selection eraser"), 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);

  }
  else
  {
    dialog = gimp_dialog_new (_("Smart selection eraser"), PLUG_IN_BINARY,
                            NULL, 0,
                            gimp_standard_help_func, PLUG_IN_PROC,

                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,

                            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);


  /* Controls */
  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);

  row = 0;
  if (isResynthesizerInstalled != TRUE)
  {
    label = gtk_label_new (_("The Resynthesizer plug-in is required for this operation\n"
                             "But this 3rd party plug-in is not installed\n"
                             "Resynthesizer is available at the gimp plug-in registry"));
    gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
    gtk_table_attach (GTK_TABLE (table), label, 0, 2, row, row + 1,
                      GTK_FILL, GTK_FILL, 4, 0);
    gtk_widget_show (label);

    row++;
  }
  else
  {
    adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row,
                                _("Border Radius:"), SCALE_WIDTH, 7,
                                val_ptr->corpus_border_radius, 0.0, 1000.0, 1.0, 10.0, 0,
                                TRUE, 0, 0,
                                NULL, NULL);
    g_signal_connect (adj, "value-changed",
                      G_CALLBACK (gimp_int_adjustment_update),
                      &val_ptr->corpus_border_radius);

    row++;

    if (foundResynthS)
    {
      adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row,
                                _("Seed:"), SCALE_WIDTH, 7,
                                val_ptr->seed, -1.0, 10000.0, 1.0, 10.0, 0,
                                TRUE, 0, 0,
                                NULL, NULL);
      g_signal_connect (adj, "value-changed",
                      G_CALLBACK (gimp_int_adjustment_update),
                      &val_ptr->seed);

      row++;
    }

    /* layer combo_box (alt_selection) */
    label = gtk_label_new (_("Set Selection:"));
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
                      GTK_FILL, GTK_FILL, 4, 0);
    gtk_widget_show (label);

    /* layer combo_box (Sample from where to pick the alternative selection */
    combo = gimp_layer_combo_box_new (p_selectionConstraintFunc, NULL);

    gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), drawable_id,
                                G_CALLBACK (p_selectionComboCallback),
                                NULL);

    gtk_table_attach (GTK_TABLE (table), combo, 1, 3, row, row + 1,
                      GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
    gtk_widget_show (combo);
  }

  /* Done */

  gtk_widget_show (dialog);

  run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);

  gtk_widget_destroy (dialog);

  return run;
}  /* end p_dialog */