static void gimp_view_renderer_imagefile_render (GimpViewRenderer *renderer, GtkWidget *widget) { GdkPixbuf *pixbuf = gimp_view_renderer_get_frame_pixbuf (renderer, widget, renderer->width, renderer->height); if (! pixbuf) { GimpImagefile *imagefile = GIMP_IMAGEFILE (renderer->viewable); pixbuf = gimp_view_renderer_imagefile_get_icon (imagefile, widget, MIN (renderer->width, renderer->height)); } if (pixbuf) { gimp_view_renderer_render_pixbuf (renderer, pixbuf); g_object_unref (pixbuf); } else { const gchar *stock_id = gimp_viewable_get_stock_id (renderer->viewable); gimp_view_renderer_render_stock (renderer, widget, stock_id); } }
void gimp_tool_replace_status (GimpTool *tool, GimpDisplay *display, const gchar *format, ...) { GimpDisplayShell *shell; const gchar *stock_id; va_list args; g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (format != NULL); shell = GIMP_DISPLAY_SHELL (display->shell); stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info)); va_start (args, format); gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar), G_OBJECT_TYPE_NAME (tool), stock_id, format, args); va_end (args); tool->status_displays = g_list_remove (tool->status_displays, display); tool->status_displays = g_list_prepend (tool->status_displays, display); }
void gimp_tool_push_status_length (GimpTool *tool, GimpDisplay *display, const gchar *title, GimpOrientationType axis, gdouble value, const gchar *help) { GimpDisplayShell *shell; const gchar *stock_id; g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); shell = GIMP_DISPLAY_SHELL (display->shell); stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info)); gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar), G_OBJECT_TYPE_NAME (tool), stock_id, title, axis, value, help); tool->status_displays = g_list_remove (tool->status_displays, display); tool->status_displays = g_list_prepend (tool->status_displays, display); }
void gimp_tool_push_status_coords (GimpTool *tool, GimpDisplay *display, GimpCursorPrecision precision, const gchar *title, gdouble x, const gchar *separator, gdouble y, const gchar *help) { GimpDisplayShell *shell; const gchar *stock_id; g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); shell = GIMP_DISPLAY_SHELL (display->shell); stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info)); gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar), G_OBJECT_TYPE_NAME (tool), stock_id, precision, title, x, separator, y, help); tool->status_displays = g_list_remove (tool->status_displays, display); tool->status_displays = g_list_prepend (tool->status_displays, display); }
static void tool_options_actions_update_presets (GimpActionGroup *group, const gchar *action_prefix, GCallback callback, const gchar *help_id, GimpContainer *presets) { GList *list; gint n_children = 0; gint i; for (i = 0; ; i++) { gchar *action_name; GtkAction *action; action_name = g_strdup_printf ("%s-%03d", action_prefix, i); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); g_free (action_name); if (! action) break; gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action); } if (presets) n_children = gimp_container_get_n_children (presets); if (n_children > 0) { GimpEnumActionEntry entry; entry.name = NULL; entry.label = NULL; entry.accelerator = ""; entry.tooltip = NULL; entry.value = 0; entry.value_variable = FALSE; entry.help_id = help_id; for (list = GIMP_LIST (presets)->list, i = 0; list; list = g_list_next (list), i++) { GimpObject *options = list->data; entry.name = g_strdup_printf ("%s-%03d", action_prefix, i); entry.label = gimp_object_get_name (options); entry.stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (options)); entry.value = i; gimp_action_group_add_enum_actions (group, NULL, &entry, 1, callback); g_free ((gchar *) entry.name); } } }
static void gimp_tool_preset_editor_set_data (GimpDataEditor *editor, GimpData *data) { GimpToolPresetEditor *preset_editor = GIMP_TOOL_PRESET_EDITOR (editor); if (editor->data) g_signal_handlers_disconnect_by_func (editor->data, gimp_tool_preset_editor_notify_data, editor); GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data); if (editor->data) { GimpToolInfo *tool_info; const gchar *stock_id; gchar *label; g_signal_handlers_block_by_func (preset_editor->tool_preset_model, gimp_tool_preset_editor_notify_model, editor); gimp_config_copy (GIMP_CONFIG (editor->data), GIMP_CONFIG (preset_editor->tool_preset_model), GIMP_CONFIG_PARAM_SERIALIZE); g_signal_handlers_unblock_by_func (preset_editor->tool_preset_model, gimp_tool_preset_editor_notify_model, editor); g_signal_connect (editor->data, "notify", G_CALLBACK (gimp_tool_preset_editor_notify_data), editor); tool_info = preset_editor->tool_preset_model->tool_options->tool_info; stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); label = g_strdup_printf (_("%s Preset"), tool_info->blurb); gtk_image_set_from_stock (GTK_IMAGE (preset_editor->tool_icon), stock_id, GTK_ICON_SIZE_MENU); gtk_label_set_text (GTK_LABEL (preset_editor->tool_label), label); g_free (label); } }
static void gimp_view_renderer_layer_render (GimpViewRenderer *renderer, GtkWidget *widget) { const gchar *stock_id = NULL; if (gimp_layer_is_floating_sel (GIMP_LAYER (renderer->viewable))) { stock_id = GIMP_STOCK_FLOATING_SELECTION; } else if (gimp_drawable_is_text_layer (GIMP_DRAWABLE (renderer->viewable))) { stock_id = gimp_viewable_get_stock_id (renderer->viewable); } if (stock_id) gimp_view_renderer_default_render_stock (renderer, widget, stock_id); else GIMP_VIEW_RENDERER_CLASS (parent_class)->render (renderer, widget); }
static gboolean gimp_image_map_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool); GimpToolInfo *tool_info = tool->tool_info; GimpDrawable *drawable; /* set display so the dialog can be hidden on display destruction */ tool->display = display; if (! image_map_tool->shell) { GimpImageMapToolClass *klass; GtkWidget *shell; GtkWidget *vbox; GtkWidget *toggle; const gchar *stock_id; klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool); stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); image_map_tool->shell = shell = gimp_tool_dialog_new (tool_info, display->shell, klass->shell_desc, GIMP_STOCK_RESET, RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (shell), RESPONSE_RESET, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); g_signal_connect_object (shell, "response", G_CALLBACK (gimp_image_map_tool_response), G_OBJECT (image_map_tool), 0); image_map_tool->main_vbox = vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox); if (klass->settings_name) gimp_image_map_tool_add_settings_gui (image_map_tool); /* The preview toggle */ toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options), "preview", _("_Preview")); gtk_box_pack_end (GTK_BOX (image_map_tool->main_vbox), toggle, FALSE, FALSE, 0); gtk_widget_show (toggle); g_signal_connect_object (tool_info->tool_options, "notify::preview", G_CALLBACK (gimp_image_map_tool_notify_preview), image_map_tool, 0); /* Fill in subclass widgets */ gimp_image_map_tool_dialog (image_map_tool); gtk_widget_show (vbox); if (image_map_tool->operation) g_signal_connect_object (tool_info->gimp->config, "notify::use-gegl", G_CALLBACK (gimp_image_map_tool_gegl_notify), image_map_tool, 0); } drawable = gimp_image_get_active_drawable (display->image); gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (image_map_tool->shell), GIMP_VIEWABLE (drawable), GIMP_CONTEXT (tool_info->tool_options)); gtk_widget_show (image_map_tool->shell); image_map_tool->drawable = drawable; gimp_image_map_tool_create_map (image_map_tool); return TRUE; }
void tools_actions_setup (GimpActionGroup *group) { GtkAction *action; GList *list; gimp_action_group_add_actions (group, "tools-action", tools_actions, G_N_ELEMENTS (tools_actions)); gimp_action_group_add_string_actions (group, "tools-action", tools_alternative_actions, G_N_ELEMENTS (tools_alternative_actions), G_CALLBACK (tools_select_cmd_callback)); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), "tools-by-color-select-short"); gtk_action_set_accel_path (action, "<Actions>/tools/tools-by-color-select"); gimp_action_group_add_enum_actions (group, NULL, tools_color_average_radius_actions, G_N_ELEMENTS (tools_color_average_radius_actions), G_CALLBACK (tools_color_average_radius_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_paint_brush_size_actions, G_N_ELEMENTS (tools_paint_brush_size_actions), G_CALLBACK (tools_paint_brush_size_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_paint_brush_angle_actions, G_N_ELEMENTS (tools_paint_brush_angle_actions), G_CALLBACK (tools_paint_brush_angle_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_paint_brush_aspect_ratio_actions, G_N_ELEMENTS (tools_paint_brush_aspect_ratio_actions), G_CALLBACK (tools_paint_brush_aspect_ratio_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_ink_blob_size_actions, G_N_ELEMENTS (tools_ink_blob_size_actions), G_CALLBACK (tools_ink_blob_size_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_ink_blob_aspect_actions, G_N_ELEMENTS (tools_ink_blob_aspect_actions), G_CALLBACK (tools_ink_blob_aspect_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_ink_blob_angle_actions, G_N_ELEMENTS (tools_ink_blob_angle_actions), G_CALLBACK (tools_ink_blob_angle_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_foreground_select_brush_size_actions, G_N_ELEMENTS (tools_foreground_select_brush_size_actions), G_CALLBACK (tools_fg_select_brush_size_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_transform_preview_opacity_actions, G_N_ELEMENTS (tools_transform_preview_opacity_actions), G_CALLBACK (tools_transform_preview_opacity_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_value_1_actions, G_N_ELEMENTS (tools_value_1_actions), G_CALLBACK (tools_value_1_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_value_2_actions, G_N_ELEMENTS (tools_value_2_actions), G_CALLBACK (tools_value_2_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_value_3_actions, G_N_ELEMENTS (tools_value_3_actions), G_CALLBACK (tools_value_3_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_value_4_actions, G_N_ELEMENTS (tools_value_4_actions), G_CALLBACK (tools_value_4_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_object_1_actions, G_N_ELEMENTS (tools_object_1_actions), G_CALLBACK (tools_object_1_cmd_callback)); gimp_action_group_add_enum_actions (group, NULL, tools_object_2_actions, G_N_ELEMENTS (tools_object_2_actions), G_CALLBACK (tools_object_2_cmd_callback)); for (list = gimp_get_tool_info_iter (group->gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = list->data; if (tool_info->menu_path) { GimpStringActionEntry entry; const gchar *stock_id; const gchar *identifier; gchar *tmp; gchar *name; stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); identifier = gimp_object_get_name (tool_info); tmp = g_strndup (identifier + strlen ("gimp-"), strlen (identifier) - strlen ("gimp--tool")); name = g_strdup_printf ("tools-%s", tmp); g_free (tmp); entry.name = name; entry.stock_id = stock_id; entry.label = tool_info->menu_path; entry.accelerator = tool_info->menu_accel; entry.tooltip = tool_info->help; entry.help_id = tool_info->help_id; entry.value = identifier; gimp_action_group_add_string_actions (group, NULL, &entry, 1, G_CALLBACK (tools_select_cmd_callback)); g_free (name); } } }