Commit eba26aaa authored by Adrien Destugues's avatar Adrien Destugues

Merge trunk to the cpcmode5 branch. This gets us a more recent grafx2 with the...

Merge trunk to the cpcmode5 branch. This gets us a more recent grafx2 with the cpcmode5 drawing. Now to make this mode optional so users can still work in regular mode :)

git-svn-id: svn://pulkomandy.tk/GrafX2/branches/[email protected] 416bcca6-2ee7-4201-b75f-2eb2f807beb1
parent 4e60f5ad
This diff is collapsed.
$(OBJDIR)/SFont.o: SFont.c SFont.h
$(OBJDIR)/brush.o: brush.c global.h struct.h const.h graph.h misc.h errors.h \
windows.h sdlscreen.h brush.h
$(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h engine.h \
......@@ -5,12 +6,13 @@ $(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h engine.h \
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
readline.h filesel.h loadsave.h init.h buttons.h operatio.h pages.h \
palette.h errors.h readini.h saveini.h shade.h io.h help.h text.h \
sdlscreen.h windows.h brush.h input.h special.h
sdlscreen.h windows.h brush.h input.h special.h setup.h
$(OBJDIR)/buttons_effects.o: buttons_effects.c buttons.h struct.h const.h engine.h \
global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h
global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h \
brush.h
$(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h \
buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \
input.h engine.h pages.h layers.h
input.h engine.h pages.h layers.h factory.h loadsave.h io.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 input.h help.h
......@@ -21,7 +23,8 @@ $(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \
help.h filesel.h
$(OBJDIR)/graph.o: graph.c global.h struct.h const.h engine.h buttons.h pages.h \
errors.h sdlscreen.h graph.h misc.h pxsimple.h pxtall.h pxwide.h \
pxdouble.h pxtriple.h pxwide2.h pxtall2.h pxquad.h windows.h input.h
pxdouble.h pxtriple.h pxwide2.h pxtall2.h pxquad.h windows.h input.h \
brush.h
$(OBJDIR)/help.o: help.c const.h struct.h global.h misc.h engine.h helpfile.h \
help.h sdlscreen.h text.h keyboard.h windows.h input.h hotkeys.h \
errors.h pages.h
......@@ -29,9 +32,9 @@ $(OBJDIR)/hotkeys.o: hotkeys.c struct.h const.h global.h hotkeys.h
$(OBJDIR)/init.o: init.c buttons.h struct.h const.h errors.h global.h graph.h \
init.h io.h factory.h help.h hotkeys.h keyboard.h loadsave.h misc.h \
mountlist.h operatio.h palette.h sdlscreen.h setup.h transform.h \
windows.h layers.h
windows.h layers.h special.h
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
windows.h errors.h misc.h input.h
windows.h errors.h misc.h buttons.h input.h loadsave.h
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \
......@@ -39,18 +42,20 @@ $(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h
$(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io.h \
loadsave.h misc.h graph.h op_c.h pages.h palette.h sdlscreen.h windows.h \
engine.h
engine.h brush.h setup.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \
engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \
io.h text.h setup.h windows.h brush.h palette.h realpath.h
io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h
$(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.h \
engine.h misc.h keyboard.h windows.h palette.h input.h graph.h pages.h
$(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \
global.h io.h libraw2crtc.h loadsave.h misc.h sdlscreen.h windows.h
$(OBJDIR)/mountlist.o: mountlist.c mountlist.h
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h
$(OBJDIR)/mountlist.o: mountlist.c
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h global.h engine.h \
windows.h
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h
operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h \
input.h
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \
misc.h windows.h
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
......@@ -63,34 +68,35 @@ $(OBJDIR)/pxquad.o: pxquad.c global.h struct.h const.h sdlscreen.h misc.h graph.
pxquad.h
$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxsimple.h
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxtall2.h
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxtall.h pxsimple.h
$(OBJDIR)/pxtall2.o: pxtall2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxtall2.h
$(OBJDIR)/pxtriple.o: pxtriple.c global.h struct.h const.h sdlscreen.h misc.h \
graph.h pxtriple.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide2.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide.h
$(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide2.h
$(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h \
setup.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \
sdlscreen.h readline.h windows.h input.h
$(OBJDIR)/realpath.o: realpath.c
$(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h errors.h \
misc.h saveini.h
misc.h saveini.h setup.h
$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h errors.h \
misc.h
$(OBJDIR)/setup.o: setup.c struct.h const.h io.h setup.h
$(OBJDIR)/SFont.o: SFont.c SFont.h
$(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h engine.h errors.h \
misc.h readline.h help.h sdlscreen.h windows.h input.h shade.h
$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \
special.h pages.h misc.h buttons.h
$(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \
errors.h
errors.h windows.h misc.h setup.h
$(OBJDIR)/tiles.o: tiles.c
$(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.h \
sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h pages.h
$(OBJDIR)/version.o: version.c
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \
global.h graph.h input.h misc.h readline.h sdlscreen.h
global.h graph.h input.h misc.h op_c.h readline.h sdlscreen.h palette.h
......@@ -69,7 +69,7 @@ static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
SFont_Font* SFont_InitFont(SDL_Surface* Surface)
{
int x = 0, i = 0;
int x = 0, i = 33;
Uint32 pixel;
SFont_Font* Font;
Uint32 pink;
......@@ -78,21 +78,42 @@ SFont_Font* SFont_InitFont(SDL_Surface* Surface)
return NULL;
Font = (SFont_Font *) malloc(sizeof(SFont_Font));
memset(Font, 0, sizeof(SFont_Font));
Font->Surface = Surface;
SDL_LockSurface(Surface);
pink = SDL_MapRGB(Surface->format, 255, 0, 255);
pink = GetPixel(Surface, 0, 0);
while (x < Surface->w) {
if (GetPixel(Surface, x, 0) == pink) {
Font->CharPos[i++]=x;
while((x < Surface->w) && (GetPixel(Surface, x, 0)== pink))
if (GetPixel(Surface, x, 0) != pink) {
Font->CharBegin[i]=x;
while((x < Surface->w) && (GetPixel(Surface, x, 0)!= pink))
x++;
Font->CharPos[i++]=x;
Font->CharWidth[i]=x-Font->CharBegin[i];
i++;
}
x++;
}
Font->MaxPos = x-1;
// Create lowercase characters, if not present
for (i=0; i <26; i++)
{
if (Font->CharWidth['a'+i]==0)
{
Font->CharBegin['a'+i]=Font->CharBegin['A'+i];
Font->CharWidth['a'+i]=Font->CharWidth['A'+i];
}
}
// Determine space width.
// This strange format doesn't allow font designer to write explicit
// space as a character.
// Rule: A space should be as large as the character " if available,
// or 'a' if it's not.
Font->Space = Font->CharWidth[(int)'"'];
if (Font->Space<2)
Font->Space = Font->CharWidth[(int)'a'];
pixel = GetPixel(Surface, 0, Surface->h-1);
SDL_UnlockSurface(Surface);
......@@ -111,7 +132,6 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
int x, int y, const char *text)
{
const char* c;
int charoffset;
SDL_Rect srcrect, dstrect;
if(text == NULL)
......@@ -123,42 +143,39 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
srcrect.h = dstrect.h = Font->Surface->h - 1;
for(c = text; *c != '\0' && x <= Surface->w ; c++) {
charoffset = ((int) (*c - 33)) * 2 + 1;
// skip spaces and nonprintable characters
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
x += Font->CharPos[2]-Font->CharPos[1];
if (*c == ' ' || Font->CharWidth[(int)*c]==0) {
x += Font->Space;
continue;
}
srcrect.w = Font->CharPos[charoffset+2] - Font->CharPos[charoffset];
srcrect.w = Font->CharWidth[(int)*c];
dstrect.w = srcrect.w;
srcrect.x = Font->CharPos[charoffset];
srcrect.x = Font->CharBegin[(int)*c];
dstrect.x = x;
SDL_BlitSurface(Font->Surface, &srcrect, Surface, &dstrect);
x += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
x += Font->CharWidth[(int)*c];
}
}
int SFont_TextWidth(const SFont_Font *Font, const char *text)
{
const char* c;
int charoffset=0;
int width = 0;
if(text == NULL)
return 0;
for(c = text; *c != '\0'; c++) {
charoffset = ((int) *c - 33) * 2 + 1;
// skip spaces and nonprintable characters
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
width += Font->CharPos[2]-Font->CharPos[1];
if (*c == ' ' || Font->CharWidth[(int)*c]==0) {
width += Font->Space;
continue;
}
width += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
width += Font->CharWidth[(int)*c];
}
return width;
......
......@@ -56,8 +56,9 @@ extern "C" {
/// and call InitFont( YourFont );
typedef struct {
SDL_Surface *Surface;
int CharPos[512];
int MaxPos;
int CharBegin[256];
int CharWidth[256];
int Space;
} SFont_Font;
///
......
This diff is collapsed.
......@@ -111,10 +111,19 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear);
///
/// Changes the Brush size, discarding its previous content.
/// @return 0 OK, 1 Failed
byte Realloc_brush(word new_brush_width, word new_brush_height);
/// Changes the Brush size.
/// @return 0 on success, non-zero on failure (memory?).
/// @param new_brush: Optionally, you can provide an already allocated new
/// brush - otherwise, this function performs the allocation.
/// @param old_brush: If the caller passes NULL, this function will free the old
/// pixel data. If the caller provides the address of a (free) byte
/// pointer, the function will make it point to the original pixel data,
/// in this case it will be the caller's responsibility to free() it
/// (after transferring pixels to Brush, usually).
byte Realloc_brush(word new_brush_width, word new_brush_height, byte *new_brush, byte **old_brush);
/// Sets brush's original palette and color mapping.
void Brush_set_palette(T_Palette *palette);
#endif
......@@ -38,7 +38,7 @@
#include "sdlscreen.h"
#include "windows.h"
#if defined(__VBCC__)||defined(__GP2X__)
#if defined(__VBCC__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
#define M_PI 3.141592653589793238462643
#endif
......@@ -251,6 +251,106 @@ void Colorpicker_0_1(void)
Unselect_button(BUTTON_COLORPICKER);
}
/////////////////////////////////////////////////////////// OPERATION_RMB_COLORPICK
byte Rightclick_colorpick(byte cursor_visible)
{
// Check if the rightclick colorpick should take over:
if (!Config.Right_click_colorpick)
return 0;
if (Mouse_K!=RIGHT_SIDE)
return 0;
// In these modes, the Foreground color is ignored,
// so the RMB should act as normal.
if (Shade_mode||Quick_shade_mode||Tiling_mode)
return 0;
Colorpicker_color=-1;
Colorpicker_X=-1;
Colorpicker_Y=-1;
if (cursor_visible)
Hide_cursor();
Start_operation_stack(OPERATION_RMB_COLORPICK);
Init_start_operation();
// Just an indicator to go to next step
Operation_push(1);
Rightclick_colorpick_2_1();
if (cursor_visible)
Display_cursor();
return 1;
}
void Rightclick_colorpick_2_1(void)
//
// Opration : OPERATION_RMB_COLORPICK
// Click Souris: 2
// Taille_Pile : 1
//
// Souris efface: Non
//
{
char str[4];
if ( (Colorpicker_X!=Paintbrush_X)
|| (Colorpicker_Y!=Paintbrush_Y) )
{
if ( (Paintbrush_X>=0) && (Paintbrush_Y>=0)
&& (Paintbrush_X<Main_image_width)
&& (Paintbrush_Y<Main_image_height) )
Colorpicker_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
else
Colorpicker_color=0;
Colorpicker_X=Paintbrush_X;
Colorpicker_Y=Paintbrush_Y;
if (Menu_is_visible)
{
Print_coordinates();
Num2str(Colorpicker_color,str,3);
Print_in_menu(str,20);
Print_general(170*Menu_factor_X,Menu_status_Y," ",0,Colorpicker_color);
}
}
}
void Rightclick_colorpick_0_1(void)
//
// Opration : OPERATION_RMB_COLORPICK
// Click Souris: 0
// Taille_Pile : 1
//
// Souris efface: Non
//
{
short dummy;
Hide_cursor();
Operation_pop(&dummy);
Set_fore_color(Colorpicker_color);
// Restore previous operation
Start_operation_stack(Operation_before_interrupt);
// Erase the color block which shows the picked color
if (Operation_before_interrupt!=OPERATION_REPLACE)
if ( (Mouse_Y<Menu_Y) && (Menu_is_visible) &&
( (!Main_magnifier_mode) || (Mouse_X<Main_separator_position) || (Mouse_X>=Main_X_zoom) ) )
Print_in_menu("X: Y: ",0);
Print_coordinates();
Display_cursor();
}
////////////////////////////////////////////////////// OPERATION_GRAB_BRUSH
......@@ -858,6 +958,10 @@ void Rotate_brush_1_5(void)
Operation_pop(&old_y);
Operation_pop(&old_x);
// On corrige les coordonnes de la ligne si la touche shift est appuye...
if(SDL_GetModState() & KMOD_SHIFT)
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&Paintbrush_X,&Paintbrush_Y);
if ( (Paintbrush_X!=old_x) || (Paintbrush_Y!=old_y) || (prev_state!=2) )
{
if ( (Brush_rotation_center_X==Paintbrush_X)
......@@ -921,6 +1025,10 @@ void Rotate_brush_0_5(void)
Operation_pop(&old_y);
Operation_pop(&old_x);
// On corrige les coordonnes de la ligne si la touche shift est appuye...
if(SDL_GetModState() & KMOD_SHIFT)
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&Paintbrush_X,&Paintbrush_Y);
if ((Paintbrush_X!=old_x) || (Paintbrush_Y!=old_y) || (prev_state!=3))
{
if ( (Brush_rotation_center_X==Paintbrush_X)
......
This diff is collapsed.
......@@ -670,5 +670,9 @@ void Button_Smear_mode(void);
void Button_Brush_container(void);
byte Store_paintbrush(int index);
void Select_paintbrush(int index);
#endif
......@@ -40,6 +40,7 @@
#include "sdlscreen.h"
#include "struct.h"
#include "windows.h"
#include "brush.h"
//---------- Menu dans lequel on tagge des couleurs (genre Stencil) ----------
void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_cancel, const char *help_section, word close_shortcut)
......@@ -279,7 +280,7 @@ void Button_Grid_menu(void)
{
case 3 :
Num2str(chosen_X,str,2);
Readline(39,26,str,2,1);
Readline(39,26,str,2,INPUT_TYPE_INTEGER);
chosen_X=atoi(str);
// On corrige les dimensions
if ((!chosen_X) || (chosen_X>80))
......@@ -301,7 +302,7 @@ void Button_Grid_menu(void)
break;
case 4 :
Num2str(chosen_Y,str,2);
Readline(39,47,str,2,1);
Readline(39,47,str,2,INPUT_TYPE_INTEGER);
chosen_Y=atoi(str);
// On corrige les dimensions
if ((!chosen_Y) || (chosen_Y>80))
......@@ -323,7 +324,7 @@ void Button_Grid_menu(void)
break;
case 5 :
Num2str(dx_selected,str,2);
Readline(97,26,str,2,1);
Readline(97,26,str,2,INPUT_TYPE_INTEGER);
dx_selected=atoi(str);
// On corrige les dimensions
if (dx_selected>79)
......@@ -338,7 +339,7 @@ void Button_Grid_menu(void)
break;
case 6 :
Num2str(dy_selected,str,2);
Readline(97,47,str,2,1);
Readline(97,47,str,2,INPUT_TYPE_INTEGER);
dy_selected=atoi(str);
// On corrige les dimensions
if (dy_selected>79)
......@@ -479,7 +480,7 @@ void Button_Smooth_menu(void)
Num2str(chosen_matrix[x][y],str,2);
Readline(matrix_input[x][y]->Pos_X+2,
matrix_input[x][y]->Pos_Y+2,
str,2,1);
str,2,INPUT_TYPE_INTEGER);
chosen_matrix[x][y]=atoi(str);
Display_cursor();
}
......@@ -553,6 +554,9 @@ void Button_Colorize_mode(void)
break;
case 2 :
Effect_function=Effect_substractive_colorize;
break;
case 3 :
Effect_function=Effect_alpha_colorize;
}
Shade_mode=0;
Quick_shade_mode=0;
......@@ -572,10 +576,12 @@ void Button_Colorize_display_selection(int mode)
Print_in_window(4,37," ",MC_Black,MC_Light);
Print_in_window(4,57," ",MC_Black,MC_Light);
Print_in_window(4,74," ",MC_Black,MC_Light);
Print_in_window(4,91," ",MC_Black,MC_Light);
// Partie droite
Print_in_window(129,37," ",MC_Black,MC_Light);
Print_in_window(129,57," ",MC_Black,MC_Light);
Print_in_window(129,74," ",MC_Black,MC_Light);
Print_in_window(129,91," ",MC_Black,MC_Light);
// Ensuite, on affiche la flche l o il le faut:
switch(mode)
......@@ -588,6 +594,9 @@ void Button_Colorize_display_selection(int mode)
break;
case 2 : // Mthode soustractive
y_pos=74;
break;
case 3 : // Mthode alpha
y_pos=91;
}
Print_in_window(4,y_pos,"\020",MC_Black,MC_Light);
Print_in_window(129,y_pos,"\021",MC_Black,MC_Light);
......@@ -600,7 +609,7 @@ void Button_Colorize_menu(void)
short clicked_button;
char str[4];
Open_window(140,118,"Transparency");
Open_window(140,135,"Transparency");
Print_in_window(16,23,"Opacity:",MC_Dark,MC_Light);
Window_set_input_button(87,21,3); // 1
......@@ -610,9 +619,10 @@ void Button_Colorize_menu(void)
Window_set_normal_button(16,54,108,14,"Additive" ,2,1,SDLK_d); // 3
Window_set_normal_button(16,71,108,14,"Subtractive",1,1,SDLK_s); // 4
Window_set_normal_button(16,88,108,14,"Alpha",1,1,SDLK_a); // 4
Window_set_normal_button(16,94, 51,14,"Cancel" ,0,1,KEY_ESC); // 5
Window_set_normal_button(73,94, 51,14,"OK" ,0,1,SDLK_RETURN); // 6
Window_set_normal_button(16,111, 51,14,"Cancel" ,0,1,KEY_ESC); // 5
Window_set_normal_button(73,111, 51,14,"OK" ,0,1,SDLK_RETURN); // 6
Num2str(Colorize_opacity,str,3);
Window_input_content(Window_special_button_list,str);
......@@ -632,7 +642,7 @@ void Button_Colorize_menu(void)
{
case 1: // Zone de saisie de l'opacit
Num2str(chosen_opacity,str,3);
Readline(89,23,str,3,1);
Readline(89,23,str,3,INPUT_TYPE_INTEGER);
chosen_opacity=atoi(str);
// On corrige le pourcentage
if (chosen_opacity>100)
......@@ -643,9 +653,10 @@ void Button_Colorize_menu(void)
}
Display_cursor();
break;
case 2: // Mthode interpole
case 3: // Mthode additive
case 4: // Mthode soustractive
case 2: // Interpolated method
case 3: // Additive method
case 4: // Substractive method
case 5: // Alpha method
selected_mode=clicked_button-2;
Hide_cursor();
Button_Colorize_display_selection(selected_mode);
......@@ -654,13 +665,13 @@ void Button_Colorize_menu(void)
if (Is_shortcut(Key,0x100+BUTTON_HELP))
Window_help(BUTTON_EFFECTS, "TRANSPARENCY");
else if (Is_shortcut(Key,SPECIAL_COLORIZE_MENU))
clicked_button=6;
clicked_button=7;
}
while (clicked_button<5);
while (clicked_button<6);
Close_window();
if (clicked_button==6) // OK
if (clicked_button==7) // OK
{
Colorize_opacity =chosen_opacity;
Colorize_current_mode=selected_mode;
......@@ -724,7 +735,7 @@ void Button_Tiling_menu(void)
if (clicked_button==3) // Zone de saisie du dcalage X
{
Num2str(chosen_offset_x,str,4);
Readline(93,23,str,4,1);
Readline(93,23,str,4,INPUT_TYPE_INTEGER);
chosen_offset_x=atoi(str);
// On corrige le dcalage en X
if (chosen_offset_x>=Brush_width)
......@@ -739,7 +750,7 @@ void Button_Tiling_menu(void)
if (clicked_button==4) // Zone de saisie du dcalage Y
{
Num2str(chosen_offset_y,str,4);
Readline(93,37,str,4,1);
Readline(93,37,str,4,INPUT_TYPE_INTEGER);
chosen_offset_y=atoi(str);
// On corrige le dcalage en Y
if (chosen_offset_y>=Brush_height)
......@@ -975,8 +986,8 @@ void Button_Sieve_menu(void)
{
clicked_button=Window_clicked_button();
origin_x=Window_pos_X+(Menu_factor_X*Window_special_button_list->Pos_X);
origin_y=Window_pos_Y+(Menu_factor_Y*Window_special_button_list->Pos_Y);
origin_x=Window_pos_X+(Menu_factor_X*Window_special_button_list->Pos_X);
origin_y=Window_pos_Y+(Menu_factor_Y*Window_special_button_list->Pos_Y);
switch (clicked_button)
......@@ -1063,15 +1074,22 @@ void Button_Sieve_menu(void)
break;
case 7 : // Transfer to brush
Brush_width=Sieve_width;
Brush_height=Sieve_height;
free(Brush);
Brush=(byte *)malloc(((long)Brush_height)*Brush_width);
if (Realloc_brush(Sieve_width, Sieve_height, NULL, NULL))
break;
for (y_pos=0; y_pos<Sieve_height; y_pos++)
for (x_pos=0; x_pos<Sieve_width; x_pos++)
Pixel_in_brush(x_pos,y_pos,(Sieve[x_pos][y_pos])?Fore_color:Back_color);
*(Brush_original_pixels + y_pos * Brush_width + x_pos) = (Sieve[x_pos][y_pos])?Fore_color:Back_color;
// Grab palette
memcpy(Brush_original_palette, Main_palette,sizeof(T_Palette));
// Remap (no change)
Remap_brush();
Brush_offset_X=(Brush_width>>1);
Brush_offset_Y=(Brush_height>>1);
Change_paintbrush_shape(PAINTBRUSH_SHAPE_COLOR_BRUSH);
break;
......
......@@ -37,7 +37,6 @@
#define BETA1 98 ///< Version number for gfx2.cfg (3/4)
#define BETA2 0 ///< Version number for gfx2.cfg (4/4)
#define MAX_VIDEO_MODES 100 ///< Maximum number of video modes Grafx2 can propose.
#define NB_SHORTCUTS 183 ///< Number of actions that can have a key combination associated to it.
#define NB_ZOOM_FACTORS 15 ///< 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.
......@@ -45,9 +44,10 @@
#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 MENU_SPRITE_WIDTH 16 ///< Width of a menu sprite in pixels
#define MENU_SPRITE_HEIGHT 16 ///< Height of a menu sprite in pixels
#define EFFECT_SPRITE_WIDTH 14 ///< Width of an effect sprite in pixels
#define EFFECT_SPRITE_HEIGHT 14 ///< Height of an effect sprite in pixels
#define LAYER_SPRITE_WIDTH 14 ///< Width of a layer button in pixels
#define LAYER_SPRITE_HEIGHT 10 ///< Height of a layer button in pixels
#define PAINTBRUSH_WIDTH 16 ///< Width of a preset paintbrush sprite
......@@ -120,6 +120,7 @@ enum FILE_FORMATS
FORMAT_KCF,
FORMAT_PAL,
FORMAT_SCR,
FORMAT_XPM,
FORMAT_MISC, ///< Must be last of enum: others formats recognized by SDL_image
};
......@@ -210,9 +211,17 @@ enum PAINTBRUSH_SHAPES
PAINTBRUSH_SHAPE_DIAMOND,
PAINTBRUSH_SHAPE_SIEVE_ROUND,
PAINTBRUSH_SHAPE_SIEVE_SQUARE,
PAINTBRUSH_SHAPE_RESERVED1, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED2, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED3, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED4, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED5, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED6, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED7, ///< Reserved for future use
PAINTBRUSH_SHAPE_RESERVED8, ///< Reserved for future use
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 floodfill.
PAINTBRUSH_SHAPE_NONE, ///< Used to display no cursor at all (colorpicker)
PAINTBRUSH_SHAPE_NONE, ///< Used to display no cursor at all (colorpicker)
PAINTBRUSH_SHAPE_COLOR_BRUSH, ///< User's brush, in color mode
PAINTBRUSH_SHAPE_MONO_BRUSH, ///< User's brush, in mono mode
</