diff --git a/ChangeLog b/ChangeLog
index f642f83e7..5725d779f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-05-05 David A. Capello
+
+ * src/script/functions.c (CropLayer): Rewritten (more simple).
+ (CropSprite): Fixed to crop the background layer right.
+
+ * src/commands/cmd_merge_down_layer.c (cmd_merge_down_layer_execute):
+ Fixed to merge a transparent over the background.
+
+ * src/raster/image.c (image_crop): Added the 'bgcolor' parameter.
+
+ * src/script/functions.c (CropLayer): Fixed.
+
2008-05-04 David A. Capello
* src/util/celmove.c (move_cel, copy_cel): Fixed to handle
diff --git a/data/gui-en.xml b/data/gui-en.xml
index 4dec2444a..1d0b5cc56 100644
--- a/data/gui-en.xml
+++ b/data/gui-en.xml
@@ -133,8 +133,8 @@
-- Mouse cursor: is the icon (a little image) that you
-displaces with the mouse movement (it moves pixel-by-pixel of the
-screen).
-- Drawing cursor: is the cross that appears inside the editor
-(it moves pixel-by-pixel of the image).
-- Left/Right: go to previous/next frame.
-- Down/Up: go to first/last frame.
-- 1 to 6: changes the editor's zoom.
-- Shift+Mouse movement: moves the editor's scroll
-- + or - from pad: changes the brush size
-- 9 or 0: picks primary or secondary color from the image
-- Ctrl+Mouse movement: moves the current layer
-
-
-
-
- System menu |
-
-
F5 | Refresh the screen |
- F12 | Take a screen shot |
-
- File menu |
-
-
Ctrl+N | Creates a new sprite |
- Ctrl+O F3 | Opens a sprite |
- Ctrl+S F2 | Saves current sprite (ask for file name) |
- Ctrl+W | Closes the current sprite |
- Ctrl+Q Esc | Quits (ask about modified sprites) |
-
- Edit menu |
-
-
Ctrl+Z Ctrl+U | Undo |
- Ctrl+R | Redo |
- Ctrl+X Shift+Del | Cut |
- Ctrl+C Ctrl+Ins | Copy |
- Ctrl+V Shift+Ins | Paste |
- Ctrl+B Ctrl+Del | Clear |
- Shift+M | Moves the selected pixel region (mask) to other position |
- Shift+C | Copies a pixel region in other position |
-
- Shift+H | Flips the pixel region horizontally |
- Shift+V | Flips the pixel region vertically |
- / (slash) | Replace colors |
- Ctrl+I | Makes a negative of the image inside selected area |
-
- Sprite menu |
-
-
Ctrl+P | Shows the main sprite's properties |
-
- Layer menu |
-
-
Shift+P | Shows the properties of selected layer |
- Shift+N | Inserts an image-layer |
-
- Frame menu |
-
-
Ctrl+Shift+P | Shows the properties of selected frame |
- Ctrl+Shift+N | Creates a new frame |
-
- Mask (selection) menu |
-
-
Ctrl+A | Selects all |
- Ctrl+D | Deselects the mask |
- Ctrl+Shift+D | Reselects the mask |
- Ctrl+Shift+I | Inverts the mask |
- ? | Shows the window to mask regions by image color |
- Ctrl+Shift+M | Shows the masks' repository |
-
- Tool menu |
-
-
Ctrl+0 | Loads a script from file |
- F1 | Shows tips |
- Ctrl+Shift+O | Shows options |
-
- Drawing Tool menu |
-
-
C | Shows/hide Configure Tool window |
- M | Marker: Select mask regions |
- D | Dots: Draw pixel by pixel |
- P | Pencil: Draw perfect trace |
- B | Brush: Draw imperfect trace |
- F | Floodfill: Fill areas |
- S | Spray: Draw random pixels |
- L | Line: Draw a line between two points |
- R | Rectangle: Draw a rectangle between two points |
- E | Ellipse: Draw a oval between two points |
-
- Filters menu |
-
-
F9 | Shows the Convolution Matrix window |
- F10 Ctrl+M | Shows the Color Curve window |
-
- View menu |
-
-
F8 | Views the sprite like a mosaic (tiled) |
- F7 | Views the sprite in a normal size |
- Ctrl+F1 | Switch the menu-bar |
- Ctrl+F2 | Switch the status-bar |
- Ctrl+F3 | Switch the color-bar |
- Ctrl+F4 | Switch the tool-bar |
- Ctrl+1 | Makes the current editor the unique one |
- Ctrl+2 | Splits the current editor vertically |
- Ctrl+3 | Splits the current editor horizontally |
- Ctrl+4 | Closes the current editor |
- Tab | Shows/hide the Film Editor |
- F4 | Shows the palette editor |
- X | Shows the filters popup menu |
-
-
-
-
-
diff --git a/misc/dist.sh b/misc/dist.sh
index 31b851ce2..70742aae3 100644
--- a/misc/dist.sh
+++ b/misc/dist.sh
@@ -1,7 +1,7 @@
#! /bin/sh
dir="`pwd`"
-version=0.6-beta2
+version=0.6b2
distdir=ase-$version
freetype_files="third_party/freetype/ChangeLog \
@@ -90,7 +90,7 @@ ase_files="config.h \
data/tips/*.pcx \
data/tips/tips.en \
data/tips/tips.es \
- docs/*.html \
+ docs/*.pdf \
docs/*.txt \
docs/files/*.txt \
docs/licenses/*.txt \
@@ -107,8 +107,8 @@ ase_files="config.h \
src/dialogs/*.[ch] \
src/effect/*.[ch] \
src/file/*.[ch] \
- src/file/fli/*.[ch] \
- src/file/fli/README \
+ src/file/fli/*.[ch] \
+ src/file/fli/README \
src/file/gif/*.[ch] \
src/intl/*.[ch] \
src/jinete/*.[ch] \
@@ -177,9 +177,7 @@ $1/data/jids/*.jid \
$1/data/gui-en.xml \
$1/data/tips/*.en \
$1/data/tips/*.es \
-$1/docs/*.html \
-$1/docs/*.info \
-$1/docs/*.texi \
+$1/docs/*.pdf \
$1/docs/*.txt \
$1/docs/files/*.txt \
$1/docs/licenses/*.txt"
diff --git a/src/commands/cmd_background_from_layer.c b/src/commands/cmd_background_from_layer.c
index 720dacfb0..3c3a5dce0 100644
--- a/src/commands/cmd_background_from_layer.c
+++ b/src/commands/cmd_background_from_layer.c
@@ -23,6 +23,7 @@
#include "modules/sprites.h"
#include "raster/layer.h"
#include "raster/sprite.h"
+#include "raster/undo.h"
#include "script/functions.h"
static bool cmd_background_from_layer_enabled(const char *argument)
@@ -38,8 +39,13 @@ static bool cmd_background_from_layer_enabled(const char *argument)
static void cmd_background_from_layer_execute(const char *argument)
{
- BackgroundFromLayer();
- update_screen_for_sprite(current_sprite);
+ Sprite *sprite = current_sprite;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "Background from Layer");
+
+ BackgroundFromLayer(sprite);
+ update_screen_for_sprite(sprite);
}
Command cmd_background_from_layer = {
diff --git a/src/commands/cmd_crop.c b/src/commands/cmd_crop.c
index 6fb0ebdcd..3ad9ec66e 100644
--- a/src/commands/cmd_crop.c
+++ b/src/commands/cmd_crop.c
@@ -19,11 +19,13 @@
#include "config.h"
#include "commands/commands.h"
+#include "modules/gui.h"
#include "modules/sprites.h"
#include "raster/image.h"
-#include "raster/mask.h"
#include "raster/layer.h"
+#include "raster/mask.h"
#include "raster/sprite.h"
+#include "raster/undo.h"
#include "script/functions.h"
#include "util/autocrop.h"
#include "util/misc.h"
@@ -41,7 +43,13 @@ static bool cmd_crop_sprite_enabled(const char *argument)
static void cmd_crop_sprite_execute(const char *argument)
{
- CropSprite();
+ Sprite *sprite = current_sprite;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "Sprite Crop");
+
+ CropSprite(sprite);
+ update_screen_for_sprite(sprite);
}
/* ======================== */
@@ -55,7 +63,13 @@ static bool cmd_autocrop_sprite_enabled(const char *argument)
static void cmd_autocrop_sprite_execute(const char *argument)
{
- autocrop_sprite();
+ Sprite *sprite = current_sprite;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "Sprite Autocrop");
+
+ autocrop_sprite(sprite);
+ update_screen_for_sprite(sprite);
}
/**********************************************************************/
diff --git a/src/commands/cmd_flatten_layers.c b/src/commands/cmd_flatten_layers.c
index 0856d3c1e..e5306a3f4 100644
--- a/src/commands/cmd_flatten_layers.c
+++ b/src/commands/cmd_flatten_layers.c
@@ -19,7 +19,10 @@
#include "config.h"
#include "commands/commands.h"
+#include "modules/gui.h"
#include "modules/sprites.h"
+#include "raster/undo.h"
+#include "raster/sprite.h"
#include "script/functions.h"
static bool cmd_flatten_layers_enabled(const char *argument)
@@ -29,7 +32,13 @@ static bool cmd_flatten_layers_enabled(const char *argument)
static void cmd_flatten_layers_execute(const char *argument)
{
- FlattenLayers();
+ Sprite *sprite = current_sprite;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "Flatten Layers");
+
+ FlattenLayers(sprite);
+ update_screen_for_sprite(sprite);
}
Command cmd_flatten_layers = {
diff --git a/src/commands/cmd_flip.c b/src/commands/cmd_flip.c
index 7ff1a8f93..12a5e00b6 100644
--- a/src/commands/cmd_flip.c
+++ b/src/commands/cmd_flip.c
@@ -100,7 +100,7 @@ static void do_flip(int horz)
}
/* flip the portion of the bitmap */
- area = image_crop(image, x1, y1, x2-x1+1, y2-y1+1);
+ area = image_crop(image, x1, y1, x2-x1+1, y2-y1+1, 0);
for (y=0; y<(y2-y1+1); y++)
for (x=0; x<(x2-x1+1); x++)
image_putpixel(image,
diff --git a/src/commands/cmd_layer_from_background.c b/src/commands/cmd_layer_from_background.c
index 8511de501..2252c5fa7 100644
--- a/src/commands/cmd_layer_from_background.c
+++ b/src/commands/cmd_layer_from_background.c
@@ -42,8 +42,13 @@ static bool cmd_layer_from_background_enabled(const char *argument)
static void cmd_layer_from_background_execute(const char *argument)
{
- LayerFromBackground();
- update_screen_for_sprite(current_sprite);
+ Sprite *sprite = current_sprite;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "Layer from Background");
+
+ LayerFromBackground(sprite);
+ update_screen_for_sprite(sprite);
}
Command cmd_layer_from_background = {
diff --git a/src/commands/cmd_merge_down_layer.c b/src/commands/cmd_merge_down_layer.c
index 748ba1a3c..73aaee784 100644
--- a/src/commands/cmd_merge_down_layer.c
+++ b/src/commands/cmd_merge_down_layer.c
@@ -86,7 +86,7 @@ static void cmd_merge_down_layer_execute(const char *argument)
/* with source image? */
if (src_image != NULL) {
/* no destination image */
- if (dst_image == NULL) {
+ if (dst_image == NULL) { /* only a transparent layer can have a null cel */
/* copy this cel to the destination layer... */
/* creating a copy of the image */
@@ -108,14 +108,30 @@ static void cmd_merge_down_layer_execute(const char *argument)
}
/* with destination */
else {
- int x1 = MIN(src_cel->x, dst_cel->x);
- int y1 = MIN(src_cel->y, dst_cel->y);
- int x2 = MAX(src_cel->x+src_image->w-1, dst_cel->x+dst_image->w-1);
- int y2 = MAX(src_cel->y+src_image->h-1, dst_cel->y+dst_image->h-1);
- Image *new_image = image_crop(dst_image,
- x1-dst_cel->x,
- y1-dst_cel->y,
- x2-x1+1, y2-y1+1);
+ int x1, y1, x2, y2, bgcolor;
+ Image *new_image;
+
+ /* merge down in the background layer */
+ if (layer_is_background(dst_layer)) {
+ x1 = 0;
+ y1 = 0;
+ x2 = sprite->w;
+ y2 = sprite->h;
+ bgcolor = app_get_color_to_clear_layer(dst_layer);
+ }
+ /* merge down in a transparent layer */
+ else {
+ x1 = MIN(src_cel->x, dst_cel->x);
+ y1 = MIN(src_cel->y, dst_cel->y);
+ x2 = MAX(src_cel->x+src_image->w-1, dst_cel->x+dst_image->w-1);
+ y2 = MAX(src_cel->y+src_image->h-1, dst_cel->y+dst_image->h-1);
+ bgcolor = 0;
+ }
+
+ new_image = image_crop(dst_image,
+ x1-dst_cel->x,
+ y1-dst_cel->y,
+ x2-x1+1, y2-y1+1, bgcolor);
/* merge src_image in new_image */
image_merge(new_image, src_image,
diff --git a/src/commands/cmd_new_file.c b/src/commands/cmd_new_file.c
index 66c82493f..8695ac1b4 100644
--- a/src/commands/cmd_new_file.c
+++ b/src/commands/cmd_new_file.c
@@ -136,7 +136,7 @@ static void cmd_new_file_execute(const char *argument)
/* if the background color isn't transparent, we have to
convert the `Layer 1' in a `Background' */
if (color_type(color) != COLOR_TYPE_MASK) {
- BackgroundFromLayer();
+ BackgroundFromLayer(sprite);
/* clear the image to */
image_clear(GetImage(sprite),
diff --git a/src/commands/cmd_new_layer.c b/src/commands/cmd_new_layer.c
index 6081ba1b9..b20c5b99f 100644
--- a/src/commands/cmd_new_layer.c
+++ b/src/commands/cmd_new_layer.c
@@ -26,6 +26,7 @@
#include "modules/sprites.h"
#include "raster/layer.h"
#include "raster/sprite.h"
+#include "raster/undo.h"
#include "script/functions.h"
static bool cmd_new_layer_enabled(const char *argument)
@@ -44,14 +45,19 @@ static void cmd_new_layer_execute(const char *argument)
return;
name_widget = jwidget_find_name(window, "name");
- jwidget_set_text(name_widget, GetUniqueLayerName());
+ jwidget_set_text(name_widget, GetUniqueLayerName(sprite));
jwidget_set_min_size(name_widget, 128, 0);
jwindow_open_fg(window);
if (jwindow_get_killer(window) == jwidget_find_name(window, "ok")) {
const char *name = jwidget_get_text(jwidget_find_name(window, "name"));
- Layer *layer = NewLayer();
+ Layer *layer;
+
+ if (undo_is_enabled(sprite->undo))
+ undo_set_label(sprite->undo, "New Layer");
+
+ layer = NewLayer(sprite);
if (!layer) {
jalert(_("Error<