diff --git a/const.h b/const.h index f288368d..af384518 100644 --- a/const.h +++ b/const.h @@ -26,170 +26,170 @@ // Déclaration des constantes //////////////////////////////////////////////// -#define M_2PI 6.28318530717958647692528676656 +#define M_2PI 6.28318530717958647692528676656 ///< Hmm, pie... -#define PERCENTAGE_VERSION "99.0%" // Libellé du pourcentage de la version ß -#define VERSION1 2 // | -#define VERSION2 0 // |_ Numéro de version découpé en -#define BETA1 98 // | plusieurs parties => 2.0 ß95.5% -#define BETA2 0 // | (utilisé pour le fichier de config) -#define ALPHA_BETA "ß" // Type de la version "Þ" ou "ß" -#define MAX_VIDEO_MODES 100 // Nombre de modes vidéo maxi -#define NB_BUTTONS 38 // Nombre de boutons à gérer -#define NB_SHORTCUTS 134 // Nombre de combinaisons de touches -#define NB_SPECIAL_SHORTCUTS 72 // Nombre de touches spéciales -#define NB_OPERATIONS 33 // Nombre d'opérations gérées par le moteur -#define NB_ZOOM_FACTORS 12 // Nombre de facteurs de zoom -#define MENU_WIDTH 254 // Largeur du menu en taille réelle -#define MENU_HEIGHT 44 // Hauteur du menu en taille réelle -#define NB_CURSOR_SPRITES 8 // Nombre de sprites de curseur -#define CURSOR_SPRITE_WIDTH 15 // Largeur d'un sprite de curseur en pixels -#define CURSOR_SPRITE_HEIGHT 15 // Hauteur d'un sprite de curseur en pixels -#define NB_EFFECTS_SPRITES 9 // Nombre de sprites d'effets -#define NB_MENU_SPRITES 20 // Nombre de sprites de menu -#define MENU_SPRITE_WIDTH 14 // Largeur d'un sprite de menu en pixels -#define MENU_SPRITE_HEIGHT 14 // Hauteur d'un sprite de menu en pixels -#define PAINTBRUSH_WIDTH 16 // Largeur d'un sprite de pinceau prédéfini -#define PAINTBRUSH_HEIGHT 16 // Hauteur d'un sprite de pinceau prédéfini -#define MAX_PAINTBRUSH_SIZE 127 // Taille maxi des pinceaux -#define NB_ICON_SPRITES 7 // Nombre de sprites de drives -#define ICON_SPRITE_WIDTH 8 // Largeur d'un sprite de drive en pixels -#define ICON_SPRITE_HEIGHT 8 // Hauteur d'un sprite de drive en pixels -#define NB_PAINTBRUSH_SPRITES 48 // Nombre de sprites de pinceau -#define NB_PRESET_SIEVE 12 // Nombre de trames prédéfinies -#define OPERATION_STACK_SIZE 16 // Nombre maximum d'éléments utilisés par les opérations -#define MAX_DISPLAYABLE_PATH 37 // Taille maximum affichable du répertoire courant dans les fenêtres du fileselect -#define COMMENT_SIZE 32 // Taille maxi des commentaires pour le PKM -#define NB_MAX_PAGES_UNDO 99 // Nombre maximal de pages d'undo -#define DEFAULT_ZOOM_FACTOR 4 // Facteur de zoom initial -#define MAX_PATH_CHARACTERS 260 // Le nombre de caractères maxi pour un nom de fichier avec chemin complet -#define NB_BOOKMARKS 4 // Nombre de boutons "signet" dans l'ecran Save/Load -// Caractères présents dans les deux fontes +#define PERCENTAGE_VERSION "99.0%" ///< Version label, for display purpose +#define VERSION1 2 ///< Version number for gfx2.cfg (1/4) +#define VERSION2 0 ///< Version number for gfx2.cfg (2/4) +#define BETA1 98 ///< Version number for gfx2.cfg (3/4) +#define BETA2 0 ///< Version number for gfx2.cfg (4/4) +#define ALPHA_BETA "ß" ///< Status of Grafx2... +#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_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. +#define NB_CURSOR_SPRITES 8 ///< Number of available mouse cursor sprites. +#define CURSOR_SPRITE_WIDTH 15 ///< Width of a mouse cursor sprite. +#define CURSOR_SPRITE_HEIGHT 15 ///< Height of a mouse cursor sprite. +#define NB_EFFECTS_SPRITES 9 ///< Number of effect sprites. +#define NB_MENU_SPRITES 20 ///< Number of menu sprites. +#define MENU_SPRITE_WIDTH 14 ///< Width of a menu sprite in pixels +#define MENU_SPRITE_HEIGHT 14 ///< Height of a menu sprite in pixels +#define PAINTBRUSH_WIDTH 16 ///< Width of a preset paintbrush sprite +#define PAINTBRUSH_HEIGHT 16 ///< Height of a preset paintbrush sprite +#define MAX_PAINTBRUSH_SIZE 127 ///< Max size for a resizable paintbrush +#define ICON_SPRITE_WIDTH 8 ///< Width of an icon in pixels +#define ICON_SPRITE_HEIGHT 8 ///< Height of an icon in pixels +#define NB_PAINTBRUSH_SPRITES 48 ///< Number of preset paintbrushes +#define NB_PRESET_SIEVE 12 ///< Number of preset sieve patterns +#define OPERATION_STACK_SIZE 16 ///< Max number of parameters in the operation stack. +#define MAX_DISPLAYABLE_PATH 37 ///< Max number of characters to display directory name, in Save/Load screens. +#define COMMENT_SIZE 32 ///< Max number of characters for a comment in PKM or PNG file. +#define NB_MAX_PAGES_UNDO 99 ///< Max number of undo pages +#define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier. +#define MAX_PATH_CHARACTERS 260 ///< Number of characters for a file+complete path. Adapt to your OS... +#define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen. +// Character to show a right arrow, used when editing long strings. It's present in ::GFX_system_font #define RIGHT_TRIANGLE_CHARACTER 16 +// Character to show a left arrow, used when editing long strings. It's present in ::GFX_system_font #define LEFT_TRIANGLE_CHARACTER 17 +/// Character to display in menus for an ellipsis. #define ELLIPSIS_CHARACTER '…' -// On impose à l'allocation dynamique des pages de backups de conserver un -// minimum de 256 Ko pour que le reste du programme puisse continuer à -// fonctionner. +/// +/// We force the dynamic backup page allocation to leave a minimum of +/// 256Kb of free memory, to allow the rest of the program to work safely. +/// Note: This is a remainder of the DOS version. This system might not work +/// so well on other OSes, where the "available memory" changes due to external +/// factors. #define MINIMAL_MEMORY_TO_RESERVE (256*1024) -#define LEFT_SIDE 1 // Indique une direction (ou click) à gauche -#define RIGHT_SIDE 2 // Indique une direction (ou click) à droite +#define LEFT_SIDE 1 ///< Indicates a left side or left-click +#define RIGHT_SIDE 2 ///< Indicates a right side or right-click -#define SEPARATOR_WIDTH 6 // [ Û±±° ] -#define INITIAL_SEPARATOR_PROPORTION 0.3 // proportion de la zone non-zoomée en largeur par rapport à l'écran -#define NB_ZOOMED_PIXELS_MIN 4 // Nombre minimal de pixels zoomés en largeur (Note: En dessous de 4, on ne peut plus scroller!) +#define SEPARATOR_WIDTH 6 ///< Width of the separator between the normal and the zoomed view +#define INITIAL_SEPARATOR_PROPORTION 0.3 ///< Proportion of the normal view width, relative to the whole screen width. +#define NB_ZOOMED_PIXELS_MIN 4 ///< Minimal number of pixel shown (in width) by the zoomed view. (Note: below 4, you can't scroll!) #if defined(__MORPHOS__) || defined(__amigaos4__) || defined(__amigaos__) #define PARENT_DIR "/" #else + /// Filename that means "parent directory" for your operating system. #define PARENT_DIR ".." #endif - // Les différents formats de fichiers: +// -- File formats #ifndef __no_pnglib__ -#define NB_KNOWN_FORMATS 13 // Nombre de formats connus (devrait être la valeur maximale de NB_FORMATS_LOAD et NB_FORMATS_SAVE, mais plus généralement: Card({NB_FORMATS_LOAD} UNION {NB_FORMATS_SAVE})) -#define NB_FORMATS_LOAD 13 // Nombre de formats que l'on sait charger -#define NB_FORMATS_SAVE 13 // Nombre de formats que l'on sait sauver +#define NB_KNOWN_FORMATS 13 ///< Total number of known file formats. +#define NB_FORMATS_LOAD 13 ///< Number of file formats that grafx2 can load. +#define NB_FORMATS_SAVE 13 ///< Number of file formats that grafx2 can save. #else // Without pnglib -#define NB_KNOWN_FORMATS 12 // Nombre de formats connus (devrait être la valeur maximale de NB_FORMATS_LOAD et NB_FORMATS_SAVE, mais plus généralement: Card({NB_FORMATS_LOAD} UNION {NB_FORMATS_SAVE})) -#define NB_FORMATS_LOAD 12 // Nombre de formats que l'on sait charger -#define NB_FORMATS_SAVE 12 // Nombre de formats que l'on sait sauver +#define NB_KNOWN_FORMATS 12 ///< Total number of known file formats. +#define NB_FORMATS_LOAD 12 ///< Number of file formats that grafx2 can load. +#define NB_FORMATS_SAVE 12 ///< Number of file formats that grafx2 can save. #endif +/// List of file formats recognized by grafx2 enum FILE_FORMATS { - FORMAT_PKM=1, // | - FORMAT_LBM, // | - FORMAT_GIF, // | Il faudra penser à réordonner - FORMAT_BMP, // | les données sur les formats dans - FORMAT_PCX, // | GLOBAL.H si on modifie ces cons- - FORMAT_IMG, // |_ tantes. - FORMAT_SCx, // | - FORMAT_PI1, // | Elles représentent l'indice où - FORMAT_PC1, // | l'on doit aller piocher ces - FORMAT_CEL, // | données. - FORMAT_KCF, // | - FORMAT_PAL, // | - FORMAT_PNG // | + FORMAT_ANY=0, ///< This is not really a file format, it's reserverd for the "*.*" filter option. + FORMAT_PKM=1, + FORMAT_LBM, + FORMAT_GIF, + FORMAT_BMP, + FORMAT_PCX, + FORMAT_IMG, + FORMAT_SCx, + FORMAT_PI1, + FORMAT_PC1, + FORMAT_CEL, + FORMAT_KCF, + FORMAT_PAL, + FORMAT_PNG }; -#define DEFAULT_FILEFORMAT FORMAT_GIF // Format par défaut (ah bon? oh!) - - // Les différentes erreurs: +/// Default format for 'save as' +#define DEFAULT_FILEFORMAT FORMAT_GIF +/// Error codes for ::Error() enum ERROR_CODES { - // 0 = Red flash on screen, non-fatal error - ERROR_GUI_MISSING=1, // The graphics file is missing - ERROR_GUI_CORRUPTED, // The graphics file cannot be parsed for GUI elements - ERROR_INI_MISSING, // File gfx2def.ini is missing - ERROR_CFG_MISSING, // File gfx2.cfg is missing (non-fatal) - ERROR_CFG_CORRUPTED, // File gfx2.cfg couldn't be parsed (non-fatal) - ERROR_CFG_OLD, // Unknown version of gfx2.cfg : either VERY old or wrong file (non-fatal) - ERROR_MEMORY, // Out of memory - ERROR_COMMAND_LINE, // Error in command-line arguments (syntax, or couldn't find the file to open) - ERROR_FORBIDDEN_MODE, // Graphics mode requested is not supported - ERROR_SAVING_CFG, // Error while writing gfx2.cfg - ERROR_MISSING_DIRECTORY, // Unable to return to the original "current directory" on program exit - ERROR_INI_CORRUPTED, // File gfx2.ini couldn't be parsed - ERROR_SAVING_INI, // Error while writing gfx2.ini - ERROR_SORRY_SORRY_SORRY // (Page allocation error that shouldn't ever happen, now) + ERROR_WARNING=0, ///< Red flash on screen, non-fatal error + ERROR_GUI_MISSING, ///< The graphics file is missing + ERROR_GUI_CORRUPTED, ///< The graphics file cannot be parsed for GUI elements + ERROR_INI_MISSING, ///< File gfx2def.ini is missing + ERROR_CFG_MISSING, ///< File gfx2.cfg is missing (non-fatal) + ERROR_CFG_CORRUPTED, ///< File gfx2.cfg couldn't be parsed (non-fatal) + ERROR_CFG_OLD, ///< Unknown version of gfx2.cfg : either VERY old or wrong file (non-fatal) + ERROR_MEMORY, ///< Out of memory + ERROR_COMMAND_LINE, ///< Error in command-line arguments (syntax, or couldn't find the file to open) + ERROR_FORBIDDEN_MODE, ///< Graphics mode requested is not supported + ERROR_SAVING_CFG, ///< Error while writing gfx2.cfg + ERROR_MISSING_DIRECTORY, ///< Unable to return to the original "current directory" on program exit + ERROR_INI_CORRUPTED, ///< File gfx2.ini couldn't be parsed + ERROR_SAVING_INI, ///< Error while writing gfx2.ini + ERROR_SORRY_SORRY_SORRY ///< (Page allocation error that shouldn't ever happen, now) }; - // Les différents types de pixels - +// Available pixel scalers enum PIXEL_RATIO { - PIXEL_SIMPLE, + PIXEL_SIMPLE=0, PIXEL_WIDE, PIXEL_TALL, - PIXEL_DOUBLE + PIXEL_DOUBLE, + PIXEL_MAX ///< Number of elements in enum }; - // Les différentes catégories de bouton: - +/// Different kinds of menu button behavior. enum FAMILY_OF_BUTTONS { - FAMILY_TOOL=1, // Outils de dessin (exemple : Freehand draw) - FAMILY_INTERRUPTION, // Opération éphémère (exemple : changement de brosse) > Interruption de l'opération courante pour faire autre chose, puis on revient - FAMILY_INSTANT, // Pif paf (exemple : changement de couleur) > ça sera fini dès qu'on lache le bouton, pas d'utilisation de la pile d'opérations - FAMILY_TOOLBAR, // Cache/Montre la barre d'outils - FAMILY_EFFECTS // Effets + FAMILY_TOOL=1, ///< Drawing tools (example : Freehand draw) + FAMILY_INTERRUPTION, ///< Temporary operation (example : choosing paintbrush) > Interrupts the current operation to do something, then come back. + FAMILY_INSTANT, ///< Single-click action (example : choose a color in palette) > It will be over as soon as we exit the called function. + FAMILY_TOOLBAR, ///< Hide/show the menu + FAMILY_EFFECTS ///< Effects }; - // Les différentes formes de bouton: - +// The different kinds of buttons in menus or windows. enum BUTTON_SHAPES { - BUTTON_SHAPE_NO_FRAME, // Ex: la palette - BUTTON_SHAPE_RECTANGLE, // Ex: la plupart - BUTTON_SHAPE_TRIANGLE_TOP_LEFT, // Ex: Rectangles vides - BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT // Ex: Rectangles pleins + BUTTON_SHAPE_NO_FRAME, ///< Ex: the palette + BUTTON_SHAPE_RECTANGLE, ///< Ex: Most buttons. + BUTTON_SHAPE_TRIANGLE_TOP_LEFT, ///< Ex: Empty rectangles. + BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT ///< Ex: Filled rectangles. }; - // Les différentes formes de curseur: - +/// The different "mouse cursor" shapes enum CURSOR_SHAPES { CURSOR_SHAPE_ARROW, - CURSOR_SHAPE_TARGET, // Utilise le pinceau - CURSOR_SHAPE_COLORPICKER, // Utilise le pinceau + CURSOR_SHAPE_TARGET, ///< This one uses the paintbrush + CURSOR_SHAPE_COLORPICKER, ///< This one uses the paintbrush CURSOR_SHAPE_HOURGLASS, CURSOR_SHAPE_MULTIDIRECTIONNAL, CURSOR_SHAPE_HORIZONTAL, - CURSOR_SHAPE_THIN_TARGET, // Utilise le pinceau - CURSOR_SHAPE_THIN_COLORPICKER, // Utilise le pinceau + CURSOR_SHAPE_THIN_TARGET, ///< This one uses the paintbrush + CURSOR_SHAPE_THIN_COLORPICKER, ///< This one uses the paintbrush CURSOR_SHAPE_XOR_TARGET, CURSOR_SHAPE_XOR_RECTANGLE, CURSOR_SHAPE_XOR_ROTATION }; - // Les différentes formes de pinceaux (les types de pinceaux doivent être au début) - +/// The different shapes that can be used as a paintbrush (paintbrush types go in the beginning) enum PAINTBRUSH_SHAPES { PAINTBRUSH_SHAPE_ROUND, @@ -198,25 +198,24 @@ enum PAINTBRUSH_SHAPES PAINTBRUSH_SHAPE_VERTICAL_BAR, PAINTBRUSH_SHAPE_SLASH, PAINTBRUSH_SHAPE_ANTISLASH, - PAINTBRUSH_SHAPE_RANDOM, + PAINTBRUSH_SHAPE_RANDOM, ///< Random pixels in a circle shape, like an airbrush. PAINTBRUSH_SHAPE_CROSS, PAINTBRUSH_SHAPE_PLUS, PAINTBRUSH_SHAPE_DIAMOND, PAINTBRUSH_SHAPE_SIEVE_ROUND, PAINTBRUSH_SHAPE_SIEVE_SQUARE, - PAINTBRUSH_SHAPE_MISC,// Ce doit être le dernier des types de pinceaux, comme ça il indique le nombre de types de pinceaux (-1) - PAINTBRUSH_SHAPE_POINT, // Utilisé pour réduire de pinceau à 1 point dans certaines opérations - PAINTBRUSH_SHAPE_COLOR_BRUSH, - PAINTBRUSH_SHAPE_MONO_BRUSH + PAINTBRUSH_SHAPE_MISC, ///< A raw monochrome bitmap, can't be resized. This must be the last of the preset paintbrush types. + PAINTBRUSH_SHAPE_POINT, ///< Used to reduce the paintbrush to a single pixel, during operations like colorpicker. + PAINTBRUSH_SHAPE_COLOR_BRUSH, ///< User's brush, in color mode + PAINTBRUSH_SHAPE_MONO_BRUSH ///< User's brush, in mono mode }; - // Les différents états de bouton: - +/// Normal resting state for a menu button. #define BUTTON_RELEASED 0 -#define BUTTON_PRESSED 1 - - // Les différents modes de Shade +/// State of a menu button that is being pressed. +#define BUTTON_PRESSED 1 +/// The different modes of the Shade enum SHADE_MODES { SHADE_MODE_NORMAL, @@ -224,39 +223,39 @@ enum SHADE_MODES SHADE_MODE_NOSAT }; - // Les différents chunks du fichier .CFG - +/// Identifiers for the chunks (data blocks) of gfx2.cfg enum CHUNKS_CFG { CHUNK_KEYS = 0, - CHUNK_VIDEO_MODES = 1, - CHUNK_SHADE = 2, - CHUNK_MASK = 3, - CHUNK_STENCIL = 4, - CHUNK_GRADIENTS = 5, - CHUNK_SMOOTH = 6, - CHUNK_EXCLUDE_COLORS = 7, - CHUNK_QUICK_SHADE = 8, - CHUNK_GRID = 9, - CHUNK_MAX + CHUNK_VIDEO_MODES = 1, + CHUNK_SHADE = 2, + CHUNK_MASK = 3, + CHUNK_STENCIL = 4, + CHUNK_GRADIENTS = 5, + CHUNK_SMOOTH = 6, + CHUNK_EXCLUDE_COLORS = 7, + CHUNK_QUICK_SHADE = 8, + CHUNK_GRID = 9, + CHUNK_MAX }; - // Les différents types de lecteurs: - +/// Identifiers for the 8x8 icons of ::GFX_icon_sprite enum ICON_TYPES { - ICON_FLOPPY_3_5, // 0: Diskette 3"« - ICON_FLOPPY_5_25, // 1: Diskette 5"¬ - ICON_HDD, // 2: HDD - ICON_CDROM, // 3: CD-ROM - ICON_NETWORK, // 4: Logique (réseau?) + ICON_FLOPPY_3_5=0, ///< 3½" Floppy disk + ICON_FLOPPY_5_25, ///< 5¼" Floppy disk + ICON_HDD, ///< Hard disk drive + ICON_CDROM, ///< CD-ROM + ICON_NETWORK, ///< "Network" drive + ICON_STAR, ///< Star (favorite) + ICON_DROPDOWN, ///< Dropdown arrow + NB_ICON_SPRITES ///< Number of 8x8 icons }; - // Les différents boutons: - +/// Identifiers for the buttons in the menu. enum BUTTON_NUMBERS { - BUTTON_PAINTBRUSHES, + BUTTON_PAINTBRUSHES=0, BUTTON_ADJUST, BUTTON_DRAW, BUTTON_CURVES, @@ -293,29 +292,32 @@ enum BUTTON_NUMBERS BUTTON_PAL_LEFT, BUTTON_PAL_RIGHT, BUTTON_CHOOSE_COL, - BUTTON_HIDE + BUTTON_HIDE, + NB_BUTTONS ///< Number of buttons in the menu bar. }; - // Les actions des touches spéciales - +/// +/// Identifiers of special actions that can have a keyboard shortcut. +/// They are special in the sense that there's no button in the menu for them, +/// so it requires a specific handling. enum SPECIAL_ACTIONS { - SPECIAL_MOUSE_UP, - SPECIAL_MOUSE_DOWN, - SPECIAL_MOUSE_LEFT, - SPECIAL_MOUSE_RIGHT, - SPECIAL_CLICK_LEFT, - SPECIAL_CLICK_RIGHT, - SPECIAL_NEXT_FORECOLOR, - SPECIAL_PREVIOUS_FORECOLOR, - SPECIAL_NEXT_BACKCOLOR, - SPECIAL_PREVIOUS_BACKCOLOR, - SPECIAL_SMALLER_PAINTBRUSH, - SPECIAL_BIGGER_PAINTBRUSH, - SPECIAL_NEXT_USER_FORECOLOR, - SPECIAL_PREVIOUS_USER_FORECOLOR, - SPECIAL_NEXT_USER_BACKCOLOR, - SPECIAL_PREVIOUS_USER_BACKCOLOR, + SPECIAL_MOUSE_UP=0, + SPECIAL_MOUSE_DOWN, + SPECIAL_MOUSE_LEFT, + SPECIAL_MOUSE_RIGHT, + SPECIAL_CLICK_LEFT, + SPECIAL_CLICK_RIGHT, + SPECIAL_NEXT_FORECOLOR, + SPECIAL_PREVIOUS_FORECOLOR, + SPECIAL_NEXT_BACKCOLOR, + SPECIAL_PREVIOUS_BACKCOLOR, + SPECIAL_SMALLER_PAINTBRUSH, + SPECIAL_BIGGER_PAINTBRUSH, + SPECIAL_NEXT_USER_FORECOLOR, + SPECIAL_PREVIOUS_USER_FORECOLOR, + SPECIAL_NEXT_USER_BACKCOLOR, + SPECIAL_PREVIOUS_USER_BACKCOLOR, SPECIAL_SCROLL_UP, SPECIAL_SCROLL_DOWN, SPECIAL_SCROLL_LEFT, @@ -353,68 +355,65 @@ enum SPECIAL_ACTIONS SPECIAL_BOTTOM_LEFT_ATTACHMENT, SPECIAL_BOTTOM_RIGHT_ATTACHMENT, SPECIAL_EXCLUDE_COLORS_MENU, - SPECIAL_SHADE_MODE, // | - SPECIAL_SHADE_MENU, // | - SPECIAL_QUICK_SHADE_MODE, // | - SPECIAL_QUICK_SHADE_MENU, // | - SPECIAL_STENCIL_MODE, // | - SPECIAL_STENCIL_MENU, // | - SPECIAL_MASK_MODE, // | Il faut que le premier effet soit - SPECIAL_MASK_MENU, // | SPECIAL_SHADE_MODE, et que le - SPECIAL_GRID_MODE, // | dernier soit SPECIAL_TILING_MENU, - SPECIAL_GRID_MENU, // |_ et que seuls des effets soient - SPECIAL_SIEVE_MODE, // | définis entre ces deux là car - SPECIAL_SIEVE_MENU, // | des tests sur cet intervalle sont - SPECIAL_COLORIZE_MODE, // | faits dans le moteur. - SPECIAL_COLORIZE_MENU, // | - SPECIAL_SMOOTH_MODE, // | - SPECIAL_SMOOTH_MENU, // | - SPECIAL_SMEAR_MODE, // | - SPECIAL_TILING_MODE, // | - SPECIAL_TILING_MENU // | + SPECIAL_SHADE_MODE, + SPECIAL_SHADE_MENU, + SPECIAL_QUICK_SHADE_MODE, ///< This must be the first of the "effects" family + SPECIAL_QUICK_SHADE_MENU, + SPECIAL_STENCIL_MODE, + SPECIAL_STENCIL_MENU, + SPECIAL_MASK_MODE, + SPECIAL_MASK_MENU, + SPECIAL_GRID_MODE, + SPECIAL_GRID_MENU, + SPECIAL_SIEVE_MODE, + SPECIAL_SIEVE_MENU, + SPECIAL_COLORIZE_MODE, + SPECIAL_COLORIZE_MENU, + SPECIAL_SMOOTH_MODE, + SPECIAL_SMOOTH_MENU, + SPECIAL_SMEAR_MODE, + SPECIAL_TILING_MODE, + SPECIAL_TILING_MENU, ///< This must be the last of the "effects" family + NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts }; - // Définition des opérations: - +/// Identifiers of the operations, ie tools you use on the image. enum OPERATIONS { - OPERATION_CONTINUOUS_DRAW, // Dessin à la main continu - OPERATION_DISCONTINUOUS_DRAW, // Dessin à la main discontinu - OPERATION_POINT_DRAW, // Dessin à la main point par point - OPERATION_FILLED_CONTOUR, // Contour rempli - OPERATION_LINE, // Lignes - OPERATION_K_LIGNE, // Lignes reliées - OPERATION_CENTERED_LINES, // Lignes concentriques - OPERATION_EMPTY_RECTANGLE, // Rectangle vide - OPERATION_FILLED_RECTANGLE, // Rectangle plein - OPERATION_EMPTY_CIRCLE, // Cercle vide - OPERATION_FILLED_CIRCLE, // Cercle plein - OPERATION_EMPTY_ELLIPSE, // Ellipse vide - OPERATION_FILLED_ELLIPSE, // Ellipse pleine - OPERATION_FILL, // Fill - OPERATION_REPLACE, // Replace couleur - OPERATION_GRAB_BRUSH, // Prise de brosse rectangulaire - OPERATION_POLYBRUSH, // Prise d'une brosse multiforme - OPERATION_COLORPICK, // Récupération d'une couleur - OPERATION_MAGNIFY, // Positionnement de la fenêtre de loupe - OPERATION_3_POINTS_CURVE, // Courbe à 3 points - OPERATION_4_POINTS_CURVE, // Courbe à 4 points - OPERATION_AIRBRUSH, // Spray - OPERATION_POLYGON, // Polygone - OPERATION_POLYFORM, // Polyforme - OPERATION_POLYFILL, // Polyfill - OPERATION_FILLED_POLYFORM, // Polyforme rempli - OPERATION_SCROLL, // Scroll - OPERATION_GRAD_CIRCLE, // Cercles dégradés - OPERATION_GRAD_ELLIPSE, // Ellipses dégradées - OPERATION_ROTATE_BRUSH, // Faire tourner brosse - OPERATION_STRETCH_BRUSH, // Etirer brosse - OPERATION_DISTORT_BRUSH, // Deformer brosse - OPERATION_GRAD_RECTANGLE, // Rectangle dégradé - - OPERATION_NONE + OPERATION_CONTINUOUS_DRAW=0, ///< Freehand continuous draw + OPERATION_DISCONTINUOUS_DRAW,///< Freehand discontinuous draw + OPERATION_POINT_DRAW, ///< Freehand point-by-point draw + OPERATION_FILLED_CONTOUR, ///< Filled contour + OPERATION_LINE, ///< Lines + OPERATION_K_LIGNE, ///< Linked lines + OPERATION_CENTERED_LINES, ///< Centered lines + OPERATION_EMPTY_RECTANGLE, ///< Empty rectangle + OPERATION_FILLED_RECTANGLE, ///< Filled rectangle + OPERATION_EMPTY_CIRCLE, ///< Empty circle + OPERATION_FILLED_CIRCLE, ///< Filled circle + OPERATION_EMPTY_ELLIPSE, ///< Empty ellipse + OPERATION_FILLED_ELLIPSE, ///< Filled ellipse + OPERATION_FILL, ///< Fill + OPERATION_REPLACE, ///< Color replacer + OPERATION_GRAB_BRUSH, ///< Rectangular brush grabbing + OPERATION_POLYBRUSH, ///< Polygonal brush grabbing + OPERATION_COLORPICK, ///< Colorpicker + OPERATION_MAGNIFY, ///< Position the magnify window + OPERATION_3_POINTS_CURVE, ///< Curve with 3 control points + OPERATION_4_POINTS_CURVE, ///< Curve with 4 control points + OPERATION_AIRBRUSH, ///< Airbrush + OPERATION_POLYGON, ///< Polygon + OPERATION_POLYFORM, ///< Polyform + OPERATION_POLYFILL, ///< Filled polygon + OPERATION_FILLED_POLYFORM, ///< Filled polyform + OPERATION_SCROLL, ///< Scroll (pan) + OPERATION_GRAD_CIRCLE, ///< Gradient-filled circle + OPERATION_GRAD_ELLIPSE, ///< Gradient-filled ellipse + OPERATION_ROTATE_BRUSH, ///< Rotate brush + OPERATION_STRETCH_BRUSH, ///< Stretch brush + OPERATION_DISTORT_BRUSH, ///< Distort brush + OPERATION_GRAD_RECTANGLE, ///< Gradient-filled rectangle + NB_OPERATIONS ///< Number of operations handled by the engine }; - - #endif diff --git a/engine.c b/engine.c index ea9fe6dd..8438cc4a 100644 --- a/engine.c +++ b/engine.c @@ -1597,7 +1597,7 @@ T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width, if (label && label[0]) Print_in_window(temp->Pos_X+2,temp->Pos_Y+(temp->Height-7)/2,label,MC_Black,MC_Light); if (display_arrow) - Window_display_icon_sprite(temp->Pos_X+temp->Width-10,temp->Pos_Y+(temp->Height-7)/2,6); + Window_display_icon_sprite(temp->Pos_X+temp->Width-10,temp->Pos_Y+(temp->Height-7)/2,ICON_DROPDOWN); return temp; } diff --git a/filesel.c b/filesel.c index d13a1899..1f9d4c89 100644 --- a/filesel.c +++ b/filesel.c @@ -967,7 +967,7 @@ byte Button_Load_or_Save(byte load, byte image) else Open_window(310,200,"Save brush"); Window_set_normal_button(198,180,51,14,"Save",0,1,SDLK_RETURN); // 1 - if (Main_format==0) // Correction du *.* + if (Main_format==FORMAT_ANY) // Correction du *.* { Main_format=Main_fileformat; Main_fileselector_position=0; @@ -1004,7 +1004,7 @@ byte Button_Load_or_Save(byte load, byte image) // Dropdown pour les formats de fichier formats_dropdown= Window_set_dropdown_button(69,28,49,11,0, - (Main_format==0)?"*.*":File_formats[Main_format-1].Extension, + (Main_format==FORMAT_ANY)?"*.*":File_formats[Main_format-1].Extension, 1,0,1,RIGHT_SIDE|LEFT_SIDE); // 6 if (load) Window_dropdown_add_item(formats_dropdown,0,"*.*"); @@ -1259,7 +1259,7 @@ byte Button_Load_or_Save(byte load, byte image) dummy=1; if (!dummy) { - if (Main_format) + if (Main_format != FORMAT_ANY) { if(!Directory_exists(Main_filename)) { diff --git a/global.h b/global.h index cca44b61..124aeecc 100644 --- a/global.h +++ b/global.h @@ -50,11 +50,11 @@ GFX2_GLOBAL word Config_Key[NB_SPECIAL_SHORTCUTS][2]; /// A video mode (resolution) usable by Grafx2. typedef struct { - short Width; ///< Screen width - short Height; ///< Screen height - byte Mode; ///< Unused (used to be Mode-X, SVGA, etc) + short Width; ///< Screen width + short Height; ///< Screen height + byte Mode; ///< Unused (used to be Mode-X, SVGA, etc) word Fullscreen; ///< 0 for window, 1 for fullscreen - byte State; ///< How good is the mode supported. 0:Good (white) 1:OK (light) 2:So-so (dark) 4:User-disabled (black); +128 => System doesn't support it at all. + byte State; ///< How good is the mode supported. 0:Good (white) 1:OK (light) 2:So-so (dark) 4:User-disabled (black); +128 => System doesn't support it at all. } T_Video_mode; /// Array of all video modes supported by your platform. Actually filled up to ::Nb_video_modes, excluded. @@ -66,10 +66,10 @@ GFX2_GLOBAL int Nb_video_modes; /// A default 256-color palette. GFX2_GLOBAL T_Palette Default_palette; -// Menu colors +// -- Menu colors GFX2_GLOBAL byte MC_Black; ///< Index of color to use as "black" in the GUI menus. -GFX2_GLOBAL byte MC_Dark; ///< Index of color to use as "dark grey" in the GUI menus. +GFX2_GLOBAL byte MC_Dark; ///< Index of color to use as "dark grey" in the GUI menus. GFX2_GLOBAL byte MC_Light; ///< Index of color to use as "light grey" in the GUI menus. GFX2_GLOBAL byte MC_White; ///< Index of color to use as "white" in the GUI menus. GFX2_GLOBAL byte MC_Trans; ///< Index of color to use as "transparent" while loading the GUI file. @@ -119,12 +119,12 @@ GFX2_GLOBAL byte Mouse_fix_factor_X; /// Divisor for the mouse coordinates recieved. No target currently needs it, should be left at 1. GFX2_GLOBAL byte Mouse_fix_factor_Y; -/// +/// /// This boolean is true when the current operation allows changing the /// foreground or background color. GFX2_GLOBAL byte Allow_color_change_during_operation; -// Mouse cursor data +// -- Mouse cursor data /// Current mouse cursor. Value is in enum ::CURSOR_SHAPES GFX2_GLOBAL byte Cursor_shape; @@ -145,7 +145,7 @@ GFX2_GLOBAL byte GFX_cursor_sprite[NB_CURSOR_SPRITES][CURSOR_SPRITE_HEIGHT][CURS /// Storage for the graphics under the mouse cursor. Used by ::Hide_cursor and ::Display_cursor GFX2_GLOBAL byte CURSOR_BACKGROUND[CURSOR_SPRITE_HEIGHT][CURSOR_SPRITE_WIDTH]; -// Paintbrush data +// -- Paintbrush data /// Active paintbrush. It's an index in enum ::PAINTBRUSH_SHAPES GFX2_GLOBAL byte Paintbrush_shape; @@ -184,7 +184,7 @@ GFX2_GLOBAL short Paintbrush_offset_X; /// Position of current paintbrush's handle GFX2_GLOBAL short Paintbrush_offset_Y; -// Graphic commands +// -- Graphic commands /// On the screen, draw a point. GFX2_GLOBAL Func_pixel Pixel; @@ -231,7 +231,7 @@ GFX2_GLOBAL Func_display_brush_color_zoom Clear_brush_scaled; /// Draw an arbitrary brush on screen (not the current brush) GFX2_GLOBAL Func_draw_brush Display_brush; -// Screen data +// -- Screen data /// Requested window width. This is set when the user resizes the window. GFX2_GLOBAL int Resize_width; @@ -303,7 +303,7 @@ GFX2_GLOBAL int Pixel_width; GFX2_GLOBAL int Pixel_height; -// Current image data +// -- Current image data /// Pointer to the pixel data of the main image GFX2_GLOBAL byte * Main_screen; @@ -348,7 +348,7 @@ GFX2_GLOBAL char Main_comment[COMMENT_SIZE+1]; GFX2_GLOBAL short Main_separator_position; /// X position (in screen coordinates) of the first pixel of the magnified view. GFX2_GLOBAL short Main_X_zoom; -/// Proportion of the non-magnified part of the screen. +/// Proportion of the non-magnified part of the screen. GFX2_GLOBAL float Main_separator_proportion; /// Boolean, true if the main image has the magnifier active. GFX2_GLOBAL byte Main_magnifier_mode; @@ -363,7 +363,7 @@ GFX2_GLOBAL short Main_magnifier_offset_X; /// Y position (in image space) of the pixel to display in the top left corner of the magnified view. GFX2_GLOBAL short Main_magnifier_offset_Y; -// Spare page data +// -- Spare page data /// Pointer to the pixel data of the spare page GFX2_GLOBAL byte * Spare_screen; @@ -408,7 +408,7 @@ GFX2_GLOBAL char Spare_comment[COMMENT_SIZE+1]; GFX2_GLOBAL short Spare_separator_position; /// X position (in screen coordinates) of the first pixel of the magnified view. GFX2_GLOBAL short Spare_X_zoom; -/// Proportion of the non-magnified part of the screen. +/// Proportion of the non-magnified part of the screen. GFX2_GLOBAL float Spare_separator_proportion; /// Boolean, true if the main image has the magnifier active. GFX2_GLOBAL byte Spare_magnifier_mode; @@ -423,7 +423,7 @@ GFX2_GLOBAL short Spare_magnifier_offset_X; /// Y position (in image space) of the pixel to display in the top left corner of the magnified view. GFX2_GLOBAL short Spare_magnifier_offset_Y; -// Image backups +// -- Image backups /// Backup of the current screen, used during drawing when FX feedback is OFF. GFX2_GLOBAL byte * Screen_backup; @@ -432,202 +432,313 @@ GFX2_GLOBAL T_List_of_pages * Main_backups; /// List of backup pages for the spare page. GFX2_GLOBAL T_List_of_pages * Spare_backups; -// Brush data +// -- Brush data /// Pixel data of the current brush. GFX2_GLOBAL byte * Brush; -GFX2_GLOBAL word Brush_offset_X; // Centre horizontal de la brosse -GFX2_GLOBAL word Brush_offset_Y; // Centre vertical de la brosse -GFX2_GLOBAL word Brush_width; // Largeur de la brosse -GFX2_GLOBAL word Brush_height; // Hauteur de la brosse +/// X coordinate of the brush's "hot spot". It is < ::Brush_width +GFX2_GLOBAL word Brush_offset_X; +/// Y coordinate of the brush's "hot spot". It is < ::Brush_height +GFX2_GLOBAL word Brush_offset_Y; +/// Width of the current brush. +GFX2_GLOBAL word Brush_width; +/// Height of the current brush. +GFX2_GLOBAL word Brush_height; +/// Name of the directory that holds the brush fil (after loading or saving it). +GFX2_GLOBAL char Brush_file_directory[MAX_PATH_CHARACTERS]; +/// Filename (without directory) of the brush (after loading or saving it). +GFX2_GLOBAL char Brush_filename[MAX_PATH_CHARACTERS]; +/// File format of the brush. It's a value of enum ::FILE_FORMATS +GFX2_GLOBAL byte Brush_fileformat; +/// +/// Fileselector "filter" format, for the brush. +/// It's 0 for "*.*", or a value of enum ::FILE_FORMATS +GFX2_GLOBAL byte Brush_format; +/// Index of the first file/entry to display in the brush's fileselector. +GFX2_GLOBAL short Brush_fileselector_position; +/// +/// Position of the "highlight" bar in the brush's fileselector. 10 Files can +/// be visible, so it's a number in the [0-9] range. +GFX2_GLOBAL short Brush_fileselector_offset; +/// Current directory for the brush's fileselector. +GFX2_GLOBAL char Brush_current_directory[256]; +/// File comment in the brush's fileselector (some image formats support text strings). +GFX2_GLOBAL char Brush_comment[COMMENT_SIZE+1]; +/// Indicator used for the "Rotate brush" operation. +GFX2_GLOBAL byte Brush_rotation_center_is_defined; +/// Position of the brush's rotation center, in screen coordinates. +GFX2_GLOBAL short Brush_rotation_center_X; +/// Position of the brush's rotation center, in screen coordinates. +GFX2_GLOBAL short Brush_rotation_center_Y; -GFX2_GLOBAL char Brush_file_directory[MAX_PATH_CHARACTERS];// | -GFX2_GLOBAL char Brush_filename[MAX_PATH_CHARACTERS]; // | -GFX2_GLOBAL byte Brush_fileformat; // | Infos sur le -GFX2_GLOBAL byte Brush_format; // |_ sélecteur de -GFX2_GLOBAL short Brush_fileselector_position; // | fichiers de la -GFX2_GLOBAL short Brush_fileselector_offset; // | brosse. -GFX2_GLOBAL char Brush_current_directory[256]; // | -GFX2_GLOBAL char Brush_comment[COMMENT_SIZE+1]; // | +// -- Menu data (toolbox) -GFX2_GLOBAL byte Brush_rotation_center_is_defined; // | Infos sur le -GFX2_GLOBAL short Brush_rotation_center_X; // |- centre de rotation -GFX2_GLOBAL short Brush_rotation_center_Y; // | de la brosse - - // Données sur le menu - -GFX2_GLOBAL byte Menu_is_visible; // Le menu est actif à l'écran -GFX2_GLOBAL word Menu_Y; // Ordonnée où commence le menu -GFX2_GLOBAL word Menu_status_Y; // Ordonnée où commence le texte dans le menu -GFX2_GLOBAL byte Menu_factor_X; // Facteur de grossissement du menu en X -GFX2_GLOBAL byte Menu_factor_Y; // Facteur de grossissement du menu en Y -GFX2_GLOBAL word Menu_palette_cell_width; // Taille d'une couleur de la palette du menu +/// Boolean, true if the menu has to be displayed. +GFX2_GLOBAL byte Menu_is_visible; +/// +/// Y position (in screen coordinates) where the menu begins. +/// This is always either ::Screen_height (when menu is hidden) or (::Screen_height - ::MENU_HEIGHT) +/// As a result, the drawing algoritm always draws the image from 0 to ::Menu_Y-1 +GFX2_GLOBAL word Menu_Y; +/// Y position of the status bar (in screen coordinates) +GFX2_GLOBAL word Menu_status_Y; +/// Scaling factor for the menu and all GUI elements +GFX2_GLOBAL byte Menu_factor_X; +/// Scaling factor for the menu and all GUI elements +GFX2_GLOBAL byte Menu_factor_Y; +/// Size of a color cell in the menu's palette. +GFX2_GLOBAL word Menu_palette_cell_width; - // Données sur la fenêtre de menu +// -- Window data -GFX2_GLOBAL byte Windows_open; // Nombre de fenetres empilées. 0 si pas de fenetre ouverte. +/// Number of stacked windows currently displayed. 0 when no window is present. +GFX2_GLOBAL byte Windows_open; +/// Backup of ::Menu_is_visible, used to store it while a window is open. +GFX2_GLOBAL byte Menu_is_visible_before_window; +/// Backup of ::Menu_Y, used to store it while a window is open. +GFX2_GLOBAL word Menu_Y_before_window; +/// Backup of ::Paintbrush_hidden, used to store it while a window is open. +GFX2_GLOBAL byte Paintbrush_hidden_before_window; -GFX2_GLOBAL byte Menu_is_visible_before_window; // Le menu était visible avant d'ouvir une fenêtre -GFX2_GLOBAL word Menu_Y_before_window; // Ordonnée du menu avant d'ouvrir une fenêtre -GFX2_GLOBAL byte Paintbrush_hidden_before_window;// Le pinceau étatit déjà caché avant l'ouverture de la fenetre? - -GFX2_GLOBAL word Window_stack_pos_X[8]; // Position du bord gauche de la fenêtre dans l'écran +GFX2_GLOBAL word Window_stack_pos_X[8]; +/// Position of the left border of the topmost window (in screen coordinates) #define Window_pos_X Window_stack_pos_X[Windows_open-1] -GFX2_GLOBAL word Window_stack_pos_Y[8]; // Position du bord haut de la fenêtre dans l'écran +GFX2_GLOBAL word Window_stack_pos_Y[8]; +/// Position of the top border of the topmost window (in screen coordinates) #define Window_pos_Y Window_stack_pos_Y[Windows_open-1] -GFX2_GLOBAL word Window_stack_width[8]; // Largeur de la fenêtre +GFX2_GLOBAL word Window_stack_width[8]; +/// +/// Width of the topmost window, in "window pixels" +/// (multiply by ::Menu_factor_X to get screen pixels) #define Window_width Window_stack_width[Windows_open-1] -GFX2_GLOBAL word Window_stack_height[8]; // Hauteur de la fenêtre +GFX2_GLOBAL word Window_stack_height[8]; +/// +/// Height of the topmost window, in "window pixels" +/// (multiply by ::Menu_factor_Y to get screen pixels) #define Window_height Window_stack_height[Windows_open-1] GFX2_GLOBAL word Window_stack_nb_buttons[8]; +/// Total number of buttons/controls in the topmost window. #define Window_nb_buttons Window_stack_nb_buttons[Windows_open-1] GFX2_GLOBAL T_Normal_button * Window_stack_normal_button_list[8]; +/// List of normal buttons in the topmost window. #define Window_normal_button_list Window_stack_normal_button_list[Windows_open-1] GFX2_GLOBAL T_Palette_button * Window_stack_palette_button_list[8]; +/// List of "palette" buttons in the topmost window. #define Window_palette_button_list Window_stack_palette_button_list[Windows_open-1] GFX2_GLOBAL T_Scroller_button * Window_stack_scroller_button_list[8]; +/// List of sliders (scrollers) in the topmost window. #define Window_scroller_button_list Window_stack_scroller_button_list[Windows_open-1] GFX2_GLOBAL T_Special_button * Window_stack_special_button_list[8]; +/// List of special buttons in the topmost window. #define Window_special_button_list Window_stack_special_button_list[Windows_open-1] GFX2_GLOBAL T_Dropdown_button * Window_stack_dropdown_button_list[8]; +/// List of dropdown buttons in the topmost window. #define Window_dropdown_button_list Window_stack_dropdown_button_list[Windows_open-1] GFX2_GLOBAL int Window_stack_attribute1[8]; +/// +/// The function ::Window_clicked_button() set this to ::LEFT_SIDE or ::RIGHT_SIDE +/// after a button is activated through left or right mouse click. #define Window_attribute1 Window_stack_attribute1[Windows_open-1] -// Cette variable sert à stocker 2 informations: -// - Sur le click d'un scroller, la position active (0-n) -// - Sur le click d'une palette, le numero de couleur (0-255). GFX2_GLOBAL int Window_stack_attribute2[8]; +/// +/// The function ::Window_clicked_button() set this to return extra information: +/// - When a scroller was clicked: the scroller position (0-n) +/// - When a palette was clicked: the color index (0-255) +/// - When a dropdown was used: the selected item's number T_Dropdown_choice::Number #define Window_attribute2 Window_stack_attribute2[Windows_open-1] -// Définition des boutons //////////////////////////////////////////////////// +/// Definition of the menu (toolbox) GFX2_GLOBAL struct { - // Informations sur l'aspect du bouton (graphisme): - word X_offset; // Décalage par rapport à la gauche du menu - word Y_offset; // Décalage par rapport au haut du menu - word Width; // Largeur du bouton - word Height; // Hauteur du bouton - byte Pressed; // Le bouton est enfoncé - byte Shape; // Forme du bouton + // Button aspect + word X_offset; ///< Position relative to menu's left + word Y_offset; ///< Position relative to menu's top + word Width; ///< Button's active width + word Height; ///< Button's active heigth + byte Pressed; ///< Button is currently pressed + byte Shape; ///< Shape, listed in enum ::BUTTON_SHAPES - // Information sur les clicks de la souris: - Func_action Gauche; // Action déclenchée par un click gauche sur le bouton - Func_action Droite; // Action déclenchée par un click droit sur le bouton - word Left_shortcut[2]; // Shortcut clavier équivalent à un click gauche sur le bouton - word Right_shortcut[2]; // Shortcut clavier équivalent à un click droit sur le bouton + // Triggers on mouse/keyboard + Func_action Gauche; ///< Action triggered by a left mouseclick on the button + Func_action Droite; ///< Action triggered by a right mouseclick on the button + word Left_shortcut[2]; ///< Keyboard shortcut for a left mouseclick + word Right_shortcut[2];///< Keyboard shortcut for a right mouseclick - // Informations sur le désenclenchement du bouton géré par le moteur: - Func_action Desenclencher; // Action appelée lors du désenclenchement du bouton - byte Famille; // Ensemble de boutons auquel celui-ci appartient + // Data used when the button is unselected + Func_action Desenclencher; ///< Action triggered by unselecting the button + byte Famille; ///< enum ::FAMILY_OF_BUTTONS. } Buttons_Pool[NB_BUTTONS]; -// Informations sur les différents modes de dessin +// -- Information about the different drawing modes (effects) +/// Current effecting function. When no effect is selected this is ::No_effect() GFX2_GLOBAL Func_effect Effect_function; +/// +/// Pointer to the image to read, while drawing. It's either ::Main_screen +/// (the image you draw) when FX feedback is ON, or ::Screen_backup (a backup +/// copy) when FX feedback is off. GFX2_GLOBAL byte * FX_feedback_screen; -GFX2_GLOBAL byte Exclude_color[256]; // Couleurs à exclure pour Best_color +/// +/// Array of booleans, indicates which colors should never be picked by +/// ::Best_color() +GFX2_GLOBAL byte Exclude_color[256]; - // Mode smear: +// -- Smear mode -GFX2_GLOBAL byte Smear_mode; // Le mode smear est enclenché -GFX2_GLOBAL byte Smear_start; // On vient juste de commencer une opération en Smear -GFX2_GLOBAL byte * Smear_brush; // Sprite de la brosse de Smear -GFX2_GLOBAL word Smear_brush_width; // Largeur de la brosse de Smear -GFX2_GLOBAL word Smear_brush_height; // Hauteur de la brosse de Smear -GFX2_GLOBAL short Smear_min_X,Smear_max_X,Smear_min_Y,Smear_max_Y; // Bornes de la Brush du smear +/// Smear mode is activated +GFX2_GLOBAL byte Smear_mode; +/// Boolean, indicates that a smear is in progress. +GFX2_GLOBAL byte Smear_start; +/// Pointer to the sprite to use for smear; it contains pixels from the image. +GFX2_GLOBAL byte * Smear_brush; +/// Width of the ::Smear_brush +GFX2_GLOBAL word Smear_brush_width; +/// Height of the ::Smear_brush +GFX2_GLOBAL word Smear_brush_height; +/// Limits of the smear. +GFX2_GLOBAL short Smear_min_X; +/// Limits of the smear. +GFX2_GLOBAL short Smear_max_X; +/// Limits of the smear. +GFX2_GLOBAL short Smear_min_Y; +/// Limits of the smear. +GFX2_GLOBAL short Smear_max_Y; - // Mode shade: +// -- Shade mode +/// List of the shade tables +GFX2_GLOBAL T_Shade Shade_list[8]; +/// Shade currently selected (index in ::Shade_list) +GFX2_GLOBAL byte Shade_current; +/// Conversion table in use +GFX2_GLOBAL byte * Shade_table; +/// Conversion table for a left click +GFX2_GLOBAL byte Shade_table_left[256]; +/// Conversion table for a right click +GFX2_GLOBAL byte Shade_table_right[256]; +/// Boolean, true when the shade mode is active. +GFX2_GLOBAL byte Shade_mode; -GFX2_GLOBAL T_Shade Shade_list[8]; // Listes de shade -GFX2_GLOBAL byte Shade_current; // Numéro du shade en cours -GFX2_GLOBAL byte * Shade_table; // Table de conversion de shade en cours -GFX2_GLOBAL byte Shade_table_left[256]; // Table de conversion de shade pour un clic gauche -GFX2_GLOBAL byte Shade_table_right[256]; // Table de conversion de shade pour un clic droit -GFX2_GLOBAL byte Shade_mode; // Le mode shade est enclenché +/// Boolean, true when the quick-shade mode is active. +GFX2_GLOBAL byte Quick_shade_mode; +/// Size of the step, in Quick-shade mode. It's the number of colors to "jump". +GFX2_GLOBAL byte Quick_shade_step; +/// Determines how colors should loop in Quick-shade more. Value in enum ::SHADE_MODES +GFX2_GLOBAL byte Quick_shade_loop; -GFX2_GLOBAL byte Quick_shade_mode; // Le mode quick-shade est enclenché -GFX2_GLOBAL byte Quick_shade_step; // Pas du mode quick-shade -GFX2_GLOBAL byte Quick_shade_loop; // Normal / Loop / No sat. +// -- Stencil mode - // Mode stencil: +/// Boolean, true when stencil mode is active. +GFX2_GLOBAL byte Stencil_mode; +/// Array of the protected colors by Stencil mode. +GFX2_GLOBAL byte Stencil[256]; -GFX2_GLOBAL byte Stencil_mode; // Le mode stencil est enclenché -GFX2_GLOBAL byte Stencil[256]; // Tableau des couleurs protégées +// -- Grid mode - // Mode grille: +/// Boolean, true when the Grid mode is active. +GFX2_GLOBAL byte Snap_mode; +/// Width of the grid in Grid mode. +GFX2_GLOBAL word Snap_width; +/// Height of the grid in Grid mode. +GFX2_GLOBAL word Snap_height; +/// Position of the starting pixel, in Grid mode. +GFX2_GLOBAL word Snap_offset_X; +/// Position of the starting pixel, in Grid mode. +GFX2_GLOBAL word Snap_offset_Y; -GFX2_GLOBAL byte Snap_mode; // Le mode grille est enclenché -GFX2_GLOBAL word Snap_width; // Largeur entre 2 points de la grille -GFX2_GLOBAL word Snap_height; // Hauteur entre 2 points de la grille -GFX2_GLOBAL word Snap_offset_X; // Position en X du point le + à gauche -GFX2_GLOBAL word Snap_offset_Y; // Position en Y du point le + en haut +// -- Sieve mode - // Mode trame: +/// Boolean, true when the Sieve mode is active +GFX2_GLOBAL byte Sieve_mode; +/// Sprite of the sieve pattern. It's actually an array of booleans. +GFX2_GLOBAL byte Sieve[16][16]; +/// Preset sieve patterns, stored as binary (one word per line) +GFX2_GLOBAL word GFX_sieve_pattern[12][16]; +/// Width of the sieve pattern, in Sieve mode. +GFX2_GLOBAL short Sieve_width; +/// Height of the sieve pattern, in Sieve mode. +GFX2_GLOBAL short Sieve_height; -GFX2_GLOBAL byte Sieve_mode; // Le mode Sieve est enclenché -GFX2_GLOBAL byte Sieve[16][16]; // Sprite de la trame -GFX2_GLOBAL word GFX_sieve_pattern[12][16]; // Trames préséfinies (compactées sur 16*16 bits) -GFX2_GLOBAL short Sieve_width; // Largeur de la trame -GFX2_GLOBAL short Sieve_height; // Hauteur de la trame +// -- Colorize mode - // Mode colorize: - -GFX2_GLOBAL byte Colorize_mode; // Le mode Colorize est enclenché -GFX2_GLOBAL byte Colorize_opacity; // Intensité du Colorize -GFX2_GLOBAL byte Colorize_current_mode; // Le type de Colorize en cours (0-2) +/// Boolean, true when the Colorize mode is active. +GFX2_GLOBAL byte Colorize_mode; +/// % of opacity of Colorize mode (for translucency) +GFX2_GLOBAL byte Colorize_opacity; +/// Sets the colorization mode: 0 transparency, 1 additive, 2 substractive +GFX2_GLOBAL byte Colorize_current_mode; +/// +/// Table of precomputed factors used by Colorize mode. It hold 0 to 255 when +/// opacity is 100%, 0 to 128 when opacity is 50%, etc. +// FIXME: This only caches a multiplication and a division. Maybe we should scrap it GFX2_GLOBAL word Facteur_A_table[256]; +/// +/// Table of precomputed factors used by Colorize mode. It hold 255 to 0 when +/// opacity is 100%, 128 to 0 when opacity is 50%, etc. +// FIXME: This only caches a multiplication, a division, a substraction. Maybe we should scrap it GFX2_GLOBAL word Facteur_B_table[256]; - // Mode smooth: +// -- Smooth mode -GFX2_GLOBAL byte Smooth_mode; // Le mode Smooth est enclenché -GFX2_GLOBAL byte Smooth_matrix[3][3]; // La matrice du Smooth actuel +/// Boolean, true when the Smooth mode is active +GFX2_GLOBAL byte Smooth_mode; +/// Matrix of "weights" used by the Smooth mode. +GFX2_GLOBAL byte Smooth_matrix[3][3]; - // Mode Tiling: +// -- Tiling mode -GFX2_GLOBAL byte Tiling_mode; // Le mode Tiling est enclenché -GFX2_GLOBAL short Tiling_offset_X; // Décalage du tiling en X -GFX2_GLOBAL short Tiling_offset_Y; // Décalage du tiling en Y +/// Boolean, true when the Tiling mode is active +GFX2_GLOBAL byte Tiling_mode; +/// Position of the starting pixel in Tiling mode. +GFX2_GLOBAL short Tiling_offset_X; +/// Position of the starting pixel in Tiling mode. +GFX2_GLOBAL short Tiling_offset_Y; - // Mode Mask +// -- Mask mode -GFX2_GLOBAL byte Mask_mode; // Le mode Masque est enclenché -GFX2_GLOBAL byte Mask_table[256]; // Tableau des couleurs constituant le masque +/// Boolean, true when the Tiling mode is active +GFX2_GLOBAL byte Mask_mode; +/// Array of booleans. True if the indexed color is protected by the mask. +GFX2_GLOBAL byte Mask_table[256]; - // Mode loupe: +// -- Magnifier data +/// Pointer to ::Magnify_table[n] : table of multipliers used by the Magnifier. +// FIXME: This only caches a multiplication. Maybe we should scrap it GFX2_GLOBAL word * Zoom_factor_table; +/// Precomputed tables of multipliers used by the Magnifier. +// FIXME: This only caches a multiplication. Maybe we should scrap it GFX2_GLOBAL word Magnify_table[NB_ZOOM_FACTORS][512]; #ifdef GLOBAL_VARIABLES word ZOOM_FACTOR[NB_ZOOM_FACTORS]={2,3,4,5,6,8,10,12,14,16,18,20}; #else +/// Successive zoom factors, used by the Magnifier. extern word ZOOM_FACTOR[NB_ZOOM_FACTORS]; #endif - // Données sur les ellipses et les cercles: - +// -- Data for ellipses and circles +// FIXME: move most of these to graph.c GFX2_GLOBAL long Ellipse_cursor_X; GFX2_GLOBAL long Ellipse_cursor_Y; GFX2_GLOBAL long Ellipse_vertical_radius_squared; @@ -637,178 +748,253 @@ GFX2_GLOBAL long Circle_cursor_X; GFX2_GLOBAL long Circle_cursor_Y; GFX2_GLOBAL long Circle_limit; - // Données sur les dégradés: +// -- Data for gradients -GFX2_GLOBAL short Gradient_lower_bound; // Plus petite couleur englobée par le dégradé -GFX2_GLOBAL short Gradient_upper_bound; // Plus grande couleur englobée par le dégradé -GFX2_GLOBAL int Gradient_is_inverted; // Booléen "Le dégradé est en réalité inversé" -GFX2_GLOBAL long Gradient_bounds_range; // = Abs(Gradient_lower_bound-Gradient_upper_bound)+1 -GFX2_GLOBAL long Gradient_total_range; // Valeur maximum des indices passés à la fonction de dégradé (!!! >0 !!!) -GFX2_GLOBAL long Gradient_random_factor; // Facteur de mélange (1-256+) du dégradé -GFX2_GLOBAL Func_gradient Gradient_function; // Fonction de traitement du dégradé, varie selon la méthode choisie par l'utilisateur. -GFX2_GLOBAL Func_pixel Gradient_pixel; // Redirection de l'affichage +/// First color of the gradient. +GFX2_GLOBAL short Gradient_lower_bound; +/// Last color of the gradient +GFX2_GLOBAL short Gradient_upper_bound; +/// Boolean, true if the gradient should use colors in descending order +GFX2_GLOBAL int Gradient_is_inverted; +/// Number of colors in the range ::Gradient_lower_bound to ::Gradient_upper_bound (included) +GFX2_GLOBAL long Gradient_bounds_range; +/// Maximum value passed to the gradient function. The pixels assigned this value should use last gradient color. +GFX2_GLOBAL long Gradient_total_range; +/// Amount of randomness to use in gradient (1-256+) +GFX2_GLOBAL long Gradient_random_factor; +/// Pointer to a gradient function, depending on the selected method. +GFX2_GLOBAL Func_gradient Gradient_function; +/// +/// Pointer to the pixel-drawing function that gradients should use: +/// either ::Pixel (if the gradient must be drawn on menus only) +/// or ::Display_pixel (if the gradient must be drawn on the image) +GFX2_GLOBAL Func_pixel Gradient_pixel; +/// Settings for all gradients +GFX2_GLOBAL T_Gradient_array Gradient_array[16]; +/// Index in ::Gradient_array of the currently selected gradient. +GFX2_GLOBAL byte Current_gradient; -GFX2_GLOBAL T_Gradient_array Gradient_array[16]; // Données de tous les dégradés -GFX2_GLOBAL byte Current_gradient; // index du tableau correspondant au dégradé courant +// -- Airbrush data +/// Mode to use in airbrush: 0 for multicolor, 1 for mono. +GFX2_GLOBAL byte Airbrush_mode; +/// Diameter of the airbrush, in pixels. +GFX2_GLOBAL short Airbrush_size; +/// Delay between two airbrush "shots", in 1/100s +GFX2_GLOBAL byte Airbrush_delay; +/// Number of pixels that are emitted by the airbrush, in mono mode. +GFX2_GLOBAL byte Airbrush_mono_flow; +/// Number of pixels that are emitted by the airbrush for each color (multi mode) +GFX2_GLOBAL byte Airbrush_multi_flow[256]; +/// -- Misc data about the program - // Données sur le Spray: - -GFX2_GLOBAL byte Airbrush_mode; // Mode Mono(1) ou Multicolore(0) -GFX2_GLOBAL short Airbrush_size; // Diamètre du spray en pixels -GFX2_GLOBAL byte Airbrush_delay; // Délai en VBLs entre 2 "pschiitt" -GFX2_GLOBAL byte Airbrush_mono_flow; // Nombre de pixels qui sortent en même temps en mono -GFX2_GLOBAL byte Airbrush_multi_flow[256]; // Idem pour chaque couleur - - - // Données diverses sur le programme: - +/// Boolean, set to true to exit the program. GFX2_GLOBAL byte Quitting; -GFX2_GLOBAL char Initial_directory[256]; // Répertoire à partir duquel à été lancé le programme -GFX2_GLOBAL char Repertoire_des_donnees[256]; // Répertoire contenant les fichiers lus (interface graphique, etc) -GFX2_GLOBAL char Config_directory[256]; // Répertoire contenant les fichiers .ini et .cfg +/// Name of the directory that was current when the program was run. +GFX2_GLOBAL char Initial_directory[256]; +/// Name of the directory that holds the program's (read-only) data: skins, icon, etc. +GFX2_GLOBAL char Repertoire_des_donnees[256]; +/// Name of the directory where grafx2 reads and writes configuration (gfx2.ini, gfx2.cfg) +GFX2_GLOBAL char Config_directory[256]; +/// Current foreground color for drawing. GFX2_GLOBAL byte Fore_color; +/// Current background color for drawing. GFX2_GLOBAL byte Back_color; +/// For the "Freehand draw" tool, this determines which variant is selected, from ::OPERATION_CONTINUOUS_DRAW to ::OPERATION_FILLED_CONTOUR GFX2_GLOBAL byte Selected_operation; +/// For the Curve tool, this determines which variant is selected, either ::OPERATION_3_POINTS_CURVE or ::OPERATION_4_POINTS_CURVE GFX2_GLOBAL byte Selected_curve_mode; +/// For the Line tool, this determines which variant is selected, either ::OPERATION_LINE, ::OPERATION_K_LIGNE or ::OPERATION_CENTERED_LINES GFX2_GLOBAL byte Selected_line_mode; +/// Determines which color appears in the first cell of the menu palette. Change this value to "scroll" the palette. GFX2_GLOBAL byte First_color_in_palette; +/// Boolean, true if Grafx2 was run with a file as command-line argument, which must be open immediately. GFX2_GLOBAL byte File_in_command_line; -GFX2_GLOBAL byte Resolution_in_command_line; // utilisée uniquement si la variable précédente est à 1 +/// Boolean, true if Grafx2 was run with a command-line argument to set a resolution on startup (overrides config) +GFX2_GLOBAL byte Resolution_in_command_line; -// Les différents sprites: +// - Graphic skin data +/// Bitmap data for the menu, a single rectangle. GFX2_GLOBAL byte GFX_menu_block[MENU_HEIGHT][MENU_WIDTH]; +/// Bitmap data for the icons that are displayed over the menu. GFX2_GLOBAL byte GFX_menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH]; +/// Bitmap data for the different "effects" icons. GFX2_GLOBAL byte GFX_effect_sprite[NB_EFFECTS_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH]; - +/// Bitmap data for the Grafx2 logo that appears on splash screen. All 256 colors allowed. GFX2_GLOBAL byte * GFX_logo_grafx2; - +/// Bitmap data for the classic 8x8 font used in menus etc. GFX2_GLOBAL byte GFX_system_font[256*8*8]; +/// Bitmap data for the "fun" 8x8 font used in menus etc. GFX2_GLOBAL byte GFX_fun_font [256*8*8]; +/// Bitmap data for the 6x8 font used in help screens. GFX2_GLOBAL byte GFX_help_font_norm [256][6][8]; +/// Bitmap data for the 6x8 font used in help screens ("bold" verstion). GFX2_GLOBAL byte GFX_bold_font [256][6][8]; // 12 // 34 +/// Bitmap data for the title font used in help screens. Top-left quarter. GFX2_GLOBAL byte GFX_help_font_t1 [64][6][8]; +/// Bitmap data for the title font used in help screens. Top-right quarter. GFX2_GLOBAL byte GFX_help_font_t2 [64][6][8]; +/// Bitmap data for the title font used in help screens. Bottom-left quarter. GFX2_GLOBAL byte GFX_help_font_t3 [64][6][8]; +/// Bitmap data for the title font used in help screens. Bottom-right quarter. GFX2_GLOBAL byte GFX_help_font_t4 [64][6][8]; +/// Bitmap data for the small 8x8 icons. +GFX2_GLOBAL byte GFX_icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH]; + +/// Pointer to the font selected for menus. It's either ::GFX_system_font or ::GFX_fun_font GFX2_GLOBAL byte * Menu_font; - // Les données de l'aide: +// -- Help data -GFX2_GLOBAL byte Current_help_section; // index de la table d'aide en cours de consultation -GFX2_GLOBAL word Help_position; // Numéro de la ligne d'aide en cours de consultation +/// Index of the ::Help_section shown by the Help screen. +GFX2_GLOBAL byte Current_help_section; +/// Line number of the help viewer, in current ::Help_section. 0 for top, increase value to scroll down. +GFX2_GLOBAL word Help_position; - // Données sur les opérations - -GFX2_GLOBAL word Operation_before_interrupt; // N° de l'opération en cours avant l'utilisation d'une interruption -GFX2_GLOBAL word Current_operation; // N° de l'opération en cours -GFX2_GLOBAL word Operation_stack[OPERATION_STACK_SIZE]; // Pile simplifiée -GFX2_GLOBAL byte Operation_stack_size; // Taille effective de la pile (0=vide) -GFX2_GLOBAL byte Operation_in_magnifier; // Indique si l'opération a commencé dans la partie Zoomée ou non +// -- Operation data +/// Index of the operation which was selected (ex: drawing rectangle) before the current interruption (ex: colorpicking). +GFX2_GLOBAL word Operation_before_interrupt; +/// Index of the current operation. This is the active "tool". +GFX2_GLOBAL word Current_operation; +/// +/// This stack is used to memorize all parameters needed during the course of +/// an operation. For example when drawing a rectangle: color, starting +/// coordinates, ending coordinates. +GFX2_GLOBAL word Operation_stack[OPERATION_STACK_SIZE]; +/// Number of parameters stored in ::Operation_stack (0=empty) +GFX2_GLOBAL byte Operation_stack_size; +/// Boolean, true if the operation (drawing) started in the magnified area. +GFX2_GLOBAL byte Operation_in_magnifier; +/// Last color hovered by the colorpicker. -1 if it wasn't over the image. GFX2_GLOBAL short Colorpicker_color; +/// Position of the colorpicker tool, in image coordinates. GFX2_GLOBAL short Colorpicker_X; +/// Position of the colorpicker tool, in image coordinates. GFX2_GLOBAL short Colorpicker_Y; #ifdef GLOBAL_VARIABLES byte CURSOR_FOR_OPERATION[NB_OPERATIONS]= { - CURSOR_SHAPE_TARGET , // Dessin à la main continu - CURSOR_SHAPE_TARGET , // Dessin à la main discontinu - CURSOR_SHAPE_TARGET , // Dessin à la main point par point - CURSOR_SHAPE_TARGET , // Contour fill - CURSOR_SHAPE_TARGET , // Lignes - CURSOR_SHAPE_TARGET , // Lignes reliées - CURSOR_SHAPE_TARGET , // Lignes centrées - CURSOR_SHAPE_XOR_TARGET , // Rectangle vide - CURSOR_SHAPE_XOR_TARGET , // Rectangle plein - CURSOR_SHAPE_TARGET , // Cercles vides - CURSOR_SHAPE_TARGET , // Cercles pleins - CURSOR_SHAPE_TARGET , // Ellipses vides - CURSOR_SHAPE_TARGET , // Ellipses pleines + CURSOR_SHAPE_TARGET , // Freehand continuous draw + CURSOR_SHAPE_TARGET , // Freehand discontinuous draw + CURSOR_SHAPE_TARGET , // Freehand point-by-point draw + CURSOR_SHAPE_TARGET , // Filled contour + CURSOR_SHAPE_TARGET , // Lines + CURSOR_SHAPE_TARGET , // Linked lines + CURSOR_SHAPE_TARGET , // Centered lines + CURSOR_SHAPE_XOR_TARGET , // Empty rectangle + CURSOR_SHAPE_XOR_TARGET , // Filled rectangle + CURSOR_SHAPE_TARGET , // Empty circle + CURSOR_SHAPE_TARGET , // Filled circle + CURSOR_SHAPE_TARGET , // Empty ellipse + CURSOR_SHAPE_TARGET , // Filled ellipse CURSOR_SHAPE_TARGET , // Fill - CURSOR_SHAPE_TARGET , // Replace - CURSOR_SHAPE_XOR_TARGET , // Prise de brosse rectangulaire - CURSOR_SHAPE_TARGET , // Prise d'une brosse multiforme - CURSOR_SHAPE_COLORPICKER , // Récupération d'une couleur - CURSOR_SHAPE_XOR_RECTANGLE , // Positionnement de la fenêtre de loupe - CURSOR_SHAPE_TARGET , // Courbe à 3 points - CURSOR_SHAPE_TARGET , // Courbe à 4 points - CURSOR_SHAPE_TARGET , // Spray - CURSOR_SHAPE_TARGET , // Polygone - CURSOR_SHAPE_TARGET , // Polyforme - CURSOR_SHAPE_TARGET , // Polyfill - CURSOR_SHAPE_TARGET , // Polyforme rempli - CURSOR_SHAPE_MULTIDIRECTIONNAL, // Scroll - CURSOR_SHAPE_TARGET , // Cercles dégradés - CURSOR_SHAPE_TARGET , // Ellipses dégradées - CURSOR_SHAPE_XOR_ROTATION , // Faire tourner brosse - CURSOR_SHAPE_XOR_TARGET , // Etirer brosse - CURSOR_SHAPE_TARGET , // Deformer brosse - CURSOR_SHAPE_XOR_TARGET , // Rectangle degrade + CURSOR_SHAPE_TARGET , // Color replacer + CURSOR_SHAPE_XOR_TARGET , // Rectangular brush grabbing + CURSOR_SHAPE_TARGET , // Polygonal brush grabbing + CURSOR_SHAPE_COLORPICKER , // Colorpicker + CURSOR_SHAPE_XOR_RECTANGLE , // Position the magnify window + CURSOR_SHAPE_TARGET , // Curve with 3 control points + CURSOR_SHAPE_TARGET , // Curve with 4 control points + CURSOR_SHAPE_TARGET , // Airbrush + CURSOR_SHAPE_TARGET , // Polygon + CURSOR_SHAPE_TARGET , // Polyform + CURSOR_SHAPE_TARGET , // Filled polygon + CURSOR_SHAPE_TARGET , // Filled polyform + CURSOR_SHAPE_MULTIDIRECTIONNAL , // Scroll (pan) + CURSOR_SHAPE_TARGET , // Gradient-filled circle + CURSOR_SHAPE_TARGET , // Gradient-filled ellipse + CURSOR_SHAPE_XOR_ROTATION , // Rotate brush + CURSOR_SHAPE_XOR_TARGET , // Stretch brush + CURSOR_SHAPE_TARGET , // Distort brush + CURSOR_SHAPE_XOR_TARGET , // Gradient-filled rectangle }; #else + /// ::Cursor_shape to use for each operation. extern byte CURSOR_FOR_OPERATION[NB_OPERATIONS]; #endif - - // Procédures à appeler: Opération,Mouse_K,State de la pile - +/// +/// Procedures to call for each state (determined by ::Operation_stack_size) of +/// each operation, and for each mouse state (no button,left button,right button) GFX2_GLOBAL struct { - byte Hide_cursor; // Booléen "il faut effacer le curseur pour l'opéra." - Func_action Action; // Action appelée + byte Hide_cursor; ///< Boolean: Need to hide/unhide cursor during this step + Func_action Action; ///< Function to call } Operation[NB_OPERATIONS][3][OPERATION_STACK_SIZE]; +// -- Fileselector data - -// Informations sur les lecteurs et autres images -GFX2_GLOBAL byte GFX_icon_sprite[NB_ICON_SPRITES][ICON_SPRITE_HEIGHT][ICON_SPRITE_WIDTH]; - - -// -- Section des informations sur les formats de fichiers ------------------ - - // Comptage du nb d'éléments dans la liste: +/// Number of elements in the current fileselector's ::Filelist GFX2_GLOBAL short Filelist_nb_elements; +/// Number of files in the current fileselector's ::Filelist GFX2_GLOBAL short Filelist_nb_files; +/// Number of directories in the current fileselector's ::Filelist GFX2_GLOBAL short Filelist_nb_directories; - // Tête de la liste chaînée: +/// Head of the linked list for the fileselector. GFX2_GLOBAL T_Fileselector_item * Filelist; -// ------------------- Inititialisation des formats connus ------------------- - -void Do_nothing(void); - -GFX2_GLOBAL signed char File_error; // 0: opération I/O OK - // 1: Error dès le début de l'opération - // 2: Error durant l'opération => données modifiées - //-1: Interruption du chargement d'une preview +// -- misc +/// +/// Indicator of error in previous file operations. +/// - 0: OK +/// - 1: Error when beginning operation. Existing data should be ok. +/// - 2: Error while operation was in progress. Data is modified. +/// - -1: Interruption of a preview. +GFX2_GLOBAL signed char File_error; +/// Current line number when reading/writing gfx2.ini GFX2_GLOBAL int Line_number_in_INI_file; - +/// +/// Pointer to a pixel-loading function. This is used by the generic loading +/// function to load a preview, a brush or an image. GFX2_GLOBAL Func_pixel Pixel_load_function; +/// +/// Pointer to a pixel-reading function. This is used by the generic saving +/// function to save a brush or an image. GFX2_GLOBAL Func_read Read_pixel_old; -/******************** - * Spécifique à SDL * - ********************/ +// -- Specific to SDL + +/// Pointer to the program's screen. GFX2_GLOBAL SDL_Surface * Screen_SDL; +/// Pointer to the current joystick controller. GFX2_GLOBAL SDL_Joystick* Joystick; -#define KEY_NONE 0 +/// Indicates "no keyboard shortcut". +#define KEY_NONE 0 +/// +/// This is the "key identifier" for the mouse 3rd button. +/// It was chosen to not conflict with any SDL key number. #define KEY_MOUSEMIDDLE (SDLK_LAST+1) +/// +/// This is the "key identifier" for the mouse wheelup. +/// It was chosen to not conflict with any SDL key number. #define KEY_MOUSEWHEELUP (SDLK_LAST+2) +/// +/// This is the "key identifier" for the mouse wheeldown. +/// It was chosen to not conflict with any SDL key number. #define KEY_MOUSEWHEELDOWN (SDLK_LAST+3) -#define KEY_JOYBUTTON (SDLK_LAST+4) +/// +/// This is the "key identifier" for joystick button number 0. +/// All numbers starting with this one are reserved for joystick buttons +/// (since their is an unknown number of them, and for example 18 on GP2X) +/// It was chosen to not conflict with any SDL key number. +#define KEY_JOYBUTTON (SDLK_LAST+4) #ifdef __gp2x__ #define KEY_ESC (KEY_JOYBUTTON+GP2X_BUTTON_X) #else + /// + /// This is the key identifier for ESC. When hard-coding keyboard shortcuts + /// for buttons, etc. we use this instead of SDLK_ESCAPE, + /// so the GP2X port can get a joybutton equivalent of it. #define KEY_ESC SDLK_ESCAPE #endif diff --git a/misc.c b/misc.c index ca599ccc..8e78f119 100644 --- a/misc.c +++ b/misc.c @@ -224,6 +224,7 @@ void Replace_a_color(byte old_color, byte New_color) Update_rect(0,0,0,0); // On peut TOUT a jour // C'est pas un problème car il n'y a pas de preview } +// FIXME: move to graph.c, it's the only caller void Ellipse_compute_limites(short horizontal_radius,short vertical_radius) { @@ -234,6 +235,7 @@ void Ellipse_compute_limites(short horizontal_radius,short vertical_radius) Ellipse_limit = Ellipse_horizontal_radius_squared * Ellipse_vertical_radius_squared; } +// FIXME: move to graph.c, it's the only caller byte Pixel_in_ellipse(void) { qword ediesi = Ellipse_cursor_X * Ellipse_cursor_X * Ellipse_vertical_radius_squared + @@ -243,6 +245,7 @@ byte Pixel_in_ellipse(void) return 0; } +// FIXME: move to graph.c, it's the only caller byte Pixel_in_circle(void) { if(Circle_cursor_X * Circle_cursor_X +