mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00

- Some coding style fixes (alignment, etc.). - Adding missing "Since: 3.0" annotations. We are still wondering whether this should go in 2.10, in which case, it would become "Since: 2.10.32" annotations. See discussion in !274. - Changing gimp_checks_get_colors() signature: merge the 4 color arguments into 2 (inout) arguments which seems a bit nicer in C, whereas binding handles such arguments correctly. The other alternative would have been to at least change the order to have out arguments in the end. I also hesitated to get another API in libgimp, which would have been config-aware (just returning the 2 check colors, depending on user-set Preferences), then having GimpPreviewArea handling 2 colors (without a GimpCheckType input). But actually, doing this, we'd remove the nice menu popup where one could choose a generic check type (not everyone wants to play with specific non-gray colors) in Gimp*Preview widgets. So in the end, I left this whole thing as-is. Instead I document the function with code sample to initialize properly the GimpPreviewArea (since libgimpwidgets/ are independent with no knowledge of the core config) in order to respect user preferences. - Hide the color properties in gimp_preview_area_menu_new() because anyway gimp_preview_area_menu_new() does not support GimpRGB properties right now (so all we get are warnings). It's still possible to select custom colors on GimpPreviewArea, simply we are stuck at the ones set in Preferences globally for now (unless a plug-in creates custom GUI to set these). Fixed Conflicts from !274: libgimp/gimp.h libgimpwidgets/gimppreviewarea.c
106 lines
2.8 KiB
C
106 lines
2.8 KiB
C
/* GIMP - The GNU Image Manipulation Program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include <gegl.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
#include "widgets-types.h"
|
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "gimprender.h"
|
|
|
|
|
|
static void gimp_render_setup_notify (gpointer config,
|
|
GParamSpec *param_spec,
|
|
Gimp *gimp);
|
|
|
|
|
|
static GimpRGB color1;
|
|
static GimpRGB color2;
|
|
|
|
|
|
void
|
|
gimp_render_init (Gimp *gimp)
|
|
{
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_signal_connect (gimp->config, "notify::transparency-type",
|
|
G_CALLBACK (gimp_render_setup_notify),
|
|
gimp);
|
|
|
|
g_signal_connect (gimp->config, "notify::transparency-custom-color1",
|
|
G_CALLBACK (gimp_render_setup_notify),
|
|
gimp);
|
|
|
|
g_signal_connect (gimp->config, "notify::transparency-custom-color2",
|
|
G_CALLBACK (gimp_render_setup_notify),
|
|
gimp);
|
|
|
|
gimp_render_setup_notify (gimp->config, NULL, gimp);
|
|
}
|
|
|
|
void
|
|
gimp_render_exit (Gimp *gimp)
|
|
{
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_signal_handlers_disconnect_by_func (gimp->config,
|
|
gimp_render_setup_notify,
|
|
gimp);
|
|
}
|
|
|
|
const GimpRGB *
|
|
gimp_render_check_color1 (void)
|
|
{
|
|
return &color1;
|
|
}
|
|
|
|
const GimpRGB *
|
|
gimp_render_check_color2 (void)
|
|
{
|
|
return &color2;
|
|
}
|
|
|
|
static void
|
|
gimp_render_setup_notify (gpointer config,
|
|
GParamSpec *param_spec,
|
|
Gimp *gimp)
|
|
{
|
|
GimpRGB *color1_custom;
|
|
GimpRGB *color2_custom;
|
|
GimpCheckType check_type;
|
|
|
|
g_object_get (config,
|
|
"transparency-type", &check_type,
|
|
"transparency-custom-color1", &color1_custom,
|
|
"transparency-custom-color2", &color2_custom,
|
|
NULL);
|
|
|
|
color1 = *color1_custom;
|
|
color2 = *color2_custom;
|
|
gimp_checks_get_colors (check_type, &color1, &color2);
|
|
g_free (color1_custom);
|
|
g_free (color2_custom);
|
|
}
|