void edit_paste_into_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; return_if_no_display (display, data); edit_paste (display, TRUE); }
void view_zoom_revert_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; return_if_no_display (display, data); gimp_display_shell_scale_revert (gimp_display_get_shell (display)); }
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); } }
void select_border_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpImage *image; GtkWidget *dialog; GtkWidget *button; gdouble xres; gdouble yres; return_if_no_display (display, data); image = gimp_display_get_image (display); gimp_image_get_resolution (image, &xres, &yres); dialog = gimp_query_size_box (_("Border Selection"), GTK_WIDGET (gimp_display_get_shell (display)), gimp_standard_help_func, GIMP_HELP_SELECTION_BORDER, _("Border selection by"), select_border_radius, 1, 32767, 0, gimp_display_get_shell (display)->unit, MIN (xres, yres), FALSE, G_OBJECT (image), "disconnect", select_border_callback, image); /* Feather button */ button = gtk_check_button_new_with_mnemonic (_("_Feather border")); gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "border-feather-toggle", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), select_border_feather); gtk_widget_show (button); /* Edge lock button */ button = gtk_check_button_new_with_mnemonic (_("_Selected areas continue outside the image")); g_object_set_data (G_OBJECT (dialog), "edge-lock-toggle", button); gimp_help_set_help_data (button, _("When bordering, act as if selected areas " "continued outside the image."), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), select_border_edge_lock); gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button, FALSE, FALSE, 0); gtk_widget_show (button); gtk_widget_show (dialog); }
void help_help_cmd_callback (GtkAction *action, gpointer data) { Gimp *gimp; GimpDisplay *display; return_if_no_gimp (gimp, data); return_if_no_display (display, data); gimp_help_show (gimp, GIMP_PROGRESS (display), NULL, NULL); }
void view_rotate_other_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; return_if_no_display (display, data); shell = gimp_display_get_shell (display); gimp_display_shell_rotate_dialog (shell); }
void select_border_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GtkWidget *dialog; GtkWidget *button; return_if_no_display (display, data); dialog = gimp_query_size_box (_("Border Selection"), display->shell, gimp_standard_help_func, GIMP_HELP_SELECTION_BORDER, _("Border selection by"), select_border_radius, 1, 32767, 0, GIMP_DISPLAY_SHELL (display->shell)->unit, MIN (display->image->xresolution, display->image->yresolution), FALSE, G_OBJECT (display->image), "disconnect", select_border_callback, display->image); /* Feather button */ button = gtk_check_button_new_with_mnemonic (_("_Feather border")); gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "border-feather-toggle", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), select_border_feather); gtk_widget_show (button); /* Edge lock button */ button = gtk_check_button_new_with_mnemonic (_("_Lock selection to image edges")); gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "edge-lock-toggle", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), select_border_edge_lock); gtk_widget_show (button); gtk_widget_show (dialog); }
void view_new_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; return_if_no_display (display, data); shell = gimp_display_get_shell (display); gimp_create_display (display->gimp, gimp_display_get_image (display), shell->unit, gimp_zoom_model_get_factor (shell->zoom)); }
void edit_redo_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; GimpDisplay *display; return_if_no_image (image, data); return_if_no_display (display, data); if (tool_manager_redo_active (image->gimp, display) || gimp_image_redo (image)) { gimp_image_flush (image); } }
void drawable_value_invert_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; GimpDrawable *drawable; GimpDisplay *display; return_if_no_drawable (image, drawable, data); return_if_no_display (display, data); gimp_drawable_apply_operation_by_name (drawable, GIMP_PROGRESS (display), _("Invert"), "gegl:value-invert", NULL); gimp_image_flush (image); }
void file_open_as_layers_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GtkWidget *widget; GimpImage *image; const gchar *uri; return_if_no_display (display, data); return_if_no_widget (widget, data); image = display->image; uri = gimp_object_get_name (GIMP_OBJECT (image)); file_open_dialog_show (widget, image, uri, TRUE); }
void view_new_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; return_if_no_display (display, data); shell = gimp_display_get_shell (display); gimp_create_display (display->gimp, gimp_display_get_image (display), shell->unit, gimp_zoom_model_get_factor (shell->zoom), G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))), gimp_widget_get_monitor (GTK_WIDGET (shell))); }
void view_close_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; GimpImage *image; return_if_no_display (display, data); shell = gimp_display_get_shell (display); image = gimp_display_get_image (display); /* Check for the image so we don't close the last display. */ if (image) gimp_display_shell_close (shell, FALSE); }
void view_zoom_selection_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpImage *image; gint x, y, width, height; return_if_no_display (display, data); return_if_no_image (image, data); gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)), &x, &y, &width, &height); gimp_display_shell_scale_to_rectangle (gimp_display_get_shell (display), GIMP_ZOOM_IN, x, y, width, height, FALSE); }
void view_flip_vertically_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; gboolean active; return_if_no_display (display, data); shell = gimp_display_get_shell (display); active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (active != shell->flip_vertically) { gimp_display_shell_flip (shell, shell->flip_horizontally, active); } }
void file_save_template_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GtkWidget *dialog; return_if_no_display (display, data); dialog = gimp_query_string_box (_("Create New Template"), display->shell, gimp_standard_help_func, GIMP_HELP_FILE_SAVE_AS_TEMPLATE, _("Enter a name for this template"), NULL, G_OBJECT (display->image), "disconnect", file_new_template_callback, display->image); gtk_widget_show (dialog); }
void image_rotate_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpDisplay *display; GimpProgress *progress; return_if_no_display (display, data); progress = gimp_progress_start (GIMP_PROGRESS (display), _("Rotating"), FALSE); gimp_image_rotate (display->image, action_data_get_context (data), (GimpRotationType) value, progress); if (progress) gimp_progress_end (progress); gimp_image_flush (display->image); }
void image_duplicate_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; GimpImage *new_image; return_if_no_display (display, data); shell = GIMP_DISPLAY_SHELL (display->shell); new_image = gimp_image_duplicate (display->image); gimp_create_display (new_image->gimp, new_image, shell->unit, gimp_zoom_model_get_factor (shell->zoom)); g_object_unref (new_image); }
void image_resize_to_selection_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpProgress *progress; return_if_no_display (display, data); progress = gimp_progress_start (GIMP_PROGRESS (display), _("Resizing"), FALSE); gimp_image_resize_to_selection (display->image, action_data_get_context (data), progress); if (progress) gimp_progress_end (progress); gimp_image_flush (display->image); }
void view_rotate_relative_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; gdouble delta = 0.0; return_if_no_display (display, data); shell = gimp_display_get_shell (display); delta = action_select_value ((GimpActionSelectType) value, 0.0, -180.0, 180.0, 0.0, 1.0, 15.0, 90.0, 0.0, TRUE); gimp_display_shell_rotate (shell, delta); }
void windows_show_display_previous_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; Gimp *gimp; gint index; return_if_no_display (display, data); return_if_no_gimp (gimp, data); index = gimp_container_get_child_index (gimp->displays, GIMP_OBJECT (display)); index--; if (index < 0) index = gimp_container_get_n_children (gimp->displays) - 1; display = GIMP_DISPLAY (gimp_container_get_child_by_index (gimp->displays, index)); gimp_display_shell_present (gimp_display_get_shell (display)); }
void view_fullscreen_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; GimpImageWindow *window; return_if_no_display (display, data); shell = gimp_display_get_shell (display); window = gimp_display_shell_get_window (shell); if (window) { gboolean active; active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); gimp_image_window_set_fullscreen (window, active); } }
void file_create_template_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpImage *image; GtkWidget *dialog; return_if_no_display (display, data); image = gimp_display_get_image (display); dialog = gimp_query_string_box (_("Create New Template"), GTK_WIDGET (gimp_display_get_shell (display)), gimp_standard_help_func, GIMP_HELP_FILE_CREATE_TEMPLATE, _("Enter a name for this template"), NULL, G_OBJECT (image), "disconnect", file_new_template_callback, image); gtk_widget_show (dialog); }
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); }
void select_grow_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GtkWidget *dialog; return_if_no_display (display, data); dialog = gimp_query_size_box (_("Grow Selection"), display->shell, gimp_standard_help_func, GIMP_HELP_SELECTION_GROW, _("Grow selection by"), select_grow_pixels, 1, 32767, 0, GIMP_DISPLAY_SHELL (display->shell)->unit, MIN (display->image->xresolution, display->image->yresolution), FALSE, G_OBJECT (display->image), "disconnect", select_grow_callback, display->image); gtk_widget_show (dialog); }
void view_rotate_absolute_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; gdouble angle = 0.0; return_if_no_display (display, data); shell = gimp_display_get_shell (display); angle = action_select_value ((GimpActionSelectType) value, 0.0, -180.0, 180.0, 0.0, 1.0, 15.0, 90.0, 0.0, TRUE); gimp_display_shell_rotate_to (shell, angle); if (value == GIMP_ACTION_SELECT_SET_TO_DEFAULT) gimp_display_shell_flip (shell, FALSE, FALSE); }
void drawable_levels_stretch_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; GimpDrawable *drawable; GimpDisplay *display; GtkWidget *widget; return_if_no_drawable (image, drawable, data); return_if_no_display (display, data); return_if_no_widget (widget, data); if (! gimp_drawable_is_rgb (drawable)) { gimp_message_literal (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, _("White Balance operates only on RGB color layers.")); return; } gimp_drawable_levels_stretch (drawable, GIMP_PROGRESS (display)); gimp_image_flush (image); }
void image_properties_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; GimpImage *image; GtkWidget *dialog; return_if_no_display (display, data); shell = GIMP_DISPLAY_SHELL (display->shell); image = display->image; dialog = image_properties_dialog_new (display->image, action_data_get_context (data), display->shell); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (display->shell)); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); gtk_window_present (GTK_WINDOW (dialog)); }
void plug_in_history_cmd_callback (GtkAction *action, GimpPlugInProcedure *procedure, gpointer data) { Gimp *gimp; GimpDisplay *display; GimpValueArray *args; gint n_args; return_if_no_gimp (gimp, data); return_if_no_display (display, data); args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure)); g_value_set_int (gimp_value_array_index (args, 0), GIMP_RUN_INTERACTIVE); n_args = plug_in_collect_display_args (action, display, GIMP_PROCEDURE (procedure)->args, args, 1); plug_in_procedure_execute (procedure, gimp, display, args, n_args); gimp_value_array_unref (args); }
void debug_dump_keyboard_shortcuts_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpImageWindow *window; GtkUIManager *manager; GtkAccelGroup *accel_group; GList *group_it; GList *strings = NULL; return_if_no_display (display, data); window = gimp_display_shell_get_window (gimp_display_get_shell (display)); manager = GTK_UI_MANAGER (gimp_image_window_get_ui_manager (window)); accel_group = gtk_ui_manager_get_accel_group (manager); /* Gather formated strings of keyboard shortcuts */ for (group_it = gtk_ui_manager_get_action_groups (manager); group_it; group_it = g_list_next (group_it)) { GimpActionGroup *group = group_it->data; GList *actions = NULL; GList *action_it = NULL; actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group)); actions = g_list_sort (actions, (GCompareFunc) gimp_action_name_compare); for (action_it = actions; action_it; action_it = g_list_next (action_it)) { GtkAction *action = action_it->data; const gchar *name = gtk_action_get_name (action); GClosure *accel_closure = NULL; if (strstr (name, "-menu") || strstr (name, "-popup") || name[0] == '<') continue; accel_closure = gtk_action_get_accel_closure (action); if (accel_closure) { GtkAccelKey *key = gtk_accel_group_find (accel_group, debug_accel_find_func, accel_closure); if (key && key->accel_key && key->accel_flags & GTK_ACCEL_VISIBLE) { const gchar *label_tmp; gchar *label; gchar *key_string; label_tmp = gtk_action_get_label (action); label = gimp_strip_uline (label_tmp); key_string = gtk_accelerator_get_label (key->accel_key, key->accel_mods); strings = g_list_prepend (strings, g_strdup_printf ("%-20s %s", key_string, label)); g_free (key_string); g_free (label); } } } g_list_free (actions); } /* Sort and prints the strings */ { GList *string_it = NULL; strings = g_list_sort (strings, (GCompareFunc) strcmp); for (string_it = strings; string_it; string_it = g_list_next (string_it)) { g_print ("%s\n", (gchar *) string_it->data); g_free (string_it->data); } g_list_free (strings); } }