Exemplo n.º 1
0
/* A function to create the basic GtkTreeModel for the icon view */
static GtkTreeModel*
create_model (void)
{
  GtkListStore *model;
  GtkTreeIter   iter;
  guint32       i;
  gint32        image = multi_page.images[0];

  /* validate_image_list was called earlier, so all the images
   * up to multi_page.image_count are valid */
  model = gtk_list_store_new (4,
                              GDK_TYPE_PIXBUF, /* THUMB */
                              G_TYPE_STRING,   /* PAGE_NUMBER */
                              G_TYPE_STRING,   /* IMAGE_NAME */
                              G_TYPE_INT);     /* IMAGE_ID */

  for (i = 0 ; i < multi_page.image_count && i < MAX_PAGE_COUNT ; i++)
    {
      image = multi_page.images[i];

      gtk_list_store_append (model, &iter);
      gtk_list_store_set (model, &iter,
                          THUMB, gimp_image_get_thumbnail (image, THUMB_WIDTH, THUMB_HEIGHT, GIMP_PIXBUF_SMALL_CHECKS),
                          PAGE_NUMBER, g_strdup_printf ("Page %d", i+1),
                          IMAGE_NAME, gimp_image_get_name (image),
                          IMAGE_ID, image,
                          -1);

    }

  return GTK_TREE_MODEL (model);
}
Exemplo n.º 2
0
/* A function that is called when the button for adding an image
 * was clicked */
