home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Linux / gimp-2.2.0.tar.gz / gimp-2.2.0.tar / gimp-2.2.0 / plug-ins / print / gimp_color_window.c < prev    next >
C/C++ Source or Header  |  2004-11-04  |  19KB  |  611 lines

  1. /*
  2.  * "$Id: gimp_color_window.c,v 1.16 2004/11/04 10:06:22 mitch Exp $"
  3.  *
  4.  *   Main window code for Print plug-in for the GIMP.
  5.  *
  6.  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com),
  7.  *    Robert Krawitz (rlk@alum.mit.edu), Steve Miller (smiller@rni.net)
  8.  *      and Michael Natterer (mitch@gimp.org)
  9.  *
  10.  *   This program is free software; you can redistribute it and/or modify it
  11.  *   under the terms of the GNU General Public License as published by the Free
  12.  *   Software Foundation; either version 2 of the License, or (at your option)
  13.  *   any later version.
  14.  *
  15.  *   This program is distributed in the hope that it will be useful, but
  16.  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  17.  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  18.  *   for more details.
  19.  *
  20.  *   You should have received a copy of the GNU General Public License
  21.  *   along with this program; if not, write to the Free Software
  22.  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23.  */
  24.  
  25. #include "config.h"
  26.  
  27. #include <string.h>
  28.  
  29. #ifdef __GNUC__
  30. #warning GTK_DISABLE_DEPRECATED
  31. #endif
  32. #undef GTK_DISABLE_DEPRECATED
  33.  
  34. #include <gtk/gtk.h>
  35.  
  36. #include <gimp-print/gimp-print.h>
  37.  
  38. #include "libgimp/gimp.h"
  39. #include "libgimp/gimpui.h"
  40.  
  41. #include "print_gimp.h"
  42.  
  43. #include "libgimp/stdplugins-intl.h"
  44.  
  45. #define RESPONSE_RESET 1
  46.  
  47. gint    thumbnail_w, thumbnail_h, thumbnail_bpp;
  48. guchar *thumbnail_data;
  49. gint    adjusted_thumbnail_bpp;
  50. guchar *adjusted_thumbnail_data;
  51.  
  52. GtkWidget *gimp_color_adjust_dialog;
  53.  
  54. static GtkObject *brightness_adjustment;
  55. static GtkObject *saturation_adjustment;
  56. static GtkObject *density_adjustment;
  57. static GtkObject *contrast_adjustment;
  58. static GtkObject *cyan_adjustment;
  59. static GtkObject *magenta_adjustment;
  60. static GtkObject *yellow_adjustment;
  61. static GtkObject *gamma_adjustment;
  62.  
  63. GtkWidget   *dither_algo_combo       = NULL;
  64. static gint  dither_algo_callback_id = -1;
  65.  
  66. static void gimp_brightness_update    (GtkAdjustment *adjustment);
  67. static void gimp_saturation_update    (GtkAdjustment *adjustment);
  68. static void gimp_density_update       (GtkAdjustment *adjustment);
  69. static void gimp_contrast_update      (GtkAdjustment *adjustment);
  70. static void gimp_cyan_update          (GtkAdjustment *adjustment);
  71. static void gimp_magenta_update       (GtkAdjustment *adjustment);
  72. static void gimp_yellow_update        (GtkAdjustment *adjustment);
  73. static void gimp_gamma_update         (GtkAdjustment *adjustment);
  74. static void gimp_set_color_defaults   (void);
  75.  
  76. static void gimp_dither_algo_callback (GtkWidget *widget,
  77.                        gpointer   data);
  78.  
  79.  
  80. void        gimp_build_dither_combo   (void);
  81.  
  82. static GtkWidget *swatch = NULL;
  83.  
  84. static void
  85. gimp_dither_algo_callback (GtkWidget *widget,
  86.                gpointer   data)
  87. {
  88.   const gchar *new_algo =
  89.     gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (dither_algo_combo)->entry));
  90.   int i;
  91.  
  92.   for (i = 0; i < stp_dither_algorithm_count (); i++)
  93.     if (strcasecmp (new_algo, stp_dither_algorithm_text (i)) == 0)
  94.       {
  95.         stp_set_dither_algorithm (*pv, stp_dither_algorithm_name (i));
  96.         return;
  97.       }
  98.  
  99.   stp_set_dither_algorithm (*pv, stp_default_dither_algorithm ());
  100. }
  101.  
  102. void
  103. gimp_build_dither_combo (void)
  104. {
  105.   stp_param_t *vec = g_new (stp_param_t, stp_dither_algorithm_count());
  106.   gint i;
  107.  
  108.   for (i = 0; i < stp_dither_algorithm_count(); i++)
  109.     {
  110.       vec[i].name = g_strdup (stp_dither_algorithm_name (i));
  111.       vec[i].text = g_strdup (stp_dither_algorithm_text (i));
  112.     }
  113.  
  114.   gimp_plist_build_combo (dither_algo_combo,
  115.               stp_dither_algorithm_count (),
  116.               vec,
  117.               stp_get_dither_algorithm (*pv),
  118.               stp_default_dither_algorithm (),
  119.               G_CALLBACK (gimp_dither_algo_callback),
  120.               &dither_algo_callback_id);
  121.  
  122.   for (i = 0; i < stp_dither_algorithm_count (); i++)
  123.     {
  124.       g_free ((void *) vec[i].name);
  125.       g_free ((void *) vec[i].text);
  126.     }
  127.   g_free (vec);
  128. }
  129.  
  130. void
  131. gimp_redraw_color_swatch (void)
  132. {
  133.   if (swatch)
  134.     gtk_widget_queue_draw (swatch);
  135. }
  136.  
  137. static gboolean
  138. gimp_color_swatch_expose (void)
  139. {
  140.   (adjusted_thumbnail_bpp == 1
  141.    ? gdk_draw_gray_image
  142.    : gdk_draw_rgb_image) (swatch->window,
  143.                           swatch->style->fg_gc[GTK_STATE_NORMAL],
  144.               0, 0, thumbnail_w, thumbnail_h,
  145.                           GDK_RGB_DITHER_NORMAL,
  146.               adjusted_thumbnail_data,
  147.               adjusted_thumbnail_bpp * thumbnail_w);
  148.  
  149.   return FALSE;
  150. }
  151.  
  152. static void
  153. gimp_color_adjust_response (GtkWidget *widget,
  154.                             gint       response_id,
  155.                             gpointer   data)
  156. {
  157.   if (response_id == RESPONSE_RESET)
  158.     {
  159.       gimp_set_color_defaults ();
  160.     }
  161.   else
  162.     {
  163.       gtk_widget_hide (widget);
  164.     }
  165. }
  166.  
  167. /*
  168.  * gimp_create_color_adjust_window (void)
  169.  *
  170.  * NOTES:
  171.  *   creates the color adjuster popup, allowing the user to adjust brightness,
  172.  *   contrast, saturation, etc.
  173.  */
  174. void
  175. gimp_create_color_adjust_window (void)
  176. {
  177.   GtkWidget *vbox;
  178.   GtkWidget *hbox;
  179.   GtkWidget *frame;
  180.   GtkWidget *table;
  181.   GtkWidget *event_box;
  182.  
  183.   const stp_vars_t lower   = stp_minimum_settings ();
  184.   const stp_vars_t upper   = stp_maximum_settings ();
  185.   const stp_vars_t defvars = stp_default_settings ();
  186.  
  187.   /*
  188.    * Fetch a thumbnail of the image we're to print from the Gimp.  This must
  189.    *
  190.    */
  191.  
  192.   thumbnail_w = THUMBNAIL_MAXW;
  193.   thumbnail_h = THUMBNAIL_MAXH;
  194.   thumbnail_data = gimp_image_get_thumbnail_data (image_ID,
  195.                                                   &thumbnail_w,
  196.                                                   &thumbnail_h,
  197.                                                   &thumbnail_bpp);
  198.  
  199.   /*
  200.    * thumbnail_w and thumbnail_h have now been adjusted to the actual
  201.    * thumbnail dimensions.  Now initialize a color-adjusted version of
  202.    * the thumbnail.
  203.    */
  204.  
  205.   adjusted_thumbnail_data = g_malloc (3 * thumbnail_w * thumbnail_h);
  206.  
  207.   gimp_color_adjust_dialog =
  208.     gimp_dialog_new (_("Print Color Adjust"), "print",
  209.                      NULL, 0,
  210.              gimp_standard_help_func, "file-print-gimp",
  211.  
  212.              GIMP_STOCK_RESET, RESPONSE_RESET,
  213.              GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE,
  214.  
  215.              NULL);
  216.  
  217.   gtk_dialog_set_default_response (GTK_DIALOG (gimp_color_adjust_dialog),
  218.                                    GTK_RESPONSE_CLOSE);
  219.  
  220.   g_signal_connect (gimp_color_adjust_dialog, "response",
  221.                     G_CALLBACK (gimp_color_adjust_response),
  222.                     NULL);
  223.  
  224.   vbox = gtk_vbox_new (FALSE, 12);
  225.   gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
  226.   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gimp_color_adjust_dialog)->vbox),
  227.               vbox, FALSE, FALSE, 0);
  228.   gtk_widget_show (vbox);
  229.  
  230.   /*
  231.    * Drawing area for color swatch feedback display...
  232.    */
  233.  
  234.   hbox = gtk_hbox_new (FALSE, 0);
  235.   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  236.   gtk_widget_show (hbox);
  237.  
  238.   frame = gtk_frame_new (NULL);
  239.   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  240.   gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
  241.   gtk_widget_show (frame);
  242.  
  243.   swatch = gtk_drawing_area_new ();
  244.   gtk_widget_set_size_request (swatch, thumbnail_w, thumbnail_h);
  245.   gtk_container_add (GTK_CONTAINER (frame), swatch);
  246.   gtk_widget_show (swatch);
  247.  
  248.   g_signal_connect (swatch, "expose_event",
  249.                     G_CALLBACK (gimp_color_swatch_expose),
  250.                     NULL);
  251.  
  252.  
  253.   table = gtk_table_new (9, 3, FALSE);
  254.   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  255.   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  256.   gtk_table_set_row_spacing (GTK_TABLE (table), 1, 12);
  257.   gtk_table_set_row_spacing (GTK_TABLE (table), 4, 12);
  258.   gtk_table_set_row_spacing (GTK_TABLE (table), 7, 12);
  259.   gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
  260.   gtk_widget_show (table);
  261.  
  262.  
  263.   /*
  264.    * Brightness slider...
  265.    */
  266.  
  267.   brightness_adjustment =
  268.     gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("Brightness:"), 200, 0,
  269.                           stp_get_brightness (defvars),
  270.               stp_get_brightness (lower),
  271.               stp_get_brightness (upper),
  272.               stp_get_brightness (defvars) / 100,
  273.               stp_get_brightness (defvars) / 10,
  274.               3, TRUE, 0, 0, NULL, NULL);
  275.   set_adjustment_tooltip (brightness_adjustment,
  276.                           _("Set the brightness of the print.\n"
  277.                             "0 is solid black, 2 is solid white"),
  278.                           NULL);
  279.   g_signal_connect (brightness_adjustment, "value_changed",
  280.                     G_CALLBACK (gimp_brightness_update),
  281.                     NULL);
  282.  
  283.   /*
  284.    * Contrast slider...
  285.    */
  286.  
  287.   contrast_adjustment =
  288.     gimp_scale_entry_new (GTK_TABLE (table), 0, 1, _("Contrast:"), 200, 0,
  289.                           stp_get_contrast (defvars),
  290.               stp_get_contrast (lower),
  291.               stp_get_contrast (upper),
  292.               stp_get_contrast (defvars) / 100,
  293.               stp_get_contrast (defvars) / 10,
  294.               3, TRUE, 0, 0, NULL, NULL);
  295.   set_adjustment_tooltip (contrast_adjustment,
  296.                           _("Set the contrast of the print"),
  297.                           NULL);
  298.   g_signal_connect (contrast_adjustment, "value_changed",
  299.                     G_CALLBACK (gimp_contrast_update),
  300.                     NULL);
  301.  
  302.   /*
  303.    * Cyan slider...
  304.    */
  305.  
  306.   cyan_adjustment =
  307.     gimp_scale_entry_new (GTK_TABLE (table), 0, 2, _("Cyan:"), 200, 0,
  308.                           stp_get_cyan (defvars),
  309.               stp_get_cyan (lower),
  310.               stp_get_cyan (upper),
  311.               stp_get_cyan (defvars) / 100,
  312.               stp_get_cyan (defvars) / 10,
  313.               3, TRUE, 0, 0, NULL, NULL);
  314.   set_adjustment_tooltip (cyan_adjustment,
  315.                           _("Adjust the cyan balance of the print"),
  316.                           NULL);
  317.   g_signal_connect (cyan_adjustment, "value_changed",
  318.                     G_CALLBACK (gimp_cyan_update),
  319.                     NULL);
  320.  
  321.   /*
  322.    * Magenta slider...
  323.    */
  324.  
  325.   magenta_adjustment =
  326.     gimp_scale_entry_new (GTK_TABLE (table), 0, 3, _("Magenta:"), 200, 0,
  327.                           stp_get_magenta (defvars),
  328.               stp_get_magenta (lower),
  329.               stp_get_magenta (upper),
  330.               stp_get_magenta (defvars) / 100,
  331.               stp_get_magenta (defvars) / 10,
  332.               3, TRUE, 0, 0, NULL, NULL);
  333.   set_adjustment_tooltip (magenta_adjustment,
  334.                           _("Adjust the magenta balance of the print"),
  335.                           NULL);
  336.   g_signal_connect (magenta_adjustment, "value_changed",
  337.                     G_CALLBACK (gimp_magenta_update),
  338.                     NULL);
  339.  
  340.   /*
  341.    * Yellow slider...
  342.    */
  343.  
  344.   yellow_adjustment =
  345.     gimp_scale_entry_new (GTK_TABLE (table), 0, 4, _("Yellow:"), 200, 0,
  346.                           stp_get_yellow (defvars),
  347.               stp_get_yellow (lower),
  348.               stp_get_yellow (upper),
  349.               stp_get_yellow (defvars) / 100,
  350.               stp_get_yellow (defvars) / 10,
  351.               3, TRUE, 0, 0, NULL, NULL);
  352.   set_adjustment_tooltip (yellow_adjustment,
  353.                           _("Adjust the yellow balance of the print"),
  354.                           NULL);
  355.   g_signal_connect (yellow_adjustment, "value_changed",
  356.                     G_CALLBACK (gimp_yellow_update),
  357.                     NULL);
  358.  
  359.   /*
  360.    * Saturation slider...
  361.    */
  362.  
  363.   saturation_adjustment =
  364.     gimp_scale_entry_new (GTK_TABLE (table), 0, 5, _("Saturation:"), 200, 0,
  365.                           stp_get_saturation (defvars),
  366.               stp_get_saturation (lower),
  367.               stp_get_saturation (upper),
  368.               stp_get_saturation (defvars) / 1000,
  369.               stp_get_saturation (defvars) / 100,
  370.               3, TRUE, 0, 0, NULL, NULL);
  371.   set_adjustment_tooltip (saturation_adjustment,
  372.                           _("Adjust the saturation (color balance) of the print\n"
  373.                             "Use zero saturation to produce grayscale output "
  374.                             "using color and black inks"),
  375.                           NULL);
  376.   g_signal_connect (saturation_adjustment, "value_changed",
  377.                     G_CALLBACK (gimp_saturation_update),
  378.                     NULL);
  379.  
  380.   /*
  381.    * Density slider...
  382.    */
  383.  
  384.   density_adjustment =
  385.     gimp_scale_entry_new (GTK_TABLE (table), 0, 6, _("Density:"), 200, 0,
  386.                           stp_get_density (defvars),
  387.               stp_get_density (lower),
  388.               stp_get_density (upper),
  389.               stp_get_density (defvars) / 1000,
  390.               stp_get_density (defvars) / 100,
  391.               3, TRUE, 0, 0, NULL, NULL);
  392.   set_adjustment_tooltip (density_adjustment,
  393.                           _("Adjust the density (amount of ink) of the print. "
  394.                             "Reduce the density if the ink bleeds through the "
  395.                             "paper or smears; increase the density if black "
  396.                             "regions are not solid."),
  397.                           NULL);
  398.   g_signal_connect (density_adjustment, "value_changed",
  399.                     G_CALLBACK (gimp_density_update),
  400.                     NULL);
  401.  
  402.   /*
  403.    * Gamma slider...
  404.    */
  405.  
  406.   gamma_adjustment =
  407.     gimp_scale_entry_new (GTK_TABLE (table), 0, 7, _("Gamma:"), 200, 0,
  408.                           stp_get_gamma (defvars),
  409.               stp_get_gamma (lower),
  410.               stp_get_gamma (upper),
  411.               stp_get_gamma (defvars) / 1000,
  412.               stp_get_gamma (defvars) / 100,
  413.               3, TRUE, 0, 0, NULL, NULL);
  414.   set_adjustment_tooltip (gamma_adjustment,
  415.                           _("Adjust the gamma of the print. Larger values will "
  416.                             "produce a generally brighter print, while smaller "
  417.                             "values will produce a generally darker print. "
  418.                             "Black and white will remain the same, unlike with "
  419.                             "the brightness adjustment."),
  420.                           NULL);
  421.   g_signal_connect (gamma_adjustment, "value_changed",
  422.                     G_CALLBACK (gimp_gamma_update),
  423.                     NULL);
  424.  
  425.   /*
  426.    * Dither algorithm option combo...
  427.    */
  428.  
  429.  
  430.   event_box = gtk_event_box_new ();
  431.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 8,
  432.                              _("Dither Algorithm:"), 0.0, 0.5,
  433.                              event_box, 2, FALSE);
  434.  
  435.   dither_algo_combo = gtk_combo_new ();
  436.   gtk_container_add (GTK_CONTAINER(event_box), dither_algo_combo);
  437.   gtk_widget_show (dither_algo_combo);
  438.  
  439.   gimp_help_set_help_data (GTK_WIDGET (event_box),
  440.                            _("Choose the dither algorithm to be used.\n"
  441.                              "Adaptive Hybrid usually produces the best "
  442.                              "all-around quality.\n"
  443.                              "Ordered is faster and produces almost as good "
  444.                              "quality on photographs.\n"
  445.                              "Fast and Very Fast are considerably faster, and "
  446.                              "work well for text and line art.\n"
  447.                              "Hybrid Floyd-Steinberg generally produces "
  448.                              "inferior output."),
  449.                            NULL);
  450.  
  451.   gimp_build_dither_combo ();
  452. }
  453.  
  454. static void
  455. gimp_brightness_update (GtkAdjustment *adjustment)
  456. {
  457.   gimp_invalidate_preview_thumbnail ();
  458.   if (stp_get_brightness (*pv) != adjustment->value)
  459.     {
  460.       stp_set_brightness (*pv, adjustment->value);
  461.       gimp_update_adjusted_thumbnail ();
  462.     }
  463. }
  464.  
  465. static void
  466. gimp_contrast_update (GtkAdjustment *adjustment)
  467. {
  468.   gimp_invalidate_preview_thumbnail ();
  469.  
  470.   if (stp_get_contrast (*pv) != adjustment->value)
  471.     {
  472.       stp_set_contrast (*pv, adjustment->value);
  473.       gimp_update_adjusted_thumbnail ();
  474.     }
  475. }
  476.  
  477. static void
  478. gimp_cyan_update (GtkAdjustment *adjustment)
  479. {
  480.   gimp_invalidate_preview_thumbnail ();
  481.  
  482.   if (stp_get_cyan (*pv) != adjustment->value)
  483.     {
  484.       stp_set_cyan (*pv, adjustment->value);
  485.       gimp_update_adjusted_thumbnail ();
  486.     }
  487. }
  488.  
  489. static void
  490. gimp_magenta_update (GtkAdjustment *adjustment)
  491. {
  492.   gimp_invalidate_preview_thumbnail ();
  493.  
  494.   if (stp_get_magenta (*pv) != adjustment->value)
  495.     {
  496.       stp_set_magenta (*pv, adjustment->value);
  497.       gimp_update_adjusted_thumbnail ();
  498.     }
  499. }
  500.  
  501. static void
  502. gimp_yellow_update (GtkAdjustment *adjustment)
  503. {
  504.   gimp_invalidate_preview_thumbnail ();
  505.  
  506.   if (stp_get_yellow (*pv) != adjustment->value)
  507.     {
  508.       stp_set_yellow (*pv, adjustment->value);
  509.       gimp_update_adjusted_thumbnail ();
  510.     }
  511. }
  512.  
  513. static void
  514. gimp_saturation_update (GtkAdjustment *adjustment)
  515. {
  516.   gimp_invalidate_preview_thumbnail ();
  517.  
  518.   if (stp_get_saturation (*pv) != adjustment->value)
  519.     {
  520.       stp_set_saturation (*pv, adjustment->value);
  521.       gimp_update_adjusted_thumbnail ();
  522.     }
  523. }
  524.  
  525. static void
  526. gimp_density_update (GtkAdjustment *adjustment)
  527. {
  528.   if (stp_get_density (*pv) != adjustment->value)
  529.     {
  530.       stp_set_density (*pv, adjustment->value);
  531.     }
  532. }
  533.  
  534. static void
  535. gimp_gamma_update (GtkAdjustment *adjustment)
  536. {
  537.   gimp_invalidate_preview_thumbnail ();
  538.  
  539.   if (stp_get_gamma (*pv) != adjustment->value)
  540.     {
  541.       stp_set_gamma (*pv, adjustment->value);
  542.       gimp_update_adjusted_thumbnail ();
  543.     }
  544. }
  545.  
  546. static void
  547. gimp_set_adjustment_active (GtkObject *adj,
  548.                             gboolean   active)
  549. {
  550.   gtk_widget_set_sensitive (GTK_WIDGET (GIMP_SCALE_ENTRY_LABEL (adj)), active);
  551.   gtk_widget_set_sensitive (GTK_WIDGET (GIMP_SCALE_ENTRY_SCALE (adj)), active);
  552.   gtk_widget_set_sensitive (GTK_WIDGET (GIMP_SCALE_ENTRY_SPINBUTTON (adj)),
  553.                             active);
  554. }
  555.  
  556. void
  557. gimp_set_color_sliders_active (gboolean active)
  558. {
  559.   gimp_set_adjustment_active (cyan_adjustment, active);
  560.   gimp_set_adjustment_active (magenta_adjustment, active);
  561.   gimp_set_adjustment_active (yellow_adjustment, active);
  562.   gimp_set_adjustment_active (saturation_adjustment, active);
  563. }
  564.  
  565. void
  566. gimp_do_color_updates (void)
  567. {
  568.   gtk_adjustment_set_value (GTK_ADJUSTMENT (brightness_adjustment),
  569.                 stp_get_brightness (*pv));
  570.  
  571.   gtk_adjustment_set_value (GTK_ADJUSTMENT (gamma_adjustment),
  572.                 stp_get_gamma (*pv));
  573.  
  574.   gtk_adjustment_set_value (GTK_ADJUSTMENT (contrast_adjustment),
  575.                 stp_get_contrast (*pv));
  576.  
  577.   gtk_adjustment_set_value (GTK_ADJUSTMENT (cyan_adjustment),
  578.                 stp_get_cyan (*pv));
  579.  
  580.   gtk_adjustment_set_value (GTK_ADJUSTMENT (magenta_adjustment),
  581.                 stp_get_magenta (*pv));
  582.  
  583.   gtk_adjustment_set_value (GTK_ADJUSTMENT (yellow_adjustment),
  584.                 stp_get_yellow (*pv));
  585.  
  586.   gtk_adjustment_set_value (GTK_ADJUSTMENT (saturation_adjustment),
  587.                 stp_get_saturation (*pv));
  588.  
  589.   gtk_adjustment_set_value (GTK_ADJUSTMENT (density_adjustment),
  590.                 stp_get_density (*pv));
  591.  
  592.   gimp_update_adjusted_thumbnail ();
  593. }
  594.  
  595. void
  596. gimp_set_color_defaults (void)
  597. {
  598.   const stp_vars_t defvars = stp_default_settings ();
  599.  
  600.   stp_set_brightness (*pv, stp_get_brightness (defvars));
  601.   stp_set_gamma (*pv, stp_get_gamma (defvars));
  602.   stp_set_contrast (*pv, stp_get_contrast (defvars));
  603.   stp_set_cyan (*pv, stp_get_cyan (defvars));
  604.   stp_set_magenta (*pv, stp_get_magenta (defvars));
  605.   stp_set_yellow (*pv, stp_get_yellow (defvars));
  606.   stp_set_saturation (*pv, stp_get_saturation (defvars));
  607.   stp_set_density (*pv, stp_get_density (defvars));
  608.  
  609.   gimp_do_color_updates ();
  610. }
  611.