From f7d0d2b128bc5b69d835b56952570c42034f5c5f Mon Sep 17 00:00:00 2001 From: GerdtR Date: Mon, 9 Dec 2013 21:02:13 +0000 Subject: [PATCH] Changed the structure icon.ini. Now you can create icons with repetitive or empty names. git-svn-id: svn://kolibrios.org@4336 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/icon_new/@icon.asm | 524 ++++++++------------------- programs/system/icon_new/DlgAdd.inc | 40 +- programs/system/icon_new/Moving.inc | 165 +++++---- programs/system/icon_new/RButton.inc | 103 ++++-- programs/system/icon_new/icon.ini | 90 +++-- programs/system/icon_new/iconman.inc | 301 +++++++++++++++ 6 files changed, 688 insertions(+), 535 deletions(-) create mode 100644 programs/system/icon_new/iconman.inc diff --git a/programs/system/icon_new/@icon.asm b/programs/system/icon_new/@icon.asm index 1ff5dc559d..c2ba7c5ff4 100644 --- a/programs/system/icon_new/@icon.asm +++ b/programs/system/icon_new/@icon.asm @@ -1,15 +1,14 @@ -;иногда неверно определяется ширина менюшки - -ICONS_DAT equ '/rd/1/icons.dat' ICON_STRIP equ '/rd/1/iconstrp.png' -ICON_SIZE equ 68 -IMG_SIZE equ 32 -TEXT_BOTTOM_Y equ 14 -IMAGE_TOP_Y equ 10 ;>=1 -ALIGN_SIZE equ 68 -NAME_LENGTH equ 11 -MIN_NO_MOVING equ 8 - ;для диалога создания/редактирования +ICON_INI equ '/rd/1/settings/icon.ini' +ICON_SIZE equ 68 ;размер области для иконки с надписью +IMG_SIZE equ 32 ;размер иконок +TEXT_BOTTOM_Y equ 14 ;отступ по Y текста от низа иконки +IMAGE_TOP_Y equ 10 ;>=1 Координата Y иконки в области для данной иконки +ALIGN_SIZE equ 68 ;размер сетки выравнивания +NAME_LENGTH equ 11 ;длина имени иконки +MIN_NO_MOVING equ 8 ;через столько пикселей сдвига мыши начинается таскание иконки + + ;--------для диалога создания/редактирования ICONSX equ 20 ICONSY equ 80 ICONS_DRAW_COUNTW equ 10 ;количество иконок в ширину @@ -41,7 +40,6 @@ include '../../proc32.inc' include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../dll.inc' ;include '../../debug.inc' - ;------------------------------------------------------------------------------ START: ; start of execution mcall 68,11 @@ -96,8 +94,8 @@ START: ; start of execution ;########## загружаем данные иконок в память ########################## - mcall 70,fiIni ;выделяем память, достаточной для хранения ini файла. Её точно хватит для хранения данных об иконках - test eax,eax + mcall 70,fiIni ;выделяем память, достаточной для хранения ini файла. + test eax,eax ;Её точно хватит для хранения данных об иконках jnz ErrorIni cmp dword[bufIni+32],0 @@ -113,6 +111,13 @@ START: ; start of execution NoErrIni: m2m [PIcoDB],[BegData] + + + mov edi,IconsID + xor eax,eax + mov ecx,100h/4 + rep stosd + mov [nLoadIcon],0 stdcall [ini_enum_sections],IconIni,LoadIconsData ;int3 mov eax,dword[PIcoDB] @@ -125,7 +130,6 @@ START: ; start of execution mov dword[SizeData],0 @@: ;###################################################################### - call FillIconsOffs ;заполняет MaxNumIcon,IconsOffs mcall 40,0100000b ;нужны только события мыши, перерисовка иконок будет в другом потоке @@ -143,6 +147,8 @@ START: ; start of execution mcall 51,1,BGRedrawThread,stack_bredraw ;запускаем поток перерисовки иконок stdcall [OpenDialog_Init],OpenDialog_data +;dph [MaxNumIcon] + messages: mcall 10 sub eax,6 @@ -188,6 +194,7 @@ close: mcall -1 LButtonPress: + stdcall GetNumIcon,[MouseX],[MouseY],-1 ;int3 cmp eax,-1 @@ -421,7 +428,6 @@ MovingIcon: stdcall SetPosition,[SelIcon],eax,ebx - m2m [PIcoDB],[BegData] stdcall [ini_enum_sections],IconIni,Ini_SavePos ;in RButton.inc @@ -435,8 +441,6 @@ MovingIcon: ;------------------------------------------------------------------------------- RButtonPress: - cmp [RButtonActiv],1 - je messages mov [RButtonActiv],1 @@: @@ -657,8 +661,6 @@ local IconData:DWORD ret endp - - proc RestoreBackgrnd,NumIcon:DWORD push ebx edi mov eax,[NumIcon] @@ -710,308 +712,6 @@ proc RestoreBackgrnd,NumIcon:DWORD ret endp -;ret eax=numIcon -proc AddIcon stdcall,x,y,lpIcon,lpName,lpExeFile,lpParams - push ebx edi esi - - mov eax,[x] - mov ebx,[y] - - xor edx,edx - test eax,8000h - jnz @f - mov dx,[wsW] ;если надо, то преобразовываем в - shr edx,1 ;отрицательные координаты - add dx,[wsX] - cmp eax,edx - jbe @f - sub ax,[wsW] - inc eax - @@: - - test ebx,8000h - jnz @f - mov dx,[wsY] - shr edx,1 - add dx,[wsH] - cmp ebx,edx - jbe @f - sub bx,[wsH] - inc ebx - @@: - ;поправка на случай выхода за край экрана - - test eax,8000h - jnz @f - mov dx,[wsXe] - sub edx,ICON_SIZE - cmp eax,edx - jbe @f - mov eax,edx - @@: - - test ebx,8000h - jnz @f - mov dx,[wsYe] - sub edx,ICON_SIZE - cmp ebx,edx - jbe @f - mov ebx,edx - @@: - - mov [x],eax - mov [y],ebx - - xor al,al - or ecx,-1 - mov edi,[lpName] - repne scasb - sub edi,[lpName] - mov ebx,edi - mov edi,[lpExeFile] - repne scasb - sub edi,[lpExeFile] - add ebx,edi - mov edi,[lpParams] - repne scasb - sub edi,[lpParams] - add ebx,edi - mov edi,[lpIcon] - repne scasb - sub edi,[lpIcon] - add ebx,edi - add ebx,4 - mov ecx,dword[SizeData] - add ecx,ebx - mov edx,[IconsOffs] - mcall 68,20 - - mov edx,dword[SizeData] - mov dword[SizeData],ecx - mov dword[BegData],eax - mov edi,eax - add edi,edx - mov esi,[lpName] - @@: lodsb - stosb - test al,al - jnz @b - - mov esi,[lpExeFile] - @@: lodsb - stosb - test al,al - jnz @b - - mov esi,[lpParams] - @@: lodsb - stosb - test al,al - jnz @b - - mov esi,[lpIcon] - @@: lodsb - stosb - test al,al - jnz @b - - mov eax,[x] - mov ebx,[y] - shl eax,16 - mov ax,bx - mov dword[edi],eax - - stdcall FillIconsOffs - - pop esi edi ebx - ret -endp - - -proc EditIcon stdcall,NumIcon,lpIcon,lpName,lpExeFile,lpParams - push edi - mov eax,[NumIcon] - mov edi,[IconsOffs+eax*4] - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - repne scasb - push dword[edi] - stdcall DelIcon,[NumIcon] - pop edx - xor eax,eax - mov ax,dx - shr edx,16 - stdcall AddIcon,edx,eax,DAreaIcon,DAreaName,DAreaPath,DAreaParams - pop edi - ret -endp - -proc SetPosition stdcall,NumIcon,x,y - push edi - mov eax,[NumIcon] - mov edi,[IconsOffs+eax*4] - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - repne scasb - mov eax,[x] - shl eax,16 - mov ax,word[y] - mov dword[edi],eax - pop edi - ret -endp - -proc GetNumIcon stdcall,x,y,NumIconI ;номер иконки, который проверять не надо или -1 -local posX:WORD,\ - posY:WORD - push ebx edi - mov ecx,[MaxNumIcon] - test ecx,ecx - jnz @f - or eax,-1 - pop edi ebx - ret - @@: - - mov ebx,ecx - dec ebx - .TestIcon: - cmp dword[NumIconI],-1 - je @f - - cmp ebx,[NumIconI] - jne @f - dec ebx - dec ecx - test ecx,ecx - jz .NoIcon - @@: - - push ecx - - or ecx,-1 - xor al,al - mov edi,[IconsOffs+ebx*4] - repne scasb - repne scasb - repne scasb - repne scasb - - mov ax,[edi+2] - test ax,8000h - jz @f - add ax,[wsXe] - jmp .gni1 - @@: - add ax,[wsX] - .gni1: - mov [posX],ax - - mov ax,[edi] - test ax,8000h - jz @f - add ax,[wsYe] - jmp .gni2 - @@: - add ax,[wsY] - .gni2: - - mov [posY],ax - - mov eax,[x] - mov edx,[y] - - cmp ax,[posX] - jb @f - add word[posX],ICON_SIZE - cmp ax,[posX] - ja @f - - cmp dx,[posY] - jb @f - add word[posY],ICON_SIZE - cmp dx,[posY] - ja @f - - jmp .OkIcon - @@: - - dec ebx - pop ecx - - ;loop .TestIcon - dec ecx - jnz .TestIcon - jmp .NoIcon - .OkIcon: - mov eax,ebx - pop edi ebx - ret - .NoIcon: - or eax,-1 - pop edi ebx - ret -endp - -proc DelIcon stdcall,NumIcon - push ebx edi esi - - cmp [MaxNumIcon],0 - je .end - - cmp [MaxNumIcon],1 - je .OhneIco - - mov ebx,[NumIcon] - - mov eax,[MaxNumIcon] - dec eax - mov [MaxNumIcon],eax - cmp ebx,eax - je @f - - shl ebx,2 - - mov ecx,dword[BegData] - add ecx,dword[SizeData] - sub ecx,[IconsOffs+4+ebx] - - mov edx,[IconsOffs+4+ebx] - sub edx,[IconsOffs+ebx] - sub dword[SizeData],edx - - mov esi,[IconsOffs+4+ebx] - mov edi,[IconsOffs+ebx] - rep movsb - jmp .endDel - - @@: - mov ecx,dword[BegData] - add ecx,dword[SizeData] - sub ecx,[IconsOffs+ebx*4] - sub dword[SizeData],ecx - - .endDel: - stdcall FillIconsOffs - jmp .end - -.OhneIco: - mov edi,[BegData] - mov [SizeData],0 - mov dword[edi],0 - mov [MaxNumIcon],0 - mov dword[IconsOffs],0 - .end: - mcall 15,3 - pop esi edi ebx - ret -endp ;заполняет MaxNumIcon,IconsOffs proc FillIconsOffs push ebx edi @@ -1031,6 +731,7 @@ proc FillIconsOffs add ebx,dword[BegData] or ecx,-1 .CalcNumIc: + repne scasb repne scasb repne scasb @@ -1046,6 +747,7 @@ proc FillIconsOffs @@: mov dword[IconsOffs+edx],0 + pop edi ebx ret endp @@ -1066,12 +768,26 @@ proc LoadIconsData stdcall,f_name,sec_name ret .lid1: + + mov ebx,[sec_name] ;копируем ID + mov ax,[ebx] + mov edi,[nLoadIcon] + mov word[edi*4+IconsID],ax + mov word[edi*4+IconsID+2],0 + mov edi,[PIcoDB] - mov esi,[sec_name] - @@: lodsb - stosb - test al,al - jnz @b + stdcall [ini_get_str],[f_name],[sec_name],keyName,edi,4096,0 + test eax,eax + jz @f + xor eax,eax + pop edi esi ebx + ret + @@: + xor al,al + or ecx,-1 + repne scasb + + stdcall [ini_get_str],[f_name],[sec_name],keyPath,edi,4096,0 test eax,eax @@ -1126,11 +842,61 @@ proc LoadIconsData stdcall,f_name,sec_name add edi,4 mov [PIcoDB],edi + inc [nLoadIcon] + mov eax,1 pop edi esi ebx ret endp +proc GenerateID ;ax = ID + push ebx edi + mov ebx,[MaxNumIcon] + test ebx,ebx + jnz @f + mov eax,'00' + pop edi ebx + ret + @@: + + mov eax,dword[IconsID+ebx*4-4] + .inc: + inc ah + cmp ah,'9'+1 + jne @f + mov ah,'A' + @@: + cmp ah,'F'+1 + jne @f + mov ah,'0' + inc al + @@: + cmp al,'9'+1 + jne @f + mov al,'A' + @@: + cmp al,'F'+1 + jne @f + mov al,'0' + @@: + + + mov edi,IconsID + ;cmp dword[edi],0 + ;je @f + mov ecx,100h + @@: scasd + je .inc + cmp dword[edi],0 + je @f + loop @b + @@: + + pop edi ebx + ret +endp + +include 'iconman.inc' include 'bgredraw.inc' include 'RButton.inc' include 'DlgAdd.inc' @@ -1180,14 +946,15 @@ fiIni dd 5 ; dd 0 dd 0 dd bufIni - db '/rd/1/settings/icon.ini',0 + db 0 + dd IconIni IconsFile db ICON_STRIP,0 -NameIconsDat db ICONS_DAT,0 + align 4 -MaxNumIcon dd 0 ;количество иконок -IconNoDraw dd -1 ;-1 либо номер иконки, которую не надо рисовать( когда её таскают :)) +MaxNumIcon dd 0 ;количество иконок +IconNoDraw dd -1 ;-1 либо номер иконки, которую не надо рисовать( когда её таскают ) bFixIcons dd 1 bNotSave dd 0 @@ -1197,11 +964,11 @@ RButtonActiv dd 0 MovingActiv dd 0 DlgAddActiv dd 0 -IconIni db '/rd/1/settings/icon.ini',0 +IconIni db ICON_INI,0 pthNotify db '/rd/1/@notify',0 -;keyName db 'name',0 +keyName db 'name',0 keyPath db 'path',0 keyParams db 'param',0 keyIco db 'ico',0 @@ -1210,41 +977,42 @@ keyY db 'y',0 ;------------------------------------------------------------------------------- IMPORTS: -library cnv_png,'cnv_png.obj',\ +library cnv_png ,'cnv_png.obj',\ archiver,'archiver.obj',\ - box_lib,'box_lib.obj',\ + box_lib ,'box_lib.obj',\ proc_lib,'proc_lib.obj',\ - libini,'libini.obj' + libini ,'libini.obj' import cnv_png,\ - cnv_png_import.Start,'START',\ - cnv_png_import.Version,'version',\ - cnv_png_import.Check,'Check_Header',\ - cnv_png_import.Assoc,'Associations' + cnv_png_import.Start ,'START',\ + cnv_png_import.Version ,'version',\ + cnv_png_import.Check ,'Check_Header',\ + cnv_png_import.Assoc ,'Associations' import archiver,\ - unpack_DeflateUnpack2,'deflate_unpack2' + unpack_DeflateUnpack2 ,'deflate_unpack2' import box_lib,\ - edit_box_draw,'edit_box',\ - edit_box_key,'edit_box_key',\ - edit_box_mouse,'edit_box_mouse',\ - scrollbar_h_draw,'scrollbar_h_draw',\ - scrollbar_h_mouse,'scrollbar_h_mouse' + edit_box_draw ,'edit_box',\ + edit_box_key ,'edit_box_key',\ + edit_box_mouse ,'edit_box_mouse',\ + scrollbar_h_draw ,'scrollbar_h_draw',\ + scrollbar_h_mouse ,'scrollbar_h_mouse' import proc_lib,\ - OpenDialog_Init,'OpenDialog_init',\ - OpenDialog_Start,'OpenDialog_start' + OpenDialog_Init ,'OpenDialog_init',\ + OpenDialog_Start ,'OpenDialog_start' import libini,\ - ini_enum_sections,'ini_enum_sections',\ - ini_enum_keys,'ini_enum_keys',\ - ini_get_str,'ini_get_str',\ - ini_set_str,'ini_set_str',\ - ini_get_color,'ini_get_color',\ - ini_get_int,'ini_get_int',\ - ini_set_int,'ini_set_int',\ - ini_del_section,'ini_del_section' + ini_enum_sections ,'ini_enum_sections',\ + ini_enum_keys ,'ini_enum_keys',\ + ini_get_str ,'ini_get_str',\ + ini_set_str ,'ini_set_str',\ + ini_get_color ,'ini_get_color',\ + ini_get_int ,'ini_get_int',\ + ini_set_int ,'ini_set_int',\ + ini_del_section ,'ini_del_section',\ + ini_exist_sect ,'ini_exist_sect' ;ini.get_str (f_name, sec_name, key_name, buffer, buf_len, def_val) @@ -1254,6 +1022,13 @@ import libini,\ ;------------------------------------------------------------------------------- ;----- RButton.inc ------------------------------------------------------------- ;------------------------------------------------------------------------------- + +if lang eq ru + MinRMenuW dd 18*6+10 +else + MinRMenuW dd 15*6+10 +end if + secRButt db 'rbmenu',0 PredItem dd -1 @@ -1267,13 +1042,13 @@ if lang eq ru RMenuDel db 'Удалить',0 RMenuProp db 'Свойства',0 else - RMenuRedrawFon db 'Refresh',0 - RMenuAlign db 'Snap to Grid',0 - RMenuOffMoving db 'Lock icons',0 - RMenuOnMoving db 'Unlock icons',0 - RMenuAdd db 'New icon',0 - RMenuDel db 'Delete',0 - RMenuProp db 'Properties',0 + RMenuRedrawFon db 'Redraw',0 + RMenuAlign db 'Snap to Grid',0 + RMenuOffMoving db 'Fix the icons',0 + RMenuOnMoving db 'Unfix the icons',0 + RMenuAdd db 'Add',0 + RMenuDel db 'Delete',0 + RMenuProp db 'Properties',0 end if if lang eq ru @@ -1285,7 +1060,7 @@ else ErrRunProg db 'Error runing program',0 WarningSave db 'Do not forget to save the changes, run the RDSave',0 ErrNotFoundIni db 'icon.ini not found',0 - ErrName db 'The name "rbmenu" is reserved',0 + ErrName db 'The name "rbmenu" reserved',0 end if ;------------------------------------------------------------------------------- @@ -1320,11 +1095,11 @@ end if ;/не менять положение edtName edit_box NAME_LENGTH*6+4,70+20+IMG_SIZE,6,0FFFFFFh,06F9480h,0FFh,0h,0,NAME_LENGTH,\ DAreaName,mouse_dd,0,0,0 -edtExePath edit_box 281-3-20-IMG_SIZE,70+20+IMG_SIZE,26,0FFFFFFh,06F9480h,0FFh,0h,0,256,\ +edtExePath edit_box 281-3-20-IMG_SIZE,70+20+IMG_SIZE,26,0FFFFFFh,06F9480h,0FFh,0h,0,255,\ DAreaPath,mouse_dd,0,0,0 -edtParams edit_box 295-20-IMG_SIZE,70+20+IMG_SIZE,46,0FFFFFFh,06F9480h,0FFh,0h,0,256,\ +edtParams edit_box 295-20-IMG_SIZE,70+20+IMG_SIZE,46,0FFFFFFh,06F9480h,0FFh,0h,0,255,\ DAreaParams,mouse_dd,0,0,0 -edtIcon edit_box 295-20-IMG_SIZE,70+20+IMG_SIZE,66,0FFFFFFh,06F9480h,0FFh,0h,0,256,\ +edtIcon edit_box 295-20-IMG_SIZE,70+20+IMG_SIZE,66,0FFFFFFh,06F9480h,0FFh,0h,0,255,\ DAreaIcon,mouse_dd,0,0,0 endEdits: ;\ @@ -1421,7 +1196,6 @@ MouseX rd 1 MouseY rd 1 RBSlot rd 1 - AddX rd 1 AddY rd 1 @@ -1430,11 +1204,14 @@ DlgSelIcon rd 1 slotDlgAdd rd 1 DlgBufImg rb IMG_SIZE*IMG_SIZE*3 - +align 4 bufStdIco rb 40 -IconsOffs rd 100 +IconsOffs rd 100 ;таблица с указателями на конкретные иконки(для ускорения) PIcoDB rd 1 +nLoadIcon rd 1 ;номер читаемой из ini иконки +IconsID rd 100 ;ID иконок - 2 байтa + байт 0 + выравнивающий байт - строка с 2мя шеснадцетиричными цифрами +nameSection rb 4 align 4 icon_count rd 1 @@ -1444,7 +1221,6 @@ strip_file_size rd 1 cur_band_compensation rd 1 ;---- RButton ----------------------------------------------------------------------- -MinRMenuW rd 1 bufIni rb 40 NumMenuButt rd 1 @@ -1456,9 +1232,9 @@ MaxPage rd 1 mouse_dd rd 1 DAreaName rb NAME_LENGTH+1 -DAreaPath rb 256+1 -DAreaParams rb 256+1 -DAreaIcon rb 256+1 +DAreaPath rb 255+1 +DAreaParams rb 255+1 +DAreaIcon rb 255+1 align 4 RBProcInfo rb 1024 diff --git a/programs/system/icon_new/DlgAdd.inc b/programs/system/icon_new/DlgAdd.inc index 6d995e5289..b1e1a6ebd9 100644 --- a/programs/system/icon_new/DlgAdd.inc +++ b/programs/system/icon_new/DlgAdd.inc @@ -24,7 +24,7 @@ DlgProp: cmp bx,[wsY] jae @f mov bx,[wsY] - @@: ;eax,ebx - реальная координата. Все координаты в проге относительно левого верхнего угла рабочей области + @@: ;eax,ebx - Ёхры№эр  ъююЁфшэрЄр. ┬ёх ъююЁфшэрЄ√ т яЁюух юЄэюёшЄхы№эю ыхтюую тхЁїэхую єуыр Ёрсюўхщ юсырёЄш xor edx,edx mov dx,[wsXe] @@ -41,7 +41,7 @@ DlgProp: mov ebx,edx @@: - xor edx,edx ;преобразовываем в относительные + xor edx,edx ;яЁхюсЁрчют√трхь т юЄэюёшЄхы№э√х mov dx,[wsW] shr edx,1 add dx,[wsX] @@ -408,25 +408,35 @@ DSaveIcon: cmp [DlgSelIcon],-1 je @f - ;удаляем из ini старую иконку - mov ebx,[DlgSelIcon] - mov eax,[IconsOffs+ebx*4] - stdcall [ini_del_section],IconIni,eax - + stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams + mov ebx,[DlgSelIcon] + mov eax,[IconsID+ebx*4] jmp DExitAndSave @@: + + call GenerateID + + mov ebx,[MaxNumIcon] + mov [IconsID+ebx*4],eax + push eax stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams - ;jmp DExitAndSave + pop eax + ;------------------------------------------------------------------------------- DExitAndSave: - stdcall [ini_set_str],IconIni,DAreaName,keyPath,DAreaPath,dword[edtExePath.size] - stdcall [ini_set_str],IconIni,DAreaName,keyParams,DAreaParams,dword[edtParams.size] - stdcall [ini_set_str],IconIni,DAreaName,keyIco,DAreaIcon,dword[edtIcon.size] - stdcall [ini_set_int],IconIni,DAreaName,keyX,[MouseX] - stdcall [ini_set_int],IconIni,DAreaName,keyY,[MouseY] + mov dword[nameSection],eax + stdcall [ini_set_str],IconIni,nameSection,keyName,DAreaName,dword[edtName.size] + stdcall [ini_set_str],IconIni,nameSection,keyPath,DAreaPath,dword[edtExePath.size] + stdcall [ini_set_str],IconIni,nameSection,keyParams,DAreaParams,dword[edtParams.size] + stdcall [ini_set_str],IconIni,nameSection,keyIco,DAreaIcon,dword[edtIcon.size] + cmp [DlgSelIcon],-1 + jne @f + stdcall [ini_set_int],IconIni,nameSection,keyX,[MouseX] + stdcall [ini_set_int],IconIni,nameSection,keyY,[MouseY] + @@: DExit: mov [DlgAddActiv],0 mov [slotDlgAdd],0 @@ -614,7 +624,7 @@ local IcoX:DWORD,\ add edi,3 loop @b - ;затирание не использованых мест + ;чрЄшЁрэшх эх шёяюы№чютрэ√ї ьхёЄ jmp .Dalee .DrawIcons2: @@ -657,7 +667,7 @@ proc DrawSelIcon cmp al,'/' jne .GetIconInd .PathToIcon: - mov al,30h ;заглушка!!!!!!!!!!!!! + mov al,30h ;чруыє°ър!!!!!!!!!!!!! mov byte[edi+1],0 .GetIconInd: ;int3 diff --git a/programs/system/icon_new/Moving.inc b/programs/system/icon_new/Moving.inc index 0e4bd5869c..85873322c2 100644 --- a/programs/system/icon_new/Moving.inc +++ b/programs/system/icon_new/Moving.inc @@ -1,58 +1,57 @@ proc MovingWnd local MySlot:DWORD - mcall 40,0 ;SetMaskMessage 000b + mcall 40,0 ;SetMaskMessage 000b - mcall 12,1 ;RedrawWinBeg + mcall 12,1 ;RedrawWinBeg - mcall 14 - xor ebx,ebx - xor ecx,ecx - mov cx,ax - shr eax,16 - mov cx,ax - dec ebx - dec ecx - mcall 0,,,01000000h - ;mcall 0,IMG_SIZE,IMG_SIZE,01000000h - mcall 12,2 ;RedrawWinEnd + mcall 14 + xor ebx,ebx + xor ecx,ecx + mov cx,ax + shr eax,16 + mov cx,ax + dec ebx + dec ecx + mcall 0,,,01000000h + mcall 12,2 ;RedrawWinEnd - mov eax,[SelIcon] - call DrawIconToArea + mov eax,[SelIcon] + call DrawIconToArea - mcall 37,4,IconArea,10100002h - push eax - test eax,eax - jz @f - mov ecx,eax - mcall 37,5 + mcall 37,4,IconArea,10100002h + push eax + test eax,eax + jz @f + mov ecx,eax + mcall 37,5 @@: - mcall 9,RBProcInfo,-1 ;+30 - mcall 18,21,dword[RBProcInfo+30] - mov [MySlot],eax + mcall 9,RBProcInfo,-1 ;+30 + mcall 18,21,dword[RBProcInfo+30] + mov [MySlot],eax .messages: - cmp [MovingActiv],1 - jne .close - mcall 18,7 - cmp eax,[MySlot] - je @f - mcall 18,3,[MySlot] + cmp [MovingActiv],1 + jne .close + mcall 18,7 + cmp eax,[MySlot] + je @f + mcall 18,3,[MySlot] @@: - mcall 5,1 ;Yield - jmp .messages + mcall 5,1 ;Yield + jmp .messages .close: - pop ecx - test ecx,ecx - jz @f - mcall 37,6 + pop ecx + test ecx,ecx + jz @f + mcall 37,6 @@: - mcall -1 + mcall -1 endp @@ -60,62 +59,62 @@ endp ;eax = NumIcon proc DrawIconToArea ;предназначен для иконок размером = 32x32 - push edi esi + push edi esi - ;mov eax,[NumIcon] - mov edi,[IconsOffs+eax*4] - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - mov al,[edi] - cmp al,'9' - ja .PathToIcon - cmp al,'/' - jne .GetIconInd + ;mov eax,[NumIcon] + mov edi,[IconsOffs+eax*4] + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + mov al,[edi] + cmp al,'9' + ja .PathToIcon + cmp al,'/' + jne .GetIconInd .PathToIcon: - mov al,30h ;заглушка!!!!!!!!!!!!! - mov byte[edi+1],0 + mov al,30h ;заглушка!!!!!!!!!!!!! + mov byte[edi+1],0 .GetIconInd: ;int3 - sub al,30h - cmp byte[edi+1],0 - je @f - shl eax,1 - lea eax,[eax*4+eax] - xor edx,edx - mov dl,[edi+1] - sub dl,30h - add eax,edx - @@: ;eax=num icon - cmp eax,[icon_count] - jb @f - xor eax,eax + sub al,30h + cmp byte[edi+1],0 + je @f + shl eax,1 + lea eax,[eax*4+eax] + xor edx,edx + mov dl,[edi+1] + sub dl,30h + add eax,edx + @@: ;eax=num icon + cmp eax,[icon_count] + jb @f + xor eax,eax @@: - test eax,eax - je .DIA - mov ecx,eax - xor eax,eax + test eax,eax + je .DIA + mov ecx,eax + xor eax,eax @@: - add eax,32*32*4;IMG_SIZE*IMG_SIZE*4 - loop @b + add eax,32*32*4;IMG_SIZE*IMG_SIZE*4 + loop @b .DIA: - mov esi,eax - add esi,[raw_pointer] - add esi,44 + mov esi,eax + add esi,[raw_pointer] + add esi,44 - mov edi,IconArea;+((IMAGE_TOP_Y*ICON_SIZE)+((ICON_SIZE-IMG_SIZE)/2))*4 + mov edi,IconArea;+((IMAGE_TOP_Y*ICON_SIZE)+((ICON_SIZE-IMG_SIZE)/2))*4 ;int3 - mov eax,32;IMG_SIZE - mov edx,eax + mov eax,32;IMG_SIZE + mov edx,eax @@: - mov ecx,eax - rep movsd + mov ecx,eax + rep movsd ; add edi,32*4 - dec edx - jnz @b + dec edx + jnz @b - pop esi edi - ret + pop esi edi + ret endp diff --git a/programs/system/icon_new/RButton.inc b/programs/system/icon_new/RButton.inc index 318f901ef9..2f40bd9d08 100644 --- a/programs/system/icon_new/RButton.inc +++ b/programs/system/icon_new/RButton.inc @@ -1,18 +1,10 @@ -DELTA_COLOR equ 70 -COLOR_SEL_BUT equ 00F7092Dh +DELTA_COLOR equ 70 +COLOR_SEL_BUT equ 00F7092Dh MAX_USER_BUTTONS equ 30 ;---- thread for rbutton ----------------------------------------------------------------------- RButtonWin: - if lang eq ru - mov [MinRMenuW],18*6+10 - else - mov [MinRMenuW],15*6+10 - end if - - - mcall 40,100101b ;SetMaskMessage 100101b mcall 48,3,sc,40 @@ -372,10 +364,58 @@ RBAdd: RBDelete: mov eax,[SelIcon] - mov eax,[IconsOffs+eax*4] + lea eax,[IconsID+eax*4] stdcall [ini_del_section],IconIni,eax stdcall DelIcon,[SelIcon] + mov ebx,[SelIcon] + lea edi,[IconsID+ebx*4-4] + lea esi,[edi+4] + mov ecx,[MaxNumIcon] + sub ecx,[SelIcon] +;dph ecx + test ecx,ecx + jz @f + rep movsd + @@: +;debug_newline +;dpsP IconsID+4*0 +;dps ' ' +;dpsP IconsID+4*1 +;dps ' ' +;dpsP IconsID+4*2 +;dps ' ' +;dpsP IconsID+4*3 +;dps ' ' +;dpsP IconsID+4*4 +;dps ' ' +;dpsP IconsID+4*5 +;dps ' ' +;dpsP IconsID+4*6 +;dps ' ' +;dpsP IconsID+4*7 +;dps ' ' +;dpsP IconsID+4*8 +;dps ' ' +;dpsP IconsID+4*9 +;dps ' ' +;dpsP IconsID+4*10 +;dps ' ' +;dpsP IconsID+4*11 +;dps ' ' +;dpsP IconsID+4*12 +;dps ' ' +;dpsP IconsID+4*13 +;dps ' ' +;dpsP IconsID+4*14 +;dps ' ' +;dpsP IconsID+4*15 +;dps ' ' +;dpsP IconsID+4*16 +;dps ' ' +;dpsP IconsID+4*17 +;debug_newline + mov dword[fiRunProg+8],WarningSave mov dword[fiRunProg+21],pthNotify @@ -501,7 +541,6 @@ proc DrawRBLine y,active ret endp - proc MouseInWin ;Carry flag = 1, если клик в окне mcall 37,0 ;GetMousePos xor ebx,ebx @@ -522,7 +561,6 @@ proc MouseInWin ;Carry flag = 1, ret endp - proc AlignIcons local posX:WORD,\ posY:WORD,\ @@ -715,19 +753,14 @@ endp proc Ini_SavePos stdcall,f_name,sec_name push ebx edi esi + mov ebx,[sec_name] + xor eax,eax + mov ax,[ebx] + xor ebx,ebx .SearchSect: - mov edi,[IconsOffs+ebx*4] - mov esi,[sec_name] - @@: - lodsb - scasb - jne @f - test al,al - jnz @b - - jmp .IcoDataFound - @@: + cmp eax,[IconsID+ebx*4] + je .IcoDataFound inc ebx cmp ebx,[MaxNumIcon] @@ -738,19 +771,14 @@ proc Ini_SavePos stdcall,f_name,sec_name ret .IcoDataFound: + xor al,al + mov edi,[IconsOffs+ebx*4] + or ecx,-1 repne scasb repne scasb repne scasb - -;int3 - movzx eax,word[edi+2] - test eax,8000h - jz @f - or eax,0FFFF0000h - @@: - - stdcall [ini_set_int],[f_name],[sec_name],keyX,eax + repne scasb movzx eax,word[edi] test eax,8000h @@ -760,6 +788,15 @@ proc Ini_SavePos stdcall,f_name,sec_name stdcall [ini_set_int],[f_name],[sec_name],keyY,eax + movzx eax,word[edi+2] + + test eax,8000h + jz @f + or eax,0FFFF0000h + @@: + + stdcall [ini_set_int],[f_name],[sec_name],keyX,eax + mov eax,1 pop esi edi ebx ret diff --git a/programs/system/icon_new/icon.ini b/programs/system/icon_new/icon.ini index ece8521a98..27723723f9 100644 --- a/programs/system/icon_new/icon.ini +++ b/programs/system/icon_new/icon.ini @@ -1,171 +1,201 @@ [rbmenu] -Настройка устройств=setup +Диспетчер процессов=cpu Управление темой=desktop -Диспетчер процессов=/rd/1/cpu +Настройка фона=/sys/media/palitra +Настройка устройств=setup Консоль=/rd/1/shell -[KFM] + +[00] +name=KFM path=/SYS/FILE MANAGERS/KFM param= ico=5 x=0 y=0 -[TINYPAD] +[01] +name=TINYPAD path=/SYS/TINYPAD param= ico=9 x=0 y=68 -[EOLITE] +[02] +name=EOLITE path=/SYS/FILE MANAGERS/EOLITE param= ico=2 x=68 y=0 -[SHELL] +[03] +name=SHELL path=/SYS/SHELL param= ico=20 x=136 y=0 -[KFAR] +[04] +name=KFAR path=/SYS/FILE MANAGERS/KFAR param= ico=16 x=68 y=68 -[RDSAVE] +[05] +name=RDSAVE path=/SYS/RDSAVE param= ico=17 x=0 y=136 -[CALC] +[06] +name=CALC path=/SYS/CALC param= ico=4 x=68 y=136 -[ANIMAGE] +[07] +name=ANIMAGE path=/SYS/MEDIA/ANIMAGE param= ico=15 x=136 y=68 -[KPACK] +[08] +name=KPACK path=/SYS/KPACK param= ico=10 x=-67 y=0 -[SNAKE] +[09] +name=SNAKE path=/SYS/GAMES/SNAKE param= ico=3 x=-135 y=-135 -[MINE] +[0A] +name=MINE path=/SYS/GAMES/MINE param= ico=14 x=-67 y=-67 -[LIFE2] +[0B] +name=LIFE2 path=/SYS/DEMOS/LIFE2 param= ico=13 x=-135 y=-67 -[MBLOCKS] +[0C] +name=MBLOCKS path=/SYS/GAMES/MBLOCKS param= ico=11 x=-67 y=-135 -[PONG] +[0D] +name=PONG path=/SYS/GAMES/PONG3 param= ico=12 x=-203 y=-67 -[15] +[0E] +name=15 path=/SYS/GAMES/15 param= ico=0 x=-271 y=-67 -[DOCPACK] +[0F] +name=DOCPACK path=/SYS/DOCPACK param= ico=8 x=-67 y=68 -[BOARD] +[10] +name=BOARD path=/SYS/DEVELOP/BOARD param= ico=19 x=-135 y=0 -[HEXEDIT] +[11] +name=HEXEDIT path=/SYS/DEVELOP/HEED param= ico=22 x=-67 y=136 -[MTDBG] +[12] +name=MTDBG path=/SYS/DEVELOP/MTDBG param= ico=6 x=-203 y=0 -[PIPES] +[13] +name=PIPES path=/SYS/GAMES/PIPES param= ico=26 x=0 y=-135 -[SUDOKU] +[14] +name=SUDOKU path=/SYS/GAMES/SUDOKU param= ico=25 x=0 y=-67 -[GOMOKU] +[15] +name=GOMOKU path=/SYS/GAMES/GOMOKU param= ico=24 x=68 y=-67 -[XONIX] +[16] +name=XONIX path=/SYS/GAMES/XONIX param= ico=21 x=68 y=-135 -[CHECKERS] +[17] +name=CHECKERS path=/SYS/GAMES/CHECKERS param= ico=1 x=-271 y=-135 -[KOSILKA] +[18] +name=KOSILKA path=/SYS/GAMES/KOSILKA param= ico=23 x=136 y=-67 -[FLOOD-IT] +[19] +name=FLOOD-IT path=/SYS/GAMES/FLOOD-IT param= ico=27 x=136 y=-135 -[FASM] +[1A] +name=FASM path=/SYS/DEVELOP/FASM param= ico=10 x=-135 y=68 -[CLICKS] +[1B] +name=CLICKS path=/SYS/GAMES/CLICKS param= ico=18 diff --git a/programs/system/icon_new/iconman.inc b/programs/system/icon_new/iconman.inc new file mode 100644 index 0000000000..025b002fdd --- /dev/null +++ b/programs/system/icon_new/iconman.inc @@ -0,0 +1,301 @@ +;ret eax=numIcon +proc AddIcon stdcall,x,y,lpIcon,lpName,lpExeFile,lpParams + push ebx edi esi + + mov eax,[x] + mov ebx,[y] + + xor edx,edx + test eax,8000h + jnz @f + mov dx,[wsW] ;если надо, то преобразовываем в + shr edx,1 ;отрицательные координаты + add dx,[wsX] + cmp eax,edx + jbe @f + sub ax,[wsW] + inc eax + @@: + + test ebx,8000h + jnz @f + mov dx,[wsY] + shr edx,1 + add dx,[wsH] + cmp ebx,edx + jbe @f + sub bx,[wsH] + inc ebx + @@: + ;поправка на случай выхода за край экрана + + test eax,8000h + jnz @f + mov dx,[wsXe] + sub edx,ICON_SIZE + cmp eax,edx + jbe @f + mov eax,edx + @@: + + test ebx,8000h + jnz @f + mov dx,[wsYe] + sub edx,ICON_SIZE + cmp ebx,edx + jbe @f + mov ebx,edx + @@: + + mov [x],eax + mov [y],ebx + + xor al,al + or ecx,-1 + mov edi,[lpName] + repne scasb + sub edi,[lpName] + mov ebx,edi + mov edi,[lpExeFile] + repne scasb + sub edi,[lpExeFile] + add ebx,edi + mov edi,[lpParams] + repne scasb + sub edi,[lpParams] + add ebx,edi + mov edi,[lpIcon] + repne scasb + sub edi,[lpIcon] + add ebx,edi + add ebx,4 + mov ecx,dword[SizeData] + add ecx,ebx + mov edx,[IconsOffs] + mcall 68,20 + + mov edx,dword[SizeData] + mov dword[SizeData],ecx + mov dword[BegData],eax + mov edi,eax + add edi,edx + mov esi,[lpName] + @@: lodsb + stosb + test al,al + jnz @b + + mov esi,[lpExeFile] + @@: lodsb + stosb + test al,al + jnz @b + + mov esi,[lpParams] + @@: lodsb + stosb + test al,al + jnz @b + + mov esi,[lpIcon] + @@: lodsb + stosb + test al,al + jnz @b + + mov eax,[x] + mov ebx,[y] + shl eax,16 + mov ax,bx + mov dword[edi],eax + + stdcall FillIconsOffs + + pop esi edi ebx + ret +endp + +proc EditIcon stdcall,NumIcon,lpIcon,lpName,lpExeFile,lpParams + push edi + mov eax,[NumIcon] + mov edi,[IconsOffs+eax*4] + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + repne scasb + push dword[edi] + stdcall DelIcon,[NumIcon] + pop edx + xor eax,eax + mov ax,dx + shr edx,16 + stdcall AddIcon,edx,eax,DAreaIcon,DAreaName,DAreaPath,DAreaParams + pop edi + ret +endp + +proc SetPosition stdcall,NumIcon,x,y + push edi + mov eax,[NumIcon] + mov edi,[IconsOffs+eax*4] + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + repne scasb + mov eax,[x] + shl eax,16 + mov ax,word[y] + mov dword[edi],eax + pop edi + ret +endp + +proc GetNumIcon stdcall,x,y,NumIconI ;номер иконки, который проверять не надо или -1 +local posX:WORD,\ + posY:WORD + push ebx edi + mov ecx,[MaxNumIcon] + test ecx,ecx + jnz @f + or eax,-1 + pop edi ebx + ret + @@: + + mov ebx,ecx + dec ebx + .TestIcon: + cmp dword[NumIconI],-1 + je @f + + cmp ebx,[NumIconI] + jne @f + dec ebx + dec ecx + test ecx,ecx + jz .NoIcon + @@: + + push ecx + + or ecx,-1 + xor al,al + mov edi,[IconsOffs+ebx*4] + repne scasb + repne scasb + repne scasb + repne scasb + + mov ax,[edi+2] + test ax,8000h + jz @f + add ax,[wsXe] + jmp .gni1 + @@: + add ax,[wsX] + .gni1: + mov [posX],ax + + mov ax,[edi] + test ax,8000h + jz @f + add ax,[wsYe] + jmp .gni2 + @@: + add ax,[wsY] + .gni2: + + mov [posY],ax + + mov eax,[x] + mov edx,[y] + + cmp ax,[posX] + jb @f + add word[posX],ICON_SIZE + cmp ax,[posX] + ja @f + + cmp dx,[posY] + jb @f + add word[posY],ICON_SIZE + cmp dx,[posY] + ja @f + + jmp .OkIcon + @@: + + dec ebx + pop ecx + + ;loop .TestIcon + dec ecx + jnz .TestIcon + jmp .NoIcon + .OkIcon: + mov eax,ebx + pop edi ebx + ret + .NoIcon: + or eax,-1 + pop edi ebx + ret +endp + +proc DelIcon stdcall,NumIcon + push ebx edi esi + + cmp [MaxNumIcon],0 + je .end + + cmp [MaxNumIcon],1 + je .OhneIco + + mov ebx,[NumIcon] + + mov eax,[MaxNumIcon] + dec eax + mov [MaxNumIcon],eax + cmp ebx,eax + je @f + + shl ebx,2 + + mov ecx,dword[BegData] + add ecx,dword[SizeData] + sub ecx,[IconsOffs+4+ebx] + + mov edx,[IconsOffs+4+ebx] + sub edx,[IconsOffs+ebx] + sub dword[SizeData],edx + + mov esi,[IconsOffs+4+ebx] + mov edi,[IconsOffs+ebx] + rep movsb + jmp .endDel + + @@: + mov ecx,dword[BegData] + add ecx,dword[SizeData] + sub ecx,[IconsOffs+ebx*4] + sub dword[SizeData],ecx + + .endDel: + stdcall FillIconsOffs + jmp .end + +.OhneIco: + mov edi,[BegData] + mov [SizeData],0 + mov dword[edi],0 + mov [MaxNumIcon],0 + mov dword[IconsOffs],0 + .end: + mcall 15,3 + pop esi edi ebx + ret +endp \ No newline at end of file