mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Added Editor::flashCurrentLayer() for when the current layer is changed.
This commit is contained in:
parent
ebe068b211
commit
8720d156e5
@ -68,8 +68,9 @@ void GotoPreviousLayerCommand::execute(Context* context)
|
||||
|
||||
sprite->setCurrentLayer(sprite->indexToLayer(i));
|
||||
|
||||
update_screen_for_sprite(sprite);
|
||||
current_editor->editor_update_statusbar_for_standby();
|
||||
// Flash the current layer
|
||||
assert(current_editor != NULL); // Cannot be null when we have a current sprite
|
||||
current_editor->flashCurrentLayer();
|
||||
|
||||
app_get_statusbar()
|
||||
->showTip(1000, _("Layer `%s' selected"),
|
||||
@ -116,8 +117,9 @@ void GotoNextLayerCommand::execute(Context* context)
|
||||
|
||||
sprite->setCurrentLayer(sprite->indexToLayer(i));
|
||||
|
||||
update_screen_for_sprite(sprite);
|
||||
current_editor->editor_update_statusbar_for_standby();
|
||||
// Flash the current layer
|
||||
assert(current_editor != NULL); // Cannot be null when we have a current sprite
|
||||
current_editor->flashCurrentLayer();
|
||||
|
||||
app_get_statusbar()
|
||||
->showTip(1000, _("Layer `%s' selected"),
|
||||
|
@ -509,6 +509,11 @@ void gui_feedback()
|
||||
/* record file if is necessary */
|
||||
rec_screen_poll();
|
||||
|
||||
gui_flip_screen();
|
||||
}
|
||||
|
||||
void gui_flip_screen()
|
||||
{
|
||||
/* double buffering? */
|
||||
if (double_buffering && ji_screen) {
|
||||
jmouse_draw_cursor();
|
||||
|
@ -71,6 +71,7 @@ void update_screen_for_sprite(const Sprite* sprite);
|
||||
|
||||
void gui_run();
|
||||
void gui_feedback();
|
||||
void gui_flip_screen();
|
||||
void gui_setup_screen(bool reload_font);
|
||||
|
||||
void load_window_pos(Widget* window, const char *section);
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
void editor_draw_mask();
|
||||
void editor_draw_mask_safe();
|
||||
|
||||
void flashCurrentLayer();
|
||||
|
||||
void screen_to_editor(int xin, int yin, int *xout, int *yout);
|
||||
void editor_to_screen(int xin, int yin, int *xout, int *yout);
|
||||
|
||||
|
@ -532,6 +532,38 @@ void Editor::drawGrid()
|
||||
jrect_free(vp);
|
||||
}
|
||||
|
||||
void Editor::flashCurrentLayer()
|
||||
{
|
||||
int x, y;
|
||||
const Image* src_image = m_sprite->getCurrentImage(&x, &y);
|
||||
if (src_image) {
|
||||
m_sprite->prepareExtra();
|
||||
Image* flash_image = m_sprite->getExtras();
|
||||
int u, v;
|
||||
|
||||
image_clear(flash_image, flash_image->mask_color);
|
||||
for (v=0; v<flash_image->h; ++v) {
|
||||
for (u=0; u<flash_image->w; ++u) {
|
||||
if (u-x >= 0 && u-x < src_image->w &&
|
||||
v-y >= 0 && v-y < src_image->h) {
|
||||
ase_uint32 color = image_getpixel(src_image, u-x, v-y);
|
||||
if (color != src_image->mask_color) {
|
||||
color_t ccc = color_rgb(255, 255, 255);
|
||||
image_putpixel(flash_image, u, v,
|
||||
get_color_for_image(flash_image->imgtype, ccc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor_draw_sprite(0, 0, m_sprite->getWidth()-1, m_sprite->getHeight()-1);
|
||||
gui_flip_screen();
|
||||
|
||||
image_clear(flash_image, flash_image->mask_color);
|
||||
editor_draw_sprite(0, 0, m_sprite->getWidth()-1, m_sprite->getHeight()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::turnOnSelectionModifiers()
|
||||
{
|
||||
// TODO deleteDecorators()
|
||||
|
@ -19,9 +19,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <allegro.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include "Vaca/Bind.h"
|
||||
#include "jinete/jinete.h"
|
||||
@ -479,17 +480,25 @@ bool StatusBar::msg_proc(JMessage msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case JM_BUTTONPRESSED:
|
||||
// When the user press the mouse-button over a hot-layer-button...
|
||||
if (m_hot_layer >= 0) {
|
||||
try {
|
||||
CurrentSpriteWriter sprite(UIContext::instance());
|
||||
if (sprite) {
|
||||
Layer* layer = sprite->indexToLayer(m_hot_layer);
|
||||
if (layer && layer != sprite->getCurrentLayer()) {
|
||||
sprite->setCurrentLayer(layer);
|
||||
update_screen_for_sprite(sprite);
|
||||
dirty(); // Redraw the status-bar
|
||||
if (layer) {
|
||||
// Set the current layer
|
||||
if (layer != sprite->getCurrentLayer())
|
||||
sprite->setCurrentLayer(layer);
|
||||
|
||||
// Flash the current layer
|
||||
assert(current_editor != NULL); // Cannot be null when we have a current sprite
|
||||
current_editor->flashCurrentLayer();
|
||||
|
||||
// Redraw the status-bar
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user