2000-05-31 21:16:11 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 00:47:26 +00:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-05-31 21:16:11 +00:00
|
|
|
*
|
|
|
|
* gimpgradientselect_pdb.c
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-05-31 21:16:11 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-17 22:28:01 +00:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-05-31 21:16:11 +00:00
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-17 22:28:01 +00:00
|
|
|
* License along with this library. If not, see
|
2018-07-11 23:27:07 +02:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-05-31 21:16:11 +00:00
|
|
|
*/
|
|
|
|
|
2007-01-09 10:52:47 +00:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2002-05-13 23:30:23 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 15:13:17 +02:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2000-05-31 21:16:11 +00:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 11:43:10 +02:00
|
|
|
|
|
|
|
/**
|
2019-07-31 10:04:43 +02:00
|
|
|
* SECTION: gimpgradientselect
|
2010-07-07 11:43:10 +02:00
|
|
|
* @title: gimpgradientselect
|
2022-10-15 15:11:05 -04:00
|
|
|
* @short_description: Methods of a gradient chooser dialog
|
2010-07-07 11:43:10 +02:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* A dialog letting a user choose a gradient. Read more at
|
|
|
|
* gimpfontselect.
|
2010-07-07 11:43:10 +02:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-24 23:06:53 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradients_popup:
|
2022-10-15 15:11:05 -04:00
|
|
|
* @gradient_callback: The callback PDB proc to call when user chooses a gradient.
|
2007-01-09 10:52:47 +00:00
|
|
|
* @popup_title: Title of the gradient selection dialog.
|
2023-08-17 01:30:59 +02:00
|
|
|
* @initial_gradient: The initial gradient choice.
|
app, libgimp, pdb: add a parent_window parameter to gimp_*_popup() PDB calls.
Brush, font, gradient, palette and pattern choices are currently chosen through
a dialog created by the core, which then returns the user choice to the calling
plug-in. This has the unfortunate consequence of having a pile of likely at
least 3 windows (main GIMP window by core process, plug-in window by plug-in
process, then the choice popup by the core process) shared in 2 processes, which
often end up under each other and that's messy. Even more as the choice popup is
kinda expected to be like a sub-part of the plug-in dialog.
So anyway, now the plug-in can send its window handle to the core so that the
resource choice dialog ends up always above the plug-in dialog.
Of course, it will always work only on platforms where we have working
inter-process transient support.
2023-08-15 00:12:16 +02:00
|
|
|
* @parent_window: An optional parent window handle for the popup to be set transient to.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Invokes the Gimp gradients selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Opens a dialog letting a user choose a gradient.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean
|
2023-08-17 01:30:59 +02:00
|
|
|
gimp_gradients_popup (const gchar *gradient_callback,
|
|
|
|
const gchar *popup_title,
|
|
|
|
GimpGradient *initial_gradient,
|
|
|
|
GBytes *parent_window)
|
2000-05-31 21:16:11 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, gradient_callback,
|
|
|
|
G_TYPE_STRING, popup_title,
|
2023-08-17 01:30:59 +02:00
|
|
|
GIMP_TYPE_GRADIENT, initial_gradient,
|
app, libgimp, pdb: add a parent_window parameter to gimp_*_popup() PDB calls.
Brush, font, gradient, palette and pattern choices are currently chosen through
a dialog created by the core, which then returns the user choice to the calling
plug-in. This has the unfortunate consequence of having a pile of likely at
least 3 windows (main GIMP window by core process, plug-in window by plug-in
process, then the choice popup by the core process) shared in 2 processes, which
often end up under each other and that's messy. Even more as the choice popup is
kinda expected to be like a sub-part of the plug-in dialog.
So anyway, now the plug-in can send its window handle to the core so that the
resource choice dialog ends up always above the plug-in dialog.
Of course, it will always work only on platforms where we have working
inter-process transient support.
2023-08-15 00:12:16 +02:00
|
|
|
G_TYPE_BYTES, parent_window,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-09-03 23:55:49 +02:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradients-popup",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2000-08-23 01:44:59 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 01:44:59 +00:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
2000-08-24 23:06:53 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradients_close_popup:
|
2007-01-09 10:52:47 +00:00
|
|
|
* @gradient_callback: The name of the callback registered for this pop-up.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2007-01-09 10:52:47 +00:00
|
|
|
* Close the gradient selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Closes an open gradient selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean
|
2003-07-02 01:20:08 +00:00
|
|
|
gimp_gradients_close_popup (const gchar *gradient_callback)
|
2000-05-31 21:16:11 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, gradient_callback,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-03 23:55:49 +02:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradients-close-popup",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2000-08-23 01:44:59 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 01:44:59 +00:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
2000-08-24 23:06:53 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradients_set_popup:
|
2007-01-09 10:52:47 +00:00
|
|
|
* @gradient_callback: The name of the callback registered for this pop-up.
|
2023-08-16 20:17:53 +02:00
|
|
|
* @gradient: The gradient to set as selected.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2007-01-09 10:52:47 +00:00
|
|
|
* Sets the current gradient in a gradient selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2007-01-09 10:52:47 +00:00
|
|
|
* Sets the current gradient in a gradient selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean
|
2023-08-16 20:17:53 +02:00
|
|
|
gimp_gradients_set_popup (const gchar *gradient_callback,
|
|
|
|
GimpGradient *gradient)
|
2000-05-31 21:16:11 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 01:44:59 +00:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, gradient_callback,
|
2023-08-16 20:17:53 +02:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-03 23:55:49 +02:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradients-set-popup",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2000-05-31 21:16:11 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2000-08-23 01:44:59 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 01:44:59 +00:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:16:11 +00:00
|
|
|
}
|