From 48efeaf1fc886c25e3c579edf9d4a3d64fbd5d4c Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Sun, 19 Jul 2015 23:09:56 +0000 Subject: [PATCH] Eolite:Refresh window when changing settings. Kpack:Fixed bag kpack wait event. git-svn-id: svn://kolibrios.org@5582 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/end/end.c | 14 ++++--- programs/cmm/eolite/include/settings.h | 35 +++++++++++++---- programs/cmm/lib/file_system.h | 12 +++--- programs/cmm/lib/kolibri.h | 53 +++++++++++++++++++++++--- programs/cmm/lib/random.h | 4 +- programs/cmm/lib/strings.h | 51 +++++++++++++++++++------ programs/other/kpack/trunk/kpack.asm | 2 +- 7 files changed, 132 insertions(+), 39 deletions(-) diff --git a/programs/cmm/end/end.c b/programs/cmm/end/end.c index 5f15cc2b7e..d957a4b1c9 100644 --- a/programs/cmm/end/end.c +++ b/programs/cmm/end/end.c @@ -50,7 +50,7 @@ int PANEL_X, PANEL_Y; void main() { int key; - dword s1,s2, s3, s4, sides_w; + dword s1,s2, s3, s4, sides_w,i; mem_Init(); WIN_SIZE_X=GetScreenWidth()+1; @@ -106,11 +106,15 @@ void main() sc.get(); DefineAndDrawWindow(0,0,WIN_SIZE_X, WIN_SIZE_Y, 0x01, 0, 0, 0x01fffFFF); //_PutImage(0,0,WIN_SIZE_X,WIN_SIZE_Y,shadow_buf); - _PutImage(0,0,WIN_SIZE_X, PANEL_Y,s1); + if(!i){ + _PutImage(0,0,WIN_SIZE_X, PANEL_Y,s1); + + _PutImage(0,PANEL_Y,sides_w, PANEL_SIZE_Y+1,s2); + _PutImage(sides_w+PANEL_SIZE_X+1,PANEL_Y,sides_w-1, PANEL_SIZE_Y+1,s3); + _PutImage(0,PANEL_Y+PANEL_SIZE_Y+1,WIN_SIZE_X, PANEL_Y-1,s4); + //i = 1; + } draw_main_area(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y); - _PutImage(0,PANEL_Y,sides_w, PANEL_SIZE_Y+1,s2); - _PutImage(sides_w+PANEL_SIZE_X+1,PANEL_Y,sides_w-1, PANEL_SIZE_Y+1,s3); - _PutImage(0,PANEL_Y+PANEL_SIZE_Y+1,WIN_SIZE_X, PANEL_Y-1,s4); break; default: _DRAW: draw_stars(); diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 0e8f2a1b47..f0f92f71c6 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -35,16 +35,36 @@ void settings_dialog() unsigned int key; proc_info settings_form; - if (active_settings){cmd_free = 4;ExitProcess();} + dword save_show_dev_name,save_real_files_names_case, save_info_after_copy, save_use_big_fonts, save_files_h, save_DBLTime; + + if (active_settings){ + EXIT_SETTING: + show_dev_name = save_show_dev_name; + real_files_names_case = save_real_files_names_case; + info_after_copy = save_info_after_copy; + use_big_fonts = save_use_big_fonts; + files.line_h = save_files_h; + MOUSE_TIME = save_DBLTime; + cmd_free = 4; + ExitProcess(); + } active_settings=1; - SetEventMask(0x27); + + save_show_dev_name = show_dev_name; + save_real_files_names_case = real_files_names_case; + save_info_after_copy = info_after_copy; + save_use_big_fonts = use_big_fonts; + save_files_h = files.line_h; + save_DBLTime = MOUSE_TIME; + + //SetEventMask(0x27); loop(){ switch(WaitEvent()) { - case evMouse: + /*case evMouse: - break; + break;*/ case evButton: id=GetButtonID(); if (id==10) @@ -58,8 +78,7 @@ void settings_dialog() if (id==1) || (id==11) { active_settings=0; - cmd_free = 4; - ExitProcess(); + goto EXIT_SETTING; } if (id==5) { @@ -74,6 +93,7 @@ void settings_dialog() if (id==26) && (files.line_h>8) files.line_h--; if (id==27) MOUSE_TIME++; if (id==28) && (MOUSE_TIME>30) MOUSE_TIME--; + RefreshWindow(Form.ID,settings_form.ID); DrawSettingsCheckBoxes(); break; @@ -83,8 +103,7 @@ void settings_dialog() { active_settings = 0; action_buf = 300; - cmd_free = 4; - ExitProcess(); + goto EXIT_SETTING; } break; diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index 9c36aac9ee..3493027c82 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -33,8 +33,8 @@ :void DrawDate(dword x, y, color, in_date) { - //char text[10]; - EDI = in_date; + char text[15]; + /*EDI = in_date; EAX = 47; EBX = 2<<16; EDX = x<<16+y; @@ -47,10 +47,10 @@ EDX += 18<<16; EBX = 4<<16; ECX = EDI.date.year; - $int 0x40; - - //sprintf(#text,"%d.%d.%d",EDI.date.day,EDI.date.month,EDI.date.year); - //WriteText(x, y, 0x80, 0x80<<24+color, #text); + $int 0x40;*/ + + //sprintf(#text,"%s","ddf"); + WriteText(x, y, 0x80, color, "adas\0"); } diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 78fa2ea529..43adeeafe7 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -1,6 +1,6 @@ //CODED by Veliant, Leency, Nable. GNU GPL licence. -#define LIB_KOLIBRI_H +#define INCLUDE_KOLIBRI_H #startaddress 0 #code32 TRUE @@ -92,10 +92,10 @@ char program_path[4096]; * up - key release events * move - event mouse movements * click - when clicked - * dblclick - double-click the default 50 ms + * dblclick - double-click the default 50 (500 ms) */ -dword __TMP_TIME,MOUSE_TIME; +:dword __TMP_TIME,MOUSE_TIME; :struct mouse { signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top; @@ -296,7 +296,7 @@ dword __TMP_TIME,MOUSE_TIME; } //------------------------------------------------------------------------------ -dword wait_event_code; +:dword wait_event_code; inline fastcall dword WaitEvent() { $mov eax,10 @@ -375,6 +375,18 @@ inline fastcall dword GetFreeRAM() //return eax = размер свободной памяти в килобайтах } +inline void draw_line(dword x1,y1,x2,y2,color) +{ + x2--;y2--;y1--; + $mov EAX,38 + EBX = x1<<16; + EBX |= x2; + ECX = y1<<16; + ECX |= y2; + $mov EDX,color + $int 0x40 +} + inline fastcall dword LoadDriver(ECX) //ECX - имя драйвера { $mov eax, 68 @@ -761,6 +773,19 @@ void DefineButton(dword x,y,w,h,EDX,ESI) $int 0x40 } +inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE) +{ + EAX = 18; + EBX = 22; + ECX = 3; + EDX = ID_REFRESH; + $int 0x40 + EAX = 18; + EBX = 3; + EDX = ID_ACTIVE; + $int 0x40 +} + void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) { EAX = 8; @@ -808,15 +833,31 @@ inline fastcall dword GetStartTime() return mem; } +:struct _screen +{ + dword width,height; +} screen; + +:struct _skin +{ + dword width,height; +} skin; + dword __generator; // random number generator - для генерации случайных чисел -dword program_path_length; +:dword program_path_length; //The initialization of the initial data before running void load_init_main() { - //program_path_length = strlen(program_path); + skin.height = GetSkinHeight(); + + screen.width = GetScreenWidth(); + screen.height = GetScreenHeight(); + + //program_path_length = strlen(I_Path); MOUSE_TIME = 50; //Default 500 ms. __generator = GetStartTime(); + //mem_Init(); main(); } \ No newline at end of file diff --git a/programs/cmm/lib/random.h b/programs/cmm/lib/random.h index 04d1abd440..fa376e9043 100644 --- a/programs/cmm/lib/random.h +++ b/programs/cmm/lib/random.h @@ -46,7 +46,7 @@ inline fastcall int random( ECX) $pop ebx } -:inline long unirand0(void) +inline long unirand0(void) { long k,ans,tmp,save; save = __generator; @@ -63,7 +63,7 @@ inline fastcall int random( ECX) } :long RAND_A,RAND_C,RAND_TMP; -:inline long rand(signed long x1,x2) +inline long rand(signed long x1,x2) { long tmp,xx; RAND_A = __generator; diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index d2f3370946..6e6ee1378c 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -178,7 +178,7 @@ L2: $jnz L2 } -:inline dword strncpy(dword text1, text2, signed len) +inline dword strncpy(dword text1, text2, signed len) signed o1,o2; { if(!text1)||(!len) return text1; @@ -237,7 +237,7 @@ inline fastcall void strtrim( ESI) } */ -byte __isWhite(int s){ if (s==13)||(s==32)||(s==10)||(s==9) return true; return false; } +inline byte __isWhite(int s){ if (s==13)||(s==32)||(s==10)||(s==9) return true; return false; } inline void strltrim(dword text){ int s; dword back_text; @@ -451,7 +451,7 @@ LS3: } } -dword strcmpi(dword cmp1, cmp2) +inline dword strcmpi(dword cmp1, cmp2) { char si, ue; @@ -470,7 +470,7 @@ dword strcmpi(dword cmp1, cmp2) } } -dword strstri(dword searchin, usestr_s) +inline dword strstri(dword searchin, usestr_s) { dword usestr_e = usestr_s; char si, ue; @@ -489,7 +489,7 @@ dword strstri(dword searchin, usestr_s) } -unsigned int strcpyb(dword search_in, copyin, startstr, endstr) +inline unsigned int strcpyb(dword search_in, copyin, startstr, endstr) { dword startp, endp; dword copyin_start_off = copyin; @@ -662,7 +662,7 @@ inline dword itoa(signed long number) return ret; } -:inline fastcall itoa_(signed int EDI, ESI) +inline fastcall itoa_(signed int EDI, ESI) { $pusha EBX = EDI; @@ -695,7 +695,7 @@ F3: return EBX; } -:inline dword memchr(dword s,int c,signed len) +inline dword memchr(dword s,int c,signed len) { if(!len) return NULL; do { @@ -706,7 +706,7 @@ F3: return NULL; } -:inline dword strdup(dword text) +inline dword strdup(dword text) { dword l = strlen(text); dword ret = malloc(l+1); @@ -715,7 +715,7 @@ F3: return ret; } -:inline dword strndup(dword str, signed maxlen) +inline dword strndup(dword str, signed maxlen) { dword copy,len; @@ -729,7 +729,36 @@ F3: return copy; } -:inline cdecl int sprintf(dword buf, format,...) +inline dword hexdec(dword text) +{ + char s; + dword ret,l; + //l = strlen(text); + ret = 0; + s = DSBYTE[text]; + //if(l==6) + while(s) + { + ret <<= 4; + if(s>='A')&&(s<='F')ret |= s-'A'+10; + else if(s>='a')&&(s<='f')ret |= s-'a'+10; + else if(s>='0')&&(s<='9')ret |= s-'a'+10; + text++; + s = DSBYTE[text]; + } + /*else if(l==3) while(s) + { + ret <<= 4; + if(s>='A')&&(s<='F')ret |= s-'A'+10; + else if(s>='a')&&(s<='f')ret |= s-'a'+10; + else if(s>='0')&&(s<='9')ret |= s-'a'+10; + text++; + s = DSBYTE[text]; + }*/ + return ret; +} + +inline cdecl int sprintf(dword buf, format,...) { byte s; char X[10]; @@ -813,7 +842,7 @@ F3: return buf-ret; } -void debugi(dword d_int) +inline void debugi(dword d_int) { char tmpch[12]; itoa_(#tmpch, d_int); diff --git a/programs/other/kpack/trunk/kpack.asm b/programs/other/kpack/trunk/kpack.asm index f645b32451..39bfd706f9 100644 --- a/programs/other/kpack/trunk/kpack.asm +++ b/programs/other/kpack/trunk/kpack.asm @@ -55,7 +55,7 @@ include '../../../develop/libraries/box_lib/load_lib.mac' START: mcall 68,11 - mcall 40,0x80000027 + mcall 40,0x27 load_libraries l_libs_start,load_lib_end cmp eax,-1