Subversion Repositories Kolibri OS

Rev

Rev 7777 | Rev 8408 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7389 theonlymir 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
; Hot Angles Config ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
; Compile with FASM
7776 leency 5
; Version 0.3.9: Apr 11, 2020
7389 theonlymir 6
 
7
; Copyright (c) 2018, Efremenkov Sergey aka TheOnlyMirage
8
; All rights reserved.
9
; Redistribution and use in source and binary forms, with or without modification,
10
; are permitted provided that the following conditions are met:
11
;    * Redistributions of source code must retain the above copyright notice, this
12
;    list of conditions and the following disclaimer.
13
;    * Redistributions in binary form must reproduce the above copyright  notice,
14
;    this list of conditions and the following disclaimer in the documentation and/or
15
;    other materials provided with the distribution.
16
;    * Neither the name of the  nor the names of its contributors may
17
;    be used to endorse or promote products derived from this software without
18
;    specific prior written permission.
19
 
20
; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21
; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
22
; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
; --------------------------------------------------------------------------------------
27
 
7408 theonlymir 28
;P.S.      (.  )
7389 theonlymir 29
format binary as ""     ; Binary file format without extension
30
use32                   ; Tell compiler to use 32 bit instructions
31
org 0                   ; the base address of code, always 0x0
32
 
7776 leency 33
;     
7389 theonlymir 34
db 'MENUET01'
35
dd 1
36
dd START
37
dd I_END
38
dd MEM
39
dd STACKTOP
40
dd 0, 0
41
 
42
;   
7395 theonlymir 43
include 'lang.inc'       ;   
7389 theonlymir 44
include '../../macros.inc'
7402 theonlymir 45
include '../../proc32.inc'
46
include '../../dll.inc'
7408 theonlymir 47
include '../../develop/libraries/box_lib/trunk/box_lib.mac' ; checkBox  editBox
7443 theonlymir 48
include '../../develop/libraries/box_lib/load_lib.mac'      ;   
7436 theonlymir 49
@use_library
7443 theonlymir 50
 
51
KMENUITEM_NORMAL    equ 0
52
KMENUITEM_SUBMENU   equ 1
53
KMENUITEM_SEPARATOR equ 2
54
 
7389 theonlymir 55
Otstup = 30
56
 
57
START:
7776 leency 58
    call copyKill        ;      
59
    mcall  68, 11        ; 
7389 theonlymir 60
 
7436 theonlymir 61
    ;mcall 48,3,sc,sizeof.system_colors ;  
7389 theonlymir 62
    mov  eax,48          ;  
63
    mov  ebx,3
64
    mov  ecx, sc
65
    mov  edx, sizeof.system_colors
66
    mcall
67
 
7402 theonlymir 68
    stdcall dll.Load, @IMPORT
69
    or      eax, eax
70
    jnz     exit
71
 
7776 leency 72
    mov  eax,40          ;    
73
    mov  ebx,0x27        ;       ,  ,  ,    (-  -      ;   )
7389 theonlymir 74
    mcall
75
 
7436 theonlymir 76
    load_libraries l_libs_start,load_lib_end ; ()
77
    stdcall [OpenDialog_Init],OpenDialog_data ; 
78
 
7443 theonlymir 79
    ;mode menu
80
    stdcall [kmenu_init], sc    ;kmenu initialisation
81
    stdcall [ksubmenu_new]
82
    mov [modeMenu], eax
83
    stdcall [kmenuitem_new], KMENUITEM_NORMAL, valueModeMenu0, 110
84
    stdcall [ksubmenu_add], [modeMenu], eax
85
    stdcall [kmenuitem_new], KMENUITEM_NORMAL, valueModeMenu1, 111
86
    stdcall [ksubmenu_add], [modeMenu], eax
87
    stdcall [kmenuitem_new], KMENUITEM_NORMAL, valueModeMenu2, 112
88
    stdcall [ksubmenu_add], [modeMenu], eax
89
    stdcall [kmenuitem_new], KMENUITEM_NORMAL, valueModeMenu3, 113
90
    stdcall [ksubmenu_add], [modeMenu], eax
91
        stdcall [kmenuitem_new], KMENUITEM_SUBMENU, valueModeMenu1, [modeMenu]
92
 
7776 leency 93
    call  loadConfig     ;   ,   -     
94
    call  draw_window    ;  
7389 theonlymir 95
 
96
;   
97
event_wait:
98
    mov     eax, 10      ; function 10 : wait until event
99
    mcall                ; event type is returned in eax
100
 
101
    cmp     eax, 1       ; Event redraw request ?
102
    je      red          ; Expl.: there has been activity on screen and
103
                         ; parts of the applications has to be redrawn.
104
 
105
    cmp     eax, 2       ; Event key in buffer ?
106
    je      key          ; Expl.: User has pressed a key while the
107
                         ; app is at the top of the window stack.
108
 
109
    cmp     eax, 3       ; Event button in buffer ?
110
    je      button       ; Expl.: User has pressed one of the
111
                         ; applications buttons.
112
 
7776 leency 113
    invoke  edit_box_mouse, editLU   ;    editBox'
7402 theonlymir 114
    invoke  edit_box_mouse, editLD
115
    invoke  edit_box_mouse, editRU
116
    invoke  edit_box_mouse, editRD
7776 leency 117
    ;stdcall [kmainmenu_dispatch_cursorevent], [modeMenu] ;   
7459 theonlymir 118
    invoke  edit_box_mouse, editRadius
7402 theonlymir 119
 
7389 theonlymir 120
    jmp     event_wait
121
 
122
 
7776 leency 123
red:                     ;   
7389 theonlymir 124
   call    draw_window
125
   jmp     event_wait
126
 
127
key:                                    ; Keypress event handler
128
        mov     eax, 2                  ; The key is returned in ah. The key must be
129
        mcall                           ; read and cleared from the system queue.
7408 theonlymir 130
 
7402 theonlymir 131
        invoke  edit_box_key, editLU
132
        invoke  edit_box_key, editLD
133
        invoke  edit_box_key, editRU
134
        invoke  edit_box_key, editRD
7459 theonlymir 135
        invoke  edit_box_key, editRadius
136
 
137
        cmp eax, 1
7460 theonlymir 138
        je event_wait
7459 theonlymir 139
        cmp word[hkSymbol], 0
7460 theonlymir 140
        jne event_wait
7459 theonlymir 141
        cmp al, 0
142
        jne .next
143
        mov byte[hkSymbol], ah
144
 
7776 leency 145
        push eax ecx esi            ;  
7459 theonlymir 146
        shr eax, 16
147
        mov byte[keyscan], al
148
        mov ecx, 0
149
        mov cl, al ;byte[keyscan]
150
        mov esi, keystr.data
151
        call IntToStr
152
 
153
        ;   
154
        xor ecx, ecx
155
        mov esi, keystr.data
156
       @@:
157
        cmp byte[esi], 0
158
        je @f
159
        inc esi
160
        inc ecx
161
        ;cmp ecx, 4
162
        ;je @f
163
        jmp @b
164
       @@:
7776 leency 165
        ;  
7459 theonlymir 166
        mov dword[keystr.size], ecx
167
 
168
        pop esi ecx eax
169
        jmp red
170
.next:
171
        ;cmp al, 2
172
        ;jne @f
173
        ;cmp ah, 0
174
        ;jne @f
7776 leency 175
        ;  
7459 theonlymir 176
        ;shr eax, 16
177
        ;bt eax, 0   ;left shift
178
        ;jne @f
179
        ;mov byte[hkSymbol], 2
180
        ;jmp red
181
@@:
7389 theonlymir 182
        jmp     event_wait              ; Just read the key, ignore it and jump to event_wait.
183
 
184
button:                                 ; Buttonpress event handler
185
    mov     eax,17                  ; The button number defined in window_draw
186
    mcall                           ; is returned to ah.
187
 
188
    cmp     ah,1                    ; button id=1 ?
189
    jne     noclose
7402 theonlymir 190
exit:
7389 theonlymir 191
    mov     eax,-1                  ; Function -1 : close this program
192
    mcall
193
noclose:
194
    cmp  ah, 2         ; ""
7436 theonlymir 195
    jne  @f ;butend
7776 leency 196
    call applyButton   ;    
7436 theonlymir 197
    jmp event_wait
198
@@:
199
    cmp ah, 4
200
    jne @f
201
    mov byte[editID], 4
202
    call but_open_dlg
203
    jmp  event_wait
204
@@:
205
    cmp ah, 5
206
    jne @f
207
    mov byte[editID], 5
208
    call but_open_dlg
209
    jmp  event_wait
210
@@:
211
    cmp ah, 6
