void tool_manager_control_active (Gimp *gimp, GimpToolAction action, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { GimpTool *tool = tool_manager->active_tool; if (display && gimp_tool_has_display (tool, display)) { gimp_tool_control (tool, action, display); } else if (action == GIMP_TOOL_ACTION_HALT) { if (gimp_tool_control_is_active (tool->control)) gimp_tool_control_halt (tool->control); } } }
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); }
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; }
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); }
void tool_manager_exit (Gimp *gimp) { GimpToolManager *tool_manager; GimpContext *user_context; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); tool_manager_set (gimp, NULL); user_context = gimp_get_user_context (gimp); g_signal_handlers_disconnect_by_func (user_context, tool_manager_tool_changed, tool_manager); g_signal_handlers_disconnect_by_func (user_context, tool_manager_preset_changed, tool_manager); gimp_container_remove_handler (gimp->images, tool_manager->image_clean_handler_id); gimp_container_remove_handler (gimp->images, tool_manager->image_dirty_handler_id); if (tool_manager->active_tool) g_object_unref (tool_manager->active_tool); g_slice_free (GimpToolManager, tool_manager); }
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_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); } }
GimpTool * tool_manager_get_active (Gimp *gimp) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); tool_manager = tool_manager_get (gimp); return tool_manager->active_tool; }
void tool_manager_focus_display_active (Gimp *gimp, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { gimp_tool_set_focus_display (tool_manager->active_tool, display); } }
void tool_manager_active_modifier_state_active (Gimp *gimp, GdkModifierType state, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { gimp_tool_set_active_modifier_state (tool_manager->active_tool, state, display); } }
gboolean tool_manager_redo_active (Gimp *gimp, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { return gimp_tool_redo (tool_manager->active_tool, display); } return FALSE; }
const gchar * tool_manager_get_redo_desc_active (Gimp *gimp, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { return gimp_tool_get_redo_desc (tool_manager->active_tool, display); } return NULL; }
void tool_manager_cursor_update_active (Gimp *gimp, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { gimp_tool_cursor_update (tool_manager->active_tool, coords, state, display); } }
gboolean tool_manager_key_release_active (Gimp *gimp, GdkEventKey *kevent, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { return gimp_tool_key_release (tool_manager->active_tool, kevent, display); } return FALSE; }
void tool_manager_motion_active (Gimp *gimp, const GimpCoords *coords, guint32 time, GdkModifierType state, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { gimp_tool_motion (tool_manager->active_tool, coords, time, state, display); } }
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; tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack, tool); tool_manager_select_tool (gimp, tool); g_object_unref (tool); } }
void tool_manager_oper_update_active (Gimp *gimp, const GimpCoords *coords, GdkModifierType state, gboolean proximity, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool && ! gimp_tool_control_is_active (tool_manager->active_tool->control)) { gimp_tool_oper_update (tool_manager->active_tool, coords, state, proximity, display); } }
GimpUIManager * tool_manager_get_popup_active (Gimp *gimp, const GimpCoords *coords, GdkModifierType state, GimpDisplay *display, const gchar **ui_path) { GimpToolManager *tool_manager; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { return gimp_tool_get_popup (tool_manager->active_tool, coords, state, display, ui_path); } return NULL; }