From b2feccc039cb4675791921f90d1da13e74ddb2bd Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 31 Oct 2009 18:11:13 +0000 Subject: [PATCH 1/4] Restored changes in main() that I overwrote in merge git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1127 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- main.c | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/main.c b/main.c index ade4ba8e..2ce2d961 100644 --- a/main.c +++ b/main.c @@ -170,18 +170,18 @@ void Error_function(int error_code, const char *filename, int line_number, const } // --------------------- Analyse de la ligne de commande --------------------- -void Analyze_command_line(int argc,char * argv[]) +void Analyze_command_line(int argc, char * argv[]) { char *buffer ; int index; - File_in_command_line=0; - Resolution_in_command_line=0; + File_in_command_line = 0; + Resolution_in_command_line = 0; - Current_resolution=Config.Default_resolution; + Current_resolution = Config.Default_resolution; - for (index=1; index 1) { - // plusieurs noms de fichier en argument + // Il y a déjà 2 noms de fichiers et on vient d'en trouver un 3ème Error(ERROR_COMMAND_LINE); Display_syntax(); exit(0); } else if (File_exists(argv[index])) { - File_in_command_line=1; + File_in_command_line ++; + buffer = Realpath(argv[index], NULL); - // On récupère le chemin complet du paramètre - // Et on découpe ce chemin en répertoire(path) + fichier(.ext) - buffer=Realpath(argv[index],NULL); + if (File_in_command_line == 1) + { + // Separate path from filename Extract_path(Main_file_directory, buffer); Extract_filename(Main_filename, buffer); + DEBUG(Main_filename, 0); + free(buffer); + } else { + Extract_path(Spare_file_directory, buffer); + Extract_filename(Spare_filename, buffer); + DEBUG(Spare_filename, 1); free(buffer); - chdir(Main_file_directory); + } } else { @@ -546,7 +553,7 @@ int Init_program(int argc,char * argv[]) if (temp) Error(temp); - Analyze_command_line(argc,argv); + Analyze_command_line(argc, argv); Current_help_section=0; Help_position=0; @@ -635,7 +642,7 @@ int Init_program(int argc,char * argv[]) // Brouillon_* et pas les infos contenues dans la page de brouillon // elle-même ne m'inspire pas confiance mais ça a l'air de marcher sans // poser de problèmes, alors... - if (File_in_command_line) + if (File_in_command_line == 1) { strcpy(Spare_file_directory,Spare_current_directory); strcpy(Spare_filename,"NO_NAME.GIF"); @@ -793,10 +800,19 @@ int main(int argc,char * argv[]) if (Config.Opening_message && (!File_in_command_line)) Button_Message_initial(); - if (File_in_command_line) + switch (File_in_command_line) { + case 2: Button_Reload(); - Resolution_in_command_line=0; + DEBUG(Main_filename, 0); + DEBUG(Spare_filename, 0); + Button_Page(); + // no break ! proceed with the other file now + case 1: + Button_Reload(); + Resolution_in_command_line = 0; + default: + break; } } Main_handler(); From 1f7da7c52506631c568ab1d2916d54c30691a3a3 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 31 Oct 2009 23:32:32 +0000 Subject: [PATCH 2/4] Removed deprecated settings 'Mouse correction factor' (issue 23) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1128 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- global.h | 5 ----- readini.c | 4 ++-- saveini.c | 4 ++-- struct.h | 2 -- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/global.h b/global.h index a7082cb7..8a2fd8dc 100644 --- a/global.h +++ b/global.h @@ -112,11 +112,6 @@ GFX2_GLOBAL dword Key_ANSI; /// Boolean set to true when the OS/window manager requests the application to close. ie: [X] button GFX2_GLOBAL byte Quit_is_required; -/// Divisor for the mouse coordinates recieved. No target currently needs it, should be left at 1. -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. diff --git a/readini.c b/readini.c index a3cf1e7b..7e1b9ef8 100644 --- a/readini.c +++ b/readini.c @@ -469,13 +469,13 @@ int Load_INI(T_Config * conf) goto Erreur_Retour; if ((values[0]<0) || (values[0]>4)) goto Erreur_ERREUR_INI_CORROMPU; - conf->Mouse_fix_factor_X=Mouse_fix_factor_X=values[0]; + // Deprecated setting, unused if ((return_code=Load_INI_get_values (file,buffer,"Y_correction_factor",1,values))) goto Erreur_Retour; if ((values[0]<0) || (values[0]>4)) goto Erreur_ERREUR_INI_CORROMPU; - conf->Mouse_fix_factor_Y=Mouse_fix_factor_Y=values[0]; + // Deprecated setting, unused if ((return_code=Load_INI_get_values (file,buffer,"Cursor_aspect",1,values))) goto Erreur_Retour; diff --git a/saveini.c b/saveini.c index 39a153b6..543b8124 100644 --- a/saveini.c +++ b/saveini.c @@ -445,11 +445,11 @@ int Save_INI(T_Config * conf) if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Y_sensitivity",1,values,0))) goto Erreur_Retour; - values[0]=conf->Mouse_fix_factor_X; + values[0]=0; if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"X_correction_factor",1,values,0))) goto Erreur_Retour; - values[0]=conf->Mouse_fix_factor_Y; + values[0]=0; if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Y_correction_factor",1,values,0))) goto Erreur_Retour; diff --git a/struct.h b/struct.h index 9867b4dc..eac999a2 100644 --- a/struct.h +++ b/struct.h @@ -285,8 +285,6 @@ typedef struct byte Max_undo_pages; ///< Number of steps to memorize for Undo/Redo. byte Mouse_sensitivity_index_x; ///< Mouse sensitivity in X axis byte Mouse_sensitivity_index_y; ///< Mouse sensitivity in Y axis - byte Mouse_fix_factor_X; ///< Mouse correction factor in X axis. - byte Mouse_fix_factor_Y; ///< Mouse correction factor in Y axis. byte Mouse_merge_movement; ///< Number of SDL mouse events that are merged into a single change of mouse coordinates. byte Delay_left_click_on_slider; ///< Delay (in 1/100s) between two activations of a repeatable button when you hold left-click. byte Delay_right_click_on_slider; ///< Delay (in 1/100s) between two activations of a repeatable button when you hold left-click. From 1582d9e6d9257d4b624e944b81efe5e6b4acbfce Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 31 Oct 2009 23:57:32 +0000 Subject: [PATCH 3/4] Contextual help for skin window git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1129 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 2 ++ helpfile.h | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/buttons.c b/buttons.c index 75e0eba6..f6008f3e 100644 --- a/buttons.c +++ b/buttons.c @@ -1121,6 +1121,8 @@ void Button_Skins(void) do { clicked_button=Window_clicked_button(); + if (Is_shortcut(Key,0x100+BUTTON_HELP)) + Window_help(BUTTON_SETTINGS, "SKINS"); switch(clicked_button) { diff --git a/helpfile.h b/helpfile.h index 748794f7..a3938903 100644 --- a/helpfile.h +++ b/helpfile.h @@ -2065,11 +2065,6 @@ static const T_Help_table helptable_settings[] = HELP_TEXT ("some particular files or directories must be") HELP_TEXT ("displayed by the fileselectors or not.") HELP_TEXT ("") - HELP_TEXT ("- Show/Hide picture limits: Indicates if the") - HELP_TEXT ("picture boundaries must be displayed when") - HELP_TEXT ("you are in a resolution bigger than the") - HELP_TEXT ("picture.") - HELP_TEXT ("") HELP_TEXT ("- Clear palette: Indicates if loading a file") HELP_TEXT ("with a palette of less than 256 colors must") HELP_TEXT ("erase the rest of the current palette") @@ -2117,9 +2112,6 @@ static const T_Help_table helptable_settings[] = HELP_TEXT ("placing the handle in the center of the") HELP_TEXT ("brush.") HELP_TEXT ("") - HELP_TEXT ("- Separate colors: Draws a squaring around") - HELP_TEXT ("the colors of the tool-bar.") - HELP_TEXT ("") HELP_TEXT ("- Auto-set resolution: sets the best") HELP_TEXT ("resolution for the loaded image.") HELP_TEXT ("") @@ -2151,9 +2143,10 @@ static const T_Help_table helptable_settings[] = HELP_TEXT ("GrafX2 with a classical font, or another one") HELP_TEXT ("a bit funnier.") HELP_TEXT ("") - HELP_TEXT ("- Cursor: allows you to choose whether you") - HELP_TEXT ("prefer a solid cursor or a transparent") - HELP_TEXT ("cursor.") + HELP_TEXT ("- Cursor: Allows you to choose the graphic") + HELP_TEXT ("mouse cursor: Solid and Thin are solid black") + HELP_TEXT ("and white cursors defined by the skin file,") + HELP_TEXT (" Transparent is a 1-pixel wide XOR cross.") HELP_TEXT ("") HELP_TEXT ("- Graphic file: you can change the whole") HELP_TEXT ("interface by selecting where the sprites for") @@ -2165,6 +2158,15 @@ static const T_Help_table helptable_settings[] = HELP_TEXT ("days of Sunset Design. If you create a good") HELP_TEXT ("skin, feel free to share it with us! We may") HELP_TEXT ("include it in a future release...") + HELP_TEXT ("") + HELP_TEXT ("- Separate colors: Draws a squaring around") + HELP_TEXT ("the colors of the tool-bar.") + HELP_TEXT ("") + HELP_TEXT ("- Show/Hide picture limits: Indicates if the") + HELP_TEXT ("picture boundaries must be displayed when") + HELP_TEXT ("you are in a resolution bigger than the") + HELP_TEXT ("picture.") + HELP_TEXT ("") }; static const T_Help_table helptable_clear[] = { From 373e39abe8f2e4b045a3f1e1ebd97fda279bdf0e Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sun, 1 Nov 2009 00:17:48 +0000 Subject: [PATCH 4/4] Fix a mouse cursor that appeared on palette screen when opening palette git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1130 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- palette.c | 222 +++++++++++++++++++++++++++--------------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/palette.c b/palette.c index 20750ac8..b25eb280 100644 --- a/palette.c +++ b/palette.c @@ -801,46 +801,46 @@ void Button_Palette(void) // Graduation des jauges de couleur Block(Window_pos_X + (Menu_factor_X * 179), - Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 206), - Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 233), - Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 109), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 179), - Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 206), - Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 233), - Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 125), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 179), - Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 206), - Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); Block(Window_pos_X + (Menu_factor_X * 233), - Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, - MC_Dark); + Window_pos_Y + (Menu_factor_Y * 141), Menu_factor_X * 17, Menu_factor_Y, + MC_Dark); // Jauges de couleur red_slider = Window_set_scroller_button(182, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].R*Color_max/255);// 2 green_slider = Window_set_scroller_button(209, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].G*Color_max/255);// 3 blue_slider = Window_set_scroller_button(236, 81, 88,Color_count,1,Color_max-working_palette[Fore_color].B*Color_max/255);// 4 if(Palette_view_is_RGB==1) { - Print_in_window(184,71,"R",MC_Dark,MC_Light); - Print_in_window(211,71,"G",MC_Dark,MC_Light); - Print_in_window(238,71,"B",MC_Dark,MC_Light); + Print_in_window(184,71,"R",MC_Dark,MC_Light); + Print_in_window(211,71,"G",MC_Dark,MC_Light); + Print_in_window(238,71,"B",MC_Dark,MC_Light); Componant_unit(RGB_scale); } else { - Print_in_window(184,71,"H",MC_Dark,MC_Light); - Print_in_window(211,71,"S",MC_Dark,MC_Light); - Print_in_window(238,71,"L",MC_Dark,MC_Light); + Print_in_window(184,71,"H",MC_Dark,MC_Light); + Print_in_window(211,71,"S",MC_Dark,MC_Light); + Print_in_window(238,71,"L",MC_Dark,MC_Light); Componant_unit(256); } @@ -866,7 +866,7 @@ void Button_Palette(void) Window_set_normal_button( 6,32,59,14,"Spread" ,4,1,SDLK_e); // 10 reduce_dropdown = Window_set_dropdown_button(222, 17, 60, 14, 60, "Reduce", 0, - 0, 1, 1); // 11 + 0, 1, 1); // 11 Window_dropdown_add_item(reduce_dropdown, 0, "to 128"); Window_dropdown_add_item(reduce_dropdown, 1, "to 64"); Window_dropdown_add_item(reduce_dropdown, 2, "to 32"); @@ -893,27 +893,27 @@ void Button_Palette(void) Window_set_normal_button(96,32,29,14,"HSL" ,1,1,SDLK_h); // 22 Window_set_normal_button(96,47,29,14,"Srt" ,1,1,SDLK_s); // 23 - if (Config.Auto_nb_used) - { - Update_color_count(&used_colors,color_usage); - - Num2str(color_usage[Fore_color], str, 6); - Print_in_window(222, 33, str, MC_Black, MC_Light); - Print_in_window(222, 42, "pixels", MC_Dark, MC_Light); - } - - - // Dessin des petits effets spéciaux pour les boutons [+] et [-] Draw_thingumajig(263, 74,MC_White,-1); Draw_thingumajig(280, 74,MC_White,+1); Draw_thingumajig(263,165,MC_Dark,-1); Draw_thingumajig(280,165,MC_Dark,+1); - Update_window_area(0,0,299,188); - Display_cursor(); + if (Config.Auto_nb_used) + { + Update_color_count(&used_colors,color_usage); + + Hide_cursor(); + Print_in_window(222, 42, "pixels", MC_Dark, MC_Light); + Num2str(color_usage[Fore_color], str, 6); + Print_in_window(222, 33, str, MC_Black, MC_Light); + Display_cursor(); + } + + Update_window_area(0,0,299,188); + do { old_mouse_x=Mouse_X; @@ -962,8 +962,8 @@ void Button_Palette(void) Block(Window_pos_X+(Menu_factor_X*237),Window_pos_Y+(Menu_factor_Y*58),Menu_factor_X*56,Menu_factor_Y*7,MC_Light); Num2str(Fore_color,str,3); Print_in_window(237,58,str,MC_Black,MC_Light); - Num2str(color_usage[Fore_color], str, 6); - Print_in_window(222, 33, str, MC_Black, MC_Light); + Num2str(color_usage[Fore_color], str, 6); + Print_in_window(222, 33, str, MC_Black, MC_Light); Update_rect(Window_pos_X+(Menu_factor_X*237),Window_pos_Y+(Menu_factor_Y*58),Menu_factor_X*56,Menu_factor_Y*7); // Affichage des jauges @@ -994,13 +994,13 @@ void Button_Palette(void) Num2str(block_end ,str+4,3); str[3]=26; // Flèche vers la droite Print_in_window(237,58,str,MC_Black,MC_Light); - { - int pixel_count = 0; - for (i = block_start; i <= block_end; i++) - pixel_count += color_usage[i]; - Num2str(pixel_count, str, 6); - } - Print_in_window(222, 33, str, MC_Black, MC_Light); + { + int pixel_count = 0; + for (i = block_start; i <= block_end; i++) + pixel_count += color_usage[i]; + Num2str(pixel_count, str, 6); + } + Print_in_window(222, 33, str, MC_Black, MC_Light); // Affichage des jauges Display_sliders(red_slider,green_slider,blue_slider,1,NULL); @@ -1018,13 +1018,13 @@ void Button_Palette(void) Num2str(block_end ,str+4,3); str[3]=26; // Flèche vers la droite Print_in_window(237,58,str,MC_Black,MC_Light); - { - int pixel_count = 0; - for (i = block_start; i <= block_end; i++) - pixel_count += color_usage[i]; - Num2str(pixel_count, str, 6); - } - Print_in_window(222, 33, str, MC_Black, MC_Light); + { + int pixel_count = 0; + for (i = block_start; i <= block_end; i++) + pixel_count += color_usage[i]; + Num2str(pixel_count, str, 6); + } + Print_in_window(222, 33, str, MC_Black, MC_Light); // Affichage des jauges Display_sliders(red_slider,green_slider,blue_slider,1,NULL); @@ -1041,8 +1041,8 @@ void Button_Palette(void) Block(Window_pos_X+(Menu_factor_X*261),Window_pos_Y+(Menu_factor_Y*58),Menu_factor_X*32,Menu_factor_Y*7,MC_Light); Num2str(Fore_color,str,3); Print_in_window(237,58,str,MC_Black,MC_Light); - Num2str(Fore_color, str, 6); - Print_in_window(222, 33, str, MC_Black, MC_Light); + Num2str(Fore_color, str, 6); + Print_in_window(222, 33, str, MC_Black, MC_Light); // Affichage des jauges Display_sliders(red_slider,green_slider,blue_slider,0,working_palette); @@ -1439,66 +1439,66 @@ void Button_Palette(void) case 11: // Reduce memcpy(backup_palette, working_palette, sizeof(T_Palette)); - switch(Window_attribute2) // Get the dropdown value - { - case 0: // 128 - reduce_colors_number = 128; - break; - case 1: // 64 - reduce_colors_number = 64; - break; - case 2: // 32 - reduce_colors_number = 32; - break; - case 3: // 16 - reduce_colors_number = 16; - break; - case 4: // 8 - reduce_colors_number = 8; - break; - case 5: // 4 - reduce_colors_number = 4; - break; - case 6: // 2 - reduce_colors_number = 2; - break; - case 7: // other - reduce_colors_number - = Requester_window("Enter the max. number of colors", - reduce_colors_number); - if (reduce_colors_number < 2 || reduce_colors_number >= 256) - reduce_colors_number = -1; - break; - } + switch(Window_attribute2) // Get the dropdown value + { + case 0: // 128 + reduce_colors_number = 128; + break; + case 1: // 64 + reduce_colors_number = 64; + break; + case 2: // 32 + reduce_colors_number = 32; + break; + case 3: // 16 + reduce_colors_number = 16; + break; + case 4: // 8 + reduce_colors_number = 8; + break; + case 5: // 4 + reduce_colors_number = 4; + break; + case 6: // 2 + reduce_colors_number = 2; + break; + case 7: // other + reduce_colors_number + = Requester_window("Enter the max. number of colors", + reduce_colors_number); + if (reduce_colors_number < 2 || reduce_colors_number >= 256) + reduce_colors_number = -1; + break; + } - if (reduce_colors_number > 0) - { - if (!image_is_backed_up) - { - Backup(); - image_is_backed_up = 1; - } + if (reduce_colors_number > 0) + { + if (!image_is_backed_up) + { + Backup(); + image_is_backed_up = 1; + } - Reduce_palette(&used_colors, reduce_colors_number, working_palette, - color_usage); + Reduce_palette(&used_colors, reduce_colors_number, working_palette, + color_usage); - if ((Config.Safety_colors) && (used_colors<4)) - { - memcpy(temp_palette, Main_palette, sizeof(T_Palette)); - memcpy(Main_palette, working_palette, sizeof(T_Palette)); - Set_nice_menu_colors(color_usage, 0); - memcpy(working_palette, Main_palette, sizeof(T_Palette)); - memcpy(Main_palette, temp_palette, sizeof(T_Palette)); - } + if ((Config.Safety_colors) && (used_colors<4)) + { + memcpy(temp_palette, Main_palette, sizeof(T_Palette)); + memcpy(Main_palette, working_palette, sizeof(T_Palette)); + Set_nice_menu_colors(color_usage, 0); + memcpy(working_palette, Main_palette, sizeof(T_Palette)); + memcpy(Main_palette, temp_palette, sizeof(T_Palette)); + } - Set_palette(working_palette); // On définit la nouvelle palette - Draw_all_palette_sliders(red_slider, green_slider, blue_slider, - working_palette, block_start, block_end); - memcpy(temp_palette, working_palette, sizeof(T_Palette)); + Set_palette(working_palette); // On définit la nouvelle palette + Draw_all_palette_sliders(red_slider, green_slider, blue_slider, + working_palette, block_start, block_end); + memcpy(temp_palette, working_palette, sizeof(T_Palette)); - End_of_modification(); - need_to_remap = 1; - } + End_of_modification(); + need_to_remap = 1; + } break; case 12: // Undo