kolibrios-gitea/programs/other/ha/HACONFIG.ASM
theonlymirage d391793523 Hot Angles: transition to a components from the library box_lib
git-svn-id: svn://kolibrios.org@7402 a494cfbc-eb01-0410-851d-a64ba20cac60
2018-09-21 23:46:18 +00:00

760 lines
23 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Hot Angles Config ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Compile with FASM
; Version 0.3: Sep 22, 2018
; Copyright (c) 2018, Efremenkov Sergey aka TheOnlyMirage
; All rights reserved.
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright notice, this
; list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation and/or
; other materials provided with the distribution.
; * Neither the name of the <organization> nor the names of its contributors may
; be used to endorse or promote products derived from this software without
; specific prior written permission.
; THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
; --------------------------------------------------------------------------------------
;P.S. Êîä ñûðîé, òðåáóåòñÿ îïòèìèçàöèÿ è äîðàáîòêà (ñì. òåìó ôîðóìà)
format binary as "" ; Binary file format without extension
use32 ; Tell compiler to use 32 bit instructions
org 0 ; the base address of code, always 0x0
; Çàãîëîâîê èñïîëíÿåìîãî ôàéëà Êîëèáðè ÎÑ
db 'MENUET01'
dd 1
dd START
dd I_END
dd MEM
dd STACKTOP
dd 0, 0
; Íà÷àëî îáëàñòè êîäà
include 'lang.inc' ;ïîääåðæêà ÿçûêîâ ïðè êîìïèëÿöèè
include '../../macros.inc'
include '../../proc32.inc'
include '../../dll.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
;;include 'editbox.inc'
;;use_edit_box
;;include 'check.inc' ;âêëþ÷èòü ôàéë check.inc
;;version_ch1 ;íåîáõîäèìûé ìàêðîñ äëÿ âêëþ÷åíèÿ new âåðñèè check_box1
;;use_check_box ;èñïîëüçóÿ ìàêðîñû, âíåñòè ïðîöåäóðû äëÿ ðèñîâàíèÿ ÷åê áîêñà
Otstup = 30
START:
call copyKill ;ïðîñòåéøàÿ çàùèòà îò çàïóñêà âòîðîé êîïèè ïðèëîæåíèÿ
mcall 68, 11 ;èíèöèàëèçàöèÿ êó÷è
mov eax,48 ;ïîëó÷èòü ñèñòåìíûå öâåòà
mov ebx,3
mov ecx, sc
mov edx, sizeof.system_colors
mcall
stdcall dll.Load, @IMPORT
or eax, eax
jnz exit
invoke init_checkbox, ch1
mov eax,40 ;óñòàíîâèòü ìàñêó äëÿ îæèäàåìûõ ñîáûòèé
mov ebx,0x27 ;ñèñòåìà áóäåò ðåàãèðîâàòü òîëüêî íà ñîîáùåíèå î ïåðåðèñîâêå, íàæàòà êíîïêà, îïðåäåë¸ííàÿ ðàíåå, ñîáûòèå îò ìûøè (÷òî-òî ñëó÷èëîñü - íàæàòèå íà êíîïêó ìûøè èëè ïåðåìåùåíèå; ñáðàñûâàåòñÿ ïðè ïðî÷òåíèè)
mcall
call loadConfig ;çàãðóæàåì êîíôèãóðàöèþ èç ôàéëà, åñëè íåò - òî âûñòàâëÿåì ïàðàìåòðû ïî óìîë÷àíèþ
call draw_window ;îòðèñîâàòü îêíî ïðèëîæåíèÿ
; Îáðàáîòêà öèêëà ñîáûòèé
event_wait:
mov eax, 10 ; function 10 : wait until event
mcall ; event type is returned in eax
cmp eax, 1 ; Event redraw request ?
je red ; Expl.: there has been activity on screen and
; parts of the applications has to be redrawn.
cmp eax, 2 ; Event key in buffer ?
je key ; Expl.: User has pressed a key while the
; app is at the top of the window stack.
cmp eax, 3 ; Event button in buffer ?
je button ; Expl.: User has pressed one of the
; applications buttons.
;mouse_edit_boxes editboxes,editboxes_end
;mouse_check_boxes check_boxes,check_boxes_end ;ïðîâåðêà ÷åê áîêñà
invoke edit_box_mouse, editLU
invoke edit_box_mouse, editLD
invoke edit_box_mouse, editRU
invoke edit_box_mouse, editRD
invoke check_box_mouse, ch1 ;ïðîâåðêà ÷åê áîêñà
jmp event_wait
red: ;îáðàáîòêà ñîáûòèÿ ïåðåðèñîâêè îêíà
call draw_window
jmp event_wait
key: ; Keypress event handler
mov eax, 2 ; The key is returned in ah. The key must be
mcall ; read and cleared from the system queue.
;key_edit_boxes editboxes,editboxes_end
invoke edit_box_key, editLU
invoke edit_box_key, editLD
invoke edit_box_key, editRU
invoke edit_box_key, editRD
jmp event_wait ; Just read the key, ignore it and jump to event_wait.
button: ; Buttonpress event handler
mov eax,17 ; The button number defined in window_draw
mcall ; is returned to ah.
cmp ah,1 ; button id=1 ?
jne noclose
exit:
mov eax,-1 ; Function -1 : close this program
mcall
noclose:
cmp ah, 2 ;êíîïêà "Ïðèìåíèòü"
jne butend
call applyButton ;âûçîâ íàøåãî îáðàáîò÷èêà íàæàòèÿ êíîïêè
butend:
jmp event_wait ;this is for ignored events, useful at development
;èìÿ êîíôèãóðàöèîííîãî ôàéëà
fileName: db 'SETTINGS/HOTANGLES.CFG', 0
;ñòðóêòóðà äëÿ ñîçäàíèÿ/ïåðåçàïèñè ôàéëà
createFile:
.func dd 2 ;íîìåð ïîäôóíêöèè
.re dd 0, 0 ;çàðåçåðâèðîâàíî
.size dd 0 ;ñêîëüêî áàéò ïèñàòü
.data_adr dd 0 ;óêàçàòåëü íà äàííûå
.path db 0
.path_adr dd fileName ;ïóòü
;ñòðîêà ïàðàìåòðîâ ïî óìîë÷àíèþ è å¸ ðàçìåð
defaultDataForConfig db 121,13,10,'/rd/1/HACONFIG',13,10,'/rd/1/HACONFIG',13,10,'/rd/1/HACONFIG',13,10,'/rd/1/HACONFIG',13,10
defaultDataSize = 48+19
copyParam: ;êîïèðóåò ïàðàìåòð(êîìàíäó çàïóñêà) â áóôåð (ñì. äàëüøå)
push esi ebx ecx
mov ecx, dword[ebx] ;÷èòàåì ðàçìåð ñòðîêè
.copy: ;êîïèðóåì ñèìâîëû
cmp ecx, 0
je copyParam.copyEnd
mov bl, byte[esi]
mov byte[eax], bl
dec ecx
inc eax
inc esi
jmp copyParam.copy
.copyEnd:
pop ecx ebx esi
ret
addPerenos: ;äîáàâëÿåò ïåðåíîñ ñòðîêè â áóôåð
mov byte[eax], 13
inc eax
mov byte[eax], 10
inc eax
ret
;îáðàáîò÷èê êíîïêè "Ïðèìåíèòü"
applyButton:
push eax ebx ecx
;mov dword[createFile.data_adr], defaultDataForConfig
;mov dword[createFile.size], defaultDataSize
;âû÷èñëèì ðàçìåð ôàéëà êîíôèãóðàöèè â áàéòàõ
mov ecx, 5*2+1 ;1 áàéò íà ñîñòîÿíèå àêòèâíîñòè è 5 ïàð ïåðåíîñîâ ñòðîê (ñèìâîëû 13, 10)
add ecx, dword[editLU.size] ;dataBuffer.size1] ;ïëþñ ðàçìåð êàæäîé ñòðîêè â áàéòàõ
add ecx, dword[editLD.size] ;dataBuffer.size2]
add ecx, dword[editRU.size] ;dataBuffer.size3]
add ecx, dword[editRD.size] ;dataBuffer.size4]
;òåïåðü ðàçìåð ôàéëà êîíôèãóðàöèè â ecx
mov dword[createFile.size], ecx ;ïîëîæèì ðàçìåð áàéò â ñòðóêòóðó ñîçäàíèÿ/ïåðåçàïèñè ôàéëà
mcall 68, 12, ecx ;âûäåëÿåì áëîê ïàìÿòè ïîä áóôåð ñîäåðæèìîãî
mov dword[createFile.data_adr], eax ;ñîõðàíÿåì àäðåñ áóôåðà â ñòðóêòóðó
;çàïîëíèì áóôåð ñîäåðæèìîãî:
mov byte[eax], 110; 'n' ;ïî óìîë÷àíèþ ôëàã ñíÿò
cmp word[ch1.flags], 110b ;ch_flag_en and ch_flag_middle ;110b ;ch_flag_en ;âûñòàâëåí checkBox èëè íåò?
jne applyButton.no
mov byte[eax], 121 ;èíà÷å êëàä¸ì 'y'
.no:
inc eax
call addPerenos
push esi ebx
call UpdateEditsSizes ;îáíîâèòü ðàçìåðû òåêñòà â edit'àõ
mov esi, dataBuffer.1 ;editLU.text
mov ebx, dataBuffer.size1 ;editLU.size
call copyParam
call addPerenos ;äîáàâëÿåì ïåðåíîñ ñòðîêè
mov esi, dataBuffer.2 ;editLD.text
mov ebx, dataBuffer.size2 ;editLD.size
call copyParam
call addPerenos ;äîáàâëÿåì ïåðåíîñ ñòðîêè
mov esi, dataBuffer.3
mov ebx, dataBuffer.size3
call copyParam
call addPerenos ;äîáàâëÿåì ïåðåíîñ ñòðîêè
mov esi, dataBuffer.4
mov ebx, dataBuffer.size4
call copyParam
call addPerenos ;äîáàâëÿåì ïåðåíîñ ñòðîêè
pop ebx esi
mov ebx, createFile
mcall 70
cmp eax, 0
je .end
;èíà÷å çäåñü íóæíî âûâåñòè îêíî ñ îøèáêîé !!!
.end:
mcall 68, 13, dword[createFile.data_adr] ;îñâîáîæäàåì ïàìÿòü ïîä áóôåð
call restartHotAnglesApp ;ïåðåçàïóñêàåì @HOTANGLES
pop ecx ebx eax
ret
compareBytes2:
push edi esi ecx ebx
xor eax, eax
mov ecx, 10 ;max ðàçìåð ñòðîê 11
@@:
mov bl, byte[edi]
cmp bl, byte[esi]
jne compareBytes.no
inc edi
inc esi
cmp ecx, 0
je @f
dec ecx
jmp @b
.no:
mov eax, 1
@@:
pop ebx ecx esi edi
ret
restartHotAnglesApp: ;!!!
;íàõîäèì âñå êîïèè ïðèëîæåíèÿ ïî èìåíè è çàâåðøàåì èõ
push eax ebx ecx esi edi
;óêàçàòåëè, êîòîðûå íèêîãäà íå ìåíÿþòñÿ:
mov esi, startAppData.file_name ;ïåðâàÿ ñòðîêà - èñêîìîå èìÿ ïðèëîæåíèÿ
mov edi, buf ;âòîðàÿ ñòðîêà - èìÿ òåêóùåãî ñëîòà
add edi, 10
mov ecx, 1
@@:
mcall 9, buf, ecx ;ïîëó÷àåì äàííûå î÷åðåäíîãî ñëîòà
mov dword[slotMax], eax
call compareBytes2 ;ñðàâíèâàåì èìÿ
cmp eax, 0
jne restartHotAnglesApp.next ;åñëè íå ñîâïàëî, òî ïåðåõîäèì íà ñëåäóþùèé ñëîò
;push eax ebx ecx
mcall 18, 2, ecx ;èíà÷å çàâåðøàåì ñëîò
;pop ecx ebx eax
.next:
inc ecx
cmp ecx, dword[slotMax]
ja @f
jmp @b
@@:
pop edi esi ecx ebx eax
;çàïóñêàåì ïðèëîæåíèå çàíîâî
push eax ebx
mcall 70, startAppData
cmp eax, 0
ja @f ;åñëè eax>0, òî óñïåøíî çàïóùåíî
;!!! èíà÷å òóò ïå÷àòàåì îøèáêó
@@:
pop ebx eax
ret
startAppData:
.subfunction dd 7
.flags dd 0
.param dd 0
.rezerv dd 0, 0
.full_name db '/rd/1/'
.file_name db '@HOTANGLES', 0
;db 0
;.name: dd HotAnglesAppName
;HotAnglesAppName db '@HOTANGLES', 0
UpdateEditsSizes:
push eax
mov eax, dword[editLU.size]
mov dword[dataBuffer.size1], eax
mov eax, dword[editLD.size]
mov dword[dataBuffer.size2], eax
mov eax, dword[editRU.size]
mov dword[dataBuffer.size3], eax
mov eax, dword[editRD.size]
mov dword[dataBuffer.size4], eax
pop eax
ret
fileAdr dd 0
loadConfig:
push eax ebx ecx edx
mcall 68, 27, fileName ;çàãðóæàåì êîíôèãóðàöèîííûé ôàéë â ÎÇÓ
mov dword[fileAdr], eax ;ñîõðàíÿåì àäðåñ áëîêà ïàìÿòè ôàéëà
cmp eax, 0
je loadConfig.default ;åñëè ôàéëà êîíôèãóðàöèè íåò, òî ñòàâèì íàñòðîéêè ïî óìîë÷àíèþ
;èíà÷å äàííûå çàãðóæåíû â ÎÇÓ, ðàçìåð â edx
cmp edx, 0 ;åñëè ôàéë ïóñò, â í¸ì íåò äàííûõ, òî ñòàâèì íàñòðîéêè ïî óìîë÷àíèþ
je loadConfig.default
.start:
add edx, eax ;êëàä¸ì â edx - àäðåñ êîíöà êîíôèã.äàííûõ
.chStart:
cmp byte[eax], 121 ;'y' ;âûñòàâëÿåì checkBox - ïàðàìåòð àêòèâíîñòè ïðèëîæåíèÿ
jne loadConfig.no
.yes:
mov word[ch1.flags], 110b ;ch_flag_en and ch_flag_middle ;110b ;ch_flag_en
jmp loadConfig.chEnd
.no:
mov word[ch1.flags], 100b ;0 and ch_flag_middle ;100b
.chEnd:
;jmp loadConfig.end ;êîìàíäà äëÿ óäîáñòâà îòëàäêè è ïîèñêà îøèáîê
;êîïèðóåì ñîäåðæèìîå ñòðîê â áóôåð
push edi esi ecx ebx eax
;èíèöèàëèçèðóåì óêàçàòåëè íà àäðåñà áóôåðà ñòðîêè è å¸ ðàçìåðà
mov edi, dataBuffer.1 ;dword[dataBuffer.1]
mov esi, dataBuffer.size1 ;dword[dataBuffer.size1]
;ecx - ñ÷¸ò÷èê áàéò â ñòðîêå
; mov ecx, 0 ;xor ecx, ecx
.block:
xor ecx, ecx ;îáíóëÿåì ñ÷¸ò÷èê
inc eax
cmp byte[eax], 10 ;åñëè î÷åðåäíîé êîä ñèìâîëà 10 èëè 13, òî ïðîïóñêàåì ñèìâîëû
je loadConfig.block ;propusk ;äî ïåðâîãî îòëè÷íîãî îò íèõ
cmp byte[eax], 13
je loadConfig.block ;propusk
; ñèìâîë îòëè÷åí îò ïåðåíîñà ñòðîêè è âîçâðàòà êàðåòêè - íà÷èíàåì êîïèðîâàòü îòñþäà â áóôåð
mov bl, byte[eax]
mov byte[edi], bl
inc edi
inc eax
inc ecx ;óâåëè÷èâàåì ñ÷¸ò÷èê ñèìâîëîâ â ñòðîêå
;èä¸ì äî êîíöà ýòîé ñòðîêè: ïîêà íå âñòðåòèì î÷åðåäíîé 10, 13, 0 èëè file end
.while: ;è êîïèðóåì âñ¸ â áóôåð
cmp eax, edx ;ïðîâåðÿåì çàêîí÷èëñÿ ëè ôàéë, à êîíöà ñòðîêè íå áûëî !!!
ja loadConfig.ura
cmp byte[eax], 10
je loadConfig.ura
cmp byte[eax], 0
je loadConfig.ura
cmp byte[eax], 13
je loadConfig.ura
mov bl, byte[eax]
mov byte[edi], bl
inc edi
inc eax
inc ecx
cmp ecx, 511
jae loadConfig.ura
jmp loadConfig.while
.ura:
mov byte[edi], 0 ;êëàä¸ì çàâåðøàþùèé 0 â ñòðîêó
mov dword[esi], ecx ;ñîõðàíÿåì ðàçìåð ñòðîêè
add esi, 4 ;ïåðåõîäèì íà ðàçìåð ñëåäóþùåãî áóôåðà
sub edi, ecx ;ïåðåõîäèì íà ñëåäóþùèé áóôåð
add edi, 512
; mov ecx, 0 ;xor ecx, ecx ;îáíóëÿåì ðàçìåð ñòðîêè
cmp edi, dataBuffer.size1 ;åñëè ýòî áûë ïîñëåäíèé áóôåð (è ìû âûøëè çà àäðåñà ðàçìåðîâ áóôåðîâ), òî âûõîäèì
jb loadConfig.block
pop eax ebx ecx esi edi
jmp loadConfig.end
.default:
mov eax, defaultDataForConfig
mov edx, defaultDataSize
jmp loadConfig.start
.end:
mov ecx, dword[fileAdr] ;åñëè ôàéë áûë çàãðóæåí, òî
cmp ecx, 0
je @f
mcall 68, 13, ecx ;âûãðóæàåì ôàéë èç ïàìÿòè
@@:
call updateParams ;ïðèìåíÿåì íàñòðîéêè êàæäîãî áóôåðà
pop edx ecx ebx eax
ret
updateParams: ;max, size, pos
push eax
mov eax, dword[dataBuffer.size1]
mov dword[editLU.size], eax
mov dword[editLU.pos], eax
mov eax, dword[dataBuffer.size2]
mov dword[editLD.size], eax
mov dword[editLD.pos], eax
mov eax, dword[dataBuffer.size3]
mov dword[editRU.size], eax
mov dword[editRU.pos], eax
mov eax, dword[dataBuffer.size4]
mov dword[editRD.size], eax
mov dword[editRD.pos], eax
pop eax
ret
selfName db 'HACONFIG', 0 ;'@HOTANGLES',0
selfNameSize = 8;9 ;äî 11 byte
;
compareBytes:
push edi esi ecx ebx
mov eax, 0 ;xor eax, eax
mov ecx, selfNameSize ;11 ;max ðàçìåð ñòðîê 11
@@:
mov bl, byte[edi]
cmp bl, byte[esi]
jne compareBytes.no
inc edi
inc esi
cmp ecx, 0
je @f
dec ecx
jmp @b
.no:
mov eax, 1
@@:
pop ebx ecx esi edi
ret
;
slotMax dd 0
selfPID dd 0
buf db 1024 dup(0)
copyKill:
push eax ebx ecx esi edi
;ñïåðâà ïðî÷ò¸ì ñâîþ èíôîðìàöèþ
mcall 9, buf, -1
mov eax, dword[buf+30]
mov dword[selfPID], eax
;óêàçàòåëè, êîòîðûå íèêîãäà íå ìåíÿþòñÿ:
mov esi, selfName ;ïåðâàÿ ñòðîêà - èìÿ òåêóùåãî ïðèëîæåíèÿ
mov edi, buf ;âòîðàÿ ñòðîêà - èìÿ òåêóùåãî ñëîòà
add edi, 10
mov ecx, 1
@@:
mcall 9, buf, ecx
mov dword[slotMax], eax
;åñëè ýòî ìû ñàìè, òî ïðîïóñêàåì ïðîâåðêó
mov eax, dword[buf+30]
cmp eax, dword[selfPID]
je copyKill.propusk
call compareBytes ;ñðàâíèâàåì 11 áàéò ñòðîê, ðåçóëüòàò â eax
cmp eax, 0
je copyKill.selfKill
.propusk:
inc ecx
cmp ecx, dword[slotMax]
ja @f
jmp @b
.selfKill:
pop edi esi ecx ebx eax
mcall -1
ret
@@:
pop edi esi ecx ebx eax
ret
WindowsWidth = 450
WindowsHeight = 195
coord: ;êîîðäèíàòû îêíà ïðèëîæåíèÿ
.y dw 0
.x dw 0
draw_window:
;óäàëÿåì êíîïêó, åñëè åñòü
mov edx, 0x80000002
mcall 8
mov eax, 12 ; function 12: tell os about windowdraw
mov ebx, 1 ; 1, start of draw
mcall
;îòîáðàçèì îêíî ïî öåíòðó ýêðàíà äëÿ ýòîãî:
mcall 14 ;ïîëó÷èì ðàçìåðû ýêðàíà
mov dword[coord], eax ;ïîëîæèì ðàçìåðû ýêðàíà â êîîðäèíàòû
shr word[coord.x], 1 ;âåðíåå ïîëîæèì èõ ïîëîâèíó
shr word[coord.y], 1
;âû÷èñëÿåì êîîðäèíàòû îêíà, ÷òîáû îêíî áûëî ïî ñåðåäèíå ýêðàíà
sub word[coord.x], WindowsWidth/2
sub word[coord.y], WindowsHeight/2
mov eax, 0 ; function 0 : define and draw window
mov ebx, 0 ;* 65536 + WindowsWidth ; [x start] *65536 + [x size]
mov bx, word[coord.x]
shl ebx, 16
mov bx, WindowsWidth
mov ecx, 0
mov cx, word[coord.y] ;* 65536 + WindowsHeight ; [y start] *65536 + [y size]
shl ecx, 16
mov cx, WindowsHeight
mov edx, 0x14ffffff ; color of work area RRGGBB
; 0x02000000 = window type 4 (fixed size, skinned window)
mov esi, 0x808899ff ; color of grab bar RRGGBB
; 0x80000000 = color glide
mov edi, title
mcall
;draw_check_boxes check_boxes,check_boxes_end ;ðèñîâàíèå ÷åêáîêñîâ
;draw_edit_boxes editboxes,editboxes_end ;ðèñîâàíèå edit box'îâ
invoke edit_box_draw, editLU ;ðèñîâàíèå edit box'îâ
invoke edit_box_draw, editLD
invoke edit_box_draw, editRU
invoke edit_box_draw, editRD
invoke check_box_draw, ch1 ;ðèñîâàíèå ÷åêáîêñîâ
;ðèñóåì êíîïêó
mov ebx, (WindowsWidth-80-Otstup)*65536 + 80 ;êîîðäèíàòà X, øèðèíà êíîïêè
mov ecx, 160*65536 + 20 ;êîîðäèíàòà Y, âûñîòà êíîïêè
mov edx, 0x00000002 ;2 ;íîìåð êíîïêè
mov esi, 0x00AABBCC ;öâåò êíîïêè
mcall 8
;ðèñóåì òåêñò êíîïêè
mov ebx, (WindowsWidth-80-Otstup+25-buttonTextXoffset) * 65536 + 166 ;êîîðäèíàòû òåêñòà (x, y)
mov ecx, 0xFFFFFF ;áåëûé öâåò òåêñòà
mov edx, buttonText
mov esi, buttonTextSize ;5 ;ðàçìåð òåêñòà â ñèìâîëàõ
mcall 4
call draw_super_text
LineLength = 62 ;42
mov ebx, 40 * 65536 + 36 ; draw info text with function 4 (x, y)
mov ecx, 0x224466
mov edx, text
mov esi, LineLength
mov eax, 4
.newline: ; text from the DATA AREA
mcall
add ebx, 12
add edx, LineLength
cmp byte[edx], 0
jne .newline
mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 2 ; 2, end of draw
mcall
ret
align 16
@IMPORT:
library box_lib, 'box_lib.obj'
import box_lib,\
edit_box_draw, 'edit_box',\
edit_box_key, 'edit_box_key',\
edit_box_mouse, 'edit_box_mouse',\
init_checkbox, 'init_checkbox2',\
check_box_draw, 'check_box_draw2',\
check_box_mouse, 'check_box_mouse2',\
option_box_draw, 'option_box_draw',\
option_box_mouse, 'option_box_mouse'
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA äàííûå äëÿ check_box1 - èñïîëüçóåò ñèñòåìíûå öâåòà
;Ôîðìàò äàííûõ ÷åê áîêñà:
; êîîðäèíàòà õ, êîîðäèíàòà ó, óêàçàòåëü íà íà÷àëî ñòðîêè, äëèíà ñòðîêè
;ñîñòîÿíèå ðàáîòû óòèëèòû: àêòèâíà/íåò
;check_boxes:
; ch1 check_box1 30,160,ch_text.1,ch_text.e1-ch_text.1,ch_flag_en
;check_boxes_end:
;êîîðäèíàòû (x,y) = (30, 160) ðàçìåð ÷åêáîêñà 12, öâåò òåêñòà 0x224466
ch1 check_box2 30 shl 16 + 12, 160 shl 16 + 12, 6, 0xFFFFFFFF, 0xAABBCC, 0x224466, ch_text, 110b ; ch_flag_en and ch_flag_middle
if lang eq ru ;åñëè ÿçûê ñáîðêè ðóññêèé
text db "Š®­ä¨£ãà â®à Hot Angles ®â¢¥ç ¥â §  ­ áâனªã  ªâ¨¢­ëå 㣫®¢. "
db "<22> áâன⥠¯ à ¬¥âàë ¯®¤ á¥¡ï ¨«¨ ®âª«îç¨â¥ íâã ®¯æ¨î. "
db " ", 0
hed:
title db "Š®­ä¨£ãà â®à ã⨫¨âë Hot Angles", 0
buttonText db "<22>ਬ¥­¨âì", 0
buttonTextSize = 9
buttonTextXoffset = 12
ch_text db '‚ª«îç¨âì/ ªâ¨¢¨à®¢ âì "Hot Angles"', 0
;ch_text: ;ñîïðîâîæäàþùèé òåêñò äëÿ ÷åê áîêñîâ
;.1 db '‚ª«îç¨âì/ ªâ¨¢¨à®¢ âì "Hot Angles"'
;.e1:
superText:
.lu db 'Š®¬ ­¤  «¥¢®£® ¢¥àå­¥£® 㣫 : ', 0
.ld db 'Š®¬ ­¤  «¥¢®£® ­¨¦­¥£® 㣫 : ', 0
.ru db 'Š®¬ ­¤  ¯à ¢®£® ¢¥àå­¥£® 㣫 :', 0
.rd db 'Š®¬ ­¤  ¯à ¢®£® ­¨¦­¥£® 㣫 : ', 0
superTextSize = 30
else ;èíà÷å àíãëèéñêèé òåêñò
text db "This is a Hot Angles Configurator. "
db "Set the parameters bellow for yourself or disable this option."
db " ", 0
hed:
title db "Hot Angles Configurator", 0
buttonText db "Apply", 0
buttonTextSize = 5
buttonTextXoffset = 0
ch_text db 'Activate "Hot Angles"',0 ;ñîïðîâîæäàþùèé òåêñò äëÿ ÷åê áîêñà
;.1 db 'Activate "Hot Angles"',0
;.e1:
superText:
.lu db 'Left up angle command: ', 0
.ld db 'Left down angle command: ', 0
.ru db 'Right up angle command: ', 0
.rd db 'Right down angle command:', 0
superTextSize = 25
end if
draw_super_text:
push eax ebx ecx edx edi esi
mov ebx, Otstup * 65536 + 74 ; draw info text with function 4 (x, y)
mov ecx, 0x224466
mov eax, superText.lu
mov edx, eax
mov esi, superTextSize ;22
mcall 4
mov ebx, Otstup * 65536 + 109
mov edx, superText.ld
mov esi, superTextSize ;24
mcall 4
mov ebx, 240 * 65536 + 74
mov edx, superText.ru
mov esi, superTextSize ;23
mcall 4
mov ebx, 240 * 65536 + 109
mov edx, superText.rd
mov esi, superTextSize ;25
mcall 4
pop esi edi edx ecx ebx eax
ret
edMaxSize = 510 ;òåïåðü ñ íîâûì êîìïîíåíòîì ìîæíî è 511 óêàçàòü
edMax = 0 ;max, size, pos
align 4
editLU edit_box 180,Otstup,85, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, dataBuffer.1, mouse_dd, 0, edMax, edMax ;ed_focus
editLD edit_box 180,Otstup,120, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, dataBuffer.2, mouse_dd, 0, edMax, edMax
editRU edit_box 180,240,85, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, dataBuffer.3, mouse_dd, 0, edMax, edMax
editRD edit_box 180,240,120, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, dataBuffer.4, mouse_dd, 0, edMax, edMax
;editboxes:
;editLU edit_box 180,Otstup,85,0xffffff,0x6a9480,0,0xAABBCC,0,edMaxSize,dataBuffer.1,ed_focus,edMax,edMax
;editLD edit_box 180,Otstup,120,0xffffff,0x6a9480,0,0xAABBCC,0,edMaxSize,dataBuffer.2,0,edMax,edMax
;editRU edit_box 180,240,85,0xffffff,0x6a9480,0,0xAABBCC,0,edMaxSize,dataBuffer.3,0,edMax,edMax
;editRD edit_box 180,240,120,0xffffff,0x6a9480,0,0xAABBCC,0,edMaxSize,dataBuffer.4,0,edMax,edMax
;editboxes_end:
;data_of_code dd 0
;mouse_flag dd 0x0
dataBuffer:
.1: rb 512
.2: rb 512
.3: rb 512
.4: rb 512
.size1: rd 1
.size2: rd 1
.size3: rd 1
.size4: rd 1
;255+255+2
;äâà çàïàñíûõ áàéòà íåîáõîäèìû äëÿ òîãî ÷òî áû íå ïåïåðåïèñàòü ñëåäóþùèåé áàéòû, â êîíöå áóôåðà 0
dataBufferEnd:
mouse_dd dd ?
sc system_colors
I_END:
rb 4096
align 16
STACKTOP:
MEM: