diff --git a/buttons.c b/buttons.c index 308748ec..88fd9a7b 100644 --- a/buttons.c +++ b/buttons.c @@ -1488,7 +1488,7 @@ void Button_Copy_page(void) Copy_image_only(); if (clicked_button==5) - Remap_picture(); + Remap_spare(); if (clicked_button!=2) // copie de la palette memcpy(Spare_palette,Main_palette,sizeof(T_Palette)); diff --git a/engine.c b/engine.c index ea2b2aec..80a49c94 100644 --- a/engine.c +++ b/engine.c @@ -481,6 +481,7 @@ void Main_handler(void) byte temp; byte effect_modified; byte action; + dword key_pressed; do { @@ -499,6 +500,12 @@ void Main_handler(void) if(Get_input()) { action = 0; + + // Inhibit all keys if a drawing operation is in progress. + // We make an exception for the freehand operations, but these will + // only accept a very limited number of shortcuts. + if (Operation_stack_size!=0 && !Allow_color_change_during_operation) + Key=0; // Evenement de fermeture if (Quit_is_required) @@ -507,7 +514,6 @@ void Main_handler(void) Button_Quit(); } - // Gestion des touches if (Key) { effect_modified = 0; @@ -518,6 +524,54 @@ void Main_handler(void) { // Special keys (functions not hooked to a UI button) switch(key_index) + { + case SPECIAL_NEXT_FORECOLOR : // Next foreground color + Special_next_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color + Special_previous_forecolor(); + action++; + break; + case SPECIAL_NEXT_BACKCOLOR : // Next background color + Special_next_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color + Special_previous_backcolor(); + action++; + break; + case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau + Smaller_paintbrush(); + action++; + break; + case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau + Bigger_paintbrush(); + action++; + break; + case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color + Special_next_user_forecolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color + Special_previous_user_forecolor(); + action++; + break; + case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color + Special_next_user_backcolor(); + action++; + break; + case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color + Special_previous_user_backcolor(); + action++; + break; + } + + // Other shortcuts are forbidden while an operation is in progress + if (Operation_stack_size!=0) + continue; + + switch (key_index) { case SPECIAL_SCROLL_UP : // Scroll up if (Main_magnifier_mode) @@ -603,46 +657,6 @@ void Main_handler(void) Scroll_screen(1,0); action++; break; - case SPECIAL_NEXT_FORECOLOR : // Next foreground color - Special_next_forecolor(); - action++; - break; - case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color - Special_previous_forecolor(); - action++; - break; - case SPECIAL_NEXT_BACKCOLOR : // Next background color - Special_next_backcolor(); - action++; - break; - case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color - Special_previous_backcolor(); - action++; - break; - case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau - Smaller_paintbrush(); - action++; - break; - case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau - Bigger_paintbrush(); - action++; - break; - case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color - Special_next_user_forecolor(); - action++; - break; - case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color - Special_previous_user_forecolor(); - action++; - break; - case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color - Special_next_user_backcolor(); - action++; - break; - case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color - Special_previous_user_backcolor(); - action++; - break; case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor Hide_cursor(); Cursor_hidden=!Cursor_hidden; @@ -1000,20 +1014,28 @@ void Main_handler(void) } } // End of special keys - // Shortcut for functions of Menu buttons - for (button_index=0;button_index