212
    jne @f
213
    mov byte[editID], 6
214
    call but_open_dlg
215
    jmp  event_wait
216
@@:
217
    cmp ah, 7
218
    jne @f
219
    mov byte[editID], 7
220
    call but_open_dlg
221
    jmp  event_wait
222
@@:
7443 theonlymir 223
    cmp ah, 8
224
    jne @f
225
    push eax ebx ecx
226
    mcall 9, pi, -1 ;get window coord
227
 
7459 theonlymir 228
    mov eax, dword[pi+34]
7776 leency 229
    add eax, buttonModeX ;+ 5
7459 theonlymir 230
    mov word[coordModeMenu.x], ax
7443 theonlymir 231
 
7459 theonlymir 232
    mov eax, dword[pi+38]
7777 theonlymir 233
    add eax, buttonModeY + 20 ;20 -    
7459 theonlymir 234
    mov word[coordModeMenu.y], ax
7443 theonlymir 235
 
7459 theonlymir 236
    stdcall [ksubmenu_draw], [modeMenu], coordModeMenu
7443 theonlymir 237
    pop ecx ebx eax
238
    jmp  event_wait
239
@@:
7459 theonlymir 240
    cmp ah, 9
241
    jne @f
242
    mov word[hkSymbol], 0
243
    jmp red ;event_wait
244
@@:
7443 theonlymir 245
    cmp ah, 110
246
    jne @f
247
    mov byte[mode], 48 ;'0'
248
    jmp  event_wait
249
@@:
250
    cmp ah, 111
251
    jne @f
252
    mov byte[mode], 49 ;'1'
253
    jmp  event_wait
254
@@:
255
    cmp ah, 112
256
    jne @f
257
    mov byte[mode], 50 ;'2'
258
    jmp  event_wait
259
@@:
260
    cmp ah, 113
261
    jne @f
262
    mov byte[mode], 51 ;'3'
263
    jmp  event_wait
264
@@:
7389 theonlymir 265
butend:
266
    jmp  event_wait    ;this is for ignored events, useful at development
267
 
268
 
269
 
7776 leency 270
;  
7389 theonlymir 271
fileName: db 'SETTINGS/HOTANGLES.CFG', 0
272
 
7776 leency 273
;  / 
7389 theonlymir 274
createFile:
275
  .func     dd 2    ; 
276
  .re       dd 0, 0 ;
277
  .size     dd 0    ;  
278
  .data_adr dd 0    ;  
279
  .path     db 0
280
  .path_adr dd fileName    ;
281
 
7776 leency 282
;      
7459 theonlymir 283
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,'Space',13,10,'57',13,10,'10',13,10,'s',13,10
284
defaultDataSize = 85 ;48+19+4
7389 theonlymir 285
 
286
 
287
copyParam:  ; ( )   (. )
288
   push esi ebx ecx
289
   mov ecx, dword[ebx] ;  
7412 theonlymir 290
 
291
   cmp ecx, 0          ;  ?
292
   jne copyParam.copy  ; ,       (  )
293
 
7776 leency 294
   mov byte[eax], '-'  ;  ,     '-'
7412 theonlymir 295
   inc eax
296
   ;jmp copyParam.copyEnd ; 
7776 leency 297
   ;       
7412 theonlymir 298
 
7389 theonlymir 299
.copy:  ; 
300
   cmp ecx, 0
301
   je copyParam.copyEnd
302
   mov bl, byte[esi]
303
   mov byte[eax], bl
304
   dec ecx
305
   inc eax
306
   inc esi
307
   jmp copyParam.copy
308
.copyEnd:
309
   pop ecx ebx esi
310
   ret
311
 
312
 
7776 leency 313
addPerenos:  ;    
7389 theonlymir 314
   mov byte[eax], 13
315
   inc eax
316
   mov byte[eax], 10
317
   inc eax
318
   ret
319
 
320
;  ""
321
applyButton:
322
    push eax ebx ecx
323
        ;mov dword[createFile.data_adr], defaultDataForConfig
324
        ;mov dword[createFile.size], defaultDataSize
325
 
326
        ;     
7776 leency 327
        mov ecx, 9*2+1 ;1      9    ( 13, 10)
7408 theonlymir 328
        add ecx, dword[editLU.size] ;     
329
        add ecx, dword[editLD.size]
330
        add ecx, dword[editRU.size]
7389 theonlymir 331
        add ecx, dword[editRD.size] ;dataBuffer.size4]
7459 theonlymir 332
        add ecx, dword[editRadius.size]
333
        add ecx, dword[hkSize] ;   
334
        add ecx, dword[keystr.size] ;   
7776 leency 335
        inc ecx ;  1     
7412 theonlymir 336
 
7776 leency 337
        ;cmp dword[keystr.size], 3
338
        ;jbe @f
339
        ;mcall -1
340
      ;@@:
341
 
342
        ;   ,      ,   +1 
7412 theonlymir 343
        cmp dword[editLU.size], 0
344
        jne @f
345
        inc ecx
346
@@:
347
        cmp dword[editLD.size], 0
348
        jne @f
349
        inc ecx
350
@@:
351
        cmp dword[editRU.size], 0
352
        jne @f
353
        inc ecx
354
@@:
355
        cmp dword[editRD.size], 0
356
        jne @f
357
        inc ecx
358
@@:
359
 
7389 theonlymir 360
        ;     ecx
7776 leency 361
        mov dword[createFile.size], ecx ;     / 
362
        mcall 68, 12, ecx ;     
363
        mov dword[createFile.data_adr], eax ;    
7389 theonlymir 364
 
365
        ;  :
7776 leency 366
        push ebx    ;  
7443 theonlymir 367
        mov bl, byte[mode]
368
        mov byte[eax], bl
369
        pop ebx
370
 
7389 theonlymir 371
        inc eax
372
        call addPerenos
373
 
374
        push esi ebx
375
        call UpdateEditsSizes ;    edit'
376
 
7776 leency 377
        mov esi, dataBuffer.1     ;editLU.text
378
        mov ebx, dataBuffer.size1 ;editLU.size
7389 theonlymir 379
        call copyParam
7776 leency 380
        call addPerenos     ;  
7389 theonlymir 381
 
7408 theonlymir 382
        mov esi, dataBuffer.2
383
        mov ebx, dataBuffer.size2
7389 theonlymir 384
        call copyParam
7776 leency 385
        call addPerenos     ;  
7389 theonlymir 386
 
387
        mov esi, dataBuffer.3
388
        mov ebx, dataBuffer.size3
389
        call copyParam
7776 leency 390
        call addPerenos     ;  
7389 theonlymir 391
 
392
        mov esi, dataBuffer.4
393
        mov ebx, dataBuffer.size4
394
        call copyParam
7776 leency 395
        call addPerenos     ;  
7389 theonlymir 396
 
7776 leency 397
        ;  
7459 theonlymir 398
        call saveKey
399
        call addPerenos
400
 
7776 leency 401
        ;  
7459 theonlymir 402
        mov esi, keystr.data    ;  keystr  
403
        xor ebx, ebx
404
      @@:
405
        cmp byte[esi], 0
406
        je @f
407
        mov bl, byte[esi]
408
        mov byte[eax], bl
409
        inc eax
410
        inc esi
411
        cmp esi, keystr.size-1
412
        jae @f
413
        jmp @b
414
      @@:
415
        call addPerenos
416
 
7776 leency 417
        ; 
418
        ;!!!    ,       (  '-')
7459 theonlymir 419
        mov esi, radiusBuffer.data
420
        mov ebx, editRadius.size ;radiusBuffer.size
421
        call copyParam
422
        call addPerenos
423
 
7776 leency 424
        ;  
425
        push ebx    ;  
7459 theonlymir 426
        mov bl, byte[sizeStyle]
427
        mov byte[eax], bl
428
        pop ebx
429
        inc eax
430
        call addPerenos
431
 
7389 theonlymir 432
        pop ebx esi
433
 
434
 
435
    mov ebx, createFile
436
    mcall 70
437
        cmp eax, 0
438
        je .end
439
        ;       !!!
440
.end:
7776 leency 441
        mcall 68, 13, dword[createFile.data_adr]  ;   
7412 theonlymir 442
        call finishHotAnglesApp ;     @HOTANGLES
443
        call loadConfig         ;  
444
        call draw_window        ; 
445
        call startHotAnglesApp  ; @HOTANGLES
7389 theonlymir 446
        pop ecx ebx eax
447
    ret
448
 
449
 
450
 
451
 
452
 
453
 
454
compareBytes2:
455
   push edi esi ecx ebx
456
   xor eax, eax
