Exemplo n.º 1
0
GtkWidget *
gimp_color_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *frame;
  GtkWidget *scale;
  GtkWidget *button;

  /*  the sample average options  */
  frame = gimp_frame_new (NULL);
  gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
  gtk_widget_show (frame);

  scale = gimp_prop_spin_scale_new (config, "average-radius", NULL,
                                    1.0, 10.0, 0);
  gtk_container_add (GTK_CONTAINER (frame), scale);
  gtk_widget_show (scale);

  button = gimp_prop_check_button_new (config, "sample-average", NULL);
  gtk_frame_set_label_widget (GTK_FRAME (frame), button);
  gtk_widget_show (button);

  g_object_bind_property (config, "sample-average",
                          scale,  "sensitive",
                          G_BINDING_SYNC_CREATE);

  return vbox;
}
Exemplo n.º 2
0
GtkWidget *
gimp_crop_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *vbox_rectangle;
  GtkWidget *button;

  /*  layer toggle  */
  button = gimp_prop_check_button_new (config, "layer-only",
                                       _("Current layer only"));
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  /*  allow growing toggle  */
  button = gimp_prop_check_button_new (config, "allow-growing",
                                       _("Allow growing"));
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  /*  rectangle options  */
  vbox_rectangle = gimp_rectangle_options_gui (tool_options);
  gtk_box_pack_start (GTK_BOX (vbox), vbox_rectangle, FALSE, FALSE, 0);
  gtk_widget_show (vbox_rectangle);

  return vbox;
}
GtkWidget *
gimp_magnify_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *frame;
  GtkWidget *button;
  gchar     *str;

  /*  the auto_resize toggle button  */
  button = gimp_prop_check_button_new (config, "auto-resize",
                                       _("Auto-resize window"));
  gtk_box_pack_start (GTK_BOX (vbox),  button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  /*  tool toggle  */
  str = g_strdup_printf (_("Tool Toggle  (%s)"),
                         gimp_get_mod_string (GDK_CONTROL_MASK));

  frame = gimp_prop_enum_radio_frame_new (config, "zoom-type",
                                          str, 0, 0);
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  g_free (str);

  return vbox;
}
Exemplo n.º 4
0
GtkWidget *
gimp_measure_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *button;

  /*  the use_info_window toggle button  */
  button = gimp_prop_check_button_new (config, "use-info-window", NULL);
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  return vbox;
}
Exemplo n.º 5
0
GtkWidget *
gimp_seamless_clone_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *scale;

  scale = gimp_prop_spin_scale_new (config, "max-refine-scale",
                                    _("Refinement scale"),
                                    1.0, 10.0, 0);
  gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 50.0);
  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
  gtk_widget_show (scale);

  return vbox;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 7
0
GtkWidget *
gimp_cage_options_gui (GimpToolOptions *tool_options)
{
  GObject   *config = G_OBJECT (tool_options);
  GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
  GtkWidget *mode;
  GtkWidget *button;

  mode = gimp_prop_enum_radio_box_new (config, "cage-mode", 0, 0);
  gtk_box_pack_start (GTK_BOX (vbox), mode, FALSE, FALSE, 0);
  gtk_widget_show (mode);

  button = gimp_prop_check_button_new (config, "fill-plain-color",
                                       _("Fill from first point"));
  gtk_box_pack_start (GTK_BOX (vbox),  button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  return vbox;
}
Exemplo n.º 8
0
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;
  GdkModifierType  toggle_mask;

  toggle_mask = gimp_get_toggle_behavior_mask ();

  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 (_("Affect:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  box = gimp_prop_enum_icon_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 (toggle_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;
}
Exemplo n.º 9
0
GtkWidget *
gimp_paint_options_gui (GimpToolOptions *tool_options)
{
  GObject          *config  = G_OBJECT (tool_options);
  GimpPaintOptions *options = GIMP_PAINT_OPTIONS (tool_options);
  GtkWidget        *vbox    = gimp_tool_options_gui (tool_options);
  GtkWidget        *hbox;
  GtkWidget        *menu;
  GtkWidget        *label;
  GtkWidget        *scale;
  GType             tool_type;

  tool_type = tool_options->tool_info->tool_type;

  /*  the paint mode menu  */
  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 (_("Mode:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  menu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE, FALSE);
  gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0);
  gtk_widget_show (menu);

  if (tool_type == GIMP_TYPE_ERASER_TOOL     ||
      tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
    {
      gtk_widget_set_sensitive (menu, FALSE);
      gtk_widget_set_sensitive (label, FALSE);
    }

  /*  the opacity scale  */
  scale = gimp_prop_opacity_spin_scale_new (config, "opacity",
                                            _("Opacity"));
  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
  gtk_widget_show (scale);

  /*  the brush  */
  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
    {
      GtkWidget *button;
      GtkWidget *hbox;
      GtkWidget *frame;

      button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options),
                                        _("Brush"), 2,
                                        "brush-view-type", "brush-view-size",
                                        "gimp-brush-editor");
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
      gtk_widget_show (hbox);

      scale = gimp_prop_spin_scale_new (config, "brush-size",
                                        _("Size"),
                                        0.01, 1.0, 2);
      gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);
      gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.7);
      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
      gtk_widget_show (scale);

      button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
      gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
                                GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      g_signal_connect (button, "clicked",
                        G_CALLBACK (gimp_paint_options_gui_reset_size),
                        options);

      gimp_help_set_help_data (button,
                               _("Reset size to brush's native size"), NULL);

      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
      gtk_widget_show (hbox);

      scale = gimp_prop_spin_scale_new (config, "brush-aspect-ratio",
                                        _("Aspect Ratio"),
                                        0.01, 0.1, 2);
      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
      gtk_widget_show (scale);

      button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
      gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
                                GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      g_signal_connect (button, "clicked",
                        G_CALLBACK (gimp_paint_options_gui_reset_aspect_ratio),
                        options);

      gimp_help_set_help_data (button,
                               _("Reset aspect ratio to brush's native"), NULL);

      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
      gtk_widget_show (hbox);

      scale = gimp_prop_spin_scale_new (config, "brush-angle",
                                        _("Angle"),
                                        1.0, 5.0, 2);
      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
      gtk_widget_show (scale);

      button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
      gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
                                GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      g_signal_connect (button, "clicked",
                        G_CALLBACK (gimp_paint_options_gui_reset_angle),
                        options);

      gimp_help_set_help_data (button,
                               _("Reset angle to zero"), NULL);

      button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
                                           _("Dynamics"), 2,
                                           "dynamics-view-type",
                                           "dynamics-view-size",
                                           "gimp-dynamics-editor");
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      frame = dynamics_options_gui (options, tool_type);
      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
      gtk_widget_show (frame);

      frame = jitter_options_gui (options, tool_type);
      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
      gtk_widget_show (frame);
    }

  /*  the "smooth stroke" options  */
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINT_TOOL))
    {
      GtkWidget *frame;

      frame = smoothing_options_gui (options, tool_type);
      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
      gtk_widget_show (frame);
    }

  /*  the "incremental" toggle  */
  if (tool_type == GIMP_TYPE_PENCIL_TOOL     ||
      tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
      tool_type == GIMP_TYPE_ERASER_TOOL)
    {
      GtkWidget *button;

      button = gimp_prop_enum_check_button_new (config,
                                                "application-mode",
                                                _("Incremental"),
                                                GIMP_PAINT_CONSTANT,
                                                GIMP_PAINT_INCREMENTAL);
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);
    }

  /* the "hard edge" toggle */
  if (tool_type == GIMP_TYPE_ERASER_TOOL            ||
      tool_type == GIMP_TYPE_CLONE_TOOL             ||
      tool_type == GIMP_TYPE_HEAL_TOOL              ||
      tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
      tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
    {
      GtkWidget *button;

      button = gimp_prop_check_button_new (config, "hard", _("Hard edge"));
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);
    }

  return vbox;
}
Exemplo n.º 10
0
void
gimp_tools_restore (Gimp *gimp)
{
  GimpContainer *gimp_list;
  GimpObject    *object;
  GFile         *file;
  GList         *list;
  GError        *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  gimp_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE);

  file = gimp_directory_file ("toolrc", NULL);

  if (gimp->be_verbose)
    g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));

  if (gimp_config_deserialize_gfile (GIMP_CONFIG (gimp_list), file,
                                     NULL, NULL))
    {
      gint n = gimp_container_get_n_children (gimp->tool_info_list);
      gint i;

      gimp_list_reverse (GIMP_LIST (gimp_list));

      for (list = GIMP_LIST (gimp_list)->list, i = 0;
           list;
           list = g_list_next (list), i++)
        {
          const gchar *name;

          name = gimp_object_get_name (list->data);

          object = gimp_container_get_child_by_name (gimp->tool_info_list,
                                                     name);

          if (object)
            {
              g_object_set (object,
                            "visible", GIMP_TOOL_INFO (list->data)->visible,
                            NULL);

              gimp_container_reorder (gimp->tool_info_list,
                                      object, MIN (i, n - 1));
            }
        }
    }

  g_object_unref (file);
  g_object_unref (gimp_list);

  /* make the generic operation tool invisible by default */
  object = gimp_container_get_child_by_name (gimp->tool_info_list,
                                             "gimp-operation-tool");
  if (object)
    g_object_set (object, "visible", FALSE, NULL);

  for (list = gimp_get_tool_info_iter (gimp);
       list;
       list = g_list_next (list))
    {
      GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data);

      /*  get default values from prefs (see bug #120832)  */
      gimp_config_reset (GIMP_CONFIG (tool_info->tool_options));
    }

  if (! gimp_contexts_load (gimp, &error))
    {
      gimp_message_literal (gimp, NULL, GIMP_MESSAGE_WARNING, error->message);
      g_clear_error (&error);
    }

  /*  make sure there is always a tool active, so broken config files
   *  can't leave us with no initial tool
   */
  if (! gimp_context_get_tool (gimp_get_user_context (gimp)))
    {
      gimp_context_set_tool (gimp_get_user_context (gimp),
                             gimp_get_tool_info_iter (gimp)->data);
    }

  for (list = gimp_get_tool_info_iter (gimp);
       list;
       list = g_list_next (list))
    {
      GimpToolInfo           *tool_info = GIMP_TOOL_INFO (list->data);
      GimpToolOptionsGUIFunc  options_gui_func;
      GtkWidget              *options_gui;

      /*  copy all context properties except those the tool actually
       *  uses, because the subsequent deserialize() on the tool
       *  options will only set the properties that were set to
       *  non-default values at the time of saving, and we want to
       *  keep these default values as if they have been saved.
       * (see bug #541586).
       */
      gimp_context_copy_properties (gimp_get_user_context (gimp),
                                    GIMP_CONTEXT (tool_info->tool_options),
                                    GIMP_CONTEXT_PROP_MASK_ALL &~
                                    (tool_info->context_props    |
                                     GIMP_CONTEXT_PROP_MASK_TOOL |
                                     GIMP_CONTEXT_PROP_MASK_PAINT_INFO));

      gimp_tool_options_deserialize (tool_info->tool_options, NULL);

      options_gui_func = g_object_get_data (G_OBJECT (tool_info),
                                            "gimp-tool-options-gui-func");

      if (options_gui_func)
        {
          options_gui = (* options_gui_func) (tool_info->tool_options);
        }
      else
        {
          GtkWidget *label;

          options_gui = gimp_tool_options_gui (tool_info->tool_options);

          label = gtk_label_new (_("This tool has\nno options."));
          gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
          gimp_label_set_attributes (GTK_LABEL (label),
                                     PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
                                     -1);
          gtk_box_pack_start (GTK_BOX (options_gui), label, FALSE, FALSE, 6);
          gtk_widget_show (label);
        }

      gimp_tools_set_tool_options_gui (tool_info->tool_options,
                                       g_object_ref_sink (options_gui));
    }
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
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);
  GimpAsyncSet    *async_set;
  GtkWidget       *options_vbox;
  GtkWidget       *grid;
  GtkWidget       *vbox;
  GtkWidget       *hbox;
  GtkWidget       *button;
  GtkWidget       *entry;
  GtkWidget       *box;
  GtkWidget       *spinbutton;
  GtkWidget       *combo;
  GtkSizeGroup    *size_group;
  gint             row = 0;

  async_set =
    gimp_data_factory_get_async_set (tool_options->tool_info->gimp->font_factory);

  box = gimp_busy_box_new (_("Loading fonts (this may take a while...)"));
  gtk_container_set_border_width (GTK_CONTAINER (box), 8);
  gtk_box_pack_start (GTK_BOX (main_vbox), box, FALSE, FALSE, 0);

  g_object_bind_property (async_set, "empty",
                          box,       "visible",
                          G_BINDING_SYNC_CREATE |
                          G_BINDING_INVERT_BOOLEAN);

  options_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL,
                              gtk_box_get_spacing (GTK_BOX (main_vbox)));
  gtk_box_pack_start (GTK_BOX (main_vbox), options_vbox, FALSE, FALSE, 0);
  gtk_widget_show (options_vbox);

  g_object_bind_property (async_set,    "empty",
                          options_vbox, "sensitive",
                          G_BINDING_SYNC_CREATE);

  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 (options_vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  grid = gtk_grid_new ();
  gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
  gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
  gtk_box_pack_start (GTK_BOX (options_vbox), grid, FALSE, FALSE, 0);
  gtk_widget_show (grid);

  entry = gimp_prop_size_entry_new (config,
                                    "font-size", FALSE, "font-size-unit", "%p",
                                    GIMP_SIZE_ENTRY_UPDATE_SIZE, 72.0);
  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
                            _("Size:"), 0.0, 0.5,
                            entry, 2);

  options->size_entry = entry;

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
  gtk_box_pack_start (GTK_BOX (options_vbox), vbox, FALSE, FALSE, 0);
  gtk_widget_show (vbox);

  button = gimp_prop_check_button_new (config, "use-editor", NULL);
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  button = gimp_prop_check_button_new (config, "antialias", NULL);
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  grid = gtk_grid_new ();
  gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
  gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
  gtk_box_pack_start (GTK_BOX (options_vbox), grid, FALSE, FALSE, 0);
  gtk_widget_show (grid);

  row = 0;

  size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

  button = gimp_prop_enum_combo_box_new (config, "hint-style", -1, -1);
  gtk_widget_set_halign (button, GTK_ALIGN_START);
  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
                            _("Hinting:"), 0.0, 0.5,
                            button, 1);
  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));
  gtk_widget_set_halign (button, GTK_ALIGN_START);
  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
                            _("Color:"), 0.0, 0.5,
                            button, 1);
  gtk_size_group_add_widget (size_group, button);

  box = gimp_prop_enum_icon_box_new (config, "justify", "format-justify", 0, 0);
  gtk_widget_set_halign (box, GTK_ALIGN_START);
  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
                            _("Justify:"), 0.0, 0.5,
                            box, 2);
  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);
  gtk_widget_set_halign (spinbutton, GTK_ALIGN_START);
  gimp_grid_attach_icon (GTK_GRID (grid), row++,
                         GIMP_ICON_FORMAT_INDENT_MORE,
                         spinbutton, 1);

  spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1);
  gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
  gtk_widget_set_halign (spinbutton, GTK_ALIGN_START);
  gimp_grid_attach_icon (GTK_GRID (grid), row++,
                         GIMP_ICON_FORMAT_TEXT_SPACING_LINE,
                         spinbutton, 1);

  spinbutton = gimp_prop_spin_button_new (config,
                                          "letter-spacing", 1.0, 10.0, 1);
  gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
  gtk_widget_set_halign (spinbutton, GTK_ALIGN_START);
  gimp_grid_attach_icon (GTK_GRID (grid), row++,
                         GIMP_ICON_FORMAT_TEXT_SPACING_LETTER,
                         spinbutton, 1);

  combo = gimp_prop_enum_combo_box_new (config, "box-mode", 0, 0);
  gtk_widget_set_halign (combo, GTK_ALIGN_START);
  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
                            _("Box:"), 0.0, 0.5,
                            combo, 1);

  /*  Only add the language entry if the iso-codes package is available.  */

