From 82476db9884b857c0a1d5a75a06bd6b0054d07da Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 24 Mar 2011 11:50:09 -0300 Subject: [PATCH] Remove deprecated file cmd_new_cel.cpp. --- src/commands/cmd_new_cel.cpp | 108 ----------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 src/commands/cmd_new_cel.cpp diff --git a/src/commands/cmd_new_cel.cpp b/src/commands/cmd_new_cel.cpp deleted file mode 100644 index 59b21b606..000000000 --- a/src/commands/cmd_new_cel.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* ASE - Allegro Sprite Editor - * Copyright (C) 2001-2011 David Capello - * - * 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" - -#include "gui/gui.h" - -#include "commands/command.h" -#include "console.h" -#include "gfx/color.h" -#include "modules/gui.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" -#include "raster/undo.h" - -////////////////////////////////////////////////////////////////////// -// new_cel - -class NewCelCommand : public Command -{ -public: - NewCelCommand(); - Command* clone() { return new NewCelCommand(*this); } - -protected: - bool onEnabled(Context* context); - void onExecute(Context* context); -}; - -bool NewCelCommand::onEnabled(Context* context) -{ - return - current_sprite && - current_sprite->layer && - layer_is_readable(current_sprite->layer) && - layer_is_writable(current_sprite->layer) && - layer_is_image(current_sprite->layer) && - !layer_get_cel(current_sprite->layer, current_sprite->frame); -} - -void NewCelCommand::onExecute(Context* context) -{ - int image_index; - Image *image; - Cel *cel; - - /* create a new empty cel with a new clean image */ - image = image_new(current_sprite->imgtype, - current_sprite->w, - current_sprite->h); - if (!image) { - console_printf(_("Not enough memory.\n")); - return; - } - - /* background color (right color) */ - image_clear(image, 0); - - /* add the image in the stock */ - image_index = current_sprite->stock->addImage(image); - - if (undo_is_enabled(current_sprite->undo)) { - current_sprite->undo->setLabel("New Cel"); - undo_open(current_sprite->undo); - undo_add_image(current_sprite->undo, - current_sprite->stock, image_index); - } - - /* create the new cel */ - cel = cel_new(current_sprite->frame, image_index); - - /* add the cel in the layer */ - if (undo_is_enabled(current_sprite->undo)) - undo_add_cel(current_sprite->undo, current_sprite->layer, cel); - - layer_add_cel(current_sprite->layer, cel); - - if (undo_is_enabled(current_sprite->undo)) - undo_close(current_sprite->undo); - - update_screen_for_document(current_sprite); -} - -////////////////////////////////////////////////////////////////////// -// CommandFactory - -Command* CommandFactory::createNewCelCommand() -{ - return new NewCelCommand; -}