Commit 013cc9c3 authored by Maurits Rijk's avatar Maurits Rijk
Browse files

Use HIG capitalization style. Added GPL license in a few places.

Minor code clean-up.
parent 9158152f
2004-05-25 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/align_layers.c
* plug-ins/common/animoptimize.c
* plug-ins/common/animationplay.c
* plug-ins/common/apply_lens.c
* plug-ins/common/autocrop.c
* plug-ins/common/autostretch_hsv.c
* plug-ins/common/blinds.c
* plug-ins/common/blur.c
* plug-ins/common/borderaverage.c:
* plug-ins/common/bz2.c:
* plug-ins/common/c_astretch.c:
* plug-ins/common/ccanalyze.c:
* plug-ins/common/channel_mixer.c:
* plug-ins/common/color_enhance.c:
* plug-ins/common/colorify.c:
* plug-ins/common/colortoalpha.c:
* plug-ins/common/csource.c:
* plug-ins/common/cubism.c:
* plug-ins/common/curve_bend.c:
Use HIG capitalization style. Added GPL license in a few places.
Minor code clean-up.
2004-05-25 Sven Neumann <sven@gimp.org>
Sorry, couldn't resist to finish this task...
......
......@@ -21,10 +21,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
......@@ -389,7 +385,6 @@ align_layers_get_align_offsets (gint32 drawable_id,
gimp_drawable_detach (layer);
}
/* dialog stuff */
static int
align_layers_dialog (void)
{
......@@ -423,7 +418,7 @@ align_layers_dialog (void)
_("Collect"), H_COLLECT,
_("Fill (left to right)"), LEFT2RIGHT,
_("Fill (right to left)"), RIGHT2LEFT,
_("Snap to Grid"), SNAP2HGRID,
_("Snap to grid"), SNAP2HGRID,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_style);
......@@ -432,13 +427,13 @@ align_layers_dialog (void)
&VALS.h_style);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("_Horizontal Style:"), 0.0, 0.5,
_("_Horizontal style:"), 0.0, 0.5,
combo, 2, FALSE);
combo = gimp_int_combo_box_new (_("Left Edge"), H_BASE_LEFT,
combo = gimp_int_combo_box_new (_("Left edge"), H_BASE_LEFT,
_("Center"), H_BASE_CENTER,
_("Right Edge"), H_BASE_RIGHT,
_("Right edge"), H_BASE_RIGHT,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_base);
......@@ -447,14 +442,14 @@ align_layers_dialog (void)
&VALS.h_base);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Ho_rizontal Base:"), 0.0, 0.5,
_("Ho_rizontal base:"), 0.0, 0.5,
combo, 2, FALSE);
combo = gimp_int_combo_box_new (_("None"), V_NONE,
_("Collect"), V_COLLECT,
_("Fill (top to bottom)"), TOP2BOTTOM,
_("Fill (bottom to top)"), BOTTOM2TOP,
_("Snap to Grid"), SNAP2VGRID,
_("Snap to grid"), SNAP2VGRID,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_style);
......@@ -463,12 +458,12 @@ align_layers_dialog (void)
&VALS.v_style);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("_Vertical Style:"), 0.0, 0.5,
_("_Vertical style:"), 0.0, 0.5,
combo, 2, FALSE);
combo = gimp_int_combo_box_new (_("Top Edge"), V_BASE_TOP,
combo = gimp_int_combo_box_new (_("Top edge"), V_BASE_TOP,
_("Center"), V_BASE_CENTER,
_("Bottom Edge"), V_BASE_BOTTOM,
_("Bottom edge"), V_BASE_BOTTOM,
NULL);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_base);
......@@ -477,11 +472,11 @@ align_layers_dialog (void)
&VALS.v_base);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
_("Ver_tical Base:"), 0.0, 0.5,
_("Ver_tical base:"), 0.0, 0.5,
combo, 2, FALSE);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
_("_Grid Size:"), SCALE_WIDTH, 0,
_("_Grid size:"), SCALE_WIDTH, 0,
VALS.grid_size, 0, 200, 1, 10, 0,
TRUE, 0, 0,
NULL, NULL);
......@@ -490,7 +485,7 @@ align_layers_dialog (void)
&VALS.grid_size);
toggle = gtk_check_button_new_with_mnemonic
(_("_Ignore the Bottom Layer even if Visible"));
(_("_Ignore the bottom layer even if visible"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), VALS.ignore_bottom);
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 3, 5, 6);
gtk_widget_show (toggle);
......@@ -500,7 +495,7 @@ align_layers_dialog (void)
&VALS.ignore_bottom);
toggle = gtk_check_button_new_with_mnemonic
(_("_Use the (Invisible) Bottom Layer as the Base"));
(_("_Use the (invisible) bottom layer as the base"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
VALS.base_is_bottom_layer);
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 3, 6, 7);
......
......@@ -3,84 +3,22 @@
*
* (c) Adam D. Moss : 1997-2000 : adam@gimp.org : adam@foxbox.org
*
* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This is part of the GIMP package and is released under the GNU
* Public License.
*/
/*
* REVISION HISTORY:
*
* 2000-08-30 : version 0.98.8
* Default frame timing is now 100ms instead of 125ms.
*
* 2000-06-05 : version 0.98.7
* Fix old bug which could cause errors in evaluating the
* final pixel of each composed layer.
*
* 2000-01-13 : version 0.98.6
* Looser parsing of (XXXXX) layer-name tags
*
* 98.07.27 : version 0.98.5
* UI tweaks, fix for pseudocolor displays w/gdkrgb.
*
* 98.07.20 : version 0.98.4
* User interface improvements.
*
* 98.07.19 : version 0.98.2
* Another speedup for some kinds of shaped animations.
*
* 98.07.19 : version 0.98.0
* Adapted to use GDKRGB (from recent GTK >= 1.1) if
* available - good speed and reliability improvement.
* Plus some minor tweaks.
*
* 98.04.28 : version 0.94.2
* Fixed a time-parsing bug.
*
* 98.04.05 : version 0.94.0
* Improved performance and removed flicker when shaped.
* Shaped mode also works with RGB* images now.
* Fixed some longstanding potential visual debris.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 98.04.04 : version 0.92.0
* Improved responsiveness and performance for the new
* shaped-animation mode. Still some flicker.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 98.04.02 : version 0.90.0
* EXPERIMENTAL wackyness - try dragging the animation
* out of the plugin dialog's preview box...
* (only works on non-RGB* images for now)
*
* 98.03.16 : version 0.85.0
* Implemented some more rare opaque/alpha combinations.
*
* 98.03.15 : version 0.84.0
* Tried to clear up the GTK object/cast warnings. Only
* partially successful. Could use some help.
*
* 97.12.11 : version 0.83.0
* GTK's timer logic changed a little... adjusted
* plugin to fit.
*
* 97.09.16 : version 0.81.7
* Fixed progress bar's off-by-one problem with
* the new timing. Fixed erroneous black bars which
* were sometimes visible when the first frame was
* smaller than the image itself. Made playback
* controls inactive when image doesn't have multiple
* frames. Moved progress bar above control buttons,
* it's less distracting there. More cosmetic stuff.
*
* 97.09.15 : version 0.81.0
* Now plays INDEXED and GRAY animations.
*
* 97.09.15 : version 0.75.0
* Next frame is generated ahead of time - results
* in more precise timing.
*
* 97.09.14 : version 0.70.0
* Initial release. RGB only.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
......@@ -166,8 +104,8 @@ static void init_preview_misc (void);
/* tag util functions*/
static int parse_ms_tag (const char *str);
static DisposeType parse_disposal_tag (const char *str);
static DisposeType get_frame_disposal (const guint whichframe);
static guint32 get_frame_duration (const guint whichframe);
static DisposeType get_frame_disposal (guint whichframe);
static guint32 get_frame_duration (guint whichframe);
static int is_disposal_tag (const char *str,
DisposeType *disposal,
int *taglength);
......@@ -310,7 +248,6 @@ reshape_from_bitmap (gchar* bitmap)
}
}
static gboolean
shape_pressed (GtkWidget *widget,
GdkEventButton *event)
......@@ -339,7 +276,6 @@ shape_pressed (GtkWidget *widget,
return FALSE;
}
static gboolean
maybeblocked_expose (GtkWidget *widget,
GdkEventExpose *event)
......@@ -391,7 +327,6 @@ shape_motion (GtkWidget *widget,
return FALSE;
}
static gboolean
repaint_da (GtkWidget *darea,
GdkEventExpose *event,
......@@ -406,7 +341,6 @@ repaint_da (GtkWidget *darea,
return TRUE;
}
static gboolean
repaint_sda (GtkWidget *darea,
GdkEventExpose *event,
......@@ -421,7 +355,6 @@ repaint_sda (GtkWidget *darea,
return TRUE;
}
static gboolean
preview_pressed (GtkWidget *widget,
GdkEventButton *event)
......@@ -460,8 +393,6 @@ preview_pressed (GtkWidget *widget,
return shape_pressed (shape_window, event);
}
static void
build_dialog (GimpImageBaseType basetype,
gchar *imagename)
......@@ -1192,7 +1123,6 @@ render_frame (gint32 whichframe)
gimp_drawable_detach(drawable);
}
/* If we're using GDKRGB, we don't reshape in this function because
it's too late (GDKRGB is synchronous). So this just updates the
progress bar. */
......@@ -1210,7 +1140,6 @@ show_frame (void)
g_free (text);
}
static void
init_preview_misc (void)
{
......@@ -1247,30 +1176,27 @@ init_preview_misc (void)
shape_drawing_area_data = preview_data;
}
static void
total_alpha_preview (guchar* ptr)
{
int i;
if (shaping)
{
memset(shape_preview_mask, 0, (width*height)/8 + height);
}
else
{
for (i=0;i<height;i++)
gint i;
for (i = 0;i < height; i++)
{
if (i&8)
memcpy(&ptr[i*3*width], preview_alpha1_data, 3*width);
if (i & 8)
memcpy (&ptr[i*3*width], preview_alpha1_data, 3*width);
else
memcpy(&ptr[i*3*width], preview_alpha2_data, 3*width);
memcpy (&ptr[i*3*width], preview_alpha2_data, 3*width);
}
}
}
/* Util. */
static void
......@@ -1374,35 +1300,29 @@ step_callback (GtkWidget *widget,
show_frame();
}
/* tag util. */
static DisposeType
get_frame_disposal (const guint whichframe)
get_frame_disposal (guint whichframe)
{
gchar *layer_name;
DisposeType disposal;
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
disposal = parse_disposal_tag(layer_name);
g_free(layer_name);
layer_name = gimp_drawable_get_name (layers[total_frames-(whichframe+1)]);
disposal = parse_disposal_tag (layer_name);
g_free (layer_name);
return(disposal);
return disposal;
}
static guint32
get_frame_duration (const guint whichframe)
get_frame_duration (guint whichframe)
{
gchar *layer_name;
gint duration = 0;
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
if (layer_name != NULL)
if (layer_name)
{
duration = parse_ms_tag(layer_name);
g_free(layer_name);
......@@ -1412,12 +1332,13 @@ get_frame_duration (const guint whichframe)
else
if (duration == 0) duration = 100; /* FIXME - 0-wait is nasty */
return ((guint32) duration);
return (guint32) duration;
}
static int
is_ms_tag (const char *str, int *duration, int *taglength)
is_ms_tag (const char *str,
int *duration,
int *taglength)
{
gint sum = 0;
gint offset;
......@@ -1474,7 +1395,6 @@ is_ms_tag (const char *str, int *duration, int *taglength)
return 1;
}
static int
parse_ms_tag (const char *str)
{
......@@ -1485,7 +1405,7 @@ parse_ms_tag (const char *str)
length = strlen(str);
for (i=0; i<length; i++)
for (i = 0; i < length; i++)
{
if (is_ms_tag (&str[i], &rtn, &dummy))
return rtn;
......@@ -1494,9 +1414,10 @@ parse_ms_tag (const char *str)
return -1;
}
static int
is_disposal_tag (const char *str, DisposeType *disposal, int *taglength)
is_disposal_tag (const char *str,
DisposeType *disposal,
int *taglength)
{
if (strlen(str) != 9)
return 0;
......@@ -1517,7 +1438,6 @@ is_disposal_tag (const char *str, DisposeType *disposal, int *taglength)
return 0;
}
static DisposeType
parse_disposal_tag (const char *str)
{
......@@ -1527,14 +1447,14 @@ parse_disposal_tag (const char *str)
length = strlen(str);
for (i=0; i<length; i++)
for (i = 0; i < length; i++)
{
if (is_disposal_tag(&str[i], &rtn, &dummy))
if (is_disposal_tag (&str[i], &rtn, &dummy))
{
return rtn;
}
}
return (DISPOSE_UNDEFINED); /* FIXME */
return DISPOSE_UNDEFINED; /* FIXME */
}
......@@ -5,78 +5,22 @@
* adam@gimp.org
* adam@foxbox.org
*
* This is part of the GIMP package and falls under the GPL.
*/
/*
* REVISION HISTORY:
*
* 2003-11-23 : version 1.1.2
* Improved optimization for GIF and file formats using
* compression on a line-by-line basis. See bug #66367.
* (Raphaël Quinet)
*
* 2003-08-12 : version 1.1.1
* Disable the semi-broken background/foreground stuff
* unless EXPERIMENTAL_BACKDROP_CODE is defined...
*
* 2001-04-28 : version 1.1.0 [ALPHA]
* Support automated background (or foreground) removal.
* It's half-broken.
* Eliminated special optimized frame alignment cases --
* we're not trying to be real-time like animationplay
* and it complicates the code.
*
* 2000-08-30 : version 1.0.4
* Change default frame duration from 125ms to 100ms for
* consistancy.
*
* 2000-06-05 : version 1.0.3
* Fix old bug which could cause errors in evaluating the
* final pixel of each composed layer.
*
* 2000-01-13 : version 1.0.2
* Collapse timing of completely optimized-away frames
* onto previous surviving frame. Also be looser with
* (XXXXX) tag parsing.
* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 2000-01-07 : version 1.0.1
* PDB interface submitted by Andreas Jaekel
* <jaekel@cablecats.de>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 98.05.17 : version 1.0.0
* Finally preserves frame timings / layer names. Has
* a progress bar now. No longer beta, I suppose.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 98.04.19 : version 0.70.0
* Plug-in doubles up as Animation UnOptimize too! (This
* is somewhat more useful than it sounds.)
*
* 98.03.16 : version 0.61.0
* Support more rare opaque/transparent combinations.
*
* 97.12.09 : version 0.60.0
* Added support for INDEXED* and GRAY* images.
*
* 97.12.09 : version 0.52.0
* Fixed some bugs.
*
* 97.12.08 : version 0.51.0
* Relaxed bounding box on optimized layers marked
* 'replace'.
*
* 97.12.07 : version 0.50.0
* Initial release.
*/
/*
* BUGS:
* ?
*/
/*
* TODO:
* User interface
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
......@@ -1171,9 +1115,6 @@ do_optimizations (GimpRunMode run_mode,
return new_image_id;
}
/* Util. */
static DisposeType
......@@ -1186,11 +1127,9 @@ get_frame_disposal (guint whichframe)
disposal = parse_disposal_tag(layer_name);
g_free(layer_name);
return(disposal);
return disposal;
}
static guint32
get_frame_duration (guint whichframe)
{
......@@ -1198,7 +1137,7 @@ get_frame_duration (guint whichframe)
gint duration = 0;
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
if (layer_name != NULL)
if (layer_name)
{
duration = parse_ms_tag(layer_name);
g_free(layer_name);
......@@ -1207,10 +1146,9 @@ get_frame_duration (guint whichframe)
if (duration < 0) duration = 100; /* FIXME for default-if-not-said */
if (duration == 0) duration = 100; /* FIXME - 0-wait is nasty */
return ((guint32) duration);
return (guint32) duration;
}
static gboolean
is_ms_tag (const gchar *str,
gint *duration,
......@@ -1271,7 +1209,6 @@ is_ms_tag (const gchar *str,
return TRUE;
}
static int
parse_ms_tag (const char *str)
{
......@@ -1282,7 +1219,7 @@ parse_ms_tag (const char *str)
length = strlen (str);
for (i=0; i<length; i++)
for (i = 0; i < length; i++)
{
if (is_ms_tag (&str[i], &rtn, &dummy))
return rtn;
......@@ -1291,7 +1228,6 @@ parse_ms_tag (const char *str)
return -1;
}
static gboolean
is_disposal_tag (const gchar *str,
DisposeType *disposal,
......@@ -1337,8 +1273,6 @@ parse_disposal_tag (const gchar *str)
return DISPOSE_UNDEFINED; /* FIXME */
}
static void
remove_disposal_tag (gchar *dest,
gchar *src)
......@@ -1367,8 +1301,6 @@ remove_disposal_tag (gchar *dest,
dest[offset] = '\0';
}
static void
remove_ms_tag (gchar *dest,
gchar *src)
......
......@@ -382,8 +382,8 @@ lens_dialog (GimpDrawable *drawable)
toggle = gtk_radio_button_new_with_mnemonic_from_widget
(GTK_RADIO_BUTTON (toggle),
gimp_drawable_is_indexed (drawable->drawable_id)