457
   mov ecx, 10  ;max   11
458
@@:
459
   mov bl, byte[edi]
460
   cmp bl, byte[esi]
461
   jne compareBytes.no
462
   inc edi
463
   inc esi
464
   cmp ecx, 0
465
   je @f
466
   dec ecx
467
   jmp @b
468
.no:
469
   mov eax, 1
470
@@:
471
   pop ebx ecx esi edi
472
   ret
473
 
474
 
7412 theonlymir 475
finishHotAnglesApp:
7776 leency 476
   ;        
7389 theonlymir 477
   push eax ebx ecx esi edi
7776 leency 478
   ;,    :
479
   mov esi, startAppData.file_name       ;  -   
480
   mov edi, buf            ;  -   
7389 theonlymir 481
   add edi, 10
482
 
483
   mov ecx, 1
484
@@:
485
   mcall 9, buf, ecx              ;   
486
   mov dword[slotMax], eax
487
 
7776 leency 488
   call compareBytes2 ; 
7389 theonlymir 489
   cmp eax, 0
7412 theonlymir 490
   jne finishHotAnglesApp.next   ;  ,     
7389 theonlymir 491
 
492
   mcall 18, 2, ecx               ;  
493
.next:
494
   inc  ecx
495
   cmp ecx, dword[slotMax]
496
   ja @f
497
   jmp @b
498
@@:
499
   pop edi esi ecx ebx eax
7412 theonlymir 500
   ret
7389 theonlymir 501
 
7412 theonlymir 502
startHotAnglesApp:
7389 theonlymir 503
   ;  
504
   push eax ebx
505
   mcall 70, startAppData
506
   cmp eax, 0
507
   ja @f       ; eax>0,   
508
   ;!!!    
509
@@:
510
   pop ebx eax
511
   ret
512
 
513
startAppData:
514
    .subfunction dd   7
515
    .flags       dd   0
516
    .param       dd   0
517
    .rezerv      dd   0, 0
518
    .full_name   db   '/rd/1/'
519
    .file_name   db   '@HOTANGLES', 0
520
 
521
UpdateEditsSizes:
522
   push eax
523
   mov eax, dword[editLU.size]
524
   mov dword[dataBuffer.size1], eax
525
 
526
   mov eax, dword[editLD.size]
527
   mov dword[dataBuffer.size2], eax
528
 
529
   mov eax, dword[editRU.size]
530
   mov dword[dataBuffer.size3], eax
531
 
532
   mov eax, dword[editRD.size]
533
   mov dword[dataBuffer.size4], eax
534
 
7459 theonlymir 535
   mov eax, dword[editRadius.size]
536
   mov dword[radiusBuffer.size], eax
537
 
7389 theonlymir 538
   pop eax
539
   ret
540
 
541
fileAdr dd 0
542
 
543
loadConfig:
544
   push eax ebx ecx edx
545
   mcall 68, 27, fileName   ;    
7776 leency 546
   mov dword[fileAdr], eax  ;    
7389 theonlymir 547
   cmp eax, 0
548
   je loadConfig.default       ;   ,     
549
   ;    ,   edx
7776 leency 550
   cmp edx, 0               ;  ,    ,     
7389 theonlymir 551
   je loadConfig.default
552
.start:
7776 leency 553
   add edx, eax             ;  edx -   .
7389 theonlymir 554
 
555
.chStart:
7443 theonlymir 556
 
557
   push ebx
558
   mov bl, byte[eax]
7776 leency 559
   cmp bl, 48          ;      ,    'n' ( )
7443 theonlymir 560
   jb loadConfig.checkN
561
   cmp bl, 51
562
   ja loadConfig.checkN
563
 
564
   mov byte[mode], bl  ;     
7776 leency 565
   jmp loadConfig.modeEnd   ;  
7443 theonlymir 566
.checkN:
567
   cmp bl, 'n'             ; n -   ""
568
   jne @f
569
   mov byte[mode], 48 ;'0'
570
   jmp loadConfig.modeEnd
7436 theonlymir 571
@@:
7459 theonlymir 572
   cmp bl, 'y'             ; y -   
573
   jne @f
574
   mov byte[mode], 49 ;'1'
575
   jmp loadConfig.modeEnd
576
@@:
577
   mov byte[mode], 48 ;'0'    
7776 leency 578
   ;mov byte[mode], 49 ;'1'       
7443 theonlymir 579
.modeEnd:
580
   pop ebx
7776 leency 581
   ;jmp loadConfig.end   ;      
7389 theonlymir 582
 
583
   ;    
584
   push edi esi ecx ebx eax
7776 leency 585
   ;        
7408 theonlymir 586
   mov edi, dataBuffer.1
587
   mov esi, dataBuffer.size1
7776 leency 588
   ;ecx -    
7389 theonlymir 589
.block:
7776 leency 590
   xor ecx, ecx ; 
7389 theonlymir 591
   inc eax
592
   cmp byte[eax], 10         ;    10  13,   
7408 theonlymir 593
   je loadConfig.block       ;    
7389 theonlymir 594
   cmp byte[eax], 13
7408 theonlymir 595
   je loadConfig.block
7389 theonlymir 596
 
597
   ;         -     
598
   mov bl, byte[eax]
599
   mov byte[edi], bl
600
   inc edi
601
   inc eax
7776 leency 602
   inc ecx ;    
7389 theonlymir 603
 
7776 leency 604
   ;    :     10, 13, 0  file end
605
.while:     ;    
606
   cmp eax, edx           ;   ,      !!!
7389 theonlymir 607
   ja loadConfig.ura
608
   cmp byte[eax], 10
609
   je loadConfig.ura
610
   cmp byte[eax], 0
611
   je loadConfig.ura
612
   cmp byte[eax], 13
613
   je loadConfig.ura
614
 
615
   mov bl, byte[eax]
616
   mov byte[edi], bl
617
   inc edi
618
   inc eax
619
   inc ecx
620
   cmp ecx, 511
621
   jae loadConfig.ura
622
   jmp loadConfig.while
623
.ura:
7776 leency 624
   mov byte[edi], 0      ;  0  
625
   mov dword[esi], ecx   ;  
7389 theonlymir 626
   add esi, 4            ;    
627
   sub edi, ecx          ;   
628
   add edi, 512
7776 leency 629
   ;xor ecx, ecx          ;  
7389 theonlymir 630
 
631
   cmp edi, dataBuffer.size1 ;     (      ),  
632
   jb loadConfig.block
633
 
7459 theonlymir 634
   call readOptKey        ; 
635
   call gotoEndString
636
 
637
   ;  
638
   call readScanKey
639
   call gotoEndString
640
 
7776 leency 641
   call readOptRadius     ;    mode 3
7459 theonlymir 642
   call gotoEndString
643
   call readOptSize       ;  
644
   call gotoEndString
645
 
7389 theonlymir 646
   pop eax ebx ecx esi edi
647
 
648
   jmp loadConfig.end
649
.default:
650
   mov eax, defaultDataForConfig
651
   mov edx, defaultDataSize
652
   jmp loadConfig.start
653
.end:
654
   mov ecx, dword[fileAdr]    ;   , 
655
   cmp ecx, 0
656
   je @f
7776 leency 657
   mcall 68, 13, ecx  ;   
7389 theonlymir 658
@@:
7776 leency 659
   call updateParams ;   
660
   call setMySize    ;   
7389 theonlymir 661
   pop edx ecx ebx eax
662
   ret
663
 
664
 
7459 theonlymir 665
setMySize:
666
   push eax
7776 leency 667
   ; mysize     sizeStyle
7459 theonlymir 668
   cmp byte[sizeStyle], '0'
669
   jb @f
670
   cmp byte[sizeStyle], '7'
671
   ja @f
7776 leency 672
   mov eax, 0                  ;   ,    
7459 theonlymir 673
   mov al, byte[sizeStyle]
674
   sub al, '0'
675
   jmp .end
676
@@:
677
   cmp byte[sizeStyle], 'a'
678
   je .auto
7776 leency 679
   ;cmp byte[sizeStyle], 's'
680
   ;je .system
681
.system:     ;   : s - 
682
;   push ebx ecx
683
   ;!!!
684
;   mov eax, 9
685
;   mcall 48, 11   ;   
686
   ;eax -    
687
;   mov ecx, eax
688
;   push eax
689
;   mcall 48, 12, ecx  ;  
690
;   pop eax
691
;   pop ecx ebx
692
   ;temp fix -       and -1
693
;   push ebx edx
694
;   mov ebx, 9
695
   ;div ebx
696
;   pop edx ebx
697
   ;cmp eax, 0
698
   ;je .end
699
   ;dec eax
