Partial merge of the SDL2 branch into trunk

* Mainly get the cleanup of window drawing functions.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2102 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2015-03-02 13:44:18 +00:00
parent f0ebf223a8
commit 78fcc648c3
11 changed files with 145 additions and 197 deletions

View File

@ -203,7 +203,8 @@ endif
LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lfreetype -lbe $(LUALOPT)
CC = gcc
#Append the gcc kind to the objdir (gcc2 or gcc4) to avoid conflicts when switching from one to other.
OBJDIR = ../obj/haiku
OBJKIND = $(shell gcc -dumpversion)
OBJDIR = ../obj/haiku/$(OBJKIND)
ZIP = zip
else
@ -286,8 +287,8 @@ endif
LUACOPT =
LUALOPT =
else
LUACOPT = `pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags`
LUALOPT = `pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs`
LUACOPT = $(shell pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags)
LUALOPT = $(shell pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs)
endif
endif
@ -358,8 +359,8 @@ endif
# Compiles a regular linux executable for the native platform
BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) `pkg-config --cflags libpng`
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) `pkg-config --libs libpng` $(LUALOPT) -lm
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) $(shell pkg-config --cflags libpng) -D_XOPEN_SOURCE=700
LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) $(shell pkg-config --libs libpng) $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/unix
FCLOPT = -lfontconfig
@ -581,7 +582,7 @@ $(OBJDIR)/winres.o : gfx2.ico
# Compile the C++ file needed in Haiku to use the API
$(OBJDIR)/haiku.o : haiku.cpp
g++ -c haiku.cpp -o $(OBJDIR)/haiku.o
g++ -c haiku.cpp -o $(OBJDIR)/haiku.o $(COPT) -Wno-multichar
clean :
$(DELCOMMAND) $(OBJ)

View File

