diff --git a/Makefile.dep b/Makefile.dep index 168d260b..8b1b065e 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -14,7 +14,7 @@ $(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h input.h engine.h pages.h layers.h $(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h engine.h errors.h \ filesel.h loadsave.h global.h graph.h io.h misc.h pages.h readline.h \ - sdlscreen.h windows.h palette.h + sdlscreen.h windows.h palette.h input.h help.h $(OBJDIR)/fileformats.o: fileformats.c errors.h global.h struct.h const.h \ loadsave.h misc.h io.h windows.h pages.h $(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \ diff --git a/buttons.c b/buttons.c index be3f32b6..173dc301 100644 --- a/buttons.c +++ b/buttons.c @@ -646,9 +646,9 @@ void Button_Clear(void) Hide_cursor(); Backup(); if (Stencil_mode && Config.Clear_with_stencil) - Hide_current_image_with_stencil(0,Stencil); + Clear_current_image_with_stencil(Main_backups->Pages->Transparent_color,Stencil); else - Hide_current_image(0); + Clear_current_image(Main_backups->Pages->Transparent_color); Redraw_layered_image(); Display_all_screen(); End_of_modification(); @@ -661,9 +661,9 @@ void Button_Clear_with_backcolor(void) Hide_cursor(); Backup(); if (Stencil_mode && Config.Clear_with_stencil) - Hide_current_image_with_stencil(Back_color,Stencil); + Clear_current_image_with_stencil(Back_color,Stencil); else - Hide_current_image(Back_color); + Clear_current_image(Back_color); Redraw_layered_image(); Display_all_screen(); End_of_modification(); diff --git a/const.h b/const.h index d79a8606..9d6d5024 100644 --- a/const.h +++ b/const.h @@ -71,6 +71,7 @@ /// Character to display in menus for an ellipsis. #define ELLIPSIS_CHARACTER '…' #define NB_LAYERS 1 ///< Initial number of layers for a new image +#define MAX_NB_LAYERS 16 ///< Maximum number of layers that can be used in grafx2. Note that 32 is upper limit because of a few bit fields. #define BRUSH_CONTAINER_PREVIEW_WIDTH 16 ///< Size for preview of a brush in Brush container #define BRUSH_CONTAINER_PREVIEW_HEIGHT 16 ///< Size for preview of a brush in Brush container #define BRUSH_CONTAINER_COLUMNS 4 ///< Number of columns in the Brush container diff --git a/factory.c b/factory.c index d8b5df0a..93789de7 100644 --- a/factory.c +++ b/factory.c @@ -38,6 +38,8 @@ #include "sdlscreen.h" #include "windows.h" #include "palette.h" +#include "input.h" // Is_shortcut() +#include "help.h" // Window_help() #ifdef __ENABLE_LUA__ @@ -768,8 +770,11 @@ void Button_Brush_Factory(void) Update_window_area(0, 0, Window_width, Window_height); Display_cursor(); - do { + do + { clicked_button = Window_clicked_button(); + if (Is_shortcut(Key,0x100+BUTTON_HELP)) + Window_help(BUTTON_BRUSH_EFFECTS, "BRUSH FACTORY"); switch (clicked_button) { diff --git a/graph.c b/graph.c index b85f6695..efc0e96b 100644 --- a/graph.c +++ b/graph.c @@ -592,7 +592,6 @@ try_again: Position_screen_according_to_zoom(); Compute_limits(); Compute_paintbrush_coordinates(); - Display_all_screen(); Resize_width=0; Resize_height=0; diff --git a/helpfile.h b/helpfile.h index df27a0c0..67d02fb0 100644 --- a/helpfile.h +++ b/helpfile.h @@ -1284,6 +1284,30 @@ static const T_Help_table helptable_brush_fx[] = HELP_TEXT ("") HELP_LINK ("- Save : (Key:%s)",SPECIAL_SAVE_BRUSH) HELP_TEXT ("Save a brush to disk.") + HELP_TEXT ("") + HELP_TEXT ("") + HELP_TEXT ("") + HELP_TITLE("BRUSH FACTORY") + HELP_TEXT ("") + HELP_TEXT ("This menu allows you to run scripts. Scripts") + HELP_TEXT ("are written in the Lua language, and allow") + HELP_TEXT ("you to modify the brush (hence the name") + HELP_TEXT ("'Brush factory'), or even modify the image") + HELP_TEXT ("or palette, like a Photoshop filter. See") + HELP_TEXT ("the online documentation for more help") + HELP_TEXT ("on scripting.") + HELP_TEXT ("") + HELP_TEXT ("You can select a script with the selector,") + HELP_TEXT ("the bottom panel shows a short description") + HELP_TEXT ("of what it does, and you can click Run to") + HELP_TEXT ("launch it.") + HELP_TEXT ("") + HELP_TEXT ("The scripts are located in the application's") + HELP_TEXT ("data folder, under the '/scripts'") + HELP_TEXT ("subdirectory. The list is refreshed each") + HELP_TEXT ("time you open the window. Scripts are loaded") + HELP_TEXT ("from disk when you run them.") + HELP_TEXT ("") }; static const T_Help_table helptable_effects[] = { @@ -2187,7 +2211,8 @@ static const T_Help_table helptable_clear[] = HELP_BOLD ("LEFT CLICK") HELP_LINK ("(Key:%s)",0x100+BUTTON_CLEAR) HELP_TEXT ("") - HELP_TEXT ("Clears the picture with the color number 0.") + HELP_TEXT ("Clears the picture with the color number 0,") + HELP_TEXT ("or the transparent color of the picture.") HELP_TEXT ("") HELP_BOLD ("RIGHT CLICK") HELP_LINK ("(Key:%s)",0x200+BUTTON_CLEAR) @@ -2500,7 +2525,22 @@ static const T_Help_table helptable_layermenu[] = HELP_TEXT ("") HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_MENU) HELP_TEXT ("") - HELP_TEXT ("* Not implemented yet! *") + HELP_TEXT ("In this menu you can set the following") + HELP_TEXT ("options:") + HELP_TEXT ("") + HELP_TEXT ("* Transparent color : This determines which") + HELP_TEXT ("color index is considered transparent when") + HELP_TEXT ("using layers. Click the button and then") + HELP_TEXT ("click on the image to pick the right color,") + HELP_TEXT ("or use ESC to cancel.") + HELP_TEXT ("") + HELP_TEXT ("* Transparent background : When this option") + HELP_TEXT ("is checked, all pixels of the transparent") + HELP_TEXT ("color on layer 1 (background layer) will") + HELP_TEXT ("be tagged as transparent in the final image.") + HELP_TEXT ("Check this option if you want to make a") + HELP_TEXT ("transparent GIF or PNG. These are the only") + HELP_TEXT ("file formats that support this option.") }; static const T_Help_table helptable_layertrans[] = diff --git a/hotkeys.c b/hotkeys.c index 85f98bdf..31e28ac1 100644 --- a/hotkeys.c +++ b/hotkeys.c @@ -903,9 +903,9 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { 0}, {104, "Clear page", - "Clears the picture with the first", - "color of the palette (usually black)", - "", + "Clears the picture with color 0,", + "or the transparent color if it's", + "a layered image.", true, SDLK_BACKSPACE, // BackSpace 0}, @@ -1471,8 +1471,8 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = { 0}, {180, "Layers menu", - "Opens the window with layer options.", - "", + "Opens a window with options related", + "to layers and image transparency.", "", true, SDLK_HOME|MOD_ALT, // Alt + Home diff --git a/layers.c b/layers.c index 1b3a27c0..6b8abfb9 100644 --- a/layers.c +++ b/layers.c @@ -97,7 +97,7 @@ void Button_Layer_add(void) { Hide_cursor(); - if (Main_backups->Pages->Nb_layers < 32) + if (Main_backups->Pages->Nb_layers < MAX_NB_LAYERS) { // Backup with unchanged layers Backup_layers(0); @@ -212,8 +212,8 @@ void Button_Layer_menu(void) { clicked_button=Window_clicked_button(); - //if (Is_shortcut(Key,0x100+BUTTON_HELP)) - // Window_help(BUTTON_LAYERS, NULL); + if (Is_shortcut(Key,0x100+BUTTON_HELP)) + Window_help(BUTTON_LAYER_MENU, NULL); switch(clicked_button) { case 1: // color diff --git a/misc.c b/misc.c index f53f90cf..cf960bea 100644 --- a/misc.c +++ b/misc.c @@ -173,7 +173,7 @@ void Wait_end_of_click(void) while(Mouse_K) if(!Get_input()) SDL_Delay(20); } -void Hide_current_image_with_stencil(byte color, byte * stencil) +void Clear_current_image_with_stencil(byte color, byte * stencil) //Effacer l'image courante avec une certaine couleur en mode Stencil { int nb_pixels=0; //ECX @@ -192,7 +192,7 @@ void Hide_current_image_with_stencil(byte color, byte * stencil) } } -void Hide_current_image(byte color) +void Clear_current_image(byte color) // Effacer l'image courante avec une certaine couleur { memset( diff --git a/misc.h b/misc.h index 31be15a9..4a6010e5 100644 --- a/misc.h +++ b/misc.h @@ -40,8 +40,8 @@ void Set_color(byte color, byte red, byte green, byte blue); void Set_palette(T_Palette palette); void Palette_256_to_64(T_Palette palette); void Palette_64_to_256(T_Palette palette); -void Hide_current_image(byte color); -void Hide_current_image_with_stencil(byte color, byte * stencil); +void Clear_current_image(byte color); +void Clear_current_image_with_stencil(byte color, byte * stencil); void Slider_timer(byte speed); dword Round_div(dword numerator,dword divisor); word Count_used_colors(dword * usage); diff --git a/pages.c b/pages.c index 9abe14a9..de7fccec 100644 --- a/pages.c +++ b/pages.c @@ -807,7 +807,7 @@ int Backup_with_new_dimensions(int upload,byte layers,int width,int height) { for (i=0; iPages->Image[i], 0, width*height); + memset(Main_backups->Pages->Image[i], Main_backups->Pages->Transparent_color, width*height); } Update_buffers(width, height); @@ -859,7 +859,7 @@ int Backup_and_resize_the_spare(int width,int height) for (i=0; iPages->Image[i], 0, width*height); + memset(Spare_backups->Pages->Image[i], Spare_backups->Pages->Transparent_color, width*height); } // Update_buffers(width, height); // Not for spare @@ -1106,8 +1106,7 @@ byte Add_layer(T_List_of_pages *list, byte layer) source_page = list->Pages; - // Hard limit of 32 at the moment, because layer bitmasks are 32bit. - if (list->Pages->Nb_layers == 32) + if (list->Pages->Nb_layers == MAX_NB_LAYERS) return 1; // Keep the position reasonable diff --git a/windows.c b/windows.c index ff8a9738..18a47a5d 100644 --- a/windows.c +++ b/windows.c @@ -478,7 +478,7 @@ void Display_layerbar(void) if (horiz_space/button_width < button_number) button_number = horiz_space/button_width; // Only 16 icons at the moment - if (button_number > 16) + if (button_number > 16) // can be different from MAX_NB_LAYERS button_number = 16; // Enlarge the buttons themselves if there's enough room @@ -2582,15 +2582,15 @@ void Display_all_screen(void) if (Main_magnifier_mode) { if (Main_image_widthPages->Transparent_color); } else { if (Main_image_widthPages->Transparent_color); } if (Main_image_heightPages->Transparent_color); // ---/\/\/\ Partie zoomée: /\/\/\--- if (Main_magnifier_mode) @@ -2616,9 +2616,9 @@ void Display_all_screen(void) if (Main_image_widthPages->Transparent_color); if (Main_image_heightPages->Transparent_color); } // ---/\/\/\ Affichage des limites /\/\/\---