2007-11-16 18:25:45 +00:00
|
|
|
/* ASE - Allegro Sprite Editor
|
2009-01-24 00:41:01 +00:00
|
|
|
* Copyright (C) 2001-2009 David Capello
|
2007-09-23 20:13:58 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2007-12-05 01:30:50 +00:00
|
|
|
#include "jinete/jbase.h"
|
2007-09-23 20:13:58 +00:00
|
|
|
|
2007-12-05 01:30:50 +00:00
|
|
|
#include "commands/commands.h"
|
2007-09-23 20:13:58 +00:00
|
|
|
#include "modules/sprites.h"
|
2007-09-30 15:32:21 +00:00
|
|
|
#include "raster/layer.h"
|
|
|
|
#include "raster/mask.h"
|
2007-09-23 20:13:58 +00:00
|
|
|
#include "raster/sprite.h"
|
2009-03-07 19:14:40 +00:00
|
|
|
#include "util/clipboard.h"
|
2007-09-30 15:32:21 +00:00
|
|
|
#include "util/misc.h"
|
2007-09-23 20:13:58 +00:00
|
|
|
|
2007-12-05 01:30:50 +00:00
|
|
|
static bool cmd_copy_enabled(const char *argument)
|
2007-09-30 15:32:21 +00:00
|
|
|
{
|
2009-06-01 02:59:15 +00:00
|
|
|
CurrentSprite sprite;
|
|
|
|
|
|
|
|
if ((!sprite) ||
|
|
|
|
(!sprite->layer) ||
|
|
|
|
(!layer_is_readable(sprite->layer)) ||
|
|
|
|
(!layer_is_writable(sprite->layer)) ||
|
|
|
|
(!sprite->mask) ||
|
|
|
|
(!sprite->mask->bitmap))
|
|
|
|
return false;
|
2007-09-30 15:32:21 +00:00
|
|
|
else
|
2009-06-01 02:59:15 +00:00
|
|
|
return GetImage(sprite) ? true: false;
|
2007-09-30 15:32:21 +00:00
|
|
|
}
|
|
|
|
|
2007-12-05 01:30:50 +00:00
|
|
|
static void cmd_copy_execute(const char *argument)
|
2007-09-23 20:13:58 +00:00
|
|
|
{
|
2009-06-01 02:59:15 +00:00
|
|
|
CurrentSprite sprite;
|
|
|
|
clipboard::copy(sprite);
|
2007-09-23 20:13:58 +00:00
|
|
|
}
|
2007-12-05 01:30:50 +00:00
|
|
|
|
|
|
|
Command cmd_copy = {
|
|
|
|
CMD_COPY,
|
|
|
|
cmd_copy_enabled,
|
|
|
|
NULL,
|
|
|
|
cmd_copy_execute,
|
|
|
|
NULL
|
|
|
|
};
|