700
   mov eax, 0 ;xor eax, eax ;test temp
7459 theonlymir 701
   jmp .end
7776 leency 702
.auto:       ;a -      
703
   ;!!!
7459 theonlymir 704
   mcall 14
705
   push ebx
706
   xor ebx, ebx
707
   mov bx, ax
708
   shr eax, 16
709
   cmp ax, bx       ;   
710
   jae .a
711
   mov ax, bx
712
.a:
713
   pop ebx
7776 leency 714
   cmp ax, 1919     ;    0   1 
7459 theonlymir 715
   jb .size0
716
   cmp ax, 2047
717
   jb .size1
718
   cmp ax, 4095
719
   jb .size2
720
   cmp ax, 8191
721
   jb .size3
722
 
7776 leency 723
   jmp .size4
7459 theonlymir 724
 
725
.size0:
726
   mov eax, 0
727
   jmp .end
728
.size1:
729
   mov eax, 1
730
   jmp .end
731
.size2:
732
   mov eax, 2
733
   jmp .end
734
.size3:
735
   mov eax, 3
736
   jmp .end
737
.size4:
738
   mov eax, 4
739
   jmp .end
740
.size5:
741
   mov eax, 5
742
   jmp .end
743
.size6:
744
   mov eax, 6
745
   jmp .end
746
.size7:
747
   mov eax, 7
748
   jmp .end
749
 
750
;.default:
751
;   mov eax, 1
752
.end:
753
   mov byte[mysize], al ;mov dword[mysize], eax
754
   pop eax
755
   ret
756
 
757
 
758
readScanKey:
759
   ;    
7776 leency 760
   cmp eax, edx  ;  , 
7459 theonlymir 761
   ja .default   ;  
762
   cmp byte[eax], 10
763
   je @f
764
   cmp byte[eax], 0
765
   je @f
766
   cmp byte[eax], 13
767
   je @f
768
 
769
   push ecx ebx esi
770
   mov ecx, 0 ;xor ecx, ecx
771
   mov esi, keystr.data
772
.copy:
773
   mov bl, byte[eax]
774
   cmp bl, 0
775
   je .copyEnd
776
   cmp bl, 10
777
   je .copyEnd
778
   cmp bl, 13
779
   je .copyEnd
780
   cmp esi, keystr.size-1
781
   jae .copyEnd
782
   mov byte[esi], bl
783
   inc esi
784
   inc eax
785
   inc ecx
786
   jmp .copy
787
.copyEnd:
788
   mov byte[esi], 0
789
   mov dword[keystr.size], ecx
790
   pop esi ebx ecx
791
 
792
   jmp .end
793
@@:
794
   inc eax
795
   jmp readScanKey
796
.default:
797
   mov byte[keyscan], 57
798
   mov word[keystr.data], '57'
799
   mov byte[keystr.data+2], 0
800
   mov dword[keystr.size], 2
801
.end:
802
   ret
803
 
804
readOptKey:  ;1;3;4;5 - space or shift
805
   ;    
7776 leency 806
   cmp eax, edx  ;  , 
7459 theonlymir 807
   ja .default   ;  
808
   cmp byte[eax], 10
809
   je @f
810
   cmp byte[eax], 0
811
   je @f
812
   cmp byte[eax], 13
813
   je @f
814
   ;    
815
   cmp dword[eax], 'Ctrl'
816
   jne .notCtrl
817
   mov byte[hkSymbol], 3
818
   mov dword[hkSize], 4
819
   jmp .end
820
.notCtrl:
821
   cmp dword[eax], 'Shif'
822
   jne .notShift
823
   mov byte[hkSymbol], 2
824
   mov dword[hkSize], 5
825
   jmp .end
826
.notShift:
827
   cmp dword[eax], 'Spac'
828
   jne .notSpace
829
   mov byte[hkSymbol], 32
830
   mov dword[hkSize], 5
831
   jmp .end
832
.notSpace:
833
   cmp word[eax], 'Al'
834
   jne .notAlt
835
   mov byte[hkSymbol], 1
836
   mov dword[hkSize], 3
837
   jmp .end
838
.notAlt:
7776 leency 839
   ;,   1 ,   
7459 theonlymir 840
   cmp byte[eax+1], 10
841
   je .oneSymb
842
   cmp byte[eax+1], 0
843
   je .oneSymb
844
   cmp byte[eax+1], 13
845
   je .oneSymb
846
   jmp .default
847
.oneSymb:
7776 leency 848
   ;,     !!!
7459 theonlymir 849
 
7776 leency 850
   ;   
7459 theonlymir 851
   push ebx
852
   ;xor ebx, ebx
853
   mov bl, byte[eax]
854
   mov byte[hkSymbol], bl
855
   mov dword[hkSize], 1
856
   pop ebx
857
 
858
   jmp .end
859
@@:
860
   inc eax
861
   jmp readOptKey
862
 
863
.default:
864
   mov byte[hkSymbol], 32
865
   mov dword[hkSize], 5
866
.end:
867
   mov byte[hkSymbol+1], 0
868
   ret
869
 
870
;    
871
gotoEndString:
7776 leency 872
   cmp eax, edx  ;  , 
7459 theonlymir 873
   ja @f         ;
874
   cmp byte[eax], 10
875
   je @f
876
   cmp byte[eax], 0
877
   je @f
878
   cmp byte[eax], 13
879
   je @f
880
   ;    
881
   inc eax
882
   jmp gotoEndString
883
@@:
884
   ret
885
 
886
readOptRadius:
887
   ;    
7776 leency 888
   cmp eax, edx  ;  , 
7459 theonlymir 889
   ja .default   ;  
890
   cmp byte[eax], 10
891
   je @f
892
   cmp byte[eax], 0
893
   je @f
894
   cmp byte[eax], 13
895
   je @f
896
 
897
   ;  
898
   push ebx ecx
899
   xor ecx, ecx
900
.readValue:
901
   mov bl, byte[eax]
902
   mov byte[radiusBuffer.data+ecx], bl
903
   inc ecx
904
   inc eax
7776 leency 905
   cmp eax, edx  ;  ,  
7459 theonlymir 906
   ja .readEnd
907
   cmp byte[eax], 10
908
   je .readEnd
909
   cmp byte[eax], 0
910
   je .readEnd
911
   cmp byte[eax], 13
912
   je .readEnd
913
   cmp ecx, 6
914
   jae .readEnd
915
   jmp .readValue
916
.readEnd:
917
   mov byte[radiusBuffer.data+ecx], 0
918
   mov dword[radiusBuffer.size], ecx
919
   pop ecx ebx
920
 
921
   jmp .end
922
@@:
923
   inc eax
924
   jmp readOptRadius
925
.default:
926
   mov byte[radiusBuffer.data], '0'
927
   mov byte[radiusBuffer.data+1], 0
928
   mov dword[radiusBuffer.size], 1
929
.end:
930
 
931
   ret
932
 
933
 
934
readOptSize:
935
   ;    
7776 leency 936
   cmp eax, edx  ;  , 
7459 theonlymir 937
   ja .default   ;  
938
   cmp byte[eax], 10
939
   je @f
940
   cmp byte[eax], 0
941
   je @f
942
   cmp byte[eax], 13
943
   je @f
944
 
7776 leency 945
   ;,    : 1-7, a, s
7459 theonlymir 946
   cmp byte[eax], 'a'
947
   je .setValue
948
   cmp byte[eax], 's'
949
   je .setValue
950
   cmp byte[eax], '0'
951
   je .setValue
952
   cmp byte[eax], '1'
953
   je .setValue
954
   cmp byte[eax], '2'
955
   je .setValue
956
   cmp byte[eax], '3'
957
   je .setValue
958
   cmp byte[eax], '4'
959
   je .setValue
960
   cmp byte[eax], '5'
961
   je .setValue
962
   cmp byte[eax], '6'
963
   je .setValue
964
   cmp byte[eax], '7'
965
   je .setValue
966
 
967
   jmp .default    ;    
968
 
969
.setValue:
970
   push ebx
971
   mov bl, byte[eax]
972
   mov byte[sizeStyle], bl
973
   pop ebx
974
 
975
   jmp .end
976
@@:
977
   inc eax
978
   jmp readOptSize
979
.default:
980
   mov byte[sizeStyle], 's'   ;
981
.end:
982
   ret
983
 
984
 
985
 
986
 
7389 theonlymir 987
updateParams: ;max, size, pos
988
   push eax
989
   mov eax, dword[dataBuffer.size1]
990
   mov dword[editLU.size], eax
991
   mov dword[editLU.pos], eax
992
 
993
   mov eax, dword[dataBuffer.size2]
