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
|
|
|
*
|
|
|
|
* gimpbrushselect_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: gimpbrushselect
|
2010-07-07 11:43:10 +02:00
|
|
|
* @title: gimpbrushselect
|
2022-10-15 15:11:05 -04:00
|
|
|
* @short_description: Methods of a font 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 brush. Read more at
|
|
|
|
* gimpfontselect.
|
2010-07-07 11:43:10 +02:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-24 23:06:53 +00:00
|
|
|
/**
|
|
|
|
* gimp_brushes_popup:
|
2022-10-15 15:11:05 -04:00
|
|
|
* @brush_callback: The callback PDB proc to call when user chooses a brush.
|
2007-01-09 10:52:47 +00:00
|
|
|
* @popup_title: Title of the brush selection dialog.
|
2025-01-20 20:11:14 +01:00
|
|
|
* @initial_brush: (nullable): The brush to set as the initial choice.
|
|
|
|
* @parent_window: (nullable): 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 brush 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 brush.
|
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
|
2022-10-15 15:11:05 -04:00
|
|
|
gimp_brushes_popup (const gchar *brush_callback,
|
|
|
|
const gchar *popup_title,
|
2023-08-17 01:30:59 +02:00
|
|
|
GimpBrush *initial_brush,
|
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
|
|
|
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, brush_callback,
|
|
|
|
G_TYPE_STRING, popup_title,
|
2023-08-17 01:30:59 +02:00
|
|
|
GIMP_TYPE_BRUSH, initial_brush,
|
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
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-brushes-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_brushes_close_popup:
|
2007-01-09 10:52:47 +00:00
|
|
|
* @brush_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 brush selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Closes an open brush 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_brushes_close_popup (const gchar *brush_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, brush_callback,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-brushes-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_brushes_set_popup:
|
2007-01-09 10:52:47 +00:00
|
|
|
* @brush_callback: The name of the callback registered for this pop-up.
|
2023-08-16 20:17:53 +02:00
|
|
|
* @brush: The brush to set as selected.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Sets the selected brush in a brush selection dialog.
|
2000-08-24 23:06:53 +00:00
|
|
|
*
|
2022-10-15 15:11:05 -04:00
|
|
|
* Sets the selected brush in a brush 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
|
2022-10-15 15:11:05 -04:00
|
|
|
gimp_brushes_set_popup (const gchar *brush_callback,
|
2023-08-16 20:17:53 +02:00
|
|
|
GimpBrush *brush)
|
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, brush_callback,
|
2023-08-16 20:17:53 +02:00
|
|
|
GIMP_TYPE_BRUSH, brush,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-brushes-set-popup",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
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
|
|
|
}
|