2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-07-28 23:00:08 +00:00
|
|
|
* Copyright (C) 1999 Manish Singh
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-07-28 23:00:08 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-07-28 23:00:08 +00: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
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-07-28 23:00:08 +00:00
|
|
|
*/
|
2000-12-16 21:37:03 +00:00
|
|
|
|
1999-09-06 00:07:03 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-06-22 22:26:46 +02:00
|
|
|
#include <gegl.h>
|
2002-03-14 22:42:50 +00:00
|
|
|
#include <gtk/gtk.h>
|
1999-10-04 19:26:07 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-05-21 20:30:16 +00:00
|
|
|
|
2002-03-14 22:42:50 +00:00
|
|
|
#include "display-types.h"
|
|
|
|
|
|
|
|
#include "gimpdisplayshell.h"
|
2009-10-02 23:55:26 +02:00
|
|
|
#include "gimpdisplayshell-expose.h"
|
2002-03-14 22:42:50 +00:00
|
|
|
#include "gimpdisplayshell-filter.h"
|
2015-05-27 12:29:42 +02:00
|
|
|
#include "gimpdisplayshell-profile.h"
|
2019-07-25 09:15:07 +02:00
|
|
|
#include "gimpdisplayshell-render.h"
|
1999-08-28 22:40:37 +00:00
|
|
|
|
1999-07-28 23:00:08 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
/* local function prototypes */
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
static void gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
|
|
|
|
GimpDisplayShell *shell);
|
1999-10-04 19:26:07 +00:00
|
|
|
|
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
/* public functions */
|
1999-08-28 22:40:37 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
void
|
|
|
|
gimp_display_shell_filter_set (GimpDisplayShell *shell,
|
|
|
|
GimpColorDisplayStack *stack)
|
2000-01-03 07:49:19 +00:00
|
|
|
{
|
2003-11-21 22:52:36 +00: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 07:49:19 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
if (stack == shell->filter_stack)
|
|
|
|
return;
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
if (shell->filter_stack)
|
2000-01-03 07:49:19 +00:00
|
|
|
{
|
2003-11-21 22:52:36 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (shell->filter_stack,
|
|
|
|
gimp_display_shell_filter_changed,
|
|
|
|
shell);
|
2000-01-03 07:49:19 +00:00
|
|
|
}
|
|
|
|
|
2019-07-25 09:55:55 +02:00
|
|
|
g_set_object (&shell->filter_stack, stack);
|
2000-01-03 07:49:19 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
if (shell->filter_stack)
|
|
|
|
{
|
|
|
|
g_signal_connect (shell->filter_stack, "changed",
|
|
|
|
G_CALLBACK (gimp_display_shell_filter_changed),
|
|
|
|
shell);
|
|
|
|
}
|
1999-12-23 13:33:43 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
gimp_display_shell_filter_changed (NULL, shell);
|
1999-07-28 23:00:08 +00:00
|
|
|
}
|
|
|
|
|
2015-06-01 08:16:12 +02:00
|
|
|
gboolean
|
|
|
|
gimp_display_shell_has_filter (GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2017-11-05 08:57:46 -05:00
|
|
|
if (shell->filter_stack)
|
|
|
|
{
|
2015-06-09 23:57:44 +02:00
|
|
|
GList *filters;
|
2017-11-05 08:57:46 -05:00
|
|
|
GList *iter;
|
|
|
|
|
2015-06-09 23:57:44 +02:00
|
|
|
filters = gimp_color_display_stack_get_filters (shell->filter_stack);
|
|
|
|
|
|
|
|
for (iter = filters; iter; iter = g_list_next (iter))
|
2017-11-05 08:57:46 -05:00
|
|
|
{
|
|
|
|
if (gimp_color_display_get_enabled (GIMP_COLOR_DISPLAY (iter->data)))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2015-06-01 08:16:12 +02:00
|
|
|
}
|
|
|
|
|
1999-12-23 13:33:43 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
/* private functions */
|
1999-08-28 22:40:37 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_display_shell_filter_changed_idle (gpointer data)
|
1999-08-28 01:17:11 +00:00
|
|
|
{
|
2003-11-21 22:52:36 +00:00
|
|
|
GimpDisplayShell *shell = data;
|
1999-08-28 01:17:11 +00:00
|
|
|
|
2015-05-27 12:29:42 +02:00
|
|
|
gimp_display_shell_profile_update (shell);
|
2003-11-21 22:52:36 +00:00
|
|
|
gimp_display_shell_expose_full (shell);
|
2019-07-15 23:24:35 +02:00
|
|
|
gimp_display_shell_render_invalidate_full (shell);
|
2015-05-27 12:29:42 +02:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
shell->filter_idle_id = 0;
|
2002-03-14 22:42:50 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
return FALSE;
|
1999-08-28 01:17:11 +00:00
|
|
|
}
|
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
static void
|
|
|
|
gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
|
|
|
|
GimpDisplayShell *shell)
|
1999-08-28 01:17:11 +00:00
|
|
|
{
|
2003-11-21 22:52:36 +00:00
|
|
|
if (shell->filter_idle_id)
|
|
|
|
g_source_remove (shell->filter_idle_id);
|
1999-08-28 01:17:11 +00:00
|
|
|
|
2003-11-21 22:52:36 +00:00
|
|
|
shell->filter_idle_id =
|
|
|
|
g_idle_add_full (G_PRIORITY_LOW,
|
|
|
|
gimp_display_shell_filter_changed_idle,
|
|
|
|
shell, NULL);
|
1999-08-28 01:17:11 +00:00
|
|
|
}
|