static void gimp_pattern_select_constructed (GObject *object) { GimpPdbDialog *dialog = GIMP_PDB_DIALOG (object); GtkWidget *content_area; if (G_OBJECT_CLASS (parent_class)->constructed) G_OBJECT_CLASS (parent_class)->constructed (object); dialog->view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_GRID, dialog->context->gimp->pattern_factory, dialog->context, GIMP_VIEW_SIZE_MEDIUM, 1, dialog->menu_factory); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (GIMP_CONTAINER_EDITOR (dialog->view)->view), 6 * (GIMP_VIEW_SIZE_MEDIUM + 2), 6 * (GIMP_VIEW_SIZE_MEDIUM + 2)); gtk_container_set_border_width (GTK_CONTAINER (dialog->view), 12); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_box_pack_start (GTK_BOX (content_area), dialog->view, TRUE, TRUE, 0); gtk_widget_show (dialog->view); }
static GObject * gimp_font_select_constructor (GType type, guint n_params, GObjectConstructParam *params) { GObject *object; GimpPdbDialog *dialog; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); dialog = GIMP_PDB_DIALOG (object); dialog->view = gimp_font_view_new (GIMP_VIEW_TYPE_LIST, dialog->context->gimp->fonts, dialog->context, GIMP_VIEW_SIZE_MEDIUM, 1, dialog->menu_factory); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (GIMP_CONTAINER_EDITOR (dialog->view)->view), 6 * (GIMP_VIEW_SIZE_MEDIUM + 2), 6 * (GIMP_VIEW_SIZE_MEDIUM + 2)); gtk_container_set_border_width (GTK_CONTAINER (dialog->view), 12); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->view); gtk_widget_show (dialog->view); return object; }
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 GtkWidget * quit_close_all_dialog_new (Gimp *gimp, gboolean do_quit) { GimpContainer *images; GimpContext *context; GimpMessageBox *box; GtkWidget *dialog; GtkWidget *label; GtkWidget *button; GtkWidget *view; GtkWidget *dnd_widget; gint rows; gint view_size; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); #ifdef __GNUC__ #warning FIXME: need container of dirty images #endif images = gimp_displays_get_dirty_images (gimp); context = gimp_context_new (gimp, "close-all-dialog", gimp_get_user_context (gimp)); g_return_val_if_fail (images != NULL, NULL); dialog = gimp_message_dialog_new (do_quit ? _("Quit GIMP") : _("Close All Images"), GIMP_STOCK_WARNING, NULL, 0, gimp_standard_help_func, do_quit ? GIMP_HELP_FILE_QUIT : GIMP_HELP_FILE_CLOSE_ALL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); g_object_set_data_full (G_OBJECT (dialog), "dirty-images", images, (GDestroyNotify) g_object_unref); g_object_set_data_full (G_OBJECT (dialog), "dirty-images-context", context, (GDestroyNotify) g_object_unref); g_signal_connect (dialog, "response", G_CALLBACK (quit_close_all_dialog_response), gimp); box = GIMP_MESSAGE_DIALOG (dialog)->box; button = gtk_dialog_add_button (GTK_DIALOG (dialog), "", GTK_RESPONSE_OK); g_object_set_data (G_OBJECT (box), "ok-button", button); g_object_set_data (G_OBJECT (box), "do-quit", GINT_TO_POINTER (do_quit)); g_signal_connect_object (images, "add", G_CALLBACK (quit_close_all_dialog_container_changed), box, 0); g_signal_connect_object (images, "remove", G_CALLBACK (quit_close_all_dialog_container_changed), box, 0); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); view_size = gimp->config->layer_preview_size; rows = CLAMP (gimp_container_num_children (images), 3, 6); view = gimp_container_tree_view_new (images, context, view_size, 1); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (view), -1, rows * (view_size + 2)); gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE, 0); gtk_widget_show (view); g_signal_connect (view, "activate-item", G_CALLBACK (quit_close_all_dialog_image_activated), gimp); dnd_widget = gimp_container_view_get_dnd_widget (GIMP_CONTAINER_VIEW (view)); gimp_dnd_xds_source_add (dnd_widget, (GimpDndDragViewableFunc) gimp_dnd_get_drag_data, NULL); if (do_quit) label = gtk_label_new (_("If you quit GIMP now, " "these changes will be lost.")); else label = gtk_label_new (_("If you close these images now, " "changes will be lost.")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); gtk_widget_show (label); g_object_set_data (G_OBJECT (box), "lost-label", label); quit_close_all_dialog_container_changed (images, NULL, GIMP_MESSAGE_DIALOG (dialog)->box); return dialog; }
static GObject * gimp_brush_select_constructor (GType type, guint n_params, GObjectConstructParam *params) { GObject *object; GimpPdbDialog *dialog; GimpBrushSelect *select; GtkWidget *table; GtkAdjustment *spacing_adj; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); dialog = GIMP_PDB_DIALOG (object); select = GIMP_BRUSH_SELECT (object); gimp_context_set_opacity (dialog->context, select->initial_opacity); gimp_context_set_paint_mode (dialog->context, select->initial_mode); g_signal_connect (dialog->context, "opacity-changed", G_CALLBACK (gimp_brush_select_opacity_changed), dialog); g_signal_connect (dialog->context, "paint-mode-changed", G_CALLBACK (gimp_brush_select_mode_changed), dialog); dialog->view = gimp_brush_factory_view_new (GIMP_VIEW_TYPE_GRID, dialog->context->gimp->brush_factory, dialog->context, FALSE, GIMP_VIEW_SIZE_MEDIUM, 1, dialog->menu_factory); gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (GIMP_CONTAINER_EDITOR (dialog->view)->view), 5 * (GIMP_VIEW_SIZE_MEDIUM + 2), 5 * (GIMP_VIEW_SIZE_MEDIUM + 2)); gtk_container_set_border_width (GTK_CONTAINER (dialog->view), 12); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->view); gtk_widget_show (dialog->view); /* Create the frame and the table for the options */ table = GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_scale->parent; gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 2); /* Create the opacity scale widget */ select->opacity_data = GTK_ADJUSTMENT (gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("Opacity:"), -1, 5, gimp_context_get_opacity (dialog->context) * 100.0, 0.0, 100.0, 1.0, 10.0, 1, TRUE, 0.0, 0.0, NULL, NULL)); g_signal_connect (select->opacity_data, "value-changed", G_CALLBACK (gimp_brush_select_opacity_update), select); /* Create the paint mode option menu */ select->paint_mode_menu = gimp_paint_mode_menu_new (TRUE, FALSE); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("Mode:"), 0.0, 0.5, select->paint_mode_menu, 2, FALSE); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (select->paint_mode_menu), gimp_context_get_paint_mode (dialog->context), G_CALLBACK (gimp_brush_select_mode_update), select); spacing_adj = GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_adjustment; /* Use passed spacing instead of brushes default */ if (select->spacing >= 0) gtk_adjustment_set_value (spacing_adj, select->spacing); g_signal_connect (spacing_adj, "value-changed", G_CALLBACK (gimp_brush_select_spacing_update), select); gtk_widget_show (table); return object; }
static void gimp_container_popup_create_view (GimpContainerPopup *popup) { GimpEditor *editor; GtkWidget *button; popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR, "view-type", popup->view_type, "container", popup->container, "context", popup->context, "view-size", popup->view_size, "view-border-width", popup->view_border_width, NULL); gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view), FALSE); if (popup->view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *search_entry; search_entry = gtk_entry_new (); gtk_box_pack_end (GTK_BOX (popup->editor->view), search_entry, FALSE, FALSE, 0); gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GIMP_CONTAINER_TREE_VIEW (GIMP_CONTAINER_VIEW (popup->editor->view))->view), GTK_ENTRY (search_entry)); gtk_widget_show (search_entry); } 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, "zoom-out", _("Smaller Previews"), NULL, G_CALLBACK (gimp_container_popup_smaller_clicked), NULL, popup); gimp_editor_add_button (editor, "zoom-in", _("Larger Previews"), NULL, G_CALLBACK (gimp_container_popup_larger_clicked), NULL, popup); button = gimp_editor_add_icon_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_icon_name, popup->dialog_tooltip, NULL, G_CALLBACK (gimp_container_popup_dialog_clicked), NULL, popup); gtk_widget_grab_focus (GTK_WIDGET (popup->editor)); }