Exemple #1
0
static void
gimp_dynamics_editor_set_data (GimpDataEditor *editor,
                               GimpData       *data)
{
  GimpDynamicsEditor *dynamics_editor = GIMP_DYNAMICS_EDITOR (editor);

  if (editor->data)
    g_signal_handlers_disconnect_by_func (editor->data,
                                          gimp_dynamics_editor_notify_data,
                                          editor);

  GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);

  if (editor->data)
    {
      g_signal_handlers_block_by_func (dynamics_editor->dynamics_model,
                                       gimp_dynamics_editor_notify_model,
                                       editor);

      gimp_config_copy (GIMP_CONFIG (editor->data),
                        GIMP_CONFIG (dynamics_editor->dynamics_model),
                        GIMP_CONFIG_PARAM_SERIALIZE);

      g_signal_handlers_unblock_by_func (dynamics_editor->dynamics_model,
                                         gimp_dynamics_editor_notify_model,
                                         editor);

      g_signal_connect (editor->data, "notify",
                        G_CALLBACK (gimp_dynamics_editor_notify_data),
                        editor);
    }

  gtk_widget_set_sensitive (dynamics_editor->notebook, editor->data_editable);
}
Exemple #2
0
static void
gimp_brush_editor_set_data (GimpDataEditor *editor,
                            GimpData       *data)
{
  GimpBrushEditor         *brush_editor = GIMP_BRUSH_EDITOR (editor);
  GimpBrushGeneratedShape  shape        = GIMP_BRUSH_GENERATED_CIRCLE;
  gdouble                  radius       = 0.0;
  gint                     spikes       = 2;
  gdouble                  hardness     = 0.0;
  gdouble                  ratio        = 0.0;
  gdouble                  angle        = 0.0;
  gdouble                  spacing      = 0.0;

  if (editor->data)
    g_signal_handlers_disconnect_by_func (editor->data,
                                          gimp_brush_editor_notify_brush,
                                          editor);

  GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);

  if (editor->data)
    g_signal_connect (editor->data, "notify",
                      G_CALLBACK (gimp_brush_editor_notify_brush),
                      editor);

  gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (data));

  if (editor->data)
    {
      spacing = gimp_brush_get_spacing (GIMP_BRUSH (editor->data));

      if (GIMP_IS_BRUSH_GENERATED (editor->data))
        {
          GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (editor->data);

          shape    = gimp_brush_generated_get_shape        (brush);
          radius   = gimp_brush_generated_get_radius       (brush);
          spikes   = gimp_brush_generated_get_spikes       (brush);
          hardness = gimp_brush_generated_get_hardness     (brush);
          ratio    = gimp_brush_generated_get_aspect_ratio (brush);
          angle    = gimp_brush_generated_get_angle        (brush);
        }
    }

  gtk_widget_set_sensitive (brush_editor->options_box,
                            editor->data_editable);

  gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (brush_editor->shape_group),
                                   shape);

  gtk_adjustment_set_value (brush_editor->radius_data,       radius);
  gtk_adjustment_set_value (brush_editor->spikes_data,       spikes);
  gtk_adjustment_set_value (brush_editor->hardness_data,     hardness);
  gtk_adjustment_set_value (brush_editor->aspect_ratio_data, ratio);
  gtk_adjustment_set_value (brush_editor->angle_data,        angle);
  gtk_adjustment_set_value (brush_editor->spacing_data,      spacing);
}
Exemple #3
0
static void
gimp_brush_editor_class_init (GimpBrushEditorClass *klass)
{
  GObjectClass        *object_class = G_OBJECT_CLASS (klass);
  GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);

  object_class->constructor = gimp_brush_editor_constructor;

  editor_class->set_data    = gimp_brush_editor_set_data;
  editor_class->title       = _("Brush Editor");
}
Exemple #4
0
static void
gimp_dynamics_editor_class_init (GimpDynamicsEditorClass *klass)
{
  GObjectClass        *object_class = G_OBJECT_CLASS (klass);
  GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);

  object_class->constructed = gimp_dynamics_editor_constructed;
  object_class->finalize    = gimp_dynamics_editor_finalize;

  editor_class->set_data    = gimp_dynamics_editor_set_data;
  editor_class->title       = _("Paint Dynamics Editor");
}
static void
gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
{
    GObjectClass        *object_class = G_OBJECT_CLASS (klass);
    GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);

    object_class->constructed = gimp_tool_preset_editor_constructed;
    object_class->finalize    = gimp_tool_preset_editor_finalize;

    editor_class->set_data    = gimp_tool_preset_editor_set_data;
    editor_class->title       = _("Tool Preset Editor");
}
Exemple #6
0
static void
gimp_palette_editor_set_data (GimpDataEditor *editor,
                              GimpData       *data)
{
  GimpPaletteEditor *palette_editor = GIMP_PALETTE_EDITOR (editor);

  g_signal_handlers_block_by_func (palette_editor->columns_adj,
                                   palette_editor_columns_changed,
                                   editor);

  if (editor->data)
    {
      if (palette_editor->color_dialog)
        {
          gtk_widget_destroy (palette_editor->color_dialog);
          palette_editor->color_dialog = NULL;
        }

      g_signal_handlers_disconnect_by_func (editor->data,
                                            palette_editor_invalidate_preview,
                                            editor);

      gtk_adjustment_set_value (palette_editor->columns_adj, 0);
    }

  GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);

  gimp_view_set_viewable (GIMP_VIEW (palette_editor->view),
                          GIMP_VIEWABLE (data));

  if (editor->data)
    {
      GimpPalette *palette = GIMP_PALETTE (editor->data);

      g_signal_connect (editor->data, "invalidate-preview",
                        G_CALLBACK (palette_editor_invalidate_preview),
                        editor);

      gtk_adjustment_set_value (palette_editor->columns_adj,
                                gimp_palette_get_columns (palette));

      palette_editor_scroll_top_left (palette_editor);

      palette_editor_invalidate_preview (GIMP_PALETTE (editor->data),
                                         palette_editor);
    }

  g_signal_handlers_unblock_by_func (palette_editor->columns_adj,
                                     palette_editor_columns_changed,
                                     editor);
}
Exemple #7
0
static void
gimp_palette_editor_class_init (GimpPaletteEditorClass *klass)
{
  GObjectClass        *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass      *widget_class = GTK_WIDGET_CLASS (klass);
  GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);

  object_class->constructed = gimp_palette_editor_constructed;
  object_class->dispose     = gimp_palette_editor_dispose;

  widget_class->unmap       = gimp_palette_editor_unmap;

  editor_class->set_data    = gimp_palette_editor_set_data;
  editor_class->title       = _("Palette Editor");
}
static void
gimp_tool_preset_editor_set_data (GimpDataEditor *editor,
                                  GimpData       *data)
{
    GimpToolPresetEditor *preset_editor = GIMP_TOOL_PRESET_EDITOR (editor);

    if (editor->data)
        g_signal_handlers_disconnect_by_func (editor->data,
                                              gimp_tool_preset_editor_notify_data,
                                              editor);

    GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);

    if (editor->data)
    {
        GimpToolInfo *tool_info;
        const gchar  *stock_id;
        gchar        *label;

        g_signal_handlers_block_by_func (preset_editor->tool_preset_model,
                                         gimp_tool_preset_editor_notify_model,
                                         editor);

        gimp_config_copy (GIMP_CONFIG (editor->data),
                          GIMP_CONFIG (preset_editor->tool_preset_model),
                          GIMP_CONFIG_PARAM_SERIALIZE);

        g_signal_handlers_unblock_by_func (preset_editor->tool_preset_model,
                                           gimp_tool_preset_editor_notify_model,
                                           editor);

        g_signal_connect (editor->data, "notify",
                          G_CALLBACK (gimp_tool_preset_editor_notify_data),
                          editor);

        tool_info = preset_editor->tool_preset_model->tool_options->tool_info;

        stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
        label    = g_strdup_printf (_("%s Preset"), tool_info->blurb);

        gtk_image_set_from_stock (GTK_IMAGE (preset_editor->tool_icon),
                                  stock_id, GTK_ICON_SIZE_MENU);
        gtk_label_set_text (GTK_LABEL (preset_editor->tool_label), label);

        g_free (label);
    }
}