[gimp-gap/gap-2-8] added LAYER GROUP Support in the FramesModify feature.
- From: Wolfgang Hofer <wolfgangh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-gap/gap-2-8] added LAYER GROUP Support in the FramesModify feature.
- Date: Sat, 15 Feb 2014 09:25:44 +0000 (UTC)
commit a1111eef7891fb199ff66951759061b316406d65
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date: Sat Feb 15 10:16:48 2014 +0100
added LAYER GROUP Support in the FramesModify feature.
ChangeLog | 86 +++++
gap/gap_blend_fill_main.c | 2 +-
gap/gap_bluebox.c | 4 +-
gap/gap_colormask_exec.c | 8 +-
gap/gap_detail_tracking_exec.c | 2 +-
gap/gap_edge_detection.c | 2 +-
gap/gap_fg_matting_dialog.c | 2 +-
gap/gap_fg_matting_exec.c | 4 +-
gap/gap_filter_codegen.c | 4 +-
gap/gap_filter_foreach.c | 8 +-
gap/gap_filter_iterators.c | 6 +-
gap/gap_fire_pattern.c | 20 +-
gap/gap_image.c | 79 +++++-
gap/gap_image.h | 6 +
gap/gap_layer_copy.c | 12 +-
gap/gap_lib.c | 8 +-
gap/gap_main.c | 53 +++-
gap/gap_match.c | 2 +-
gap/gap_mod_layer.c | 639 +++++++++++++++++++++++++++++++-------
gap/gap_mod_layer.h | 33 ++-
gap/gap_mod_layer_dialog.c | 418 ++++++++++++++++++++++++-
gap/gap_mod_layer_dialog.h | 27 ++-
gap/gap_morph_dialog.c | 4 +-
gap/gap_morph_exec.c | 24 +-
gap/gap_morph_main.c | 2 +-
gap/gap_morph_shape.c | 6 +-
gap/gap_mov_dialog.c | 6 +-
gap/gap_mov_exec.c | 18 +-
gap/gap_mov_render.c | 8 +-
gap/gap_mov_xml_par.c | 2 +-
gap/gap_onion_base.c | 16 +-
gap/gap_player_dialog.c | 4 +-
gap/gap_range_ops.c | 12 +-
gap/gap_split.c | 6 +-
gap/gap_story_att_trans_dlg.c | 38 ++--
gap/gap_story_render_processor.c | 10 +-
gap/gap_vex_exec.c | 2 +-
gap/gap_water_pattern.c | 18 +-
gap/gap_wr_resynth.c | 2 +-
libgapvidapi/gap_vid_api.c | 12 +-
libgapvidutil/gap_gve_png.c | 2 +-
41 files changed, 1338 insertions(+), 279 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e8c7b77..eac42f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,89 @@
+2014-02-15 Wolfgang Hofer <hof gimp org>
+
+ - added LAYER GROUP support for the "FramesModify" feature.
+
+ - Added Groupname and delimiter entry widgets where the user can
+ specify the scope of the layer selection.
+ (e.g. the name of the group that contains the layers that are to be selected)
+ Nested groups can be selected as "MyGroup/SubGroup"
+ Where the delimiter string "/" is used to split subgroup names.
+ An empty Groupname refers to the images toplevel layers.
+
+ - Added new Functions:
+ Layer Stackposition/Raise layers(s) to top
+ Layer Stackposition/Lower Layers(s) to bottom
+ Layer Stackposition/Reorder Layer
+
+ Merge Layers/Merge down layer(s) expand as necessary
+ Merge Layers/Merge down layer(s) clipped to image
+ Merge Layers/Merge down layer(s) clipped to bg-layer
+
+ Create Layergroup
+
+ ----------
+
+ The Reorder Layer function provides new entries
+ New Group Name
+ New Position
+ to specify the target group (empty name refers to toplevel image)
+ and stackposition where the selected Layer(s) shall be moved to.
+
+ - Modify Functions "Merge.."
+
+
+ - Modify Function "duplicate layer" now creates the layer above the source layer
+ (older versions placed the duplicate above the active layer)
+
+
+ - replaced the follwing deprecated procedure calls
+
+ gimp_drawable_get_### gimp_item_get_###
+ gimp_drawable_set_### gimp_item_set_##
+ gimp_image_raise_layer gimp_image_raise_item
+ gimp_image_lower_layer gimp_image_lower_item
+
+
+ * gap/gap_blend_fill_main.c
+ * gap/gap_bluebox.c
+ * gap/gap_colormask_exec.c
+ * gap/gap_detail_tracking_exec.c
+ * gap/gap_edge_detection.c
+ * gap/gap_fg_matting_dialog.c
+ * gap/gap_fg_matting_exec.c
+ * gap/gap_filter_codegen.c
+ * gap/gap_filter_foreach.c
+ * gap/gap_filter_iterators.c
+ * gap/gap_fire_pattern.c
+ * gap/gap_image.c
+ * gap/gap_image.h
+ * gap/gap_layer_copy.c
+ * gap/gap_lib.c
+ * gap/gap_main.c
+ * gap/gap_match.c
+ * gap/gap_mod_layer.c
+ * gap/gap_mod_layer.h
+ * gap/gap_mod_layer_dialog.c
+ * gap/gap_mod_layer_dialog.h
+ * gap/gap_morph_dialog.c
+ * gap/gap_morph_exec.c
+ * gap/gap_morph_main.c
+ * gap/gap_morph_shape.c
+ * gap/gap_mov_dialog.c
+ * gap/gap_mov_exec.c
+ * gap/gap_mov_render.c
+ * gap/gap_mov_xml_par.c
+ * gap/gap_onion_base.c
+ * gap/gap_player_dialog.c
+ * gap/gap_range_ops.c
+ * gap/gap_split.c
+ * gap/gap_story_att_trans_dlg.c
+ * gap/gap_story_render_processor.c
+ * gap/gap_vex_exec.c
+ * gap/gap_water_pattern.c
+ * gap/gap_wr_resynth.c
+ * libgapvidapi/gap_vid_api.c
+ * libgapvidutil/gap_gve_png.c
+
2014-02-02 Wolfgang Hofer <hof gimp org>
- added LAYER GROUP Support in the "MovePath" dialog.
diff --git a/gap/gap_blend_fill_main.c b/gap/gap_blend_fill_main.c
index dd6a162..bb5b0ac 100644
--- a/gap/gap_blend_fill_main.c
+++ b/gap/gap_blend_fill_main.c
@@ -1791,7 +1791,7 @@ gap_blend_fill_dialog (FilterVals *fiVals, gint32 drawable_id)
guiStuffPtr = &guiStuffRecord;
- guiStuffPtr->imageId = gimp_drawable_get_image(drawable_id);
+ guiStuffPtr->imageId = gimp_item_get_image(drawable_id);
guiStuffPtr->msg_label = NULL;
guiStuffPtr->svg_entry = NULL;
guiStuffPtr->svg_filesel = NULL;
diff --git a/gap/gap_bluebox.c b/gap/gap_bluebox.c
index efef423..55d122f 100644
--- a/gap/gap_bluebox.c
+++ b/gap/gap_bluebox.c
@@ -167,7 +167,7 @@ gap_bluebox_bbp_new(gint32 layer_id)
bbp->image_filename = NULL;
if(layer_id >= 0)
{
- bbp->image_id = gimp_drawable_get_image(layer_id);
+ bbp->image_id = gimp_item_get_image(layer_id);
bbp->image_filename = g_strdup(gimp_image_get_filename(bbp->image_id));
}
bbp->run_mode = GIMP_RUN_NONINTERACTIVE;
@@ -1657,7 +1657,7 @@ gap_bluebox_apply(GapBlueboxGlobalParams *bbp)
);
gimp_layer_scale(bbp->pv_master_layer_id, l_width, l_height, 0);
gimp_layer_set_offsets(bbp->pv_master_layer_id, 0, 0);
- gimp_drawable_set_visible(bbp->pv_master_layer_id, FALSE);
+ gimp_item_set_visible(bbp->pv_master_layer_id, FALSE);
}
/* use a the scaled mastercopy when operating with reduced preview size */
diff --git a/gap/gap_colormask_exec.c b/gap/gap_colormask_exec.c
index 430a588..dd20c12 100644
--- a/gap/gap_colormask_exec.c
+++ b/gap/gap_colormask_exec.c
@@ -3854,7 +3854,7 @@ p_fetch_colormask_in_previous_frame(gint32 orig_layer_id)
GapAnimInfo *ainfo_ptr;
prevCmskId = -1;
- image_id = gimp_drawable_get_image(orig_layer_id);
+ image_id = gimp_item_get_image(orig_layer_id);
ainfo_ptr = gap_lib_alloc_ainfo(image_id, GIMP_RUN_NONINTERACTIVE);
if(ainfo_ptr != NULL)
{
@@ -3989,7 +3989,7 @@ p_copy_cmaskvals_to_colorMaskParams(GapColormaskValues *cmaskvals, GapColorMaskP
cmaskParPtr->algorithm = cmaskvals->algorithm;
cmaskParPtr->dst_layer_id = dst_layer_id;
- cmaskParPtr->dst_image_id = gimp_drawable_get_image(dst_layer_id);
+ cmaskParPtr->dst_image_id = gimp_item_get_image(dst_layer_id);
cmaskParPtr->cmask_drawable_id = cmaskvals->colormask_id;
cmaskParPtr->colorThreshold = cmaskvals->loColorThreshold; /* use loColorThreshold as default for
colorThreshold */
cmaskParPtr->loColorThreshold = cmaskvals->loColorThreshold;
@@ -4609,7 +4609,7 @@ gap_create_or_replace_colormask_layer (gint32 orig_layer_id
{
/* delete (e.g. close) the previous frame image (form memory not from disk)
*/
- gap_image_delete_immediate(gimp_drawable_get_image(prevCmaskId));
+ gap_image_delete_immediate(gimp_item_get_image(prevCmaskId));
}
return (workLayerId);
@@ -4633,7 +4633,7 @@ gap_colormask_apply_by_name (gint32 dst_layer_id
gint32 colormaskId;
- colormaskId = gap_layer_find_by_name(gimp_drawable_get_image(dst_layer_id), COLORMASK_LAYER_NAME);
+ colormaskId = gap_layer_find_by_name(gimp_item_get_image(dst_layer_id), COLORMASK_LAYER_NAME);
if (colormaskId < 0)
{
return (-1);
diff --git a/gap/gap_detail_tracking_exec.c b/gap/gap_detail_tracking_exec.c
index 850947c..e797cfa 100644
--- a/gap/gap_detail_tracking_exec.c
+++ b/gap/gap_detail_tracking_exec.c
@@ -776,7 +776,7 @@ p_parse_frame_nr_from_layerId(gint32 layerId)
frameNr = 0;
- layername = gimp_drawable_get_name(layerId);
+ layername = gimp_item_get_name(layerId);
if(layername)
{
len = strlen(layername);
diff --git a/gap/gap_edge_detection.c b/gap/gap_edge_detection.c
index df6082a..7695acc 100644
--- a/gap/gap_edge_detection.c
+++ b/gap/gap_edge_detection.c
@@ -753,7 +753,7 @@ gint32 gap_edgeDetection(gint32 refDrawableId
- imageId = gimp_drawable_get_image(activeDrawableId);
+ imageId = gimp_item_get_image(activeDrawableId);
edgeLayerId = gimp_layer_copy(activeDrawableId);
gimp_image_insert_layer (imageId, edgeLayerId, 0, 0 /* stackposition */ );
diff --git a/gap/gap_fg_matting_dialog.c b/gap/gap_fg_matting_dialog.c
index e21b493..7c5c830 100644
--- a/gap/gap_fg_matting_dialog.c
+++ b/gap/gap_fg_matting_dialog.c
@@ -291,7 +291,7 @@ p_tri_map_combo_constrain(gint32 image_id, gint32 drawable_id, FgExtractDialogGu
return(FALSE);
}
- processedImageId = gimp_drawable_get_image(guiStuffPtr->drawable_id);
+ processedImageId = gimp_item_get_image(guiStuffPtr->drawable_id);
if(image_id != processedImageId)
{
diff --git a/gap/gap_fg_matting_exec.c b/gap/gap_fg_matting_exec.c
index 5c5728e..22ddbbd 100644
--- a/gap/gap_fg_matting_exec.c
+++ b/gap/gap_fg_matting_exec.c
@@ -242,7 +242,7 @@ p_tri_map_preprocessing (GimpDrawable *drawable, GapFgExtractValues *fgValPtr, g
gint32 imageId;
*dummyLayerId = -1;
- imageId = gimp_drawable_get_image(drawable->drawable_id);
+ imageId = gimp_item_get_image(drawable->drawable_id);
inputLayerMaskId = gimp_layer_get_mask(drawable->drawable_id);
@@ -327,7 +327,7 @@ gap_drawable_foreground_extract (GimpDrawable *drawable,
{
gint32 imageId;
- imageId = gimp_drawable_get_image(drawable->drawable_id);
+ imageId = gimp_item_get_image(drawable->drawable_id);
resultLayerId = gimp_layer_new(imageId
, "FG"
, drawable->width
diff --git a/gap/gap_filter_codegen.c b/gap/gap_filter_codegen.c
index aa12689..649c874 100644
--- a/gap/gap_filter_codegen.c
+++ b/gap/gap_filter_codegen.c
@@ -541,11 +541,11 @@ gint gap_codegen_gen_code_iterator(char *proc_name)
fprintf(l_fp, " gint32 l_tmp_image_id;\n");
fprintf(l_fp, " gint l_idx, l_idx_from, l_idx_to;\n");
fprintf(l_fp, "\n");
- fprintf(l_fp, " l_tmp_image_id = gimp_drawable_get_image(val_from);\n");
+ fprintf(l_fp, " l_tmp_image_id = gimp_item_get_image(val_from);\n");
fprintf(l_fp, "\n");
fprintf(l_fp, " /* check if from and to values are both valid drawables within the same image
*/\n");
fprintf(l_fp, " if ((l_tmp_image_id > 0)\n");
- fprintf(l_fp, " && (l_tmp_image_id = gimp_drawable_get_image(val_to)))\n");
+ fprintf(l_fp, " && (l_tmp_image_id = gimp_item_get_image(val_to)))\n");
fprintf(l_fp, " {\n");
fprintf(l_fp, " l_idx_from = -1;\n");
fprintf(l_fp, " l_idx_to = -1;\n");
diff --git a/gap/gap_filter_foreach.c b/gap/gap_filter_foreach.c
index c4470be..0034489 100644
--- a/gap/gap_filter_foreach.c
+++ b/gap/gap_filter_foreach.c
@@ -198,7 +198,7 @@ p_visibilty_restore(gint32 image_id, gint nlayers, int *visible_tab, char *plugi
{
for(l_idx = 0; l_idx < nlayers; l_idx++)
{
- gimp_drawable_set_visible(l_layers_list[l_idx], visible_tab[l_idx]);
+ gimp_item_set_visible(l_layers_list[l_idx], visible_tab[l_idx]);
if(gap_debug) printf("visibilty restore [%d] %d\n", (int)l_idx, (int)visible_tab[l_idx]);
}
p_gdisplays_update_full(image_id);
@@ -337,12 +337,12 @@ p_foreach_multilayer2(GimpRunMode run_mode, gint32 image_id,
for(l_idx = 0; l_idx < l_nlayers; l_idx++)
{
l_layer_id = p_get_indexed_layerid(image_id, &l_nlayers, l_idx, canonical_plugin_name);
- l_visible_tab[l_idx] = gimp_drawable_get_visible(l_layer_id);
+ l_visible_tab[l_idx] = gimp_item_get_visible(l_layer_id);
/* make the backround visible, all others invisible
* (so the user can see the effect of the 1.st applied _FROM filter)
*/
- gimp_drawable_set_visible(l_layer_id, (l_idx == l_nlayers - 1));
+ gimp_item_set_visible(l_layer_id, (l_idx == l_nlayers - 1));
}
p_gdisplays_update_full(image_id);
@@ -421,7 +421,7 @@ p_foreach_multilayer2(GimpRunMode run_mode, gint32 image_id,
else
{
/* make _TO layer visible */
- gimp_drawable_set_visible(l_layer_id, TRUE);
+ gimp_item_set_visible(l_layer_id, TRUE);
p_gdisplays_update_full(image_id);
if(gap_debug) printf("DEBUG: apllying %s on Layerstack 0 id=%d\n", canonical_plugin_name,
(int)l_layer_id);
diff --git a/gap/gap_filter_iterators.c b/gap/gap_filter_iterators.c
index a89da29..882e0c0 100644
--- a/gap/gap_filter_iterators.c
+++ b/gap/gap_filter_iterators.c
@@ -469,11 +469,11 @@ p_delta_drawable_simple(gint32 *val, gint32 val_from, gint32 val_to, gint32 tota
{
return;
}
- l_tmp_image_id = gimp_drawable_get_image(val_from);
+ l_tmp_image_id = gimp_item_get_image(val_from);
/* check if from and to values are both valid drawables within the same image */
if ((l_tmp_image_id > 0)
- && (l_tmp_image_id = gimp_drawable_get_image(val_to)))
+ && (l_tmp_image_id = gimp_item_get_image(val_to)))
{
l_idx_from = -1;
l_idx_to = -1;
@@ -568,7 +568,7 @@ p_capture_image_name_and_assign_pesistent_id(GapFmacContext *fmacContext, gint32
{
GapAnimInfo *l_ainfo_ptr;
- image_id = gimp_drawable_get_image(drawable_id);
+ image_id = gimp_item_get_image(drawable_id);
filename = gimp_image_get_filename(image_id);
ainfo_type = GAP_AINFO_ANIMIMAGE;
stackposition = gap_layer_get_stackposition(image_id, drawable_id);
diff --git a/gap/gap_fire_pattern.c b/gap/gap_fire_pattern.c
index 9a0c833..64718aa 100644
--- a/gap/gap_fire_pattern.c
+++ b/gap/gap_fire_pattern.c
@@ -772,7 +772,7 @@ p_init_context_and_cloud_and_shape_layers(gint32 drawable_id, firepattern_val_t
gboolean success;
gdouble strechedHeight;
- ctxt->image_id = gimp_drawable_get_image(drawable_id);
+ ctxt->image_id = gimp_item_get_image(drawable_id);
ctxt->blend_mode = p_convertBlendNum_to_BlendMode(cuvals->blendNum);
ctxt->width = gimp_image_width(ctxt->image_id);
ctxt->height = gimp_image_height(ctxt->image_id);
@@ -1013,7 +1013,7 @@ p_drawable_get_name(gint32 drawable_id)
if(gimp_drawable_is_valid(drawable_id))
{
- return(gimp_drawable_get_name(drawable_id));
+ return(gimp_item_get_name(drawable_id));
}
return (invalidName);
@@ -1046,9 +1046,9 @@ p_run_renderFirePattern(gint32 drawable_id, firepattern_val_t *cuvals, firepatte
/* save visibility status of processed layer .. */
- isVisible = gimp_drawable_get_visible(drawable_id);
+ isVisible = gimp_item_get_visible(drawable_id);
/* .. and force visibility (required for merge down fire pattern to the active layer) */
- gimp_drawable_set_visible(drawable_id, TRUE);
+ gimp_item_set_visible(drawable_id, TRUE);
templayer_id = drawable_id;
nframesToProcess = 1;
@@ -1161,9 +1161,9 @@ p_run_renderFirePattern(gint32 drawable_id, firepattern_val_t *cuvals, firepatte
p_cloud_size_check(newlayer1_id, ctxt);
p_shape_size_check(newlayer2_id, ctxt);
- gimp_drawable_set_visible(newlayer1_id, TRUE);
- gimp_drawable_set_visible(newlayer2_id, TRUE);
- gimp_drawable_set_visible(templayer_id, TRUE);
+ gimp_item_set_visible(newlayer1_id, TRUE);
+ gimp_item_set_visible(newlayer2_id, TRUE);
+ gimp_item_set_visible(templayer_id, TRUE);
/* calculate offsets to shift the cloud layer according to pahse of the currently processed frame */
{
@@ -1220,7 +1220,7 @@ p_run_renderFirePattern(gint32 drawable_id, firepattern_val_t *cuvals, firepatte
gchar *layerName;
layerName = g_strdup_printf("Frame_%03d", (int)count +1);
- gimp_drawable_set_name(templayer_id, layerName);
+ gimp_item_set_name(templayer_id, layerName);
g_free(layerName);
}
@@ -1233,7 +1233,7 @@ p_run_renderFirePattern(gint32 drawable_id, firepattern_val_t *cuvals, firepatte
/* restore visibility status of processed layer */
- gimp_drawable_set_visible(templayer_id, isVisible);
+ gimp_item_set_visible(templayer_id, isVisible);
if (cuvals->createImage)
{
@@ -1626,7 +1626,7 @@ p_pattern_layer_constrain(gint32 image_id, gint32 drawable_id, FirePatternDialog
return(FALSE);
}
- processedImageId = gimp_drawable_get_image(wcd->drawable_id);
+ processedImageId = gimp_item_get_image(wcd->drawable_id);
if(image_id == processedImageId)
{
diff --git a/gap/gap_image.c b/gap/gap_image.c
old mode 100644
new mode 100755
index 5a1a764..4100eca
--- a/gap/gap_image.c
+++ b/gap/gap_image.c
@@ -297,7 +297,7 @@ gap_image_merge_to_specified_layer(gint32 ref_layer_id, GimpMergeType mergemode)
{
gint32 l_image_id;
- l_image_id = gimp_drawable_get_image(ref_layer_id);
+ l_image_id = gimp_item_get_image(ref_layer_id);
if(l_image_id >= 0)
{
gint32 l_idx;
@@ -311,7 +311,7 @@ gap_image_merge_to_specified_layer(gint32 ref_layer_id, GimpMergeType mergemode)
{
if (l_layers_list[l_idx] == ref_layer_id)
{
- gimp_drawable_set_visible(l_layers_list[l_idx], TRUE);
+ gimp_item_set_visible(l_layers_list[l_idx], TRUE);
}
else
{
@@ -356,7 +356,7 @@ gap_image_set_selection_from_selection_or_drawable(gint32 image_id, gint32 ref_d
{
return (FALSE);
}
- ref_image_id = gimp_drawable_get_image(ref_drawable_id);
+ ref_image_id = gimp_item_get_image(ref_drawable_id);
if (ref_image_id < 0)
{
@@ -460,7 +460,7 @@ gap_image_remove_invisble_layers(gint32 image_id)
for(ii=0; ii < l_nlayers; ii++)
{
- if (gimp_drawable_get_visible(l_layers_list[ii]) != TRUE)
+ if (gimp_item_get_visible(l_layers_list[ii]) != TRUE)
{
gimp_image_remove_layer(image_id, l_layers_list[ii]);
}
@@ -1057,3 +1057,74 @@ gap_image_find_or_create_group_layer(gint32 image_id
return(l_group_layer_id);
} /* end gap_image_find_or_create_group_layer */
+
+
+/* -----------------------------
+ * gap_image_reorder_layer
+ * -----------------------------
+ * move the specified layer to another position within the same image.
+ * (done by removing and then re-inserting the layer)
+ * new_groupname
+ * Name of a group or group/subgroup where the specified layer_id shall be moved to.
+ * Note that the string new_groupname uses the delimiter string
+ * to split nested group/sugrup names.
+ * use new_groupname = NULL to move the specified layer_id to image toplevel.
+ * enableGroupCreation
+ * TRUE:
+ * in case the group layer with new_groupname does not exist
+ * it will be created automatically.
+ * FALSE:
+ * in case the group layer with new_groupname does not exist
+ * -1 is returned and the reorder operation is not performed.
+ * new_position
+ * the desired new stackposition within the specified new_groupname
+ * or toplevel image (when new_groupname is NULL or empty)
+ * returns -1 on error
+ */
+gint32
+gap_image_reorder_layer(gint32 image_id, gint32 layer_id,
+ gint32 new_position,
+ char *new_groupname,
+ char *delimiter,
+ gboolean enableGroupCreation,
+ char *new_layername)
+{
+ gint32 l_parent_id;
+ gint32 l_dup_layer_id;
+ gchar *l_name;
+
+ l_parent_id = gap_image_find_or_create_group_layer(image_id
+ , new_groupname
+ , delimiter
+ , 0 /* stackposition for the group in case it is created at toplevel */
+ , enableGroupCreation
+ );
+ if (l_parent_id < 0)
+ {
+ return (-1);
+ }
+
+ l_dup_layer_id = gimp_layer_copy(layer_id);
+
+ l_name = NULL;
+ if (new_layername != NULL)
+ {
+ if (*new_layername != '\0')
+ {
+ l_name = g_strdup(new_layername);
+ }
+ }
+
+ if (l_name == NULL)
+ {
+ l_name = gimp_item_get_name(layer_id);
+ }
+ gimp_image_remove_layer(image_id, layer_id);
+
+ gimp_image_insert_layer(image_id, l_dup_layer_id, l_parent_id, new_position);
+ gimp_item_set_name(l_dup_layer_id, l_name);
+ g_free(l_name);
+
+ return (0); /* OK */
+
+} /* end gap_image_reorder_layer */
diff --git a/gap/gap_image.h b/gap/gap_image.h
old mode 100644
new mode 100755
index bfc04cc..40b46ad
--- a/gap/gap_image.h
+++ b/gap/gap_image.h
@@ -84,6 +84,12 @@ gint32 gap_image_find_or_create_group_layer(gint32 image_id
, gboolean enableCreate
);
+gint32 gap_image_reorder_layer(gint32 image_id, gint32 layer_id,
+ gint32 new_position,
+ char *new_groupname,
+ char *delimiter,
+ gboolean enableGroupCreation,
+ char *new_layername);
#endif
diff --git a/gap/gap_layer_copy.c b/gap/gap_layer_copy.c
index 3eebc58..ced4642 100644
--- a/gap/gap_layer_copy.c
+++ b/gap/gap_layer_copy.c
@@ -75,7 +75,7 @@ gint32 gap_layer_copy_to_dest_image (gint32 dst_image_id,
opacity = CLAMP(opacity, 0.0, 100.0);
- l_name = gimp_drawable_get_name(src_layer_id);
+ l_name = gimp_item_get_name(src_layer_id);
/* copy the layer */
l_new_layer_id = gimp_layer_new_from_drawable(src_layer_id, dst_image_id);
@@ -91,7 +91,7 @@ gint32 gap_layer_copy_to_dest_image (gint32 dst_image_id,
/* findout the offsets of the original layer within the source Image */
gimp_drawable_offsets(src_layer_id, src_offset_x, src_offset_y );
- gimp_drawable_set_name(l_new_layer_id, l_name);
+ gimp_item_set_name(l_new_layer_id, l_name);
gimp_layer_set_opacity(l_new_layer_id, opacity);
gimp_layer_set_mode(l_new_layer_id, mode);
@@ -580,7 +580,7 @@ gap_layer_clear_to_color(gint32 layer_id
{
gint32 image_id;
- image_id = gimp_drawable_get_image(layer_id);
+ image_id = gimp_item_get_image(layer_id);
if(alpha==0.0)
{
@@ -801,11 +801,11 @@ gap_layer_make_duplicate(gint32 src_layer_id, gint32 image_id
{
l_prefix = name_prefix;
}
- l_old_name = gimp_drawable_get_name(src_layer_id);
+ l_old_name = gimp_item_get_name(src_layer_id);
l_new_name = g_strdup_printf("%s%s%s", l_prefix, l_old_name, l_suffix);
- gimp_drawable_set_name(l_new_layer_id, l_new_name);
+ gimp_item_set_name(l_new_layer_id, l_new_name);
g_free(l_old_name);
g_free(l_new_name);
@@ -938,7 +938,7 @@ gap_layer_find_by_name(gint32 image_id, const char *name)
char *layername;
gboolean isEqual;
- layername = gimp_drawable_get_name(l_layers_list[ii]);
+ layername = gimp_item_get_name(l_layers_list[ii]);
isEqual = (strcmp(layername, name) == 0);
g_free(layername);
diff --git a/gap/gap_lib.c b/gap/gap_lib.c
index 0b28116..6bec84b 100644
--- a/gap/gap_lib.c
+++ b/gap/gap_lib.c
@@ -346,7 +346,7 @@ p_set_or_pick_active_layer_by_pos(gint32 image_id
{
char *l_name;
- l_name = gimp_drawable_get_name(l_matching_layer_id);
+ l_name = gimp_item_get_name(l_matching_layer_id);
if(setActiveLayer == TRUE)
{
printf("p_set_or_pick_active_layer_by_pos SET layer_id %d '%s' as ACTIVE\n"
@@ -432,7 +432,7 @@ p_set_or_pick_active_layer_by_name(gint32 image_id
l_score = 0;
l_case_bonus = 0;
l_layer_id = l_layers_list[l_idx];
- l_layer_name = gimp_drawable_get_name(l_layer_id);
+ l_layer_name = gimp_item_get_name(l_layer_id);
if(l_layer_name)
{
gint ii;
@@ -538,7 +538,7 @@ p_set_or_pick_active_layer_by_name(gint32 image_id
{
char *l_name;
- l_name = gimp_drawable_get_name(l_matching_layer_id);
+ l_name = gimp_item_get_name(l_matching_layer_id);
if (setActiveLayer == TRUE)
{
printf("p_set_or_pick_active_layer_by_name SET layer_id %d '%s' as ACTIVE\n"
@@ -594,7 +594,7 @@ p_get_active_layer_name(gint32 image_id
if(*active_layer >= 0)
{
- layer_name = gimp_drawable_get_name(*active_layer);
+ layer_name = gimp_item_get_name(*active_layer);
/* findout stackposition of the active layer
* (ignoring onionskin layer positions)
diff --git a/gap/gap_main.c b/gap/gap_main.c
old mode 100644
new mode 100755
index ee06aa1..cdc70ad
--- a/gap/gap_main.c
+++ b/gap/gap_main.c
@@ -493,12 +493,28 @@ GimpPlugInInfo PLUG_IN_INFO =
", 56:set layer mode to value_mode"
", 57:apply filter on layermask"
", 58:set selection from alphachannel"
+ ", 59:resize layer to mage size"
+ ", 60:create layer from opacity"
+ ", 61:create layer from layermask"
+ ", 62:create layer from alphachannel"
+ ", 63:reorder layer (move to new group and/or position)"
+ ", 64:create empty layergroup"
+ ", 65:raise to top"
+ ", 66:lower to bg"
+ ", 67:merge down expand"
+ ", 68:merge down clip to image"
+ ", 69:merge down clip to bg"
},
{GIMP_PDB_INT32, "select_mode", "Mode how to identify a layer: 0-3 by layername 0=equal, 1=prefix,
2=suffix, 3=contains, 4=layerstack_numberslist, 5=inv_layerstack, 6=all_visible"},
{GIMP_PDB_INT32, "select_case", "0: ignore case 1: select_string is case sensitive"},
{GIMP_PDB_INT32, "select_invert", "0: select normal 1: invert (select all unselected layers)"},
{GIMP_PDB_STRING, "select_string", "string to match with layername (how to match is defined by
select_mode)"},
{GIMP_PDB_STRING, "new_layername", "is only used at action rename. [####] is replaced by the
framnumber"},
+
+ {GIMP_PDB_INT32, "new_position", "new stackposition within the image or in the new group. is only used
at action reorder."},
+ {GIMP_PDB_STRING, "new_groupname", "is only used at action reorder. the selected layer(s) is(are) moved
to this new_groupname (group will be created automatically if it does not already exist)"},
+ {GIMP_PDB_STRING, "select_groupname", "defines the selection scope, e.g. the name of the group where its
layers can be selected by name or position(s). An empty string defines the images toplevel layers as
selection scope"},
+ {GIMP_PDB_STRING, "delimiter", "Delimiter characterstring used in group names to identify subgroup
names."},
};
static int nargs_modify = G_N_ELEMENTS (args_modify);
@@ -559,8 +575,6 @@ MAIN ()
static void
query ()
{
- gchar *l_help_str;
-
gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);
gimp_install_procedure(PLUGIN_NAME_GAP_NEXT,
@@ -962,6 +976,10 @@ run (const gchar *name
const char *l_env;
char l_extension[32];
+ gint32 l_new_position;
+ char l_delimiter[32];
+ char l_sel_groupname[MAX_LAYERNAME];
+ char l_new_groupname[MAX_LAYERNAME];
char l_sel_str[MAX_LAYERNAME];
char l_layername[MAX_LAYERNAME];
char *l_basename_ptr;
@@ -1684,6 +1702,12 @@ run (const gchar *name
}
else if (strcmp (name, PLUGIN_NAME_GAP_MODIFY) == 0)
{
+ l_sel_str[0] = '\0';
+ l_delimiter[0] = '/';
+ l_delimiter[1] = '\0';
+ l_sel_groupname[0] = '\0';
+ l_new_groupname[0] = '\0';
+
if (run_mode == GIMP_RUN_NONINTERACTIVE)
{
if (n_params != nargs_modify)
@@ -1694,13 +1718,24 @@ run (const gchar *name
{
if(param[9].data.d_string != NULL)
{
- strncpy(l_sel_str, param[9].data.d_string, sizeof(l_sel_str) -1);
- l_sel_str[sizeof(l_sel_str) -1] = '\0';
+ g_snprintf(l_sel_str, sizeof(l_sel_str) -1, "%s", param[9].data.d_string);
}
if(param[10].data.d_string != NULL)
{
- strncpy(l_layername, param[10].data.d_string, sizeof(l_layername) -1);
- l_layername[sizeof(l_layername) -1] = '\0';
+ g_snprintf(l_layername, sizeof(l_layername) -1, "%s", param[10].data.d_string);
+ }
+
+ if(param[12].data.d_string != NULL)
+ {
+ g_snprintf(l_new_groupname, sizeof(l_new_groupname) -1, "%s", param[12].data.d_string);
+ }
+ if(param[13].data.d_string != NULL)
+ {
+ g_snprintf(l_sel_groupname, sizeof(l_sel_groupname) -1, "%s", param[13].data.d_string);
+ }
+ if(param[14].data.d_string != NULL)
+ {
+ g_snprintf(l_delimiter, sizeof(l_delimiter) -1, "%s", param[14].data.d_string);
}
}
}
@@ -1714,9 +1749,13 @@ run (const gchar *name
sel_case = param[7].data.d_int32;
sel_invert = param[8].data.d_int32;
+ l_new_position = param[11].data.d_int32;
+
+
l_rc_image = gap_mod_layer(run_mode, image_id, range_from, range_to,
nr, sel_mode, sel_case, sel_invert,
- l_sel_str, l_layername);
+ l_sel_str, l_layername,
+ l_new_position, l_new_groupname, l_sel_groupname, l_delimiter);
}
}
diff --git a/gap/gap_match.c b/gap/gap_match.c
index bbc3b87..51aa811 100644
--- a/gap/gap_match.c
+++ b/gap/gap_match.c
@@ -450,7 +450,7 @@ gap_match_layer(gint32 layer_idx, const char *layername, const char *pattern,
l_rc = gap_match_number((nlayers -1) - layer_idx, pattern);
break;
case GAP_MTCH_ALL_VISIBLE:
- l_rc = gimp_drawable_get_visible(layer_id);
+ l_rc = gimp_item_get_visible(layer_id);
break;
default:
l_rc = gap_match_name(layername, pattern, mode, case_sensitive);
diff --git a/gap/gap_mod_layer.c b/gap/gap_mod_layer.c
old mode 100644
new mode 100755
index 4f95f1f..976fa13
--- a/gap/gap_mod_layer.c
+++ b/gap/gap_mod_layer.c
@@ -85,6 +85,23 @@ extern int gap_debug; /* ==0 ... dont print debug infos */
#define GAP_DB_BROWSER_MODFRAMES_HELP_ID "gap-modframes-db-browser"
+static int p_merge_selected_toplevel_layers(gint32 image_id,
+ gint merge_mode,
+ GapModLayliElem *layli_ptr,
+ gint nlayers,
+ gint32 sel_cnt,
+ long curr,
+ char *new_layername
+ );
+static int p_merge_selected_group_member_layers(gint32 image_id,
+ gint merge_mode,
+ GapModLayliElem *layli_ptr,
+ gint nlayers,
+ gint32 sel_cnt,
+ long curr,
+ char *new_layername
+ );
+
/* ============================================================================
* p_pitstop_dialog
* return -1 on CANCEL
@@ -205,30 +222,57 @@ gap_mod_get_1st_selected (GapModLayliElem * layli_ptr, gint nlayers)
return(-1);
} /* end gap_mod_get_1st_selected */
-
-/* ============================================================================
- * gap_mod_alloc_layli
- * returns pointer to a new allocated image_id of the new created multilayer image
- * (or NULL on error)
- * ============================================================================
+/* -----------------------------
+ * gap_mod_alloc_layli_group
+ * -----------------------------
+ * returns an array of GapModLayliElem struct with information
+ * on all layers in the specified group or subgroup (sel_groupname)
+ * Note that the specified delimiter string is used to split
+ * sel_groupname into group/subgroup (a typically delimiter string is "/")
+ * In case sel_groupname is NULL or an empty string, the information
+ * on toplevel layers in the image is delivered.
+ * returns (NULL on error)
*/
-
GapModLayliElem *
-gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
+gap_mod_alloc_layli_group(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
gint32 sel_mode,
gint32 sel_case,
gint32 sel_invert,
- char *sel_pattern )
+ char *sel_pattern,
+ char *sel_groupname,
+ char *delimiter)
{
gint32 *l_layers_list;
gint32 l_layer_id;
gint32 l_idx;
+ gint32 l_parent_id;
GapModLayliElem *l_layli_ptr;
char *l_layername;
*l_sel_cnt = 0;
+ l_parent_id = gap_image_find_or_create_group_layer(image_id
+ , sel_groupname
+ , delimiter
+ , 0 /* stackposition for the group in case it is created at toplvel */
+ , FALSE /* do not enableCreate (just want to find id of a group layer) */
+ );
+ if(l_parent_id > 0)
+ {
+ l_layers_list = gimp_item_get_children(l_parent_id, nlayers);
+ }
+ else
+ {
+ if(sel_groupname != NULL)
+ {
+ if (*sel_groupname != '\0')
+ {
+ /* the not-empty groupname was not found, therefore no layers shall be affected in this image */
+ return (NULL);
+ }
+ }
+ l_layers_list = gimp_image_get_layers(image_id, nlayers);
+ }
- l_layers_list = gimp_image_get_layers(image_id, nlayers);
if(l_layers_list == NULL)
{
return(NULL);
@@ -244,9 +288,9 @@ gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
for(l_idx = 0; l_idx < (*nlayers); l_idx++)
{
l_layer_id = l_layers_list[l_idx];
- l_layername = gimp_drawable_get_name(l_layer_id);
+ l_layername = gimp_item_get_name(l_layer_id);
l_layli_ptr[l_idx].layer_id = l_layer_id;
- l_layli_ptr[l_idx].visible = gimp_drawable_get_visible(l_layer_id);
+ l_layli_ptr[l_idx].visible = gimp_item_get_visible(l_layer_id);
l_layli_ptr[l_idx].selected = gap_match_layer(l_idx,
l_layername,
sel_pattern,
@@ -258,7 +302,7 @@ gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
{
(*l_sel_cnt)++; /* count all selected layers */
}
- if(gap_debug) printf("gap: gap_mod_alloc_layli [%d] id:%d, sel:%d name:%s:\n",
+ if(gap_debug) printf("gap: gap_mod_alloc_layli_group [%d] id:%d, sel:%d name:%s:\n",
(int)l_idx, (int)l_layer_id,
(int)l_layli_ptr[l_idx].selected, l_layername);
g_free (l_layername);
@@ -267,6 +311,33 @@ gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
g_free (l_layers_list);
return( l_layli_ptr );
+} /* end gap_mod_alloc_layli_group */
+
+/* -------------------------
+ * gap_mod_alloc_layli
+ * -------------------------
+ * returns an array of GapModLayliElem struct with information
+ * on all toplevel layers in the specified image.
+ * (or NULL on error)
+ */
+GapModLayliElem *
+gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
+ gint32 sel_mode,
+ gint32 sel_case,
+ gint32 sel_invert,
+ char *sel_pattern )
+{
+ GapModLayliElem *l_layli_ptr;
+
+ l_layli_ptr = gap_mod_alloc_layli_group(image_id, l_sel_cnt, nlayers
+ , sel_mode
+ , sel_case
+ , sel_invert
+ , sel_pattern
+ , NULL /* sel_groupname == NULL refers to toplevel image */
+ , NULL /* delimiter not relevant */
+ );
+ return( l_layli_ptr );
} /* end gap_mod_alloc_layli */
@@ -277,7 +348,7 @@ gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
* ============================================================================
*/
static void
-p_raise_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gint nlayers)
+p_raise_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gint nlayers, gboolean toTop)
{
if(layli_ptr[0].layer_id == layer_id) return; /* is already on top */
@@ -286,11 +357,18 @@ p_raise_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gi
/* implicitly add an alpha channel before we try to raise */
gimp_layer_add_alpha(layer_id);
}
- gimp_image_raise_layer(image_id, layer_id);
+ if (toTop == TRUE)
+ {
+ gimp_image_raise_item_to_top(image_id, layer_id);
+ }
+ else
+ {
+ gimp_image_raise_item(image_id, layer_id);
+ }
} /* end p_raise_layer */
static void
-p_lower_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gint nlayers)
+p_lower_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gint nlayers, gboolean
toBottom)
{
if(layli_ptr[nlayers-1].layer_id == layer_id) return; /* is already on bottom */
@@ -302,16 +380,22 @@ p_lower_layer (gint32 image_id, gint32 layer_id, GapModLayliElem * layli_ptr, gi
if(nlayers > 1)
{
- if((layli_ptr[nlayers-2].layer_id == layer_id)
+ if(((layli_ptr[nlayers-2].layer_id == layer_id) || (toBottom == TRUE))
&& (! gimp_drawable_has_alpha (layli_ptr[nlayers-1].layer_id)))
{
- /* the layer is one step above a "bottom-layer without alpha" */
+ /* the layer shall move to bottom or is one step above a "bottom-layer without alpha" */
/* implicitly add an alpha channel before we try to lower */
gimp_layer_add_alpha(layli_ptr[nlayers-1].layer_id);
}
}
-
- gimp_image_lower_layer(image_id, layer_id);
+ if (toBottom == TRUE)
+ {
+ gimp_image_lower_item_to_bottom(image_id, layer_id);
+ }
+ else
+ {
+ gimp_image_lower_item(image_id, layer_id);
+ }
} /* end p_lower_layer */
@@ -453,7 +537,215 @@ p_apply_selection_action(gint32 image_id, gint32 action_mode
/* ---------------------------------
- * p_apply_action
+ * p_merge_selected_toplevel_layers
+ * ---------------------------------
+ * perform merge of selcted toplevel layer(s)
+ *
+ * This merge strategy
+ * o) hides all unselected layers (at top image level)
+ * o) calls the merge visible layers procedure of the GIMP core
+ * o) (optionally) sets a new name for the merged layer
+ * o) restores visiblility of the other unselected layers.
+ *
+ * returns 0 if all done OK
+ * (or -1 on error)
+ */
+static int
+p_merge_selected_toplevel_layers(gint32 image_id,
+ gint merge_mode,
+ GapModLayliElem *layli_ptr,
+ gint nlayers,
+ gint32 sel_cnt,
+ long curr,
+ char *new_layername
+ )
+{
+ int l_idx;
+ int l_rc;
+ gint l_vis_result;
+ char l_name_buff[MAX_LAYERNAME];
+ gint32 l_layer_id;
+
+ l_vis_result = FALSE;
+
+ /* set selected layers visible, all others invisible for merge */
+ for(l_idx = 0; l_idx < nlayers; l_idx++)
+ {
+ if(layli_ptr[l_idx].selected == FALSE)
+ {
+ gimp_item_set_visible(layli_ptr[l_idx].layer_id, FALSE);
+ }
+ else
+ {
+ if(gimp_item_get_visible(layli_ptr[l_idx].layer_id))
+ {
+ /* result will be visible if at least one of the
+ * selected layers was visible before
+ */
+ l_vis_result = TRUE;
+ }
+ gimp_item_set_visible(layli_ptr[l_idx].layer_id, TRUE);
+ }
+ }
+
+ /* merge all visible layers (i.e. all selected layers) */
+ l_layer_id = gimp_image_merge_visible_layers (image_id, merge_mode);
+ if(l_vis_result == FALSE)
+ {
+ gimp_item_set_visible(l_layer_id, FALSE);
+ }
+
+ /* if new_layername is available use that name
+ * for the new merged layer
+ */
+ if (!gap_match_string_is_empty (new_layername))
+ {
+ gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
+ new_layername, curr);
+ gimp_item_set_name(l_layer_id, &l_name_buff[0]);
+ }
+
+ /* restore visibility flags after merge */
+ for(l_idx = 0; l_idx < nlayers; l_idx++)
+ {
+ if(layli_ptr[l_idx].selected == FALSE)
+ {
+ gimp_item_set_visible(layli_ptr[l_idx].layer_id,
+ layli_ptr[l_idx].visible);
+ }
+ }
+
+ return(0);
+
+} /* end p_merge_selected_toplevel_layers */
+
+
+/* ------------------------------------
+ * p_merge_selected_group_member_layers
+ * ------------------------------------
+ * perform merge of selcted layer(s) that are all members of
+ * the same layergroup.
+ *
+ * This merge strategy
+ * o) creates a temporary image of same size/type (l_tmp_img_id)
+ * o) copies all selected layers to the temporary image (l_tmp_img_id)
+ * o) calls gimp_image_merge_visible_layers on the temporary image (l_tmp_img_id, mode)
+ * o) copy the merged layer back to the original image
+ * to the same group at the position of the lowest selected layer
+ * o) removes the temporary image
+ * o) removes all selected layers in the original image.
+ *
+ * returns 0 if all done OK
+ * (or -1 on error)
+ */
+static int
+p_merge_selected_group_member_layers(gint32 image_id,
+ gint merge_mode,
+ GapModLayliElem *layli_ptr,
+ gint nlayers,
+ gint32 sel_cnt,
+ long curr,
+ char *new_layername)
+{
+ int l_idx;
+ int l_rc;
+ char l_name_buff[MAX_LAYERNAME];
+ gint32 l_tmp_img_id;
+ gint32 l_layer_id;
+ gint32 l_new_layer_id;
+ gint32 l_merged_layer_id;
+ gint32 l_last_selected_layer_id;
+ gint32 l_parent_id;
+ gint32 l_position;
+ gint l_src_offset_x;
+ gint l_src_offset_y;
+ char *l_name;
+
+
+ /* create a temporary image */
+ l_tmp_img_id = gap_image_new_of_samesize(image_id);
+ l_name = NULL;
+
+ /* copy all selected layers to the temporary image */
+ l_last_selected_layer_id = -1;
+ for(l_idx = nlayers; l_idx >= 0; l_idx--)
+ {
+ if(layli_ptr[l_idx].selected != FALSE)
+ {
+ l_layer_id = layli_ptr[l_idx].layer_id;
+ if (l_last_selected_layer_id < 0)
+ {
+ l_last_selected_layer_id = l_layer_id;
+ l_name = gimp_item_get_name(l_last_selected_layer_id);
+ }
+
+ /* copy the layer from the temp image to the preview multilayer image */
+ l_new_layer_id = gap_layer_copy_to_dest_image(l_tmp_img_id,
+ l_layer_id,
+ gimp_layer_get_opacity(l_layer_id),
+ gimp_layer_get_mode(l_layer_id),
+ &l_src_offset_x,
+ &l_src_offset_y
+ );
+
+ gimp_image_insert_layer (l_tmp_img_id, l_new_layer_id, 0, 0);
+ gimp_layer_set_offsets(l_new_layer_id, l_src_offset_x, l_src_offset_y);
+ }
+ }
+
+ /* merge visible layers in the temporary image */
+ l_merged_layer_id = gimp_image_merge_visible_layers (l_tmp_img_id, merge_mode);
+ l_new_layer_id = gap_layer_copy_to_dest_image(image_id,
+ l_merged_layer_id,
+ gimp_layer_get_opacity(l_merged_layer_id),
+ gimp_layer_get_mode(l_merged_layer_id),
+ &l_src_offset_x,
+ &l_src_offset_y
+ );
+ l_position = gimp_image_get_item_position (image_id, l_last_selected_layer_id);
+ l_parent_id = gimp_item_get_parent(l_last_selected_layer_id);
+ gimp_image_insert_layer (image_id, l_new_layer_id, l_parent_id, l_position);
+ gimp_layer_set_offsets(l_new_layer_id, l_src_offset_x, l_src_offset_y);
+
+ /* remove the selected layers from the original image */
+ for(l_idx = 0; l_idx < nlayers; l_idx++)
+ {
+ if(layli_ptr[l_idx].selected != FALSE)
+ {
+ gimp_image_remove_layer(image_id, layli_ptr[l_idx].layer_id);
+ }
+ }
+
+ /* if new_layername is available use that name
+ * for the new merged layer
+ */
+ if (!gap_match_string_is_empty (new_layername))
+ {
+ gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
+ new_layername, curr);
+ gimp_item_set_name(l_new_layer_id, &l_name_buff[0]);
+ }
+ else if (l_name != NULL)
+ {
+ gimp_item_set_name(l_new_layer_id, l_name);
+ }
+
+ if (l_name != NULL)
+ {
+ g_free(l_name);
+ }
+
+
+ /* remove the temporary image */
+ gap_image_delete_immediate(l_tmp_img_id);
+ return(0);
+
+
+} /* end p_merge_selected_group_member_layers */
+
+
+/* ---------------------------------
+ * p_apply_action2
* ---------------------------------
* perform function (defined by action_mode)
* on all selcted layer(s)
@@ -465,7 +757,7 @@ p_apply_selection_action(gint32 image_id, gint32 action_mode
* (or -1 on error)
*/
static int
-p_apply_action(gint32 image_id,
+p_apply_action2(gint32 image_id,
gint32 action_mode,
GapModLayliElem *layli_ptr,
gint nlayers,
@@ -476,7 +768,10 @@ p_apply_action(gint32 image_id,
long curr,
char *new_layername,
char *filter_procname,
- gint32 master_image_id
+ gint32 master_image_id,
+ gint32 new_position,
+ char *new_groupname,
+ char *delimiter
)
{
int l_idx;
@@ -485,15 +780,15 @@ p_apply_action(gint32 image_id,
gint32 l_layermask_id;
gint32 l_new_layer_id;
gint l_merge_mode;
- gint l_vis_result;
char l_name_buff[MAX_LAYERNAME];
- if(gap_debug) printf("gap: p_apply_action START\n");
+ if(gap_debug) printf("gap: p_apply_action2 START\n");
l_rc = 0;
l_merge_mode = -44; /* none of the flatten modes */
+
if(action_mode == GAP_MOD_ACM_MERGE_EXPAND) l_merge_mode = GAP_RANGE_OPS_FLAM_MERG_EXPAND;
if(action_mode == GAP_MOD_ACM_MERGE_IMG) l_merge_mode = GAP_RANGE_OPS_FLAM_MERG_CLIP_IMG;
if(action_mode == GAP_MOD_ACM_MERGE_BG) l_merge_mode = GAP_RANGE_OPS_FLAM_MERG_CLIP_BG;
@@ -518,68 +813,67 @@ p_apply_action(gint32 image_id,
}
- /* merge actions require one call per image */
+ /* some merge actions require special processing per image
+ * and are handled here
+ */
if(l_merge_mode != (-44))
{
- if(sel_cnt < 2)
- {
- return(0); /* OK, nothing to merge */
- }
+ gint32 l_first_selected_layer_id;
+ gint32 l_parent_id;
- l_vis_result = FALSE;
+ l_idx = gap_mod_get_1st_selected (layli_ptr, nlayers);
+ l_first_selected_layer_id = layli_ptr[l_idx].layer_id;
- /* set selected layers visible, all others invisible for merge */
- for(l_idx = 0; l_idx < nlayers; l_idx++)
+ if(gap_debug)
+ {
+ printf("merge: sel_cnt:%d l_first_selected_layer_id:%d %s\n"
+ , sel_cnt
+ , l_first_selected_layer_id
+ , gimp_item_get_name(l_first_selected_layer_id)
+ );
+ }
+ if(sel_cnt < 2)
{
- if(layli_ptr[l_idx].selected == FALSE)
+ if(sel_cnt != 1)
{
- gimp_drawable_set_visible(layli_ptr[l_idx].layer_id, FALSE);
+ return(0); /* OK, nothing to merge */
}
- else
+
+ if (!gimp_item_is_group(l_first_selected_layer_id))
{
- if(gimp_drawable_get_visible(layli_ptr[l_idx].layer_id))
- {
- /* result will we visible if at least one of the
- * selected layers was visible before
- */
- l_vis_result = TRUE;
- }
- gimp_drawable_set_visible(layli_ptr[l_idx].layer_id, TRUE);
+ return(0); /* there is only one layer selected that is not a group, nothing to merge */
}
+
}
-
- /* merge all visible layers (i.e. all selected layers) */
- l_layer_id = gimp_image_merge_visible_layers (image_id, l_merge_mode);
- if(l_vis_result == FALSE)
- {
- gimp_drawable_set_visible(l_layer_id, FALSE);
- }
-
- /* if new_layername is available use that name
- * for the new merged layer
- */
- if (!gap_match_string_is_empty (new_layername))
+
+ l_parent_id = gimp_item_get_parent(l_first_selected_layer_id);
+ if (l_parent_id > 0)
{
- gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
- new_layername, curr);
- gimp_drawable_set_name(l_layer_id, &l_name_buff[0]);
+ l_rc = p_merge_selected_group_member_layers(image_id
+ ,l_merge_mode
+ ,layli_ptr
+ ,nlayers
+ ,sel_cnt
+ ,curr
+ ,new_layername
+ );
}
-
- /* restore visibility flags after merge */
- for(l_idx = 0; l_idx < nlayers; l_idx++)
+ else
{
- if(layli_ptr[l_idx].selected == FALSE)
- {
- gimp_drawable_set_visible(layli_ptr[l_idx].layer_id,
- layli_ptr[l_idx].visible);
- }
+ l_rc = p_merge_selected_toplevel_layers(image_id
+ ,l_merge_mode
+ ,layli_ptr
+ ,nlayers
+ ,sel_cnt
+ ,curr
+ ,new_layername
+ );
}
-
- return(0);
+ return (l_rc);
}
/* -----------------------------*/
- /* non-merge actions require calls foreach selected layer */
+ /* non-merge actions (except merge down) require calls foreach selected layer */
for(l_idx = 0; (l_idx < nlayers) && (l_rc == 0); l_idx++)
{
l_layer_id = layli_ptr[l_idx].layer_id;
@@ -587,34 +881,49 @@ p_apply_action(gint32 image_id,
/* apply function defined by action_mode */
if(layli_ptr[l_idx].selected != FALSE)
{
- if(gap_debug) printf("gap: p_apply_action on selected LayerID:%d layerstack:%d\n",
+ if(gap_debug) printf("gap: p_apply_action2 on selected LayerID:%d layerstack:%d\n",
(int)l_layer_id, (int)l_idx);
switch(action_mode)
{
+ case GAP_MOD_ACM_MERGE_DOWN_EXPAND:
+ gimp_image_merge_down(image_id, l_layer_id, GAP_RANGE_OPS_FLAM_MERG_EXPAND);
+ break;
+ case GAP_MOD_ACM_MERGE_DOWN_IMG:
+ gimp_image_merge_down(image_id, l_layer_id, GAP_RANGE_OPS_FLAM_MERG_CLIP_IMG);
+ break;
+ case GAP_MOD_ACM_MERGE_DOWN_BG:
+ gimp_image_merge_down(image_id, l_layer_id, GAP_RANGE_OPS_FLAM_MERG_CLIP_BG);
+ break;
case GAP_MOD_ACM_SET_VISIBLE:
- gimp_drawable_set_visible(l_layer_id, TRUE);
+ gimp_item_set_visible(l_layer_id, TRUE);
break;
case GAP_MOD_ACM_SET_INVISIBLE:
- gimp_drawable_set_visible(l_layer_id, FALSE);
+ gimp_item_set_visible(l_layer_id, FALSE);
break;
case GAP_MOD_ACM_SET_LINKED:
- gimp_drawable_set_linked(l_layer_id, TRUE);
+ gimp_item_set_linked(l_layer_id, TRUE);
break;
case GAP_MOD_ACM_SET_UNLINKED:
- gimp_drawable_set_linked(l_layer_id, FALSE);
+ gimp_item_set_linked(l_layer_id, FALSE);
break;
case GAP_MOD_ACM_RAISE:
- p_raise_layer(image_id, l_layer_id, layli_ptr, nlayers);
+ p_raise_layer(image_id, l_layer_id, layli_ptr, nlayers, FALSE);
break;
case GAP_MOD_ACM_LOWER:
- p_lower_layer(image_id, l_layer_id, layli_ptr, nlayers);
+ p_lower_layer(image_id, l_layer_id, layli_ptr, nlayers, FALSE);
+ break;
+ case GAP_MOD_ACM_RAISE_TOP:
+ p_raise_layer(image_id, l_layer_id, layli_ptr, nlayers, TRUE);
+ break;
+ case GAP_MOD_ACM_LOWER_BOTTOM:
+ p_lower_layer(image_id, l_layer_id, layli_ptr, nlayers, TRUE);
break;
case GAP_MOD_ACM_APPLY_FILTER:
l_rc = gap_filt_pdb_call_plugin(filter_procname,
image_id,
l_layer_id,
GIMP_RUN_WITH_LAST_VALS);
- if(gap_debug) printf("gap: p_apply_action FILTER:%s rc =%d\n",
+ if(gap_debug) printf("gap: p_apply_action2 FILTER:%s rc =%d\n",
filter_procname, (int)l_rc);
break;
case GAP_MOD_ACM_APPLY_FILTER_ON_LAYERMASK:
@@ -627,13 +936,20 @@ p_apply_action(gint32 image_id,
}
break;
case GAP_MOD_ACM_DUPLICATE:
- l_new_layer_id = gimp_layer_copy(l_layer_id);
- gimp_image_insert_layer (image_id, l_new_layer_id, 0, -1);
- if (!gap_match_string_is_empty (new_layername))
{
+ gint32 l_parent_id;
+ gint32 l_position;
+
+ l_parent_id = gimp_item_get_parent(l_layer_id);
+ l_position = gimp_image_get_item_position(image_id, l_layer_id);
+ l_new_layer_id = gimp_layer_copy(l_layer_id);
+ gimp_image_insert_layer (image_id, l_new_layer_id, l_parent_id, l_position);
+ if (!gap_match_string_is_empty (new_layername))
+ {
gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
new_layername, curr);
- gimp_drawable_set_name(l_new_layer_id, &l_name_buff[0]);
+ gimp_item_set_name(l_new_layer_id, &l_name_buff[0]);
+ }
}
break;
case GAP_MOD_ACM_DELETE:
@@ -642,7 +958,7 @@ p_apply_action(gint32 image_id,
case GAP_MOD_ACM_RENAME:
gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
new_layername, curr);
- gimp_drawable_set_name(l_layer_id, &l_name_buff[0]);
+ gimp_item_set_name(l_layer_id, &l_name_buff[0]);
break;
case GAP_MOD_ACM_SEL_ALPHA:
@@ -665,7 +981,7 @@ p_apply_action(gint32 image_id,
{
gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
new_layername, curr);
- gimp_drawable_set_name(l_sel_channel_id, &l_name_buff[0]);
+ gimp_item_set_name(l_sel_channel_id, &l_name_buff[0]);
}
}
break;
@@ -684,7 +1000,7 @@ p_apply_action(gint32 image_id,
l_channels = gimp_image_get_channels(image_id, &n_channels);
for(l_ii=0; l_ii < n_channels; l_ii++)
{
- l_channelname = gimp_drawable_get_name(l_channels[l_ii]);
+ l_channelname = gimp_item_get_name(l_channels[l_ii]);
if(l_channelname)
{
if(strcmp(l_channelname,&l_name_buff[0] ) == 0)
@@ -718,7 +1034,7 @@ p_apply_action(gint32 image_id,
l_channels = gimp_image_get_channels(image_id, &n_channels);
for(l_ii=0; l_ii < n_channels; l_ii++)
{
- l_channelname = gimp_drawable_get_name(l_channels[l_ii]);
+ l_channelname = gimp_item_get_name(l_channels[l_ii]);
if(l_channelname)
{
if(strcmp(l_channelname,&l_name_buff[0] ) == 0)
@@ -898,6 +1214,32 @@ p_apply_action(gint32 image_id,
, _("_msk") /* name suffix */
);
break;
+ case GAP_MOD_ACM_REORDER_LAYER:
+ l_name_buff[0] = '\0';
+ if (new_layername != NULL)
+ {
+ if (*new_layername != '\0')
+ {
+ gap_match_substitute_framenr(&l_name_buff[0], sizeof(l_name_buff),
+ new_layername, curr);
+ }
+ }
+ gap_image_reorder_layer(image_id, l_layer_id
+ , new_position
+ , new_groupname
+ , delimiter
+ , TRUE /* enable automatically group creation */
+ , &l_name_buff[0]
+ );
+ break;
+ case GAP_MOD_ACM_NEW_LAYER_GROUP:
+ gap_image_find_or_create_group_layer(image_id
+ , new_groupname
+ , delimiter
+ , new_position
+ , TRUE /* enableGroupCreation */
+ );
+ break;
case GAP_MOD_ACM_SET_MODE_NORMAL:
gimp_layer_set_mode(l_layer_id, GIMP_NORMAL_MODE);
break;
@@ -974,7 +1316,54 @@ p_apply_action(gint32 image_id,
}
return (l_rc);
-} /* end p_apply_action */
+} /* end p_apply_action2 */
+
+
+/* ---------------------------------
+ * p_apply_action
+ * ---------------------------------
+ */
+static int
+p_apply_action(gint32 image_id,
+ gint32 action_mode,
+ GapModLayliElem *layli_ptr,
+ gint nlayers,
+ gint32 sel_cnt,
+
+ long from,
+ long to,
+ long curr,
+ char *new_layername,
+ char *filter_procname,
+ gint32 master_image_id,
+ gint32 new_position,
+ char *new_groupname,
+ char *delimiter
+ )
+{
+ int l_rc;
+
+ gimp_image_undo_group_start (image_id);
+
+ l_rc = p_apply_action2(image_id,
+ action_mode,
+ layli_ptr,
+ nlayers,
+ sel_cnt,
+ from,
+ to,
+ curr,
+ new_layername,
+ filter_procname,
+ master_image_id,
+ new_position,
+ new_groupname,
+ delimiter
+ );
+ gimp_image_undo_group_end (image_id);
+ return l_rc;
+
+} /* end p_apply_action */
/* ============================================================================
@@ -1113,7 +1502,8 @@ p_do_2nd_filter_dialogs(char *filter_procname,
char *last_frame_filename,
gint32 sel_mode, gint32 sel_case,
gint32 sel_invert, char *sel_pattern,
- gboolean operate_on_layermask
+ gboolean operate_on_layermask,
+ char *sel_groupname, char *delimiter
)
{
gint32 l_drawable_id;
@@ -1149,8 +1539,9 @@ p_do_2nd_filter_dialogs(char *filter_procname,
goto cleanup;
/* get informations (id, visible, selected) about all layers */
- l_layli_ptr = gap_mod_alloc_layli(l_last_image_id, &l_sel_cnt, &l_nlayers,
- sel_mode, sel_case, sel_invert, sel_pattern);
+ l_layli_ptr = gap_mod_alloc_layli_group(l_last_image_id, &l_sel_cnt, &l_nlayers,
+ sel_mode, sel_case, sel_invert, sel_pattern,
+ sel_groupname, delimiter);
if (l_layli_ptr == NULL)
goto cleanup;
@@ -1169,7 +1560,7 @@ p_do_2nd_filter_dialogs(char *filter_procname,
if(l_drawable_id < 0)
{
g_message (_("Modify Layers cancelled: first selected layer \"%s\"\nin last frame has no layermask"),
- gimp_drawable_get_name(l_layli_ptr[l_idx].layer_id)
+ gimp_item_get_name(l_layli_ptr[l_idx].layer_id)
);
goto cleanup;
}
@@ -1217,16 +1608,23 @@ cleanup:
} /* end p_do_2nd_filter_dialogs */
-/* ============================================================================
+/* --------------------------
* gap_mod_frames_modify
- *
+ * --------------------------
* foreach frame of the range (given by range_from and range_to)
* perform function defined by action_mode
* on all selected layer(s) described by sel_mode, sel_case
* sel_invert and sel_pattern
+ * the scope of selectable layers can be image toplevel layers
+ * when sel_groupname is NULL or empty string.
+ * or the members of the specified layergroup
+ * specified by the sel_groupname string
+ * that may refere to a nested group.
+ * note that groupname/subgroupname are splitted by the specified delimter string
+ * (typical "/" is used as delimiter)
+ *
* returns 0 if all done OK
* (or -1 on error or cancel)
- * ============================================================================
*/
gint32
gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
@@ -1234,6 +1632,8 @@ gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
gint32 action_mode, gint32 sel_mode,
gint32 sel_case, gint32 sel_invert,
char *sel_pattern, char *new_layername,
+ gint32 new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter,
GtkWidget *progress_bar,
gboolean *run_flag)
{
@@ -1363,9 +1763,10 @@ gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
goto error;
}
- /* get informations (id, visible, selected) about all layers */
- l_layli_ptr = gap_mod_alloc_layli(l_tmp_image_id, &l_sel_cnt, &l_nlayers,
- sel_mode, sel_case, sel_invert, sel_pattern);
+ /* get informations (id, visible, selected) about all layers at releant level */
+ l_layli_ptr = gap_mod_alloc_layli_group(l_tmp_image_id, &l_sel_cnt, &l_nlayers,
+ sel_mode, sel_case, sel_invert, sel_pattern,
+ sel_groupname, delimiter);
if(l_layli_ptr == NULL)
{
@@ -1393,7 +1794,7 @@ gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
if(gimp_layer_get_mask(l_layli_ptr[l_ii].layer_id) < 0)
{
g_message(_("first selected layer \"%s\"\nin start frame has no layermask"),
- gimp_drawable_get_name(l_layli_ptr[l_ii].layer_id)
+ gimp_item_get_name(l_layli_ptr[l_ii].layer_id)
);
goto error;
}
@@ -1430,7 +1831,8 @@ gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
accelCharacteristic,
l_last_frame_filename,
sel_mode, sel_case, sel_invert, sel_pattern,
- l_operate_on_layermask
+ l_operate_on_layermask,
+ sel_groupname, delimiter
);
}
@@ -1471,7 +1873,10 @@ gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
l_begin, l_end, l_cur_frame_nr,
new_layername,
&l_filter_procname[0],
- ainfo_ptr->image_id /* MASTER_image_id */
+ ainfo_ptr->image_id, /* MASTER_image_id */
+ new_position,
+ new_groupname,
+ delimiter
);
if(l_rc != 0)
{
@@ -1672,12 +2077,13 @@ error:
* gap_mod_layer
* ============================================================================
*/
-
gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
gint32 range_from, gint32 range_to,
gint32 action_mode, gint32 sel_mode,
gint32 sel_case, gint32 sel_invert,
- char *sel_pattern, char *new_layername)
+ char *sel_pattern, char *new_layername,
+ gint32 new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter)
{
int l_rc;
GapAnimInfo *ainfo_ptr;
@@ -1692,11 +2098,20 @@ gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
char l_sel_pattern[MAX_LAYERNAME];
char l_new_layername[MAX_LAYERNAME];
+ gint32 l_new_position;
+ char l_new_groupname[MAX_LAYERNAME];
+ char l_sel_groupname[MAX_LAYERNAME];
+ char l_delimiter[32];
l_rc = 0;
progress_bar = NULL;
dlg = NULL;
+ l_delimiter[0] = '/';
+ l_delimiter[1] = '\0';
+ l_sel_groupname[0] = '\0';
+ l_new_groupname[0] = '\0';
+
ainfo_ptr = gap_lib_alloc_ainfo(image_id, run_mode);
if(ainfo_ptr != NULL)
{
@@ -1711,7 +2126,10 @@ gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
l_rc = gap_mod_frames_dialog (ainfo_ptr, &l_from, &l_to,
&l_action_mode,
&l_sel_mode, &sel_case, &sel_invert,
- &l_sel_pattern[0], &l_new_layername[0]);
+ &l_sel_pattern[0], &l_new_layername[0],
+ &l_new_position,
+ &l_new_groupname[0], &l_sel_groupname[0], &l_delimiter[0]
+ );
gap_lib_free_ainfo(&ainfo_ptr);
return (l_rc);
}
@@ -1724,10 +2142,15 @@ gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
l_sel_case = sel_case;
l_sel_invert = sel_invert;
- strncpy(&l_sel_pattern[0], sel_pattern, sizeof(l_sel_pattern) -1);
- l_sel_pattern[sizeof(l_sel_pattern) -1] = '\0';
- strncpy(&l_new_layername[0], new_layername, sizeof(l_new_layername) -1);
- l_new_layername[sizeof(l_new_layername) -1] = '\0';
+ g_snprintf(&l_sel_pattern[0], sizeof(l_sel_pattern) -1, "%s", sel_pattern);
+ g_snprintf(&l_new_layername[0], sizeof(l_new_layername) -1, "%s", new_layername);
+
+ l_new_position = new_position;
+ g_snprintf(&l_new_groupname[0], sizeof(l_new_groupname) -1, "%s", new_groupname);
+ g_snprintf(&l_sel_groupname[0], sizeof(l_sel_groupname) -1, "%s", sel_groupname);
+ g_snprintf(&l_delimiter[0], sizeof(l_delimiter) -1, "%s", delimiter);
+
+
}
if(l_rc >= 0)
@@ -1745,6 +2168,8 @@ gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
l_action_mode,
l_sel_mode, sel_case, sel_invert,
&l_sel_pattern[0], &l_new_layername[0],
+ l_new_position,
+ &l_new_groupname[0], &l_sel_groupname[0], &l_delimiter[0],
progress_bar, &run_flag
);
}
diff --git a/gap/gap_mod_layer.h b/gap/gap_mod_layer.h
old mode 100644
new mode 100755
index 828e666..0fc44ed
--- a/gap/gap_mod_layer.h
+++ b/gap/gap_mod_layer.h
@@ -114,6 +114,14 @@
#define GAP_MOD_ACM_CREATE_LAYER_FROM_LMASK 61
#define GAP_MOD_ACM_CREATE_LAYER_FROM_ALPHA 62
+#define GAP_MOD_ACM_REORDER_LAYER 63
+#define GAP_MOD_ACM_NEW_LAYER_GROUP 64
+#define GAP_MOD_ACM_RAISE_TOP 65
+#define GAP_MOD_ACM_LOWER_BOTTOM 66
+#define GAP_MOD_ACM_MERGE_DOWN_EXPAND 67
+#define GAP_MOD_ACM_MERGE_DOWN_IMG 68
+#define GAP_MOD_ACM_MERGE_DOWN_BG 69
+
typedef struct
{
gint32 layer_id;
@@ -121,24 +129,37 @@ typedef struct
gint selected;
} GapModLayliElem;
-GapModLayliElem *gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers,
- gint32 sel_mode,
- gint32 sel_case,
- gint32 sel_invert,
- char *sel_pattern );
+GapModLayliElem *gap_mod_alloc_layli(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers
+ , gint32 sel_mode
+ , gint32 sel_case
+ , gint32 sel_invert
+ , char *sel_pattern
+ );
+GapModLayliElem *gap_mod_alloc_layli_group(gint32 image_id, gint32 *l_sel_cnt, gint *nlayers
+ , gint32 sel_mode
+ , gint32 sel_case
+ , gint32 sel_invert
+ , char *sel_pattern
+ , char *sel_groupname
+ , char *delimiter
+ );
int gap_mod_get_1st_selected (GapModLayliElem * layli_ptr, gint nlayers);
gint gap_mod_layer(GimpRunMode run_mode, gint32 image_id,
gint32 range_from, gint32 range_to,
gint32 action_mode, gint32 sel_mode,
gint32 sel_case, gint32 sel_invert,
- char *sel_pattern, char *new_layername);
+ char *sel_pattern, char *new_layername,
+ gint32 new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter);
gint32 gap_mod_frames_modify(GapAnimInfo *ainfo_ptr,
long range_from, long range_to,
gint32 action_mode, gint32 sel_mode,
gint32 sel_case, gint32 sel_invert,
char *sel_pattern, char *new_layername,
+ gint32 new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter,
GtkWidget *progress_bar,
gboolean *run_flag);
diff --git a/gap/gap_mod_layer_dialog.c b/gap/gap_mod_layer_dialog.c
old mode 100644
new mode 100755
index 49b7d69..f10d79d
--- a/gap/gap_mod_layer_dialog.c
+++ b/gap/gap_mod_layer_dialog.c
@@ -63,6 +63,8 @@
#define MENU_ITEM_TITLE_KEY "gap_menu_item_title_key"
#define MENU_ITEM_TIPTEXT_KEY "gap_menu_item_tiptext_key"
+#define GAP_MOD_FRAMES_RESPONSE_ACTIVE 1
+
extern int gap_debug; /* ==0 ... dont print debug infos */
@@ -98,8 +100,15 @@ static void p_case_sensitive_toggled_callback(GtkCheckButton *checkbutton, GapMo
static void p_invert_selection_toggled_callback(GtkCheckButton *checkbutton, GapModFramesGlobalParams *gmop);
static void p_layer_pattern_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop);
static void p_new_layername_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop);
+static void p_new_groupname_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop);
+static void p_sel_groupname_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop);
+static void p_delimiter_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop);
+
+
static void p_sel_mode_radio_callback(GtkWidget *widget, GapModFramesGlobalParams *gmop);
static void p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop);
+static void p_get_values_from_active_layer(GapModFramesGlobalParams *gmop);
+
/* ---------------------------------
@@ -111,9 +120,14 @@ p_mod_frames_response (GtkWidget *widget,
gint response_id,
GapModFramesGlobalParams *gmop)
{
- if (response_id == GTK_RESPONSE_CANCEL)
+ if (response_id == GAP_MOD_FRAMES_RESPONSE_ACTIVE)
+ {
+ p_get_values_from_active_layer(gmop);
+ return;
+ }
+ else if (response_id == GTK_RESPONSE_CANCEL)
{
- gmop->retcode = -1;
+ gmop->retcode = -1;
if(gmop->run_flag == TRUE)
{
gmop->run_flag = FALSE;
@@ -138,6 +152,10 @@ p_mod_frames_response (GtkWidget *widget,
, gmop->sel_invert
, gmop->sel_pattern
, gmop->new_layername
+ , gmop->new_position
+ , gmop->new_groupname
+ , gmop->sel_groupname
+ , gmop->delimiter
, gmop->progress_bar
, &gmop->run_flag
);
@@ -155,6 +173,154 @@ p_mod_frames_response (GtkWidget *widget,
}
} /* end p_mod_frames_response */
+
+/* ---------------------------------
+ * p_get_values_from_active_layer
+ * ---------------------------------
+ */
+static void
+p_get_values_from_active_layer(GapModFramesGlobalParams *gmop)
+{
+ gint32 l_image_id;
+ gint32 l_active_layer_id;
+ gint32 l_parent_layer_id;
+ gchar *l_group_path;
+ gchar *l_delimiter;
+ gchar *l_name;
+ gint32 l_position;
+
+ if (gmop == NULL)
+ {
+ return;
+ }
+ if((gmop->ainfo_ptr == NULL)
+ || (gmop->layer_pattern_entry == NULL)
+ || (gmop->sel_groupname_entry == NULL))
+ {
+ return;
+ }
+
+
+ l_image_id = gmop->ainfo_ptr->image_id;
+ l_active_layer_id = gimp_image_get_active_layer(l_image_id);
+ if (l_active_layer_id < 0)
+ {
+ return;
+ }
+
+ l_group_path = g_strdup("\0");
+ l_delimiter = g_strdup("\0");
+ l_parent_layer_id = gimp_item_get_parent (l_active_layer_id);
+ while(l_parent_layer_id > 0)
+ {
+ char *l_name;
+ char *l_group_path_new;
+
+ l_name = gimp_item_get_name(l_parent_layer_id);
+ l_group_path_new = g_strdup_printf("%s%s%s", l_name, l_delimiter, l_group_path);
+
+
+
+ g_free(l_delimiter);
+ g_free(l_name);
+ g_free(l_group_path);
+ l_group_path = l_group_path_new;
+ l_delimiter = g_strdup(&gmop->delimiter[0]);
+
+ l_parent_layer_id = gimp_item_get_parent (l_parent_layer_id);
+
+ }
+
+ gtk_entry_set_text(GTK_ENTRY(gmop->sel_groupname_entry), l_group_path);
+ g_free(l_group_path);
+
+ switch(gmop->sel_mode)
+ {
+ case GAP_MTCH_EQUAL:
+ case GAP_MTCH_START:
+ case GAP_MTCH_END:
+ case GAP_MTCH_ANYWHERE:
+ l_name = gimp_item_get_name(l_active_layer_id);
+ break;
+ case GAP_MTCH_INV_NUMBERLIST:
+ {
+ gint l_nlayers;
+ gint32 *l_src_layers;
+ l_src_layers = NULL;
+ l_nlayers = 0;
+ l_parent_layer_id = gimp_item_get_parent (l_active_layer_id);
+ if (l_parent_layer_id <= 0)
+ {
+ l_src_layers = gimp_image_get_layers (l_image_id, &l_nlayers);
+ }
+ else
+ {
+ l_src_layers = gimp_item_get_children (l_parent_layer_id, &l_nlayers);
+ }
+ if (l_src_layers != NULL)
+ {
+ g_free(l_src_layers);
+ }
+ l_position = gimp_image_get_item_position (l_image_id, l_active_layer_id);
+ l_name = g_strdup_printf("%d", (l_nlayers -1) - l_position);
+ }
+ break;
+ default:
+ l_position = gimp_image_get_item_position (l_image_id, l_active_layer_id);
+ l_name = g_strdup_printf("%d", l_position);
+ break;
+ }
+ gtk_entry_set_text(GTK_ENTRY(gmop->layer_pattern_entry), l_name);
+ g_free(l_name);
+
+
+
+} /* end p_get_values_from_active_layer */
+
+
+
+/* --------------------------------------
+ * p_hide_or_show_widget
+ * --------------------------------------
+ */
+static void
+p_hide_or_show_widget(GtkWidget *wgt, gboolean sensitive)
+{
+ if(wgt)
+ {
+ if(sensitive == TRUE)
+ {
+ gtk_widget_show(wgt);
+ }
+ else
+ {
+ gtk_widget_hide(wgt);
+ }
+ }
+
+} /* end p_hide_or_show_widget */
+
+
+/* --------------------------------------
+ * p_hide_or_show_attached_widget_by_name
+ * --------------------------------------
+ */
+static void
+p_hide_or_show_attached_widget_by_name(GtkObject *adj, const char *name, gboolean sensitive)
+{
+ GtkWidget *wgt;
+
+ if(adj == NULL)
+ {
+ return;
+ }
+
+ wgt = GTK_WIDGET(g_object_get_data (G_OBJECT (adj), name));
+ p_hide_or_show_widget(wgt, sensitive);
+
+} /* end p_hide_or_show_attached_widget_by_name */
+
+
/* ---------------------------------
* p_upd_sensitivity
* ---------------------------------
@@ -165,9 +331,11 @@ p_upd_sensitivity(GapModFramesGlobalParams *gmop)
GtkWidget *wgt;
gboolean l_sensitive;
gboolean l_sensitive_frame;
+ gboolean l_sensitive_new_group;
const char *l_label_name;
l_sensitive = FALSE;
+ l_sensitive_new_group = FALSE;
switch(gmop->sel_mode)
{
case GAP_MTCH_EQUAL:
@@ -207,6 +375,14 @@ p_upd_sensitivity(GapModFramesGlobalParams *gmop)
l_label_name = " ";
switch(gmop->action_mode)
{
+ case GAP_MOD_ACM_NEW_LAYER_GROUP:
+ l_sensitive_new_group = TRUE;
+ break;
+ case GAP_MOD_ACM_REORDER_LAYER:
+ l_label_name = _("New Layer Name");
+ l_sensitive = TRUE;
+ l_sensitive_new_group = TRUE;
+ break;
case GAP_MOD_ACM_DUPLICATE:
case GAP_MOD_ACM_RENAME:
l_label_name = _("New Layer Name");
@@ -256,11 +432,20 @@ p_upd_sensitivity(GapModFramesGlobalParams *gmop)
gtk_label_set_text(GTK_LABEL(wgt), l_label_name);
}
+
+ p_hide_or_show_widget(gmop->new_groupname_label, l_sensitive_new_group);
+ p_hide_or_show_widget(gmop->new_groupname_entry, l_sensitive_new_group);
+
+ p_hide_or_show_attached_widget_by_name(gmop->new_position_adj, "label", l_sensitive_new_group);
+ p_hide_or_show_attached_widget_by_name(gmop->new_position_adj, "scale", l_sensitive_new_group);
+ p_hide_or_show_attached_widget_by_name(gmop->new_position_adj, "spinbutton", l_sensitive_new_group);
+
} /* end p_upd_sensitivity */
+
/* ---------------------------------
* p_func_optionmenu_callback
* ---------------------------------
@@ -569,6 +754,12 @@ p_make_layer_stackpositions_submenu(GtkWidget *master_menu, GapModFramesGlobalPa
sub_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
+ p_make_func_menu_item(_("Raise layer(s) to top")
+ ,_("raise selected layer(s) to top")
+ ,GAP_MOD_ACM_RAISE_TOP
+ ,sub_menu
+ ,gmop
+ );
p_make_func_menu_item(_("Raise layer(s)")
,_("raise all selected layers")
,GAP_MOD_ACM_RAISE
@@ -581,6 +772,18 @@ p_make_layer_stackpositions_submenu(GtkWidget *master_menu, GapModFramesGlobalPa
,sub_menu
,gmop
);
+ p_make_func_menu_item(_("Lower layer(s) to bottom")
+ ,_("lower selected layer(s) to bottom")
+ ,GAP_MOD_ACM_LOWER_BOTTOM
+ ,sub_menu
+ ,gmop
+ );
+ p_make_func_menu_item(_("Reorder layer(s)")
+ ,_("move the selected layer(s) to specified group and/or stack position")
+ ,GAP_MOD_ACM_REORDER_LAYER
+ ,sub_menu
+ ,gmop
+ );
} /* end p_make_layer_stackpositions_submenu */
@@ -621,6 +824,25 @@ p_make_merge_layers_submenu(GtkWidget *master_menu, GapModFramesGlobalParams *gm
,gmop
);
+ p_make_func_menu_item(_("Merge down layer(s); expand as necessary")
+ ,_("merge selected layers with the layer below and expand as necessary")
+ ,GAP_MOD_ACM_MERGE_DOWN_EXPAND
+ ,sub_menu
+ ,gmop
+ );
+ p_make_func_menu_item(_("Merge down layer(s); clipped to image")
+ ,_("merge selected layers with the layer below and clip to image size")
+ ,GAP_MOD_ACM_MERGE_DOWN_IMG
+ ,sub_menu
+ ,gmop
+ );
+ p_make_func_menu_item(_("Merge down layer(s) clipped to bg-layer")
+ ,_("merge selected layers with the layer below and clip to bg-layer")
+ ,GAP_MOD_ACM_MERGE_DOWN_BG
+ ,sub_menu
+ ,gmop
+ );
+
} /* end p_make_merge_layers_submenu */
@@ -870,6 +1092,12 @@ p_make_toplevel_menu_items(GtkWidget *master_menu, GapModFramesGlobalParams *gmo
,master_menu
,gmop
);
+ p_make_func_menu_item(_("Create Layergroup")
+ ,NULL
+ ,GAP_MOD_ACM_NEW_LAYER_GROUP
+ ,master_menu
+ ,gmop
+ );
} /* end p_make_toplevel_menu_items */
@@ -950,6 +1178,58 @@ p_new_layername_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmo
);
} /* end p_new_layername_entry_update_cb */
+/* --------------------------
+ * p_sel_groupname_entry_update_cb
+ * --------------------------
+ */
+static void
+p_sel_groupname_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop)
+{
+ if(gmop == NULL)
+ {
+ return;
+ }
+
+ g_snprintf(gmop->sel_groupname, sizeof(gmop->sel_groupname), "%s"
+ , gtk_entry_get_text(GTK_ENTRY(widget))
+ );
+} /* end p_sel_groupname_entry_update_cb */
+
+/* --------------------------
+ * p_new_groupname_entry_update_cb
+ * --------------------------
+ */
+static void
+p_new_groupname_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop)
+{
+ if(gmop == NULL)
+ {
+ return;
+ }
+
+ g_snprintf(gmop->new_groupname, sizeof(gmop->new_groupname), "%s"
+ , gtk_entry_get_text(GTK_ENTRY(widget))
+ );
+} /* end p_new_groupname_entry_update_cb */
+
+
+/* --------------------------
+ * p_delimiter_entry_update_cb
+ * --------------------------
+ */
+static void
+p_delimiter_entry_update_cb(GtkWidget *widget, GapModFramesGlobalParams *gmop)
+{
+ if(gmop == NULL)
+ {
+ return;
+ }
+
+ g_snprintf(gmop->delimiter, sizeof(gmop->delimiter), "%s"
+ , gtk_entry_get_text(GTK_ENTRY(widget))
+ );
+} /* end p_delimiter_entry_update_cb */
+
/* --------------------------
* p_sel_mode_radio_callback
@@ -990,6 +1270,7 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
GtkWidget *table;
GtkWidget *func_table;
GtkWidget *sel_table;
+ GtkWidget *sel_sub_table;
GtkWidget *range_table;
GtkWidget *label;
GtkWidget *check_button;
@@ -998,6 +1279,7 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
GtkWidget *master_menu;
GtkWidget *progress_bar;
gint row;
+ gint subrow;
GtkObject *adj;
GtkWidget *radio_button;
@@ -1010,6 +1292,7 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
NULL, 0,
gimp_standard_help_func, GAP_MOD_FRAMES_HELP_ID,
+ _("Get Active Layer"), GAP_MOD_FRAMES_RESPONSE_ACTIVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
@@ -1123,7 +1406,49 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
, _("Name for all handled layers (or channels),\n"
"where the string '[######]' is replaced by the frame number.")
, NULL);
+ row++;
+ /* the newGroupName label */
+ label = gtk_label_new (_("New Group Name:"));
+ gmop->new_groupname_label = label;
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+ gtk_table_attach (GTK_TABLE(table), label, 0, 1, row, row+1
+ , GTK_FILL, 0, 0, 0);
+ gtk_widget_show (label);
+
+ /* the newGroupName entry */
+ entry = gtk_entry_new();
+ gmop->new_groupname_entry = entry;
+ gtk_entry_set_text(GTK_ENTRY(entry), gmop->new_groupname);
+ gtk_widget_show(entry);
+ gtk_table_attach (GTK_TABLE(table), entry, 1, 2, row, row+1
+ ,GTK_FILL|GTK_EXPAND , 0, 0, 0);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK (p_new_groupname_entry_update_cb),
+ gmop);
+ gimp_help_set_help_data(entry
+ , _("Name for the new group to be created if not already present\n"
+ "(relevant in reorder layer and creat group function)")
+ , NULL);
+
+ row++;
+ /* the new_position scale entry */
+ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row,
+ _("New Position:"), SCALE_WIDTH, SPIN_BUTTON_WIDTH,
+ (gdouble)gmop->new_position,
+ (gdouble)0, /* lower */
+ (gdouble)999, /* upper */
+ 1, 10, /* step, page */
+ 0, /* digits */
+ TRUE, /* constrain */
+ (gdouble)gmop->ainfo_ptr->first_frame_nr, /* lower unconstrained */
+ (gdouble)gmop->ainfo_ptr->last_frame_nr, /* upper unconstrained */
+ _("New Stack position (relevant for reorder layer function)"), NULL);
+ gmop->new_position_adj = adj;
+ g_object_set_data(G_OBJECT(adj), "gmop", gmop);
+ g_signal_connect (adj, "value_changed",
+ G_CALLBACK (gimp_int_adjustment_update),
+ &gmop->new_position);
/* +++++++++++++++++++++++++ */
/* the layer selection frame */
@@ -1207,7 +1532,7 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
,(GtkAttachOptions) (GTK_FILL)
,(GtkAttachOptions) (0), 0, 0);
gimp_help_set_help_data (check_button
- , _("Perform actions on all unselected layers")
+ , _("Perform actions on all unselected layers at same level in the layers tree
(e.g. in the same group)")
, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button)
, gmop->sel_invert);
@@ -1315,7 +1640,7 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button),
l_radio_pressed);
gimp_help_set_help_data(radio_button
- , _("Select all visible layers")
+ , _("Select all visible layers at same level in the layers tree (e.g. in the same
group)")
, NULL);
gtk_widget_show (radio_button);
@@ -1328,14 +1653,19 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
row++;
- /* the hbox */
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_show (hbox);
+ /* the sel_sub_table */
+ sel_sub_table = gtk_table_new (2, 3, FALSE);
+ gtk_widget_show (sel_sub_table);
+
+ subrow = 0;
+
/* the layer_pattern label */
label = gtk_label_new (_("Layer Pattern:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE(sel_sub_table), label, 0, 1, subrow, subrow+1
+ , 0, 0, 0, 0);
/* the layer_pattern entry */
@@ -1350,12 +1680,59 @@ p_create_mod_frames_dialog(GapModFramesGlobalParams *gmop)
G_CALLBACK (p_layer_pattern_entry_update_cb),
gmop);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 4);
+ gtk_table_attach (GTK_TABLE(sel_sub_table), entry, 1, 3, subrow, subrow+1
+ , GTK_FILL | GTK_EXPAND, 0, 0, 0);
+
+
+ subrow++;
+
+ /* the sel_groupname label */
+ label = gtk_label_new (_("Groupname:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE(sel_sub_table), label, 0, 1, subrow, subrow+1
+ , 0, 0, 0, 0);
+
+
+ /* the sel_groupname entry */
+ entry = gtk_entry_new();
+ gmop->sel_groupname_entry = entry;
+ gtk_entry_set_text(GTK_ENTRY(entry), gmop->sel_groupname);
+ gimp_help_set_help_data(entry
+ , _("String to identify layer group/subgroup name "
+ "that builds the scope for the layer selection. "
+ "An empty string refers to the image toplevel")
+ , NULL);
+ gtk_widget_show(entry);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK (p_sel_groupname_entry_update_cb),
+ gmop);
- gtk_table_attach (GTK_TABLE(sel_table), hbox, 0, 2, row, row+1
+ gtk_table_attach (GTK_TABLE(sel_sub_table), entry, 1, 2, subrow, subrow+1
, GTK_FILL | GTK_EXPAND, 0, 0, 0);
+ /* the delimiter entry */
+ entry = gtk_entry_new();
+ gmop->delimiter_entry = entry;
+ gtk_entry_set_text(GTK_ENTRY(entry), gmop->delimiter);
+ gtk_widget_set_size_request(entry, SPIN_BUTTON_WIDTH, -1);
+ gimp_help_set_help_data(entry
+ , _("Delimiter string to split layer group/subgroup names.")
+ , NULL);
+ gtk_widget_show(entry);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK (p_delimiter_entry_update_cb),
+ gmop);
+
+ gtk_table_attach (GTK_TABLE(sel_sub_table), entry, 2, 3, subrow, subrow+1
+ , GTK_FILL, 0, 0, 0);
+
+
+
+
+
+ gtk_table_attach (GTK_TABLE(sel_table), sel_sub_table, 0, 2, row, row+1
+ , GTK_FILL | GTK_EXPAND, 0, 0, 0);
@@ -1439,7 +1816,9 @@ gap_mod_frames_dialog(GapAnimInfo *ainfo_ptr,
gint32 *range_from, gint32 *range_to,
gint32 *action_mode, gint32 *sel_mode,
gint32 *sel_case, gint32 *sel_invert,
- char *sel_pattern, char *new_layername)
+ char *sel_pattern, char *new_layername,
+ gint32 *new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter)
{
GapModFramesGlobalParams global_modify_params;
GapModFramesGlobalParams *gmop;
@@ -1462,6 +1841,11 @@ gap_mod_frames_dialog(GapAnimInfo *ainfo_ptr,
gmop->sel_pattern[0] = '0';
gmop->sel_pattern[1] = '\0';
gmop->new_layername[0] = '\0';
+ gmop->new_position = 0;
+ gmop->new_groupname[0] = '\0';
+ gmop->sel_groupname[0] = '\0';
+ gmop->delimiter[0] = '/';
+ gmop->delimiter[1] = '\0';
gmop->case_sensitive_check_button = NULL;
gmop->invert_check_button = NULL;
@@ -1470,9 +1854,17 @@ gap_mod_frames_dialog(GapAnimInfo *ainfo_ptr,
gmop->new_layername_label = NULL;
gmop->layer_selection_frame = NULL;
+ gmop->new_groupname_label = NULL;
+ gmop->new_groupname_entry = NULL;
+ gmop->sel_groupname_label = NULL;
+ gmop->sel_groupname_entry = NULL;
+ gmop->delimiter_label = NULL;
+ gmop->delimiter_entry = NULL;
+ gmop->new_position_adj = NULL;
p_create_mod_frames_dialog(gmop);
p_upd_sensitivity(gmop);
+ p_get_values_from_active_layer(gmop);
gtk_widget_show (gmop->shell);
@@ -1489,9 +1881,13 @@ gap_mod_frames_dialog(GapAnimInfo *ainfo_ptr,
*sel_mode = gmop->sel_mode;
*sel_case = gmop->sel_case;
*sel_invert = gmop->sel_invert;
+ *new_position = gmop->new_position;
g_snprintf(sel_pattern, MAX_LAYERNAME, "%s", gmop->sel_pattern);
g_snprintf(new_layername, MAX_LAYERNAME, "%s", gmop->new_layername);
+ g_snprintf(new_groupname, MAX_LAYERNAME, "%s", gmop->new_groupname);
+ g_snprintf(sel_groupname, MAX_LAYERNAME, "%s", gmop->sel_groupname);
+ g_snprintf(delimiter, 32, "%s", gmop->delimiter);
if(gmop->run_flag)
{
diff --git a/gap/gap_mod_layer_dialog.h b/gap/gap_mod_layer_dialog.h
old mode 100644
new mode 100755
index 5289688..e8aa857
--- a/gap/gap_mod_layer_dialog.h
+++ b/gap/gap_mod_layer_dialog.h
@@ -4,7 +4,7 @@
* GAP ... Gimp Animation Plugins
*
* This Module contains:
- * modify Layer(s) in frames dialog
+ * modify Layer(s) in frames dialog
* (perform actions (like raise, set visible, apply filter)
* - foreach selected layer
* - in each frame of the selected framerange)
@@ -59,24 +59,37 @@ typedef struct GapModFramesGlobalParams { /* nick: gmop */
char sel_pattern[MAX_LAYERNAME];
char new_layername[MAX_LAYERNAME];
+ gint32 new_position;
+ char new_groupname[MAX_LAYERNAME];
+ char sel_groupname[MAX_LAYERNAME];
+ char delimiter[32];
/* GUI widget pointers */
- GtkWidget *shell;
+ GtkWidget *shell;
GtkWidget *func_info_label;
GtkWidget *new_layername_label;
GtkWidget *new_layername_entry;
GtkWidget *layer_pattern_entry;
- GtkWidget *case_sensitive_check_button;
+ GtkWidget *case_sensitive_check_button;
GtkWidget *invert_check_button;
GtkWidget *layer_selection_frame;
GtkWidget *progress_bar;
- GtkWidget *main_vbox;
+ GtkWidget *main_vbox;
+
+ GtkWidget *new_groupname_label;
+ GtkWidget *new_groupname_entry;
+ GtkWidget *sel_groupname_label;
+ GtkWidget *sel_groupname_entry;
+ GtkWidget *delimiter_label;
+ GtkWidget *delimiter_entry;
+ GtkObject *new_position_adj;
+
GtkObject *frame_from_adj;
GtkObject *frame_to_adj;
gint32 retcode;
-
+
} GapModFramesGlobalParams;
@@ -86,7 +99,9 @@ int gap_mod_frames_dialog(GapAnimInfo *ainfo_ptr,
gint32 *range_from, gint32 *range_to,
gint32 *action_mode, gint32 *sel_mode,
gint32 *sel_case, gint32 *sel_invert,
- char *sel_pattern, char *new_layername);
+ char *sel_pattern, char *new_layername,
+ gint32 *new_position,
+ char *new_groupname, char *sel_groupname, char *delimiter);
#endif
diff --git a/gap/gap_morph_dialog.c b/gap/gap_morph_dialog.c
index 7cd0996..cae1a4b 100644
--- a/gap/gap_morph_dialog.c
+++ b/gap/gap_morph_dialog.c
@@ -1751,7 +1751,7 @@ p_render_zoomed_pview(GapMorphSubWin *swp)
if(gap_debug) printf("p_render_zoomed_pview START src_layer_id: %d\n", (int)src_layer_id);
- src_image_id = gimp_drawable_get_image(src_layer_id);
+ src_image_id = gimp_item_get_image(src_layer_id);
l_basetype = gimp_image_base_type(src_image_id);
l_type = GIMP_RGBA_IMAGE;
if(l_basetype == GIMP_GRAY)
@@ -2262,7 +2262,7 @@ p_imglayer_menu_callback(GtkWidget *widget, GapMorphSubWin *swp)
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value);
layer_id = value;
- l_image_id = gimp_drawable_get_image(layer_id);
+ l_image_id = gimp_item_get_image(layer_id);
if(!gap_image_is_alive(l_image_id))
{
if(gap_debug) printf("p_imglayer_menu_callback: NOT ALIVE image_id=%d layer_id=%d\n",
diff --git a/gap/gap_morph_exec.c b/gap/gap_morph_exec.c
index 5f5f01d..e998421 100644
--- a/gap/gap_morph_exec.c
+++ b/gap/gap_morph_exec.c
@@ -2612,7 +2612,7 @@ p_get_tween_steps_and_layerstacks(GapMorphGlobalParams *mgpp, GapMorphExeLayerst
if(mgpp->osrc_layer_id >= 0)
{
- src_image_id = gimp_drawable_get_image(mgpp->osrc_layer_id);
+ src_image_id = gimp_item_get_image(mgpp->osrc_layer_id);
mlayers->src_layers = gimp_image_get_layers (src_image_id
,&mlayers->src_nlayers
@@ -2636,7 +2636,7 @@ p_get_tween_steps_and_layerstacks(GapMorphGlobalParams *mgpp, GapMorphExeLayerst
{
tween_steps = mgpp->tween_steps;
- dst_image_id = gimp_drawable_get_image(mgpp->fdst_layer_id);
+ dst_image_id = gimp_item_get_image(mgpp->fdst_layer_id);
mlayers->dst_layers = gimp_image_get_layers (dst_image_id
,&mlayers->dst_nlayers
);
@@ -2775,7 +2775,7 @@ gap_morph_execute(GapMorphGlobalParams *mgpp)
}
cp_layer_id = -1;
- dst_image_id = gimp_drawable_get_image(mgpp->fdst_layer_id);
+ dst_image_id = gimp_item_get_image(mgpp->fdst_layer_id);
dst_stack_position = 1;
/* findout stackposition (where to insert new tween layer(s)
@@ -2863,7 +2863,7 @@ gap_morph_execute(GapMorphGlobalParams *mgpp)
ii = mlayers->dst1_idx - (current_step -1);
gap_layer_copy_content(mlayers->dst_layers[ii], new_layer_id);
}
- tween_image_id = gimp_drawable_get_image(new_layer_id);
+ tween_image_id = gimp_item_get_image(new_layer_id);
gimp_image_delete(tween_image_id);
}
@@ -3498,7 +3498,7 @@ p_morph_render_frame_tweens_in_subdir(GapAnimInfo *ainfo_ptr, GapMorphGlobalPara
* (that is already saved to disk)
* we keep only the last one opened in gimp.
*/
- gap_image_delete_immediate(gimp_drawable_get_image(l_tween_layer_id));
+ gap_image_delete_immediate(gimp_item_get_image(l_tween_layer_id));
}
if(targetTweenFrameFilename != NULL)
@@ -3574,7 +3574,7 @@ p_morph_render_frame_tweens_in_subdir(GapAnimInfo *ainfo_ptr, GapMorphGlobalPara
, tweenFramesToBeCreated +1
, l_current_step
);
- l_tween_tmp_image_id = gimp_drawable_get_image(l_tween_layer_id);
+ l_tween_tmp_image_id = gimp_item_get_image(l_tween_layer_id);
if(gap_debug)
{
printf("p_morph_render_frame_tweens_in_subdir saving tween:%s :%d\n"
@@ -3601,7 +3601,7 @@ p_morph_render_frame_tweens_in_subdir(GapAnimInfo *ainfo_ptr, GapMorphGlobalPara
}
g_free(workpointFileName);
- gap_image_delete_immediate(gimp_drawable_get_image(currLayerId));
+ gap_image_delete_immediate(gimp_item_get_image(currLayerId));
if(!success)
{
break;
@@ -3618,7 +3618,7 @@ p_morph_render_frame_tweens_in_subdir(GapAnimInfo *ainfo_ptr, GapMorphGlobalPara
if(nextLayerId >= 0)
{
- gap_image_delete_immediate(gimp_drawable_get_image(nextLayerId));
+ gap_image_delete_immediate(gimp_item_get_image(nextLayerId));
}
return(l_tween_layer_id);
@@ -3723,7 +3723,7 @@ gap_morph_render_frame_tweens(GapAnimInfo *ainfo_ptr, GapMorphGlobalParams *mgpp
/* delete the previous handled tween frame image in memory. (that is already saved to disk
* we keep only the last one opened)
*/
- gap_image_delete_immediate(gimp_drawable_get_image(l_tween_layer_id));
+ gap_image_delete_immediate(gimp_item_get_image(l_tween_layer_id));
}
l_current_step = l_tween_frame_nr - mgpp->range_from;
@@ -3790,7 +3790,7 @@ gap_morph_render_frame_tweens(GapAnimInfo *ainfo_ptr, GapMorphGlobalParams *mgpp
}
l_tween_layer_id = gap_morph_render_one_of_n_tweens(mgpp, total_steps, l_current_step);
- l_tween_tmp_image_id = gimp_drawable_get_image(l_tween_layer_id);
+ l_tween_tmp_image_id = gimp_item_get_image(l_tween_layer_id);
if(gap_debug)
{
printf("gap_morph_render_frame_tweens saving tween:%s :%d\n"
@@ -3812,8 +3812,8 @@ gap_morph_render_frame_tweens(GapAnimInfo *ainfo_ptr, GapMorphGlobalParams *mgpp
}
}
- gap_image_delete_immediate(gimp_drawable_get_image(mgpp->osrc_layer_id));
- gap_image_delete_immediate(gimp_drawable_get_image(mgpp->fdst_layer_id));
+ gap_image_delete_immediate(gimp_item_get_image(mgpp->osrc_layer_id));
+ gap_image_delete_immediate(gimp_item_get_image(mgpp->fdst_layer_id));
}
return(l_tween_layer_id);
diff --git a/gap/gap_morph_main.c b/gap/gap_morph_main.c
index a666821..5ce068f 100644
--- a/gap/gap_morph_main.c
+++ b/gap/gap_morph_main.c
@@ -764,7 +764,7 @@ run (const gchar *name, /* name of plugin */
gimp_set_data (name, mgpp, sizeof (GapMorphGlobalParams));
if(strcmp(name, PLUG_IN_NAME_WORKPOINTS) != 0)
{
- gimp_display_new(gimp_drawable_get_image(tween_layer_id));
+ gimp_display_new(gimp_item_get_image(tween_layer_id));
}
}
}
diff --git a/gap/gap_morph_shape.c b/gap/gap_morph_shape.c
index 175ed56..e4a70f8 100644
--- a/gap/gap_morph_shape.c
+++ b/gap/gap_morph_shape.c
@@ -767,7 +767,7 @@ gap_moprhShapeDetectionEdgeBased(GapMorphGUIParams *mgup, gboolean *cancelFlagPt
,&msctx->countEdgePixels
);
- msctx->edgeImageId = gimp_drawable_get_image(msctx->edgeLayerId);
+ msctx->edgeImageId = gimp_item_get_image(msctx->edgeLayerId);
if(gap_debug)
{
@@ -1287,7 +1287,7 @@ gap_morph_shape_generate_frame_tween_workpoints(GapAnimInfo *ainfo_ptr
);
g_free(workpointFileName);
- gap_image_delete_immediate(gimp_drawable_get_image(currLayerId));
+ gap_image_delete_immediate(gimp_item_get_image(currLayerId));
if(!success)
{
break;
@@ -1302,7 +1302,7 @@ gap_morph_shape_generate_frame_tween_workpoints(GapAnimInfo *ainfo_ptr
if(nextLayerId >= 0)
{
- gap_image_delete_immediate(gimp_drawable_get_image(nextLayerId));
+ gap_image_delete_immediate(gimp_item_get_image(nextLayerId));
}
return (frameCount);
diff --git a/gap/gap_mov_dialog.c b/gap/gap_mov_dialog.c
index d1abe5d..4193490 100644
--- a/gap/gap_mov_dialog.c
+++ b/gap/gap_mov_dialog.c
@@ -638,7 +638,7 @@ gap_mov_dlg_edit_movepath_dialog (gint32 frame_image_id, gint32 drawable_id
);
}
- pvals->src_image_id = gimp_drawable_get_image(drawable_id);
+ pvals->src_image_id = gimp_item_get_image(drawable_id);
pvals->src_layer_id = drawable_id;
if(isXmlLoadOk != TRUE)
@@ -2810,7 +2810,7 @@ mov_imglayer_menu_callback(GtkWidget *widget, t_mov_gui_stuff *mgp)
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value);
id = value;
- l_image_id = gimp_drawable_get_image(id);
+ l_image_id = gimp_item_get_image(id);
if(!gap_image_is_alive(l_image_id))
{
if(gap_debug)
@@ -5784,7 +5784,7 @@ mov_path_prevw_preview_init ( t_mov_gui_stuff *mgp )
if(gap_debug) printf ("mov_path_prevw_preview_init:"
" before gap_pview_render_from_image drawable_id:%d\n"
, (int)mgp->drawable->drawable_id);
- image_id = gimp_drawable_get_image(mgp->drawable->drawable_id);
+ image_id = gimp_item_get_image(mgp->drawable->drawable_id);
if(gap_debug) printf ("mov_path_prevw_preview_init:"
" after gap_pview_render_from_image drawable_id:%d image_id:%d\n"
, (int)mgp->drawable->drawable_id
diff --git a/gap/gap_mov_exec.c b/gap/gap_mov_exec.c
index 9b4e840..29b06ce 100644
--- a/gap/gap_mov_exec.c
+++ b/gap/gap_mov_exec.c
@@ -36,7 +36,7 @@
* gimp 1.3.14a; 2003/05/24 hof: rename p_fetch_src_frame to gap_mov_render_fetch_src_frame
* gimp 1.3.12a; 2003/05/01 hof: merge into CVS-gimp-gap project
* gimp 1.3.11a; 2003/01/18 hof: Conditional framesave
- * gimp 1.3.5a; 2002/04/20 hof: api cleanup (dont use gimp_drawable_set_image)
+ * gimp 1.3.5a; 2002/04/20 hof: api cleanup
* gimp 1.3.4a; 2002/03/12 hof: removed private pdb-wrappers
* gimp 1.1.29b; 2000/11/20 hof: FRAME based Stepmodes, bugfixes for path calculation
* gimp 1.1.23a; 2000/06/03 hof: bugfix anim_preview < 100% did not work
@@ -300,7 +300,7 @@ p_add_tween_and_trace(gint32 dest_image_id, GapMovData *mov_ptr, GapMovCurrent *
* in this case the tween_layer is set invisible
*
*/
- gimp_drawable_set_visible(l_new_layer_id, FALSE);
+ gimp_item_set_visible(l_new_layer_id, FALSE);
}
/* remove tween layers from the tween_image after usage */
@@ -378,7 +378,7 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
/* get the_rendered_object Layer */
l_layer_id = gap_image_merge_visible_layers(l_tmp_image_id, l_mergemode);
- gimp_drawable_set_name(l_layer_id, _("Tweenlayer"));
+ gimp_item_set_name(l_layer_id, _("Tweenlayer"));
{
gint32 l_new_layer_id;
gint l_src_offset_x, l_src_offset_y;
@@ -452,7 +452,7 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
l_tmp_image_id = mov_ptr->val_ptr->dst_image_id;
if (l_tmp_image_id < 0)
{
- l_tmp_image_id = gimp_drawable_get_image(singleFramePtr->drawable_id);
+ l_tmp_image_id = gimp_item_get_image(singleFramePtr->drawable_id);
}
}
@@ -569,7 +569,7 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
l_name = g_strdup_printf("frame_%06d (%dms)"
, (int) cur_ptr->dst_frame_nr
, (int)(1000/mov_ptr->val_ptr->apv_framerate));
- gimp_drawable_set_name(l_layer_id, l_name);
+ gimp_item_set_name(l_layer_id, l_name);
g_free(l_name);
{
@@ -1812,7 +1812,7 @@ p_init_curr_ptr_with_1st_controlpoint(GapMovCurrent *cur_ptr, GapMovValues *val_
{
cur_ptr->isSingleFrame = TRUE;
cur_ptr->singleMovObjLayerId = singleFramePtr->drawable_id;
- cur_ptr->singleMovObjImageId = gimp_drawable_get_image(cur_ptr->singleMovObjLayerId);
+ cur_ptr->singleMovObjImageId = gimp_item_get_image(cur_ptr->singleMovObjLayerId);
cur_ptr->keep_proportions = singleFramePtr->keep_proportions;
cur_ptr->fit_width = singleFramePtr->fit_width;
cur_ptr->fit_height = singleFramePtr->fit_height;
@@ -1838,7 +1838,7 @@ p_duplicate_layer(gint32 layerId)
gint32 imageId;
- imageId = gimp_drawable_get_image(layerId);
+ imageId = gimp_item_get_image(layerId);
gimp_image_set_active_layer(imageId, layerId);
dupLayerId = gimp_layer_copy(layerId);
gimp_image_insert_layer(imageId, dupLayerId, 0, -1 /* -1 place above active layer */);
@@ -2070,7 +2070,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
gimp_image_undo_disable (val_ptr->trace_image_id);
gimp_layer_add_alpha(val_ptr->trace_layer_id);
gimp_edit_clear(val_ptr->trace_layer_id);
- gimp_drawable_set_name(val_ptr->trace_layer_id, _("Tracelayer"));
+ gimp_item_set_name(val_ptr->trace_layer_id, _("Tracelayer"));
}
/* RENDER the 1.st frame outside the frameindex loop,
@@ -3863,7 +3863,7 @@ p_check_move_path_params(GapMovData *mov_data)
}
else if(gimp_drawable_is_layer(mov_data->val_ptr->src_layer_id))
{
- mov_data->val_ptr->src_image_id = gimp_drawable_get_image(mov_data->val_ptr->src_layer_id);
+ mov_data->val_ptr->src_image_id = gimp_item_get_image(mov_data->val_ptr->src_layer_id);
}
else
{
diff --git a/gap/gap_mov_render.c b/gap/gap_mov_render.c
index a1f2e6c..04e72dc 100644
--- a/gap/gap_mov_render.c
+++ b/gap/gap_mov_render.c
@@ -226,7 +226,7 @@ p_mov_apply_bluebox(gint32 layer_id
if(val_ptr->bbp)
{
- val_ptr->bbp->image_id = gimp_drawable_get_image(layer_id);
+ val_ptr->bbp->image_id = gimp_item_get_image(layer_id);
val_ptr->bbp->drawable_id = layer_id;
val_ptr->bbp->layer_id = layer_id;
val_ptr->bbp->run_mode = GIMP_RUN_NONINTERACTIVE;
@@ -755,7 +755,7 @@ gap_mov_render_render(gint32 image_id, GapMovValues *val_ptr, GapMovCurrent *cur
val_ptr->src_stepmode,
val_ptr->rotate_threshold,
cur_ptr->singleMovObjLayerId,
- gimp_drawable_get_image(cur_ptr->singleMovObjLayerId),
+ gimp_item_get_image(cur_ptr->singleMovObjLayerId),
image_id
);
}
@@ -767,7 +767,7 @@ gap_mov_render_render(gint32 image_id, GapMovValues *val_ptr, GapMovCurrent *cur
l_mode = p_get_paintmode(val_ptr->src_paintmode
,cur_ptr->singleMovObjLayerId
);
- if(gimp_drawable_get_image(cur_ptr->singleMovObjLayerId) == image_id)
+ if(gimp_item_get_image(cur_ptr->singleMovObjLayerId) == image_id)
{
/* the moving object layer id is already part of the processed frame image */
l_cp_layer_id = cur_ptr->singleMovObjLayerId;
@@ -886,7 +886,7 @@ gap_mov_render_render(gint32 image_id, GapMovValues *val_ptr, GapMovCurrent *cur
if(val_ptr->src_force_visible)
{
- gimp_drawable_set_visible(l_cp_layer_id, TRUE);
+ gimp_item_set_visible(l_cp_layer_id, TRUE);
}
/* check for layermask */
diff --git a/gap/gap_mov_xml_par.c b/gap/gap_mov_xml_par.c
index 73a819e..f5b2d33 100644
--- a/gap/gap_mov_xml_par.c
+++ b/gap/gap_mov_xml_par.c
@@ -1518,7 +1518,7 @@ gap_mov_xml_par_save(char *filename, GapMovValues *pvals)
char *src_filename;
gint32 src_image_id;
- src_image_id = gimp_drawable_get_image(pvals->src_layer_id);
+ src_image_id = gimp_item_get_image(pvals->src_layer_id);
fprintf(l_fp, " <%s ", GAP_MOVPATH_XML_TOKEN_MOVING_OBJECT);
gap_xml_write_int_value(l_fp, GAP_MOVPATH_XML_TOKEN_SRC_LAYER_ID, pvals->src_layer_id);
diff --git a/gap/gap_onion_base.c b/gap/gap_onion_base.c
index 1a51281..943afd8 100644
--- a/gap/gap_onion_base.c
+++ b/gap/gap_onion_base.c
@@ -71,7 +71,7 @@ gap_onion_base_mark_as_onionlayer(gint32 layer_id)
l_parasite_data = g_malloc(sizeof(GapOnionBaseParasite_data));
l_parasite_data->timestamp = gap_base_get_current_time();
- l_parasite_data->tattoo = gimp_drawable_get_tattoo(layer_id);
+ l_parasite_data->tattoo = gimp_item_get_tattoo(layer_id);
if(gap_debug) printf("gap_onion_base_mark_as_onionlayer: tattoo is: %d\n", (int)l_parasite_data->tattoo);
l_parasite = gimp_parasite_new(GAP_ONION_PARASITE_NAME,
@@ -111,7 +111,7 @@ gap_onion_base_check_is_onion_layer(gint32 layer_id)
l_parasite_data = (GapOnionBaseParasite_data *)l_parasite->data;
if(gap_debug) printf("gap_onion_base_check_is_onion_layer: tattoo is: %d\n",
(int)l_parasite_data->tattoo);
- if (l_parasite_data->tattoo == gimp_drawable_get_tattoo(layer_id))
+ if (l_parasite_data->tattoo == gimp_item_get_tattoo(layer_id))
{
l_found = TRUE;
if(gap_debug) printf("gap_onion_base_check_is_onion_layer: ONION_LAYER_FOUND layer_id %d\n",
(int)layer_id);
@@ -167,12 +167,12 @@ gap_onion_base_onionskin_visibility(gint32 image_id, gint visi_mode)
{
if (l_visible == VISIBILTY_UNSET)
{
- l_visible = !gimp_drawable_get_visible(l_layer_id);
+ l_visible = !gimp_item_get_visible(l_layer_id);
}
/* set visibility */
if(gap_debug) printf("layer_id %d visibility: %d\n", (int)l_layer_id ,(int)l_visible);
- gimp_drawable_set_visible(l_layer_id, l_visible);
+ gimp_item_set_visible(l_layer_id, l_visible);
}
}
g_free(l_layers_list);
@@ -481,7 +481,7 @@ gap_onion_base_onionskin_apply(gpointer gpp
for(l_ign=0, l_idx=l_nlayers -1; l_idx >= 0;l_idx--)
{
l_layer_id = l_layers_list[l_idx];
- l_layername = gimp_drawable_get_name(l_layer_id);
+ l_layername = gimp_item_get_name(l_layer_id);
l_is_onion = gap_onion_base_check_is_onion_layer(l_layer_id);
@@ -498,7 +498,7 @@ gap_onion_base_onionskin_apply(gpointer gpp
)
|| (l_is_onion))
{
- gimp_drawable_set_visible(l_layer_id, FALSE);
+ gimp_item_set_visible(l_layer_id, FALSE);
}
g_free (l_layername);
@@ -568,7 +568,7 @@ gap_onion_base_onionskin_apply(gpointer gpp
/* set layername */
l_name = g_strdup_printf(_("onionskin_%06d"), (int) l_frame_nr);
- gimp_drawable_set_name(l_new_layer_id, l_name);
+ gimp_item_set_name(l_new_layer_id, l_name);
g_free(l_name);
@@ -646,7 +646,7 @@ gap_onion_image_has_oinonlayers(gint32 image_id, gboolean only_visible)
{
if (only_visible)
{
- if(gimp_drawable_get_visible(l_layer_id))
+ if(gimp_item_get_visible(l_layer_id))
{
l_has_onion = TRUE;
break;
diff --git a/gap/gap_player_dialog.c b/gap/gap_player_dialog.c
index 46b8bf1..1eafeaf 100644
--- a/gap/gap_player_dialog.c
+++ b/gap/gap_player_dialog.c
@@ -1412,7 +1412,7 @@ p_mtrace_image( GapPlayerMainGlobalParams *gpp
,(int)gpp->play_current_framenr
,(int)(1000 / gpp->speed)
);
- gimp_drawable_set_name(dst_layer_id, l_name);
+ gimp_item_set_name(dst_layer_id, l_name);
g_free(l_name);
}
@@ -1484,7 +1484,7 @@ p_mtrace_tmpbuf( GapPlayerMainGlobalParams *gpp
,(int)gpp->play_current_framenr
,(int)(1000 / gpp->speed)
);
- gimp_drawable_set_name(dst_layer_id, l_name);
+ gimp_item_set_name(dst_layer_id, l_name);
g_free(l_name);
}
diff --git a/gap/gap_range_ops.c b/gap/gap_range_ops.c
index d7adbc7..00ec0e0 100644
--- a/gap/gap_range_ops.c
+++ b/gap/gap_range_ops.c
@@ -1045,13 +1045,13 @@ p_frames_to_multilayer(GapAnimInfo *ainfo_ptr,
{
/* set all selected layers visible, all others invisible */
l_tmp_layer_id = l_layli_ptr[l_vidx].layer_id;
- gimp_drawable_set_visible(l_tmp_layer_id,
+ gimp_item_set_visible(l_tmp_layer_id,
l_layli_ptr[l_vidx].selected);
if((bg_visible == 0) && (l_vidx == (l_nlayers -1)))
{
/* set BG_Layer invisible */
- gimp_drawable_set_visible(l_tmp_layer_id, FALSE);
+ gimp_item_set_visible(l_tmp_layer_id, FALSE);
if(l_layli_ptr[l_vidx].selected)
{
l_nvisible--;
@@ -1086,7 +1086,7 @@ p_frames_to_multilayer(GapAnimInfo *ainfo_ptr,
l_tmp_layer_id = l_layers_list[l_vidx];
/* stop at 1.st visible layer (this should be the only visible layer) */
- if(gimp_drawable_get_visible(l_tmp_layer_id)) break;
+ if(gimp_item_get_visible(l_tmp_layer_id)) break;
/* stop at 1.st layer if image was flattened */
if((flatten_mode < GAP_RANGE_OPS_FLAM_MERG_EXPAND) || (flatten_mode >
GAP_RANGE_OPS_FLAM_MERG_CLIP_BG)) break;
@@ -1136,9 +1136,9 @@ p_frames_to_multilayer(GapAnimInfo *ainfo_ptr,
gap_match_substitute_framenr(&l_layername[0], sizeof(l_layername),
frame_basename, (long)l_cur_frame_nr);
- gimp_drawable_set_name(l_cp_layer_id, &l_layername[0]);
+ gimp_item_set_name(l_cp_layer_id, &l_layername[0]);
- gimp_drawable_set_visible(l_cp_layer_id, l_visible);
+ gimp_item_set_visible(l_cp_layer_id, l_visible);
l_visible = FALSE; /* all further layers are set invisible */
}
/* else: tmp image has no visible layers, ignore that frame */
@@ -1453,7 +1453,7 @@ p_frames_convert(GapAnimInfo *ainfo_ptr,
{
if( (l_nlayers == 1)
&& (! gimp_drawable_has_alpha(l_layers_list[0]))
- && (! gimp_drawable_get_visible(l_layers_list[0])))
+ && (! gimp_item_get_visible(l_layers_list[0])))
{
l_img_already_flat = TRUE;
}
diff --git a/gap/gap_split.c b/gap/gap_split.c
index a6edaae..9ac2170 100644
--- a/gap/gap_split.c
+++ b/gap/gap_split.c
@@ -191,7 +191,7 @@ p_split_image(GapAnimInfo *ainfo_ptr, split_vals_t *valPtr)
{
if(valPtr->only_visible)
{
- if (! gimp_drawable_get_visible(l_layers_list[l_idx]))
+ if (! gimp_item_get_visible(l_layers_list[l_idx]))
{
/* skip invisible layers in only_visible Mode */
continue;
@@ -219,7 +219,7 @@ p_split_image(GapAnimInfo *ainfo_ptr, split_vals_t *valPtr)
if(valPtr->only_visible)
{
- if (! gimp_drawable_get_visible(l_src_layer_id))
+ if (! gimp_item_get_visible(l_src_layer_id))
{
/* skip invisible layers in only_visible Mode */
continue;
@@ -288,7 +288,7 @@ p_split_image(GapAnimInfo *ainfo_ptr, split_vals_t *valPtr)
/* add the copied layer to current destination image */
gimp_image_insert_layer(l_new_image_id, l_cp_layer_id, 0, 0);
gimp_layer_set_offsets(l_cp_layer_id, l_src_offset_x, l_src_offset_y);
- gimp_drawable_set_visible(l_cp_layer_id, TRUE);
+ gimp_item_set_visible(l_cp_layer_id, TRUE);
}
diff --git a/gap/gap_story_att_trans_dlg.c b/gap/gap_story_att_trans_dlg.c
index b0f3ab2..a130541 100644
--- a/gap/gap_story_att_trans_dlg.c
+++ b/gap/gap_story_att_trans_dlg.c
@@ -1266,7 +1266,7 @@ p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, gint img_idx)
attw->gfx_tab[img_idx].opre_layer_id = layer_id;
attw->gfx_tab[img_idx].opre_info.layer_is_fake = TRUE;
}
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].opre_layer_id, FALSE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].opre_layer_id, FALSE);
} /* end p_check_and_make_opre_default_layer */
@@ -1307,7 +1307,7 @@ p_check_and_make_orig_default_layer(GapStbAttrWidget *attw, gint img_idx)
attw->gfx_tab[img_idx].orig_layer_id = layer_id;
attw->gfx_tab[img_idx].orig_info.layer_is_fake = TRUE;
}
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].orig_layer_id, FALSE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].orig_layer_id, FALSE);
} /* end p_check_and_make_orig_default_layer */
@@ -1339,7 +1339,7 @@ p_create_color_layer(GapStbAttrWidget *attw, gint32 image_id
);
gimp_image_insert_layer (image_id, layer_id, 0, stackposition);
gap_layer_clear_to_color(layer_id, red, green, blue, 1.0);
- gimp_drawable_set_visible(layer_id, TRUE);
+ gimp_item_set_visible(layer_id, TRUE);
pv_master_width = (gdouble)gimp_image_width(image_id) * PVIEW_TO_MASTER_SCALE;
pv_master_height = (gdouble)gimp_image_height(image_id) * PVIEW_TO_MASTER_SCALE;
@@ -1503,10 +1503,10 @@ p_adjust_stackposition(gint32 image_id, gint32 layer_id, gint position)
gint ii;
/* adjust stack position */
- gimp_image_lower_layer_to_bottom (image_id, layer_id);
+ gimp_image_lower_item_to_bottom (image_id, layer_id);
for (ii=0; ii < position; ii++)
{
- gimp_image_raise_layer (image_id, layer_id);
+ gimp_image_raise_item (image_id, layer_id);
}
} /* end p_adjust_stackposition */
@@ -1623,7 +1623,7 @@ p_create_transformed_layer_movepath(gint32 image_id
if(mov_obj_layer_id >= 0)
{
- gimp_drawable_set_visible(mov_obj_layer_id, TRUE);
+ gimp_item_set_visible(mov_obj_layer_id, TRUE);
if(! gimp_drawable_has_alpha(mov_obj_layer_id))
{
/* have to add alpha channel */
@@ -1686,7 +1686,7 @@ p_create_transformed_layer_movepath(gint32 image_id
printf("p_create_transformed_layer_movepath: "
"new_layer_id:%d new_layers_image_id:%d mov_obj_image_id:%d (preview)image_id:%d\n"
,(int)new_layer_id
- ,(int)gimp_drawable_get_image(new_layer_id)
+ ,(int)gimp_item_get_image(new_layer_id)
,(int)mov_obj_image_id
,(int)image_id
);
@@ -1697,7 +1697,7 @@ p_create_transformed_layer_movepath(gint32 image_id
}
- gimp_drawable_set_visible(new_layer_id, TRUE);
+ gimp_item_set_visible(new_layer_id, TRUE);
p_adjust_stackposition(image_id, new_layer_id, stackposition);
@@ -1788,13 +1788,13 @@ p_create_transformed_layer(gint32 image_id
new_layer_id = gimp_layer_copy(origsize_layer_id);
gimp_image_insert_layer (image_id, new_layer_id, 0, stackposition);
- gimp_drawable_set_name(new_layer_id, layername);
+ gimp_item_set_name(new_layer_id, layername);
gimp_layer_scale(new_layer_id, calculated->width, calculated->height, 0);
- gimp_drawable_set_visible(new_layer_id, TRUE);
+ gimp_item_set_visible(new_layer_id, TRUE);
*layer_id_ptr = new_layer_id;
}
@@ -1902,12 +1902,12 @@ p_render_gfx(GapStbAttrWidget *attw, gint img_idx)
prefetch_visible = p_calculate_prefetch_visibility(attw, img_idx);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].opre_layer_id, FALSE);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].orig_layer_id, FALSE);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].deco_layer_id, TRUE);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].curr_layer_id, TRUE);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].pref_layer_id, prefetch_visible);
- gimp_drawable_set_visible(attw->gfx_tab[img_idx].base_layer_id, TRUE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].opre_layer_id, FALSE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].orig_layer_id, FALSE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].deco_layer_id, TRUE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].curr_layer_id, TRUE);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].pref_layer_id, prefetch_visible);
+ gimp_item_set_visible(attw->gfx_tab[img_idx].base_layer_id, TRUE);
/* render the preview from image */
gap_pview_render_from_image_duplicate (attw->gfx_tab[img_idx].pv_ptr
@@ -2686,7 +2686,7 @@ p_fetch_layer_from_animimage (const char *img_filename
if((localframe_index < l_nlayers)
&& (localframe_index >= 0))
{
- gimp_drawable_set_visible(l_layers_list[localframe_index], TRUE);
+ gimp_item_set_visible(l_layers_list[localframe_index], TRUE);
if (0 != gimp_layer_get_apply_mask(l_layers_list[localframe_index]))
{
/* the layer has an active mask, apply the mask now
@@ -2861,7 +2861,7 @@ p_create_movepath_edit_resources(GapStbAttrWidget *attw)
);
gimp_image_insert_layer (image_id, bg_layer_id, 0, 0);
gap_layer_clear_to_color(bg_layer_id, 0.0, 0.0, 0.0, 0.0);
- gimp_drawable_set_visible(bg_layer_id, TRUE);
+ gimp_item_set_visible(bg_layer_id, TRUE);
// TODO: in case the storyboard has more tracks
// the frame image should be rendered by the storyboard processor at master size
@@ -2877,7 +2877,7 @@ p_create_movepath_edit_resources(GapStbAttrWidget *attw)
gimp_image_undo_disable (attw->movepath_obj_image_id);
attw->movepath_obj_layer_id = gimp_layer_new_from_drawable(origsize_layer_id, attw->movepath_obj_image_id);
gimp_image_insert_layer (attw->movepath_obj_image_id, attw->movepath_obj_layer_id, 0, 0);
- gimp_drawable_set_visible(attw->movepath_obj_layer_id, TRUE);
+ gimp_item_set_visible(attw->movepath_obj_layer_id, TRUE);
/* create default values for movepath
diff --git a/gap/gap_story_render_processor.c b/gap/gap_story_render_processor.c
index cc32c7a..ba8553f 100644
--- a/gap/gap_story_render_processor.c
+++ b/gap/gap_story_render_processor.c
@@ -5281,7 +5281,7 @@ p_transform_postprocessing(gint32 new_layer_id
p_fetch_and_add_layermask(vidhand
, frn_elem
, local_stepcount
- , gimp_drawable_get_image(new_layer_id)
+ , gimp_item_get_image(new_layer_id)
, new_layer_id
, frn_elem->mask_anchor
);
@@ -7147,7 +7147,7 @@ p_stb_render_image_or_animimage(GapStbFetchData *gfd
}
- gimp_drawable_set_visible(l_layers_list[gfd->localframe_index], TRUE);
+ gimp_item_set_visible(l_layers_list[gfd->localframe_index], TRUE);
if (0 != gimp_layer_get_apply_mask(l_layers_list[gfd->localframe_index]))
{
/* the layer has an active mask, apply the mask now
@@ -8686,15 +8686,15 @@ p_paste_logo_pattern(gint32 drawable_id
gint l_src_offset_y;
gint32 image_id;
- image_id = gimp_drawable_get_image(drawable_id);
- gimp_selection_all(gimp_drawable_get_image(logo_pattern_id));
+ image_id = gimp_item_get_image(drawable_id);
+ gimp_selection_all(gimp_item_get_image(logo_pattern_id));
/* findout the offsets of the replacement_pattern layer within the source Image */
gimp_drawable_offsets(logo_pattern_id, &l_src_offset_x, &l_src_offset_y );
gimp_edit_copy(logo_pattern_id);
l_fsel_layer_id = gimp_edit_paste(drawable_id, TRUE); /* FALSE paste clear selection */
- gimp_selection_none(gimp_drawable_get_image(logo_pattern_id));
+ gimp_selection_none(gimp_item_get_image(logo_pattern_id));
if(gap_debug)
{
diff --git a/gap/gap_vex_exec.c b/gap/gap_vex_exec.c
index 39cfa2f..843a414 100644
--- a/gap/gap_vex_exec.c
+++ b/gap/gap_vex_exec.c
@@ -79,7 +79,7 @@ p_vex_apply_bluebox(gint32 layer_id
if(bbp)
{
- bbp->image_id = gimp_drawable_get_image(layer_id);
+ bbp->image_id = gimp_item_get_image(layer_id);
bbp->drawable_id = layer_id;
bbp->layer_id = layer_id;
bbp->run_mode = GIMP_RUN_NONINTERACTIVE;
diff --git a/gap/gap_water_pattern.c b/gap/gap_water_pattern.c
index bd3d19a..f0809a4 100644
--- a/gap/gap_water_pattern.c
+++ b/gap/gap_water_pattern.c
@@ -295,7 +295,7 @@ p_init_context_and_cloud_layers(gint32 drawable_id, waterpattern_val_t *cuvals,
{
gboolean success;
- ctxt->image_id = gimp_drawable_get_image(drawable_id);
+ ctxt->image_id = gimp_item_get_image(drawable_id);
ctxt->blend_mode = p_convertBlendNum_to_BlendMode(cuvals->blendNum);
ctxt->width = gimp_image_width(ctxt->image_id);
ctxt->height = gimp_image_height(ctxt->image_id);
@@ -432,9 +432,9 @@ p_run_renderWaterPattern(gint32 drawable_id, waterpattern_val_t *cuvals, waterpa
}
/* save visibility status of processed layer .. */
- isVisible = gimp_drawable_get_visible(drawable_id);
+ isVisible = gimp_item_get_visible(drawable_id);
/* .. and force visibility (required for merge down effects) */
- gimp_drawable_set_visible(drawable_id, TRUE);
+ gimp_item_set_visible(drawable_id, TRUE);
templayer_id = drawable_id;
nframesToProcess = 1;
@@ -459,7 +459,7 @@ p_run_renderWaterPattern(gint32 drawable_id, waterpattern_val_t *cuvals, waterpa
if(gap_debug)
{
- printf("p_run_renderWaterPattern: drawable_id :%d (%s)\n", (int)drawable_id,
gimp_drawable_get_name(drawable_id));
+ printf("p_run_renderWaterPattern: drawable_id :%d (%s)\n", (int)drawable_id,
gimp_item_get_name(drawable_id));
printf("p_run_renderWaterPattern: scalex:%f\n", (float)cuvals->scalex);
printf("p_run_renderWaterPattern: scaley:%f\n", (float)cuvals->scaley);
printf("p_run_renderWaterPattern: blendNum:%d\n", (int)cuvals->blendNum);
@@ -473,8 +473,8 @@ p_run_renderWaterPattern(gint32 drawable_id, waterpattern_val_t *cuvals, waterpa
printf("p_run_renderWaterPattern: nframes:%d\n", (int)cuvals->nframes);
printf("p_run_renderWaterPattern: seed1:%d\n", (int)cuvals->seed1);
printf("p_run_renderWaterPattern: seed2:%d\n", (int)cuvals->seed2);
- printf("p_run_renderWaterPattern: cloudLayer1:%d (%s)\n", (int)cuvals->cloudLayer1,
gimp_drawable_get_name(cuvals->cloudLayer1));
- printf("p_run_renderWaterPattern: cloudLayer2:%d (%s)\n", (int)cuvals->cloudLayer2,
gimp_drawable_get_name(cuvals->cloudLayer2));
+ printf("p_run_renderWaterPattern: cloudLayer1:%d (%s)\n", (int)cuvals->cloudLayer1,
gimp_item_get_name(cuvals->cloudLayer1));
+ printf("p_run_renderWaterPattern: cloudLayer2:%d (%s)\n", (int)cuvals->cloudLayer2,
gimp_item_get_name(cuvals->cloudLayer2));
printf("p_run_renderWaterPattern: ref_image_id:%d\n", (int)ctxt->ref_image_id);
printf("p_run_renderWaterPattern: image_id:%d\n", (int)ctxt->image_id);
@@ -587,7 +587,7 @@ p_run_renderWaterPattern(gint32 drawable_id, waterpattern_val_t *cuvals, waterpa
gchar *layerName;
layerName = g_strdup_printf("Frame_%03d", (int)count +1);
- gimp_drawable_set_name(templayer_id, layerName);
+ gimp_item_set_name(templayer_id, layerName);
g_free(layerName);
}
@@ -620,7 +620,7 @@ p_run_renderWaterPattern(gint32 drawable_id, waterpattern_val_t *cuvals, waterpa
/* restore visibility status of processed layer */
- gimp_drawable_set_visible(templayer_id, isVisible);
+ gimp_item_set_visible(templayer_id, isVisible);
if (cuvals->createImage)
{
@@ -951,7 +951,7 @@ p_pattern_layer_constrain(gint32 image_id, gint32 drawable_id, WaterPatternDialo
return(FALSE);
}
- processedImageId = gimp_drawable_get_image(wcd->drawable_id);
+ processedImageId = gimp_item_get_image(wcd->drawable_id);
if(image_id == processedImageId)
{
diff --git a/gap/gap_wr_resynth.c b/gap/gap_wr_resynth.c
index e75af95..53deccd 100644
--- a/gap/gap_wr_resynth.c
+++ b/gap/gap_wr_resynth.c
@@ -772,7 +772,7 @@ p_process_layer(gint32 image_id, gint32 drawable_id, TransValues *val_ptr)
p_pdb_call_resynthesizer(image_id, drawable_id, corpus_layer_id, val_ptr->seed);
/* delete the temporary working duplicate */
- corpus_image_id = gimp_drawable_get_image(corpus_layer_id);
+ corpus_image_id = gimp_item_get_image(corpus_layer_id);
gimp_image_delete(corpus_image_id);
}
else
diff --git a/libgapvidapi/gap_vid_api.c b/libgapvidapi/gap_vid_api.c
index 1af7dbf..f619832 100644
--- a/libgapvidapi/gap_vid_api.c
+++ b/libgapvidapi/gap_vid_api.c
@@ -817,7 +817,7 @@ p_copyRgbBufferToPixelRegion (const GimpPixelRgn *dstPR
* in case aspect is required the calling programm has to perform
* the additional call like this:
* GVA_search_fcache_and_get_frame_as_gimp_layer(gvahand, ....);
- * GVA_image_set_aspect(gvahand, gimp_drawable_get_image(fetchResult->layer_id));
+ * GVA_image_set_aspect(gvahand, gimp_item_get_image(fetchResult->layer_id));
*/
void
GVA_search_fcache_and_get_frame_as_gimp_layer_or_rgb888(t_GVA_Handle *gvahand
@@ -1119,7 +1119,7 @@ GVA_search_fcache_and_get_frame_as_gimp_layer_or_rgb888(t_GVA_Handle *gvahand
/* add new layer on top of the layerstack */
gimp_image_insert_layer (fetchResult->image_id, fetchResult->layer_id, 0, 0);
- gimp_drawable_set_visible(fetchResult->layer_id, TRUE);
+ gimp_item_set_visible(fetchResult->layer_id, TRUE);
/* clear undo stack */
if (gimp_image_undo_is_enabled(fetchResult->image_id))
@@ -1183,7 +1183,7 @@ GVA_search_fcache_and_get_frame_as_gimp_layer_or_rgb888(t_GVA_Handle *gvahand
// * in case aspect is required the calling programm has to perform
// * the additional call like this:
// * layer_id = GVA_search_fcache_and_get_frame_as_gimp_layer(gvahand, ....);
-// * GVA_image_set_aspect(gvahand, gimp_drawable_get_image(layer_id));
+// * GVA_image_set_aspect(gvahand, gimp_item_get_image(layer_id));
// */
// gint32
// GVA_search_fcache_and_get_frame_as_gimp_layer(t_GVA_Handle *gvahand
@@ -1451,7 +1451,7 @@ GVA_search_fcache_and_get_frame_as_gimp_layer_or_rgb888(t_GVA_Handle *gvahand
//
// /* add new layer on top of the layerstack */
// gimp_image_insert_layer (image_id, l_new_layer_id, 0, 0);
-// gimp_drawable_set_visible(l_new_layer_id, TRUE);
+// gimp_item_set_visible(l_new_layer_id, TRUE);
//
// /* clear undo stack */
// if (gimp_image_undo_is_enabled(image_id))
@@ -3261,14 +3261,14 @@ GVA_frame_to_gimp_layer_2(t_GVA_Handle *gvahand
* so do not delete previous added layer, but
* only set invisible
*/
- gimp_drawable_set_visible(old_layer_id, FALSE);
+ gimp_item_set_visible(old_layer_id, FALSE);
}
}
/* add new layer on top of the layerstack */
gimp_image_insert_layer (*image_id, l_new_layer_id, 0, 0);
- gimp_drawable_set_visible(l_new_layer_id, TRUE);
+ gimp_item_set_visible(l_new_layer_id, TRUE);
/* clear undo stack */
if (gimp_image_undo_is_enabled(*image_id))
diff --git a/libgapvidutil/gap_gve_png.c b/libgapvidutil/gap_gve_png.c
index 28a852f..f01f9d6 100644
--- a/libgapvidutil/gap_gve_png.c
+++ b/libgapvidutil/gap_gve_png.c
@@ -142,7 +142,7 @@ gap_gve_png_drawable_encode_png(GimpDrawable *drawable, gint32 png_interlaced, g
char *l_tmpname;
l_tmpname = gimp_temp_name("tmp.png");
- image_id = gimp_drawable_get_image(drawable->drawable_id);
+ image_id = gimp_item_get_image(drawable->drawable_id);
l_pngSaveOk = p_save_as_tmp_png_file(l_tmpname
, image_id
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]