#ifdef HAVE_ISO_CODES
  {
    GtkWidget *label;

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    gtk_box_pack_start (GTK_BOX (options_vbox), vbox, FALSE, FALSE, 0);
    gtk_widget_show (vbox);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 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;
}
Exemplo n.º 13
0
GtkWidget *
gimp_warp_options_gui (GimpToolOptions *tool_options)
{
    GimpWarpOptions *options = GIMP_WARP_OPTIONS (tool_options);
    GObject         *config  = G_OBJECT (tool_options);
    GtkWidget       *vbox    = gimp_tool_options_gui (tool_options);
    GtkWidget       *frame;
    GtkWidget       *anim_vbox;
    GtkWidget       *combo;
    GtkWidget       *scale;

    combo = gimp_prop_enum_combo_box_new (config, "behavior", 0, 0);
    g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
    gtk_widget_show (combo);

    scale = gimp_prop_spin_scale_new (config, "effect-strength",
                                      _("Strength"),
                                      1, 10, 1);
    gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 100.0);
    gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
    gtk_widget_show (scale);

    scale = gimp_prop_spin_scale_new (config, "effect-size",
                                      _("Size"),
                                      0.01, 1.0, 2);
    gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);
    gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
    gtk_widget_show (scale);

    scale = gimp_prop_spin_scale_new (config, "effect-hardness",
                                      _("Hardness"),
                                      0.01, 1.0, 2);
    gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 1.0);
    gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
    gtk_widget_show (scale);

    /*  the animation frame  */
    frame = gimp_frame_new (_("Animate"));
    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
    gtk_widget_show (frame);

    anim_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    gtk_container_add (GTK_CONTAINER (frame), anim_vbox);
    gtk_widget_show (anim_vbox);

    scale = gimp_prop_spin_scale_new (config, "n-animation-frames",
                                      _("Frames"),
                                      1.0, 10.0, 0);
    gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 3.0, 100.0);
    gtk_box_pack_start (GTK_BOX (anim_vbox), scale, FALSE, FALSE, 0);
    gtk_widget_show (scale);

    options->animate_button = gtk_button_new_with_label (_("Create Animation"));
    gtk_widget_set_sensitive (options->animate_button, FALSE);
    gtk_box_pack_start (GTK_BOX (anim_vbox), options->animate_button,
                        FALSE, FALSE, 0);
    gtk_widget_show (options->animate_button);

    g_object_add_weak_pointer (G_OBJECT (options->animate_button),
                               (gpointer) &options->animate_button);

    return vbox;
}
Exemplo n.º 14
0
/**
 * 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_icon_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, 0.0, 0.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);
  gimp_spin_scale_set_label (GIMP_SPIN_SCALE (scale), NULL);
  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;
}
Exemplo n.º 15
0
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;
}