Change errors UI related to locked/hidden layers to status bar tips

This was mainly done for Ctrl+click, so when we try to move the
Background layer, we avoid an annoying message box.
This commit is contained in:
David Capello 2014-11-24 11:50:02 -03:00
parent 3645ffe2a5
commit 80501899ca
2 changed files with 16 additions and 17 deletions

View File

@ -198,14 +198,14 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
if ((layer) &&
(layer->type() == OBJECT_LAYER_IMAGE)) {
// TODO you can move the `Background' with tiled mode
// TODO we should be able to move the `Background' with tiled mode
if (layer->isBackground()) {
Alert::show(PACKAGE
"<<You can't move the `Background' layer."
"||&Close");
StatusBar::instance()->showTip(1000,
"The background layer cannot be moved");
}
else if (!layer->isMoveable()) {
Alert::show(PACKAGE "<<The layer movement is locked.||&Close");
else if (!layer->isMoveable() || !layer->isWritable()) {
StatusBar::instance()->showTip(1000,
"Layer '%s' is locked", layer->name().c_str());
}
else {
// Change to MovingCelState
@ -237,7 +237,8 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
Image* image = location.image(&x, &y, &opacity);
if (image) {
if (!layer->isWritable()) {
Alert::show(PACKAGE "<<The layer is locked.||&Close");
StatusBar::instance()->showTip(1000,
"Layer '%s' is locked", layer->name().c_str());
return true;
}
@ -251,7 +252,8 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
// Move selected pixels
if (editor->isInsideSelection() && msg->left()) {
if (!layer->isWritable()) {
Alert::show(PACKAGE "<<The layer is locked.||&Close");
StatusBar::instance()->showTip(1000,
"Layer '%s' is locked", layer->name().c_str());
return true;
}

View File

@ -298,24 +298,21 @@ tools::ToolLoop* create_tool_loop(Editor* editor, Context* context)
Layer* layer = editor->layer();
if (!layer) {
Alert::show(PACKAGE "<<The current sprite does not have any layer.||&Close");
StatusBar::instance()->showTip(1000,
"There is no active layer");
return NULL;
}
// If the active layer is not visible.
if (!layer->isReadable()) {
Alert::show(PACKAGE
"<<The current layer is hidden,"
"<<make it visible and try again"
"||&Close");
StatusBar::instance()->showTip(1000,
"Layer '%s' is hidden", layer->name().c_str());
return NULL;
}
// If the active layer is read-only.
else if (!layer->isWritable()) {
Alert::show(PACKAGE
"<<The current layer is locked,"
"<<unlock it and try again"
"||&Close");
StatusBar::instance()->showTip(1000,
"Layer '%s' is locked", layer->name().c_str());
return NULL;
}