Subversion Repositories Kolibri OS

Rev

Rev 318 | Rev 529 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 318 Rev 485
Line 3... Line 3...
3
;   Some parts of code rewritten by Ivan Poddubny 
3
;   Some parts of code rewritten by Ivan Poddubny 
4
;
4
;
5
;   Compile with FASM for Menuet
5
;   Compile with FASM for Menuet
6
;******************************************************************************
6
;******************************************************************************
7
  include "lang.inc"
7
  include "lang.inc"
8
  include "macros.inc"
8
  include "..\..\..\macros.inc"
Line 9... Line 9...
9
 
9
 
10
  BTN_HEIGHT  = 22
10
  BTN_HEIGHT  = 22
Line 11... Line 11...
11
  TXT_Y       = (BTN_HEIGHT)/2-5
11
  TXT_Y       = (BTN_HEIGHT)/2-5
Line 25... Line 25...
25
 
25
 
26
     mov  eax, 48	  ; load system colors
26
     mov  eax, 48	  ; load system colors
27
     mov  ebx, 3
27
     mov  ebx, 3
28
     mov  ecx, sc
28
     mov  ecx, sc
29
     mov  edx, sizeof.system_colors
29
     mov  edx, sizeof.system_colors
Line 30... Line 30...
30
     int  0x40
30
     mcall
31
 
31
 
32
     mov  eax, 70	  ; load MENU.DAT
32
     mov  eax, 70	  ; load MENU.DAT
33
     mov  ebx, fileinfo
33
     mov  ebx, fileinfo
34
     int  0x40
34
     mcall
35
     test eax, eax	   ; error ?
35
     test eax, eax	   ; error ?
36
     jz  @f
36
     jz  @f
37
     cmp  eax,6
37
     cmp  eax,6
Line 87... Line 87...
87
     jbe  search_end1
87
     jbe  search_end1
88
     sub  ebx, 16
88
     sub  ebx, 16
89
     jmp  newprocess
89
     jmp  newprocess
90
  search_end1:
90
  search_end1:
91
     mov  eax, 14
91
     mov  eax, 14
92
     int  0x40
92
     mcall
93
     sub  ax, 20
93
     sub  ax, 20
94
     mov  [menu_data + y_end],	    ax
94
     mov  [menu_data + y_end],	    ax
95
     mov  [menu_data + x_start],  5
95
     mov  [menu_data + x_start],  5
96
     mov  al, [menu_data + rows]
96
     mov  al, [menu_data + rows]
97
     mov  [menu_data + cur_sel],  al	 ; clear selection
97
     mov  [menu_data + cur_sel],  al	 ; clear selection
Line 104... Line 104...
104
     add  eax, menu_data
104
     add  eax, menu_data
105
     mov  edi, eax
105
     mov  edi, eax
Line 106... Line 106...
106
 
106
 
107
     mov  eax, 40	  ; set event mask
107
     mov  eax, 40	  ; set event mask
108
     mov  ebx, 100111b	       ; mouse + button + key + redraw
108
     mov  ebx, 100111b	       ; mouse + button + key + redraw
Line 109... Line 109...
109
     int  0x40
109
     mcall
Line 110... Line 110...
110
 
110
 
111
     call draw_window
111
     call draw_window
112
 
112
 
113
still:
113
still:
Line 114... Line 114...
114
    mov  eax, 23	 ; wait here for event
114
    mov  eax, 23	 ; wait here for event
115
    mov  ebx, 5
115
    mov  ebx, 5
Line 116... Line 116...
116
    int  0x40
116
    mcall
Line 145... Line 145...
145
    jmp  still
145
    jmp  still
Line 146... Line 146...
146
 
146
 
147
 
147
 
148
  key:
148
  key:
Line 149... Line 149...
149
;   mov  eax, 2
149
;   mov  eax, 2
Line 150... Line 150...
150
    int  0x40
150
    mcall
151
 
151
 
Line 187... Line 187...
187
 
187
 
Line 188... Line 188...
188
;           include "DEBUG.INC"
188
;           include "DEBUG.INC"
189
 
189
 
190
  button:	      ; BUTTON HANDLER
190
  button:	      ; BUTTON HANDLER
Line 191... Line 191...
191
    mov  eax, 17	 ; get id
191
    mov  eax, 17	 ; get id
192
    int  0x40
192
    mcall
193
 
193
 
194
  button1:
194
  button1:
Line 236... Line 236...
236
    mov  edi, fileinfo_start.name
236
    mov  edi, fileinfo_start.name
237
    rep  movsb		   ; copy string
237
    rep  movsb		   ; copy string
238
    mov  byte [edi], 0	       ; store terminator
238
    mov  byte [edi], 0	       ; store terminator
239
    mov  eax, 70	 ; start program
239
    mov  eax, 70	 ; start program
240
    mov  ebx, fileinfo_start
240
    mov  ebx, fileinfo_start
241
    int  0x40
241
    mcall
