Esempio n. 1
0
void
colormap_edit_color_cmd_callback (GtkAction *action,
                                  gpointer   data)
{
  GimpColormapEditor *editor;
  GimpImage          *image;
  const guchar       *colormap;
  GimpRGB             color;
  gchar              *desc;
  return_if_no_image (image, data);

  editor = GIMP_COLORMAP_EDITOR (data);

  colormap = gimp_image_get_colormap (image);

  gimp_rgba_set_uchar (&color,
                       colormap[editor->col_index * 3],
                       colormap[editor->col_index * 3 + 1],
                       colormap[editor->col_index * 3 + 2],
                       OPAQUE_OPACITY);

  desc = g_strdup_printf (_("Edit colormap entry #%d"), editor->col_index);

  if (! editor->color_dialog)
    {
      editor->color_dialog =
        gimp_color_dialog_new (GIMP_VIEWABLE (image),
                               action_data_get_context (data),
                               _("Edit Colormap Entry"),
                               GIMP_STOCK_COLORMAP,
                               desc,
                               GTK_WIDGET (editor),
                               gimp_dialog_factory_from_name ("toplevel"),
                               "gimp-colormap-editor-color-dialog",
                               (const GimpRGB *) &color,
                               FALSE, FALSE);

      g_signal_connect (editor->color_dialog, "destroy",
                        G_CALLBACK (gtk_widget_destroyed),
                        &editor->color_dialog);

      g_signal_connect (editor->color_dialog, "update",
                        G_CALLBACK (colormap_edit_color_update),
                        editor);
    }
  else
    {
      gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (editor->color_dialog),
                                         GIMP_VIEWABLE (image),
                                         action_data_get_context (data));
      g_object_set (editor->color_dialog, "description", desc, NULL);
      gimp_color_dialog_set_color (GIMP_COLOR_DIALOG (editor->color_dialog),
                                   &color);
    }

  g_free (desc);

  gtk_window_present (GTK_WINDOW (editor->color_dialog));
}
Esempio n. 2
0
void
vectors_selection_to_vectors_cmd_callback (GtkAction *action,
                                           gint       value,
                                           gpointer   data)
{
  GimpImage      *image;
  GtkWidget      *widget;
  GimpProcedure  *procedure;
  GimpValueArray *args;
  GimpDisplay    *display;
  GError         *error = NULL;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  if (value)
    procedure = gimp_pdb_lookup_procedure (image->gimp->pdb,
                                           "plug-in-sel2path-advanced");
  else
    procedure = gimp_pdb_lookup_procedure (image->gimp->pdb,
                                           "plug-in-sel2path");

  if (! procedure)
    {
      gimp_message_literal (image->gimp,
                            G_OBJECT (widget), GIMP_MESSAGE_ERROR,
                            "Selection to path procedure lookup failed.");
      return;
    }

  display = gimp_context_get_display (action_data_get_context (data));

  args = gimp_procedure_get_arguments (procedure);
  gimp_value_array_truncate (args, 2);

  g_value_set_int      (gimp_value_array_index (args, 0),
                        GIMP_RUN_INTERACTIVE);
  gimp_value_set_image (gimp_value_array_index (args, 1),
                        image);

  gimp_procedure_execute_async (procedure, image->gimp,
                                action_data_get_context (data),
                                GIMP_PROGRESS (display), args,
                                GIMP_OBJECT (display), &error);

  gimp_value_array_unref (args);

  if (error)
    {
      gimp_message_literal (image->gimp,
                            G_OBJECT (widget), GIMP_MESSAGE_ERROR,
                            error->message);
      g_error_free (error);
    }
}
Esempio n. 3
0
GimpDisplay *
action_data_get_display (gpointer data)
{
  GimpDisplay     *result    = NULL;
  static gboolean  recursion = FALSE;

  if (! data || recursion)
    return NULL;

  recursion = TRUE;

  if (GIMP_IS_DISPLAY (data))
    result = data;
  else if (GIMP_IS_IMAGE_WINDOW (data))
    {
      GimpDisplayShell *shell = gimp_image_window_get_active_shell (data);
      result = shell ? shell->display : NULL;
    }

  if (! result)
    {
      GimpContext *context = action_data_get_context (data);

      if (context)
        result = gimp_context_get_display (context);
    }

  recursion = FALSE;

  return result;
}
Esempio n. 4
0
void
channels_new_cmd_callback (GtkAction *action,
                           gpointer   data)
{
  ChannelOptionsDialog *options;
  GimpImage            *image;
  GtkWidget            *widget;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  options = channel_options_dialog_new (image, NULL,
                                        action_data_get_context (data),
                                        widget,
                                        &channel_color,
                                        channel_name ? channel_name :
                                        _("Channel"),
                                        _("New Channel"),
                                        "gimp-channel-new",
                                        GIMP_STOCK_CHANNEL,
                                        _("New Channel Options"),
                                        GIMP_HELP_CHANNEL_NEW,
                                        _("New Channel Color"),
                                        _("_Fill opacity:"),
                                        TRUE);

  g_signal_connect (options->dialog, "response",
                    G_CALLBACK (channels_new_channel_response),
                    options);

  gtk_widget_show (options->dialog);
}
Esempio n. 5
0
void
dynamics_actions_update (GimpActionGroup *group,
                         gpointer         user_data)
{
  GimpContext  *context  = action_data_get_context (user_data);
  GimpDynamics *dynamics = NULL;
  GimpData     *data     = NULL;
  const gchar  *filename = NULL;

  if (context)
    {
      dynamics = gimp_context_get_dynamics (context);

      if (dynamics)
        {
          data = GIMP_DATA (dynamics);

          filename = gimp_data_get_filename (data);
        }
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("dynamics-edit",          dynamics);
  SET_SENSITIVE ("dynamics-duplicate",     dynamics && GIMP_DATA_GET_CLASS (data)->duplicate);
  SET_SENSITIVE ("dynamics-copy-location", dynamics && filename);
  SET_SENSITIVE ("dynamics-delete",        dynamics && gimp_data_is_deletable (data));

#undef SET_SENSITIVE
}
Esempio n. 6
0
void
vectors_new_cmd_callback (GtkAction *action,
                          gpointer   data)
{
  VectorsOptionsDialog *options;
  GimpImage            *image;
  GtkWidget            *widget;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  options = vectors_options_dialog_new (image, NULL,
                                        action_data_get_context (data),
                                        widget,
                                        vectors_name ? vectors_name :
                                        _("New Path"),
                                        _("New Path"),
                                        "gimp-vectors-new",
                                        GIMP_STOCK_PATH,
                                        _("New Path Options"),
                                        GIMP_HELP_PATH_NEW);

  g_signal_connect (options->dialog, "response",
                    G_CALLBACK (vectors_new_vectors_response),
                    options);

  gtk_widget_show (options->dialog);
}
Esempio n. 7
0
void
tool_presets_actions_update (GimpActionGroup *group,
                             gpointer         user_data)
{
  GimpContext    *context     = action_data_get_context (user_data);
  GimpToolPreset *tool_preset = NULL;
  GimpData       *data        = NULL;
  GFile          *file        = NULL;

  if (context)
    {
      tool_preset = gimp_context_get_tool_preset (context);

      if (tool_preset)
        {
          data = GIMP_DATA (tool_preset);

          file = gimp_data_get_file (data);
        }
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("tool-presets-edit",                 tool_preset);
  SET_SENSITIVE ("tool-presets-duplicate",            tool_preset && GIMP_DATA_GET_CLASS (data)->duplicate);
  SET_SENSITIVE ("tool-presets-copy-location",        file);
  SET_SENSITIVE ("tool-presets-show-in-file-manager", file);
  SET_SENSITIVE ("tool-presets-restore",              tool_preset);
  SET_SENSITIVE ("tool-presets-delete",               tool_preset && gimp_data_is_deletable (data));

#undef SET_SENSITIVE
}
Esempio n. 8
0
void
select_stroke_cmd_callback (GtkAction *action,
                            gpointer   data)
{
  GimpImage    *image;
  GimpDrawable *drawable;
  GtkWidget    *widget;
  GtkWidget    *dialog;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  drawable = gimp_image_get_active_drawable (image);

  if (! drawable)
    {
      gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
                    _("There is no active layer or channel to stroke to."));
      return;
    }

  dialog = stroke_dialog_new (GIMP_ITEM (gimp_image_get_mask (image)),
                              action_data_get_context (data),
                              _("Stroke Selection"),
                              GIMP_STOCK_SELECTION_STROKE,
                              GIMP_HELP_SELECTION_STROKE,
                              widget);
  gtk_widget_show (dialog);
}
Esempio n. 9
0
void
layers_edit_attributes_cmd_callback (GtkAction *action,
                                     gpointer   data)
{
  LayerOptionsDialog *dialog;
  GimpImage          *image;
  GimpLayer          *layer;
  GtkWidget          *widget;
  return_if_no_layer (image, layer, data);
  return_if_no_widget (widget, data);

  dialog = layer_options_dialog_new (gimp_item_get_image (GIMP_ITEM (layer)),
                                     layer,
                                     action_data_get_context (data),
                                     widget,
                                     gimp_object_get_name (layer),
                                     layer_fill_type,
                                     _("Layer Attributes"),
                                     "gimp-layer-edit",
                                     GTK_STOCK_EDIT,
                                     _("Edit Layer Attributes"),
                                     GIMP_HELP_LAYER_EDIT);

  g_signal_connect (dialog->dialog, "response",
                    G_CALLBACK (layers_edit_layer_response),
                    dialog);

  gtk_widget_show (dialog->dialog);
}
Esempio n. 10
0
void
edit_fill_cmd_callback (GtkAction *action,
                        gint       value,
                        gpointer   data)
{
    GimpImage       *image;
    GimpDrawable    *drawable;
    GimpFillType     fill_type;
    GimpFillOptions *options;
    GError          *error = NULL;
    return_if_no_drawable (image, drawable, data);

    fill_type = (GimpFillType) value;

    options = gimp_fill_options_new (action_data_get_gimp (data), NULL, FALSE);

    if (gimp_fill_options_set_by_fill_type (options,
                                            action_data_get_context (data),
                                            fill_type, &error))
    {
        gimp_edit_fill (image, drawable, options, NULL);
        gimp_image_flush (image);
    }
    else
    {
        gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_WARNING,
                              error->message);
        g_clear_error (&error);
    }

    g_object_unref (options);
}
Esempio n. 11
0
void
edit_fill_cmd_callback (GtkAction *action,
                        gint       value,
                        gpointer   data)
{
  GimpImage    *image;
  GimpDrawable *drawable;
  GimpFillType  fill_type;
  GError       *error = NULL;
  return_if_no_drawable (image, drawable, data);

  fill_type = (GimpFillType) value;

  if (gimp_edit_fill (image, drawable, action_data_get_context (data),
                      fill_type, GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
                      &error))
    {
      gimp_image_flush (image);
    }
  else
    {
      gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_WARNING,
                            error->message);
      g_clear_error (&error);
    }
}
Esempio n. 12
0
void
select_float_cmd_callback (GtkAction *action,
                           gpointer   data)
{
  GimpImage *image;
  GtkWidget *widget;
  GError    *error = NULL;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  if (gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
                            gimp_image_get_active_drawable (image),
                            action_data_get_context (data),
                            TRUE, 0, 0, &error))
    {
      gimp_image_flush (image);
    }
  else
    {
      gimp_message_literal (image->gimp,
                            G_OBJECT (widget), GIMP_MESSAGE_WARNING,
                            error->message);
      g_clear_error (&error);
    }
}
Esempio n. 13
0
void
image_configure_grid_cmd_callback (GtkAction *action,
                                   gpointer   data)
{
  GimpDisplay      *display;
  GimpDisplayShell *shell;
  GimpImage        *image;
  return_if_no_display (display, data);

  shell = GIMP_DISPLAY_SHELL (display->shell);
  image = display->image;

  if (! shell->grid_dialog)
    {
      shell->grid_dialog = grid_dialog_new (display->image,
                                            action_data_get_context (data),
                                            display->shell);

      gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
                                    GTK_WINDOW (display->shell));
      gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog),
                                          TRUE);

      g_object_add_weak_pointer (G_OBJECT (shell->grid_dialog),
                                 (gpointer) &shell->grid_dialog);
    }

  gtk_window_present (GTK_WINDOW (shell->grid_dialog));
}
Esempio n. 14
0
void
image_scale_cmd_callback (GtkAction *action,
                          gpointer   data)
{
  GimpDisplay *display;
  GtkWidget   *widget;
  GtkWidget   *dialog;
  return_if_no_display (display, data);
  return_if_no_widget (widget, data);

  if (image_scale_unit != GIMP_UNIT_PERCENT)
    image_scale_unit = GIMP_DISPLAY_SHELL (display->shell)->unit;

  if (image_scale_interp == -1)
    image_scale_interp = display->image->gimp->config->interpolation_type;

  dialog = image_scale_dialog_new (display->image,
                                   action_data_get_context (data),
                                   widget,
                                   image_scale_unit,
                                   image_scale_interp,
                                   image_scale_callback,
                                   display);

  g_signal_connect_object (display, "disconnect",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog, G_CONNECT_SWAPPED);

  gtk_widget_show (dialog);
}
Esempio n. 15
0
void
image_print_size_cmd_callback (GtkAction *action,
                               gpointer   data)
{
  GtkWidget   *dialog;
  GimpDisplay *display;
  GtkWidget   *widget;
  return_if_no_display (display, data);
  return_if_no_widget (widget, data);

  dialog = print_size_dialog_new (display->image,
                                  action_data_get_context (data),
                                  _("Set Image Print Resolution"),
                                  "gimp-image-print-size",
                                  widget,
                                  gimp_standard_help_func,
                                  GIMP_HELP_IMAGE_PRINT_SIZE,
                                  image_print_size_callback,
                                  NULL);

  g_signal_connect_object (display, "disconnect",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog, G_CONNECT_SWAPPED);

  gtk_widget_show (dialog);
}
Esempio n. 16
0
void
documents_actions_update (GimpActionGroup *group,
                          gpointer         data)
{
  GimpContext   *context;
  GimpImagefile *imagefile = NULL;

  context = action_data_get_context (data);

  if (context)
    imagefile = gimp_context_get_imagefile (context);

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("documents-open",                 imagefile);
  SET_SENSITIVE ("documents-raise-or-open",        imagefile);
  SET_SENSITIVE ("documents-file-open-dialog",     TRUE);
  SET_SENSITIVE ("documents-copy-location",        imagefile);
  SET_SENSITIVE ("documents-show-in-file-manager", imagefile);
  SET_SENSITIVE ("documents-remove",               imagefile);
  SET_SENSITIVE ("documents-clear",                TRUE);
  SET_SENSITIVE ("documents-recreate-preview",     imagefile);
  SET_SENSITIVE ("documents-reload-previews",      imagefile);
  SET_SENSITIVE ("documents-remove-dangling",      imagefile);

#undef SET_SENSITIVE
}
Esempio n. 17
0
void
layers_text_tool_cmd_callback (GtkAction *action,
                               gpointer   data)
{
  GimpImage *image;
  GimpLayer *layer;
  GtkWidget *widget;
  GimpTool  *active_tool;
  return_if_no_layer (image, layer, data);
  return_if_no_widget (widget, data);

  if (! gimp_item_is_text_layer (GIMP_ITEM (layer)))
    {
      layers_edit_attributes_cmd_callback (action, data);
      return;
    }

  active_tool = tool_manager_get_active (image->gimp);

  if (! GIMP_IS_TEXT_TOOL (active_tool))
    {
      GimpToolInfo *tool_info = gimp_get_tool_info (image->gimp,
                                                    "gimp-text-tool");

      if (GIMP_IS_TOOL_INFO (tool_info))
        {
          gimp_context_set_tool (action_data_get_context (data), tool_info);
          active_tool = tool_manager_get_active (image->gimp);
        }
    }

  if (GIMP_IS_TEXT_TOOL (active_tool))
    gimp_text_tool_set_layer (GIMP_TEXT_TOOL (active_tool), layer);
}
Esempio n. 18
0
void
edit_copy_visible_cmd_callback (GtkAction *action,
                                gpointer   data)
{
  GimpImage *image;
  GError    *error = NULL;
  return_if_no_image (image, data);

  if (gimp_edit_copy_visible (image, action_data_get_context (data), &error))
    {
      GimpDisplay *display = action_data_get_display (data);

      if (display)
        gimp_message_literal (image->gimp,
			      G_OBJECT (display), GIMP_MESSAGE_INFO,
			      _("Copied pixels to the clipboard"));

      gimp_image_flush (image);
    }
  else
    {
      gimp_message_literal (image->gimp,
			    G_OBJECT (action_data_get_display (data)),
			    GIMP_MESSAGE_WARNING,
			    error->message);
      g_clear_error (&error);
    }
}
Esempio n. 19
0
Gimp *
action_data_get_gimp (gpointer data)
{
  Gimp            *result    = NULL;
  static gboolean  recursion = FALSE;

  if (! data || recursion)
    return NULL;

  recursion = TRUE;

  if (GIMP_IS_GIMP (data))
    result = data;

  if (! result)
    {
      GimpDisplay *display = action_data_get_display (data);

      if (display)
        result = display->gimp;
    }

  if (! result)
    {
      GimpContext *context = action_data_get_context (data);

      if (context)
        result = context->gimp;
    }

  recursion = FALSE;

  return result;
}
Esempio n. 20
0
void
vectors_edit_cmd_callback (GtkAction *action,
                           gpointer   data)
{
  GimpImage   *image;
  GimpVectors *vectors;
  GimpTool    *active_tool;
  return_if_no_vectors (image, vectors, data);

  active_tool = tool_manager_get_active (image->gimp);

  if (! GIMP_IS_VECTOR_TOOL (active_tool))
    {
      GimpToolInfo  *tool_info = gimp_get_tool_info (image->gimp,
                                                     "gimp-vector-tool");

      if (GIMP_IS_TOOL_INFO (tool_info))
        {
          gimp_context_set_tool (action_data_get_context (data), tool_info);
          active_tool = tool_manager_get_active (image->gimp);
        }
    }

  if (GIMP_IS_VECTOR_TOOL (active_tool))
    gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors);
}
Esempio n. 21
0
void
vectors_edit_attributes_cmd_callback (GtkAction *action,
                                      gpointer   data)
{
  VectorsOptionsDialog *options;
  GimpImage            *image;
  GimpVectors          *vectors;
  GtkWidget            *widget;
  return_if_no_vectors (image, vectors, data);
  return_if_no_widget (widget, data);

  options = vectors_options_dialog_new (image, vectors,
                                        action_data_get_context (data),
                                        widget,
                                        gimp_object_get_name (GIMP_OBJECT (vectors)),
                                        _("Path Attributes"),
                                        "gimp-vectors-edit",
                                        GTK_STOCK_EDIT,
                                        _("Edit Path Attributes"),
                                        GIMP_HELP_PATH_EDIT);

  g_signal_connect (options->dialog, "response",
                    G_CALLBACK (vectors_edit_vectors_response),
                    options);

  gtk_widget_show (options->dialog);
}
Esempio n. 22
0
void
channels_edit_attributes_cmd_callback (GtkAction *action,
                                       gpointer   data)
{
  ChannelOptionsDialog *options;
  GimpImage            *image;
  GimpChannel          *channel;
  GtkWidget            *widget;
  return_if_no_channel (image, channel, data);
  return_if_no_widget (widget, data);

  options = channel_options_dialog_new (image, channel,
                                        action_data_get_context (data),
                                        widget,
                                        &channel->color,
                                        gimp_object_get_name (channel),
                                        _("Channel Attributes"),
                                        "gimp-channel-edit",
                                        GTK_STOCK_EDIT,
                                        _("Edit Channel Attributes"),
                                        GIMP_HELP_CHANNEL_EDIT,
                                        _("Edit Channel Color"),
                                        _("_Fill opacity:"),
                                        FALSE);

  g_signal_connect (options->dialog, "response",
                    G_CALLBACK (channels_edit_channel_response),
                    options);

  gtk_widget_show (options->dialog);
}
Esempio n. 23
0
void
fonts_refresh_cmd_callback (GtkAction *action,
                            gpointer   data)
{
  GimpContext *context = action_data_get_context (data);

  if (context)
    gimp_fonts_load (context->gimp);
}
Esempio n. 24
0
void
image_flatten_image_cmd_callback (GtkAction *action,
                                  gpointer   data)
{
  GimpImage *image;
  return_if_no_image (image, data);

  gimp_image_flatten (image, action_data_get_context (data));
  gimp_image_flush (image);
}
Esempio n. 25
0
void
file_open_recent_cmd_callback (GtkAction *action,
                               gint       value,
                               gpointer   data)
{
  Gimp          *gimp;
  GimpImagefile *imagefile;
  gint           num_entries;
  return_if_no_gimp (gimp, data);

  num_entries = gimp_container_get_n_children (gimp->documents);

  if (value >= num_entries)
    return;

  imagefile = (GimpImagefile *)
    gimp_container_get_child_by_index (gimp->documents, value);

  if (imagefile)
    {
      GimpDisplay       *display;
      GimpProgress      *progress;
      GimpImage         *image;
      GimpPDBStatusType  status;
      GError            *error = NULL;
      return_if_no_display (display, data);

      g_object_ref (display);
      g_object_ref (imagefile);

      progress = gimp_display_get_image (display) ?
                 NULL : GIMP_PROGRESS (display);

      image = file_open_with_display (gimp, action_data_get_context (data),
                                      progress,
                                      gimp_object_get_name (imagefile), FALSE,
                                      &status, &error);

      if (! image && status != GIMP_PDB_CANCEL)
        {
          gchar *filename =
            file_utils_uri_display_name (gimp_object_get_name (imagefile));

          gimp_message (gimp, G_OBJECT (display), GIMP_MESSAGE_ERROR,
                        _("Opening '%s' failed:\n\n%s"),
                        filename, error->message);
          g_clear_error (&error);

          g_free (filename);
        }

      g_object_unref (imagefile);
      g_object_unref (display);
    }
}
Esempio n. 26
0
void
edit_clear_cmd_callback (GtkAction *action,
                         gpointer   data)
{
  GimpImage    *image;
  GimpDrawable *drawable;
  return_if_no_drawable (image, drawable, data);

  gimp_edit_clear (image, drawable, action_data_get_context (data));
  gimp_image_flush (image);
}
Esempio n. 27
0
void
image_resize_cmd_callback (GtkAction *action,
                           gpointer   data)
{
  ImageResizeOptions *options;
  GimpImage          *image;
  GtkWidget          *widget;
  GimpDisplay        *display;
  GtkWidget          *dialog;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);
  return_if_no_display (display, data);

  options = g_slice_new (ImageResizeOptions);

  options->display = display;
  options->context = action_data_get_context (data);

  if (image_resize_unit != GIMP_UNIT_PERCENT)
    image_resize_unit = GIMP_DISPLAY_SHELL (display->shell)->unit;

  dialog = resize_dialog_new (GIMP_VIEWABLE (image),
                              action_data_get_context (data),
                              _("Set Image Canvas Size"), "gimp-image-resize",
                              widget,
                              gimp_standard_help_func, GIMP_HELP_IMAGE_RESIZE,
                              image_resize_unit,
                              image_resize_callback,
                              options);

  g_signal_connect_object (display, "disconnect",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog, G_CONNECT_SWAPPED);

  g_object_weak_ref (G_OBJECT (dialog),
                     (GWeakNotify) image_resize_options_free, options);

  gtk_widget_show (dialog);
}
Esempio n. 28
0
void
drawable_offset_cmd_callback (GtkAction *action,
                              gpointer   data)
{
  GimpImage    *image;
  GimpDrawable *drawable;
  GtkWidget    *widget;
  GtkWidget    *dialog;
  return_if_no_drawable (image, drawable, data);
  return_if_no_widget (widget, data);

  dialog = offset_dialog_new (drawable, action_data_get_context (data),
                              widget);
  gtk_widget_show (dialog);
}
Esempio n. 29
0
void
quick_mask_configure_cmd_callback (GtkAction *action,
                                   gpointer   data)
{
  GimpImage *image;
  GtkWidget *widget;
  GtkWidget *dialog;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

#define CONFIGURE_DIALOG_KEY "gimp-image-quick-mask-configure-dialog"

  dialog = dialogs_get_dialog (G_OBJECT (image), CONFIGURE_DIALOG_KEY);

  if (! dialog)
    {
      GimpRGB color;

      gimp_image_get_quick_mask_color (image, &color);

      dialog = channel_options_dialog_new (image, NULL,
                                           action_data_get_context (data),
                                           widget,
                                           _("Quick Mask Attributes"),
                                           "gimp-quick-mask-edit",
                                           GIMP_ICON_QUICK_MASK_ON,
                                           _("Edit Quick Mask Attributes"),
                                           GIMP_HELP_QUICK_MASK_EDIT,
                                           _("Edit Quick Mask Color"),
                                           _("_Mask opacity:"),
                                           FALSE,
                                           NULL,
                                           &color,
                                           FALSE,
                                           FALSE,
                                           GIMP_COLOR_TAG_NONE,
                                           FALSE,
                                           FALSE,
                                           quick_mask_configure_callback,
                                           NULL);

      item_options_dialog_set_switches_visible (dialog, FALSE);

      dialogs_attach_dialog (G_OBJECT (image), CONFIGURE_DIALOG_KEY, dialog);
    }

  gtk_window_present (GTK_WINDOW (dialog));
}
Esempio n. 30
0
void
layers_new_cmd_callback (GtkAction *action,
                         gpointer   data)
{
  LayerOptionsDialog *dialog;
  GimpImage          *image;
  GtkWidget          *widget;
  GimpLayer          *floating_sel;
  return_if_no_image (image, data);
  return_if_no_widget (widget, data);

  /*  If there is a floating selection, the new command transforms
   *  the current fs into a new layer
   */
  if ((floating_sel = gimp_image_get_floating_selection (image)))
    {
      GError *error = NULL;

      if (! floating_sel_to_layer (floating_sel, &error))
        {
          gimp_message_literal (image->gimp,
                                G_OBJECT (widget), GIMP_MESSAGE_WARNING,
                                error->message);
          g_clear_error (&error);
          return;
        }

      gimp_image_flush (image);
      return;
    }

  dialog = layer_options_dialog_new (image, NULL,
                                     action_data_get_context (data),
                                     widget,
                                     layer_name ? layer_name : _("Layer"),
                                     layer_fill_type,
                                     _("New Layer"),
                                     "gimp-layer-new",
                                     GIMP_STOCK_LAYER,
                                     _("Create a New Layer"),
                                     GIMP_HELP_LAYER_NEW);

  g_signal_connect (dialog->dialog, "response",
                    G_CALLBACK (layers_new_layer_response),
                    dialog);

  gtk_widget_show (dialog->dialog);
}