static void gimp_threshold_tool_dialog (GimpImageMapTool *image_map_tool) { GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool); GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool); GimpThresholdConfig *config = t_tool->config; GtkWidget *main_vbox; GtkWidget *hbox; GtkWidget *menu; GtkWidget *box; GtkWidget *button; main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); menu = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); box = gimp_histogram_box_new (); gtk_box_pack_start (GTK_BOX (main_vbox), box, TRUE, TRUE, 0); gtk_widget_show (box); t_tool->histogram_box = GIMP_HISTOGRAM_BOX (box); gimp_histogram_view_set_range (t_tool->histogram_box->view, config->low * 255.999, config->high * 255.999); g_signal_connect (t_tool->histogram_box->view, "range-changed", G_CALLBACK (gimp_threshold_tool_histogram_range), t_tool); gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options), t_tool->histogram_box->view); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button = gtk_button_new_with_mnemonic (_("_Auto")); gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); gimp_help_set_help_data (button, _("Automatically adjust to optimal " "binarization threshold"), NULL); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (gimp_threshold_tool_auto_clicked), t_tool); }
GtkWidget * gimp_move_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *box; GtkWidget *label; GtkWidget *frame; gchar *title; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Move:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); box = gimp_prop_enum_stock_box_new (config, "move-type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); gtk_widget_show (box); /* tool toggle */ title = g_strdup_printf (_("Tool Toggle (%s)"), gimp_get_mod_string (GDK_SHIFT_MASK)); frame = gimp_prop_boolean_radio_frame_new (config, "move-current", title, "true", "false"); gimp_move_options_notify_type (GIMP_MOVE_OPTIONS (config), NULL, frame); g_signal_connect_object (config, "notify::move-type", G_CALLBACK (gimp_move_options_notify_type), frame, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); g_free (title); return vbox; }
GtkWidget * gimp_flip_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *box; GtkWidget *label; GtkWidget *frame; gchar *str; hbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Affect:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); box = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); gtk_widget_show (box); /* tool toggle */ str = g_strdup_printf (_("Flip Type (%s)"), gimp_get_mod_string (GDK_CONTROL_MASK)); frame = gimp_prop_enum_radio_frame_new (config, "flip-type", str, GIMP_ORIENTATION_HORIZONTAL, GIMP_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); g_free (str); return vbox; }
GtkWidget * gimp_transform_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *label; GtkWidget *frame; GtkWidget *table; GtkWidget *combo; GtkWidget *button; const gchar *constrain = NULL; hbox = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Transform:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (hbox), label, 0); gtk_widget_show (label); frame = gimp_prop_enum_radio_frame_new (config, "direction", _("Direction"), 0, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the interpolation menu */ frame = gimp_frame_new (_("Interpolation:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "interpolation", 0, 0); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* the clipping menu */ hbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); frame = gimp_frame_new (_("Clipping:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "clip", 0, 0); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* the preview frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the preview type menu */ hbox = gtk_hbox_new (FALSE, 2); gtk_frame_set_label_widget (GTK_FRAME (frame), hbox); gtk_widget_show (hbox); label = gtk_label_new (_("Preview:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gimp_prop_enum_combo_box_new (config, "preview-type", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); /* the grid type menu */ button = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), button); gtk_widget_show (button); combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0); gtk_box_pack_start (GTK_BOX (button), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the grid density scale */ table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2); gtk_box_pack_start (GTK_BOX (button), table, FALSE, FALSE, 0); gtk_widget_show (table); gtk_widget_set_sensitive (button, options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_GRID || options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID); g_signal_connect (config, "notify::preview-type", G_CALLBACK (gimp_transform_options_preview_notify), button); gimp_prop_scale_entry_new (config, "grid-size", GTK_TABLE (table), 0, 0, NULL, 1.0, 8.0, 0, FALSE, 0.0, 0.0); if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL) { constrain = (_("15 degrees (%s)")); } else if (tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL) { constrain = (_("Keep aspect (%s)")); } if (constrain) { gchar *label = g_strdup_printf (constrain, gimp_get_mod_string (GDK_CONTROL_MASK)); button = gimp_prop_check_button_new (config, "constrain", label); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_free (label); } return vbox; }
static void gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool) { GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool); GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool); GimpLevelsConfig *config = tool->config; GtkListStore *store; GtkSizeGroup *label_group; GtkWidget *main_vbox; GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *vbox3; GtkWidget *hbox; GtkWidget *hbox2; GtkWidget *label; GtkWidget *menu; GtkWidget *frame; GtkWidget *hbbox; GtkWidget *button; GtkWidget *spinbutton; GtkAdjustment *adjustment; GtkWidget *bar; GtkWidget *handle_bar; gint border; g_signal_connect (image_map_tool->settings_box, "file-dialog-setup", G_CALLBACK (gimp_levels_tool_export_setup), image_map_tool); main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool); /* The option menu for selecting channels */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Cha_nnel:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); gtk_size_group_add_widget (label_group, label); store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL, GIMP_HISTOGRAM_VALUE, GIMP_HISTOGRAM_ALPHA); menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)); g_object_unref (store); g_signal_connect (menu, "changed", G_CALLBACK (levels_channel_callback), tool); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu), "gimp-channel"); gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); tool->channel_menu = menu; gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu); button = gtk_button_new_with_mnemonic (_("R_eset Channel")); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (levels_channel_reset_callback), tool); menu = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); /* Input levels frame */ frame = gimp_frame_new (_("Input Levels")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); tool->histogram_view = gimp_histogram_view_new (FALSE); gtk_box_pack_start (GTK_BOX (vbox2), tool->histogram_view, TRUE, TRUE, 0); gtk_widget_show (GTK_WIDGET (tool->histogram_view)); gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options), GIMP_HISTOGRAM_VIEW (tool->histogram_view)); g_object_get (tool->histogram_view, "border-width", &border, NULL); vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox3), border); gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0); gtk_widget_show (vbox3); tool->input_bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL); gtk_widget_set_size_request (tool->input_bar, -1, GRADIENT_HEIGHT / 2); gtk_box_pack_start (GTK_BOX (vbox3), tool->input_bar, FALSE, FALSE, 0); gtk_widget_show (tool->input_bar); bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL); gtk_widget_set_size_request (bar, -1, GRADIENT_HEIGHT / 2); gtk_box_pack_start (GTK_BOX (vbox3), bar, FALSE, FALSE, 0); gtk_widget_show (bar); handle_bar = g_object_new (GIMP_TYPE_HANDLE_BAR, NULL); gtk_widget_set_size_request (handle_bar, -1, CONTROL_HEIGHT); gtk_box_pack_start (GTK_BOX (vbox3), handle_bar, FALSE, FALSE, 0); gtk_widget_show (handle_bar); gimp_handle_bar_connect_events (GIMP_HANDLE_BAR (handle_bar), tool->input_bar); gimp_handle_bar_connect_events (GIMP_HANDLE_BAR (handle_bar), bar); /* Horizontal box for input levels spinbuttons */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); /* low input spin */ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); button = gimp_levels_tool_color_picker_new (tool, PICK_LOW_INPUT); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); tool->low_input_spinbutton = spinbutton = gimp_prop_spin_button_new (image_map_tool->config, "low-input", 0.01, 0.1, 1); gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->low_input = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)); gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (handle_bar), 0, tool->low_input); /* input gamma spin */ spinbutton = gimp_prop_spin_button_new (image_map_tool->config, "gamma", 0.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, FALSE, 0); gimp_help_set_help_data (spinbutton, _("Gamma"), NULL); gtk_widget_show (spinbutton); tool->gamma = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)); tool->gamma_linear = GTK_ADJUSTMENT (gtk_adjustment_new (127, 0, 255, 0.1, 1.0, 0.0)); g_signal_connect (tool->gamma_linear, "value-changed", G_CALLBACK (levels_linear_gamma_changed), tool); gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (handle_bar), 1, tool->gamma_linear); g_object_unref (tool->gamma_linear); /* high input spin */ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); button = gimp_levels_tool_color_picker_new (tool, PICK_HIGH_INPUT); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); spinbutton = gimp_prop_spin_button_new (image_map_tool->config, "high-input", 0.01, 0.1, 1); gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->high_input_spinbutton = spinbutton; tool->high_input = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)); gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (handle_bar), 2, tool->high_input); /* Output levels frame */ frame = gimp_frame_new (_("Output Levels")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox2), border); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); tool->output_bar = g_object_new (GIMP_TYPE_COLOR_BAR, NULL); gtk_widget_set_size_request (tool->output_bar, -1, GRADIENT_HEIGHT); gtk_box_pack_start (GTK_BOX (vbox2), tool->output_bar, FALSE, FALSE, 0); gtk_widget_show (tool->output_bar); handle_bar = g_object_new (GIMP_TYPE_HANDLE_BAR, NULL); gtk_widget_set_size_request (handle_bar, -1, CONTROL_HEIGHT); gtk_box_pack_start (GTK_BOX (vbox2), handle_bar, FALSE, FALSE, 0); gtk_widget_show (handle_bar); gimp_handle_bar_connect_events (GIMP_HANDLE_BAR (handle_bar), tool->output_bar); /* Horizontal box for levels spin widgets */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); /* low output spin */ tool->low_output_spinbutton = spinbutton = gimp_prop_spin_button_new (image_map_tool->config, "low-output", 0.01, 0.1, 1); gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)); gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (handle_bar), 0, adjustment); /* high output spin */ tool->high_output_spinbutton = spinbutton = gimp_prop_spin_button_new (image_map_tool->config, "high-output", 0.01, 0.1, 1); gtk_box_pack_end (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton)); gimp_handle_bar_set_adjustment (GIMP_HANDLE_BAR (handle_bar), 2, adjustment); /* all channels frame */ frame = gimp_frame_new (_("All Channels")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); hbbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0); gtk_widget_show (hbbox); button = gtk_button_new_with_mnemonic (_("_Auto")); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gimp_help_set_help_data (button, _("Adjust levels automatically"), NULL); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (levels_stretch_callback), tool); button = gimp_levels_tool_color_picker_new (tool, PICK_LOW_INPUT | PICK_ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_levels_tool_color_picker_new (tool, PICK_GAMMA | PICK_ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_levels_tool_color_picker_new (tool, PICK_HIGH_INPUT | PICK_ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_stock_button_new (GIMP_STOCK_TOOL_CURVES, _("Edit these Settings as Curves")); gtk_box_pack_start (GTK_BOX (main_vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (levels_to_curves_callback), tool); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu), config->channel); }
static void gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool) { GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool); GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool); GimpCurvesConfig *config = tool->config; GtkListStore *store; GtkSizeGroup *label_group; GtkWidget *main_vbox; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *hbox2; GtkWidget *label; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *bar; GtkWidget *combo; g_signal_connect (image_map_tool->settings_box, "file-dialog-setup", G_CALLBACK (gimp_curves_tool_export_setup), image_map_tool); main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool); /* The combo box for selecting channels */ hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Cha_nnel:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); gtk_size_group_add_widget (label_group, label); store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL, GIMP_HISTOGRAM_VALUE, GIMP_HISTOGRAM_ALPHA); tool->channel_menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)); g_object_unref (store); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu), config->channel); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu), "gimp-channel"); gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0); gtk_widget_show (tool->channel_menu); g_signal_connect (tool->channel_menu, "changed", G_CALLBACK (curves_channel_callback), tool); gtk_label_set_mnemonic_widget (GTK_LABEL (label), tool->channel_menu); button = gtk_button_new_with_mnemonic (_("R_eset Channel")); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (curves_channel_reset_callback), tool); /* The histogram scale radio buttons */ hbox2 = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); /* The table for the color bars and the graph */ table = gtk_table_new (2, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (main_vbox), table, TRUE, TRUE, 0); /* The left color bar */ vbox = gtk_vbox_new (FALSE, 0); gtk_table_attach (GTK_TABLE (table), vbox, 0, 1, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (vbox); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, RADIUS); gtk_widget_show (frame); tool->yrange = gimp_color_bar_new (GTK_ORIENTATION_VERTICAL); gtk_widget_set_size_request (tool->yrange, BAR_SIZE, -1); gtk_container_add (GTK_CONTAINER (frame), tool->yrange); gtk_widget_show (tool->yrange); /* The curves graph */ frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (frame); tool->graph = gimp_curve_view_new (); gtk_widget_set_size_request (tool->graph, GRAPH_SIZE + RADIUS * 2, GRAPH_SIZE + RADIUS * 2); g_object_set (tool->graph, "border-width", RADIUS, "subdivisions", 1, NULL); gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), config->curve[config->channel]); gtk_container_add (GTK_CONTAINER (frame), tool->graph); gtk_widget_show (tool->graph); gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options), GIMP_HISTOGRAM_VIEW (tool->graph)); /* The bottom color bar */ hbox2 = gtk_hbox_new (FALSE, 0); gtk_table_attach (GTK_TABLE (table), hbox2, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox2); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, TRUE, RADIUS); gtk_widget_show (frame); vbox = gtk_vbox_new (TRUE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); tool->xrange = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_size_request (tool->xrange, -1, BAR_SIZE / 2); gtk_box_pack_start (GTK_BOX (vbox), tool->xrange, TRUE, TRUE, 0); gtk_widget_show (tool->xrange); bar = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (GTK_BOX (vbox), bar, TRUE, TRUE, 0); gtk_widget_show (bar); gtk_widget_show (table); hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_end (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Curve _type:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); tool->curve_type = combo = gimp_enum_combo_box_new (GIMP_TYPE_CURVE_TYPE); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (combo), "gimp-curve"); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), 0, G_CALLBACK (curves_curve_type_callback), tool); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); }
static void gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool) { GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool); GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool); GtkListStore *store; GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *vbox3; GtkWidget *hbox; GtkWidget *hbox2; GtkWidget *label; GtkWidget *menu; GtkWidget *frame; GtkWidget *hbbox; GtkWidget *button; GtkWidget *spinbutton; GtkWidget *bar; GtkObject *data; gint border; vbox = image_map_tool->main_vbox; /* The option menu for selecting channels */ hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Cha_nnel:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL, GIMP_HISTOGRAM_VALUE, GIMP_HISTOGRAM_ALPHA); menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)); g_object_unref (store); g_signal_connect (menu, "changed", G_CALLBACK (levels_channel_callback), tool); gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu), "gimp-channel"); gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); tool->channel_menu = menu; gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu); button = gtk_button_new_with_mnemonic (_("R_eset Channel")); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (levels_channel_reset_callback), tool); menu = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0); gtk_widget_show (menu); /* Input levels frame */ frame = gimp_frame_new (_("Input Levels")); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); vbox2 = gtk_vbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, TRUE, 0); gtk_widget_show (frame); tool->hist_view = gimp_histogram_view_new (FALSE); gtk_container_add (GTK_CONTAINER (frame), tool->hist_view); gtk_widget_show (GTK_WIDGET (tool->hist_view)); gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options), GIMP_HISTOGRAM_VIEW (tool->hist_view)); g_object_get (tool->hist_view, "border-width", &border, NULL); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0); gtk_widget_show (frame); tool->input_area = gtk_event_box_new (); gtk_widget_set_size_request (tool->input_area, -1, GRADIENT_HEIGHT + CONTROL_HEIGHT); gtk_widget_add_events (tool->input_area, LEVELS_EVENT_MASK); gtk_container_add (GTK_CONTAINER (frame), tool->input_area); gtk_widget_show (tool->input_area); g_signal_connect (tool->input_area, "event", G_CALLBACK (levels_input_area_event), tool); g_signal_connect_after (tool->input_area, "expose-event", G_CALLBACK (levels_input_area_expose), tool); vbox3 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (tool->input_area), vbox3); gtk_widget_show (vbox3); tool->input_bar = g_object_new (GIMP_TYPE_COLOR_BAR, "xpad", border, "ypad", 0, NULL); gtk_widget_set_size_request (tool->input_bar, -1, GRADIENT_HEIGHT / 2); gtk_box_pack_start (GTK_BOX (vbox3), tool->input_bar, FALSE, FALSE, 0); gtk_widget_show (tool->input_bar); bar = g_object_new (GIMP_TYPE_COLOR_BAR, "xpad", border, "ypad", 0, NULL); gtk_widget_set_size_request (bar, -1, GRADIENT_HEIGHT / 2); gtk_box_pack_start (GTK_BOX (vbox3), bar, FALSE, FALSE, 0); gtk_widget_show (bar); /* Horizontal box for input levels spinbuttons */ hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); /* low input spin */ hbox2 = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); button = gimp_levels_tool_color_picker_new (tool, LOW_INPUT); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); spinbutton = gimp_spin_button_new (&data, 0, 0, 255, 1, 10, 10, 0.5, 0); gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->low_input = GTK_ADJUSTMENT (data); g_signal_connect (tool->low_input, "value-changed", G_CALLBACK (levels_low_input_adjustment_update), tool); /* input gamma spin */ spinbutton = gimp_spin_button_new (&data, 1, 0.1, 10, 0.01, 0.1, 1, 0.5, 2); gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, FALSE, 0); gimp_help_set_help_data (spinbutton, _("Gamma"), NULL); gtk_widget_show (spinbutton); tool->gamma = GTK_ADJUSTMENT (data); g_signal_connect (tool->gamma, "value-changed", G_CALLBACK (levels_gamma_adjustment_update), tool); /* high input spin */ hbox2 = gtk_hbox_new (FALSE, 2); gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); button = gimp_levels_tool_color_picker_new (tool, HIGH_INPUT); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); spinbutton = gimp_spin_button_new (&data, 255, 0, 255, 1, 10, 10, 0.5, 0); gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->high_input = GTK_ADJUSTMENT (data); g_signal_connect (tool->high_input, "value-changed", G_CALLBACK (levels_high_input_adjustment_update), tool); /* Output levels frame */ frame = gimp_frame_new (_("Output Levels")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox2 = gtk_vbox_new (FALSE, 4); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0); gtk_widget_show (frame); tool->output_area = gtk_event_box_new (); gtk_widget_set_size_request (tool->output_area, -1, GRADIENT_HEIGHT + CONTROL_HEIGHT); gtk_widget_add_events (bar, LEVELS_EVENT_MASK); gtk_container_add (GTK_CONTAINER (frame), tool->output_area); gtk_widget_show (tool->output_area); g_signal_connect (tool->output_area, "event", G_CALLBACK (levels_output_area_event), tool); g_signal_connect_after (tool->output_area, "expose-event", G_CALLBACK (levels_output_area_expose), tool); vbox3 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (tool->output_area), vbox3); gtk_widget_show (vbox3); tool->output_bar = g_object_new (GIMP_TYPE_COLOR_BAR, "xpad", border, "ypad", 0, NULL); gtk_widget_set_size_request (tool->output_bar, -1, GRADIENT_HEIGHT); gtk_box_pack_start (GTK_BOX (vbox3), tool->output_bar, FALSE, FALSE, 0); gtk_widget_show (tool->output_bar); /* Horizontal box for levels spin widgets */ hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); /* low output spin */ spinbutton = gimp_spin_button_new (&data, 0, 0, 255, 1, 10, 10, 0.5, 0); gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->low_output = GTK_ADJUSTMENT (data); g_signal_connect (tool->low_output, "value-changed", G_CALLBACK (levels_low_output_adjustment_update), tool); /* high output spin */ spinbutton = gimp_spin_button_new (&data, 255, 0, 255, 1, 10, 10, 0.5, 0); gtk_box_pack_end (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); tool->high_output = GTK_ADJUSTMENT (data); g_signal_connect (tool->high_output, "value-changed", G_CALLBACK (levels_high_output_adjustment_update), tool); frame = gimp_frame_new (_("All Channels")); gtk_box_pack_end (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); hbbox = gtk_hbutton_box_new (); gtk_box_set_spacing (GTK_BOX (hbbox), 4); gtk_box_pack_start (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0); gtk_widget_show (hbbox); gtk_box_pack_start (GTK_BOX (hbbox), image_map_tool->load_button, FALSE, FALSE, 0); gtk_widget_show (image_map_tool->load_button); gtk_box_pack_start (GTK_BOX (hbbox), image_map_tool->save_button, FALSE, FALSE, 0); gtk_widget_show (image_map_tool->save_button); hbbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0); gtk_widget_show (hbbox); button = gtk_button_new_with_mnemonic (_("_Auto")); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gimp_help_set_help_data (button, _("Adjust levels automatically"), NULL); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (levels_stretch_callback), tool); button = gimp_levels_tool_color_picker_new (tool, LOW_INPUT | ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_levels_tool_color_picker_new (tool, GAMMA | ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_levels_tool_color_picker_new (tool, HIGH_INPUT | ALL_CHANNELS); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (image_map_tool->shell, "unmap", G_CALLBACK (gimp_levels_tool_dialog_unmap), tool); }
GtkWidget * gimp_ink_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpInkOptions *ink_options = GIMP_INK_OPTIONS (tool_options); GtkWidget *vbox = gimp_paint_options_gui (tool_options); GtkWidget *frame; GtkWidget *vbox2; GtkWidget *scale; GtkWidget *blob_box; GtkWidget *hbox; GtkWidget *editor; GtkSizeGroup *size_group; /* adjust sliders */ frame = gimp_frame_new (_("Adjustment")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show (frame); vbox2 = gtk_vbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); /* size slider */ scale = gimp_prop_spin_scale_new (config, "size", _("Size"), 1.0, 2.0, 1); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* angle adjust slider */ scale = gimp_prop_spin_scale_new (config, "tilt-angle", _("Angle"), 1.0, 10.0, 1); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* sens sliders */ frame = gimp_frame_new (_("Sensitivity")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show (frame); vbox2 = gtk_vbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); /* size sens slider */ scale = gimp_prop_spin_scale_new (config, "size-sensitivity", _("Size"), 0.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* tilt sens slider */ scale = gimp_prop_spin_scale_new (config, "tilt-sensitivity", _("Tilt"), 0.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* velocity sens slider */ scale = gimp_prop_spin_scale_new (config, "vel-sensitivity", _("Speed"), 0.01, 0.1, 2); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* Blob shape widgets */ frame = gimp_frame_new (_("Shape")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); /* Blob type radiobuttons */ blob_box = gimp_prop_enum_stock_box_new (config, "blob-type", "gimp-shape", 0, 0); gtk_orientable_set_orientation (GTK_ORIENTABLE (blob_box), GTK_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX (hbox), blob_box, FALSE, FALSE, 0); gtk_widget_show (blob_box); gtk_size_group_add_widget (size_group, blob_box); /* Blob editor */ frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); gtk_size_group_add_widget (size_group, frame); editor = gimp_blob_editor_new (ink_options->blob_type, ink_options->blob_aspect, ink_options->blob_angle); gtk_container_add (GTK_CONTAINER (frame), editor); gtk_widget_show (editor); gimp_config_connect (config, G_OBJECT (editor), "blob-type"); gimp_config_connect (config, G_OBJECT (editor), "blob-aspect"); gimp_config_connect (config, G_OBJECT (editor), "blob-angle"); return vbox; }
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); } }
/** * gimp_transform_options_gui: * @tool_options: a #GimpToolOptions * * Build the Transform Tool Options. * * Return value: a container holding the transform tool options **/ GtkWidget * gimp_transform_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *box; GtkWidget *label; GtkWidget *frame; GtkWidget *combo; GtkWidget *scale; GtkWidget *grid_box; const gchar *constrain_name = NULL; const gchar *constrain_label = NULL; const gchar *constrain_tip = NULL; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Transform:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); box = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); gtk_widget_show (box); frame = gimp_prop_enum_radio_frame_new (config, "direction", _("Direction"), 0, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the interpolation menu */ combo = gimp_prop_enum_combo_box_new (config, "interpolation", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Interpolation")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the clipping menu */ combo = gimp_prop_enum_combo_box_new (config, "clip", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Clipping")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the preview frame */ scale = gimp_prop_spin_scale_new (config, "preview-opacity", _("Image opacity"), 0.01, 0.1, 0); gimp_prop_widget_set_factor (scale, 100.0, 1); frame = gimp_prop_expanding_frame_new (config, "show-preview", _("Show image preview"), scale, NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the guides frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the guides type menu */ combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Guides")); g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_frame_set_label_widget (GTK_FRAME (frame), combo); gtk_widget_show (combo); /* the grid density scale */ scale = gimp_prop_spin_scale_new (config, "grid-size", NULL, 1.8, 8.0, 0); gtk_container_add (GTK_CONTAINER (frame), scale); g_object_bind_property_full (config, "grid-type", scale, "visible", G_BINDING_SYNC_CREATE, gimp_transform_options_sync_grid, NULL, NULL, NULL); if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL) { constrain_name = "constrain-rotate"; constrain_label = _("15 degrees (%s)"); constrain_tip = _("Limit rotation steps to 15 degrees"); } else if (tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL) { constrain_name = "constrain-scale"; constrain_label = _("Keep aspect (%s)"); constrain_tip = _("Keep the original aspect ratio"); } //TODO: check that the selection tools use the gimp_get_*_mask() functions for constrain/etc or change to what they use else if (tool_options->tool_info->tool_type == GIMP_TYPE_UNIFIED_TRANSFORM_TOOL) { GdkModifierType shift = gimp_get_extend_selection_mask (); GdkModifierType ctrl = gimp_get_constrain_behavior_mask (); struct { GdkModifierType mod; gchar *name; gchar *desc; gchar *tip; } opt_list[] = { { shift, NULL, "Constrain (%s)" }, { shift, "constrain-move", "Move", "Constrain movement to 45 degree angles from center (%s)" }, { shift, "constrain-scale", "Scale", "Maintain aspect ratio when scaling (%s)" }, { shift, "constrain-rotate", "Rotate", "Constrain rotation to 15 degree increments (%s)" }, { shift, "constrain-shear", "Shear", "Shear along edge direction only (%s)" }, { shift, "constrain-perspective", "Perspective", "Constrain perspective handles to move along edges and diagonal (%s)" }, { ctrl, NULL, "From pivot (%s)" }, { ctrl, "frompivot-scale", "Scale", "Scale from pivot point (%s)" }, { ctrl, "frompivot-shear", "Shear", "Shear opposite edge by same amount (%s)" }, { ctrl, "frompivot-perspective", "Perspective", "Maintain position of pivot while changing perspective (%s)" }, { 0, NULL, "Pivot" }, { shift, "cornersnap", "Snap (%s)", "Snap pivot to corners and center (%s)" }, { 0, "fixedpivot", "Lock", "Lock pivot position to canvas" }, }; GtkWidget *button; gchar *label; gint i; frame = NULL; for (i = 0; i < G_N_ELEMENTS (opt_list); i++) { if (!opt_list[i].name && !opt_list[i].desc) { frame = NULL; continue; } label = g_strdup_printf (opt_list[i].desc, gimp_get_mod_string (opt_list[i].mod)); if (opt_list[i].name) { button = gimp_prop_check_button_new (config, opt_list[i].name, label); gtk_box_pack_start (GTK_BOX (frame ? grid_box : vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_free (label); label = g_strdup_printf (opt_list[i].tip, gimp_get_mod_string (opt_list[i].mod)); gimp_help_set_help_data (button, label, NULL); } else { frame = gimp_frame_new (label); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); grid_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_container_add (GTK_CONTAINER (frame), grid_box); gtk_widget_show (grid_box); } g_free (label); } } if (constrain_label) { GtkWidget *button; gchar *label; GdkModifierType constrain_mask; constrain_mask = gimp_get_extend_selection_mask (); label = g_strdup_printf (constrain_label, gimp_get_mod_string (constrain_mask)); button = gimp_prop_check_button_new (config, constrain_name, label); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); gimp_help_set_help_data (button, constrain_tip, NULL); g_free (label); } return vbox; }
GtkWidget * gimp_text_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpTextOptions *options = GIMP_TEXT_OPTIONS (tool_options); GtkWidget *main_vbox = gimp_tool_options_gui (tool_options); GtkWidget *table; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *entry; GtkWidget *box; GtkWidget *spinbutton; GtkWidget *combo; GtkSizeGroup *size_group; gint row = 0; hbox = gimp_prop_font_box_new (NULL, GIMP_CONTEXT (tool_options), _("Font"), 2, "font-view-type", "font-view-size"); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); entry = gimp_prop_size_entry_new (config, "font-size", FALSE, "font-size-unit", "%p", GIMP_SIZE_ENTRY_UPDATE_SIZE, 72.0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Size:"), 0.0, 0.5, entry, 2, FALSE); options->size_entry = entry; vbox = gtk_vbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); button = gimp_prop_check_button_new (config, "use-editor", _("Use editor")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); button = gimp_prop_check_button_new (config, "antialias", _("Antialiasing")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); table = gtk_table_new (6, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); row = 0; size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); button = gimp_prop_enum_combo_box_new (config, "hint-style", -1, -1); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Hinting:"), 0.0, 0.5, button, 1, TRUE); gtk_size_group_add_widget (size_group, button); button = gimp_prop_color_button_new (config, "foreground", _("Text Color"), 40, 24, GIMP_COLOR_AREA_FLAT); gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), GIMP_CONTEXT (options)); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Color:"), 0.0, 0.5, button, 1, TRUE); gtk_size_group_add_widget (size_group, button); box = gimp_prop_enum_stock_box_new (config, "justify", "gtk-justify", 0, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Justify:"), 0.0, 0.5, box, 2, TRUE); gtk_size_group_add_widget (size_group, box); g_object_unref (size_group); spinbutton = gimp_prop_spin_button_new (config, "indent", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GTK_STOCK_INDENT, spinbutton, 1, TRUE); spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GIMP_STOCK_LINE_SPACING, spinbutton, 1, TRUE); spinbutton = gimp_prop_spin_button_new (config, "letter-spacing", 1.0, 10.0, 1); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5); gimp_table_attach_stock (GTK_TABLE (table), row++, GIMP_STOCK_LETTER_SPACING, spinbutton, 1, TRUE); combo = gimp_prop_enum_combo_box_new (config, "box-mode", 0, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("Box:"), 0.0, 0.5, combo, 1, TRUE); /* Only add the language entry if the iso-codes package is available. */ #ifdef HAVE_ISO_CODES { GtkWidget *label; vbox = gtk_vbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Language:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); entry = gimp_prop_language_entry_new (config, "language"); gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0); gtk_widget_show (entry); } #endif return main_vbox; }