diff --git a/buttons.c b/buttons.c index 1b58324a..1483c785 100644 --- a/buttons.c +++ b/buttons.c @@ -3544,7 +3544,6 @@ void Button_Smear_mode(void) Smear_mode=!Smear_mode; } - // -- Mode Colorize --------------------------------------------------------- void Compute_colorize_table(void) { @@ -3792,6 +3791,76 @@ void Button_Tiling_menu(void) Display_cursor(); } +// -- All modes off --------------------------------------------------------- +void Effects_off(void) +{ + Effect_function=No_effect; + Shade_mode=0; + Quick_shade_mode=0; + Colorize_mode=0; + Smooth_mode=0; + Tiling_mode=0; + Smear_mode=0; + Stencil_mode=0; + Mask_mode=0; + Sieve_mode=0; + Snap_mode=0; + + if (! Windows_open) + { + + } +} + +void Transparency_set(byte amount) +{ + const int doubleclick_delay = 500; + static long time_click = 0; + long time_previous; + + if (!Colorize_mode) + { + // Activate mode + switch(Colorize_current_mode) + { + case 0 : + Effect_function=Effect_interpolated_colorize; + break; + case 1 : + Effect_function=Effect_additive_colorize; + break; + case 2 : + Effect_function=Effect_substractive_colorize; + } + Shade_mode=0; + Quick_shade_mode=0; + Smooth_mode=0; + Tiling_mode=0; + + Colorize_mode=1; + } + + time_previous = time_click; + time_click = SDL_GetTicks(); + + // Check if it's a quick re-press + if (time_click - time_previous < doubleclick_delay) + { + // Use the typed amount as units, keep the tens. + Colorize_opacity = ((Colorize_opacity%100) /10 *10) + amount; + if (Colorize_opacity == 0) + Colorize_opacity = 100; + } + else + { + // Use 10% units: "1"=10%, ... "0"=100% + if (amount == 0) + Colorize_opacity = 100; + else + Colorize_opacity = amount*10; + } + Compute_colorize_table(); +} //---------------------------- Courbes de Bézier ---------------------------- @@ -4970,17 +5039,7 @@ void Button_Effects(void) exit_by_close_button=1; break; case 12 : // All off - Effect_function=No_effect; - Shade_mode=0; - Quick_shade_mode=0; - Colorize_mode=0; - Smooth_mode=0; - Tiling_mode=0; - Smear_mode=0; - Stencil_mode=0; - Mask_mode=0; - Sieve_mode=0; - Snap_mode=0; + Effects_off(); Hide_cursor(); Display_effect_states(); Display_cursor(); diff --git a/buttons.h b/buttons.h index 68542809..8b87fc9b 100644 --- a/buttons.h +++ b/buttons.h @@ -425,6 +425,17 @@ void Button_Tiling_mode(void); Displays the tiling setup menu. */ void Button_Tiling_menu(void); + +/*! + Callback for the command that turns off all drawaing effects. +*/ +void Effects_off(void); + +/*! + Command that sets the transparency level. +*/ +void Transparency_set(byte amount); + // Menu des effets /*! diff --git a/const.h b/const.h index b3716712..64c7dc6b 100644 --- a/const.h +++ b/const.h @@ -33,7 +33,7 @@ #define BETA1 98 ///< Version number for gfx2.cfg (3/4) #define BETA2 0 ///< Version number for gfx2.cfg (4/4) #define MAX_VIDEO_MODES 100 ///< Maximum number of video modes Grafx2 can propose. -#define NB_SHORTCUTS 134 ///< Number of actions that can have a key combination associated to it. +#define NB_SHORTCUTS 145 ///< Number of actions that can have a key combination associated to it. #define NB_ZOOM_FACTORS 12 ///< Number of zoom levels available in the magnifier. #define MENU_WIDTH 254 ///< Width of the menu (not counting the palette) #define MENU_HEIGHT 44 ///< Height of the menu. @@ -374,7 +374,18 @@ enum SPECIAL_ACTIONS SPECIAL_SMOOTH_MODE, SPECIAL_SMOOTH_MENU, SPECIAL_SMEAR_MODE, + SPECIAL_EFFECTS_OFF, SPECIAL_TILING_MODE, + SPECIAL_TRANSPARENCY_1, + SPECIAL_TRANSPARENCY_2, + SPECIAL_TRANSPARENCY_3, + SPECIAL_TRANSPARENCY_4, + SPECIAL_TRANSPARENCY_5, + SPECIAL_TRANSPARENCY_6, + SPECIAL_TRANSPARENCY_7, + SPECIAL_TRANSPARENCY_8, + SPECIAL_TRANSPARENCY_9, + SPECIAL_TRANSPARENCY_0, SPECIAL_TILING_MENU, ///< This must be the last of the "effects" family NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts }; diff --git a/engine.c b/engine.c index 24c71e0e..70e31fa3 100644 --- a/engine.c +++ b/engine.c @@ -857,6 +857,50 @@ void Main_handler(void) Button_Tiling_menu(); Key=0; break; + case SPECIAL_EFFECTS_OFF : + Effects_off(); + Key=0; + break; + case SPECIAL_TRANSPARENCY_1 : + Transparency_set(1); + Key=0; + break; + case SPECIAL_TRANSPARENCY_2 : + Transparency_set(2); + Key=0; + break; + case SPECIAL_TRANSPARENCY_3 : + Transparency_set(3); + Key=0; + break; + case SPECIAL_TRANSPARENCY_4 : + Transparency_set(4); + Key=0; + break; + case SPECIAL_TRANSPARENCY_5 : + Transparency_set(5); + Key=0; + break; + case SPECIAL_TRANSPARENCY_6 : + Transparency_set(6); + Key=0; + break; + case SPECIAL_TRANSPARENCY_7 : + Transparency_set(7); + Key=0; + break; + case SPECIAL_TRANSPARENCY_8 : + Transparency_set(8); + Key=0; + break; + case SPECIAL_TRANSPARENCY_9 : + Transparency_set(9); + Key=0; + break; + case SPECIAL_TRANSPARENCY_0 : + Transparency_set(0); + Key=0; + break; default : // Gestion des touches de raccourci de bouton: // Pour chaque bouton shortcut_button=-1; diff --git a/help.c b/help.c index 817e1cf0..456f4619 100644 --- a/help.c +++ b/help.c @@ -119,7 +119,7 @@ void Window_set_shortcut(int action_id) while (Ordering[order_index]!=action_id) { order_index++; - if (order_index>=134) + if (order_index>=NB_SHORTCUTS) { Error(0); return; @@ -130,7 +130,7 @@ void Window_set_shortcut(int action_id) while (ConfigKey[config_index].Number!=order_index) { config_index++; - if (config_index>=134) + if (config_index>=NB_SHORTCUTS) { Error(0); return; diff --git a/helpfile.h b/helpfile.h index 4b7c4539..354cf234 100644 --- a/helpfile.h +++ b/helpfile.h @@ -159,6 +159,7 @@ static const T_Help_table helptable_help[] = HELP_LINK ("Adjust picture: %s", 0x100+BUTTON_ADJUST) HELP_LINK ("Flip picture menu: %s", 0x200+BUTTON_ADJUST) HELP_LINK ("Effects menu: %s", 0x100+BUTTON_EFFECTS) + HELP_LINK ("Effects all off %s", SPECIAL_EFFECTS_OFF) HELP_LINK ("Shade mode: %s", SPECIAL_SHADE_MODE) HELP_LINK ("Shade menu: %s", SPECIAL_SHADE_MENU) HELP_LINK ("Quick-shade mode: %s", SPECIAL_QUICK_SHADE_MODE) @@ -173,6 +174,16 @@ static const T_Help_table helptable_help[] = HELP_LINK ("Sieve menu: %s", SPECIAL_SIEVE_MENU) HELP_LINK ("Invert Sieve: %s", SPECIAL_INVERT_SIEVE) HELP_LINK ("Colorize mode: %s", SPECIAL_COLORIZE_MODE) + HELP_LINK (" At opacity 10%%: %s", SPECIAL_TRANSPARENCY_1) + HELP_LINK (" At opacity 20%%: %s", SPECIAL_TRANSPARENCY_2) + HELP_LINK (" At opacity 30%%: %s", SPECIAL_TRANSPARENCY_3) + HELP_LINK (" At opacity 40%%: %s", SPECIAL_TRANSPARENCY_4) + HELP_LINK (" At opacity 50%%: %s", SPECIAL_TRANSPARENCY_5) + HELP_LINK (" At opacity 60%%: %s", SPECIAL_TRANSPARENCY_6) + HELP_LINK (" At opacity 70%%: %s", SPECIAL_TRANSPARENCY_7) + HELP_LINK (" At opacity 80%%: %s", SPECIAL_TRANSPARENCY_8) + HELP_LINK (" At opacity 90%%: %s", SPECIAL_TRANSPARENCY_9) + HELP_LINK (" At opacity 100%%: %s", SPECIAL_TRANSPARENCY_0) HELP_LINK ("Colorize menu: %s", SPECIAL_COLORIZE_MENU) HELP_LINK ("Smooth mode: %s", SPECIAL_SMOOTH_MODE) HELP_LINK ("Smooth menu: %s", SPECIAL_SMOOTH_MENU) diff --git a/hotkeys.c b/hotkeys.c index 8d29852c..c6a12d5e 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -1094,6 +1094,94 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { true, SDLK_PERIOD, // .> (:/ en AZERTY) 0}, + {134, + "Effects off", + "Turns off all drawing effects. This", + "is the same as the 'All off' button", + "in the Effects screen", + true, + SDLK_e|MOD_SHIFT, // Shift-E + 0}, + {135, + "Transparency 10%", + "Turns transparency on and sets its", + "opacity at 10%.", + "", + true, + SDLK_1, // 1 + 0}, + {136, + "Transparency 20%", + "Turns transparency on and sets its", + "opacity at 20%.", + "", + true, + SDLK_1, // 1 + 0}, + {137, + "Transparency 30%", + "Turns transparency on and sets its", + "opacity at 30%.", + "", + true, + SDLK_1, // 1 + 0}, + {138, + "Transparency 40%", + "Turns transparency on and sets its", + "opacity at 40%.", + "", + true, + SDLK_1, // 1 + 0}, + {139, + "Transparency 50%", + "Turns transparency on and sets its", + "opacity at 50%.", + "", + true, + SDLK_1, // 1 + 0}, + {140, + "Transparency 60%", + "Turns transparency on and sets its", + "opacity at 60%.", + "", + true, + SDLK_1, // 1 + 0}, + {141, + "Transparency 70%", + "Turns transparency on and sets its", + "opacity at 70%.", + "", + true, + SDLK_1, // 1 + 0}, + {142, + "Transparency 80%", + "Turns transparency on and sets its", + "opacity at 80%.", + "", + true, + SDLK_1, // 1 + 0}, + {143, + "Transparency 90%", + "Turns transparency on and sets its", + "opacity at 90%.", + "", + true, + SDLK_1, // 1 + 0}, + {144, + "Transparency 0%", + "Turns transparency on and sets its", + "opacity at 0%.", + "", + true, + SDLK_1, // 1 + 0}, }; word Ordering[NB_SHORTCUTS]= @@ -1116,39 +1204,39 @@ word Ordering[NB_SHORTCUTS]= SPECIAL_MOUSE_RIGHT, // Emulate mouse right SPECIAL_CLICK_LEFT, // Emulate mouse click left SPECIAL_CLICK_RIGHT, // Emulate mouse click right - 0x100+BUTTON_HIDE, // Show / Hide menu + 0x100+BUTTON_HIDE, // Show / Hide menu SPECIAL_SHOW_HIDE_CURSOR, // Show / Hide cursor - SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "." - 0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice - 0x200+BUTTON_PAINTBRUSHES, // Monochrome brush - 0x100+BUTTON_DRAW, // Freehand drawing - 0x200+BUTTON_DRAW, // Switch freehand drawing mode - SPECIAL_CONTINUOUS_DRAW, // Continuous freehand drawing - 0x100+BUTTON_LINES, // Line - 0x200+BUTTON_LINES, // Knotted lines - 0x100+BUTTON_AIRBRUSH, // Spray - 0x200+BUTTON_AIRBRUSH, // Spray menu + SPECIAL_DOT_PAINTBRUSH, // Paintbrush = "." + 0x100+BUTTON_PAINTBRUSHES, // Paintbrush choice + 0x200+BUTTON_PAINTBRUSHES, // Monochrome brush + 0x100+BUTTON_DRAW, // Freehand drawing + 0x200+BUTTON_DRAW, // Switch freehand drawing mode + SPECIAL_CONTINUOUS_DRAW, // Continuous freehand drawing + 0x100+BUTTON_LINES, // Line + 0x200+BUTTON_LINES, // Knotted lines + 0x100+BUTTON_AIRBRUSH, // Spray + 0x200+BUTTON_AIRBRUSH, // Spray menu 0x100+BUTTON_FLOODFILL, // Floodfill 0x200+BUTTON_FLOODFILL, // Replace color - 0x100+BUTTON_CURVES, // Bézier's curves - 0x200+BUTTON_CURVES, // Bézier's curve with 3 or 4 points + 0x100+BUTTON_CURVES, // Bézier's curves + 0x200+BUTTON_CURVES, // Bézier's curve with 3 or 4 points 0x100+BUTTON_RECTANGLES, // Empty rectangle 0x100+BUTTON_FILLRECT, // Filled rectangle 0x100+BUTTON_CIRCLES, // Empty circle 0x200+BUTTON_CIRCLES, // Empty ellipse 0x100+BUTTON_FILLCIRC, // Filled circle 0x200+BUTTON_FILLCIRC, // Filled ellipse - 0x100+BUTTON_POLYGONS, // Empty polygon - 0x200+BUTTON_POLYGONS, // Empty polyform + 0x100+BUTTON_POLYGONS, // Empty polygon + 0x200+BUTTON_POLYGONS, // Empty polyform 0x100+BUTTON_POLYFILL, // Polyfill 0x200+BUTTON_POLYFILL, // Filled polyform 0x100+BUTTON_GRADRECT, // Gradient rectangle 0x100+BUTTON_GRADMENU, // Gradation menu 0x100+BUTTON_SPHERES, // Spheres 0x200+BUTTON_SPHERES, // Gradient ellipses - 0x100+BUTTON_ADJUST, // Adjust picture - 0x200+BUTTON_ADJUST, // Flip picture menu - 0x100+BUTTON_EFFECTS, // Menu des effets + 0x100+BUTTON_ADJUST, // Adjust picture + 0x200+BUTTON_ADJUST, // Flip picture menu + 0x100+BUTTON_EFFECTS, // Menu des effets SPECIAL_SHADE_MODE, // Shade mode SPECIAL_SHADE_MENU, // Shade menu SPECIAL_QUICK_SHADE_MODE, // Quick-shade mode @@ -1169,9 +1257,9 @@ word Ordering[NB_SHORTCUTS]= SPECIAL_SMEAR_MODE, // Smear mode SPECIAL_TILING_MODE, // Tiling mode SPECIAL_TILING_MENU, // Tiling menu - 0x100+BUTTON_BRUSH, // Pick brush - 0x100+BUTTON_POLYBRUSH, // Pick polyform brush - 0x200+BUTTON_BRUSH, // Restore brush + 0x100+BUTTON_BRUSH, // Pick brush + 0x100+BUTTON_POLYBRUSH, // Pick polyform brush + 0x200+BUTTON_BRUSH, // Restore brush SPECIAL_FLIP_X, // Flip X SPECIAL_FLIP_Y, // Flip Y SPECIAL_ROTATE_90, // 90° brush rotation @@ -1183,27 +1271,27 @@ word Ordering[NB_SHORTCUTS]= SPECIAL_GET_BRUSH_COLORS, // Get colors from brush SPECIAL_RECOLORIZE_BRUSH, // Recolorize brush SPECIAL_ROTATE_ANY_ANGLE, // Rotate brush by any angle - 0x100+BUTTON_COLORPICKER, // Pipette - 0x200+BUTTON_COLORPICKER, // Swap fore/back color - 0x100+BUTTON_MAGNIFIER, // Magnifier mode - 0x200+BUTTON_MAGNIFIER, // Zoom factor menu + 0x100+BUTTON_COLORPICKER, // Pipette + 0x200+BUTTON_COLORPICKER, // Swap fore/back color + 0x100+BUTTON_MAGNIFIER, // Magnifier mode + 0x200+BUTTON_MAGNIFIER, // Zoom factor menu SPECIAL_ZOOM_IN, // Zoom in SPECIAL_ZOOM_OUT, // Zoom out 0x100+BUTTON_BRUSH_EFFECTS, // Brush effects menu - 0x100+BUTTON_TEXT, // Text + 0x100+BUTTON_TEXT, // Text 0x100+BUTTON_RESOL, // Resolution menu 0x200+BUTTON_RESOL, // Safety resolution 0x100+BUTTON_HELP, // Help & credits 0x200+BUTTON_HELP, // Statistics 0x100+BUTTON_PAGE, // Go to spare page 0x200+BUTTON_PAGE, // Copy to spare page - 0x100+BUTTON_SAVE, // Save as - 0x200+BUTTON_SAVE, // Save - 0x100+BUTTON_LOAD, // Load - 0x200+BUTTON_LOAD, // Re-load + 0x100+BUTTON_SAVE, // Save as + 0x200+BUTTON_SAVE, // Save + 0x100+BUTTON_LOAD, // Load + 0x200+BUTTON_LOAD, // Re-load SPECIAL_SAVE_BRUSH, // Save brush SPECIAL_LOAD_BRUSH, // Load brush - 0x100+BUTTON_SETTINGS, // Settings + 0x100+BUTTON_SETTINGS, // Settings 0x100+BUTTON_UNDO, // Undo 0x200+BUTTON_UNDO, // Redo 0x100+BUTTON_KILL, // Kill @@ -1230,6 +1318,17 @@ word Ordering[NB_SHORTCUTS]= SPECIAL_PREVIOUS_USER_FORECOLOR, // Previous user-defined foreground color SPECIAL_NEXT_USER_BACKCOLOR, // Next user-defined background color SPECIAL_PREVIOUS_USER_BACKCOLOR, // Previous user-defined background color - SPECIAL_SMALLER_PAINTBRUSH, // Rétrécir le pinceau - SPECIAL_BIGGER_PAINTBRUSH // Grossir le pinceau + SPECIAL_SMALLER_PAINTBRUSH, // Sets paintbrush size: smaller + SPECIAL_BIGGER_PAINTBRUSH, // Sets paintbrush size: bigger + SPECIAL_EFFECTS_OFF, // Turns off all effects + SPECIAL_TRANSPARENCY_1, // Sets transparency level 10% + SPECIAL_TRANSPARENCY_2, // Sets transparency level 20% + SPECIAL_TRANSPARENCY_3, // Sets transparency level 30% + SPECIAL_TRANSPARENCY_4, // Sets transparency level 40% + SPECIAL_TRANSPARENCY_5, // Sets transparency level 50% + SPECIAL_TRANSPARENCY_6, // Sets transparency level 60% + SPECIAL_TRANSPARENCY_7, // Sets transparency level 70% + SPECIAL_TRANSPARENCY_8, // Sets transparency level 80% + SPECIAL_TRANSPARENCY_9, // Sets transparency level 90% + SPECIAL_TRANSPARENCY_0, // Sets transparency level 00% };