New: Implemented the functions for previous and next user's colors. (Keys = and -) They use the Shade settings.

Minor display fix: In Shortcuts screen, explanation text can no longer overdraw the border.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@791 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-05-08 16:32:33 +00:00
parent 61f03d0921
commit 9d19d8785a
12 changed files with 110 additions and 68 deletions

View File

@ -40,7 +40,7 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h misc.h \
windows.h
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
buttons.h pages.h help.h sdlscreen.h errors.h op_c.h windows.h input.h \
palette.h
palette.h shade.h
$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h misc.h \
pxdouble.h pxwide.h
$(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h sdlscreen.h misc.h pxquad.h

View File

@ -84,38 +84,6 @@ void Bouton_***(void)
void Stencil_update_color(byte color);
void Stencil_tag_color(byte color, byte tag_color);
void Message_not_implemented(void)
{
short clicked_button;
Open_window(160,76,"Not available yet!");
Print_in_window(8,20,"This function will",MC_Black,MC_Light);
Print_in_window(12,28,"be implemented in",MC_Black,MC_Light);
Print_in_window(16,36,"a later version.",MC_Black,MC_Light);
Window_set_normal_button(60,53,40,14,"OK",1,1,SDLK_RETURN); // 1
Update_window_area(0,0,Window_width, Window_height);
Display_cursor();
do
clicked_button=Window_clicked_button();
while ((clicked_button<=0) && (Key!=KEY_ESC) && (Key!=SDLK_o));
if(clicked_button<=0) Key=0;
Close_window();
// Puisque cette fonction peut être appelée par plusieurs boutons et qu'on
// ne sait pas lequel c'est, on les désenclenche tous. De toutes façons, ça
// ne sert à rien d'essayer d'optimiser ça puisque l'utilisateur ne devrait
// pas souvent l'appeler, et en plus y'en a pas beaucoup à désenclencher. ;)
// Unselect_button(BUTTON_GRADRECT);
// Unselect_button(BUTTON_TEXT);
Display_cursor();
}
void Message_out_of_memory(void)
{
short clicked_button;

View File

@ -27,12 +27,6 @@
#include "struct.h"
/*!
Displays an error message when calling an unavailable function.
Only used in the beta versions for things we haven't coded yet.
*/
void Message_not_implemented(void);
/*!
Displays an error message when there is no more memory for the requested operation.
*/

View File

@ -661,23 +661,19 @@ void Main_handler(void)
Key=0;
break;
case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color
Message_not_implemented(); // !!! TEMPORAIRE !!!
//Special_Next_user_forecolor();
Special_next_user_forecolor();
Key=0;
break;
case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color
Message_not_implemented(); // !!! TEMPORAIRE !!!
//Special_Previous_user_forecolor();
Special_previous_user_forecolor();
Key=0;
break;
case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color
Message_not_implemented(); // !!! TEMPORAIRE !!!
//Special_Next_user_backcolor();
Special_next_user_backcolor();
Key=0;
break;
case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color
Message_not_implemented(); // !!! TEMPORAIRE !!!
//Special_Previous_user_backcolor();
Special_previous_user_backcolor();
Key=0;
break;
case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor

BIN
gfx2.cfg

Binary file not shown.

6
help.c
View File

@ -152,9 +152,9 @@ void Window_set_shortcut(int action_id)
// Zone de description
Window_display_frame_in(5,68,292,37);
Print_in_window(9,70,ConfigKey[config_index].Explanation1,MC_Black,MC_Light);
Print_in_window(9,78,ConfigKey[config_index].Explanation2,MC_Black,MC_Light);
Print_in_window(9,86,ConfigKey[config_index].Explanation3,MC_Black,MC_Light);
Print_in_window(8,70,ConfigKey[config_index].Explanation1,MC_Black,MC_Light);
Print_in_window(8,78,ConfigKey[config_index].Explanation2,MC_Black,MC_Light);
Print_in_window(8,86,ConfigKey[config_index].Explanation3,MC_Black,MC_Light);
// Shortcut 0
Window_set_normal_button(27,30,177,14,"",0,1,KEY_NONE); // 4

View File

@ -2222,12 +2222,26 @@ static const T_Help_table helptable_palette[] =
HELP_TEXT ("- Colors for best match:")
HELP_TEXT ("A menu in which you can select the colors")
HELP_TEXT ("that have not to be used for smoothing, for")
HELP_TEXT ("the transparency mode and for remapping.")
HELP_TEXT ("the transparency mode, and for remapping.")
HELP_TEXT ("")
HELP_TEXT ("- User's color series:")
HELP_TEXT ("A menu in which you can define color series")
HELP_TEXT ("for next/previous colors.")
HELP_TEXT ("*** Not implemented yet ***")
HELP_TEXT ("for next/previous user color shortcuts.")
HELP_TEXT ("It's the same settings than the shade mode.")
HELP_TEXT ("After you have some color ranges defined in")
HELP_TEXT ("this screen, you can use those shortcuts to")
HELP_TEXT ("move to the next or previous color according")
HELP_TEXT ("to your ranges:")
HELP_TEXT ("")
HELP_TEXT ("Foreground color")
HELP_TEXT ("")
HELP_LINK (" Next : %s", SPECIAL_NEXT_USER_FORECOLOR)
HELP_LINK (" Previous: %s", SPECIAL_PREVIOUS_USER_FORECOLOR)
HELP_TEXT ("")
HELP_TEXT ("Background color")
HELP_LINK (" Next : %s", SPECIAL_NEXT_USER_BACKCOLOR)
HELP_LINK (" Previous: %s", SPECIAL_PREVIOUS_USER_BACKCOLOR)
HELP_TEXT ("")
HELP_TEXT ("")
HELP_TEXT ("- Palette layout:")
HELP_TEXT ("Lets you customize the palette that appears")

View File

@ -34,6 +34,7 @@
#include "windows.h"
#include "input.h"
#include "palette.h"
#include "shade.h"
byte Palette_view_is_RGB = 1; // Indique si on est en HSL ou en RGB
@ -2165,7 +2166,7 @@ void Button_Secondary_palette(void)
Open_window(200,146,"Palettes");
Window_set_normal_button(10,20,180,14,"Colors for best match",12,1,SDLK_b); // 1
Window_set_normal_button(10,37,180,14,"User's color series" ,14,0,SDLK_s); // 2
Window_set_normal_button(10,37,180,14,"User's color series" ,14,1,SDLK_s); // 2
Window_set_normal_button(139,126,53,14,"OK" , 0,1,SDLK_RETURN); // 3
Window_set_normal_button( 80,126,53,14,"Cancel" , 0,1,KEY_ESC); // 4
Window_display_frame(10,55,122,66);
@ -2249,7 +2250,7 @@ void Button_Secondary_palette(void)
Window_draw_slider(rgb_scale_slider);
}
}
while (clicked_button!=1 && clicked_button!=3 && clicked_button!=4);
while (clicked_button!=1 && clicked_button!=2 && clicked_button!=3 && clicked_button!=4);
// We need to get the sliders positions before closing the window, because they will be freed.
palette_cols=256-columns_slider->Position;
@ -2285,6 +2286,13 @@ void Button_Secondary_palette(void)
{
Menu_tag_colors("Tag colors to exclude",Exclude_color,&dummy,1, NULL);
}
else if (clicked_button==2)
{
// Open the menu with Shade settings. Same as the shortcut, except
// that this will not activate shade mode on exit.
Shade_settings_menu();
}
if (palette_needs_redraw)
{
Change_palette_cells();

26
shade.c
View File

@ -990,20 +990,21 @@ int Menu_shade(void)
return (clicked_button==5);
}
void Button_Shade_menu(void)
/// Handles the screen with Shade settings.
/// @return true if user clicked ok, false if he cancelled
int Shade_settings_menu(void)
{
T_Shade * initial_shade_list; // Anciennes données des shades
byte old_shade; // old n° de shade actif
int return_code;
// Backup des anciennes données
initial_shade_list=(T_Shade *)malloc(sizeof(Shade_list));
memcpy(initial_shade_list,Shade_list,sizeof(Shade_list));
old_shade=Shade_current;
if (!Menu_shade()) // Cancel
return_code = Menu_shade();
if (!return_code) // Cancel
{
memcpy(Shade_list,initial_shade_list,sizeof(Shade_list));
Shade_current=old_shade;
@ -1014,18 +1015,25 @@ void Button_Shade_menu(void)
Shade_list[Shade_current].Step,
Shade_list[Shade_current].Mode,
Shade_table_left,Shade_table_right);
// Si avant de rentrer dans le menu on n'était pas en mode Shade
if (!Shade_mode)
Button_Shade_mode(); // => On y passe (cool!)
}
free(initial_shade_list);
Display_cursor();
return return_code;
}
void Button_Shade_menu(void)
{
if (Shade_settings_menu())
{
// If user clicked OK while in the menu, activate Shade mode.
if (!Shade_mode)
Button_Shade_mode();
}
}
void Button_Quick_shade_menu(void)

