static void gimp_navigation_editor_set_shell (GimpNavigationEditor *editor, GimpDisplayShell *shell) { g_return_if_fail (GIMP_IS_NAVIGATION_EDITOR (editor)); g_return_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell)); if (shell == editor->shell) return; if (editor->shell) { g_signal_handlers_disconnect_by_func (editor->shell, gimp_navigation_editor_shell_scaled, editor); g_signal_handlers_disconnect_by_func (editor->shell, gimp_navigation_editor_shell_scrolled, editor); g_signal_handlers_disconnect_by_func (editor->shell, gimp_navigation_editor_shell_reconnect, editor); } else if (shell) { gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); } editor->shell = shell; if (editor->shell) { GimpImage *image = gimp_display_get_image (shell->display); gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (image)); g_signal_connect (editor->shell, "scaled", G_CALLBACK (gimp_navigation_editor_shell_scaled), editor); g_signal_connect (editor->shell, "scrolled", G_CALLBACK (gimp_navigation_editor_shell_scrolled), editor); g_signal_connect (editor->shell, "reconnect", G_CALLBACK (gimp_navigation_editor_shell_reconnect), editor); gimp_navigation_editor_shell_scaled (editor->shell, editor); } else { gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL); gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); } if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); }
static void gimp_image_editor_image_flush (GimpImage *image, gboolean invalidate_preview, GimpImageEditor *editor) { if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); }
static void gimp_navigation_editor_shell_scrolled (GimpDisplayShell *shell, GimpNavigationEditor *editor) { gimp_navigation_editor_update_marker (editor); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); }
static void gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell, GimpNavigationEditor *editor) { GimpImage *image = gimp_display_get_image (shell->display); gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (image)); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); }
static void palette_editor_entry_selected (GimpPaletteView *view, GimpPaletteEntry *entry, GimpPaletteEditor *editor) { GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor); if (editor->color != entry) { editor->color = entry; g_signal_handlers_block_by_func (editor->color_name, palette_editor_color_name_changed, editor); gtk_entry_set_text (GTK_ENTRY (editor->color_name), entry ? entry->name : _("Undefined")); g_signal_handlers_unblock_by_func (editor->color_name, palette_editor_color_name_changed, editor); gtk_editable_set_editable (GTK_EDITABLE (editor->color_name), entry && data_editor->data_editable); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); } }
void gimp_image_editor_set_image (GimpImageEditor *editor, GimpImage *image) { g_return_if_fail (GIMP_IS_IMAGE_EDITOR (editor)); g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image)); if (image != editor->image) { GIMP_IMAGE_EDITOR_GET_CLASS (editor)->set_image (editor, image); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); } }
static gboolean gimp_container_editor_select_item (GtkWidget *widget, GimpViewable *viewable, gpointer insert_data, GimpContainerEditor *editor) { GimpContainerEditorClass *klass = GIMP_CONTAINER_EDITOR_GET_CLASS (editor); if (klass->select_item) klass->select_item (editor, viewable); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), gimp_editor_get_popup_data (GIMP_EDITOR (editor->view))); return TRUE; }
void tool_options_reset_cmd_callback (GtkAction *action, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp); GimpToolInfo *tool_info = gimp_context_get_tool (context); gimp_config_reset (GIMP_CONFIG (tool_info->tool_options)); }
void gimp_data_editor_set_data (GimpDataEditor *editor, GimpData *data) { g_return_if_fail (GIMP_IS_DATA_EDITOR (editor)); g_return_if_fail (data == NULL || GIMP_IS_DATA (data)); g_return_if_fail (data == NULL || g_type_is_a (G_TYPE_FROM_INSTANCE (data), gimp_data_factory_get_data_type (editor->data_factory))); if (editor->data != data) { GIMP_DATA_EDITOR_GET_CLASS (editor)->set_data (editor, data); g_object_notify (G_OBJECT (editor), "data"); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); } }
static void palette_editor_entry_activated (GimpPaletteView *view, GimpPaletteEntry *entry, GimpPaletteEditor *editor) { if (GIMP_DATA_EDITOR (editor)->data_editable && entry == editor->color) { gimp_ui_manager_activate_action (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), "palette-editor", "palette-editor-edit-color"); } }
static void gimp_navigation_editor_shell_scaled (GimpDisplayShell *shell, GimpNavigationEditor *editor) { if (editor->zoom_label) { gchar *str; g_object_get (shell->zoom, "percentage", &str, NULL); gtk_label_set_text (GTK_LABEL (editor->zoom_label), str); g_free (str); } if (editor->zoom_adjustment) { gdouble val; val = log (gimp_zoom_model_get_factor (shell->zoom)) / G_LN2; g_signal_handlers_block_by_func (editor->zoom_adjustment, gimp_navigation_editor_zoom_adj_changed, editor); gtk_adjustment_set_value (editor->zoom_adjustment, val); g_signal_handlers_unblock_by_func (editor->zoom_adjustment, gimp_navigation_editor_zoom_adj_changed, editor); } gimp_navigation_editor_update_marker (editor); if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor))) gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)), gimp_editor_get_popup_data (GIMP_EDITOR (editor))); }
void tool_options_reset_all_cmd_callback (GtkAction *action, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); GtkWidget *dialog; dialog = gimp_message_dialog_new (_("Reset All Tool Options"), GIMP_STOCK_QUESTION, GTK_WIDGET (editor), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, gimp_standard_help_func, NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GIMP_STOCK_RESET, GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)), "unmap", G_CALLBACK (gtk_widget_destroy), dialog, G_CONNECT_SWAPPED); gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box, _("Do you really want to reset all " "tool options to default values?")); if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK) { Gimp *gimp = gimp_editor_get_ui_manager (editor)->gimp; GList *list; for (list = gimp_get_tool_info_iter (gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = list->data; gimp_config_reset (GIMP_CONFIG (tool_info->tool_options)); } } gtk_widget_destroy (dialog); }
void tool_options_save_new_preset_cmd_callback (GtkAction *action, gpointer user_data) { GimpEditor *editor = GIMP_EDITOR (user_data); Gimp *gimp = gimp_editor_get_ui_manager (editor)->gimp; GimpContext *context = gimp_get_user_context (gimp); GimpData *data; data = gimp_data_factory_data_new (context->gimp->tool_preset_factory, context, _("Untitled")); tool_options_show_preset_editor (gimp, editor, GIMP_TOOL_PRESET (data)); }
GtkWidget * gimp_font_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpFontView *font_view; GimpContainerEditor *editor; g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (view_size > 0 && view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL); g_return_val_if_fail (view_border_width >= 0 && view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH, NULL); g_return_val_if_fail (menu_factory == NULL || GIMP_IS_MENU_FACTORY (menu_factory), NULL); font_view = g_object_new (GIMP_TYPE_FONT_VIEW, "view-type", view_type, "container", container, "context", context, "view-size", view_size, "view-border-width", view_border_width, "menu-factory", menu_factory, "menu-identifier", "<Fonts>", "ui-path", "/fonts-popup", NULL); editor = GIMP_CONTAINER_EDITOR (font_view); gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (editor->view), FALSE); font_view->refresh_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "fonts", "fonts-refresh", NULL); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (font_view); }
void tool_options_edit_preset_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); Gimp *gimp = gimp_editor_get_ui_manager (editor)->gimp; GimpContext *context = gimp_get_user_context (gimp); GimpToolInfo *tool_info = gimp_context_get_tool (context); GimpToolPreset *preset; preset = (GimpToolPreset *) gimp_container_get_child_by_index (tool_info->presets, value); if (preset) { tool_options_show_preset_editor (gimp, editor, preset); } }
void tool_options_delete_preset_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp); GimpToolInfo *tool_info = gimp_context_get_tool (context); GimpToolPreset *preset; preset = (GimpToolPreset *) gimp_container_get_child_by_index (tool_info->presets, value); if (preset && gimp_data_is_deletable (GIMP_DATA (preset))) { GimpDataFactory *factory = context->gimp->tool_preset_factory; GtkWidget *dialog; dialog = data_delete_dialog_new (factory, GIMP_DATA (preset), NULL, GTK_WIDGET (editor)); gtk_widget_show (dialog); } }
GtkWidget * gimp_template_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpTemplateView *template_view; GimpContainerEditor *editor; template_view = g_object_new (GIMP_TYPE_TEMPLATE_VIEW, NULL); if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (template_view), view_type, container, context, view_size, view_border_width, menu_factory, "<Templates>", "/templates-popup")) { g_object_unref (template_view); return NULL; } editor = GIMP_CONTAINER_EDITOR (template_view); if (GIMP_IS_CONTAINER_TREE_VIEW (editor->view)) { GimpContainerTreeView *tree_view; tree_view = GIMP_CONTAINER_TREE_VIEW (editor->view); gimp_container_tree_view_connect_name_edited (tree_view, G_CALLBACK (gimp_template_view_tree_name_edited), template_view); } template_view->create_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "templates", "templates-create-image", NULL); template_view->new_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "templates", "templates-new", NULL); template_view->duplicate_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "templates", "templates-duplicate", NULL); template_view->edit_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "templates", "templates-edit", NULL); template_view->delete_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "templates", "templates-delete", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (template_view->create_button), GIMP_TYPE_TEMPLATE); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (template_view->duplicate_button), GIMP_TYPE_TEMPLATE); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (template_view->edit_button), GIMP_TYPE_TEMPLATE); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (template_view->delete_button), GIMP_TYPE_TEMPLATE); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (template_view); }
GtkWidget * gimp_buffer_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpBufferView *buffer_view; GimpContainerEditor *editor; GtkWidget *frame; GtkWidget *hbox; buffer_view = g_object_new (GIMP_TYPE_BUFFER_VIEW, NULL); if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view), view_type, container, context, view_size, view_border_width, menu_factory, "<Buffers>", "/buffers-popup")) { g_object_unref (buffer_view); return NULL; } editor = GIMP_CONTAINER_EDITOR (buffer_view); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (editor), frame, 0); gtk_widget_show (frame); hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); buffer_view->global_view = gimp_view_new_full_by_types (NULL, GIMP_TYPE_VIEW, GIMP_TYPE_BUFFER, view_size, view_size, view_border_width, FALSE, FALSE, TRUE); gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_view, FALSE, FALSE, 0); gtk_widget_show (buffer_view->global_view); g_signal_connect_object (editor->view, "notify::view-size", G_CALLBACK (gimp_buffer_view_view_notify), buffer_view, 0); g_signal_connect_object (editor->view, "notify::view-border-width", G_CALLBACK (gimp_buffer_view_view_notify), buffer_view, 0); buffer_view->global_label = gtk_label_new (_("(None)")); gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_label, FALSE, FALSE, 0); gtk_widget_show (buffer_view->global_label); g_signal_connect_object (context->gimp, "buffer-changed", G_CALLBACK (gimp_buffer_view_buffer_changed), G_OBJECT (buffer_view), 0); gimp_buffer_view_buffer_changed (context->gimp, buffer_view); buffer_view->paste_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste", NULL); buffer_view->paste_into_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste-into", NULL); buffer_view->paste_as_new_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste-as-new", NULL); buffer_view->delete_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-delete", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_into_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_as_new_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->delete_button), GIMP_TYPE_BUFFER); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (buffer_view); }
GtkWidget * gimp_image_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpImageView *image_view; GimpContainerEditor *editor; image_view = g_object_new (GIMP_TYPE_IMAGE_VIEW, NULL); if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (image_view), view_type, container, context, view_size, view_border_width, menu_factory, "<Images>", "/images-popup")) { g_object_unref (image_view); return NULL; } editor = GIMP_CONTAINER_EDITOR (image_view); image_view->raise_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "images", "images-raise-views", NULL); image_view->new_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "images", "images-new-view", NULL); image_view->delete_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "images", "images-delete", NULL); if (view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *dnd_widget; dnd_widget = gimp_container_view_get_dnd_widget (editor->view); gimp_dnd_xds_source_add (dnd_widget, (GimpDndDragViewableFunc) gimp_dnd_get_drag_data, NULL); } gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (image_view->raise_button), GIMP_TYPE_IMAGE); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (image_view->new_button), GIMP_TYPE_IMAGE); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (image_view->delete_button), GIMP_TYPE_IMAGE); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (image_view); }
GtkWidget * gimp_document_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpDocumentView *document_view; GimpContainerEditor *editor; g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (view_size > 0 && view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE); g_return_val_if_fail (view_border_width >= 0 && view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH, FALSE); g_return_val_if_fail (menu_factory == NULL || GIMP_IS_MENU_FACTORY (menu_factory), NULL); document_view = g_object_new (GIMP_TYPE_DOCUMENT_VIEW, "view-type", view_type, "container", container, "context", context, "view-size", view_size, "view-border-width", view_border_width, "menu-factory", menu_factory, "menu-identifier", "<Documents>", "ui-path", "/documents-popup", NULL); editor = GIMP_CONTAINER_EDITOR (document_view); document_view->open_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-open", "documents-raise-or-open", GDK_SHIFT_MASK, "documents-file-open-dialog", gimp_get_toggle_behavior_mask (), NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->open_button), GIMP_TYPE_IMAGEFILE); document_view->remove_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-remove", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->remove_button), GIMP_TYPE_IMAGEFILE); gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-clear", NULL); document_view->refresh_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-recreate-preview", "documents-reload-previews", GDK_SHIFT_MASK, "documents-remove-dangling", gimp_get_toggle_behavior_mask (), NULL); if (view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *dnd_widget; dnd_widget = gimp_container_view_get_dnd_widget (editor->view); gimp_dnd_uri_list_source_add (dnd_widget, gimp_document_view_drag_uri_list, editor); } gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (document_view); }