994
   mov dword[editLD.size], eax
995
   mov dword[editLD.pos], eax
996
 
997
   mov eax, dword[dataBuffer.size3]
998
   mov dword[editRU.size], eax
999
   mov dword[editRU.pos], eax
1000
 
1001
   mov eax, dword[dataBuffer.size4]
1002
   mov dword[editRD.size], eax
1003
   mov dword[editRD.pos], eax
7459 theonlymir 1004
 
1005
   mov eax, dword[radiusBuffer.size]
1006
   mov dword[editRadius.size], eax
1007
   mov dword[editRadius.pos], eax
7389 theonlymir 1008
   pop eax
1009
   ret
1010
 
1011
 
1012
 
7408 theonlymir 1013
selfName db 'HACONFIG', 0
1014
selfNameSize = 8 ; 11 byte
7389 theonlymir 1015
;
1016
compareBytes:
1017
   push edi esi ecx ebx
1018
   mov eax, 0 ;xor eax, eax
7408 theonlymir 1019
   mov ecx, selfNameSize    ;max   11
7389 theonlymir 1020
@@:
1021
   mov bl, byte[edi]
1022
   cmp bl, byte[esi]
1023
   jne compareBytes.no
1024
   inc edi
1025
   inc esi
1026
   cmp ecx, 0
1027
   je @f
1028
   dec ecx
1029
   jmp @b
1030
.no:
1031
   mov eax, 1
1032
@@:
1033
   pop ebx ecx esi edi
1034
   ret
1035
;
1036
slotMax dd 0
1037
selfPID dd 0
1038
buf db 1024 dup(0)
1039
copyKill:
1040
   push eax ebx ecx esi edi
1041
 
7776 leency 1042
   ;   
7389 theonlymir 1043
   mcall 9, buf, -1
1044
   mov eax, dword[buf+30]
1045
   mov dword[selfPID], eax
1046
 
7776 leency 1047
   ;,    :
1048
   mov esi, selfName       ;  -   
1049
   mov edi, buf            ;  -   
7389 theonlymir 1050
   add edi, 10
1051
 
1052
   mov ecx, 1
1053
@@:
1054
   mcall 9, buf, ecx
1055
   mov dword[slotMax], eax
1056
 
1057
   ;   ,   
1058
   mov eax, dword[buf+30]
1059
   cmp eax, dword[selfPID]
1060
   je copyKill.propusk
1061
 
1062
   call compareBytes   ; 11  ,   eax
1063
 
1064
   cmp eax, 0
1065
   je copyKill.selfKill
1066
 
1067
.propusk:
1068
   inc ecx
1069
   cmp ecx, dword[slotMax]
1070
   ja @f
1071
   jmp @b
1072
 
1073
.selfKill:
1074
   pop edi esi ecx ebx eax
1075
   mcall -1
1076
   ret
1077
@@:
1078
   pop edi esi ecx ebx eax
1079
   ret
1080
 
7776 leency 1081
 WindowsWidth  = 550
1082
 WindowsHeight = 235
1083
coord:      ;  
7389 theonlymir 1084
 .y dw 0
1085
 .x dw 0
1086
 
1087
draw_window:
7777 theonlymir 1088
                mcall   12, 1  ; Start window redraw
7389 theonlymir 1089
 
7776 leency 1090
        ;      :
7389 theonlymir 1091
        mcall 14 ;  
1092
        mov dword[coord], eax       ;    
1093
        shr word[coord.x], 1        ;   
1094
        shr word[coord.y], 1
1095
 
7776 leency 1096
        ;  ,      
1097
        sub word[coord.x], WindowsWidth/2
1098
        sub word[coord.y], WindowsHeight/2
7389 theonlymir 1099
 
1100
        mov     eax, 0                  ; function 0 : define and draw window
7408 theonlymir 1101
        mov     ebx, 0                  ; [x start] *65536 + [x size]
7389 theonlymir 1102
        mov bx, word[coord.x]
1103
        shl  ebx, 16
7776 leency 1104
        mov bx, WindowsWidth
7389 theonlymir 1105
 
1106
        mov ecx, 0
7408 theonlymir 1107
        mov     cx, word[coord.y]       ; [y start] *65536 + [y size]
7389 theonlymir 1108
        shl ecx, 16
7776 leency 1109
        mov cx, WindowsHeight
7389 theonlymir 1110
 
1111
        mov     edx, 0x14ffffff         ; color of work area RRGGBB
1112
                                        ; 0x02000000 = window type 4 (fixed size, skinned window)
1113
        mov     esi, 0x808899ff         ; color of grab bar  RRGGBB
1114
                                        ; 0x80000000 = color glide
1115
        mov     edi, title
1116
        mcall
1117
 
7402 theonlymir 1118
        invoke  edit_box_draw, editLU  ; edit box'
1119
        invoke  edit_box_draw, editLD
1120
        invoke  edit_box_draw, editRU
1121
        invoke  edit_box_draw, editRD
7389 theonlymir 1122
 
7776 leency 1123
        ;    
1124
        buttonAppleY = WindowsHeight-40
1125
        mcall 8, , , 2, 0x00AABBCC
1126
        mcall 4, , 0x10FFFFFF, buttonText, buttonTextSize
7469 theonlymir 1127
 
7776 leency 1128
        ;  4      
7436 theonlymir 1129
        ; 4,5,6  7
1130
        buttonW = 30
7776 leency 1131
        buttonH = 21
7436 theonlymir 1132
        ;  
7776 leency 1133
        mcall 8, , <85,buttonH>, 4, 0x00AABBCC
7436 theonlymir 1134
        ;  
7776 leency 1135
        mcall 8, , <120,buttonH>, 5
7436 theonlymir 1136
        ;  
7776 leency 1137
        mcall 8, , <85,buttonH>, 6
7436 theonlymir 1138
        ;  
7776 leency 1139
        mcall 8, , <120,buttonH>, 7
7469 theonlymir 1140
 
7776 leency 1141
        ;    4 
7436 theonlymir 1142
        mov     ecx, 0xFFFFFF              ;  
1143
        mov     edx, commonButtonText      ; 
1144
        mov     esi, commonButtonTextSize  ;   
1145
        ;  (x, y)
1146
        deltaCommonTextX = 7
7776 leency 1147
        deltaCommonTextY = 6
1148
        mcall 4, 
1149
        mcall 4, 
1150
        mcall 4, 
1151
        mcall 4, 
7469 theonlymir 1152
 
7443 theonlymir 1153
        ;delete mode button, if it exist
1154
        mov edx, 0x80000008
1155
        mcall 8
1156
        ;draw button Mode
7776 leency 1157
        buttonModeX = 30 ;433
1158
        buttonModeY = 160 ;50
1159
        buttonModeWidth = 300
1160
        buttonModeHeight = 20
7469 theonlymir 1161
        buttonModeTextYoffset = 3
7443 theonlymir 1162
        buttonModeTextXoffset = 5
7776 leency 1163
        mcall 8, , , 8, 0x00FFFFFF
1164
        mcall 13, , , 0xAABBCC
7443 theonlymir 1165
        ;draw text for button Mode
7776 leency 1166
        mov     ebx, (buttonModeX+buttonModeTextXoffset) * 65536 + (buttonModeY+buttonModeTextYoffset)    ;(x, y)
1167
        mov     ecx, 0x10000000
7443 theonlymir 1168
        call setTextModeMenu
7776 leency 1169
        mov     esi, valueModeMenuSize
7443 theonlymir 1170
        mcall 4
7776 leency 1171
        mov     ebx, (buttonModeX+buttonModeWidth-12) * 65536 + (buttonModeY+buttonModeTextYoffset+3)
1172
        mov     ecx, 0x80FFFFFF
7448 theonlymir 1173
        mov     edx, symbolDownArrow
1174
        mcall 4
7443 theonlymir 1175
 
7776 leency 1176
        ;   
1177
        buttonHotKeyX = 350-10
7459 theonlymir 1178
        buttonHotKeyWidth = 90
7776 leency 1179
        mov edx, 0x80000009    ;
7459 theonlymir 1180
        mcall 8
1181
    cmp byte[mode], 49    ;  ,   mode > 1
1182
    jbe @f
1183
        ; 
1184
        push eax ebx ecx edx esi
7776 leency 1185
        mov ebx, buttonHotKeyX*65536 + buttonHotKeyWidth  ;X + Width
1186
        mov ecx, buttonModeY*65536 + buttonModeHeight ;Y + Height
7459 theonlymir 1187
        mov edx, 0x00000009    ;button id
1188
        mov esi, 0x00FFFFFF    ;color button
1189
        mcall 8