static void
add_image_call (GtkWidget *widget,
                gpointer   img_combo)
{
  GtkListStore *store;
  GtkTreeIter   iter;
  gint32        image;

  dnd_remove = FALSE;

  gimp_int_combo_box_get_active (img_combo, &image);

  store = GTK_LIST_STORE (model);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter,
                      PAGE_NUMBER, g_strdup_printf ("Page %d", multi_page.image_count+1),
                      THUMB, gimp_image_get_thumbnail (image, THUMB_WIDTH, THUMB_HEIGHT, GIMP_PIXBUF_SMALL_CHECKS),
                      IMAGE_NAME, gimp_image_get_name (image),
                      IMAGE_ID, image,
                      -1
                      );

  multi_page.image_count++;

  dnd_remove = TRUE;
}
Exemplo n.º 3
0
static void
print_operation_set_name (GtkPrintOperation *operation,
                          gint               image_ID)
{
  gchar *name = gimp_image_get_name (image_ID);

  gtk_print_operation_set_job_name (operation, name);

  g_free (name);
}
Exemplo n.º 4
0
static GtkWidget *
lcms_icc_profile_src_label_new (gint32       image,
                                cmsHPROFILE  profile)
{
  GtkWidget *vbox;
  GtkWidget *label;
  gchar     *name;
  gchar     *desc;
  gchar     *text;

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);

  name = gimp_image_get_name (image);
  text = g_strdup_printf (_("The image '%s' has an embedded color profile:"),
                          name);
  g_free (name);

  label = g_object_new (GTK_TYPE_LABEL,
                        "label",   text,
                        "wrap",    TRUE,
                        "justify", GTK_JUSTIFY_LEFT,
                        "xalign",  0.0,
                        "yalign",  0.0,
                        NULL);
  g_free (text);

  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  desc = lcms_icc_profile_get_desc (profile);
  label = g_object_new (GTK_TYPE_LABEL,
                        "label",   desc,
                        "wrap",    TRUE,
                        "justify", GTK_JUSTIFY_LEFT,
                        "xalign",  0.0,
                        "yalign",  0.0,
                        "xpad",    24,
                        NULL);
  g_free (desc);

  gimp_label_set_attributes (GTK_LABEL (label),
                             PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
                             -1);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  return vbox;
}
Exemplo n.º 5
0
static gchar *
compose_image_name (gint32 image_ID)
{
  gchar *image_name;
  gchar *name;

  /* Compose a name of the basename and the image-ID */

  name = gimp_image_get_name (image_ID);

  image_name = g_strdup_printf ("%s-%d", name, image_ID);

  g_free (name);

  return image_name;
}
Exemplo n.º 6
0
static gboolean
webx_dialog_save_dialog (WebxDialog       *dlg)
{
  GtkWidget  *save_dlg;
  gchar       default_name[1024];
  gint        source_image;
  gboolean    saved = FALSE;

  save_dlg = gtk_file_chooser_dialog_new (_("Save Image"),
                                          GTK_WINDOW (dlg),
                                          GTK_FILE_CHOOSER_ACTION_SAVE,

                                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                          GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,

                                          NULL);
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (save_dlg),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);
  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (save_dlg),
                                                  TRUE);

  source_image = webx_pipeline_get_rgb_target (WEBX_PIPELINE (dlg->pipeline), NULL);
  g_snprintf (default_name, sizeof (default_name),
              "%s.%s",
              gimp_image_get_name (source_image),
              webx_target_get_extension (WEBX_TARGET (dlg->target)));
  gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (save_dlg), default_name);

  if (gtk_dialog_run (GTK_DIALOG (save_dlg)) == GTK_RESPONSE_ACCEPT)
    {
      gchar *filename;

      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (save_dlg));
      saved = webx_pipeline_save_image (WEBX_PIPELINE (dlg->pipeline), filename);
      if (! saved)
        g_message (_("Failed to save the file!")); 
      g_free (filename);
    }

  gtk_widget_destroy (save_dlg);
  return saved;
}
Exemplo n.º 7
0
static void
draw_info_header (GtkPrintContext *context,
                  cairo_t         *cr,
                  PrintData       *data)
{
  PangoLayout          *layout;
  PangoFontDescription *desc;
  gdouble               text_height;
  gdouble               text_width;
  gdouble               fname_text_width;
  gint                  layout_height;
  gint                  layout_width;
  gchar                 date_buffer[100];
  GDate                *date;
  const gchar          *name_str;
  GimpParasite         *parasite;
  const gchar          *end_ptr;
  gchar                *filename;
  gdouble               cr_width;

  cairo_save (cr);

  cr_width  = gtk_print_context_get_width (context);
  cairo_rectangle (cr, 0, 0, cr_width, HEADER_HEIGHT);
  cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
  cairo_fill_preserve (cr);

  cairo_set_source_rgb (cr, 0, 0, 0);
  cairo_set_line_width (cr, 1);
  cairo_stroke (cr);

  layout = gtk_print_context_create_pango_layout (context);

  desc = pango_font_description_from_string ("sans 14");
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);

  pango_layout_set_width (layout, -1);
  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);

  /* image name */
  pango_layout_set_text (layout, gimp_image_get_name (data->image_id), -1);

  pango_layout_get_size (layout, &layout_width, &layout_height);
  text_height = (gdouble) layout_height / PANGO_SCALE;

  cairo_move_to (cr, 0.02 * cr_width,  (HEADER_HEIGHT - text_height) / 5);
  pango_cairo_show_layout (cr, layout);

  /* user name */
  name_str = g_get_real_name ();
  if (name_str && g_utf8_validate (name_str, -1, &end_ptr))
    {
      pango_layout_set_text (layout, name_str, -1);

      pango_layout_get_size (layout, &layout_width, &layout_height);
      text_height = (gdouble) layout_height / PANGO_SCALE;
      text_width = (gdouble) layout_width / PANGO_SCALE;

      cairo_move_to (cr, 0.5 * cr_width - 0.5 * text_width,
                     (HEADER_HEIGHT - text_height) / 5);
      pango_cairo_show_layout (cr, layout);
    }

  /* date */
  date = g_date_new ();
  g_date_set_time_t (date, time (NULL));
  g_date_strftime (date_buffer, 100, "%x", date);
  g_date_free (date);
  pango_layout_set_text (layout, date_buffer, -1);

  pango_layout_get_size (layout, &layout_width, &layout_height);
  text_height = (gdouble) layout_height / PANGO_SCALE;
  text_width = (gdouble) layout_width / PANGO_SCALE;

  cairo_move_to (cr,
                 0.98 * cr_width - text_width,
                 (HEADER_HEIGHT - text_height) / 5);
  pango_cairo_show_layout (cr, layout);

  /* file name if any */
  filename = gimp_image_get_filename (data->image_id);

  if (filename)
    {
      pango_layout_set_text (layout,
                             gimp_filename_to_utf8 (filename), -1);
      g_free (filename);

      pango_layout_get_size (layout, &layout_width, &layout_height);
      text_height = (gdouble) layout_height / PANGO_SCALE;
      fname_text_width = (gdouble) layout_width / PANGO_SCALE;

      cairo_move_to (cr,
                     0.02 * cr_width,  4 * (HEADER_HEIGHT - text_height) / 5);
      pango_cairo_show_layout (cr, layout);
    }
  else
    {
      fname_text_width = 0;
    }

  /* image comment if it is short */
  parasite = gimp_image_parasite_find (data->image_id, "gimp-comment");

  if (parasite)
    {
      pango_layout_set_text (layout, gimp_parasite_data (parasite), -1);

      pango_layout_get_size (layout, &layout_width, &layout_height);
      text_height = (gdouble) layout_height / PANGO_SCALE;
      text_width = (gdouble) layout_width / PANGO_SCALE;

      if (fname_text_width + text_width < 0.8 * cr_width &&
          text_height < 0.5 * HEADER_HEIGHT)
        {
          cairo_move_to (cr, 0.98 * cr_width - text_width,
                         4 * (HEADER_HEIGHT - text_height) / 5);
          pango_cairo_show_layout (cr, layout);
        }

      gimp_parasite_free (parasite);
    }

  g_object_unref (layout);

  cairo_restore (cr);
}
Exemplo n.º 8
0
static gboolean
jpeg_exif_rotate_query_dialog (gint32 image_ID)
{
  GtkWidget *dialog;
  GtkWidget *hbox;
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *toggle;
  GdkPixbuf *pixbuf;
  gint       response;

  dialog = gimp_dialog_new (_("Rotate Image?"), PLUG_IN_BINARY,
                            NULL, 0, NULL, NULL,

                            _("_Keep Orientation"), GTK_RESPONSE_CANCEL,
                            GIMP_STOCK_TOOL_ROTATE, GTK_RESPONSE_OK,

                            NULL);

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

  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
  gimp_window_set_transient (GTK_WINDOW (dialog));

  hbox = gtk_hbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                      hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  vbox = gtk_vbox_new (FALSE, 6);
  gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
  gtk_widget_show (vbox);

  pixbuf = gimp_image_get_thumbnail (image_ID,
                                     THUMBNAIL_SIZE, THUMBNAIL_SIZE,
                                     GIMP_PIXBUF_SMALL_CHECKS);

  if (pixbuf)
    {
      GtkWidget *image;
      gchar     *name;

      image = gtk_image_new_from_pixbuf (pixbuf);
      g_object_unref (pixbuf);

      gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
      gtk_widget_show (image);

      name = gimp_image_get_name (image_ID);

      label = gtk_label_new (name);
      gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
      gimp_label_set_attributes (GTK_LABEL (label),
                                 PANGO_ATTR_STYLE,  PANGO_STYLE_ITALIC,
                                 -1);
      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
      gtk_widget_show (label);

      g_free (name);
    }

  vbox = gtk_vbox_new (FALSE, 12);
  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
  gtk_widget_show (vbox);

  label = g_object_new (GTK_TYPE_LABEL,
                        "label",   _("According to the EXIF data, "
                                     "this image is rotated."),
                        "wrap",    TRUE,
                        "justify", GTK_JUSTIFY_LEFT,
                        "xalign",  0.0,
                        "yalign",  0.5,
                        NULL);
  gimp_label_set_attributes (GTK_LABEL (label),
                             PANGO_ATTR_SCALE,  PANGO_SCALE_LARGE,
                             PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
                             -1);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  label = g_object_new (GTK_TYPE_LABEL,
                        "label",   _("Would you like GIMP to rotate it "
                                     "into the standard orientation?"),
                        "wrap",    TRUE,
                        "justify", GTK_JUSTIFY_LEFT,
                        "xalign",  0.0,
                        "yalign",  0.5,
                        NULL);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  toggle = gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
  gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
  gtk_widget_show (toggle);

  response = gimp_dialog_run (GIMP_DIALOG (dialog));

  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)))
    {
      GimpParasite *parasite;
      const gchar  *str = (response == GTK_RESPONSE_OK) ? "yes" : "no";

      parasite = gimp_parasite_new (JPEG_EXIF_ROTATE_PARASITE,
                                    GIMP_PARASITE_PERSISTENT,
                                    strlen (str), str);
      gimp_parasite_attach (parasite);
      gimp_parasite_free (parasite);
    }

  gtk_widget_destroy (dialog);

  return (response == GTK_RESPONSE_OK);
}
gboolean dialog (
	PlugInVals         *vals,
	PlugInUIVals       *ui_vals)
{
  if (!gimp_drawable_is_valid(vals->image_drawable_id)) {
	  vals->image_drawable_id = default_vals.image_drawable_id;
  }
  if (!gimp_drawable_is_valid(vals->mask_drawable_id)) {
	  vals->mask_drawable_id = default_vals.mask_drawable_id;
  }
  if (!gimp_vectors_is_valid(vals->stop_path_id)) {
	  vals->stop_path_id = default_vals.stop_path_id;
  }
  vals->output_drawable_id = vals->image_drawable_id;

  print_vals(vals);
  set_defaults(ui_vals);
  interface_vals.imageID = gimp_drawable_get_image(vals->image_drawable_id);
  interface_vals.image_name = gimp_image_get_name(interface_vals.imageID);
  interface_vals.image_drawable = NULL;
  interface_vals.mask_drawable = NULL;
  if (vals->image_drawable_id >= 0) {
#ifdef DEBUG
	  g_warning("There is an input image drawable id");
#endif
	  interface_vals.image_drawable = gimp_drawable_get(vals->image_drawable_id);
  }
  if (vals->mask_drawable_id >= 0) {
	  interface_vals.mask_drawable = gimp_drawable_get(vals->mask_drawable_id);
  } else {
	  interface_vals.mask_drawable = NULL;
  }

  ui_state = ui_vals;

  //if there is a selection create mask drawable and fill

  gimp_drawable_mask_bounds(vals->image_drawable_id,&interface_vals.selectionX0,
		  	  	  	  	  	  	  	  	  	  	  	&interface_vals.selectionY0,
		  	  	  	  	  	  	  	  	  	  	  	&interface_vals.selectionX1,
		  	  	  	  	  	  	  	  		  	  	&interface_vals.selectionY1);
  interface_vals.selectionWidth = interface_vals.selectionX1-interface_vals.selectionX0;
  interface_vals.selectionHeight = interface_vals.selectionY1-interface_vals.selectionY0;

  gint image_width = gimp_drawable_width(vals->image_drawable_id);
  gint image_height = gimp_drawable_height(vals->image_drawable_id);

  interface_vals.selectionX0 -= PREVIEW_SIZE*0.1;
  if (interface_vals.selectionX0 < 0) interface_vals.selectionX0 = 0;
  interface_vals.selectionX1 += PREVIEW_SIZE*0.1;
  if (interface_vals.selectionX1 > image_width) interface_vals.selectionX1 = image_width;
  interface_vals.selectionY0 -= PREVIEW_SIZE*0.1;
  if (interface_vals.selectionY0 < 0) interface_vals.selectionY0 = 0;
  interface_vals.selectionY1 += PREVIEW_SIZE*0.1;
  if (interface_vals.selectionY1 > image_height) interface_vals.selectionY1 = image_height;

  interface_vals.selectionWidth = interface_vals.selectionX1-interface_vals.selectionX0;
  interface_vals.selectionHeight = interface_vals.selectionY1-interface_vals.selectionY0;

  //vals->mask_drawable_id = gimp_image_get_selection(gimp_drawable_get_image(vals->image_drawable_id));
  //g_warning("there is a selection with id = %d",vals->mask_drawable_id);
  //if (interface_vals.mask_drawable != NULL) gimp_drawable_detach(interface_vals.mask_drawable);
  //interface_vals.mask_drawable = gimp_drawable_get(vals->mask_drawable_id);


#ifdef DEBUG
  g_warning("image dims: x0,x1,y0,y1 = %d,%d,%d,%d",interface_vals.selectionX0,interface_vals.selectionX1,interface_vals.selectionY0,interface_vals.selectionY1);
#endif
  gchar text[100];
  sprintf(text,"Inpainting: %s",interface_vals.image_name);

  gimp_ui_init (PLUGIN_NAME, TRUE);

  GtkWidget* dlg = gimp_dialog_new (text, PLUGIN_NAME,
                         NULL, 0,
			 gimp_standard_help_func, "gimp-inpaint-BCT",

			 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			 GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
			 GTK_STOCK_OK,     GTK_RESPONSE_OK,


			 NULL);

  gimp_window_set_transient (GTK_WINDOW (dlg));

  GtkWidget* vbox = gtk_vbox_new (FALSE, 10);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
		  vbox, FALSE, FALSE, 0);
  gtk_widget_show (vbox);

  /* Preview */
  GtkWidget* hbox = gtk_hbox_new (TRUE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  GtkWidget* frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

//  interface_vals.preview = TRUE;
//  interface_vals.preview_widget = GIMP_DRAWABLE_PREVIEW (gimp_drawable_preview_new(interface_vals.image_drawable,&interface_vals.preview));
//  gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (interface_vals.preview_widget));
//  gtk_widget_show (GTK_WIDGET (interface_vals.preview_widget));

  interface_vals.previewWidth  = MIN (interface_vals.selectionWidth,  PREVIEW_SIZE);
  interface_vals.previewHeight = MIN (interface_vals.selectionHeight, PREVIEW_SIZE);
  interface_vals.preview_widget = gimp_preview_area_new ();
  gtk_widget_set_size_request (interface_vals.preview_widget,
		  interface_vals.previewWidth, interface_vals.previewHeight);
  gtk_container_add (GTK_CONTAINER (frame), interface_vals.preview_widget);
  gtk_widget_show (interface_vals.preview_widget);

  buildPreviewSourceImage (vals);


  /* Source and Mask selection */
  GtkWidget* 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);

  GtkWidget* label = gtk_label_new (_("Source:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
		  GTK_FILL, GTK_FILL, 0, 0);
  gtk_widget_show (label);

  GtkWidget* combo = gimp_drawable_combo_box_new (NULL, NULL);
#ifdef DEBUG
  g_warning("setting initi value of source combo box as %d",vals->image_drawable_id);
#endif
  gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), vals->image_drawable_id,
		  G_CALLBACK (dialogSourceChangedCallback),vals);

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

  label = gtk_label_new(_("Mask:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
		  GTK_FILL, GTK_FILL, 0, 0);
  gtk_widget_show (label);

  interface_vals.mask_combo_widget = gimp_drawable_combo_box_new (NULL, NULL);
  if (interface_vals.mask_type == SELECTION) {
	  gtk_widget_set_sensitive(interface_vals.mask_combo_widget,FALSE);
  }
  gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (interface_vals.mask_combo_widget),
		  vals->mask_drawable_id,
  	  	  G_CALLBACK (dialogMaskChangedCallback),vals);


  gtk_table_attach (GTK_TABLE (table), interface_vals.mask_combo_widget, 1, 3, 1, 2,
		  GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
  gtk_widget_show (interface_vals.mask_combo_widget);




  label = gtk_label_new (_("Stop Path:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
		  GTK_FILL, GTK_FILL, 0, 0);
  gtk_widget_show (label);

  interface_vals.stop_path_combo_widget = gimp_vectors_combo_box_new (NULL, NULL);
  gtk_widget_set_sensitive(interface_vals.stop_path_combo_widget,FALSE);
  gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (interface_vals.stop_path_combo_widget), vals->stop_path_id,
		  G_CALLBACK (dialogStopPathChangedCallback),vals);
  gtk_table_attach (GTK_TABLE (table), interface_vals.stop_path_combo_widget, 1, 3, 2, 3,
		  GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
  gtk_widget_show (interface_vals.stop_path_combo_widget);


  label = gtk_label_new(_("Mask Type:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
		  GTK_FILL, GTK_FILL, 0, 0);
  gtk_widget_show (label);

  interface_vals.mask_type_widget = gtk_combo_box_new_text();
  gint num_vectors;
  gimp_image_get_vectors(interface_vals.imageID,&num_vectors);

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