void gimp_display_flush_now (GimpDisplay *display) { g_return_if_fail (GIMP_IS_DISPLAY (display)); gimp_display_flush_whenever (display, TRUE); }
static void gimp_foreground_select_tool_drop_masks (GimpForegroundSelectTool *fg_select, GimpDisplay *display) { GimpTool *tool = GIMP_TOOL (fg_select); if (fg_select->trimap) { g_object_unref (fg_select->trimap); fg_select->trimap = NULL; } if (fg_select->mask) { g_object_unref (fg_select->mask); fg_select->mask = NULL; } if (GIMP_IS_DISPLAY (display)) { gimp_display_shell_set_mask (gimp_display_get_shell (display), NULL, NULL); } gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_FREE_SELECT); gimp_tool_control_set_toggle_tool_cursor (tool->control, GIMP_TOOL_CURSOR_FREE_SELECT); gimp_tool_control_set_toggled (tool->control, FALSE); fg_select->state = MATTING_STATE_FREE_SELECT; }
void gimp_color_tool_start_sample_point (GimpTool *tool, GimpDisplay *display) { GimpColorTool *color_tool; g_return_if_fail (GIMP_IS_COLOR_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); color_tool = GIMP_COLOR_TOOL (tool); gimp_display_shell_selection_pause (gimp_display_get_shell (display)); tool->display = display; gimp_tool_control_activate (tool->control); gimp_tool_control_set_scroll_lock (tool->control, TRUE); if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool))) gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool)); color_tool->sample_point = NULL; color_tool->moving_sample_point = TRUE; color_tool->sample_point_x = SAMPLE_POINT_POSITION_INVALID; color_tool->sample_point_y = SAMPLE_POINT_POSITION_INVALID; gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display); }
void gimp_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, GdkModifierType state, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (coords != NULL); g_return_if_fail (GIMP_IS_DISPLAY (display)); GIMP_TOOL_GET_CLASS (tool)->button_press (tool, coords, time, state, display); if (gimp_tool_control_is_active (tool->control)) { tool->button_press_state = state; tool->active_modifier_state = state; if (gimp_tool_control_get_wants_click (tool->control)) { tool->in_click_distance = TRUE; tool->got_motion_event = FALSE; tool->button_press_coords = *coords; tool->button_press_time = time; } else { tool->in_click_distance = FALSE; } } }
void gimp_color_tool_start_sample_point (GimpTool *tool, GimpDisplay *display) { GimpColorTool *color_tool; g_return_if_fail (GIMP_IS_COLOR_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); color_tool = GIMP_COLOR_TOOL (tool); gimp_display_shell_selection_control (GIMP_DISPLAY_SHELL (display->shell), GIMP_SELECTION_PAUSE); tool->display = display; gimp_tool_control_activate (tool->control); if (color_tool->sample_point) gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (display->shell), color_tool->sample_point, FALSE); color_tool->sample_point = NULL; color_tool->moving_sample_point = TRUE; color_tool->sample_point_x = -1; color_tool->sample_point_y = -1; gimp_tool_set_cursor (tool, display, GIMP_CURSOR_MOUSE, GIMP_TOOL_CURSOR_COLOR_PICKER, GIMP_CURSOR_MODIFIER_MOVE); gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display); }
void gimp_display_update_area (GimpDisplay *display, gboolean now, gint x, gint y, gint w, gint h) { g_return_if_fail (GIMP_IS_DISPLAY (display)); if (now) { gimp_display_paint_area (display, x, y, w, h); } else { GimpArea *area = gimp_area_new (CLAMP (x, 0, display->image->width), CLAMP (y, 0, display->image->height), CLAMP (x + w, 0, display->image->width), CLAMP (y + h, 0, display->image->height)); display->update_areas = gimp_area_list_process (display->update_areas, area); } }
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_set_focus_display (GimpTool *tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display)); #ifdef DEBUG_FOCUS g_printerr ("%s: tool: %p display: %p focus_display: %p\n", G_STRFUNC, tool, display, tool->focus_display); #endif if (display != tool->focus_display) { if (tool->focus_display) { if (tool->active_modifier_state != 0) gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display); if (tool->modifier_state != 0) gimp_tool_set_modifier_state (tool, 0, tool->focus_display); } tool->focus_display = display; } }
void gimp_tool_push_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_push_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_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); }
void gimp_tool_set_focus_display (GimpTool *tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display)); g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE); GIMP_LOG (TOOL_FOCUS, "tool: %p focus_display: %p tool->focus_display: %p", tool, display, tool->focus_display); if (display != tool->focus_display) { if (tool->focus_display) { if (tool->active_modifier_state != 0) { gimp_tool_control_activate (tool->control); gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display); gimp_tool_control_halt (tool->control); } if (tool->modifier_state != 0) gimp_tool_set_modifier_state (tool, 0, tool->focus_display); } tool->focus_display = display; } }
static GimpProgress * gimp_tool_progress_start (GimpProgress *progress, const gchar *message, gboolean cancelable) { GimpTool *tool = GIMP_TOOL (progress); GimpDisplayShell *shell; gint x, y, w, h; g_return_val_if_fail (GIMP_IS_DISPLAY (tool->display), NULL); g_return_val_if_fail (tool->progress == NULL, NULL); shell = gimp_display_get_shell (tool->display); gimp_display_shell_untransform_viewport (shell, &x, &y, &w, &h); tool->progress = gimp_canvas_progress_new (shell, GIMP_HANDLE_ANCHOR_CENTER, x + w / 2, y + h / 2); gimp_display_shell_add_item (shell, tool->progress); g_object_unref (tool->progress); gimp_progress_start (GIMP_PROGRESS (tool->progress), message, FALSE); gimp_widget_flush_expose (shell->canvas); tool->progress_display = tool->display; return progress; }
void gimp_tool_replace_status (GimpTool *tool, GimpDisplay *display, const gchar *format, ...) { GimpDisplayShell *shell; 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); va_start (args, format); gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar), G_OBJECT_TYPE_NAME (tool), 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); }
gboolean tool_manager_initialize_active (Gimp *gimp, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { GimpTool *tool = tool_manager->active_tool; if (gimp_tool_initialize (tool, display)) { GimpImage *image = gimp_display_get_image (display); tool->drawable = gimp_image_get_active_drawable (image); return TRUE; } } return FALSE; }
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; }
gboolean procedure_commands_run_procedure (GimpProcedure *procedure, Gimp *gimp, GimpProgress *progress, GimpRunMode run_mode, GimpValueArray *args, GimpDisplay *display) { GError *error = NULL; g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), FALSE); g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE); g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), FALSE); g_return_val_if_fail (args != NULL, FALSE); g_value_set_int (gimp_value_array_index (args, 0), run_mode); gimp_procedure_execute_async (procedure, gimp, gimp_get_user_context (gimp), progress, args, GIMP_OBJECT (display), &error); if (error) { gimp_message_literal (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, error->message); g_clear_error (&error); return FALSE; } return TRUE; }
gint gimp_display_get_ID (GimpDisplay *display) { g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1); return display->ID; }
void gimp_sample_point_tool_start_new (GimpTool *parent_tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (parent_tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); gimp_sample_point_tool_start (parent_tool, display, NULL); }
gboolean gimp_tool_has_display (GimpTool *tool, GimpDisplay *display) { g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE); g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE); return GIMP_TOOL_GET_CLASS (tool)->has_display (tool, display); }
void gimp_move_tool_start_vguide (GimpTool *tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_MOVE_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); gimp_move_tool_start_guide (GIMP_MOVE_TOOL (tool), display, GIMP_ORIENTATION_VERTICAL); }
gboolean gimp_tool_key_press (GimpTool *tool, GdkEventKey *kevent, GimpDisplay *display) { g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE); g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE); g_return_val_if_fail (display == tool->focus_display, FALSE); return GIMP_TOOL_GET_CLASS (tool)->key_press (tool, kevent, display); }
static GimpProgress * gui_new_progress (Gimp *gimp, GimpObject *display) { g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL); if (display) return GIMP_PROGRESS (display); return GIMP_PROGRESS (gimp_progress_dialog_new ()); }
void gimp_sample_point_tool_start_edit (GimpTool *parent_tool, GimpDisplay *display, GimpSamplePoint *sample_point) { g_return_if_fail (GIMP_IS_TOOL (parent_tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (GIMP_IS_SAMPLE_POINT (sample_point)); gimp_sample_point_tool_start (parent_tool, display, sample_point); }
void gimp_draw_tool_start (GimpDrawTool *draw_tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (gimp_draw_tool_is_active (draw_tool) == FALSE); draw_tool->display = display; gimp_draw_tool_draw (draw_tool); }
const gchar * gimp_tool_get_redo_desc (GimpTool *tool, GimpDisplay *display) { g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL); g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL); if (display == tool->display) return GIMP_TOOL_GET_CLASS (tool)->get_redo_desc (tool, display); return NULL; }
gboolean gimp_tool_redo (GimpTool *tool, GimpDisplay *display) { g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE); g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE); if (display == tool->display) return GIMP_TOOL_GET_CLASS (tool)->redo (tool, display); return FALSE; }
void gimp_tool_message_literal (GimpTool *tool, GimpDisplay *display, const gchar *message) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (message != NULL); gimp_message_literal (display->gimp, G_OBJECT (display), GIMP_MESSAGE_WARNING, message); }
void gimp_tool_cursor_update (GimpTool *tool, GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (coords != NULL); g_return_if_fail (GIMP_IS_DISPLAY (display)); GIMP_TOOL_GET_CLASS (tool)->cursor_update (tool, coords, state, display); }
void gimp_guide_tool_start_new (GimpTool *parent_tool, GimpDisplay *display, GimpOrientationType orientation) { g_return_if_fail (GIMP_IS_TOOL (parent_tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (orientation != GIMP_ORIENTATION_UNKNOWN); gimp_guide_tool_start (parent_tool, display, NULL, orientation); }
void gimp_guide_tool_start_edit (GimpTool *parent_tool, GimpDisplay *display, GimpGuide *guide) { g_return_if_fail (GIMP_IS_TOOL (parent_tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (GIMP_IS_GUIDE (guide)); gimp_guide_tool_start (parent_tool, display, guide, GIMP_ORIENTATION_UNKNOWN); }