1190
        pop esi edx ecx ebx eax
7776 leency 1191
        ;    
1192
        mov     ebx, (buttonHotKeyX+buttonModeTextXoffset) * 65536 + (buttonModeY+buttonModeTextYoffset)    ;(x, y)
1193
        mov     ecx, 0x90224466
7459 theonlymir 1194
        call setTextForHotKey
1195
        mov     esi, valueModeMenuSize
1196
        mcall 4
1197
        ;
1198
        push eax ebx ecx edx edi esi
7776 leency 1199
        mov     ebx, buttonHotKeyX * 65536 + (buttonModeY-11)
1200
        mov ecx, 0x80224466
7459 theonlymir 1201
        mov     edx, hkCaption
1202
        mov     esi, 3
1203
        mcall 4
1204
        pop esi edi edx ecx ebx eax
1205
    @@:
1206
 
7776 leency 1207
    ;    ,     3
7459 theonlymir 1208
    cmp byte[mode], 51
1209
    jne @f
1210
        ;
1211
        push eax ebx ecx edx edi esi
7776 leency 1212
        mov     ebx, (buttonHotKeyX + buttonHotKeyWidth + 20) * 65536 + (buttonModeY-11)
1213
        mov ecx, 0x80224466
7459 theonlymir 1214
        mov     edx, radiusCaption
1215
        mov     esi, 3
1216
        mcall 4
1217
        pop esi edi edx ecx ebx eax
1218
        invoke  edit_box_draw, editRadius
1219
    @@:
1220
 
7389 theonlymir 1221
        call draw_super_text
1222
 
7408 theonlymir 1223
        LineLength = 62
7776 leency 1224
        mov     ebx, Otstup * 65536 + 32    ; draw info text with function 4 (x, y)
7459 theonlymir 1225
 
7776 leency 1226
        ;xor ecx, ecx
1227
        ;mov cl, 1 ;byte[mysize]
1228
        ;shl ecx, 24
1229
        ;add ecx, 0x224466
1230
        ;or ecx, 0x00224466  ;80224466
1231
        mov     ecx, 0x10224466
7459 theonlymir 1232
 
7389 theonlymir 1233
        mov     edx, text
1234
        mov     esi, LineLength
1235
        mov     eax, 4
1236
 
1237
  .newline:                             ; text from the DATA AREA
1238
        mcall
7776 leency 1239
        add     ebx, 15
7389 theonlymir 1240
        add     edx, LineLength
1241
        cmp     byte[edx], 0
1242
        jne     .newline
1243
 
7776 leency 1244
        mcall   12, 2  ; End window redraw
7389 theonlymir 1245
 
1246
        ret
1247
 
7459 theonlymir 1248
hkSymbol: db 0, 0
7389 theonlymir 1249
 
7459 theonlymir 1250
setTextForHotKey:
1251
   push eax
1252
   mov al, byte[hkSymbol]
1253
   cmp al, 0
1254
   jne @f
1255
      mov edx, hkHint
1256
      mov dword[hkSize], 5 ;   SPACE ;shift
1257
      jmp setTextForHotKey.end
1258
@@:
1259
   cmp al, 1
1260
   jne @f
1261
      mov edx, hkAlt
1262
      mov dword[hkSize], 3
1263
      jmp setTextForHotKey.end
1264
@@:
1265
   cmp al, 2
1266
   jne @f
1267
      mov edx, hkShift
1268
      mov dword[hkSize], 5
1269
      jmp setTextForHotKey.end
1270
@@:
1271
   cmp al, 3
1272
   jne @f
1273
      mov edx, hkCtrl
1274
      mov dword[hkSize], 4
1275
      jmp setTextForHotKey.end
1276
@@:
1277
   cmp al, 32
1278
   jne @f
1279
      mov edx, hkSpace
1280
      mov dword[hkSize], 5
1281
      jmp setTextForHotKey.end
1282
@@:
1283
   cmp al, 96  ;'`'
1284
   je  setTextForHotKey.symb
1285
   cmp al, 126 ;'~'
1286
   je  setTextForHotKey.symb
1287
   cmp al, 48 ;'0'
1288
   jb @f
1289
   cmp al, 57 ;'9'
1290
   ja @f
1291
.symb:
1292
      mov edx, hkSymbol
1293
      mov dword[hkSize], 1
1294
      jmp setTextForHotKey.end
1295
@@:
1296
   cmp al, 97  ;'a'
1297
   jb @f
1298
   cmp al, 122 ;'z'
1299
   ja @f
1300
      ;jmp setTextForHotKey.symb
1301
      mov edx, hkSymbol
1302
      mov dword[hkSize], 1
1303
      jmp setTextForHotKey.end
1304
@@:
1305
   cmp al, 65  ;'A'
1306
   jb @f
1307
   cmp al, 90 ;'Z'
1308
   ja @f
1309
      ;jmp setTextForHotKey.symb
1310
      mov edx, hkSymbol
1311
      mov dword[hkSize], 1
1312
      jmp setTextForHotKey.end
1313
@@:
7776 leency 1314
   mov word[hkSymbol], 0     ;   - ,   
7459 theonlymir 1315
   mov edx, hkHint
1316
   mov dword[hkSize], 5 ;shift or space -    
1317
.end:
1318
   pop eax
1319
   ret
1320
 
1321
 
7443 theonlymir 1322
setTextModeMenu:
1323
   cmp byte[mode], 48
1324
   jne @f
1325
        mov edx, valueModeMenu0
1326
        ret
1327
@@:
1328
   cmp byte[mode], 49
1329
   jne @f
1330
        mov edx, valueModeMenu1
1331
        ret
1332
@@:
1333
   cmp byte[mode], 50
1334
   jne @f
1335
        mov edx, valueModeMenu2
1336
        ret
1337
@@:
1338
   cmp byte[mode], 51
1339
   jne @f
1340
        mov edx, valueModeMenu3
1341
        ret
1342
@@:
1343
   mov edx, valueModeMenu1
1344
   ret
7389 theonlymir 1345
 
7395 theonlymir 1346
 
7459 theonlymir 1347
 
1348
 
1349
saveKey:
1350
   cmp word[hkSymbol], 0
1351
   je .default
1352
   cmp byte[hkSymbol], 1
1353
   je .alt
1354
   cmp byte[hkSymbol], 2
1355
   je .shift
1356
   cmp byte[hkSymbol], 3
1357
   je .ctrl
1358
   cmp byte[hkSymbol], 32
1359
   je .space
1360
.other:
1361
   mov esi, hkSymbol
1362
   mov byte[esi+1], 0
1363
   mov dword[hkSize], 1
1364
   jmp .end
1365
.space:
1366
   mov esi, hkSpace
1367
   mov dword[hkSize], 5
1368
   jmp .end
1369
.ctrl:
1370
   mov esi, hkCtrl
1371
   mov dword[hkSize], 4
1372
   jmp .end
1373
.alt:
1374
   mov esi, hkAlt
1375
   mov dword[hkSize], 3
1376
   jmp .end
1377
.default:
1378
.shift:
1379
   mov esi, hkShift
1380
   mov dword[hkSize], 5
1381
.end:
1382
   mov ebx, hkSize ;  dword[hkSize]
1383
   call copyParam
1384
   ret
1385
 
1386
 
1387
 
1388
 
1389
 
7402 theonlymir 1390
align 16
1391
@IMPORT:
1392
 
1393
library box_lib, 'box_lib.obj'
1394
 
1395
import  box_lib,\
1396
        edit_box_draw,          'edit_box',\
1397
        edit_box_key,           'edit_box_key',\
1398
        edit_box_mouse,         'edit_box_mouse',\
1399
        init_checkbox,          'init_checkbox2',\
1400
        check_box_draw,         'check_box_draw2',\
1401
        check_box_mouse,        'check_box_mouse2',\
1402
        option_box_draw,        'option_box_draw',\
1403
        option_box_mouse,       'option_box_mouse'
1404
 
7776 leency 1405
commonButtonText db '...', 0  ;    OpenDial
7436 theonlymir 1406
commonButtonTextSize = 3
7402 theonlymir 1407
 
7776 leency 1408
if lang eq ru  ;   
7395 theonlymir 1409
 
1410
text    db  "䨣 Hot Angles ⢥砥  ன ⨢ 㣫. "
7776 leency 1411
        db  "ன ࠬ  ᥡ  ⪫  .         "
1412
        db  "                                                              ", 0
7395 theonlymir 1413
 hed:
1414
title   db  "䨣 ⨫ Hot Angles", 0
1415
buttonText db "ਬ", 0
1416
buttonTextSize = 9
1417
 
