static void gimp_selection_editor_init (GimpSelectionEditor *editor) { GtkWidget *frame; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0); gtk_widget_show (frame); editor->view = gimp_view_new_by_types (NULL, GIMP_TYPE_VIEW, GIMP_TYPE_SELECTION, GIMP_VIEW_SIZE_HUGE, 0, TRUE); gimp_view_renderer_set_background (GIMP_VIEW (editor->view)->renderer, GIMP_STOCK_TEXTURE); gtk_widget_set_size_request (editor->view, GIMP_VIEW_SIZE_HUGE, GIMP_VIEW_SIZE_HUGE); gimp_view_set_expand (GIMP_VIEW (editor->view), TRUE); gtk_container_add (GTK_CONTAINER (frame), editor->view); gtk_widget_show (editor->view); g_signal_connect (editor->view, "button-press-event", G_CALLBACK (gimp_selection_view_button_press), editor); gimp_dnd_color_dest_add (editor->view, gimp_selection_editor_drop_color, editor); gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); }
static void gimp_selection_editor_set_image (GimpImageEditor *image_editor, GimpImage *image) { GimpSelectionEditor *editor = GIMP_SELECTION_EDITOR (image_editor); if (image_editor->image) { g_signal_handlers_disconnect_by_func (image_editor->image, gimp_selection_editor_mask_changed, editor); } GIMP_IMAGE_EDITOR_CLASS (parent_class)->set_image (image_editor, image); if (image) { g_signal_connect (image, "mask-changed", G_CALLBACK (gimp_selection_editor_mask_changed), editor); gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (gimp_image_get_mask (image))); } else { gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL); } }
GtkWidget * gimp_view_new_full (GimpContext *context, GimpViewable *viewable, gint width, gint height, gint border_width, gboolean is_popup, gboolean clickable, gboolean show_popup) { GtkWidget *view; g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL); view = gimp_view_new_full_by_types (context, GIMP_TYPE_VIEW, G_TYPE_FROM_INSTANCE (viewable), width, height, border_width, is_popup, clickable, show_popup); if (view) gimp_view_set_viewable (GIMP_VIEW (view), viewable); gimp_view_renderer_remove_idle (GIMP_VIEW (view)->renderer); return view; }
static GimpPaletteEntry * gimp_palette_view_find_entry (GimpPaletteView *view, gint x, gint y) { GimpPalette *palette; GimpViewRendererPalette *renderer; GimpPaletteEntry *entry = NULL; gint col, row; palette = GIMP_PALETTE (GIMP_VIEW (view)->renderer->viewable); renderer = GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (view)->renderer); if (! palette) return NULL; col = x / renderer->cell_width; row = y / renderer->cell_height; if (col >= 0 && col < renderer->columns && row >= 0 && row < renderer->rows) { entry = gimp_palette_get_entry (palette, row * renderer->columns + col); } return entry; }
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_color_selector_palette_set_config (GimpColorSelector *selector, GimpColorConfig *config) { GimpColorSelectorPalette *select = GIMP_COLOR_SELECTOR_PALETTE (selector); if (select->context) { g_signal_handlers_disconnect_by_func (select->context, gimp_color_selector_palette_palette_changed, select); select->context = NULL; } if (config) select->context = g_object_get_data (G_OBJECT (config), "gimp-context"); if (select->context) { if (! select->view) { GtkWidget *frame; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (select), frame); gtk_widget_show (frame); select->view = gimp_view_new_full_by_types (select->context, GIMP_TYPE_PALETTE_VIEW, GIMP_TYPE_PALETTE, 100, 100, 0, FALSE, TRUE, FALSE); gimp_view_set_expand (GIMP_VIEW (select->view), TRUE); gimp_view_renderer_palette_set_cell_size (GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (select->view)->renderer), -1); gimp_view_renderer_palette_set_draw_grid (GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (select->view)->renderer), TRUE); gtk_container_add (GTK_CONTAINER (frame), select->view); gtk_widget_show (select->view); g_signal_connect (select->view, "entry-clicked", G_CALLBACK (gimp_color_selector_palette_entry_clicked), select); } g_signal_connect_object (select->context, "palette-changed", G_CALLBACK (gimp_color_selector_palette_palette_changed), select, 0); gimp_color_selector_palette_palette_changed (select->context, gimp_context_get_palette (select->context), select); } }
static GimpViewable * gimp_view_drag_viewable (GtkWidget *widget, GimpContext **context, gpointer data) { if (context) *context = GIMP_VIEW (widget)->renderer->context; return GIMP_VIEW (widget)->viewable; }
static void gimp_container_grid_view_item_activated (GtkWidget *widget, gpointer data) { gimp_container_view_item_activated (GIMP_CONTAINER_VIEW (data), GIMP_VIEW (widget)->viewable); }
static void gimp_color_selector_palette_palette_changed (GimpContext *context, GimpPalette *palette, GimpColorSelectorPalette *select) { gimp_view_set_viewable (GIMP_VIEW (select->view), GIMP_VIEWABLE (palette)); }
static gboolean gimp_view_expose_event (GtkWidget *widget, GdkEventExpose *event) { if (gtk_widget_is_drawable (widget)) { GtkAllocation allocation; cairo_t *cr; gtk_widget_get_allocation (widget, &allocation); cr = gdk_cairo_create (event->window); gdk_cairo_region (cr, event->region); cairo_clip (cr); cairo_translate (cr, allocation.x, allocation.y); gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer, widget, cr, allocation.width, allocation.height); cairo_destroy (cr); } return FALSE; }
static gboolean gimp_view_button_release_event (GtkWidget *widget, GdkEventButton *bevent) { GimpView *view = GIMP_VIEW (widget); if (! view->clickable && ! view->show_popup) return FALSE; if (bevent->button == 1) { gtk_grab_remove (widget); view->has_grab = FALSE; if (view->clickable && view->in_button) { g_signal_emit (widget, view_signals[CLICKED], 0, view->press_state); } } else { return FALSE; } return view->eat_button_events ? TRUE : FALSE; }
static void gimp_viewable_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GimpViewableDialog *dialog = GIMP_VIEWABLE_DIALOG (object); switch (property_id) { case PROP_VIEWABLE: g_value_set_object (value, dialog->view ? GIMP_VIEW (dialog->view)->viewable : NULL); break; case PROP_CONTEXT: g_value_set_object (value, dialog->context); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void gimp_view_realize (GtkWidget *widget) { GimpView *view = GIMP_VIEW (widget); GtkAllocation allocation; GdkWindowAttr attributes; gint attributes_mask; GTK_WIDGET_CLASS (parent_class)->realize (widget); gtk_widget_get_allocation (widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.wclass = GDK_INPUT_ONLY; attributes.event_mask = gtk_widget_get_events (widget); attributes_mask = GDK_WA_X | GDK_WA_Y; view->event_window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (view->event_window, view); }
static void gimp_navigation_editor_set_context (GimpDocked *docked, GimpContext *context) { GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (docked); GimpDisplay *display = NULL; if (editor->context) { g_signal_handlers_disconnect_by_func (editor->context, gimp_navigation_editor_display_changed, editor); } editor->context = context; if (editor->context) { g_signal_connect (context, "display-changed", G_CALLBACK (gimp_navigation_editor_display_changed), editor); display = gimp_context_get_display (context); } gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer, context); gimp_navigation_editor_display_changed (editor->context, display, editor); }
static void gimp_palette_view_draw_selected (GimpPaletteView *pal_view, GdkRectangle *area) { GimpView *view = GIMP_VIEW (pal_view); if (view->renderer->viewable && pal_view->selected) { GtkWidget *widget = GTK_WIDGET (view); GimpViewRendererPalette *renderer; gint row, col; renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer); row = pal_view->selected->position / renderer->columns; col = pal_view->selected->position % renderer->columns; if (area) gdk_gc_set_clip_rectangle (pal_view->gc, area); gdk_draw_rectangle (widget->window, pal_view->gc, FALSE, widget->allocation.x + col * renderer->cell_width, widget->allocation.y + row * renderer->cell_height, renderer->cell_width, renderer->cell_height); if (area) gdk_gc_set_clip_rectangle (pal_view->gc, NULL); } }
static void gimp_file_dialog_add_preview (GimpFileDialog *dialog, Gimp *gimp) { if (gimp->config->thumbnail_size <= 0) return; gtk_file_chooser_set_use_preview_label (GTK_FILE_CHOOSER (dialog), FALSE); g_signal_connect (dialog, "selection-changed", G_CALLBACK (gimp_file_dialog_selection_changed), dialog); g_signal_connect (dialog, "update-preview", G_CALLBACK (gimp_file_dialog_update_preview), dialog); dialog->thumb_box = gimp_thumb_box_new (gimp_get_user_context (gimp)); gtk_widget_set_sensitive (GTK_WIDGET (dialog->thumb_box), FALSE); gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog), dialog->thumb_box); gtk_widget_show (dialog->thumb_box); #ifdef ENABLE_FILE_SYSTEM_ICONS GIMP_VIEW_RENDERER_IMAGEFILE (GIMP_VIEW (GIMP_THUMB_BOX (dialog->thumb_box)->preview)->renderer)->file_system = _gtk_file_chooser_get_file_system (GTK_FILE_CHOOSER (dialog)); #endif }
static void palettes_merge_callback (GtkWidget *widget, const gchar *palette_name, gpointer data) { /* FIXME: reimplement palettes_merge_callback() */ #if 0 GimpContainerEditor *editor; GimpPalette *palette; GimpPalette *new_palette; GList *sel_list; editor = (GimpContainerEditor *) data; sel_list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (editor->view)->gtk_list)->selection; if (! sel_list) { gimp_message_literal (gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING, "Can't merge palettes because " "there are no palettes selected."); return; } new_palette = GIMP_PALETTE (gimp_palette_new (palette_name, FALSE)); while (sel_list) { GimpListItem *list_item; list_item = GIMP_LIST_ITEM (sel_list->data); palette = (GimpPalette *) GIMP_VIEW (list_item->preview)->viewable; if (palette) { GList *cols; for (cols = gimp_palette_get_colors (palette); cols; cols = g_list_next (cols)) { GimpPaletteEntry *entry = cols->data; gimp_palette_add_entry (new_palette, entry->name, &entry->color); } } sel_list = sel_list->next; } gimp_container_add (editor->view->container, GIMP_OBJECT (new_palette)); #endif }
static void gimp_brush_editor_set_data (GimpDataEditor *editor, GimpData *data) { GimpBrushEditor *brush_editor = GIMP_BRUSH_EDITOR (editor); GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE; gdouble radius = 0.0; gint spikes = 2; gdouble hardness = 0.0; gdouble ratio = 0.0; gdouble angle = 0.0; gdouble spacing = 0.0; if (editor->data) g_signal_handlers_disconnect_by_func (editor->data, gimp_brush_editor_notify_brush, editor); GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data); if (editor->data) g_signal_connect (editor->data, "notify", G_CALLBACK (gimp_brush_editor_notify_brush), editor); gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (data)); if (editor->data) { spacing = gimp_brush_get_spacing (GIMP_BRUSH (editor->data)); if (GIMP_IS_BRUSH_GENERATED (editor->data)) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (editor->data); shape = gimp_brush_generated_get_shape (brush); radius = gimp_brush_generated_get_radius (brush); spikes = gimp_brush_generated_get_spikes (brush); hardness = gimp_brush_generated_get_hardness (brush); ratio = gimp_brush_generated_get_aspect_ratio (brush); angle = gimp_brush_generated_get_angle (brush); } } gtk_widget_set_sensitive (brush_editor->options_box, editor->data_editable); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (brush_editor->shape_group), shape); gtk_adjustment_set_value (brush_editor->radius_data, radius); gtk_adjustment_set_value (brush_editor->spikes_data, spikes); gtk_adjustment_set_value (brush_editor->hardness_data, hardness); gtk_adjustment_set_value (brush_editor->aspect_ratio_data, ratio); gtk_adjustment_set_value (brush_editor->angle_data, angle); gtk_adjustment_set_value (brush_editor->spacing_data, spacing); }
static void gimp_container_grid_view_item_context (GtkWidget *widget, gpointer data) { /* ref the view because calling gimp_container_view_item_selected() * may destroy the widget */ g_object_ref (data); if (gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data), GIMP_VIEW (widget)->viewable)) { gimp_container_view_item_context (GIMP_CONTAINER_VIEW (data), GIMP_VIEW (widget)->viewable); } g_object_unref (data); }
GtkWidget * gimp_toolbox_image_area_create (GimpToolbox *toolbox, gint width, gint height) { GimpContext *context; GtkWidget *image_view; gchar *tooltip; g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL); context = gimp_toolbox_get_context (toolbox); image_view = gimp_view_new_full_by_types (context, GIMP_TYPE_VIEW, GIMP_TYPE_IMAGE, width, height, 0, FALSE, TRUE, TRUE); g_signal_connect (image_view, "set-viewable", G_CALLBACK (image_preview_set_viewable), NULL); gimp_view_set_viewable (GIMP_VIEW (image_view), GIMP_VIEWABLE (gimp_context_get_image (context))); gtk_widget_show (image_view); #ifdef GDK_WINDOWING_X11 tooltip = g_strdup_printf ("%s\n%s", _("The active image.\n" "Click to open the Image Dialog."), _("Drag to an XDS enabled file-manager to " "save the image.")); #else tooltip = g_strdup (_("The active image.\n" "Click to open the Image Dialog.")); #endif gimp_help_set_help_data (image_view, tooltip, GIMP_HELP_TOOLBOX_IMAGE_AREA); g_free (tooltip); g_signal_connect_object (context, "image-changed", G_CALLBACK (gimp_view_set_viewable), image_view, G_CONNECT_SWAPPED); g_signal_connect (image_view, "clicked", G_CALLBACK (image_preview_clicked), toolbox); gimp_dnd_viewable_dest_add (image_view, GIMP_TYPE_IMAGE, image_preview_drop_image, context); return image_view; }
static void gimp_view_map (GtkWidget *widget) { GimpView *view = GIMP_VIEW (widget); GTK_WIDGET_CLASS (parent_class)->map (widget); if (view->event_window) gdk_window_show (view->event_window); }
static gboolean gimp_palette_view_expose (GtkWidget *widget, GdkEventExpose *eevent) { GimpPaletteView *pal_view = GIMP_PALETTE_VIEW (widget); GimpView *view = GIMP_VIEW (widget); if (! gtk_widget_is_drawable (widget)) return FALSE; GTK_WIDGET_CLASS (parent_class)->expose_event (widget, eevent); if (view->renderer->viewable && pal_view->selected) { GimpViewRendererPalette *renderer; GtkStyle *style = gtk_widget_get_style (widget); GtkAllocation allocation; cairo_t *cr; gint row, col; renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer); gtk_widget_get_allocation (widget, &allocation); row = pal_view->selected->position / renderer->columns; col = pal_view->selected->position % renderer->columns; cr = gdk_cairo_create (gtk_widget_get_window (widget)); gdk_cairo_region (cr, eevent->region); cairo_clip (cr); cairo_translate (cr, allocation.x, allocation.y); cairo_rectangle (cr, col * renderer->cell_width + 0.5, row * renderer->cell_height + 0.5, renderer->cell_width, renderer->cell_height); cairo_set_line_width (cr, 1.0); gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_SELECTED]); cairo_stroke_preserve (cr); if (gimp_cairo_set_focus_line_pattern (cr, widget)) { gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]); cairo_stroke (cr); } cairo_destroy (cr); } return FALSE; }
static void gimp_brush_editor_set_context (GimpDocked *docked, GimpContext *context) { GimpDataEditor *data_editor = GIMP_DATA_EDITOR (docked); parent_docked_iface->set_context (docked, context); gimp_view_renderer_set_context (GIMP_VIEW (data_editor->view)->renderer, context); }
static void gimp_selection_editor_set_context (GimpDocked *docked, GimpContext *context) { GimpSelectionEditor *editor = GIMP_SELECTION_EDITOR (docked); parent_docked_iface->set_context (docked, context); gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer, context); }
static void gimp_palette_editor_set_context (GimpDocked *docked, GimpContext *context) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (docked); parent_docked_iface->set_context (docked, context); gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer, context); }
static void gimp_buffer_view_set_context (GimpDocked *docked, GimpContext *context) { GimpBufferView *view = GIMP_BUFFER_VIEW (docked); parent_docked_iface->set_context (docked, context); gimp_view_renderer_set_context (GIMP_VIEW (view->global_view)->renderer, context); }
static gpointer gimp_container_grid_view_insert_item (GimpContainerView *container_view, GimpViewable *viewable, gpointer parent_insert_data, gint index) { GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (container_view); GtkWidget *view; gint view_size; view_size = gimp_container_view_get_view_size (container_view, NULL); view = gimp_view_new_full (gimp_container_view_get_context (container_view), viewable, view_size, view_size, 1, FALSE, TRUE, TRUE); gimp_view_renderer_set_border_type (GIMP_VIEW (view)->renderer, GIMP_VIEW_BORDER_WHITE); gimp_view_renderer_remove_idle (GIMP_VIEW (view)->renderer); gtk_wrap_box_pack (GTK_WRAP_BOX (grid_view->wrap_box), view, FALSE, FALSE, FALSE, FALSE); if (index != -1) gtk_wrap_box_reorder_child (GTK_WRAP_BOX (grid_view->wrap_box), view, index); gtk_widget_show (view); g_signal_connect (view, "button-press-event", G_CALLBACK (gimp_container_grid_view_item_selected), container_view); g_signal_connect (view, "double-clicked", G_CALLBACK (gimp_container_grid_view_item_activated), container_view); g_signal_connect (view, "context", G_CALLBACK (gimp_container_grid_view_item_context), container_view); return (gpointer) view; }
static gboolean gimp_view_popup_timeout (GimpViewPopup *popup) { GtkWidget *window; GtkWidget *frame; GtkWidget *view; GdkScreen *screen; GdkRectangle rect; gint monitor; gint x; gint y; popup->timeout_id = 0; screen = gtk_widget_get_screen (popup->widget); window = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_screen (GTK_WINDOW (window), screen); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); gtk_container_add (GTK_CONTAINER (window), frame); gtk_widget_show (frame); view = gimp_view_new_full (popup->context, popup->viewable, popup->popup_width, popup->popup_height, 0, TRUE, FALSE, FALSE); gimp_view_renderer_set_dot_for_dot (GIMP_VIEW (view)->renderer, popup->dot_for_dot); gtk_container_add (GTK_CONTAINER (frame), view); gtk_widget_show (view); x = popup->button_x - (popup->popup_width / 2); y = popup->button_y - (popup->popup_height / 2); monitor = gdk_screen_get_monitor_at_point (screen, x, y); gdk_screen_get_monitor_geometry (screen, monitor, &rect); x = CLAMP (x, rect.x, rect.x + rect.width - popup->popup_width); y = CLAMP (y, rect.y, rect.y + rect.height - popup->popup_height); gtk_window_move (GTK_WINDOW (window), x, y); gtk_widget_show (window); popup->popup = window; return FALSE; }
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 gimp_palette_editor_set_data (GimpDataEditor *editor, GimpData *data) { GimpPaletteEditor *palette_editor = GIMP_PALETTE_EDITOR (editor); g_signal_handlers_block_by_func (palette_editor->columns_adj, palette_editor_columns_changed, editor); if (editor->data) { if (palette_editor->color_dialog) { gtk_widget_destroy (palette_editor->color_dialog); palette_editor->color_dialog = NULL; } g_signal_handlers_disconnect_by_func (editor->data, palette_editor_invalidate_preview, editor); gtk_adjustment_set_value (palette_editor->columns_adj, 0); } GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data); gimp_view_set_viewable (GIMP_VIEW (palette_editor->view), GIMP_VIEWABLE (data)); if (editor->data) { GimpPalette *palette = GIMP_PALETTE (editor->data); g_signal_connect (editor->data, "invalidate-preview", G_CALLBACK (palette_editor_invalidate_preview), editor); gtk_adjustment_set_value (palette_editor->columns_adj, gimp_palette_get_columns (palette)); palette_editor_scroll_top_left (palette_editor); palette_editor_invalidate_preview (GIMP_PALETTE (editor->data), palette_editor); } g_signal_handlers_unblock_by_func (palette_editor->columns_adj, palette_editor_columns_changed, editor); }