Subversion Repositories Kolibri OS

Rev

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