forked from KolibriOS/kolibrios
Controls ScrolledWindow and ProgressBar render in buffer befor screen output.
Some size and speed optimizations and some bugfixes. git-svn-id: svn://kolibrios.org@1163 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
8f20fe84d3
commit
cbfb59ad64
2
programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile → programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile
Executable file → Normal file
2
programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile → programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile
Executable file → Normal file
@ -2,10 +2,10 @@ SRC = libGUI.c
|
|||||||
TARGET = libGUI.obj
|
TARGET = libGUI.obj
|
||||||
CFLAGS = -O2 -nostdinc -nostdlib -march=pentium -fomit-frame-pointer -fno-builtin
|
CFLAGS = -O2 -nostdinc -nostdlib -march=pentium -fomit-frame-pointer -fno-builtin
|
||||||
CC = gcc
|
CC = gcc
|
||||||
AR=ar
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(CC) -c $(SRC) $(CFLAGS) -o $(TARGET)
|
$(CC) -c $(SRC) $(CFLAGS) -o $(TARGET)
|
||||||
|
strip -X --strip-unneeded $(TARGET)
|
||||||
clean:
|
clean:
|
||||||
rm *.obj
|
rm *.obj
|
||||||
rm $(TARGET)
|
rm $(TARGET)
|
@ -276,6 +276,9 @@ void ButtonProc(struct ControlButton *button,struct MESSAGE *message)
|
|||||||
{
|
{
|
||||||
if (message->arg3==MOUSE_LEFT_BUTTON_DOWN)
|
if (message->arg3==MOUSE_LEFT_BUTTON_DOWN)
|
||||||
{
|
{
|
||||||
|
if ((button->btn_flags & FLAG_PRESSED_BUTTON_ON)==FALSE)
|
||||||
|
{if (button->flags & FLAG_SHOW_CONTROL)
|
||||||
|
DrawPressedButton(button);}
|
||||||
button->btn_flags=button->btn_flags | FLAG_PRESSED_BUTTON_ON;
|
button->btn_flags=button->btn_flags | FLAG_PRESSED_BUTTON_ON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +294,6 @@ void ButtonProc(struct ControlButton *button,struct MESSAGE *message)
|
|||||||
(DWORD*)ControlCheckCallbackEvent(button,(DWORD)BUTTON_PRESSED_EVENT);
|
(DWORD*)ControlCheckCallbackEvent(button,(DWORD)BUTTON_PRESSED_EVENT);
|
||||||
main_parent->number_callbacks++;
|
main_parent->number_callbacks++;
|
||||||
}
|
}
|
||||||
if (button->flags & FLAG_SHOW_CONTROL) DrawPressedButton(button);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -399,7 +401,7 @@ void* CreateButtonWithText(gui_button_data_t *info,char *txt)
|
|||||||
memmove(txtdata.text,txt,len);
|
memmove(txtdata.text,txt,len);
|
||||||
text=CreateText(&txtdata);
|
text=CreateText(&txtdata);
|
||||||
|
|
||||||
if (text->ctrl_sizex>Button->ctrl_sizex) Button->ctrl_sizex=text->ctrl_sizex+6;
|
if (text->ctrl_sizex>Button->ctrl_sizex) Button->ctrl_sizex=text->ctrl_sizex+10;
|
||||||
if (text->ctrl_sizey>Button->ctrl_sizey) Button->ctrl_sizey=text->ctrl_sizey+6;
|
if (text->ctrl_sizey>Button->ctrl_sizey) Button->ctrl_sizey=text->ctrl_sizey+6;
|
||||||
|
|
||||||
text->ctrl_x=(Button->ctrl_sizex/2)-(text->ctrl_sizex/2);
|
text->ctrl_x=(Button->ctrl_sizex/2)-(text->ctrl_sizex/2);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
control ProgressBar
|
control ProgressBar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar)
|
void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
@ -72,11 +71,12 @@ void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar)
|
|||||||
|
|
||||||
void DrawProgressBar(struct ControlProgressBar *ProgressBar)
|
void DrawProgressBar(struct ControlProgressBar *ProgressBar)
|
||||||
{
|
{
|
||||||
int x;
|
int x,y,sizex,sizey;
|
||||||
int y;
|
char c;
|
||||||
int sizex;
|
char *save_buf,*buf;
|
||||||
int sizey;
|
int save_size_x,save_size_y;
|
||||||
struct FINITION *fin;
|
DWORD draw_output,flags;
|
||||||
|
finition_t *fin;
|
||||||
|
|
||||||
x=ProgressBar->ctrl_x;
|
x=ProgressBar->ctrl_x;
|
||||||
y=ProgressBar->ctrl_y;
|
y=ProgressBar->ctrl_y;
|
||||||
@ -84,10 +84,51 @@ void DrawProgressBar(struct ControlProgressBar *ProgressBar)
|
|||||||
sizey=ProgressBar->ctrl_sizey;
|
sizey=ProgressBar->ctrl_sizey;
|
||||||
fin=(struct FINITION*)ProgressBar->finition;
|
fin=(struct FINITION*)ProgressBar->finition;
|
||||||
|
|
||||||
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK);
|
//alocate a buffer for draw text
|
||||||
Draw(fin,TOOL_GRADIENT_UP_FILLED_RECTANGLE,x+1,y+1,sizex-2,sizey-2,COLOR_MIDDLE_LIGHT,COLOR_LIGHT);
|
c=screen.bits_per_pixel >> 3;
|
||||||
|
buf=malloc(sizex*sizey*c);
|
||||||
|
|
||||||
|
//save current screen parameters
|
||||||
|
save_buf=screen.buffer;
|
||||||
|
save_size_x=screen.size_x;
|
||||||
|
save_size_y=screen.size_y;
|
||||||
|
draw_output=screen.draw_output;
|
||||||
|
|
||||||
|
//load parameters of local buffer
|
||||||
|
screen.buffer=buf;
|
||||||
|
screen.size_x=sizex;
|
||||||
|
screen.size_y=sizey;
|
||||||
|
screen.draw_output=DRAW_OUTPUT_BUFFER;
|
||||||
|
|
||||||
|
//move control
|
||||||
|
SetControlNewPosition(ProgressBar,0,0);
|
||||||
|
//save finition parameters
|
||||||
|
flags=fin->flags;
|
||||||
|
fin->flags &=FINITION_OFF;
|
||||||
|
|
||||||
|
//draw progress bar in buffer
|
||||||
|
Draw(fin,TOOL_RECTANGLE,0,0,sizex,sizey,COLOR_ABSOLUTE_DARK);
|
||||||
ProgressBarDrawProgress(ProgressBar);
|
ProgressBarDrawProgress(ProgressBar);
|
||||||
|
|
||||||
|
//restore last position of control
|
||||||
|
SetControlNewPosition(ProgressBar,x,y);
|
||||||
|
//restore finition
|
||||||
|
fin->flags=flags;
|
||||||
|
|
||||||
|
//restore screen parameters
|
||||||
|
screen.buffer=save_buf;
|
||||||
|
screen.size_x=save_size_x;
|
||||||
|
screen.size_y=save_size_y;
|
||||||
|
screen.draw_output=draw_output;
|
||||||
|
|
||||||
|
//move rendered objects from local buffer to screen
|
||||||
|
if (fin->flags & FINITION_ON)
|
||||||
|
DrawImageFinit(fin,x,y,sizex,sizey,screen.bits_per_pixel,buf);
|
||||||
|
else
|
||||||
|
DrawImage(x,y,sizex,sizey,screen.bits_per_pixel,buf);
|
||||||
|
|
||||||
|
//free local buffer
|
||||||
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetProgressBarPulse(struct ControlProgressBar *ProgressBar,int time_tick)
|
void SetProgressBarPulse(struct ControlProgressBar *ProgressBar,int time_tick)
|
||||||
@ -100,7 +141,7 @@ void SetProgressBarPulse(struct ControlProgressBar *ProgressBar,int time_tick)
|
|||||||
{
|
{
|
||||||
main_parent->number_timers_for_controls++;
|
main_parent->number_timers_for_controls++;
|
||||||
|
|
||||||
ProgressBar->timer=(DWORD*)SetTimerCallbackForControl(time_tick,&ProgressBarDrawProgress,ProgressBar);
|
ProgressBar->timer=(DWORD*)SetTimerCallbackForControl(time_tick,&DrawProgressBar,ProgressBar);
|
||||||
timer=(struct TIMER*)ProgressBar->timer;
|
timer=(struct TIMER*)ProgressBar->timer;
|
||||||
timer->flags=timer->flags | FLAG_TIMER_ON;
|
timer->flags=timer->flags | FLAG_TIMER_ON;
|
||||||
}
|
}
|
||||||
@ -148,6 +189,7 @@ void ProgressBarProc(struct ControlProgressBar *ProgressBar,struct MESSAGE *mess
|
|||||||
{
|
{
|
||||||
ProgressBar->ctrl_x=ProgressBar->ctrl_x+message->arg1;
|
ProgressBar->ctrl_x=ProgressBar->ctrl_x+message->arg1;
|
||||||
ProgressBar->ctrl_y=ProgressBar->ctrl_y+message->arg2;
|
ProgressBar->ctrl_y=ProgressBar->ctrl_y+message->arg2;
|
||||||
|
SendMessage((struct HEADER*)ProgressBar,message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MESSAGE_CALL_TIMER_EVENT:
|
case MESSAGE_CALL_TIMER_EVENT:
|
||||||
@ -157,25 +199,26 @@ void ProgressBarProc(struct ControlProgressBar *ProgressBar,struct MESSAGE *mess
|
|||||||
timer=(struct TIMER*)ProgressBar->timer;
|
timer=(struct TIMER*)ProgressBar->timer;
|
||||||
if (timer->flags & FLAG_TIMER_ON) Timer(timer);
|
if (timer->flags & FLAG_TIMER_ON) Timer(timer);
|
||||||
}
|
}
|
||||||
|
SendMessage((struct HEADER*)ProgressBar,message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MESSAGE_DESTROY_CONTROL:
|
case MESSAGE_DESTROY_CONTROL:
|
||||||
{
|
{
|
||||||
if (ProgressBar->timer!=(DWORD*)NULL) free(ProgressBar->timer);
|
if (ProgressBar->timer!=(DWORD*)NULL) free(ProgressBar->timer);
|
||||||
free(ProgressBar->finition);
|
free(ProgressBar->finition);
|
||||||
|
SendMessage((struct HEADER*)ProgressBar,message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MESSAGE_SET_MAIN_PARENT:
|
case MESSAGE_SET_MAIN_PARENT:
|
||||||
{
|
{
|
||||||
SendMessage((struct HEADER*)ProgressBar,message);
|
SendMessage((struct HEADER*)ProgressBar,message);
|
||||||
ProgressBar->main_parent=(DWORD*)message->arg1;
|
ProgressBar->main_parent=(DWORD*)message->arg1;
|
||||||
|
SendMessage((struct HEADER*)ProgressBar,message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
//send message to child controls(if there is)
|
|
||||||
SendMessage((struct HEADER*)ProgressBar,message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
@ -103,8 +103,112 @@ void ScrolledWindowPackControls(void *parent,void *Control)
|
|||||||
|
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Draw full Scroll Bar
|
// Draw full Scrolled Window
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void ScrollWin_FuncCallback_HVScroll(struct HEADER* control,void *data)
|
||||||
|
{
|
||||||
|
struct ControlScrollBar *Hscrollbar,*Vscrollbar;
|
||||||
|
struct ControlScrolledWindow *ScrolledWindow;
|
||||||
|
struct HEADER *seek_control,*exchange_control;
|
||||||
|
struct MESSAGE local_message;
|
||||||
|
struct FINITION *fin;
|
||||||
|
int i,new_x,new_y,x,y,sizex,sizey;
|
||||||
|
char c;
|
||||||
|
char *save_buf,*buf;
|
||||||
|
int save_size_x,save_size_y;
|
||||||
|
DWORD draw_output;
|
||||||
|
|
||||||
|
ScrolledWindow=(gui_scrolled_window_t*)data;
|
||||||
|
Hscrollbar=(gui_scroll_bar_t*)ScrolledWindow->horizontal_scroll;
|
||||||
|
Vscrollbar=(gui_scroll_bar_t*)ScrolledWindow->vertical_scroll;
|
||||||
|
ScrolledWindow->virtual_x=(ScrolledWindow->virtual_sizex-ScrolledWindow->scroll_arrea_sizex)*Hscrollbar->ruller_pos;
|
||||||
|
ScrolledWindow->virtual_y=(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)*Vscrollbar->ruller_pos;
|
||||||
|
|
||||||
|
x=ScrolledWindow->ctrl_x+1;
|
||||||
|
y=ScrolledWindow->ctrl_y+1;
|
||||||
|
sizex=ScrolledWindow->scroll_arrea_sizex;
|
||||||
|
sizey=ScrolledWindow->scroll_arrea_sizey;
|
||||||
|
|
||||||
|
//alocate a buffer for draw text
|
||||||
|
c=screen.bits_per_pixel >> 3;
|
||||||
|
i=sizex*sizey*c;
|
||||||
|
buf=malloc(i);
|
||||||
|
|
||||||
|
//save current screen parameters
|
||||||
|
save_buf=screen.buffer;
|
||||||
|
save_size_x=screen.size_x;
|
||||||
|
save_size_y=screen.size_y;
|
||||||
|
draw_output=screen.draw_output;
|
||||||
|
|
||||||
|
//load parameters of local buffer
|
||||||
|
screen.buffer=buf;
|
||||||
|
screen.size_x=sizex;
|
||||||
|
screen.size_y=sizey;
|
||||||
|
screen.draw_output=DRAW_OUTPUT_BUFFER;
|
||||||
|
|
||||||
|
//fill buffer by background color
|
||||||
|
FillArrea(buf,i,screen.bits_per_pixel,COLOR_LIGHT);
|
||||||
|
|
||||||
|
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION;
|
||||||
|
local_message.arg1=0;
|
||||||
|
local_message.arg2=0;
|
||||||
|
local_message.arg3=sizex;
|
||||||
|
local_message.arg4=sizey;
|
||||||
|
|
||||||
|
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd;
|
||||||
|
//move controls in new position
|
||||||
|
for(i=0;i<ScrolledWindow->number_virtual_controls;i++)
|
||||||
|
{
|
||||||
|
new_x=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x;
|
||||||
|
new_y=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y;
|
||||||
|
|
||||||
|
SetControlNewPosition(seek_control,new_x,new_y);
|
||||||
|
|
||||||
|
if (CheckCrossRectangles(x,y,sizex,sizey,new_x,new_y,
|
||||||
|
seek_control->ctrl_sizex,
|
||||||
|
seek_control->ctrl_sizey)==TRUE)
|
||||||
|
{
|
||||||
|
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL;
|
||||||
|
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF;
|
||||||
|
|
||||||
|
//move control
|
||||||
|
SetControlNewPosition(seek_control,new_x-x,new_y-y);
|
||||||
|
//call draw control in buffer
|
||||||
|
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc;
|
||||||
|
ControlProc(seek_control,&local_message);
|
||||||
|
//restore last position of control
|
||||||
|
SetControlNewPosition(seek_control,new_x,new_y);
|
||||||
|
//restore coordinates of last finition of control
|
||||||
|
fin=(finition_t*)seek_control->finition;
|
||||||
|
fin->x=x;
|
||||||
|
fin->y=y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL;
|
||||||
|
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
exchange_control=(struct HEADER*)seek_control->ctrl_fd;
|
||||||
|
seek_control=exchange_control;
|
||||||
|
}
|
||||||
|
//restore screen parameters
|
||||||
|
screen.buffer=save_buf;
|
||||||
|
screen.size_x=save_size_x;
|
||||||
|
screen.size_y=save_size_y;
|
||||||
|
screen.draw_output=draw_output;
|
||||||
|
|
||||||
|
//move rendered objects from local buffer to screen
|
||||||
|
fin=(finition_t*)ScrolledWindow->finition;
|
||||||
|
if (fin->flags & FINITION_ON)
|
||||||
|
DrawImageFinit(fin,x,y,sizex,sizey,screen.bits_per_pixel,buf);
|
||||||
|
else
|
||||||
|
DrawImage(x,y,sizex,sizey,screen.bits_per_pixel,buf);
|
||||||
|
|
||||||
|
//free local buffer
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow)
|
void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow)
|
||||||
{
|
{
|
||||||
int x,y,sizex,sizey;
|
int x,y,sizex,sizey;
|
||||||
@ -116,138 +220,16 @@ void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow)
|
|||||||
sizey=ScrolledWindow->ctrl_sizey;
|
sizey=ScrolledWindow->ctrl_sizey;
|
||||||
fin=(struct FINITION*)ScrolledWindow->finition;
|
fin=(struct FINITION*)ScrolledWindow->finition;
|
||||||
|
|
||||||
Draw(fin,TOOL_FILLED_RECTANGLE,x+1,y+1,ScrolledWindow->scroll_arrea_sizex,
|
|
||||||
ScrolledWindow->scroll_arrea_sizey,COLOR_LIGHT);
|
|
||||||
|
|
||||||
if ((ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_HORIZONTAL_SCROLL_ON) ||
|
if ((ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_HORIZONTAL_SCROLL_ON) ||
|
||||||
(ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON))
|
(ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON))
|
||||||
{
|
{
|
||||||
Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2,
|
Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2,
|
||||||
ScrolledWindow->scroll_arrea_sizey+2,0xff0000);
|
ScrolledWindow->scroll_arrea_sizey+2,COLOR_ABSOLUTE_DARK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK);
|
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK);
|
||||||
}
|
|
||||||
|
|
||||||
void ScrollWin_FuncCallback_HScroll(struct HEADER* control,void *data)
|
ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow);
|
||||||
{
|
|
||||||
struct ControlScrollBar *Hscrollbar,*Vscrollbar;
|
|
||||||
struct ControlScrolledWindow *ScrolledWindow;
|
|
||||||
struct HEADER *seek_control,*exchange_control;
|
|
||||||
struct FINITION *fin;
|
|
||||||
struct MESSAGE local_message;
|
|
||||||
int i,new_x,new_y,x,y,sizex,sizey;
|
|
||||||
|
|
||||||
Hscrollbar=(struct ControlScrollBar*)control;
|
|
||||||
ScrolledWindow=(struct ControlScrolledWindow*)data;
|
|
||||||
|
|
||||||
ScrolledWindow->virtual_x=(ScrolledWindow->virtual_sizex-ScrolledWindow->scroll_arrea_sizex)*Hscrollbar->ruller_pos;
|
|
||||||
|
|
||||||
x=ScrolledWindow->ctrl_x+1;
|
|
||||||
y=ScrolledWindow->ctrl_y+1;
|
|
||||||
sizex=ScrolledWindow->scroll_arrea_sizex;
|
|
||||||
sizey=ScrolledWindow->scroll_arrea_sizey;
|
|
||||||
|
|
||||||
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION;
|
|
||||||
local_message.arg1=x;
|
|
||||||
local_message.arg2=y;
|
|
||||||
local_message.arg3=sizex;
|
|
||||||
local_message.arg4=sizey;
|
|
||||||
|
|
||||||
fin=(finition_t*)ScrolledWindow->finition;
|
|
||||||
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT);
|
|
||||||
|
|
||||||
Vscrollbar=(struct ControlScrollBar*)ScrolledWindow->vertical_scroll;
|
|
||||||
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd;
|
|
||||||
//move controls in new position
|
|
||||||
for(i=0;i<ScrolledWindow->number_virtual_controls;i++)
|
|
||||||
{
|
|
||||||
new_x=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x;
|
|
||||||
new_y=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y;
|
|
||||||
|
|
||||||
SetControlNewPosition(seek_control,new_x,new_y);
|
|
||||||
|
|
||||||
if (CheckCrossRectangles(local_message.arg1,local_message.arg2,local_message.arg3,local_message.arg4,
|
|
||||||
seek_control->ctrl_x,seek_control->ctrl_y,seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE)
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seek_control->flags & FLAG_SHOW_CONTROL)
|
|
||||||
{
|
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc;
|
|
||||||
ControlProc(seek_control,&local_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
exchange_control=(struct HEADER*)seek_control->ctrl_fd;
|
|
||||||
seek_control=exchange_control;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrollWin_FuncCallback_VScroll(struct HEADER* control,void *data)
|
|
||||||
{
|
|
||||||
struct ControlScrollBar *Hscrollbar,*Vscrollbar;
|
|
||||||
struct ControlScrolledWindow *ScrolledWindow;
|
|
||||||
struct HEADER *seek_control,*exchange_control;
|
|
||||||
struct MESSAGE local_message;
|
|
||||||
struct FINITION *fin;
|
|
||||||
int i,new_x,new_y,x,y,sizex,sizey;
|
|
||||||
|
|
||||||
Vscrollbar=(struct ControlScrollBar*)control;
|
|
||||||
ScrolledWindow=(struct ControlScrolledWindow*)data;
|
|
||||||
|
|
||||||
ScrolledWindow->virtual_y=(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)*Vscrollbar->ruller_pos;
|
|
||||||
|
|
||||||
x=ScrolledWindow->ctrl_x+1;
|
|
||||||
y=ScrolledWindow->ctrl_y+1;
|
|
||||||
sizex=ScrolledWindow->scroll_arrea_sizex;
|
|
||||||
sizey=ScrolledWindow->scroll_arrea_sizey;
|
|
||||||
|
|
||||||
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION;
|
|
||||||
local_message.arg1=x;
|
|
||||||
local_message.arg2=y;
|
|
||||||
local_message.arg3=sizex;
|
|
||||||
local_message.arg4=sizey;
|
|
||||||
|
|
||||||
fin=(finition_t*)ScrolledWindow->finition;
|
|
||||||
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT);
|
|
||||||
|
|
||||||
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd;
|
|
||||||
//move controls in new position
|
|
||||||
for(i=0;i<ScrolledWindow->number_virtual_controls;i++)
|
|
||||||
{
|
|
||||||
new_x=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x;
|
|
||||||
new_y=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y;
|
|
||||||
|
|
||||||
SetControlNewPosition(seek_control,new_x,new_y);
|
|
||||||
|
|
||||||
if (CheckCrossRectangles(local_message.arg1,local_message.arg2,local_message.arg3,local_message.arg4,
|
|
||||||
seek_control->ctrl_x,seek_control->ctrl_y,seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE)
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seek_control->flags & FLAG_SHOW_CONTROL)
|
|
||||||
{
|
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc;
|
|
||||||
ControlProc(seek_control,&local_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
exchange_control=(struct HEADER*)seek_control->ctrl_fd;
|
|
||||||
seek_control=exchange_control;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledWindow)
|
void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledWindow)
|
||||||
@ -326,46 +308,7 @@ void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledW
|
|||||||
Vscrollbar->ruller_pos=Vscrollbar->ruller_pos/((float)(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey));
|
Vscrollbar->ruller_pos=Vscrollbar->ruller_pos/((float)(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey));
|
||||||
SpecialRedrawControl(Vscrollbar);
|
SpecialRedrawControl(Vscrollbar);
|
||||||
}
|
}
|
||||||
|
ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow);
|
||||||
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION;
|
|
||||||
local_message.arg1=x;
|
|
||||||
local_message.arg2=y;
|
|
||||||
local_message.arg3=sizex;
|
|
||||||
local_message.arg4=sizey;
|
|
||||||
|
|
||||||
fin=(finition_t*)ScrolledWindow->finition;
|
|
||||||
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT);
|
|
||||||
|
|
||||||
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd;
|
|
||||||
//move controls in new position
|
|
||||||
for(i=0;i<ScrolledWindow->number_virtual_controls;i++)
|
|
||||||
{
|
|
||||||
sx=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x;
|
|
||||||
sy=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y;
|
|
||||||
|
|
||||||
SetControlNewPosition(seek_control,sx,sy);
|
|
||||||
|
|
||||||
if (CheckCrossRectangles(x,y,sizex,sizey,seek_control->ctrl_x,seek_control->ctrl_y,
|
|
||||||
seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE)
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL;
|
|
||||||
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seek_control->flags & FLAG_SHOW_CONTROL)
|
|
||||||
{
|
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc;
|
|
||||||
ControlProc(seek_control,&local_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
exchange_control=(struct HEADER*)seek_control->ctrl_fd;
|
|
||||||
seek_control=exchange_control;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
@ -375,8 +318,8 @@ void ScrolledWindowProc(struct ControlScrolledWindow *ScrolledWindow,struct MESS
|
|||||||
{
|
{
|
||||||
int i,x,y,sizex,sizey;
|
int i,x,y,sizex,sizey;
|
||||||
struct HEADER *seek_control,*exchange_control;
|
struct HEADER *seek_control,*exchange_control;
|
||||||
struct ControlScrollBar *Hscrollbar,*Vscrollbar;
|
struct ControlScrollBar *Hscrollbar,*Vscrollbar;
|
||||||
struct MESSAGE local_message;
|
struct MESSAGE local_message;
|
||||||
struct FINITION *fin;
|
struct FINITION *fin;
|
||||||
struct TIMER *timer;
|
struct TIMER *timer;
|
||||||
|
|
||||||
@ -393,35 +336,13 @@ void ScrolledWindowProc(struct ControlScrolledWindow *ScrolledWindow,struct MESS
|
|||||||
if (ScrolledWindow->flags & FLAG_SHOW_CONTROL)
|
if (ScrolledWindow->flags & FLAG_SHOW_CONTROL)
|
||||||
{
|
{
|
||||||
DrawScrolledWindow(ScrolledWindow);
|
DrawScrolledWindow(ScrolledWindow);
|
||||||
|
Hscrollbar=(gui_scroll_bar_t*)ScrolledWindow->horizontal_scroll;
|
||||||
//send message to scroll bars
|
Vscrollbar=(gui_scroll_bar_t*)ScrolledWindow->vertical_scroll;
|
||||||
Hscrollbar=(struct ControlScrollBar*)ScrolledWindow->horizontal_scroll;
|
//draw scroll bars
|
||||||
Vscrollbar=(struct ControlScrollBar*)ScrolledWindow->vertical_scroll;
|
ControlProc=(void (*)(void *Control,gui_message_t *message))Hscrollbar->ctrl_proc;
|
||||||
|
ControlProc(Hscrollbar,message);
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))Hscrollbar->ctrl_proc;
|
ControlProc=(void (*)(void *Control,gui_message_t *message))Vscrollbar->ctrl_proc;
|
||||||
ControlProc((struct HEADER*)Hscrollbar,message);
|
ControlProc(Vscrollbar,message);
|
||||||
|
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))Vscrollbar->ctrl_proc;
|
|
||||||
ControlProc((struct HEADER*)Vscrollbar,message);
|
|
||||||
|
|
||||||
//send message finit redraw only to some child controls of ScrolledWondow
|
|
||||||
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION;
|
|
||||||
local_message.arg1=ScrolledWindow->ctrl_x+1;
|
|
||||||
local_message.arg2=ScrolledWindow->ctrl_y+1;
|
|
||||||
local_message.arg3=ScrolledWindow->scroll_arrea_sizex;
|
|
||||||
local_message.arg4=ScrolledWindow->scroll_arrea_sizey;
|
|
||||||
|
|
||||||
seek_control=(struct HEADER *)Vscrollbar->ctrl_fd;
|
|
||||||
while(seek_control!=(struct HEADER*)NULL)
|
|
||||||
{
|
|
||||||
if (seek_control->flags & FLAG_SHOW_CONTROL)
|
|
||||||
{
|
|
||||||
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc;
|
|
||||||
ControlProc(seek_control,&local_message);
|
|
||||||
}
|
|
||||||
exchange_control=(struct HEADER*)seek_control->ctrl_fd;
|
|
||||||
seek_control=exchange_control;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -590,8 +511,8 @@ void* CreateScrolledWindow(struct ScrolledWindowData *info_for_control)
|
|||||||
HorizontalScrollBar=CreateHorizontalScrollBar(&HorizontalScrollData);
|
HorizontalScrollBar=CreateHorizontalScrollBar(&HorizontalScrollData);
|
||||||
VerticalScrollBar=CreateVerticalScrollBar(&VerticalScrollData);
|
VerticalScrollBar=CreateVerticalScrollBar(&VerticalScrollData);
|
||||||
|
|
||||||
SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HScroll,ScrolledWindow);
|
SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow);
|
||||||
SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_VScroll,ScrolledWindow);
|
SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow);
|
||||||
|
|
||||||
PackControls(ScrolledWindow,HorizontalScrollBar);
|
PackControls(ScrolledWindow,HorizontalScrollBar);
|
||||||
PackControls(ScrolledWindow,VerticalScrollBar);
|
PackControls(ScrolledWindow,VerticalScrollBar);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
function for draw controls
|
functions for draw controls
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
@ -1219,30 +1219,35 @@ void DrawImage(int x,int y,int sizex,int sizey,char bits_per_pixel,char *img)
|
|||||||
switch(screen.bits_per_pixel)
|
switch(screen.bits_per_pixel)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
{
|
|
||||||
if (bits_per_pixel==32)
|
|
||||||
{//convert 32 bit image to 24 bit image
|
|
||||||
j=sizex*sizey;
|
|
||||||
ptr_src=img;
|
|
||||||
ptr_screen=malloc(j*3);
|
|
||||||
ptr_screen2=ptr_screen;
|
|
||||||
for(i=0;i<j;i++)
|
|
||||||
{
|
|
||||||
*(char*)ptr_screen=*(char*)ptr_src;
|
|
||||||
*((char*)ptr_screen+1)=*((char*)ptr_src+1);
|
|
||||||
*((char*)ptr_screen+2)=*((char*)ptr_src+2);
|
|
||||||
|
|
||||||
ptr_src+=4;
|
|
||||||
ptr_screen+=3;
|
|
||||||
}
|
|
||||||
gui_ksys_put_image_window(ptr_screen2,x,y,countx,county);
|
|
||||||
free(ptr_screen2);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
gui_ksys_put_image_window(img,x,y,countx,county);
|
switch(bits_per_pixel)
|
||||||
|
{//check bits per pixel in picture
|
||||||
|
case 32:
|
||||||
|
{//convert 32 bit image to 24 bit image
|
||||||
|
j=sizex*sizey;
|
||||||
|
ptr_src=img;
|
||||||
|
ptr_screen=malloc(j*3);
|
||||||
|
ptr_screen2=ptr_screen;
|
||||||
|
for(i=0;i<j;i++)
|
||||||
|
{
|
||||||
|
*(char*)ptr_screen=*(char*)ptr_src;
|
||||||
|
*((char*)ptr_screen+1)=*((char*)ptr_src+1);
|
||||||
|
*((char*)ptr_screen+2)=*((char*)ptr_src+2);
|
||||||
|
|
||||||
|
ptr_src+=4;
|
||||||
|
ptr_screen+=3;
|
||||||
|
}
|
||||||
|
gui_ksys_put_image_window(ptr_screen2,x,y,countx,county);
|
||||||
|
free(ptr_screen2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 24:
|
||||||
|
{
|
||||||
|
gui_ksys_put_image_window(img,x,y,countx,county);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
@ -1258,42 +1263,38 @@ void DrawImage(int x,int y,int sizex,int sizey,char bits_per_pixel,char *img)
|
|||||||
switch(bits_per_pixel)
|
switch(bits_per_pixel)
|
||||||
{
|
{
|
||||||
case 32://display 32 bit image in 24 bit mode
|
case 32://display 32 bit image in 24 bit mode
|
||||||
{
|
{//convert and draw 32 bit image in 24 bit buffer
|
||||||
pitch_screen=screen.size_x*3;
|
ptr_screen=screen.buffer+(screen.size_x*y+x)*3;
|
||||||
pitch_src=countx << 2;
|
add_screen=(screen.size_x-countx)*3;
|
||||||
ptr_screen=screen.buffer+pitch_screen*y+x*3;
|
|
||||||
ptr_src=img;
|
ptr_src=img;
|
||||||
add_screen=pitch_screen-pitch_src;
|
|
||||||
//copy line of byte with size x
|
//copy line of byte with size x
|
||||||
for(i=0;i<county;i++)
|
for(i=0;i<county;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<pitch_src;j++)
|
for(j=0;j<countx;j++)
|
||||||
{
|
{
|
||||||
*(char*)ptr_screen=*(char*)ptr_src;
|
*(char*)ptr_screen=*(char*)ptr_src;
|
||||||
ptr_src++;
|
*((char*)ptr_screen+1)=*((char*)ptr_src+1);
|
||||||
ptr_screen++;
|
*((char*)ptr_screen+2)=*((char*)ptr_src+2);
|
||||||
|
|
||||||
|
ptr_src+=4;
|
||||||
|
ptr_screen+=3;
|
||||||
}
|
}
|
||||||
ptr_screen+=add_screen;
|
ptr_screen+=add_screen;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 24://display 24 bit image in 24 bit mode
|
case 24:
|
||||||
{
|
{//display 24 bit image in 24 bit buffer
|
||||||
pitch_screen=screen.size_x*3;
|
ptr_screen=screen.buffer+(screen.size_x*y+x)*3;
|
||||||
pitch_src=countx*3;
|
add_screen=screen.size_x*3;
|
||||||
ptr_screen=screen.buffer+pitch_screen*y+x*3;
|
add_src=countx*3;
|
||||||
ptr_src=img;
|
|
||||||
add_screen=pitch_screen-pitch_src;
|
|
||||||
//copy line of byte with size x
|
//copy line of byte with size x
|
||||||
for(i=0;i<county;i++)
|
for(i=0;i<county;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<pitch_src;j++)
|
memmove(ptr_screen,img,add_src);
|
||||||
{
|
|
||||||
*(char*)ptr_screen=*(char*)ptr_src;
|
|
||||||
ptr_src++;
|
|
||||||
ptr_screen++;
|
|
||||||
}
|
|
||||||
ptr_screen+=add_screen;
|
ptr_screen+=add_screen;
|
||||||
|
img+=add_src;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1305,28 +1306,41 @@ void DrawImage(int x,int y,int sizex,int sizey,char bits_per_pixel,char *img)
|
|||||||
{ //check source image resolution
|
{ //check source image resolution
|
||||||
switch(bits_per_pixel)
|
switch(bits_per_pixel)
|
||||||
{
|
{
|
||||||
case 32://display 32 bit image in 32 bit mode
|
case 32:
|
||||||
{
|
{//display 32 bit image in 32 bit mode
|
||||||
pitch_screen=screen.size_x << 2;
|
ptr_screen=screen.buffer+(screen.size_x*y+x)*4;
|
||||||
pitch_src=countx << 2;
|
add_screen=screen.size_x*4;
|
||||||
ptr_screen=screen.buffer+pitch_screen*y+x*4;
|
add_src=countx*4;
|
||||||
ptr_src=img;
|
|
||||||
add_screen=pitch_screen-pitch_src;
|
|
||||||
//copy line of byte with size x
|
//copy line of byte with size x
|
||||||
for(i=0;i<county;i++)
|
for(i=0;i<county;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<pitch_src;j++)
|
memmove(ptr_screen,img,add_src);
|
||||||
{
|
|
||||||
*(char*)ptr_screen=*(char*)ptr_src;
|
|
||||||
ptr_src++;
|
|
||||||
ptr_screen++;
|
|
||||||
}
|
|
||||||
ptr_screen+=add_screen;
|
ptr_screen+=add_screen;
|
||||||
|
img+=add_src;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 24://display 24 bit image in 32 bit mode
|
case 24://display 24 bit image in 32 bit mode
|
||||||
{
|
{
|
||||||
|
ptr_screen=screen.buffer+(screen.size_x*y+x)*4;
|
||||||
|
add_screen=(screen.size_x-countx)*4;
|
||||||
|
ptr_src=img;
|
||||||
|
//copy line of byte with size x
|
||||||
|
for(i=0;i<county;i++)
|
||||||
|
{
|
||||||
|
for(j=0;j<countx;j++)
|
||||||
|
{
|
||||||
|
*(char*)ptr_screen=*(char*)ptr_src;
|
||||||
|
*((char*)ptr_screen+1)=*((char*)ptr_src+1);
|
||||||
|
*((char*)ptr_screen+2)=*((char*)ptr_src+2);
|
||||||
|
|
||||||
|
ptr_src+=3;
|
||||||
|
ptr_screen+=4;
|
||||||
|
}
|
||||||
|
ptr_screen+=add_screen;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
@ -1401,32 +1415,28 @@ void DrawImageFinit(finition_t *fin,int x,int y,int sizex,int sizey,char bits_pe
|
|||||||
county=y2-y1+1;
|
county=y2-y1+1;
|
||||||
|
|
||||||
//cut finited rectangle from image and move them into buffer
|
//cut finited rectangle from image and move them into buffer
|
||||||
|
|
||||||
|
bytes_per_pixel=bits_per_pixel >> 3;
|
||||||
|
buf=malloc(countx*county*bytes_per_pixel);
|
||||||
|
ptr_dest=buf;
|
||||||
|
|
||||||
|
pitch_src=sizex*bytes_per_pixel;
|
||||||
|
ptr_src=img+pitch_src*(y1-y)+(x1-x)*bytes_per_pixel;
|
||||||
|
add_src=sizex*bytes_per_pixel;
|
||||||
|
countline=countx*bytes_per_pixel;
|
||||||
|
|
||||||
switch(bits_per_pixel)
|
switch(bits_per_pixel)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
case 24:
|
case 24:
|
||||||
case 16:
|
case 16:
|
||||||
case 8:
|
case 8:
|
||||||
{ //allocate buffer
|
{
|
||||||
bytes_per_pixel=bits_per_pixel >> 3;
|
|
||||||
buf=malloc(countx*county*bytes_per_pixel);
|
|
||||||
ptr_dest=buf;
|
|
||||||
|
|
||||||
pitch_src=sizex*bytes_per_pixel;
|
|
||||||
ptr_src=img+pitch_src*(y1-y)+(x1-x)*bytes_per_pixel;
|
|
||||||
add_src=(sizex-countx)*bytes_per_pixel;
|
|
||||||
countline=countx*bytes_per_pixel;
|
|
||||||
//copy line of byte with size x
|
|
||||||
for(i=0;i<county;i++)
|
for(i=0;i<county;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<countline;j++)
|
memmove(ptr_dest,ptr_src,countline);
|
||||||
{
|
|
||||||
*(char*)ptr_dest=*(char*)ptr_src;
|
|
||||||
ptr_dest++;
|
|
||||||
ptr_src++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr_src+=add_src;
|
ptr_src+=add_src;
|
||||||
|
ptr_dest+=countline;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -173,8 +173,8 @@ void MonofontDraw(finition_t *fin,int fx,int fy,
|
|||||||
unsigned int i,j,k,step,len;
|
unsigned int i,j,k,step,len;
|
||||||
int x,y,size_x,save_size_x,save_size_y;
|
int x,y,size_x,save_size_x,save_size_y;
|
||||||
unsigned char *p,*buf,*save_buf;
|
unsigned char *p,*buf,*save_buf;
|
||||||
unsigned char c,draw_output;
|
unsigned char c;
|
||||||
|
DWORD draw_output;
|
||||||
|
|
||||||
step=font->sizex*font->sizey;
|
step=font->sizex*font->sizey;
|
||||||
len=strlen(s);
|
len=strlen(s);
|
||||||
|
@ -313,7 +313,7 @@ extern inline int gui_ksys_check_event(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
// wait event
|
// wait event while not timeout
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
extern inline int gui_ksys_wait_event_with_timeout(DWORD timeout)
|
extern inline int gui_ksys_wait_event_with_timeout(DWORD timeout)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
service structures of libGUI
|
service structures of libGUI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DWORD ID;
|
static DWORD ID;
|
||||||
|
|
||||||
//screen's parameters
|
//screen's parameters
|
||||||
#define BYTES_PER_PIXEL 4
|
#define BYTES_PER_PIXEL 4
|
||||||
@ -111,12 +111,12 @@ DWORD ID;
|
|||||||
#define DRAW_OUTPUT_SCREEN 0
|
#define DRAW_OUTPUT_SCREEN 0
|
||||||
#define DRAW_OUTPUT_BUFFER 1
|
#define DRAW_OUTPUT_BUFFER 1
|
||||||
|
|
||||||
static struct
|
|
||||||
|
static struct SCREEN
|
||||||
{
|
{
|
||||||
char *buffer;
|
DWORD bits_per_pixel;
|
||||||
char bits_per_pixel;
|
DWORD bytes_per_pixel;
|
||||||
char bytes_per_pixel;
|
DWORD draw_output;
|
||||||
char draw_output;
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int size_x;
|
int size_x;
|
||||||
@ -124,6 +124,7 @@ static struct
|
|||||||
int skin_height;
|
int skin_height;
|
||||||
int display_size_x;
|
int display_size_x;
|
||||||
int display_size_y;
|
int display_size_y;
|
||||||
|
char *buffer;
|
||||||
}screen;
|
}screen;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
@ -1326,12 +1326,13 @@ void SetControlNewPosition(void *Control,int new_x,int new_y)
|
|||||||
int old_y;
|
int old_y;
|
||||||
|
|
||||||
control=(struct HEADER*)Control;
|
control=(struct HEADER*)Control;
|
||||||
|
/*
|
||||||
main_parent=(parent_t*)control->main_parent;
|
main_parent=(parent_t*)control->main_parent;
|
||||||
if (control->parent==(DWORD*)main_parent)
|
if (control->parent==(DWORD*)main_parent)
|
||||||
{//check position of child control of main parent
|
{//check position of child control of main parent
|
||||||
if (new_x+control->ctrl_sizex-1>screen.size_x) return;
|
if (new_x+control->ctrl_sizex-1>screen.size_x) return;
|
||||||
if (new_y+control->ctrl_sizey-1>screen.size_y) return;
|
if (new_y+control->ctrl_sizey-1>screen.size_y) return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
message.type=(DWORD)MESSAGE_CHANGE_POSITION_EVENT;
|
message.type=(DWORD)MESSAGE_CHANGE_POSITION_EVENT;
|
||||||
message.arg1=(DWORD)(new_x-control->ctrl_x);
|
message.arg1=(DWORD)(new_x-control->ctrl_x);
|
||||||
|
@ -34,8 +34,9 @@ void LibGUImain(parent_t *WindowParent)
|
|||||||
{
|
{
|
||||||
//check for timers
|
//check for timers
|
||||||
if ((WindowParent->timer_bk!=(DWORD*)NULL) ||
|
if ((WindowParent->timer_bk!=(DWORD*)NULL) ||
|
||||||
(WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_check_event();}
|
(WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_wait_event_with_timeout(1);}
|
||||||
else {event=gui_ksys_wait_event();}
|
else {event=gui_ksys_wait_event();}
|
||||||
|
|
||||||
//get and chack system events
|
//get and chack system events
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
|
@ -6,15 +6,30 @@ static void *memmove(void *dst,const void *src,size_t length)
|
|||||||
{
|
{
|
||||||
void *value;
|
void *value;
|
||||||
|
|
||||||
__asm__ __volatile__(
|
if (length & 3)
|
||||||
"movl %%edi,%%eax\n\t"
|
{//length not aligned in 4 bytes use reb movsb
|
||||||
"cld\n\t"
|
__asm__ __volatile__(
|
||||||
"rep\n\t"
|
"movl %%edi,%%eax\n\t"
|
||||||
"movsb"
|
"cld\n\t"
|
||||||
:"=D"(value)
|
"rep\n\t"
|
||||||
:"c"(length),"S"(src),"D"(dst)
|
"movsb"
|
||||||
:"eax");
|
:"=D"(value)
|
||||||
|
:"c"(length),"S"(src),"D"(dst)
|
||||||
|
:"eax");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//length aligned in 4 bytes use rep movsd
|
||||||
|
length=length >> 2;//length=length/4
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"movl %%edi,%%eax\n\t"
|
||||||
|
"cld\n\t"
|
||||||
|
"rep\n\t"
|
||||||
|
"movsd"
|
||||||
|
:"=D"(value)
|
||||||
|
:"c"(length),"S"(src),"D"(dst)
|
||||||
|
:"eax");
|
||||||
|
|
||||||
|
}
|
||||||
return(value);
|
return(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user