1275 lines
34 KiB
C
1275 lines
34 KiB
C
/* LIBPIKA - The PIKA Library
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
*
|
|
* pikaitem_pdb.c
|
|
*
|
|
* This library is free software: you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* 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
|
|
* License along with this library. If not, see
|
|
* <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
|
|
|
#include "config.h"
|
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
#include "pika.h"
|
|
|
|
|
|
/**
|
|
* SECTION: pikaitem
|
|
* @title: pikaitem
|
|
* @short_description: Functions to manipulate items.
|
|
*
|
|
* Functions to manipulate items.
|
|
**/
|
|
|
|
|
|
/**
|
|
* pika_item_id_is_valid:
|
|
* @item_id: The item ID to check.
|
|
*
|
|
* Returns TRUE if the item ID is valid.
|
|
*
|
|
* This procedure checks if the given item ID is valid and refers to an
|
|
* existing item.
|
|
*
|
|
* Returns: Whether the item ID is valid.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_valid (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean valid = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-valid",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
valid = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return valid;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_drawable:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a drawable.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a drawable.
|
|
*
|
|
* Returns: TRUE if the item ID is a drawable, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_drawable (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean drawable = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-drawable",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
drawable = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return drawable;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_layer:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a layer.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a layer.
|
|
*
|
|
* Returns: TRUE if the item is a layer, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_layer (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean layer = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-layer",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
layer = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return layer;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_text_layer:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a text layer.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a text
|
|
* layer.
|
|
*
|
|
* Returns: TRUE if the item is a text layer, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_text_layer (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean text_layer = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-text-layer",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
text_layer = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return text_layer;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_channel:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a channel.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a channel.
|
|
*
|
|
* Returns: TRUE if the item ID is a channel, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_channel (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean channel = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-channel",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
channel = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return channel;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_layer_mask:
|
|
* @item_id: The item.
|
|
*
|
|
* Returns whether the item ID is a layer mask.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a layer
|
|
* mask.
|
|
*
|
|
* Returns: TRUE if the item ID is a layer mask, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_layer_mask (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean layer_mask = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-layer-mask",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
layer_mask = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return layer_mask;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_selection:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a selection.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a selection.
|
|
*
|
|
* Returns: TRUE if the item ID is a selection, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_selection (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean selection = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-selection",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
selection = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return selection;
|
|
}
|
|
|
|
/**
|
|
* pika_item_id_is_vectors:
|
|
* @item_id: The item ID.
|
|
*
|
|
* Returns whether the item ID is a vectors.
|
|
*
|
|
* This procedure returns TRUE if the specified item ID is a vectors.
|
|
*
|
|
* Returns: TRUE if the item ID is a vectors, FALSE otherwise.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_id_is_vectors (gint item_id)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean vectors = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
G_TYPE_INT, item_id,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-id-is-vectors",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
vectors = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return vectors;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_image:
|
|
* @item: The item.
|
|
*
|
|
* Returns the item's image.
|
|
*
|
|
* This procedure returns the item's image.
|
|
*
|
|
* Returns: (transfer none): The item's image.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
PikaImage *
|
|
pika_item_get_image (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
PikaImage *image = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-image",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
image = PIKA_VALUES_GET_IMAGE (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return image;
|
|
}
|
|
|
|
/**
|
|
* pika_item_delete:
|
|
* @item: The item to delete.
|
|
*
|
|
* Delete a item.
|
|
*
|
|
* This procedure deletes the specified item. This must not be done if
|
|
* the image containing this item was already deleted or if the item
|
|
* was already removed from the image. The only case in which this
|
|
* procedure is useful is if you want to get rid of a item which has
|
|
* not yet been added to an image.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_delete (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-delete",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_is_group:
|
|
* @item: The item.
|
|
*
|
|
* Returns whether the item is a group item.
|
|
*
|
|
* This procedure returns TRUE if the specified item is a group item
|
|
* which can have children.
|
|
*
|
|
* Returns: TRUE if the item is a group, FALSE otherwise.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_is_group (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean group = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-is-group",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
group = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return group;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_parent:
|
|
* @item: The item.
|
|
*
|
|
* Returns the item's parent item.
|
|
*
|
|
* This procedure returns the item's parent item, if any.
|
|
*
|
|
* Returns: (transfer none): The item's parent item.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
PikaItem *
|
|
pika_item_get_parent (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
PikaItem *parent = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-parent",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
parent = PIKA_VALUES_GET_ITEM (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return parent;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_children: (skip)
|
|
* @item: The item.
|
|
* @num_children: (out): The item's number of children.
|
|
*
|
|
* Returns the item's list of children.
|
|
*
|
|
* This procedure returns the list of items which are children of the
|
|
* specified item. The order is topmost to bottommost.
|
|
*
|
|
* Returns: (array length=num_children) (element-type PikaItem) (transfer container):
|
|
* The item's list of children.
|
|
* The returned value must be freed with g_free().
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
PikaItem **
|
|
pika_item_get_children (PikaItem *item,
|
|
gint *num_children)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
PikaItem **children = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-children",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
*num_children = 0;
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
{
|
|
*num_children = PIKA_VALUES_GET_INT (return_vals, 1);
|
|
{ PikaObjectArray *a = g_value_get_boxed (pika_value_array_index (return_vals, 2)); if (a) children = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
|
}
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return children;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_expanded:
|
|
* @item: The item.
|
|
*
|
|
* Returns whether the item is expanded.
|
|
*
|
|
* This procedure returns TRUE if the specified item is expanded.
|
|
*
|
|
* Returns: TRUE if the item is expanded, FALSE otherwise.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
gboolean
|
|
pika_item_get_expanded (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean expanded = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-expanded",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
expanded = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return expanded;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_expanded:
|
|
* @item: The item.
|
|
* @expanded: TRUE to expand the item, FALSE to collapse the item.
|
|
*
|
|
* Sets the expanded state of the item.
|
|
*
|
|
* This procedure expands or collapses the item.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
gboolean
|
|
pika_item_set_expanded (PikaItem *item,
|
|
gboolean expanded)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_BOOLEAN, expanded,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-expanded",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_name:
|
|
* @item: The item.
|
|
*
|
|
* Get the name of the specified item.
|
|
*
|
|
* This procedure returns the specified item's name.
|
|
*
|
|
* Returns: (transfer full): The item name.
|
|
* The returned value must be freed with g_free().
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gchar *
|
|
pika_item_get_name (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gchar *name = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-name",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
name = PIKA_VALUES_DUP_STRING (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return name;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_name:
|
|
* @item: The item.
|
|
* @name: The new item name.
|
|
*
|
|
* Set the name of the specified item.
|
|
*
|
|
* This procedure sets the specified item's name.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_set_name (PikaItem *item,
|
|
const gchar *name)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_STRING, name,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-name",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_visible:
|
|
* @item: The item.
|
|
*
|
|
* Get the visibility of the specified item.
|
|
*
|
|
* This procedure returns the specified item's visibility.
|
|
*
|
|
* Returns: The item visibility.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_get_visible (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean visible = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-visible",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
visible = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return visible;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_visible:
|
|
* @item: The item.
|
|
* @visible: The new item visibility.
|
|
*
|
|
* Set the visibility of the specified item.
|
|
*
|
|
* This procedure sets the specified item's visibility.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_set_visible (PikaItem *item,
|
|
gboolean visible)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_BOOLEAN, visible,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-visible",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_lock_content:
|
|
* @item: The item.
|
|
*
|
|
* Get the 'lock content' state of the specified item.
|
|
*
|
|
* This procedure returns the specified item's lock content state.
|
|
*
|
|
* Returns: Whether the item's contents are locked.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_get_lock_content (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean lock_content = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-lock-content",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
lock_content = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return lock_content;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_lock_content:
|
|
* @item: The item.
|
|
* @lock_content: The new item 'lock content' state.
|
|
*
|
|
* Set the 'lock content' state of the specified item.
|
|
*
|
|
* This procedure sets the specified item's lock content state.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_set_lock_content (PikaItem *item,
|
|
gboolean lock_content)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_BOOLEAN, lock_content,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-lock-content",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_lock_position:
|
|
* @item: The item.
|
|
*
|
|
* Get the 'lock position' state of the specified item.
|
|
*
|
|
* This procedure returns the specified item's lock position state.
|
|
*
|
|
* Returns: Whether the item's position is locked.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
gboolean
|
|
pika_item_get_lock_position (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean lock_position = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-lock-position",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
lock_position = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return lock_position;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_lock_position:
|
|
* @item: The item.
|
|
* @lock_position: The new item 'lock position' state.
|
|
*
|
|
* Set the 'lock position' state of the specified item.
|
|
*
|
|
* This procedure sets the specified item's lock position state.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
gboolean
|
|
pika_item_set_lock_position (PikaItem *item,
|
|
gboolean lock_position)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_BOOLEAN, lock_position,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-lock-position",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_lock_visibility:
|
|
* @item: The item.
|
|
*
|
|
* Get the 'lock visibility' state of the specified item.
|
|
*
|
|
* This procedure returns the specified item's lock visibility state.
|
|
*
|
|
* Returns: Whether the item's visibility is locked.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_get_lock_visibility (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean lock_visibility = FALSE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-lock-visibility",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
lock_visibility = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return lock_visibility;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_lock_visibility:
|
|
* @item: The item.
|
|
* @lock_visibility: The new item 'lock visibility' state.
|
|
*
|
|
* Set the 'lock visibility' state of the specified item.
|
|
*
|
|
* This procedure sets the specified item's lock visibility state.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
gboolean
|
|
pika_item_set_lock_visibility (PikaItem *item,
|
|
gboolean lock_visibility)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_BOOLEAN, lock_visibility,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-lock-visibility",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_color_tag:
|
|
* @item: The item.
|
|
*
|
|
* Get the color tag of the specified item.
|
|
*
|
|
* This procedure returns the specified item's color tag.
|
|
*
|
|
* Returns: The item's color tag.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
PikaColorTag
|
|
pika_item_get_color_tag (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
PikaColorTag color_tag = 0;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-color-tag",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
color_tag = PIKA_VALUES_GET_ENUM (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return color_tag;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_color_tag:
|
|
* @item: The item.
|
|
* @color_tag: The new item color tag.
|
|
*
|
|
* Set the color tag of the specified item.
|
|
*
|
|
* This procedure sets the specified item's color tag.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.10
|
|
**/
|
|
gboolean
|
|
pika_item_set_color_tag (PikaItem *item,
|
|
PikaColorTag color_tag)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
PIKA_TYPE_COLOR_TAG, color_tag,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-color-tag",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_tattoo:
|
|
* @item: The item.
|
|
*
|
|
* Get the tattoo of the specified item.
|
|
*
|
|
* This procedure returns the specified item's tattoo. A tattoo is a
|
|
* unique and permanent identifier attached to a item that can be used
|
|
* to uniquely identify a item within an image even between sessions.
|
|
*
|
|
* Returns: The item tattoo.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
guint
|
|
pika_item_get_tattoo (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
guint tattoo = 0;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-tattoo",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
tattoo = PIKA_VALUES_GET_UINT (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return tattoo;
|
|
}
|
|
|
|
/**
|
|
* pika_item_set_tattoo:
|
|
* @item: The item.
|
|
* @tattoo: The new item tattoo.
|
|
*
|
|
* Set the tattoo of the specified item.
|
|
*
|
|
* This procedure sets the specified item's tattoo. A tattoo is a
|
|
* unique and permanent identifier attached to a item that can be used
|
|
* to uniquely identify a item within an image even between sessions.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_set_tattoo (PikaItem *item,
|
|
guint tattoo)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_UINT, tattoo,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-set-tattoo",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_attach_parasite:
|
|
* @item: The item.
|
|
* @parasite: The parasite to attach to the item.
|
|
*
|
|
* Add a parasite to an item.
|
|
*
|
|
* This procedure attaches a parasite to an item. It has no return
|
|
* values.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_attach_parasite (PikaItem *item,
|
|
const PikaParasite *parasite)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
PIKA_TYPE_PARASITE, parasite,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-attach-parasite",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_detach_parasite:
|
|
* @item: The item.
|
|
* @name: The name of the parasite to detach from the item.
|
|
*
|
|
* Removes a parasite from an item.
|
|
*
|
|
* This procedure detaches a parasite from an item. It has no return
|
|
* values.
|
|
*
|
|
* Returns: TRUE on success.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gboolean
|
|
pika_item_detach_parasite (PikaItem *item,
|
|
const gchar *name)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gboolean success = TRUE;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_STRING, name,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-detach-parasite",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_parasite:
|
|
* @item: The item.
|
|
* @name: The name of the parasite to find.
|
|
*
|
|
* Look up a parasite in an item
|
|
*
|
|
* Finds and returns the parasite that is attached to an item.
|
|
*
|
|
* Returns: (transfer full): The found parasite.
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
PikaParasite *
|
|
pika_item_get_parasite (PikaItem *item,
|
|
const gchar *name)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
PikaParasite *parasite = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_STRING, name,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-parasite",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
parasite = PIKA_VALUES_DUP_PARASITE (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return parasite;
|
|
}
|
|
|
|
/**
|
|
* pika_item_get_parasite_list:
|
|
* @item: The item.
|
|
*
|
|
* List all parasites.
|
|
*
|
|
* Returns a list of all parasites currently attached the an item.
|
|
*
|
|
* Returns: (array zero-terminated=1) (transfer full):
|
|
* The names of currently attached parasites.
|
|
* The returned value must be freed with g_strfreev().
|
|
*
|
|
* Since: 2.8
|
|
**/
|
|
gchar **
|
|
pika_item_get_parasite_list (PikaItem *item)
|
|
{
|
|
PikaValueArray *args;
|
|
PikaValueArray *return_vals;
|
|
gchar **parasites = NULL;
|
|
|
|
args = pika_value_array_new_from_types (NULL,
|
|
PIKA_TYPE_ITEM, item,
|
|
G_TYPE_NONE);
|
|
|
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
|
"pika-item-get-parasite-list",
|
|
args);
|
|
pika_value_array_unref (args);
|
|
|
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
|
parasites = PIKA_VALUES_DUP_STRV (return_vals, 1);
|
|
|
|
pika_value_array_unref (return_vals);
|
|
|
|
return parasites;
|
|
}
|