From 0177401fa87312f6a6d5f21d82cf99c8085216b5 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Sat, 21 Sep 2013 12:25:30 +0000 Subject: [PATCH] Fixed some bugs reported by 0CodErr. Author of fix - GerdtR. git-svn-id: svn://kolibrios.org@3921 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/eng/icon.ini | 1 + data/it/icon.ini | 1 + data/rus/icon.ini | 1 + data/sp/icon.ini | 1 + programs/system/icon_new/@icon.asm | 32 ++++--- programs/system/icon_new/DlgAdd.inc | 38 ++++---- programs/system/icon_new/RButton.inc | 65 ++++++++----- programs/system/icon_new/build.bat | 5 + programs/system/icon_new/build.sh | 13 +++ programs/system/icon_new/ico.inc | 131 +++++++++++++++++++++++++++ programs/system/icon_new/icon.ini | 1 + 11 files changed, 239 insertions(+), 50 deletions(-) create mode 100644 programs/system/icon_new/build.bat create mode 100644 programs/system/icon_new/build.sh create mode 100644 programs/system/icon_new/ico.inc diff --git a/data/eng/icon.ini b/data/eng/icon.ini index 32c228d409..30decad891 100644 --- a/data/eng/icon.ini +++ b/data/eng/icon.ini @@ -3,6 +3,7 @@ Shell=/rd/1/shell Processes=/rd/1/cpu Themes=desktop Device setup=setup +menucolor=128,128,128 [KFM] path=/SYS/FILE MANAGERS/KFM param= diff --git a/data/it/icon.ini b/data/it/icon.ini index 32c228d409..30decad891 100644 --- a/data/it/icon.ini +++ b/data/it/icon.ini @@ -3,6 +3,7 @@ Shell=/rd/1/shell Processes=/rd/1/cpu Themes=desktop Device setup=setup +menucolor=128,128,128 [KFM] path=/SYS/FILE MANAGERS/KFM param= diff --git a/data/rus/icon.ini b/data/rus/icon.ini index f099b3faf9..47f09435c9 100644 --- a/data/rus/icon.ini +++ b/data/rus/icon.ini @@ -3,6 +3,7 @@ Диспетчер процессов=/rd/1/cpu Управление темой=desktop Настройка устройств=setup +menucolor=128,128,128 [KFM] path=/SYS/FILE MANAGERS/KFM param= diff --git a/data/sp/icon.ini b/data/sp/icon.ini index 32c228d409..30decad891 100644 --- a/data/sp/icon.ini +++ b/data/sp/icon.ini @@ -3,6 +3,7 @@ Shell=/rd/1/shell Processes=/rd/1/cpu Themes=desktop Device setup=setup +menucolor=128,128,128 [KFM] path=/SYS/FILE MANAGERS/KFM param= diff --git a/programs/system/icon_new/@icon.asm b/programs/system/icon_new/@icon.asm index f057449610..35b7ad9b01 100644 --- a/programs/system/icon_new/@icon.asm +++ b/programs/system/icon_new/@icon.asm @@ -38,7 +38,6 @@ BegData equ fiStdIco.point include 'lang.inc' include '../../macros.inc' include '../../proc32.inc' -;include '../../API.inc' include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../dll.inc' ;include '../../debug.inc' @@ -49,6 +48,7 @@ START: ; start of execution stdcall dll.Load,IMPORTS test eax,eax jnz ErrLoadLibs +;------------------------------------------------------------------------------- ; unpack deflate mov eax,[unpack_DeflateUnpack2] @@ -141,11 +141,8 @@ START: ; start of execution and eax,0FFh mov [sbIcons.max_area],eax - ; int3 -; mov eax,1 -; mov eax,[IconsOffs+eax*4] -; stdcall [ini_del_section],IconIni,eax -; ret + stdcall [OpenDialog_Init],OpenDialog_data + jmp MSGRedrawIcons messages: @@ -301,6 +298,7 @@ LButtonPress: ;------------------------------------------------------------------------------- MovingIcon: +;int3 stdcall GetNumIcon,[MouseX],[MouseY],-1 mov [SelIcon],eax stdcall RestoreBackgrnd,[SelIcon] @@ -369,9 +367,9 @@ MovingIcon: ;qweqwe: mov [MovingActiv],1 - mcall 51,1,MovingWnd,stack_dlg ;CreateThread MovingWnd,stack_dlg + mcall 51,1,MovingWnd,stack_move ;CreateThread MovingWnd,stack_dlg .WaitLB: - mcall 37,2 ;GetMouseKey + mcall 37,2 ;GetMouseKey test al,001b jz .endWaitLB @@ -458,7 +456,7 @@ RButtonPress: jmp @b @@: - mcall 51,1,RButtonWin,stack_dlg ;CreateThread RButtonWin,stack_dlg + mcall 51,1,RButtonWin,stack_rb ;CreateThread RButtonWin,stack_dlg jmp messages @@ -1178,12 +1176,15 @@ NameIconsDat db ICONS_DAT,0 align 4 MaxNumIcon dd 0 ;количество иконок -bFixIcons dd 0 +bFixIcons dd 1 bNotSave dd 0 LButtonActiv dd 0 RButtonActiv dd 0 MovingActiv dd 0 +DlgAddActiv dd 0 + +slotDlgAdd dd 0 IconIni db '/rd/1/icon.ini',0 @@ -1242,6 +1243,7 @@ import libini,\ ;----- RButton.inc ------------------------------------------------------------- ;------------------------------------------------------------------------------- secRButt db 'rbmenu',0 +keyMenuColor db 'menucolor',0 if lang eq ru RMenuRedrawFon db 'Перерисовать',0 @@ -1291,7 +1293,6 @@ DCaptName db ' DCaptPath db 'Путь',0 DCaptParams db 'Параметры',0 DCaptIcon db 'Иконка',0 -;DCaptChange db '.',0 DCaptCreate db 'Создать',0 DCaptProperties db 'Изменить',0 DCaptCancel db 'Отменить',0 @@ -1303,7 +1304,6 @@ DCaptName db 'Name',0 DCaptPath db 'Path',0 DCaptParams db 'Parameters',0 DCaptIcon db 'Icon',0 -;DCaptChange db '.',0 DCaptCreate db 'Create',0 DCaptProperties db 'Change',0 DCaptCancel db 'Cancel',0 @@ -1404,6 +1404,7 @@ AddX rd 1 AddY rd 1 SelIcon rd 1 +DlgSelIcon rd 1 sc system_colors @@ -1438,12 +1439,17 @@ DAreaIcon rb 256+1 align 4 RBProcInfo rb 1024 -align 4 +RBMenuColor rd 1 + + ; OpenDialog temp_dir_pach rb 1024 fname_Info rb 1024 ;------------------------------------------------------------------------------- + rb 256 +stack_move: +stack_rb: rb 1024 stack_dlg: align 4 diff --git a/programs/system/icon_new/DlgAdd.inc b/programs/system/icon_new/DlgAdd.inc index 7c4874df4a..d43890d10b 100644 --- a/programs/system/icon_new/DlgAdd.inc +++ b/programs/system/icon_new/DlgAdd.inc @@ -6,7 +6,9 @@ idbCancel equ 1 DlgAdd: DlgProp: + mov eax,[SelIcon] + mov [DlgSelIcon],eax cmp eax,-1 jne SetProp @@ -92,9 +94,13 @@ SetProp: startDlg: + mcall 9,RBProcInfo,-1 + mcall 18,21,dword[RBProcInfo+30] + mov [slotDlgAdd],eax + or [edtName.flags],ed_focus - mcall 40,100111b ;SetMaskMessage 100111b + mcall 40,100111b ;SetMaskMessage 100111b xor eax,eax mov dword[MaxPage],0 @@: @@ -108,8 +114,6 @@ startDlg: mov dword[MaxPage],1 @@: - stdcall [OpenDialog_Init],OpenDialog_data - DReDraw: mcall 48,3,sc,40 @@ -141,7 +145,7 @@ DReDraw: call DRedraw DMessages: - mcall 10 ;WaitMessage + mcall 10 ;WaitMessage dec eax jz DReDraw @@ -157,7 +161,7 @@ DMessages: ;--------------------------------------------------------------------- DKey: - mcall 2 ;GetKeyPressed + mcall 2 ;GetKeyPressed cmp ah,1Bh je DExit cmp ah,9 ;Tab @@ -210,7 +214,7 @@ DNextEdit: jmp DMessages ;--------------------------------------------------------------------- DButton: - mcall 17 ;GetButtonPressed + mcall 17 ;GetButtonPressed cmp ah, idbCancel je DExit cmp ah,idbChange @@ -234,10 +238,10 @@ DMouse: call DrawStdIcons @@: - mcall 37,2 ;GetMouseKey + mcall 37,2 ;GetMouseKey test eax,1 jz DMessages - mcall 37,1 ;GetMouseWinPos + mcall 37,1 ;GetMouseWinPos test eax,10001000h jne DMessages @@ -332,14 +336,14 @@ DSaveIcon: mcall 70,fiRunProg - cmp [SelIcon],-1 + cmp [DlgSelIcon],-1 je @f ;удаляем из ini старую иконку - mov ebx,[SelIcon] + mov ebx,[DlgSelIcon] mov eax,[IconsOffs+ebx*4] stdcall [ini_del_section],IconIni,eax - stdcall EditIcon,[SelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams + stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams jmp DExitAndSave @@: stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams @@ -354,11 +358,13 @@ DExitAndSave: stdcall [ini_set_int],IconIni,DAreaName,keyY,[MouseY] DExit: - mcall -1 ;ExitProcess + mov [DlgAddActiv],0 + mov [slotDlgAdd],0 + mcall -1 ;ExitThread ;################################################################## proc DRedraw - mcall 12,1 ;RedrawWinBeg + mcall 12,1 ;RedrawWinBeg mov edx,[sc.work] or edx,33000000h mcall 0,<100,400>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+185>,,,DTitle @@ -404,7 +410,7 @@ if lang eq ru or ecx,80000000h mcall ,<309,35+END_ICONS_AREAH>,,DCaptCancel - cmp [SelIcon],-1 + cmp [DlgSelIcon],-1 jne @f mpack ebx,255,35+END_ICONS_AREAH mov edx,DCaptCreate @@ -419,7 +425,7 @@ else mcall ,<315,35+END_ICONS_AREAH>,,DCaptCancel - cmp [SelIcon],-1 + cmp [DlgSelIcon],-1 jne @f mpack ebx,257,35+END_ICONS_AREAH mov edx,DCaptCreate @@ -437,7 +443,7 @@ end if call DrawSelIcon - mcall 12,2 ;RedrawWinEnd + mcall 12,2 ;RedrawWinEnd ret endp diff --git a/programs/system/icon_new/RButton.inc b/programs/system/icon_new/RButton.inc index 0bfb5659a8..b204e10280 100644 --- a/programs/system/icon_new/RButton.inc +++ b/programs/system/icon_new/RButton.inc @@ -13,7 +13,7 @@ idbRProp equ 105 ;---- thread for rbutton ----------------------------------------------------------------------- RButtonWin: - mcall 40,100101b ;SetMaskMessage 100101b + mcall 40,100101b ;SetMaskMessage 100101b stdcall GetNumIcon,[MouseX],[MouseY],-1 mov [SelIcon],eax @@ -37,7 +37,7 @@ RButtonWin: RBWRedraw: - mcall 12,1 ;RedrawWinBeg + mcall 12,1 ;RedrawWinBeg mov ebx,[MouseX] shl ebx,16 mov bx,[RMenuW] @@ -63,7 +63,7 @@ RBWRedraw: xor ebx,ebx mov bx,[RMenuW] - mov esi,0888888h + mov esi,[RBMenuColor];0888888h mcall 8 mov ebx,50000h @@ -93,7 +93,7 @@ RBWRedraw: mov cx,dx ;первая разделительная линия - mcall 38,,,0888888h + mcall 38,,,[RBMenuColor];0888888h add ecx,00010001h mcall ,,, @@ -103,7 +103,7 @@ RBWRedraw: shl ecx,16 mov cx,16 - mcall 8,,,idbRRedrawFon,0888888h ;3 кнопки второго блока + mcall 8,,,idbRRedrawFon,[RBMenuColor];0888888h ;3 кнопки второго блока add ecx,00100000h mcall ,,,idbRAlign add ecx,00100000h @@ -134,7 +134,7 @@ RBWRedraw: mov dx,cx shl ecx,16 mov cx,dx - mcall 38,,,0888888h + mcall 38,,,[RBMenuColor];0888888h add ecx,00010001h mcall ,,, ;------------ @@ -146,9 +146,9 @@ RBWRedraw: cmp dword[SelIcon],-1 je @f - mcall 8,,,idbRDel,0888888h + mcall 8,,,idbRDel,[RBMenuColor];0888888h add ecx,00100000h - mcall ,,,idbRProp,0888888h + mcall ,,,idbRProp,[RBMenuColor];0888888h mov ebx,50000h mov bx,word[esp] @@ -160,7 +160,7 @@ RBWRedraw: jmp .endRM @@: - mcall 8,,,idbRAdd,0888888h + mcall 8,,,idbRAdd,[RBMenuColor];0888888h mov ebx,50000h mov bx,word[esp] add bx,16*3+4+5 @@ -169,14 +169,14 @@ RBWRedraw: .endRM: pop ecx - mcall 12,2 ;RedrawWinEnd + mcall 12,2 ;RedrawWinEnd - mcall 9,RBProcInfo,-1 ;GetThreadInfo RBProcInfo,-1 + mcall 9,RBProcInfo,-1 ;GetThreadInfo RBProcInfo,-1 mcall 18,21,dword[RBProcInfo+30] m2m dword[RBSlot],eax RBWMessages: - mcall 10 ;WaitMessage + mcall 10 ;WaitMessage dec eax jz RBWRedraw sub eax,2 @@ -186,7 +186,7 @@ RBWMessages: jmp RBWMessages RBWButton: - mcall 17 ;GetButtonPressed + mcall 17 ;GetButtonPressed shr eax,8 cmp eax,idbRRedrawFon jz RBRedrawFon @@ -212,10 +212,10 @@ RBWButton: jmp RBWExit RBWMouse: - mcall 37,2 ;GetMouseKey + mcall 37,2 ;GetMouseKey test eax,111b jz RBWMessages - mcall 37,0 ;GetMousePos + mcall 37,0 ;GetMousePos xor ebx,ebx mov bx,ax ;y shr eax,16 ;x @@ -231,7 +231,7 @@ RBWMouse: RBWExit: mcall 68,13,[RBUser] mov [RButtonActiv],0 - mcall -1 ;ExitProcess + mcall -1 ;ExitProcess RBRedrawFon: @@ -266,8 +266,11 @@ RBFixIcons: jmp RBWExit RBAdd: - ; mov [DlgAddActiv],1 - mcall 51,1,DlgAdd,stack_dlg ;CreateThread DlgAdd,stack_dlg + cmp [DlgAddActiv],1 + je RBWSetActivWin + mov [DlgAddActiv],1 + + mcall 51,1,DlgAdd,stack_dlg ;CreateThread DlgAdd,stack_dlg jmp RBWExit RBDelete: @@ -289,10 +292,16 @@ RBDelete: jmp RBRedrawFon RBPropeties: - ; mov [DlgAddActiv],1 - mcall 51,1,DlgProp,stack_dlg ;CreateThread DlgProp,stack_dlg + cmp [DlgAddActiv],1 + je RBWSetActivWin + mov [DlgAddActiv],1 + + mcall 51,1,DlgProp,stack_dlg ;CreateThread DlgProp,stack_dlg jmp RBWExit +RBWSetActivWin: + mcall 18,3,[slotDlgAdd] + jmp RBWExit proc AlignIcons @@ -443,6 +452,19 @@ proc GetUserBut stdcall,f_name,sec_name,key_name,key_value push ebx esi edi + mov edi,[key_name] + mov esi,keyMenuColor + @@: lodsb + scasb + jne @f + test al,al + jnz @b + + stdcall [ini_get_color],[f_name],[sec_name],[key_name],0888888h + mov [RBMenuColor],eax + ret + @@: + mov edi,[key_name] ;определяем ширину меню xor eax,eax or ecx,-1 @@ -491,7 +513,7 @@ endp proc Ini_SavePos stdcall,f_name,sec_name push ebx edi esi -;int3 + xor ebx,ebx .SearchSect: mov edi,[IconsOffs+ebx*4] @@ -520,6 +542,7 @@ proc Ini_SavePos stdcall,f_name,sec_name repne scasb repne scasb +;int3 movzx eax,word[edi+2] test eax,8000h jz @f diff --git a/programs/system/icon_new/build.bat b/programs/system/icon_new/build.bat new file mode 100644 index 0000000000..ed8f495db9 --- /dev/null +++ b/programs/system/icon_new/build.bat @@ -0,0 +1,5 @@ +@echo lang fix en >lang.inc +@fasm -m 16384 @icon.asm @icon +@erase lang.inc +@kpack @icon +@pause diff --git a/programs/system/icon_new/build.sh b/programs/system/icon_new/build.sh new file mode 100644 index 0000000000..ec2a0b774e --- /dev/null +++ b/programs/system/icon_new/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# This script does for linux the same as build.bat for DOS, + + echo "lang fix en" + echo "lang fix en" > lang.inc + fasm -m 16384 @icon.asm @icon + kpack @icon + rm -f lang.inc + exit 0 + + + + diff --git a/programs/system/icon_new/ico.inc b/programs/system/icon_new/ico.inc new file mode 100644 index 0000000000..eb6486534b --- /dev/null +++ b/programs/system/icon_new/ico.inc @@ -0,0 +1,131 @@ +include 'libimg/libimg.asm' + + +;возвращает указатель на память либо 0 +LoadIcon: +path equ ebp+8 +BuffR equ ebp-16 +BuffH equ ebp-22 +endTablI equ ebp-26 + + push ebp + mov ebp,esp + add esp,-26 + + push ebx edi esi + +;--------------------------- проверяем - загружена ли этот файл с иконкой ------ + xor ebx,ebx + .SearchIco: + mov edi,[path] + mov esi,[IcoTable+ebx] + @@: lodsb + scasb + jne @f + test al,al + jnz @b + + mov eax,[IcoTable+ebx+4] + pop esi edi ebx + leave + ret 4 + @@: + add ebx,8 + cmp ebx,50*8 + jne @f + + xor eax,eax + pop esi edi ebx + leave + ret 4 + @@: + cmp [IcoTable+ebx],0 + jnz .SearchIco + +;------------------------------------------------------------------------------- + mov [endTablI],ebx + + m2m dword[fiIcon.path],dword[path] + mcall 70,fiIcon + test eax,eax + jz @f + + xor eax,eax + pop esi edi ebx + leave + ret 4 + + @@: + xor ecx,ecx + mov cx,[BuffH+4] + xor edi,edi + .TestRecord: + cmp word[BuffR],2020h + jne .NextRec + cmp byte[BuffR+2],0 + jne .NextRec + + lea eax,[BuffR] + stdcall LoadIco32b, [path],eax + + + pop esi edi ebx + leave + ret 4 + + .NextRec: + inc edi + + mov eax,edi + shl eax,4 + add eax,6 + mov dword[fiIcon.pos],eax + mcall 70,fiIcon + + loop .TestRecord + + xor eax,eax + pop esi edi ebx + leave + ret 4 +restore path +restore BuffH +restore BuffR + +proc LoadIco32b, path,bufHeader +local ImgBuff:DWORD + mov edi,[bufHeader] + cmp dword[edi+8],10A8h + je @f + + xor eax,eax + ret + + @@: + mcall 68,12,32*32*4*2 + mov ebx,[endTablI] + mov [IcoTable+ebx],eax + add eax,4096 + mov [IcoTable+ebx+4],eax + mov [ImgBuff],eax + m2m dword[fiIcon.pos],dword[edi+12] + mov dword[fiIcon.size],32*32*4 + mcall 70,fiIcon + + mov eax,[ImgBuff] + ret +endp + + + +fiIcon: + dd 0 + .pos dd 0 + dd 0 + .size dd 22 + .point dd 0 + db 0 + .path dd 0 + + +IcoTable rd 2*50 ;(name(4), data(4)). End - dword 0 \ No newline at end of file diff --git a/programs/system/icon_new/icon.ini b/programs/system/icon_new/icon.ini index f099b3faf9..47f09435c9 100644 --- a/programs/system/icon_new/icon.ini +++ b/programs/system/icon_new/icon.ini @@ -3,6 +3,7 @@ Диспетчер процессов=/rd/1/cpu Управление темой=desktop Настройка устройств=setup +menucolor=128,128,128 [KFM] path=/SYS/FILE MANAGERS/KFM param=