示例#1
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);
}
示例#2
0
void
debug_dump_attached_data_cmd_callback (GtkAction *action,
                                       gpointer   data)
{
  Gimp        *gimp         = action_data_get_gimp (data);
  GimpContext *user_context = gimp_get_user_context (gimp);

  debug_print_qdata (GIMP_OBJECT (gimp));
  debug_print_qdata (GIMP_OBJECT (user_context));
}
示例#3
0
void
file_actions_update (GimpActionGroup *group,
                     gpointer         data)
{
    Gimp         *gimp           = action_data_get_gimp (data);
    GimpImage    *image          = action_data_get_image (data);
    GimpDrawable *drawable       = NULL;
    const gchar  *source         = NULL;
    const gchar  *export         = NULL;
    gboolean      show_overwrite = FALSE;

    if (image)
    {
        drawable = gimp_image_get_active_drawable (image);
        source   = gimp_image_get_imported_uri (image);
        export   = gimp_image_get_exported_uri (image);
    }
示例#4
0
void
dialogs_actions_update (GimpActionGroup *group,
                        gpointer         data)
{
  Gimp        *gimp            = action_data_get_gimp (data);
  const gchar *toolbox_label   = NULL;
  const gchar *toolbox_tooltip = NULL;

  if (dialogs_actions_toolbox_exists (gimp))
    {
      toolbox_label   = _("Toolbox");
      toolbox_tooltip = _("Raise the toolbox");
    }
  else
    {
      toolbox_label   = _("New Toolbox");
      toolbox_tooltip = _("Create a new toolbox");
    }

  gimp_action_group_set_action_label (group, "dialogs-toolbox", toolbox_label);
  gimp_action_group_set_action_tooltip (group, "dialogs-toolbox", toolbox_tooltip);
}
示例#5
0
文件: actions.c 项目: jiapei100/gimp
GimpContext *
action_data_get_context (gpointer data)
{
  GimpContext     *result    = NULL;
  static gboolean  recursion = FALSE;

  if (! data || recursion)
    return NULL;

  recursion = TRUE;

  if (GIMP_IS_DOCK (data))
    result = gimp_dock_get_context ((GimpDock *) data);
  else if (GIMP_IS_DOCK_WINDOW (data))
    result = gimp_dock_window_get_context (((GimpDockWindow *) data));
  else if (GIMP_IS_CONTAINER_VIEW (data))
    result = gimp_container_view_get_context ((GimpContainerView *) data);
  else if (GIMP_IS_CONTAINER_EDITOR (data))
    result = gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
  else if (GIMP_IS_IMAGE_EDITOR (data))
    result = ((GimpImageEditor *) data)->context;
  else if (GIMP_IS_NAVIGATION_EDITOR (data))
    result = ((GimpNavigationEditor *) data)->context;

  if (! result)
    {
      Gimp *gimp = action_data_get_gimp (data);

      if (gimp)
        result = gimp_get_user_context (gimp);
    }

  recursion = FALSE;

  return result;
}