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 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_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)); }
static void gimp_histogram_editor_init (GimpHistogramEditor *editor) { GimpHistogramView *view; GtkWidget *hbox; GtkWidget *label; GtkWidget *menu; GtkWidget *table; gint i; const gchar *gimp_histogram_editor_labels[] = { N_("Mean:"), N_("Std dev:"), N_("Median:"), N_("Pixels:"), N_("Count:"), N_("Percentile:") }; editor->drawable = NULL; editor->histogram = NULL; editor->bg_histogram = NULL; editor->valid = FALSE; editor->idle_id = 0; editor->box = gimp_histogram_box_new (); gimp_editor_set_show_name (GIMP_EDITOR (editor), TRUE); view = GIMP_HISTOGRAM_BOX (editor->box)->view; hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Channel:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); editor->menu = menu = gimp_prop_enum_combo_box_new (G_OBJECT (view), "histogram-channel", 0, 0); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu), "gimp-channel"); gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (editor->menu), gimp_histogram_menu_sensitivity, editor, NULL); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (editor->menu), view->channel); gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); menu = gimp_prop_enum_stock_box_new (G_OBJECT (view), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); gtk_box_pack_start (GTK_BOX (editor), editor->box, TRUE, TRUE, 0); gtk_widget_show (GTK_WIDGET (editor->box)); g_signal_connect_swapped (view, "range-changed", G_CALLBACK (gimp_histogram_editor_info_update), editor); g_signal_connect_swapped (view, "notify::histogram-channel", G_CALLBACK (gimp_histogram_editor_info_update), editor); g_signal_connect_swapped (view, "expose-event", G_CALLBACK (gimp_histogram_view_expose), editor); table = gtk_table_new (3, 4, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_col_spacing (GTK_TABLE (table), 1, 6); gtk_box_pack_start (GTK_BOX (editor), table, FALSE, FALSE, 0); gtk_widget_show (table); for (i = 0; i < 6; i++) { gint x = (i / 3) * 2; gint y = (i % 3); label = gtk_label_new (gettext (gimp_histogram_editor_labels[i])); gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, PANGO_ATTR_SCALE, PANGO_SCALE_SMALL, -1); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, x, x + 1, y, y + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 2); gtk_widget_show (label); editor->labels[i] = label = g_object_new (GTK_TYPE_LABEL, "xalign", 0.0, "yalign", 0.5, "width-chars", i > 2 ? 9 : 5, NULL); gimp_label_set_attributes (GTK_LABEL (editor->labels[i]), PANGO_ATTR_SCALE, PANGO_SCALE_SMALL, -1); gtk_table_attach (GTK_TABLE (table), label, x + 1, x + 2, y, y + 1, GTK_FILL, GTK_FILL, 2, 2); gtk_widget_show (label); } }