7402 theonlymir 1418
ch_text db '/⨢஢ "Hot Angles"', 0
7395 theonlymir 1419
 
1420
superText:
1421
  .lu db '  孥 㣫: ', 0
1422
  .ld db '   㣫:  ', 0
1423
  .ru db ' ࠢ 孥 㣫:', 0
1424
  .rd db ' ࠢ  㣫: ', 0
1425
superTextSize = 30
1426
 
7443 theonlymir 1427
valueModeMenuSize = 32
1428
ModeMenu  db ' ࠡ:',0
1429
valueModeMenu0  db '⪫祭                       ',0
1430
valueModeMenu1  db '᪨ ०              ',0
1431
valueModeMenu2  db '० 祩            ',0
1432
valueModeMenu3  db '०    ⨢樨',0
1433
 
7448 theonlymir 1434
head_f_i:
1435
        head_f_l  db '⥬ 訡',0
1436
        err_message_found_lib0 db '  ⥪ ',39,'proc_lib.obj',39,0
1437
        err_message_import0 db '訡   ⥪ ',39,'proc_lib.obj',39,0
1438
        err_message_found_lib1 db '  ⥪ ',39,'kmenu.obj',39,0
1439
        err_message_import1 db '訡   ⥪ ',39,'kmenu',39,0
1440
 
7459 theonlymir 1441
hkCaption: db ':',0
7776 leency 1442
;hkHint: db '  ',0
7459 theonlymir 1443
radiusCaption: db ':',0
1444
 
7395 theonlymir 1445
else  ;  
1446
 
1447
text    db  "This is a Hot Angles Configurator.                            "
7776 leency 1448
        db  "Set the parameters bellow for yourself or disable this option."
1449
        db  "                                                              ", 0
7395 theonlymir 1450
 hed:
1451
title   db  "Hot Angles Configurator", 0
7776 leency 1452
buttonText db "  Apply  ", 0
8256 leency 1453
buttonTextSize = 9
7395 theonlymir 1454
 
7776 leency 1455
ch_text db 'Activate "Hot Angles"',0       ;    
7389 theonlymir 1456
 
1457
superText:
7395 theonlymir 1458
  .lu db 'Left up angle command:   ', 0
1459
  .ld db 'Left down angle command: ', 0
1460
  .ru db 'Right up angle command:  ', 0
7389 theonlymir 1461
  .rd db 'Right down angle command:', 0
7395 theonlymir 1462
superTextSize = 25
7389 theonlymir 1463
 
7443 theonlymir 1464
valueModeMenuSize = 32
1465
ModeMenu  db 'Mode:',0
1466
valueModeMenu0  db 'disabled                        ',0
1467
valueModeMenu1  db 'classic mode                    ',0
1468
valueModeMenu2  db 'hot key mode                    ',0
1469
valueModeMenu3  db 'activation key gesture mode     ',0
1470
 
7448 theonlymir 1471
head_f_i:
1472
        head_f_l  db 'System error',0
1473
        err_message_found_lib0 db 'Could not find library ',39,'proc_lib.obj',39,0
1474
        err_message_import0 db 'Error importing library ',39,'proc_lib.obj',39,0
1475
        err_message_found_lib1 db 'Could not find library ',39,'kmenu.obj',39,0
1476
        err_message_import1 db 'Error importing library ',39,'kmenu',39,0
1477
 
7459 theonlymir 1478
hkCaption: db 'Key:',0
7776 leency 1479
;hkHint: db 'press any key',0
7459 theonlymir 1480
radiusCaption: db 'Radius:',0
1481
 
7395 theonlymir 1482
end if
1483
 
7459 theonlymir 1484
hkAlt:   db 'Alt',0
1485
hkShift: db 'Shift',0
1486
hkCtrl:  db 'Ctrl',0
1487
hkSpace: db 'Space',0
1488
hkHint: db '?',0
1489
hkSize: rd 1 ;    
7395 theonlymir 1490
 
7389 theonlymir 1491
draw_super_text:
1492
   push eax ebx ecx edx edi esi
7459 theonlymir 1493
 
7776 leency 1494
   mov ecx, 0
1495
   mov ch, byte[mysize]
1496
   shl ecx, 16
1497
   add ecx, 0x224466
7459 theonlymir 1498
 
7776 leency 1499
   mcall 4,  ,,superText.lu,superTextSize
1500
   mcall 4, ,,superText.ld,superTextSize
1501
   mcall 4, <290,74>    ,,superText.ru,superTextSize
1502
   mcall 4, <290,109>   ,,superText.rd,superTextSize
7469 theonlymir 1503
 
7776 leency 1504
   mov     ebx, Otstup * 65536 + (buttonModeY-11)
7443 theonlymir 1505
   or ecx, 0x80000000
1506
   mov     edx, ModeMenu
1507
   mov     esi, 3
1508
   mcall 4
1509
 
7776 leency 1510
;   mov     ebx, buttonHotKeyX * 65536 + (buttonModeY-11)
1511
;   or ecx, 0x80000000
1512
;   mov     edx, hkCaption
1513
;   mov     esi, 3
1514
;   mcall 4
1515
 
7389 theonlymir 1516
   pop esi edi edx ecx ebx eax
1517
   ret
1518
 
7436 theonlymir 1519
editID db 0
1520
initEBX:
1521
   cmp byte[editID], 4
1522
   jne @f
1523
   mov ebx, dataBuffer.1
1524
   ret
1525
@@:
1526
   cmp byte[editID], 5
1527
   jne @f
1528
   mov ebx, dataBuffer.2
1529
   ret
1530
@@:
1531
   cmp byte[editID], 6
1532
   jne @f
1533
   mov ebx, dataBuffer.3
1534
   ret
1535
@@:
1536
   cmp byte[editID], 7
1537
   jne @f
1538
   mov ebx, dataBuffer.4
1539
   ret
1540
@@:
1541
   ret
1542
setRESULT:
1543
   cmp byte[editID], 4
1544
   jne @f
1545
   mov dword[dataBuffer.size1], ecx
1546
   mov dword[editLU.size], ecx
1547
   mov dword[editLU.pos], ecx
1548
   ret
1549
@@:
1550
   cmp byte[editID], 5
1551
   jne @f
1552
   mov dword[dataBuffer.size2], ecx
1553
   mov dword[editLD.size], ecx
1554
   mov dword[editLD.pos], ecx
1555
   ret
1556
@@:
1557
   cmp byte[editID], 6
1558
   jne @f
1559
   mov dword[dataBuffer.size3], ecx
1560
   mov dword[editRU.size], ecx
1561
   mov dword[editRU.pos], ecx
1562
   ret
1563
@@:
1564
   cmp byte[editID], 7
1565
   jne @f
1566
   mov dword[dataBuffer.size4], ecx
1567
   mov dword[editRD.size], ecx
1568
   mov dword[editRD.pos], ecx
1569
   ret
1570
@@:
1571
   ret
1572
copyPath:
1573
   push eax ebx ecx edx ;copy file name path
1574
        mov eax, openfile_path ;dword[OpenDialog_data.openfile_path]
1575
        call initEBX ;mov ebx, dataBuffer.1 ;.data
1576
        mov ecx, 0
1577
      @@:
1578
        mov dl, byte[eax]
1579
        cmp dl, 0 ;byte[eax], 0
1580
        je @f
1581
        mov byte[ebx], dl
1582
        inc eax
1583
        inc ebx
1584
        inc ecx
1585
        jmp @b
1586
      @@:
1587
        mov byte[ebx], 0
1588
        call setRESULT
1589
   pop edx ecx ebx eax
1590
   ret
7389 theonlymir 1591
 
7436 theonlymir 1592
 
7459 theonlymir 1593
IntToStr:  ;in esi - ; ex - 
1594
   push eax ecx edx esi
1595
   cmp ecx, 0
1596
   jne @f
1597
   mov byte[esi], 48 ; '0'
1598
   inc esi
1599
   jmp .end
1600
@@:
1601
   mov eax, ecx
1602
   mov ecx, 10
1603
.next:
1604
   mov edx, 0
1605
   div ecx
1606
   add edx, 48
1607
 
1608
   mov byte[esi], dl
1609
 
1610
   inc esi
1611
   cmp eax, 0
1612
   je .end
1613
   jmp .next
1614
.end:
7776 leency 1615
   mov byte[esi], 0   ;  
7459 theonlymir 1616
   pop esi edx ecx eax
1617
   call reverseString ;  
1618
   ret
1619
 
1620
;: esi -   
1621
reverseString:
1622
   push eax esi edi
1623
 
7776 leency 1624
   mov al, byte[esi] ;        
7459 theonlymir 1625
   cmp al, 0
