diff --git a/programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.c b/programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.c similarity index 100% rename from programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.c rename to programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.c diff --git a/programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.h b/programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.h similarity index 100% rename from programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.h rename to programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.h diff --git a/programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile b/programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile old mode 100755 new mode 100644 similarity index 84% rename from programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile rename to programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile index fddfa44985..df59e6afd2 --- a/programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile +++ b/programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile @@ -2,10 +2,10 @@ SRC = libGUI.c TARGET = libGUI.obj CFLAGS = -O2 -nostdinc -nostdlib -march=pentium -fomit-frame-pointer -fno-builtin CC = gcc -AR=ar all: $(CC) -c $(SRC) $(CFLAGS) -o $(TARGET) + strip -X --strip-unneeded $(TARGET) clean: rm *.obj rm $(TARGET) diff --git a/programs/develop/new libGUI_C/SRC/control_button.inc b/programs/develop/new libGUI_C/SRC/control_button.inc index 4f0d47841b..b941b021c3 100755 --- a/programs/develop/new libGUI_C/SRC/control_button.inc +++ b/programs/develop/new libGUI_C/SRC/control_button.inc @@ -276,6 +276,9 @@ void ButtonProc(struct ControlButton *button,struct MESSAGE *message) { 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; } } @@ -291,7 +294,6 @@ void ButtonProc(struct ControlButton *button,struct MESSAGE *message) (DWORD*)ControlCheckCallbackEvent(button,(DWORD)BUTTON_PRESSED_EVENT); main_parent->number_callbacks++; } - if (button->flags & FLAG_SHOW_CONTROL) DrawPressedButton(button); } } break; @@ -399,7 +401,7 @@ void* CreateButtonWithText(gui_button_data_t *info,char *txt) memmove(txtdata.text,txt,len); 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; text->ctrl_x=(Button->ctrl_sizex/2)-(text->ctrl_sizex/2); diff --git a/programs/develop/new libGUI_C/SRC/control_progress_bar.inc b/programs/develop/new libGUI_C/SRC/control_progress_bar.inc index 7ea1d20780..4d621ce6f2 100755 --- a/programs/develop/new libGUI_C/SRC/control_progress_bar.inc +++ b/programs/develop/new libGUI_C/SRC/control_progress_bar.inc @@ -2,7 +2,6 @@ control ProgressBar */ - void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar) { int x; @@ -72,11 +71,12 @@ void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar) void DrawProgressBar(struct ControlProgressBar *ProgressBar) { - int x; - int y; - int sizex; - int sizey; - struct FINITION *fin; + int x,y,sizex,sizey; + char c; + char *save_buf,*buf; + int save_size_x,save_size_y; + DWORD draw_output,flags; + finition_t *fin; x=ProgressBar->ctrl_x; y=ProgressBar->ctrl_y; @@ -84,10 +84,51 @@ void DrawProgressBar(struct ControlProgressBar *ProgressBar) sizey=ProgressBar->ctrl_sizey; fin=(struct FINITION*)ProgressBar->finition; - Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); - Draw(fin,TOOL_GRADIENT_UP_FILLED_RECTANGLE,x+1,y+1,sizex-2,sizey-2,COLOR_MIDDLE_LIGHT,COLOR_LIGHT); + //alocate a buffer for draw text + 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); - + + //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) @@ -100,7 +141,7 @@ void SetProgressBarPulse(struct ControlProgressBar *ProgressBar,int time_tick) { 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->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_y=ProgressBar->ctrl_y+message->arg2; + SendMessage((struct HEADER*)ProgressBar,message); break; } case MESSAGE_CALL_TIMER_EVENT: @@ -157,25 +199,26 @@ void ProgressBarProc(struct ControlProgressBar *ProgressBar,struct MESSAGE *mess timer=(struct TIMER*)ProgressBar->timer; if (timer->flags & FLAG_TIMER_ON) Timer(timer); } + SendMessage((struct HEADER*)ProgressBar,message); break; } case MESSAGE_DESTROY_CONTROL: { if (ProgressBar->timer!=(DWORD*)NULL) free(ProgressBar->timer); free(ProgressBar->finition); + SendMessage((struct HEADER*)ProgressBar,message); break; } case MESSAGE_SET_MAIN_PARENT: { SendMessage((struct HEADER*)ProgressBar,message); ProgressBar->main_parent=(DWORD*)message->arg1; + SendMessage((struct HEADER*)ProgressBar,message); break; } default: break; } - //send message to child controls(if there is) - SendMessage((struct HEADER*)ProgressBar,message); } //--------------------------------------------------------------------------------- diff --git a/programs/develop/new libGUI_C/SRC/control_scrolled_window.inc b/programs/develop/new libGUI_C/SRC/control_scrolled_window.inc index 9290d69c56..175700a5e3 100755 --- a/programs/develop/new libGUI_C/SRC/control_scrolled_window.inc +++ b/programs/develop/new libGUI_C/SRC/control_scrolled_window.inc @@ -103,105 +103,25 @@ void ScrolledWindowPackControls(void *parent,void *Control) } //////////////////////////////////////////////////////////////////////////////// -// Draw full Scroll Bar +// Draw full Scrolled Window //////////////////////////////////////////////////////////////////////////////// -void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow) -{ - int x,y,sizex,sizey; - struct FINITION *fin; - - x=ScrolledWindow->ctrl_x; - y=ScrolledWindow->ctrl_y; - sizex=ScrolledWindow->ctrl_sizex; - sizey=ScrolledWindow->ctrl_sizey; - 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) || - (ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON)) - { - Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2, - ScrolledWindow->scroll_arrea_sizey+2,0xff0000); - } - else - Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); -} - -void ScrollWin_FuncCallback_HScroll(struct HEADER* control,void *data) +void ScrollWin_FuncCallback_HVScroll(struct HEADER* control,void *data) { struct ControlScrollBar *Hscrollbar,*Vscrollbar; - struct ControlScrolledWindow *ScrolledWindow; + struct ControlScrolledWindow *ScrolledWindow; struct HEADER *seek_control,*exchange_control; + struct MESSAGE local_message; struct FINITION *fin; - struct MESSAGE local_message; 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; - Hscrollbar=(struct ControlScrollBar*)control; - ScrolledWindow=(struct ControlScrolledWindow*)data; - + 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; - - 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;inumber_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; @@ -209,15 +129,32 @@ void ScrollWin_FuncCallback_VScroll(struct HEADER* control,void *data) 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=x; - local_message.arg2=y; + local_message.arg1=0; + local_message.arg2=0; 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;inumber_virtual_controls;i++) @@ -227,11 +164,24 @@ void ScrollWin_FuncCallback_VScroll(struct HEADER* control,void *data) 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) + 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 { @@ -239,17 +189,49 @@ void ScrollWin_FuncCallback_VScroll(struct HEADER* control,void *data) 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; } + //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) +{ + int x,y,sizex,sizey; + struct FINITION *fin; + + x=ScrolledWindow->ctrl_x; + y=ScrolledWindow->ctrl_y; + sizex=ScrolledWindow->ctrl_sizex; + sizey=ScrolledWindow->ctrl_sizey; + fin=(struct FINITION*)ScrolledWindow->finition; + + if ((ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_HORIZONTAL_SCROLL_ON) || + (ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON)) + { + Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2, + ScrolledWindow->scroll_arrea_sizey+2,COLOR_ABSOLUTE_DARK); + } + else + Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); + + ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow); +} + void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledWindow) { struct HEADER *control,*seek_control,*exchange_control; @@ -326,46 +308,7 @@ void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledW Vscrollbar->ruller_pos=Vscrollbar->ruller_pos/((float)(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)); SpecialRedrawControl(Vscrollbar); } - - 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;inumber_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; - } + ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow); } //--------------------------------------------------------------------------------- @@ -375,8 +318,8 @@ void ScrolledWindowProc(struct ControlScrolledWindow *ScrolledWindow,struct MESS { int i,x,y,sizex,sizey; struct HEADER *seek_control,*exchange_control; - struct ControlScrollBar *Hscrollbar,*Vscrollbar; - struct MESSAGE local_message; + struct ControlScrollBar *Hscrollbar,*Vscrollbar; + struct MESSAGE local_message; struct FINITION *fin; struct TIMER *timer; @@ -393,35 +336,13 @@ void ScrolledWindowProc(struct ControlScrolledWindow *ScrolledWindow,struct MESS if (ScrolledWindow->flags & FLAG_SHOW_CONTROL) { DrawScrolledWindow(ScrolledWindow); - - //send message to scroll bars - Hscrollbar=(struct ControlScrollBar*)ScrolledWindow->horizontal_scroll; - Vscrollbar=(struct ControlScrollBar*)ScrolledWindow->vertical_scroll; - - ControlProc=(void (*)(void *Control,struct MESSAGE *message))Hscrollbar->ctrl_proc; - ControlProc((struct HEADER*)Hscrollbar,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; - } + Hscrollbar=(gui_scroll_bar_t*)ScrolledWindow->horizontal_scroll; + Vscrollbar=(gui_scroll_bar_t*)ScrolledWindow->vertical_scroll; + //draw scroll bars + ControlProc=(void (*)(void *Control,gui_message_t *message))Hscrollbar->ctrl_proc; + ControlProc(Hscrollbar,message); + ControlProc=(void (*)(void *Control,gui_message_t *message))Vscrollbar->ctrl_proc; + ControlProc(Vscrollbar,message); } break; } @@ -590,8 +511,8 @@ void* CreateScrolledWindow(struct ScrolledWindowData *info_for_control) HorizontalScrollBar=CreateHorizontalScrollBar(&HorizontalScrollData); VerticalScrollBar=CreateVerticalScrollBar(&VerticalScrollData); - SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HScroll,ScrolledWindow); - SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_VScroll,ScrolledWindow); + SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow); + SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow); PackControls(ScrolledWindow,HorizontalScrollBar); PackControls(ScrolledWindow,VerticalScrollBar); diff --git a/programs/develop/new libGUI_C/SRC/draw_controls.inc b/programs/develop/new libGUI_C/SRC/draw_controls.inc index 95aec233c3..61b45c3c07 100755 --- a/programs/develop/new libGUI_C/SRC/draw_controls.inc +++ b/programs/develop/new libGUI_C/SRC/draw_controls.inc @@ -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) { 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> 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) { case 32: case 24: case 16: 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;isizex*font->sizey; len=strlen(s); diff --git a/programs/develop/new libGUI_C/SRC/kolibri_system.h b/programs/develop/new libGUI_C/SRC/kolibri_system.h index d556566444..84d3e31613 100755 --- a/programs/develop/new libGUI_C/SRC/kolibri_system.h +++ b/programs/develop/new libGUI_C/SRC/kolibri_system.h @@ -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) { diff --git a/programs/develop/new libGUI_C/SRC/libGUI.h b/programs/develop/new libGUI_C/SRC/libGUI.h index bc6e34cfb1..a084c0cae2 100755 --- a/programs/develop/new libGUI_C/SRC/libGUI.h +++ b/programs/develop/new libGUI_C/SRC/libGUI.h @@ -2,7 +2,7 @@ service structures of libGUI */ -DWORD ID; +static DWORD ID; //screen's parameters #define BYTES_PER_PIXEL 4 @@ -111,12 +111,12 @@ DWORD ID; #define DRAW_OUTPUT_SCREEN 0 #define DRAW_OUTPUT_BUFFER 1 -static struct + +static struct SCREEN { - char *buffer; - char bits_per_pixel; - char bytes_per_pixel; - char draw_output; + DWORD bits_per_pixel; + DWORD bytes_per_pixel; + DWORD draw_output; int x; int y; int size_x; @@ -124,6 +124,7 @@ static struct int skin_height; int display_size_x; int display_size_y; + char *buffer; }screen; //////////////////////////////////////////////////////////////// diff --git a/programs/develop/new libGUI_C/SRC/libGUI_menegement.inc b/programs/develop/new libGUI_C/SRC/libGUI_menegement.inc index a2070a6ef6..5ff8d14724 100755 --- a/programs/develop/new libGUI_C/SRC/libGUI_menegement.inc +++ b/programs/develop/new libGUI_C/SRC/libGUI_menegement.inc @@ -1326,12 +1326,13 @@ void SetControlNewPosition(void *Control,int new_x,int new_y) int old_y; control=(struct HEADER*)Control; + /* main_parent=(parent_t*)control->main_parent; if (control->parent==(DWORD*)main_parent) {//check position of child control of main parent if (new_x+control->ctrl_sizex-1>screen.size_x) return; if (new_y+control->ctrl_sizey-1>screen.size_y) return; - } + }*/ message.type=(DWORD)MESSAGE_CHANGE_POSITION_EVENT; message.arg1=(DWORD)(new_x-control->ctrl_x); diff --git a/programs/develop/new libGUI_C/SRC/main_libGUI.inc b/programs/develop/new libGUI_C/SRC/main_libGUI.inc index 3e579eea08..1af8da61ed 100755 --- a/programs/develop/new libGUI_C/SRC/main_libGUI.inc +++ b/programs/develop/new libGUI_C/SRC/main_libGUI.inc @@ -34,8 +34,9 @@ void LibGUImain(parent_t *WindowParent) { //check for timers if ((WindowParent->timer_bk!=(DWORD*)NULL) || - (WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_check_event();} - else {event=gui_ksys_wait_event();} + (WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_wait_event_with_timeout(1);} + else {event=gui_ksys_wait_event();} + //get and chack system events switch(event) { diff --git a/programs/develop/new libGUI_C/SRC/string.inc b/programs/develop/new libGUI_C/SRC/string.inc index bc5556e26c..f64da7e438 100755 --- a/programs/develop/new libGUI_C/SRC/string.inc +++ b/programs/develop/new libGUI_C/SRC/string.inc @@ -6,15 +6,30 @@ static void *memmove(void *dst,const void *src,size_t length) { void *value; - __asm__ __volatile__( - "movl %%edi,%%eax\n\t" - "cld\n\t" - "rep\n\t" - "movsb" - :"=D"(value) - :"c"(length),"S"(src),"D"(dst) - :"eax"); + if (length & 3) + {//length not aligned in 4 bytes use reb movsb + __asm__ __volatile__( + "movl %%edi,%%eax\n\t" + "cld\n\t" + "rep\n\t" + "movsb" + :"=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); }