diff --git a/src/app/commands/cmd_remove_layer.cpp b/src/app/commands/cmd_remove_layer.cpp index 276371022..280df779f 100644 --- a/src/app/commands/cmd_remove_layer.cpp +++ b/src/app/commands/cmd_remove_layer.cpp @@ -31,6 +31,7 @@ #include "app/undo_transaction.h" #include "raster/layer.h" #include "raster/sprite.h" +#include "ui/alert.h" #include "ui/widget.h" namespace app { @@ -66,6 +67,7 @@ void RemoveLayerCommand::onExecute(Context* context) std::string layer_name; ContextWriter writer(context); Document* document(writer.document()); + Sprite* sprite(writer.sprite()); Layer* layer(writer.layer()); { UndoTransaction undoTransaction(writer.context(), "Remove Layer"); @@ -73,13 +75,21 @@ void RemoveLayerCommand::onExecute(Context* context) // TODO the range of selected layer should be in the DocumentLocation. Timeline::Range range = App::instance()->getMainWindow()->getTimeline()->range(); if (range.enabled()) { - Sprite* sprite = writer.sprite(); + if (range.layers() == sprite->countLayers()) { + ui::Alert::show("Error<= range.layerBegin(); --layer) { document->getApi().removeLayer(sprite->indexToLayer(layer)); } } else { + if (sprite->countLayers() == 1) { + ui::Alert::show("Error<name(); document->getApi().removeLayer(layer); } diff --git a/src/app/commands/filters/cmd_replace_color.cpp b/src/app/commands/filters/cmd_replace_color.cpp index a08f9fb48..6e6f7b5ea 100644 --- a/src/app/commands/filters/cmd_replace_color.cpp +++ b/src/app/commands/filters/cmd_replace_color.cpp @@ -52,11 +52,13 @@ public: void setFrom(const app::Color& from) { m_from = from; - ReplaceColorFilter::setFrom(color_utils::color_for_layer(from, m_layer)); + if (m_layer) + ReplaceColorFilter::setFrom(color_utils::color_for_layer(from, m_layer)); } void setTo(const app::Color& to) { m_to = to; - ReplaceColorFilter::setTo(color_utils::color_for_layer(to, m_layer)); + if (m_layer) + ReplaceColorFilter::setTo(color_utils::color_for_layer(to, m_layer)); } app::Color getFrom() const { return m_from; } diff --git a/src/app/commands/filters/filter_manager_impl.h b/src/app/commands/filters/filter_manager_impl.h index d51303136..cc689d807 100644 --- a/src/app/commands/filters/filter_manager_impl.h +++ b/src/app/commands/filters/filter_manager_impl.h @@ -57,7 +57,7 @@ namespace app { class NoImageException : public base::Exception { public: NoImageException() throw() - : base::Exception("There are not an active image to apply the effect.\n" + : base::Exception("There is not an active image to apply the effect.\n" "Please select a layer/cel with an image and try again.") { } };