2002-03-13 05:02:10 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
|
|
|
* gimppaletteselect_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2002-03-13 05:02:10 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2002-03-13 05:02:10 +08: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-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2002-03-13 05:02:10 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimppaletteselect
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimppaletteselect
|
2022-10-16 03:11:05 +08:00
|
|
|
* @short_description: Methods of a palette chooser dialog
|
2010-07-07 17:43:10 +08:00
|
|
|
*
|
2022-10-16 03:11:05 +08:00
|
|
|
* A dialog letting a user choose a palette. Read more at
|
|
|
|
* gimpfontselect.
|
2010-07-07 17:43:10 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
/**
|
|
|
|
* gimp_palettes_popup:
|
2022-10-16 03:11:05 +08:00
|
|
|
* @palette_callback: The callback PDB proc to call when user chooses a palette.
|
2007-01-09 18:52:47 +08:00
|
|
|
* @popup_title: Title of the palette selection dialog.
|
2022-09-06 07:28:35 +08:00
|
|
|
* @initial_palette_name: The name of the palette to set as the initial 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 06:12:16 +08:00
|
|
|
* @parent_window: An optional parent window handle for the popup to be set transient to.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2022-10-16 03:11:05 +08:00
|
|
|
* Invokes the Gimp palette selection dialog.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2022-10-16 03:11:05 +08:00
|
|
|
* Opens a dialog letting a user choose a palette.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean
|
2003-07-02 09:20:08 +08:00
|
|
|
gimp_palettes_popup (const gchar *palette_callback,
|
2006-04-12 18:27:31 +08:00
|
|
|
const gchar *popup_title,
|
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 06:12:16 +08:00
|
|
|
const gchar *initial_palette_name,
|
|
|
|
GBytes *parent_window)
|
2002-03-13 05:02:10 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, palette_callback,
|
|
|
|
G_TYPE_STRING, popup_title,
|
2022-10-16 03:11:05 +08:00
|
|
|
G_TYPE_STRING, initial_palette_name,
|
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 06:12:16 +08:00
|
|
|
G_TYPE_BYTES, parent_window,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-palettes-popup",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_palettes_close_popup:
|
2007-01-09 18:52:47 +08:00
|
|
|
* @palette_callback: The name of the callback registered for this pop-up.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2007-01-09 18:52:47 +08:00
|
|
|
* Close the palette selection dialog.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2022-10-16 03:11:05 +08:00
|
|
|
* Closes an open palette selection dialog.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean
|
2003-07-02 09:20:08 +08:00
|
|
|
gimp_palettes_close_popup (const gchar *palette_callback)
|
2002-03-13 05:02:10 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, palette_callback,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-palettes-close-popup",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_palettes_set_popup:
|
2007-01-09 18:52:47 +08:00
|
|
|
* @palette_callback: The name of the callback registered for this pop-up.
|
2023-08-17 02:17:53 +08:00
|
|
|
* @palette: The palette to set as selected.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2007-01-09 18:52:47 +08:00
|
|
|
* Sets the current palette in a palette selection dialog.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
2007-01-09 18:52:47 +08:00
|
|
|
* Sets the current palette in a palette selection dialog.
|
2002-03-13 05:02:10 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean
|
2003-07-02 09:20:08 +08:00
|
|
|
gimp_palettes_set_popup (const gchar *palette_callback,
|
2023-08-17 02:17:53 +08:00
|
|
|
GimpPalette *palette)
|
2002-03-13 05:02:10 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2002-03-13 05:02:10 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, palette_callback,
|
2023-08-17 02:17:53 +08:00
|
|
|
GIMP_TYPE_PALETTE, palette,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-palettes-set-popup",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2002-03-13 05:02:10 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2002-03-13 05:02:10 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|