1626
   je reverseString.end
1627
 
7776 leency 1628
   mov edi, esi  ;          edi
7459 theonlymir 1629
.go_last_symbol:
1630
   mov al, byte[edi+1]
1631
   cmp al, 0
1632
   je @f
1633
 
1634
   inc edi
1635
   jmp reverseString.go_last_symbol
1636
@@:
1637
   push ebx
1638
.rev:
1639
   cmp esi, edi
1640
   jae @f
1641
 
7776 leency 1642
   ;    
7459 theonlymir 1643
   mov al, byte[edi]
1644
   mov bl, byte[esi]
1645
   mov byte[edi], bl
1646
   mov byte[esi], al
1647
 
1648
   inc esi
1649
   dec edi
1650
   jmp reverseString.rev
1651
@@:
1652
   pop ebx
1653
.end:
1654
   pop edi esi eax
1655
   ret
1656
 
1657
 
1658
 
7436 theonlymir 1659
align 4
1660
but_open_dlg:
1661
        pushad
1662
        copy_path open_dialog_name,communication_area_default_path,file_name,0
1663
        mov [OpenDialog_data.type],0
1664
        stdcall[OpenDialog_Start], OpenDialog_data
1665
        cmp [OpenDialog_data.status],2
1666
        je @f
1667
        cmp [OpenDialog_data.status],0 ;  Cancel?
1668
        je .end_open
1669
                ;    
1670
                call copyPath
1671
                jmp .end_open
1672
        @@:
1673
                ;     
1674
                ;...
1675
        .end_open:
1676
        popad
1677
        ret
1678
 
7776 leency 1679
;    
7436 theonlymir 1680
align 4
1681
OpenDialog_data:
1682
.type                   dd 0 ;0 - , 1 - , 2 -  
1683
.procinfo               dd procinfo
1684
.com_area_name          dd communication_area_name ;+8
7443 theonlymir 1685
.com_area               dd 0           ;+12
7436 theonlymir 1686
.opendir_path           dd plugin_path ;+16
1687
.dir_default_path       dd default_dir ;+20
7776 leency 1688
.start_path             dd file_name   ;+24     
7436 theonlymir 1689
.draw_window            dd draw_window ;+28
7443 theonlymir 1690
.status                 dd 0           ;+32
7436 theonlymir 1691
.openfile_path          dd openfile_path ;+36    
1692
.filename_area          dd filename_area ;+40
1693
.filter_area            dd Filter
1694
.x:
1695
.x_size                 dw 420 ;+48 ; Window X size
7443 theonlymir 1696
.x_start                dw 10  ;+50 ; Window X position
7436 theonlymir 1697
.y:
1698
.y_size                 dw 320 ;+52 ; Window y size
7443 theonlymir 1699
.y_start                dw 10  ;+54 ; Window Y position
7436 theonlymir 1700
 
7776 leency 1701
default_dir db '/rd/1',0 ;  
7436 theonlymir 1702
communication_area_name: db 'FFFFFFFF_open_dialog',0
1703
open_dialog_name:  db 'opendial',0
1704
communication_area_default_path: db '/rd/1/File managers/',0
1705
 
1706
Filter:
1707
dd Filter.end - Filter.1
1708
.1:
1709
;db 'KEX',0
1710
.end:
1711
db 0
7443 theonlymir 1712
 
1713
mode db 49 ;'1'
1714
modeMenu dd 0
1715
coordModeMenu:
1716
  .x dw 100
1717
  .y dw 200
1718
 
1719
 
7436 theonlymir 1720
align 4
1721
proclib_import: ;  
1722
        OpenDialog_Init dd aOpenDialog_Init
1723
        OpenDialog_Start dd aOpenDialog_Start
1724
dd 0,0
1725
        aOpenDialog_Init db 'OpenDialog_init',0
1726
        aOpenDialog_Start db 'OpenDialog_start',0
1727
 
1728
system_dir0 db '/sys/lib/'
1729
lib0_name db 'proc_lib.obj',0
7443 theonlymir 1730
lib1_name db 'kmenu.obj',0
1731
 
7448 theonlymir 1732
symbolDownArrow db 25,0
1733
 
7436 theonlymir 1734
;library structures
1735
l_libs_start:
7443 theonlymir 1736
    lib0 l_libs lib0_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, proclib_import,err_message_import0, head_f_i
1737
    lib1 l_libs lib1_name, sys_path, file_name, system_dir0, err_message_found_lib1, head_f_l, import_libkmenu,err_message_import1,head_f_i
7436 theonlymir 1738
load_lib_end:
1739
 
7448 theonlymir 1740
 
7402 theonlymir 1741
edMaxSize = 510 ;      511 
7389 theonlymir 1742
edMax = 0 ;max, size, pos
1743
 
7402 theonlymir 1744
align 4
7776 leency 1745
editLU   edit_box 230-buttonW,Otstup+buttonW,85, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0x10000000, edMaxSize, dataBuffer.1, mouse_dd, 0, edMax, edMax  ;ed_focus
1746
editLD   edit_box 230-buttonW,Otstup+buttonW,120, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0x10000000, edMaxSize, dataBuffer.2, mouse_dd, 0, edMax, edMax
1747
editRU   edit_box 230-buttonW,290,85, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0x10000000, edMaxSize, dataBuffer.3, mouse_dd, 0, edMax, edMax
1748
editRD   edit_box 230-buttonW,290,120, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0x10000000, edMaxSize, dataBuffer.4, mouse_dd, 0, edMax, edMax
1749
editRadius edit_box 40,(buttonHotKeyX + buttonHotKeyWidth + 20),buttonModeY, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0x10000000, 4, radiusBuffer.data, mouse_dd, ed_figure_only, edMax, edMax
7389 theonlymir 1750
 
7443 theonlymir 1751
align 4
1752
import_libkmenu:
1753
        kmenu_init      dd akmenu_init
1754
        kmainmenu_draw  dd akmainmenu_draw
1755
        kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
1756
        ksubmenu_new    dd aksubmenu_new
1757
        ksubmenu_delete dd aksubmenu_delete
1758
        ksubmenu_draw   dd aksubmenu_draw
1759
        ksubmenu_add    dd aksubmenu_add
1760
        kmenuitem_new   dd akmenuitem_new
1761
        kmenuitem_delete dd akmenuitem_delete
1762
        kmenuitem_draw  dd akmenuitem_draw
1763
dd 0,0
1764
        akmenu_init     db 'kmenu_init',0
1765
        akmainmenu_draw db 'kmainmenu_draw',0
1766
        akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
1767
        aksubmenu_new   db 'ksubmenu_new',0
1768
        aksubmenu_delete db 'ksubmenu_delete',0
1769
        aksubmenu_draw  db 'ksubmenu_draw',0
1770
        aksubmenu_add   db 'ksubmenu_add',0
1771
        akmenuitem_new  db 'kmenuitem_new',0
1772
        akmenuitem_delete db 'kmenuitem_delete',0
1773
        akmenuitem_draw  db 'kmenuitem_draw',0
1774
 
7436 theonlymir 1775
sc  system_colors
7459 theonlymir 1776
mouse_dd  rd 1
7436 theonlymir 1777
 
7459 theonlymir 1778
sizeStyle: rb 1  ;     
1779
mysize: rb 1     ;rd 1
7776 leency 1780
radiusBuffer:    ;    
7459 theonlymir 1781
 .data: rb 6
1782
 .size: rd 1
1783
radiusBufferEnd:
1784
 
7443 theonlymir 1785
button_press  rd 0     ;for kmenu
1786
 
1787
sys_path:      rb 4096
1788
file_name:     rb 4096
1789
plugin_path:   rb 4096
1790
openfile_path: rb 4096
1791
filename_area: rb 256
1792
rb 1024
1793
procinfo process_information
1794
pi rb 1024
1795
 
7459 theonlymir 1796
keyscan: rb 1
1797
keystr:
1798
  .data: rb 4 ;     
7776 leency 1799
  .size: rd 1 ;     
7443 theonlymir 1800
 
7389 theonlymir 1801
dataBuffer:
1802
.1: rb 512
1803
.2: rb 512
1804
.3: rb 512
1805
.4: rb 512
1806
.size1: rd 1
1807
.size2: rd 1
1808
.size3: rd 1
1809
.size4: rd 1
7448 theonlymir 1810
;255+255+2 = 512
7776 leency 1811
;           ,    0
7389 theonlymir 1812
dataBufferEnd:
1813
 
1814
 
1815
I_END:
7776 leency 1816
        rb 4096
1817
align 16
7389 theonlymir 1818
STACKTOP:
1819
 
1820
MEM: