2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-07-29 07:00:08 +08:00
|
|
|
* Copyright (C) 1999 Manish Singh
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-07-29 07:00:08 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-07-29 07:00:08 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-07-29 07:00:08 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
1999-09-06 08:07:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-06-23 04:26:46 +08:00
|
|
|
#include <gegl.h>
|
2002-03-15 06:42:50 +08:00
|
|
|
#include <gtk/gtk.h>
|
1999-10-05 03:26:07 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "display-types.h"
|
|
|
|
|
|
|
|
#include "gimpdisplayshell.h"
|
2009-10-03 05:55:26 +08:00
|
|
|
#include "gimpdisplayshell-expose.h"
|
2002-03-15 06:42:50 +08:00
|
|
|
#include "gimpdisplayshell-filter.h"
|
2015-05-27 18:29:42 +08:00
|
|
|
#include "gimpdisplayshell-profile.h"
|
1999-08-29 06:40:37 +08:00
|
|
|
|
1999-07-29 07:00:08 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
/* local function prototypes */
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
static void gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
|
|
|
|
GimpDisplayShell *shell);
|
1999-10-05 03:26:07 +08:00
|
|
|
|
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
/* public functions */
|
1999-08-29 06:40:37 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_filter_set (GimpDisplayShell *shell,
|
|
|
|
GimpColorDisplayStack *stack)
|
2000-01-03 15:49:19 +08:00
|
|
|
{
|
2003-11-22 06:52:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
g_return_if_fail (stack == NULL || GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
2000-01-03 15:49:19 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
if (stack == shell->filter_stack)
|
|
|
|
return;
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
if (shell->filter_stack)
|
2000-01-03 15:49:19 +08:00
|
|
|
{
|
2003-11-22 06:52:36 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (shell->filter_stack,
|
|
|
|
gimp_display_shell_filter_changed,
|
|
|
|
shell);
|
2000-01-03 15:49:19 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
g_object_unref (shell->filter_stack);
|
2000-01-03 15:49:19 +08:00
|
|
|
}
|
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
shell->filter_stack = stack;
|
2000-01-03 15:49:19 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
if (shell->filter_stack)
|
|
|
|
{
|
|
|
|
g_object_ref (shell->filter_stack);
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
g_signal_connect (shell->filter_stack, "changed",
|
|
|
|
G_CALLBACK (gimp_display_shell_filter_changed),
|
|
|
|
shell);
|
|
|
|
}
|
1999-12-23 21:33:43 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
gimp_display_shell_filter_changed (NULL, shell);
|
1999-07-29 07:00:08 +08:00
|
|
|
}
|
|
|
|
|
2015-06-01 14:16:12 +08:00
|
|
|
gboolean
|
|
|
|
gimp_display_shell_has_filter (GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->filter_stack && shell->filter_stack->filters;
|
|
|
|
}
|
|
|
|
|
2005-02-21 08:45:17 +08:00
|
|
|
GimpColorDisplayStack *
|
2016-05-14 06:56:26 +08:00
|
|
|
gimp_display_shell_filter_new (GimpDisplayShell *shell)
|
2005-02-21 08:45:17 +08:00
|
|
|
{
|
2007-08-07 06:10:09 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
2005-02-21 08:45:17 +08:00
|
|
|
|
2015-06-02 05:30:03 +08:00
|
|
|
#if 0
|
|
|
|
/* disabled because we use gimpdisplayshell-profile now, keep
|
|
|
|
* the code around for reference.
|
|
|
|
*/
|
2005-02-21 08:45:17 +08:00
|
|
|
if (config->display_module)
|
|
|
|
{
|
|
|
|
GType type = g_type_from_name (config->display_module);
|
|
|
|
|
|
|
|
if (g_type_is_a (type, GIMP_TYPE_COLOR_DISPLAY))
|
|
|
|
{
|
2005-02-21 09:08:44 +08:00
|
|
|
GimpColorDisplay *display;
|
|
|
|
GimpColorDisplayStack *stack;
|
2005-02-21 08:45:17 +08:00
|
|
|
|
2005-02-21 09:08:44 +08:00
|
|
|
display = g_object_new (type,
|
2007-08-07 06:10:09 +08:00
|
|
|
"color-config", config,
|
|
|
|
"color-managed", shell,
|
2005-02-21 09:08:44 +08:00
|
|
|
NULL);
|
2005-02-21 08:45:17 +08:00
|
|
|
|
2005-02-21 09:08:44 +08:00
|
|
|
stack = gimp_color_display_stack_new ();
|
2005-02-21 08:45:17 +08:00
|
|
|
|
2005-02-21 09:08:44 +08:00
|
|
|
gimp_color_display_stack_add (stack, display);
|
|
|
|
g_object_unref (display);
|
2005-02-21 08:45:17 +08:00
|
|
|
|
2005-02-21 09:08:44 +08:00
|
|
|
return stack;
|
2005-02-21 08:45:17 +08:00
|
|
|
}
|
|
|
|
}
|
2015-06-02 05:30:03 +08:00
|
|
|
#endif
|
2005-02-21 08:45:17 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-12-23 21:33:43 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
/* private functions */
|
1999-08-29 06:40:37 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_display_shell_filter_changed_idle (gpointer data)
|
1999-08-28 09:17:11 +08:00
|
|
|
{
|
2003-11-22 06:52:36 +08:00
|
|
|
GimpDisplayShell *shell = data;
|
1999-08-28 09:17:11 +08:00
|
|
|
|
2015-05-27 18:29:42 +08:00
|
|
|
gimp_display_shell_profile_update (shell);
|
2003-11-22 06:52:36 +08:00
|
|
|
gimp_display_shell_expose_full (shell);
|
2015-05-27 18:29:42 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
shell->filter_idle_id = 0;
|
2002-03-15 06:42:50 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
return FALSE;
|
1999-08-28 09:17:11 +08:00
|
|
|
}
|
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
static void
|
|
|
|
gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
|
|
|
|
GimpDisplayShell *shell)
|
1999-08-28 09:17:11 +08:00
|
|
|
{
|
2003-11-22 06:52:36 +08:00
|
|
|
if (shell->filter_idle_id)
|
|
|
|
g_source_remove (shell->filter_idle_id);
|
1999-08-28 09:17:11 +08:00
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
shell->filter_idle_id =
|
|
|
|
g_idle_add_full (G_PRIORITY_LOW,
|
|
|
|
gimp_display_shell_filter_changed_idle,
|
|
|
|
shell, NULL);
|
1999-08-28 09:17:11 +08:00
|
|
|
}
|