Grey out + and - buttons in palette screen.

Also, some doxygening in engine.c.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@780 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-05-06 12:15:27 +00:00
parent 2fa494f77e
commit 68fdd5175c
2 changed files with 30 additions and 17 deletions

View File

@ -16,9 +16,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/ */
// /// @file Window engine and interface management
// Ce fichier contient la gestion du moteur
//
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -57,8 +55,10 @@ byte Smooth_mode_before_cancel;
byte Tiling_mode_before_cancel; byte Tiling_mode_before_cancel;
Func_effect Effect_function_before_cancel; Func_effect Effect_function_before_cancel;
///This table holds pointers to the saved window backgrounds. We can have up to 8 windows open at a time.
byte* Window_background[8]; byte* Window_background[8];
///Disables all the effects
void Cancel_effects(void) void Cancel_effects(void)
{ {
Shade_mode_before_cancel=Shade_mode; Shade_mode_before_cancel=Shade_mode;
@ -87,7 +87,7 @@ void Cancel_effects(void)
} }
//----------------- Restaurer les effets des modes de dessin ----------------- ///Get the effects and drawing modes back
void Restore_effects(void) void Restore_effects(void)
{ {
Shade_mode =Shade_mode_before_cancel; Shade_mode =Shade_mode_before_cancel;
@ -101,6 +101,7 @@ void Restore_effects(void)
} }
///Table of tooltip texts for menu buttons
char * Menu_tooltip[NB_BUTTONS]= char * Menu_tooltip[NB_BUTTONS]=
{ {
"Paintbrush choice ", "Paintbrush choice ",
@ -142,7 +143,8 @@ char * Menu_tooltip[NB_BUTTONS]=
"Color #" , "Color #" ,
"Hide tool bar " "Hide tool bar "
}; };
// Sauvegarde un bloc (généralement l'arrière-plan d'une fenêtre)
///Save a screen block (usually before erasing it with a new window or a dropdown menu)
void Save_background(byte **buffer, int x_pos, int y_pos, int width, int height) void Save_background(byte **buffer, int x_pos, int y_pos, int width, int height)
{ {
int index; int index;
@ -151,7 +153,8 @@ void Save_background(byte **buffer, int x_pos, int y_pos, int width, int height)
for (index=0; index<(height*Menu_factor_Y); index++) for (index=0; index<(height*Menu_factor_Y); index++)
Read_line(x_pos,y_pos+index,width*Menu_factor_X,(*buffer)+((int)index*width*Menu_factor_X*Pixel_width)); Read_line(x_pos,y_pos+index,width*Menu_factor_X,(*buffer)+((int)index*width*Menu_factor_X*Pixel_width));
} }
// Restaure de ce que la fenêtre cachait
///Restores a screen block
void Restore_background(byte *buffer, int x_pos, int y_pos, int width, int height) void Restore_background(byte *buffer, int x_pos, int y_pos, int width, int height)
{ {
int index; int index;
@ -159,7 +162,8 @@ void Restore_background(byte *buffer, int x_pos, int y_pos, int width, int heigh
Display_line_fast(x_pos,y_pos+index,width*Menu_factor_X,buffer+((int)index*width*Menu_factor_X*Pixel_width)); Display_line_fast(x_pos,y_pos+index,width*Menu_factor_X,buffer+((int)index*width*Menu_factor_X*Pixel_width));
free(buffer); free(buffer);
} }
// Ecrit un pixel dans un fond de fenêtre
///Draw a pixel in a saved screen block (when you sort colors in the palette, for example)
void Pixel_background(int x_pos, int y_pos, byte color) void Pixel_background(int x_pos, int y_pos, byte color)
{ {
int x_repetition=Pixel_width; int x_repetition=Pixel_width;
@ -168,7 +172,7 @@ void Pixel_background(int x_pos, int y_pos, byte color)
} }
///Guess the number of the button that was just clicked
int Button_under_mouse(void) int Button_under_mouse(void)
{ {
int btn_number; int btn_number;
@ -211,6 +215,7 @@ int Button_under_mouse(void)
} }
///Draw the frame for a menu button
void Draw_menu_button_frame(byte btn_number,byte pressed) void Draw_menu_button_frame(byte btn_number,byte pressed)
{ {
byte color_top_left; byte color_top_left;
@ -329,7 +334,7 @@ void Draw_menu_button_frame(byte btn_number,byte pressed)
} }
//---------------------- Désenclenchement d'un bouton ------------------------ ///Deselect a button
void Unselect_button(int btn_number) void Unselect_button(int btn_number)
{ {
if (Buttons_Pool[btn_number].Pressed) if (Buttons_Pool[btn_number].Pressed)
@ -344,7 +349,7 @@ void Unselect_button(int btn_number)
} }
//-Enclenchement d'un bouton (et désenclenchement de ceux de la même famille)- ///Select a button and disable all his family (for example, selecting "freehand" unselect "curves", "lines", ...)
void Select_button(int btn_number,byte click) void Select_button(int btn_number,byte click)
{ {
int family; int family;
@ -437,9 +442,7 @@ void Select_button(int btn_number,byte click)
} }
///Moves the splitbar between zoom and standard views
//--- Déplacer la barre de séparation entre la partie zoomée et la partie ----
//------------------ non-zoomée lorsqu'on est en mode loupe ------------------
void Move_separator(void) void Move_separator(void)
{ {
short old_main_separator_position=Main_separator_position; short old_main_separator_position=Main_separator_position;
@ -504,7 +507,7 @@ void Move_separator(void)
} }
//======================= Gestion principale du moteur ======================= ///Main handler for everything. This is the main loop of the program
void Main_handler(void) void Main_handler(void)
{ {
static byte temp_color; static byte temp_color;
@ -1461,9 +1464,10 @@ T_Normal_button * Window_set_normal_button(word x_pos, word y_pos,
temp->Number =Window_nb_buttons; temp->Number =Window_nb_buttons;
temp->Pos_X =x_pos; temp->Pos_X =x_pos;
temp->Pos_Y =y_pos; temp->Pos_Y =y_pos;
temp->Width =width; temp->Width =width;
temp->Height =height; temp->Height =height;
temp->Shortcut=shortcut; temp->Clickable=clickable;
temp->Shortcut =shortcut;
temp->Repeatable=0; temp->Repeatable=0;
temp->Next=Window_normal_button_list; temp->Next=Window_normal_button_list;

View File

@ -1824,6 +1824,10 @@ void Button_Palette(void)
Print_in_window(211,71,"S",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(238,71,"L",MC_Dark,MC_Light);
Componant_unit(256); Componant_unit(256);
// Display the + and - button as disabled
Window_draw_normal_bouton(266, 74,12,11,"+",0,0);
Window_draw_normal_bouton(266,165,12,11,"-",0,0);
} }
else else
{ {
@ -1832,8 +1836,13 @@ void Button_Palette(void)
Print_in_window(211,71,"G",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(238,71,"B",MC_Dark,MC_Light);
Componant_unit(RGB_scale); Componant_unit(RGB_scale);
// Display the + and - button as enabled
Window_draw_normal_bouton(266, 74,12,11,"+",0,1);
Window_draw_normal_bouton(266,165,12,11,"-",0,1);
} }
Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette); Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette);
Update_rect(266,74,103,11);
break; break;
case 25 : // Sort palette case 25 : // Sort palette