mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-15 19:52:05 +00:00
Now Shift+V works correctly when we are moving pixels.
This commit is contained in:
parent
a27d1d3eeb
commit
2e87676d70
@ -181,7 +181,8 @@ void PreviewCommand::onExecute(Context* context)
|
|||||||
if (keypressed()) {
|
if (keypressed()) {
|
||||||
int readkey_value = readkey();
|
int readkey_value = readkey();
|
||||||
Message* msg = jmessage_new_key_related(JM_KEYPRESSED, readkey_value);
|
Message* msg = jmessage_new_key_related(JM_KEYPRESSED, readkey_value);
|
||||||
Command* command = get_command_from_key_message(msg);
|
Command* command = NULL;
|
||||||
|
get_command_from_key_message(msg, &command, NULL);
|
||||||
jmessage_free(msg);
|
jmessage_free(msg);
|
||||||
|
|
||||||
// Change frame
|
// Change frame
|
||||||
|
@ -698,7 +698,9 @@ bool AnimationEditor::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_KEYPRESSED: {
|
case JM_KEYPRESSED: {
|
||||||
Command *command = get_command_from_key_message(msg);
|
Command* command = NULL;
|
||||||
|
Params* params = NULL;
|
||||||
|
get_command_from_key_message(msg, &command, ¶ms);
|
||||||
|
|
||||||
// Close animation editor.
|
// Close animation editor.
|
||||||
if ((command && (strcmp(command->short_name(), CommandId::FilmEditor) == 0)) ||
|
if ((command && (strcmp(command->short_name(), CommandId::FilmEditor) == 0)) ||
|
||||||
@ -757,7 +759,7 @@ bool AnimationEditor::onProcessMessage(Message* msg)
|
|||||||
strcmp(command->short_name(), CommandId::GotoNextLayer) == 0 ||
|
strcmp(command->short_name(), CommandId::GotoNextLayer) == 0 ||
|
||||||
strcmp(command->short_name(), CommandId::GotoLastFrame) == 0) {
|
strcmp(command->short_name(), CommandId::GotoLastFrame) == 0) {
|
||||||
// execute the command
|
// execute the command
|
||||||
UIContext::instance()->executeCommand(command);
|
UIContext::instance()->executeCommand(command, params);
|
||||||
|
|
||||||
showCurrentCel();
|
showCurrentCel();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -905,20 +905,19 @@ JAccel add_keyboard_shortcut_to_spriteeditor(const char* shortcut_string, const
|
|||||||
return shortcut->accel;
|
return shortcut->accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* get_command_from_key_message(Message* msg)
|
bool get_command_from_key_message(Message* msg, Command** command, Params** params)
|
||||||
{
|
{
|
||||||
for (std::vector<Shortcut*>::iterator
|
for (std::vector<Shortcut*>::iterator
|
||||||
it = shortcuts->begin(); it != shortcuts->end(); ++it) {
|
it = shortcuts->begin(); it != shortcuts->end(); ++it) {
|
||||||
Shortcut* shortcut = *it;
|
Shortcut* shortcut = *it;
|
||||||
|
|
||||||
if (shortcut->type == Shortcut_ExecuteCommand &&
|
if (shortcut->type == Shortcut_ExecuteCommand && shortcut->is_pressed(msg)) {
|
||||||
// TODO why?
|
if (command) *command = shortcut->command;
|
||||||
// shortcut->argument.empty() &&
|
if (params) *params = shortcut->params;
|
||||||
shortcut->is_pressed(msg)) {
|
return true;
|
||||||
return shortcut->command;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JAccel get_accel_to_execute_command(const char* command_name, Params* params)
|
JAccel get_accel_to_execute_command(const char* command_name, Params* params)
|
||||||
|
@ -113,7 +113,7 @@ JAccel add_keyboard_shortcut_to_change_tool(const char* shortcut, tools::Tool* t
|
|||||||
JAccel add_keyboard_shortcut_to_quicktool(const char* shortcut, tools::Tool* tool);
|
JAccel add_keyboard_shortcut_to_quicktool(const char* shortcut, tools::Tool* tool);
|
||||||
JAccel add_keyboard_shortcut_to_spriteeditor(const char* shortcut, const char* action_name);
|
JAccel add_keyboard_shortcut_to_spriteeditor(const char* shortcut, const char* action_name);
|
||||||
|
|
||||||
Command* get_command_from_key_message(Message* msg);
|
bool get_command_from_key_message(Message* msg, Command** command, Params** params);
|
||||||
JAccel get_accel_to_execute_command(const char* command, Params* params = NULL);
|
JAccel get_accel_to_execute_command(const char* command, Params* params = NULL);
|
||||||
JAccel get_accel_to_change_tool(tools::Tool* tool);
|
JAccel get_accel_to_change_tool(tools::Tool* tool);
|
||||||
JAccel get_accel_to_copy_selection();
|
JAccel get_accel_to_copy_selection();
|
||||||
|
@ -314,12 +314,13 @@ bool MovingPixelsState::onKeyDown(Editor* editor, Message* msg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Command* cmd = get_command_from_key_message(msg);
|
Command* command = NULL;
|
||||||
if (cmd) {
|
Params* params = NULL;
|
||||||
|
if (get_command_from_key_message(msg, &command, ¶ms)) {
|
||||||
// Intercept the "Cut" or "Copy" command to handle them locally
|
// Intercept the "Cut" or "Copy" command to handle them locally
|
||||||
// with the current m_pixelsMovement data.
|
// with the current m_pixelsMovement data.
|
||||||
if (strcmp(cmd->short_name(), CommandId::Cut) == 0 ||
|
if (strcmp(command->short_name(), CommandId::Cut) == 0 ||
|
||||||
strcmp(cmd->short_name(), CommandId::Copy) == 0) {
|
strcmp(command->short_name(), CommandId::Copy) == 0) {
|
||||||
// Copy the floating image to the clipboard.
|
// Copy the floating image to the clipboard.
|
||||||
{
|
{
|
||||||
Document* document = editor->getDocument();
|
Document* document = editor->getDocument();
|
||||||
@ -331,7 +332,7 @@ bool MovingPixelsState::onKeyDown(Editor* editor, Message* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In case of "Cut" command.
|
// In case of "Cut" command.
|
||||||
if (strcmp(cmd->short_name(), CommandId::Cut) == 0) {
|
if (strcmp(command->short_name(), CommandId::Cut) == 0) {
|
||||||
// Discard the dragged image.
|
// Discard the dragged image.
|
||||||
m_pixelsMovement->discardImage();
|
m_pixelsMovement->discardImage();
|
||||||
m_discarded = true;
|
m_discarded = true;
|
||||||
@ -345,8 +346,9 @@ bool MovingPixelsState::onKeyDown(Editor* editor, Message* msg)
|
|||||||
}
|
}
|
||||||
// Flip Horizontally/Vertically commands are handled manually to
|
// Flip Horizontally/Vertically commands are handled manually to
|
||||||
// avoid dropping the floating region of pixels.
|
// avoid dropping the floating region of pixels.
|
||||||
else if (strcmp(cmd->short_name(), CommandId::Flip) == 0) {
|
else if (strcmp(command->short_name(), CommandId::Flip) == 0) {
|
||||||
if (FlipCommand* flipCommand = dynamic_cast<FlipCommand*>(cmd)) {
|
if (FlipCommand* flipCommand = dynamic_cast<FlipCommand*>(command)) {
|
||||||
|
flipCommand->loadParams(params);
|
||||||
m_pixelsMovement->flipImage(flipCommand->getFlipType());
|
m_pixelsMovement->flipImage(flipCommand->getFlipType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user