View File

@ -27,4 +27,6 @@
void Button_Quick_shade_menu(void);
int Shade_settings_menu(void);
#endif // SHADE_H_INCLUDED

View File

@ -212,7 +212,7 @@ void Bigger_paintbrush(void)
}
//--------------------- Passer à la ForeColor suivante -----------------------
//--------------------- Increase the ForeColor -----------------------
void Special_next_forecolor(void)
{
Hide_cursor();
@ -227,7 +227,7 @@ void Special_next_forecolor(void)
Display_cursor();
}
//-------------------- Passer à la ForeColor précédente ----------------------
//--------------------- Decrease the ForeColor -----------------------
void Special_previous_forecolor(void)
{
Hide_cursor();
@ -242,7 +242,7 @@ void Special_previous_forecolor(void)
Display_cursor();
}
//--------------------- Passer à la BackColor suivante -----------------------
//--------------------- Increase the BackColor -----------------------
void Special_next_backcolor(void)
{
Hide_cursor();
@ -251,7 +251,7 @@ void Special_next_backcolor(void)
Display_cursor();
}
//-------------------- Passer à la BackColor précédente ----------------------
//--------------------- Decrease the BackColor -----------------------
void Special_previous_backcolor(void)
{
Hide_cursor();
@ -260,6 +260,53 @@ void Special_previous_backcolor(void)
Display_cursor();
}
/// Picks the next foreground color, according to current shade table
void Special_next_user_forecolor(void)
{
Hide_cursor();
Frame_menu_color(MC_Black);
Fore_color=Shade_table_left[Fore_color];
Reposition_palette();
Display_foreback();
Frame_menu_color(MC_White);
Display_cursor();
}
/// Picks the previous foreground color, according to current shade table
void Special_previous_user_forecolor(void)
{
Hide_cursor();
Frame_menu_color(MC_Black);
Fore_color=Shade_table_right[Fore_color];
Reposition_palette();
Display_foreback();
Frame_menu_color(MC_White);
Display_cursor();
}
/// Picks the next background color, according to current shade table
void Special_next_user_backcolor(void)
{
Hide_cursor();
Back_color=Shade_table_left[Back_color];
Display_foreback();
Display_cursor();
}
/// Picks the previous background color, according to current shade table
void Special_previous_user_backcolor(void)
{
Hide_cursor();
Back_color=Shade_table_right[Back_color];
Display_foreback();
Display_cursor();
}
// ------------------- Scroller l'écran (pas en mode loupe) ------------------
void Scroll_screen(short delta_x,short delta_y)

View File

@ -32,6 +32,11 @@ void Special_previous_forecolor(void);
void Special_next_backcolor(void);
void Special_previous_backcolor(void);
void Special_next_user_forecolor(void);
void Special_previous_user_forecolor(void);
void Special_next_user_backcolor(void);
void Special_previous_user_backcolor(void);
void Scroll_screen(short delta_x,short delta_y);
void Scroll_magnifier(short delta_x,short delta_y);