示例#1
0
/**
 * gimp_gradient_select_widget_set:
 * @widget:        A gradient select widget.
 * @gradient_name: Gradient name to set.
 *
 * Sets the current gradient for the gradient select widget.  Calls the
 * callback function if one was supplied in the call to
 * gimp_gradient_select_widget_new().
 */
void
gimp_gradient_select_widget_set (GtkWidget   *widget,
                                 const gchar *gradient_name)
{
  g_return_if_fail (widget != NULL);

  gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (widget),
                                            gradient_name);
}
示例#2
0
/*
 * gfig_style_set_content_from_style() sets all of the style control widgets
 * to values from the specified style.  This in turn sets the Gimp core's
 * values to the same things.  Repainting is suppressed while this happens,
 * so calling this function will not produce a repaint.
 *
 */
void
gfig_style_set_context_from_style (Style *style)
{
  gboolean enable_repaint;

  if (gfig_context->debug_styles)
    g_printerr ("Setting context from style '%s' -- ", style->name);

  enable_repaint = gfig_context->enable_repaint;
  gfig_context->enable_repaint = FALSE;

  gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button),
                               &style->foreground);
  gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
                               &style->background);
  if (!gimp_context_set_brush (style->brush_name))
    g_message ("Style from context: Failed to set brush to '%s'",
               style->brush_name);

  gimp_brush_select_button_set_brush (GIMP_BRUSH_SELECT_BUTTON (gfig_context->brush_select),
                                      style->brush_name, -1.0, -1, -1);  /* FIXME */

  gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (gfig_context->pattern_select),
                                          style->pattern);

  gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (gfig_context->gradient_select),
                                            style->gradient);

  gfig_context->bdesc.name = style->brush_name;
  if (gfig_context->debug_styles)
    g_printerr ("done.\n");

  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (gfig_context->fillstyle_combo),
                                 (gint) style->fill_type);

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_context->paint_type_toggle),
                                style->paint_type);
  gfig_context->enable_repaint = enable_repaint;
}
static void
script_fu_reset (SFScript *script)
{
  gint i;

  script_fu_script_reset (script, FALSE);

  for (i = 0; i < script->n_args; i++)
    {
      SFArgValue *value  = &script->args[i].value;
      GtkWidget  *widget = sf_interface->widgets[i];

      switch (script->args[i].type)
        {
        case SF_IMAGE:
        case SF_DRAWABLE:
        case SF_LAYER:
        case SF_CHANNEL:
        case SF_VECTORS:
        case SF_DISPLAY:
          break;

        case SF_COLOR:
          gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget),
                                       &value->sfa_color);
          break;

        case SF_TOGGLE:
          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
                                        value->sfa_toggle);
          break;

        case SF_VALUE:
        case SF_STRING:
          gtk_entry_set_text (GTK_ENTRY (widget), value->sfa_value);
          break;

        case SF_TEXT:
          {
            GtkWidget     *view;
            GtkTextBuffer *buffer;

            view = gtk_bin_get_child (GTK_BIN (widget));
            buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

            gtk_text_buffer_set_text (buffer, value->sfa_value, -1);
          }
          break;

        case SF_ADJUSTMENT:
          gtk_adjustment_set_value (value->sfa_adjustment.adj,
                                    value->sfa_adjustment.value);
          break;

        case SF_FILENAME:
        case SF_DIRNAME:
          gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
                                         value->sfa_file.filename);
          break;

        case SF_FONT:
          gimp_font_select_button_set_font (GIMP_FONT_SELECT_BUTTON (widget),
                                            value->sfa_font);
          break;

        case SF_PALETTE:
          gimp_palette_select_button_set_palette (GIMP_PALETTE_SELECT_BUTTON (widget),
                                                  value->sfa_palette);
          break;

        case SF_PATTERN:
          gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
                                                  value->sfa_pattern);
          break;

        case SF_GRADIENT:
          gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (widget),
                                                    value->sfa_gradient);
          break;

        case SF_BRUSH:
          gimp_brush_select_button_set_brush (GIMP_BRUSH_SELECT_BUTTON (widget),
                                              value->sfa_brush.name,
                                              value->sfa_brush.opacity,
                                              value->sfa_brush.spacing,
                                              value->sfa_brush.paint_mode);
          break;

        case SF_OPTION:
          gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
                                    value->sfa_option.history);
          break;

        case SF_ENUM:
          gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
                                         value->sfa_enum.history);
          break;
        }
    }
}