242
;    mcall 5,100
242
;    mcall 5,100
243
    or	   [close_now], 1      ; set close flag
243
    or	   [close_now], 1      ; set close flag
244
    pop  edi
244
    pop  edi
245
    mov  [mousemask], 0
245
    mov  [mousemask], 0
246
    jmp  close
246
    jmp  close
Line 304... Line 304...
304
    add  [thread_stack], 0x2000 ; start new thread
304
    add  [thread_stack], 0x2000 ; start new thread
305
    mov  eax, 51
305
    mov  eax, 51
306
    mov  ebx, 1
306
    mov  ebx, 1
307
    mov  ecx, thread
307
    mov  ecx, thread
308
    mov  edx, [thread_stack]
308
    mov  edx, [thread_stack]
309
    int  0x40
309
    mcall
Line 310... Line 310...
310
 
310
 
Line 311... Line 311...
311
    jmp  searchexit
311
    jmp  searchexit
312
 
312
 
313
 
313
 
314
 mouse: 	      ; MOUSE EVENT HANDLER
314
 mouse: 	      ; MOUSE EVENT HANDLER
315
    mov  eax, 37
315
    mov  eax, 37
316
    mov  ebx, 2
316
    mov  ebx, 2
317
    int  0x40
317
    mcall
318
    test eax, eax	   ; check buttons state
318
    test eax, eax	   ; check buttons state
319
    jnz  click
319
    jnz  click
320
    mov  eax, 37
320
    mov  eax, 37
321
    mov  ebx, 1
321
    mov  ebx, 1
322
    int  0x40
322
    mcall
323
    ror  eax, 16	  ; eax = [ Y | X ] relative to window
323
    ror  eax, 16	  ; eax = [ Y | X ] relative to window
Line 361... Line 361...
361
 
361
 
362
 
362
 
363
  close:
363
  close:
364
    or	   eax, -1	  ; close this thread
364
    or	   eax, -1	  ; close this thread
Line 365... Line 365...
365
    mov  [edi + child], al    ; my child is not mine
365
    mov  [edi + child], al    ; my child is not mine
366
    int  0x40
366
    mcall
367
 
367
 
Line 407... Line 407...
407
 
407
 
Line 408... Line 408...
408
draw_window:
408
draw_window:
409
 
409
 
410
    mov  eax, 12	   ; function 12:tell os about windowdraw
410
    mov  eax, 12	   ; function 12:tell os about windowdraw
Line 411... Line 411...
411
    mov  ebx, 1 	   ; 1, start of draw
411
    mov  ebx, 1 	   ; 1, start of draw
412
    int  0x40
412
    mcall
413
 
413
 
414
  movzx  ebx, [edi + rows]
414
  movzx  ebx, [edi + rows]
Line 422... Line 422...
422
    shl  ebx, 16
422
    shl  ebx, 16
423
    mov  bx,  140	    ; ebx = [ X_START | X_SIZE ]
423
    mov  bx,  140	    ; ebx = [ X_START | X_SIZE ]
424
    xor  eax, eax	    ; function 0 : define and draw window
424
    xor  eax, eax	    ; function 0 : define and draw window
425
    mov  edx, 0x01000000       ; color of work area RRGGBB,8->color gl
425
    mov  edx, 0x01000000       ; color of work area RRGGBB,8->color gl
426
    mov  esi, edx	    ; unmovable window
426
    mov  esi, edx	    ; unmovable window
427
    int  0x40
427
    mcall
Line 428... Line 428...
428
 
428
 
Line 429... Line 429...
429
    call draw_all_buttons
429
    call draw_all_buttons
430
 
430
 
431
    mov  eax,12
431
    mov  eax,12
Line 432... Line 432...
432
    mov  ebx,2
432
    mov  ebx,2
Line 433... Line 433...
433
    int  0x40
433
    mcall
Line 477... Line 477...
477
    cmp  [edi + cur_sel], dl
477
    cmp  [edi + cur_sel], dl
478
    jne  .nohighlight
478
    jne  .nohighlight
479
    add  esi, 0x1a1a1a
479
    add  esi, 0x1a1a1a
480
  .nohighlight:
480
  .nohighlight:
481
    or	   edx, 0x20000000
481
    or	   edx, 0x20000000
482
    int  0x40
482
    mcall
483
    movzx edx, dl
483
    movzx edx, dl
Line 484... Line 484...
484
 
484
 
485
    dec  dl
485
    dec  dl
486
    imul ebx, edx, BTN_HEIGHT
486
    imul ebx, edx, BTN_HEIGHT
Line 502... Line 502...
502
    jnz  .findline
502
    jnz  .findline
Line 503... Line 503...
503
 
503
 
504
    mov  ecx, [sc.work_text]
504
    mov  ecx, [sc.work_text]
505
    mov  eax, 4
505
    mov  eax, 4
506
    mov  esi, 21
506
    mov  esi, 21
Line 507... Line 507...
507
    int  0x40
507
    mcall
508
 
508