Patch by Magnus Bergman to allow setting zoom level with keyboard shortcuts.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@971 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
7a8cea5af6
commit
951096eb86
15
const.h
15
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 145 ///< Number of actions that can have a key combination associated to it.
|
||||
#define NB_SHORTCUTS 158 ///< 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.
|
||||
@ -387,6 +387,19 @@ enum SPECIAL_ACTIONS
|
||||
SPECIAL_TRANSPARENCY_9,
|
||||
SPECIAL_TRANSPARENCY_0,
|
||||
SPECIAL_TILING_MENU, ///< This must be the last of the "effects" family
|
||||
SPECIAL_ZOOM_1,
|
||||
SPECIAL_ZOOM_2,
|
||||
SPECIAL_ZOOM_3,
|
||||
SPECIAL_ZOOM_4,
|
||||
SPECIAL_ZOOM_5,
|
||||
SPECIAL_ZOOM_6,
|
||||
SPECIAL_ZOOM_8,
|
||||
SPECIAL_ZOOM_10,
|
||||
SPECIAL_ZOOM_12,
|
||||
SPECIAL_ZOOM_14,
|
||||
SPECIAL_ZOOM_16,
|
||||
SPECIAL_ZOOM_18,
|
||||
SPECIAL_ZOOM_20,
|
||||
NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts
|
||||
};
|
||||
|
||||
|
||||
52
engine.c
52
engine.c
@ -905,6 +905,58 @@ void Main_handler(void)
|
||||
Transparency_set(0);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_1 :
|
||||
Zoom_set(-1);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_2 :
|
||||
Zoom_set(0);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_3 :
|
||||
Zoom_set(1);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_4 :
|
||||
Zoom_set(2);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_5 :
|
||||
Zoom_set(3);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_6 :
|
||||
Zoom_set(4);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_8 :
|
||||
Zoom_set(5);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_10 :
|
||||
Zoom_set(6);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_12 :
|
||||
Zoom_set(7);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_14 :
|
||||
Zoom_set(8);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_16 :
|
||||
Zoom_set(9);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_18 :
|
||||
Zoom_set(10);
|
||||
Key=0;
|
||||
break;
|
||||
case SPECIAL_ZOOM_20 :
|
||||
Zoom_set(11);
|
||||
Key=0;
|
||||
break;
|
||||
default : // Gestion des touches de raccourci de bouton:
|
||||
// Pour chaque bouton
|
||||
shortcut_button=-1;
|
||||
|
||||
16
helpfile.h
16
helpfile.h
@ -206,10 +206,24 @@ static const T_Help_table helptable_help[] =
|
||||
HELP_LINK ("Rotate brush: %s", SPECIAL_ROTATE_ANY_ANGLE)
|
||||
HELP_LINK ("Pipette: %s", 0x100+BUTTON_COLORPICKER)
|
||||
HELP_LINK ("Swap fore/back color:%s", 0x200+BUTTON_COLORPICKER)
|
||||
HELP_LINK ("Magnifier mode: %s", 0x100+BUTTON_MAGNIFIER)
|
||||
HELP_TEXT ("Magnifier mode")
|
||||
HELP_LINK (" Toggle: %s", 0x100+BUTTON_MAGNIFIER)
|
||||
HELP_LINK (" Zoom factor menu: %s", 0x200+BUTTON_MAGNIFIER)
|
||||
HELP_LINK (" Zoom in: %s", SPECIAL_ZOOM_IN)
|
||||
HELP_LINK (" Zoom out: %s", SPECIAL_ZOOM_OUT)
|
||||
HELP_LINK (" 1:1 (off) %s", SPECIAL_ZOOM_1)
|
||||
HELP_LINK (" 2:1 %s", SPECIAL_ZOOM_2)
|
||||
HELP_LINK (" 3:1 %s", SPECIAL_ZOOM_3)
|
||||
HELP_LINK (" 4:1 %s", SPECIAL_ZOOM_4)
|
||||
HELP_LINK (" 5:1 %s", SPECIAL_ZOOM_5)
|
||||
HELP_LINK (" 6:1 %s", SPECIAL_ZOOM_6)
|
||||
HELP_LINK (" 8:1 %s", SPECIAL_ZOOM_8)
|
||||
HELP_LINK (" 10:1 %s", SPECIAL_ZOOM_10)
|
||||
HELP_LINK (" 12:1 %s", SPECIAL_ZOOM_12)
|
||||
HELP_LINK (" 14:1 %s", SPECIAL_ZOOM_14)
|
||||
HELP_LINK (" 16:1 %s", SPECIAL_ZOOM_16)
|
||||
HELP_LINK (" 18:1 %s", SPECIAL_ZOOM_18)
|
||||
HELP_LINK (" 20:1 %s", SPECIAL_ZOOM_20)
|
||||
HELP_LINK ("Brush effects menu: %s", 0x100+BUTTON_BRUSH_EFFECTS)
|
||||
HELP_LINK ("Text: %s", 0x100+BUTTON_TEXT)
|
||||
HELP_LINK ("Resolution menu: %s", 0x100+BUTTON_RESOL)
|
||||
|
||||
117
hotkeys.c
117
hotkeys.c
@ -1182,6 +1182,110 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
|
||||
true,
|
||||
SDLK_0, // 0
|
||||
0},
|
||||
{145,
|
||||
"Zoom 1:1",
|
||||
"Turs magnifier mode off.",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
SDLK_1|MOD_CTRL, /* Ctrl + 1 */
|
||||
0},
|
||||
{146,
|
||||
"Zoom 2:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 2:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_2|MOD_CTRL, /* Ctrl + 2 */
|
||||
0},
|
||||
{147,
|
||||
"Zoom 3:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 3:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_3|MOD_CTRL, /* Ctrl + 3 */
|
||||
0},
|
||||
{148,
|
||||
"Zoom 4:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 4:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_4|MOD_CTRL, /* Ctrl + 4 */
|
||||
0},
|
||||
{149,
|
||||
"Zoom 5:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 5:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_5|MOD_CTRL, /* Ctrl + 5 */
|
||||
0},
|
||||
{150,
|
||||
"Zoom 6:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 6:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_6|MOD_CTRL, /* Ctrl + 6 */
|
||||
0},
|
||||
{151,
|
||||
"Zoom 8:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 8:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_7|MOD_CTRL, /* Ctrl + 7 */
|
||||
0},
|
||||
{152,
|
||||
"Zoom 10:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 10:1",
|
||||
"",
|
||||
true,
|
||||
SDLK_8|MOD_CTRL, /* Ctrl + 8 */
|
||||
0},
|
||||
{153,
|
||||
"Zoom 12:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 12:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{154,
|
||||
"Zoom 14:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 14:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{155,
|
||||
"Zoom 16:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 16:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{156,
|
||||
"Zoom 18:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 18:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
{157,
|
||||
"Zoom 20:1",
|
||||
"Turs magnifier mode on and set its",
|
||||
"factor to 20:1",
|
||||
"",
|
||||
true,
|
||||
0,
|
||||
0},
|
||||
};
|
||||
|
||||
word Ordering[NB_SHORTCUTS]=
|
||||
@ -1331,4 +1435,17 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_TRANSPARENCY_8, // Sets transparency level 80%
|
||||
SPECIAL_TRANSPARENCY_9, // Sets transparency level 90%
|
||||
SPECIAL_TRANSPARENCY_0, // Sets transparency level 00%
|
||||
SPECIAL_ZOOM_1, /**< Sets zoom factor to 1:1 (no magnification) */
|
||||
SPECIAL_ZOOM_2, /**< Sets zoom factor to 2:1 */
|
||||
SPECIAL_ZOOM_3, /**< Sets zoom factor to 3:1 */
|
||||
SPECIAL_ZOOM_4, /**< Sets zoom factor to 4:1 */
|
||||
SPECIAL_ZOOM_5, /**< Sets zoom factor to 5:1 */
|
||||
SPECIAL_ZOOM_6, /**< Sets zoom factor to 6:1 */
|
||||
SPECIAL_ZOOM_8, /**< Sets zoom factor to 8:1 */
|
||||
SPECIAL_ZOOM_10, /**< Sets zoom factor to 10:1 */
|
||||
SPECIAL_ZOOM_12, /**< Sets zoom factor to 12:1 */
|
||||
SPECIAL_ZOOM_14, /**< Sets zoom factor to 14:1 */
|
||||
SPECIAL_ZOOM_16, /**< Sets zoom factor to 16:1 */
|
||||
SPECIAL_ZOOM_18, /**< Sets zoom factor to 18:1 */
|
||||
SPECIAL_ZOOM_20, /**< Sets zoom factor to 20:1 */
|
||||
};
|
||||
|
||||
22
special.c
22
special.c
@ -362,3 +362,25 @@ void Zoom(short delta)
|
||||
Display_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Set zoom value. Negative value means no zoom.
|
||||
*/
|
||||
void Zoom_set(int index)
|
||||
{
|
||||
Hide_cursor();
|
||||
if (index<0)
|
||||
{
|
||||
/* Zoom 1:1 */
|
||||
if (Main_magnifier_mode)
|
||||
Unselect_button(BUTTON_MAGNIFIER);
|
||||
}
|
||||
else
|
||||
{
|
||||
Change_magnifier_factor(index);
|
||||
if (!Main_magnifier_mode)
|
||||
Select_button(BUTTON_MAGNIFIER,1);
|
||||
Display_all_screen();
|
||||
}
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user