void tool_manager_pop_tool (Gimp *gimp) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->tool_stack) { GimpTool *tool = tool_manager->tool_stack->data; GimpDisplay *focus_display = NULL; if (tool_manager->active_tool) focus_display = tool_manager->active_tool->focus_display; tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack, tool); tool_manager_select_tool (gimp, tool); g_object_unref (tool); if (focus_display) tool_manager_focus_display_active (gimp, focus_display); } }
void tool_manager_push_tool (Gimp *gimp, GimpTool *tool) { GimpToolManager *tool_manager; GimpDisplay *focus_display = NULL; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_TOOL (tool)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { focus_display = tool_manager->active_tool->focus_display; tool_manager->tool_stack = g_slist_prepend (tool_manager->tool_stack, tool_manager->active_tool); g_object_ref (tool_manager->tool_stack->data); } tool_manager_select_tool (gimp, tool); if (focus_display) tool_manager_focus_display_active (gimp, focus_display); }
static void tool_manager_select_tool (Gimp *gimp, GimpTool *tool) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_TOOL (tool)); tool_manager = tool_manager_get (gimp); /* reset the previously selected tool, but only if it is not only * temporarily pushed to the tool stack */ if (tool_manager->active_tool && ! (tool_manager->tool_stack && tool_manager->active_tool == tool_manager->tool_stack->data)) { GimpTool *active_tool = tool_manager->active_tool; GimpDisplay *display; /* NULL image returns any display (if there is any) */ display = gimp_tool_has_image (active_tool, NULL); tool_manager_control_active (gimp, GIMP_TOOL_ACTION_HALT, display); tool_manager_focus_display_active (gimp, NULL); g_object_unref (tool_manager->active_tool); } tool_manager->active_tool = g_object_ref (tool); }
void tool_manager_select_tool (Gimp *gimp, GimpTool *tool) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_TOOL (tool)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { GimpTool *active_tool = tool_manager->active_tool; GimpDisplay *display; /* NULL image returns any display (if there is any) */ display = gimp_tool_has_image (active_tool, NULL); tool_manager_control_active (gimp, GIMP_TOOL_ACTION_HALT, display); tool_manager_focus_display_active (gimp, NULL); g_object_unref (tool_manager->active_tool); } tool_manager->active_tool = g_object_ref (tool); }
void gimp_display_delete (GimpDisplay *display) { GimpTool *active_tool; g_return_if_fail (GIMP_IS_DISPLAY (display)); /* remove the display from the list */ gimp_container_remove (display->image->gimp->displays, GIMP_OBJECT (display)); /* stop any active tool */ tool_manager_control_active (display->image->gimp, GIMP_TOOL_ACTION_HALT, display); active_tool = tool_manager_get_active (display->image->gimp); if (active_tool && active_tool->focus_display == display) tool_manager_focus_display_active (display->image->gimp, NULL); /* free the update area lists */ gimp_area_list_free (display->update_areas); display->update_areas = NULL; if (display->shell) { GtkWidget *shell = display->shell; /* set display->shell to NULL *before* destroying the shell. * all callbacks in gimpdisplayshell-callbacks.c will check * this pointer and do nothing if the shell is in destruction. */ display->shell = NULL; gtk_widget_destroy (shell); } /* unrefs the image */ gimp_display_disconnect (display); g_object_unref (display); }