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))); } }
static void gimp_data_editor_constructed (GObject *object) { GimpDataEditor *editor = GIMP_DATA_EDITOR (object); G_OBJECT_CLASS (parent_class)->constructed (object); g_assert (GIMP_IS_DATA_FACTORY (editor->data_factory)); g_assert (GIMP_IS_CONTEXT (editor->context)); gimp_data_editor_set_edit_active (editor, TRUE); editor->save_button = gimp_editor_add_button (GIMP_EDITOR (editor), "document-save", _("Save"), NULL, G_CALLBACK (gimp_data_editor_save_clicked), NULL, editor); editor->revert_button = gimp_editor_add_button (GIMP_EDITOR (editor), "document-revert", _("Revert"), NULL, G_CALLBACK (gimp_data_editor_revert_clicked), NULL, editor); /* Hide because revert buttons are not yet implemented */ gtk_widget_hide (editor->revert_button); }
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_container_popup_create_view (GimpContainerPopup *popup) { GimpEditor *editor; GtkWidget *button; popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR, NULL); gimp_container_editor_construct (popup->editor, popup->view_type, popup->container, popup->context, popup->view_size, popup->view_border_width, NULL, NULL, NULL); gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view), FALSE); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view), 6 * (popup->default_view_size + 2 * popup->view_border_width), 10 * (popup->default_view_size + 2 * popup->view_border_width)); if (GIMP_IS_EDITOR (popup->editor->view)) gimp_editor_set_show_name (GIMP_EDITOR (popup->editor->view), FALSE); gtk_container_add (GTK_CONTAINER (popup->frame), GTK_WIDGET (popup->editor)); gtk_widget_show (GTK_WIDGET (popup->editor)); editor = GIMP_EDITOR (popup->editor->view); gimp_editor_add_button (editor, GTK_STOCK_ZOOM_OUT, _("Smaller Previews"), NULL, G_CALLBACK (gimp_container_popup_smaller_clicked), NULL, popup); gimp_editor_add_button (editor, GTK_STOCK_ZOOM_IN, _("Larger Previews"), NULL, G_CALLBACK (gimp_container_popup_larger_clicked), NULL, popup); button = gimp_editor_add_stock_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp", G_CALLBACK (gimp_container_popup_view_type_toggled), popup); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), popup->view_type); if (popup->dialog_factory) gimp_editor_add_button (editor, popup->dialog_stock_id, popup->dialog_tooltip, NULL, G_CALLBACK (gimp_container_popup_dialog_clicked), NULL, popup); gtk_widget_grab_focus (GTK_WIDGET (popup->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 gboolean gimp_editor_has_button_bar (GimpDocked *docked) { GimpEditor *editor = GIMP_EDITOR (docked); return editor->button_box != NULL; }
static void gimp_editor_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GimpEditor *editor = GIMP_EDITOR (object); switch (property_id) { case PROP_MENU_FACTORY: g_value_set_object (value, editor->menu_factory); break; case PROP_MENU_IDENTIFIER: g_value_set_string (value, editor->menu_identifier); break; case PROP_UI_PATH: g_value_set_string (value, editor->ui_path); break; case PROP_POPUP_DATA: g_value_set_pointer (value, editor->popup_data); break; case PROP_SHOW_NAME: g_object_get_property (G_OBJECT (editor->name_label), "visible", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void gimp_editor_dispose (GObject *object) { GimpEditor *editor = GIMP_EDITOR (object); if (editor->menu_factory) { g_object_unref (editor->menu_factory); editor->menu_factory = NULL; } if (editor->menu_identifier) { g_free (editor->menu_identifier); editor->menu_identifier = NULL; } if (editor->ui_manager) { g_object_unref (editor->ui_manager); editor->ui_manager = NULL; } if (editor->ui_path) { g_free (editor->ui_path); editor->ui_path = NULL; } G_OBJECT_CLASS (parent_class)->dispose (object); }
static void gimp_container_grid_view_init (GimpContainerGridView *grid_view) { GimpContainerBox *box = GIMP_CONTAINER_BOX (grid_view); GtkWidget *viewport; grid_view->rows = 1; grid_view->columns = 1; grid_view->visible_rows = 0; grid_view->selected_item = NULL; gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (box->scrolled_win), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (box->scrolled_win), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gimp_editor_set_show_name (GIMP_EDITOR (grid_view), TRUE); grid_view->wrap_box = gtk_hwrap_box_new (FALSE); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (box->scrolled_win), grid_view->wrap_box); viewport = gtk_widget_get_parent (grid_view->wrap_box); gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE); gtk_widget_show (grid_view->wrap_box); g_signal_connect (viewport, "size-allocate", G_CALLBACK (gimp_container_grid_view_viewport_resized), grid_view); g_signal_connect (viewport, "button-press-event", G_CALLBACK (gimp_container_grid_view_button_press), grid_view); gtk_widget_set_can_focus (GTK_WIDGET (grid_view), TRUE); }
static void palette_editor_entry_context (GimpPaletteView *view, GimpPaletteEntry *entry, GimpPaletteEditor *editor) { gimp_editor_popup_menu (GIMP_EDITOR (editor), NULL, NULL); }
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_editor_get_show_button_bar (GimpDocked *docked) { GimpEditor *editor = GIMP_EDITOR (docked); return editor->show_button_bar; }
static GObject * gimp_vectors_tree_view_constructor (GType type, guint n_params, GObjectConstructParam *params) { GObject *object; GimpEditor *editor; GimpContainerTreeView *tree_view; GimpVectorsTreeView *view; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); editor = GIMP_EDITOR (object); tree_view = GIMP_CONTAINER_TREE_VIEW (object); view = GIMP_VECTORS_TREE_VIEW (object); /* hide basically useless edit button */ gtk_widget_hide (GIMP_ITEM_TREE_VIEW (view)->edit_button); view->toselection_button = gimp_editor_add_action_button (editor, "vectors", "vectors-selection-replace", "vectors-selection-add", GDK_SHIFT_MASK, "vectors-selection-subtract", GDK_CONTROL_MASK, "vectors-selection-intersect", GDK_SHIFT_MASK | GDK_CONTROL_MASK, NULL); gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor), GTK_BUTTON (view->toselection_button), GIMP_TYPE_VECTORS); gtk_box_reorder_child (GTK_BOX (editor->button_box), view->toselection_button, 5); view->tovectors_button = gimp_editor_add_action_button (editor, "vectors", "vectors-selection-to-vectors", "vectors-selection-to-vectors-advanced", GDK_SHIFT_MASK, NULL); gtk_box_reorder_child (GTK_BOX (editor->button_box), view->tovectors_button, 6); view->stroke_button = gimp_editor_add_action_button (editor, "vectors", "vectors-stroke", "vectors-stroke-last-values", GDK_SHIFT_MASK, NULL); gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor), GTK_BUTTON (view->stroke_button), GIMP_TYPE_VECTORS); gtk_box_reorder_child (GTK_BOX (editor->button_box), view->stroke_button, 7); gimp_dnd_svg_dest_add (GTK_WIDGET (tree_view->view), NULL, view); return object; }
static void gradient_editor_right_color_update (GimpColorDialog *dialog, const GimpRGB *color, GimpColorDialogState state, GimpGradientEditor *editor) { GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); switch (state) { case GIMP_COLOR_DIALOG_UPDATE: gimp_gradient_segment_range_blend (gradient, editor->control_sel_l, editor->control_sel_r, &editor->control_sel_l->left_color, color, TRUE, TRUE); break; case GIMP_COLOR_DIALOG_OK: gimp_gradient_segment_range_blend (gradient, editor->control_sel_l, editor->control_sel_r, &editor->control_sel_l->left_color, color, TRUE, TRUE); gimp_gradient_segments_free (editor->right_saved_segments); gtk_widget_destroy (editor->color_dialog); editor->color_dialog = NULL; gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager, GIMP_EDITOR (editor)->popup_data); break; case GIMP_COLOR_DIALOG_CANCEL: gradient_editor_replace_selection (editor, editor->right_saved_segments); if (! editor->right_saved_dirty) gimp_data_clean (GIMP_DATA (gradient)); gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); gtk_widget_destroy (editor->color_dialog); editor->color_dialog = NULL; gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager, GIMP_EDITOR (editor)->popup_data); break; } }
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); }
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; }
static void gimp_vectors_tree_view_constructed (GObject *object) { GimpEditor *editor = GIMP_EDITOR (object); GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (object); GimpVectorsTreeView *view = GIMP_VECTORS_TREE_VIEW (object); GdkModifierType extend_mask; GdkModifierType modify_mask; G_OBJECT_CLASS (parent_class)->constructed (object); extend_mask = gtk_widget_get_modifier_mask (GTK_WIDGET (object), GDK_MODIFIER_INTENT_EXTEND_SELECTION); modify_mask = gtk_widget_get_modifier_mask (GTK_WIDGET (object), GDK_MODIFIER_INTENT_MODIFY_SELECTION); /* hide basically useless edit button */ gtk_widget_hide (gimp_item_tree_view_get_edit_button (GIMP_ITEM_TREE_VIEW (view))); view->toselection_button = gimp_editor_add_action_button (editor, "vectors", "vectors-selection-replace", "vectors-selection-add", extend_mask, "vectors-selection-subtract", modify_mask, "vectors-selection-intersect", extend_mask | modify_mask, NULL); gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor), GTK_BUTTON (view->toselection_button), GIMP_TYPE_VECTORS); gtk_box_reorder_child (gimp_editor_get_button_box (editor), view->toselection_button, 5); view->tovectors_button = gimp_editor_add_action_button (editor, "vectors", "vectors-selection-to-vectors", "vectors-selection-to-vectors-advanced", GDK_SHIFT_MASK, NULL); gtk_box_reorder_child (gimp_editor_get_button_box (editor), view->tovectors_button, 6); view->stroke_button = gimp_editor_add_action_button (editor, "vectors", "vectors-stroke", "vectors-stroke-last-values", GDK_SHIFT_MASK, NULL); gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor), GTK_BUTTON (view->stroke_button), GIMP_TYPE_VECTORS); gtk_box_reorder_child (gimp_editor_get_button_box (editor), view->stroke_button, 7); gimp_dnd_svg_dest_add (GTK_WIDGET (tree_view->view), NULL, view); }
static gboolean gimp_component_editor_button_press (GtkWidget *widget, GdkEventButton *bevent, GimpComponentEditor *editor) { GtkTreeViewColumn *column; GtkTreePath *path; editor->clicked_component = -1; if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), bevent->x, bevent->y, &path, &column, NULL, NULL)) { GtkTreeIter iter; GimpChannelType channel; gboolean active; active = gtk_tree_selection_path_is_selected (editor->selection, path); gtk_tree_model_get_iter (editor->model, &iter, path); gtk_tree_path_free (path); gtk_tree_model_get (editor->model, &iter, COLUMN_CHANNEL, &channel, -1); editor->clicked_component = channel; switch (bevent->button) { case 1: if (column != editor->eye_column && bevent->type == GDK_BUTTON_PRESS) { GimpImage *image = GIMP_IMAGE_EDITOR (editor)->image; gimp_image_set_component_active (image, channel, ! active); gimp_image_flush (image); } break; case 2: break; case 3: gimp_editor_popup_menu (GIMP_EDITOR (editor), NULL, NULL); break; default: break; } } return FALSE; }
static void gimp_error_console_constructed (GObject *object) { GimpErrorConsole *console = GIMP_ERROR_CONSOLE (object); G_OBJECT_CLASS (parent_class)->constructed (object); console->clear_button = gimp_editor_add_action_button (GIMP_EDITOR (console), "error-console", "error-console-clear", NULL); console->save_button = gimp_editor_add_action_button (GIMP_EDITOR (console), "error-console", "error-console-save-all", "error-console-save-selection", GDK_SHIFT_MASK, NULL); }
static gboolean gimp_container_grid_view_popup_menu (GtkWidget *widget) { GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (widget); return gimp_editor_popup_menu (GIMP_EDITOR (widget), gimp_container_grid_view_menu_position, grid_view); }
static void gimp_histogram_editor_name_update (GimpHistogramEditor *editor) { const gchar *name = NULL; if (editor->drawable) name = gimp_object_get_name (GIMP_OBJECT (editor->drawable)); gimp_editor_set_name (GIMP_EDITOR (editor), name); }
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)); }
static void gimp_container_editor_real_context_item (GimpContainerEditor *editor, GimpViewable *viewable) { GimpContainer *container = gimp_container_view_get_container (editor->view); if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable))) { gimp_editor_popup_menu (GIMP_EDITOR (editor->view), NULL, NULL); } }
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 GimpUIManager * gimp_editor_get_menu (GimpDocked *docked, const gchar **ui_path, gpointer *popup_data) { GimpEditor *editor = GIMP_EDITOR (docked); *ui_path = editor->ui_path; *popup_data = editor->popup_data; return editor->ui_manager; }
static gboolean gimp_error_console_button_press (GtkWidget *widget, GdkEventButton *bevent, GimpErrorConsole *console) { if (gimp_button_event_triggers_context_menu (bevent)) { return gimp_editor_popup_menu (GIMP_EDITOR (console), NULL, NULL); } return FALSE; }
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 gimp_palette_editor_constructed (GObject *object) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (object); G_OBJECT_CLASS (parent_class)->constructed (object); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-edit-color", NULL); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-new-color-fg", "palette-editor-new-color-bg", gimp_get_toggle_behavior_mask (), NULL); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-delete-color", NULL); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-zoom-out", NULL); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-zoom-in", NULL); gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor", "palette-editor-zoom-all", NULL); }