@ -157,9 +157,7 @@ void Button_Message_initial(void)
Open_window(260,172,str);
Window_display_frame_in(10,20,239,62);
Block(Window_pos_X+(Menu_factor_X*11),
Window_pos_Y+(Menu_factor_Y*21),
Menu_factor_X*237,Menu_factor_Y*60,MC_Black);
Window_rectangle(11,21,237,60,MC_Black);
for (y=23,offs_y=0; y<79; offs_y+=231,y++)
for (x=14,x_pos=0; x_pos<231; x_pos++,x++)
Pixel_in_window(x,y,Gfx->Logo_grafx2[offs_y+x_pos]);
@ -1852,11 +1850,8 @@ void Check_mode_button(short x_pos, short y_pos, byte state)
case 2 : color=MC_Dark; break;
default: color=MC_Black;
}
Block(Window_pos_X+Menu_factor_X*x_pos,Window_pos_Y+Menu_factor_Y*y_pos,
Menu_factor_X*9,Menu_factor_Y*3,color);
Update_rect(Window_pos_X+Menu_factor_X*x_pos,Window_pos_Y+Menu_factor_Y*y_pos,
Menu_factor_X*9,Menu_factor_Y*3);
Window_rectangle(x_pos, y_pos, 9, 3, color);
Update_window_area(x_pos, y_pos,9,3);
}
/// Number of video modes to display in the resolution menu
@ -2422,15 +2417,9 @@ void Draw_button_gradient_style(short x_pos,short y_pos,int technique)
// On commence par afficher les 2 côtés qui constituent le dégradé de base:
// Côté gauche (noir)
Block(Window_pos_X+((x_pos+2)*Menu_factor_X),
Window_pos_Y+((y_pos+2)*Menu_factor_Y),
Menu_factor_X*6,
Menu_factor_Y*10,MC_Black);
Window_rectangle(x_pos+2, y_pos+2, 6, 10, MC_Black);
// Côté droit (blanc)
Block(Window_pos_X+((x_pos+8)*Menu_factor_X),
Window_pos_Y+((y_pos+2)*Menu_factor_Y),
Menu_factor_X*5,
Menu_factor_Y*10,MC_White);
Window_rectangle(x_pos+8, y_pos+2, 5, 10, MC_White);
switch(technique)
{
@ -2469,8 +2458,7 @@ void Draw_button_gradient_style(short x_pos,short y_pos,int technique)
}
}
Update_rect(Window_pos_X+((x_pos+2)*Menu_factor_X),Window_pos_Y+((y_pos+2)*Menu_factor_Y),
Menu_factor_X*10,Menu_factor_Y*10);
Update_window_area(x_pos+2,y_pos+2,10,10);
}
void Load_gradient_data(int index)
@ -3940,20 +3928,20 @@ void Button_Brush_FX(void)
}
// Dessin des coins et du centre pour les boutons du "brush handle"
// Coin HG
Block(Window_pos_X+(Menu_factor_X* 77),Window_pos_Y+(Menu_factor_Y* 92),Menu_factor_X*7,Menu_factor_Y,MC_Black);
Block(Window_pos_X+(Menu_factor_X* 77),Window_pos_Y+(Menu_factor_Y* 92),Menu_factor_X,Menu_factor_Y*7,MC_Black);
Window_rectangle(77, 92, 7, 1, MC_Black);
Window_rectangle(77, 92, 1, 7, MC_Black);
// Coin HD
Block(Window_pos_X+(Menu_factor_X*105),Window_pos_Y+(Menu_factor_Y* 92),Menu_factor_X*7,Menu_factor_Y,MC_Black);
Block(Window_pos_X+(Menu_factor_X*111),Window_pos_Y+(Menu_factor_Y* 92),Menu_factor_X,Menu_factor_Y*7,MC_Black);
Window_rectangle(105, 92, 7, 1, MC_Black);
Window_rectangle(111, 92, 1, 7, MC_Black);
// Centre
Block(Window_pos_X+(Menu_factor_X* 91),Window_pos_Y+(Menu_factor_Y*109),Menu_factor_X*7,Menu_factor_Y,MC_Black);
Block(Window_pos_X+(Menu_factor_X* 94),Window_pos_Y+(Menu_factor_Y*106),Menu_factor_X,Menu_factor_Y*7,MC_Black);
Window_rectangle(91, 109, 7, 1, MC_Black);
Window_rectangle(94, 106, 1, 7, MC_Black);
// Coin BG
Block(Window_pos_X+(Menu_factor_X* 77),Window_pos_Y+(Menu_factor_Y*126),Menu_factor_X*7,Menu_factor_Y,MC_Black);
Block(Window_pos_X+(Menu_factor_X* 77),Window_pos_Y+(Menu_factor_Y*120),Menu_factor_X,Menu_factor_Y*7,MC_Black);
Window_rectangle(77, 126, 7, 1, MC_Black);
Window_rectangle(77, 120, 1, 7, MC_Black);
// Coin BD
Block(Window_pos_X+(Menu_factor_X*105),Window_pos_Y+(Menu_factor_Y*126),Menu_factor_X*7,Menu_factor_Y,MC_Black);
Block(Window_pos_X+(Menu_factor_X*111),Window_pos_Y+(Menu_factor_Y*120),Menu_factor_X,Menu_factor_Y*7,MC_Black);
Window_rectangle(105, 126, 7, 1, MC_Black);
Window_rectangle(111, 120, 1, 7, MC_Black);
Update_window_area(0,0,Window_width, Window_height);
@ -4105,9 +4093,9 @@ void Refresh_airbrush_settings(byte selected_color, byte update_slider)
Num2str(Airbrush_multi_flow[selected_color],str,2);
Print_in_window(196,130,str,MC_Black,MC_Light);
Update_rect(Window_pos_X+(Menu_factor_X*(Window_palette_button_list->Pos_X+4+(selected_color >> 4)*10)),
Window_pos_Y+(Menu_factor_Y*(Window_palette_button_list->Pos_Y+3+(selected_color & 15)* 5)),
Menu_factor_X<<1,Menu_factor_Y*5);
Update_window_area(Window_palette_button_list->Pos_X+4+(selected_color >> 4)*10,
Window_palette_button_list->Pos_Y+3+(selected_color & 15)* 5,
2,5);
}
@ -4254,7 +4242,7 @@ void Button_Airbrush_menu(void)
Print_in_window(50,151," Mono",MC_Black,MC_Light);
else
Print_in_window(50,151,"Multi",MC_Black,MC_Light);
Update_rect(Window_pos_X+50*Menu_factor_X,Window_pos_Y+151*Menu_factor_Y,5*8*Menu_factor_X,8*Menu_factor_Y);
Update_window_area(50,151,5*8,8);
Display_cursor();
break;
@ -4513,8 +4501,7 @@ void Display_effect_sprite(int sprite_number, short start_x, short start_y)
void Display_effect_state(short x, short y, char * label, byte state)
{
Block(Window_pos_X+(x*Menu_factor_X),Window_pos_Y+(y*Menu_factor_Y),
12*Menu_factor_X,Menu_factor_Y<<3,MC_Light);
Window_rectangle(x,y,12,8,MC_Light);
Print_in_window(x,y,label,(state)?MC_White:MC_Black,MC_Light);
if (state)
@ -5058,11 +5045,11 @@ void Button_Text(void)
}
}
Update_rect(
Window_pos_X+preview_button->Pos_X*Menu_factor_X,
Window_pos_Y+preview_button->Pos_Y*Menu_factor_Y,
preview_button->Width*Menu_factor_X,
preview_button->Height*Menu_factor_Y);
Update_window_area(
preview_button->Pos_X,
preview_button->Pos_Y,
preview_button->Width,
preview_button->Height);
}
if (redraw_is_needed || preview_is_needed)
{

View File

@ -296,16 +296,16 @@ void Button_Stencil_mode(void)
void Stencil_tag_color(byte color, byte tag_color)
{
Block(Window_pos_X+(Menu_factor_X*(Window_palette_button_list->Pos_X+4+(color >> 4)*10)),
Window_pos_Y+(Menu_factor_Y*(Window_palette_button_list->Pos_Y+3+(color & 15)* 5)),
Menu_factor_X<<1,Menu_factor_Y*5,tag_color);
Window_rectangle(Window_palette_button_list->Pos_X+4+(color >> 4)*10,
Window_palette_button_list->Pos_Y+3+(color & 15)* 5,
2,5,tag_color);
}
void Stencil_update_color(byte color)
{
Update_rect(Window_pos_X+(Menu_factor_X*(Window_palette_button_list->Pos_X+4+(color >> 4)*10)),
Window_pos_Y+(Menu_factor_Y*(Window_palette_button_list->Pos_Y+3+(color & 15)* 5)),
Menu_factor_X<<1,Menu_factor_Y*5);
Update_window_area(Window_palette_button_list->Pos_X+4+(color >> 4)*10,
Window_palette_button_list->Pos_Y+3+(color & 15)* 5,
2,5);
}
void Button_Stencil_menu(void)
@ -1091,9 +1091,9 @@ void Button_Sieve_menu(void)
Window_set_normal_button( 97,126,11,11,"\033",0,1,SDLK_LEFT|MOD_SHIFT); // 10
Window_set_normal_button(121,126,11,11,"\032",0,1,SDLK_RIGHT|MOD_SHIFT); // 11
button_bg_color = Window_set_normal_button(109,126,11,11,"" ,0,1,SDLK_INSERT); // 12
Block(Window_pos_X+(Menu_factor_X*(button_bg_color->Pos_X+2)),
Window_pos_Y+(Menu_factor_Y*(button_bg_color->Pos_Y+2)),
Menu_factor_X*7, Menu_factor_Y*7, (default_bg_color)?MC_White:MC_Black);
Window_rectangle(button_bg_color->Pos_X+2,
button_bg_color->Pos_Y+2,
7, 7, (default_bg_color)?MC_White:MC_Black);
Window_set_repeatable_button(109, 69,11,11,"\030",0,1,SDLK_UP); // 13
Window_set_repeatable_button(109, 93,11,11,"\031",0,1,SDLK_DOWN); // 14
@ -1287,15 +1287,15 @@ void Button_Sieve_menu(void)
case 12 : // Toggle octets insérés
Hide_cursor();
default_bg_color=!default_bg_color;
Block(Window_pos_X+(Menu_factor_X*(button_bg_color->Pos_X+2)),
Window_pos_Y+(Menu_factor_Y*(button_bg_color->Pos_Y+2)),
Menu_factor_X*7, Menu_factor_Y*7, (default_bg_color)?MC_White:MC_Black);
Window_rectangle(button_bg_color->Pos_X+2,
button_bg_color->Pos_Y+2,
7, 7, (default_bg_color)?MC_White:MC_Black);
Display_cursor();
Update_rect(
Window_pos_X+(Menu_factor_X*(button_bg_color->Pos_X+2)),
Window_pos_Y+(Menu_factor_Y*(button_bg_color->Pos_Y+2)),
Menu_factor_X*7,
Menu_factor_Y*7);
Update_window_area(
button_bg_color->Pos_X+2,
button_bg_color->Pos_Y+2,
7,
7);
break;

View File

@ -1611,7 +1611,7 @@ void Open_window(word width,word height, const char * title)
Save_background(&(Window_background[Windows_open-1]), Window_pos_X, Window_pos_Y, width, height);
// Fenêtre grise
Block(Window_pos_X+(Menu_factor_X<<1),Window_pos_Y+(Menu_factor_Y<<1),(width-4)*Menu_factor_X,(height-4)*Menu_factor_Y,MC_Window);
Window_rectangle(2,2,width-4,height-4,MC_Window);
// -- Frame de la fenêtre ----- --- -- - -
@ -1620,8 +1620,8 @@ void Open_window(word width,word height, const char * title)
Window_display_frame_out(1,1,width-2,height-2);
// Barre sous le titre
Block(Window_pos_X+(Menu_factor_X<<3),Window_pos_Y+(11*Menu_factor_Y),(width-16)*Menu_factor_X,Menu_factor_Y,MC_Dark);
Block(Window_pos_X+(Menu_factor_X<<3),Window_pos_Y+(12*Menu_factor_Y),(width-16)*Menu_factor_X,Menu_factor_Y,MC_White);
Window_rectangle(8,11,width-16,1,MC_Dark);
Window_rectangle(8,12,width-16,1,MC_White);
title_length = strlen(title);
if (title_length+2 > (size_t)(width/8))
@ -1715,7 +1715,7 @@ void Close_window(void)
// Restore de ce que la fenêtre cachait
Restore_background(Window_background[Windows_open-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
Window_background[Windows_open-1]=NULL;
Update_rect(Window_pos_X,Window_pos_Y,Window_width*Menu_factor_X,Window_height*Menu_factor_Y);
Update_window_area(0,0,Window_width,Window_height);
Windows_open--;
}
else
@ -1774,9 +1774,8 @@ void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height,
Print_in_window(text_x_pos,text_y_pos,title,title_color,MC_Light);
if (undersc_letter)
Block(Window_pos_X+((text_x_pos+((undersc_letter-1)<<3))*Menu_factor_X),
Window_pos_Y+((text_y_pos+8)*Menu_factor_Y),
Menu_factor_X<<3,Menu_factor_Y,MC_Dark);
Window_rectangle(text_x_pos+((undersc_letter-1)<<3),
text_y_pos+8,8,1,MC_Dark);
}
@ -1784,14 +1783,14 @@ void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height,
void Window_select_normal_button(word x_pos,word y_pos,word width,word height)
{
Window_display_frame_generic(x_pos,y_pos,width,height,MC_Dark,MC_Black,MC_Dark,MC_Dark,MC_Black);
Update_rect(Window_pos_X+x_pos*Menu_factor_X, Window_pos_Y+y_pos*Menu_factor_Y, width*Menu_factor_X, height*Menu_factor_Y);
Update_window_area(x_pos, y_pos, width, height);
}
// -- Button normal désenfoncé dans la fenêtre --
void Window_unselect_normal_button(word x_pos,word y_pos,word width,word height)
{
Window_display_frame_out(x_pos,y_pos,width,height);
Update_rect(Window_pos_X+x_pos*Menu_factor_X, Window_pos_Y+y_pos*Menu_factor_Y, width*Menu_factor_X, height*Menu_factor_Y);
Update_window_area(x_pos, y_pos, width, height);
}
@ -1801,7 +1800,7 @@ void Window_draw_palette_bouton(word x_pos,word y_pos)
word color;
for (color=0; color<=255; color++)
Block( Window_pos_X+((((color >> 4)*10)+x_pos+6)*Menu_factor_X),Window_pos_Y+((((color & 15)*5)+y_pos+3)*Menu_factor_Y),Menu_factor_X*5,Menu_factor_Y*5,color);
Window_rectangle( ((color >> 4)*10)+x_pos+6,((color & 15)*5)+y_pos+3,5,5,color);
Window_display_frame(x_pos,y_pos,164,86);
}
@ -1817,11 +1816,11 @@ void Window_clear_tags(void)
word window_x_pos;
//word window_y_pos;
origin_x=Window_pos_X+(Window_palette_button_list->Pos_X+3)*Menu_factor_X;
origin_y=Window_pos_Y+(Window_palette_button_list->Pos_Y+3)*Menu_factor_Y;
for (x_pos=0,window_x_pos=origin_x;x_pos<16;x_pos++,window_x_pos+=(Menu_factor_X*10))
Block(window_x_pos,origin_y,Menu_factor_X*3,Menu_factor_Y*80,MC_Light);
Update_rect(origin_x,origin_y,ToWinL(160),ToWinH(80));
origin_x=Window_palette_button_list->Pos_X+3;
origin_y=Window_palette_button_list->Pos_Y+3;
for (x_pos=0,window_x_pos=origin_x;x_pos<16;x_pos++,window_x_pos+=10)
Window_rectangle(window_x_pos,origin_y,3,80,MC_Light);
Update_window_area(origin_x,origin_y,160,80);
}
@ -1997,8 +1996,8 @@ void Window_input_content(T_Special_button * button, const char * content)
void Window_clear_input_button(T_Special_button * button)
{
Block((button->Pos_X+2)*Menu_factor_X+Window_pos_X,(button->Pos_Y+2)*Menu_factor_Y+Window_pos_Y,(button->Width/8)*8*Menu_factor_X,8*Menu_factor_Y,MC_Light);
Update_rect((button->Pos_X+2)*Menu_factor_X+Window_pos_X,(button->Pos_Y+2)*Menu_factor_Y+Window_pos_Y,button->Width/8*8*Menu_factor_X,8*Menu_factor_Y);
Window_rectangle(button->Pos_X+2,button->Pos_Y+2,(button->Width/8)*8,8,MC_Light);
Update_window_area(button->Pos_X+2,button->Pos_Y+2,button->Width/8*8,8);
}
@ -2176,7 +2175,7 @@ T_Dropdown_button * Window_set_dropdown_button(word x_pos,word y_pos,word width,
temp->Next=Window_dropdown_button_list;
Window_dropdown_button_list=temp;
Window_draw_normal_bouton(x_pos,y_pos,width,height,"",-1,1);
Window_draw_normal_bouton(x_pos,y_pos,width,height,"",0,1);
if (label && label[0])
Print_in_window(temp->Pos_X+2,temp->Pos_Y+(temp->Height-7)/2,label,MC_Black,MC_Light);
if (display_arrow)
@ -2302,9 +2301,7 @@ void Open_popup(word x_pos, word y_pos, word width,word height)
/*
// Fenêtre grise
Block(Window_pos_X+1*Menu_factor_X,
Window_pos_Y+1*Menu_factor_Y,
(width-2)*Menu_factor_X,(height-2)*Menu_factor_Y,MC_Light);
Window_rectangle(1,1,width-2,height-2,MC_Light);
// Frame noir puis en relief
Window_display_frame_mono(0,0,width,height,MC_White);
@ -2389,7 +2386,7 @@ void Close_popup(void)
// Restore de ce que la fenêtre cachait
Restore_background(Window_background[Windows_open-1], Window_pos_X, Window_pos_Y, Window_width, Window_height);
Window_background[Windows_open-1]=NULL;
Update_rect(Window_pos_X,Window_pos_Y,Window_width*Menu_factor_X,Window_height*Menu_factor_Y);
Update_window_area(0,0,Window_width,Window_height);
Windows_open--;
}
else
@ -2594,7 +2591,7 @@ void Get_color_behind_window(byte * color, byte * click)
}
Restore_background(buffer,Window_pos_X,Window_pos_Y,Window_width,Window_height);
Update_rect(Window_pos_X, Window_pos_Y, Window_width*Menu_factor_X, Window_height*Menu_factor_Y);
Update_window_area(0, 0, Window_width, Window_height);
Cursor_shape=CURSOR_SHAPE_ARROW;
Paintbrush_hidden=b;
Cursor_hidden=cursor_was_hidden;
@ -2727,7 +2724,7 @@ void Move_window(short dx, short dy)
else
{
// Update pour effacer le rectangle XOR
Update_rect(Window_pos_X, Window_pos_Y, Window_width*Menu_factor_X, Window_height*Menu_factor_Y);
Update_window_area(0, 0, Window_width, Window_height);
}
Cursor_shape=CURSOR_SHAPE_ARROW;
Display_cursor();
@ -2771,34 +2768,34 @@ T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, sh
// Dessin de la boite
// Bord gauche
Block(Window_pos_X,Window_pos_Y,Menu_factor_X,box_height*Menu_factor_Y,MC_Black);
Window_rectangle(0,0,1,box_height,MC_Black);
// Frame fonce et blanc
Window_display_frame_out(1,0,button->Dropdown_width-1,box_height);
// Ombre portée
if (SHADOW_BOTTOM)
{
Block(Window_pos_X+SHADOW_RIGHT*Menu_factor_X,
Window_pos_Y+box_height*Menu_factor_Y,
button->Dropdown_width*Menu_factor_X,
SHADOW_BOTTOM*Menu_factor_Y,
Window_rectangle(SHADOW_RIGHT,
box_height,
button->Dropdown_width,
SHADOW_BOTTOM,
MC_Black);
Block(Window_pos_X,
Window_pos_Y+box_height*Menu_factor_Y,
SHADOW_RIGHT*Menu_factor_X,
Menu_factor_Y,
Window_rectangle(0,
box_height,
SHADOW_RIGHT,
1,
MC_Black);
}
if (SHADOW_RIGHT)
{
Block(Window_pos_X+button->Dropdown_width*Menu_factor_X,
Window_pos_Y+SHADOW_BOTTOM*Menu_factor_Y,
SHADOW_RIGHT*Menu_factor_X,
(box_height-SHADOW_BOTTOM)*Menu_factor_Y,
Window_rectangle(button->Dropdown_width,
SHADOW_BOTTOM,
SHADOW_RIGHT,
box_height-SHADOW_BOTTOM,
MC_Black);
Block(Window_pos_X+button->Dropdown_width*Menu_factor_X,
Window_pos_Y,
Menu_factor_X,
SHADOW_BOTTOM*Menu_factor_Y,
Window_rectangle(button->Dropdown_width,
1,
1,
SHADOW_BOTTOM,
MC_Black);
}
@ -2807,9 +2804,7 @@ T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, sh
{
old_selected_index = selected_index;
// Fenêtre grise
Block(Window_pos_X+2*Menu_factor_X,
Window_pos_Y+1*Menu_factor_Y,
(button->Dropdown_width-3)*Menu_factor_X,(box_height-2)*Menu_factor_Y,MC_Light);
Window_rectangle(2,1,button->Dropdown_width-3,box_height-2,MC_Light);
// Affichage des items
for(item=button->First_item,choice_index=0; item!=NULL; item=item->Next,choice_index++)
{
@ -2819,9 +2814,8 @@ T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, sh
{
color_1=MC_White;
color_2=MC_Dark;
Block(Window_pos_X+3*Menu_factor_X,
Window_pos_Y+((2+choice_index*8)*Menu_factor_Y),
(button->Dropdown_width-5)*Menu_factor_X,(8)*Menu_factor_Y,MC_Dark);
Window_rectangle(3,2+choice_index*8,
(button->Dropdown_width-5),8,MC_Dark);
}
else
{
@ -2830,7 +2824,7 @@ T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, sh
}
Print_in_window(3,2+choice_index*8,item->Label,color_1,color_2);
}
Update_rect(Window_pos_X,Window_pos_Y,Window_width*Menu_factor_X,Window_height*Menu_factor_Y);
Update_window_area(0,0,Window_width,Window_height);
Display_cursor();
do

View File

@ -159,9 +159,7 @@ void Window_set_shortcut(int action_id)
Window_set_normal_button(6,111,111,14,"Reset default",0,1,KEY_NONE); // 3
// Titre
Block(Window_pos_X+(Menu_factor_X*5),
Window_pos_Y+(Menu_factor_Y*16),
Menu_factor_X*292,Menu_factor_Y*11,MC_Black);
Window_rectangle(5,16,292,11,MC_Black);
Print_in_window(7,18,ConfigKey[config_index].Label,MC_White,MC_Black);
// Zone de description
@ -184,16 +182,12 @@ void Window_set_shortcut(int action_id)
if (redraw_controls)
{
Hide_cursor();
Block(Window_pos_X+(Menu_factor_X*32),
Window_pos_Y+(Menu_factor_Y*33),
Menu_factor_X*21*8,Menu_factor_Y*8,MC_Light);
Window_rectangle(32,33,21*8,8,MC_Light);
Print_in_window_limited(32,33,Key_name(shortcut_ptr[0]),21,MC_Black,MC_Light);
Block(Window_pos_X+(Menu_factor_X*32),
Window_pos_Y+(Menu_factor_Y*52),
Menu_factor_X*21*8,Menu_factor_Y*8,MC_Light);
Window_rectangle(32,52,21*8,8,MC_Light);
Print_in_window_limited(32,52,Key_name(shortcut_ptr[1]),21,MC_Black,MC_Light);
Update_rect(Window_pos_X,Window_pos_Y,302*Menu_factor_X,131*Menu_factor_Y);
Update_window_area(0,0,302,131);
Display_cursor();
redraw_controls=0;
@ -527,9 +521,7 @@ void Window_help(int section, const char *sub_section)
// dessiner de la fenêtre où va défiler le texte
Window_display_frame_in(8,17,274,132);
Block(Window_pos_X+(Menu_factor_X*9),
Window_pos_Y+(Menu_factor_Y*18),
Menu_factor_X*272,Menu_factor_Y*130,MC_Black);
Window_rectangle(9, 18, 272, 130, MC_Black);
Window_set_normal_button(266,153,35,14,"Exit",0,1,KEY_ESC); // 1
scroller=Window_set_scroller_button(290,18,130,nb_lines,
@ -545,7 +537,7 @@ void Window_help(int section, const char *sub_section)
Display_help();
Update_rect(Window_pos_X,Window_pos_Y,310*Menu_factor_X,175*Menu_factor_Y);
Update_window_area(0,0,310,175);
Display_cursor();
@ -702,9 +694,7 @@ void Button_Stats(void)
// Dessin de la fenetre ou va s'afficher le texte
Window_display_frame_in(8,17,294,132);
Block(Window_pos_X+(Menu_factor_X*9),
Window_pos_Y+(Menu_factor_Y*18),
Menu_factor_X*292,Menu_factor_Y*130,MC_Black);
Window_rectangle(9,18,292,130,MC_Black);
Window_set_normal_button(120,153,70,14,"OK",0,1,KEY_ESC); // 1
@ -879,7 +869,7 @@ void Button_Stats(void)
sprintf(buffer,"%dx%d",Screen_width,Screen_height);
Print_in_window(106,y,buffer,STATS_DATA_COLOR,MC_Black);
Update_rect(Window_pos_X,Window_pos_Y,Menu_factor_X*310,Menu_factor_Y*174);
Update_window_area(0,0,310,174);
Display_cursor();

View File

@ -23,8 +23,6 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#define _XOPEN_SOURCE 500
// Signal handler: I activate it for the two platforms who certainly
// support them. Feel free to check with others.
#if defined(__WIN32__) || defined(__linux__)

View File

@ -325,7 +325,6 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
else
Input_new_mouse_K |= 1;
break;
break;
case SDL_BUTTON_RIGHT:
if (Button_inverter)
@ -333,7 +332,6 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
else
Input_new_mouse_K |= 2;
break;
break;
case SDL_BUTTON_MIDDLE:
Key = KEY_MOUSEMIDDLE|Key_modifiers(SDL_GetModState());
@ -347,6 +345,7 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
case SDL_BUTTON_WHEELDOWN:
Key = KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState());
return 0;
default:
return 0;
}
@ -842,11 +841,11 @@ int Get_input(int sleep_time)
SDL_Event event;
int user_feedback_required = 0; // Flag qui indique si on doit arrêter de traiter les évènements ou si on peut enchainer
Color_cycling();
// Commit any pending screen update.
// This is done in this function because it's called after reading
// some user input.
Flush_update();
Color_cycling();
Key_ANSI = 0;
Key = 0;
Mouse_moved=0;

View File

@ -24,8 +24,6 @@
// Fonctions de lecture/ecriture file, gèrent les systèmes big-endian et
// little-endian.
#define _XOPEN_SOURCE 500
#include <SDL_endian.h>
#include <string.h>
#include <sys/stat.h>
@ -460,7 +458,7 @@ byte Create_lock_file(const char *file_directory)
#else
char lock_filename[MAX_PATH_CHARACTERS];
#ifdef GCWZERO
#ifdef GCWZERO
strcpy(lock_filename,"/media/home/.grafx2/");
#else
strcpy(lock_filename,file_directory);

View File

@ -523,10 +523,8 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
Hide_cursor();
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Update_rect(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
Update_window_area(x_pos,y_pos,visible_size<<3,8);
// Mise à jour des variables se rapportant à la chaîne en fonction de la chaîne initiale
strcpy(initial_string,str);
@ -544,8 +542,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
display_string[visible_size-1]=RIGHT_TRIANGLE_CHARACTER;
Display_whole_string(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),display_string,position - offset);
Update_rect(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
Update_window_area(x_pos,y_pos,visible_size<<3,8);
Flush_update();
if (Mouse_K)
{
@ -640,8 +637,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
size--;
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
goto affichage;
}
break;
@ -650,8 +646,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
{
// Effacement de la chaîne
if (position==size)
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
position--;
if (offset > 0 && (position == 0 || position < (offset + 1)))
offset--;
@ -674,8 +669,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
{
// Effacement de la chaîne
if (position==size)
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
position = 0;
offset = 0;
goto affichage;
@ -700,8 +694,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
Remove_character(str,position);
size--;
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
goto affichage;
}
break;
@ -709,8 +702,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
str[0]='\0';
position=offset=0;
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
goto affichage;
case SDLK_RETURN :
break;
@ -771,8 +763,7 @@ affichage:
}
#endif // defined(__ANDROID__)
// Effacement de la chaîne
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR);
// On raffiche la chaine correctement
if (input_type==INPUT_TYPE_INTEGER)
{
@ -801,9 +792,8 @@ affichage:
{
Print_in_window_limited(x_pos,y_pos,str,visible_size,TEXT_COLOR,BACKGROUND_COLOR);
}
Update_rect(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
Update_window_area(x_pos,y_pos,visible_size<<3,8);
return (input_key==SDLK_RETURN);
}

View File

@ -134,10 +134,9 @@ void Shade_draw_grad_ranges(void)
else
{
Window_display_frame_out(224,35,64,48);
Block(Window_pos_X+(Menu_factor_X*225),Window_pos_Y+(Menu_factor_Y*36),
Menu_factor_X*62,Menu_factor_Y*46,MC_Light);
Window_rectangle(225,36,62,46,MC_Light);
}
Update_rect(Window_pos_X+(Menu_factor_X*224),Window_pos_Y+(Menu_factor_Y*35),Menu_factor_X*64,Menu_factor_Y*48);
Update_window_area(224,35,64,48);
}
@ -181,7 +180,7 @@ void Tag_shades(word selection_start,word selection_end)
Block(x_pos,y_pos,Menu_factor_X<<2,Menu_factor_Y<<1,MC_Light);
}
}
Update_rect(Window_pos_X+8*Menu_factor_X,Window_pos_Y+131*Menu_factor_Y,Menu_factor_X*64<<2,Menu_factor_Y*8<<3);
Update_window_area(8,131,64<<2,8<<3);
}
@ -245,17 +244,17 @@ void Display_all_shade(word selection_start1,word selection_end1,
if (Shade_list[Shade_current].List[position]&0x0100) // Vide
{
Window_display_frame_out((column<<2)+8,(line*7)+127,4,4);
Block(Window_pos_X+(Menu_factor_X*((column<<2)+9)),
Window_pos_Y+(Menu_factor_Y*((line*7)+128)),
Menu_factor_X<<1,Menu_factor_Y<<1,MC_Light);
Window_rectangle((column<<2)+9,
(line*7)+128,
2,2,MC_Light);
}
else // color
Block(Window_pos_X+(Menu_factor_X*((column<<2)+8)),
Window_pos_Y+(Menu_factor_Y*((line*7)+127)),
Menu_factor_X<<2,Menu_factor_Y<<2,
Window_rectangle((column<<2)+8,
(line*7)+127,
4,4,
Shade_list[Shade_current].List[position]&0xFF);
}
Update_rect(Window_pos_X+7*Menu_factor_X,Window_pos_Y+126*Menu_factor_Y,Menu_factor_X*((64<<2)+2),Menu_factor_Y*((8<<2)+2));
Update_window_area(7,126,(64<<2)+2,(8<<2)+2);
Tag_shades(selection_start2,selection_end2);
Shade_draw_grad_ranges();
Display_selected_cell_color(selection_start2,selection_end2);
@ -484,8 +483,7 @@ int Menu_shade(void)
// Tracé d'un cadre creux autour du bloc dégradé
Window_display_frame_in(171,26,18,66);
Block(Window_pos_X+(Menu_factor_X*172),Window_pos_Y+(Menu_factor_Y*27),
Menu_factor_X<<4,Menu_factor_Y<<6,MC_Black);
Window_rectangle(172,27,16,64,MC_Black);
// Tracé d'un cadre creux autour de tous les dégradés
Window_display_frame_in(223,34,66,50);
Shade_draw_grad_ranges();
@ -526,7 +524,7 @@ int Menu_shade(void)
memcpy(buffer ,Shade_list[Shade_current].List,512*sizeof(word));
memcpy(undo_buffer,Shade_list[Shade_current].List,512*sizeof(word));
Update_rect(Window_pos_X,Window_pos_Y,Menu_factor_X*310,Menu_factor_Y*190);
Update_window_area(0,0,310,190);
Display_cursor();
@ -1070,7 +1068,7 @@ void Button_Quick_shade_menu(void)
Num2str(Quick_shade_step,str,3);
Window_input_content(step_button,str);
Update_rect(Window_pos_X,Window_pos_Y,Menu_factor_X*142,Menu_factor_Y*56);
Update_window_area(0,0,142,56);
Display_cursor();

View File

@ -108,24 +108,16 @@ void Window_display_frame_generic(word x_pos,word y_pos,word width,word height,
// color_brc=Coin Bas-Droite
{
// Bord haut (sans les extrémités)
Block(Window_pos_X+((x_pos+1)*Menu_factor_X),
Window_pos_Y+(y_pos*Menu_factor_Y),
(width-2)*Menu_factor_X,Menu_factor_Y,color_tl);
Window_rectangle(x_pos+1,y_pos,width-2,1,color_tl);
// Bord bas (sans les extrémités)
Block(Window_pos_X+((x_pos+1)*Menu_factor_X),
Window_pos_Y+((y_pos+height-1)*Menu_factor_Y),
(width-2)*Menu_factor_X,Menu_factor_Y,color_br);
Window_rectangle(x_pos+1,y_pos+height-1,width-2,1,color_br);
// Bord gauche (sans les extrémités)
Block(Window_pos_X+(x_pos*Menu_factor_X),
Window_pos_Y+((y_pos+1)*Menu_factor_Y),
Menu_factor_X,(height-2)*Menu_factor_Y,color_tl);
Window_rectangle(x_pos, y_pos+1,1,height-2,color_tl);
// Bord droite (sans les extrémités)
Block(Window_pos_X+((x_pos+width-1)*Menu_factor_X),
Window_pos_Y+((y_pos+1)*Menu_factor_Y),
Menu_factor_X,(height-2)*Menu_factor_Y,color_br);
Window_rectangle(x_pos+width-1,y_pos+1,1,height-2,color_br);
// Coin haut gauche
Pixel_in_window(x_pos,y_pos,color_tlc);
@ -706,15 +698,12 @@ void Print_char_in_window(short x_pos,short y_pos,const unsigned char c,byte tex
{
short x,y;
byte *pixel;
x_pos=(x_pos*Menu_factor_X)+Window_pos_X;
y_pos=(y_pos*Menu_factor_Y)+Window_pos_Y;
// Premier pixel du caractère
pixel=Menu_font + (c<<6);
for (y=0;y<8;y++)
for (x=0;x<8;x++)
Block(x_pos+(x*Menu_factor_X), y_pos+(y*Menu_factor_Y),
Menu_factor_X, Menu_factor_Y,
Pixel_in_window(x_pos+x, y_pos+y,
(*(pixel++)?text_color:background_color));
}
@ -735,10 +724,15 @@ void Print_in_window_limited(short x,short y,const char * str,byte size,byte tex
/// Draws a string in a window
void Print_in_window(short x,short y,const char * str,byte text_color,byte background_color)
{
Print_general((x*Menu_factor_X)+Window_pos_X,
(y*Menu_factor_Y)+Window_pos_Y,
str,text_color,background_color);
Update_rect(x*Menu_factor_X+Window_pos_X,y*Menu_factor_Y+Window_pos_Y,8*Menu_factor_X*strlen(str),8*Menu_factor_Y);
short x_pos = x;
int index;
for (index=0;str[index]!='\0';index++)
{
Print_char_in_window(x,y,str[index],text_color,background_color);
x+=8;
}
Update_window_area(x_pos,y,8*strlen(str),8);
}
// Draws a string in the menu's status bar
@ -1005,7 +999,7 @@ void Print_counter(short x,short y,const char * str,byte text_color,byte backgro
}
}
}
Update_rect(Window_pos_X+x*Menu_factor_X,Window_pos_Y+y*Menu_factor_Y,strlen(str)*Menu_factor_X*6,8*Menu_factor_Y);
Update_window_area(x,y,strlen(str)*6,8);
}
@ -1074,7 +1068,7 @@ byte Confirmation_box(char * message)
Window_set_normal_button((window_width/3)-20 ,29+(nb_lines<<3),40,14,"Yes",1,1,SDLK_y); // 1
Window_set_normal_button(((window_width<<1)/3)-20,29+(nb_lines<<3),40,14,"No" ,1,1,SDLK_n); // 2
Update_rect(Window_pos_X, Window_pos_Y, Window_width*Menu_factor_X, Window_height*Menu_factor_Y);
Update_window_area(0, 0, Window_width, Window_height);
Display_cursor();
@ -1116,8 +1110,7 @@ int Requester_window(char* message, int initial_value)
Window_set_normal_button(60 ,37,40,14,"OK",1,1,SDLK_y); // 2
Window_set_normal_button(130,37,60,14,"Cancel" ,1,1,SDLK_n); // 3
Update_rect(Window_pos_X, Window_pos_Y, Menu_factor_X * window_width,
Menu_factor_Y * 60);
Update_window_area(0, 0, window_width, 60);
Display_cursor();
do
@ -1152,7 +1145,7 @@ void Warning_message(char * message)
Print_in_window((window_width>>1)-(strlen(message)<<2),20,message,MC_Black,MC_Light);
Window_set_normal_button((window_width>>1)-20 ,37,40,14,"OK",1,1,SDLK_RETURN); // 1
Update_rect(Window_pos_X,Window_pos_Y,Menu_factor_X*window_width,Menu_factor_Y*60);
Update_window_area(0,0,window_width,60);
Display_cursor();
do