Subversion Repositories Kolibri OS

Rev

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

Rev 5427 Rev 6444
Line 1... Line -...
1
;
-
 
-
 
1
;-----------------------;
2
;   CPU -process Manager
2
; CPU - process manager ;
-
 
3
;-----------------------;
3
;
4
 
4
;------------------------------------------------------------------------------
-
 
5
; version:      1.80
-
 
6
; last update:  07/04/2012
-
 
7
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
8
; changes:      Complete elimination of flicker.
-
 
9
;               Using f.0 C = 1 - don't fill working area on window draw.
-
 
10
;               Increasing the size of buttons and a bright color.
-
 
11
;               Processing "window is rolled up" and "window is minimized"
-
 
12
;------------------------------------------------------------------------------
-
 
13
; version:      1.70
-
 
14
; last update:  04/04/2012
-
 
15
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
16
; changes:      Code refactoring and optimization.
-
 
17
;               Added russian language support.
-
 
18
;               Fix - processes information showing  not been updated during
-
 
19
;               the processing of mouse events.
-
 
20
;------------------------------------------------------------------------------
-
 
21
; Many fix's and changes created by:
-
 
22
;               Diamond, Heavyiron, SPraid, ,
-
 
23
;               Leency, IgorA, kaitz
-
 
24
;---------------------------------------------------------------------
-
 
25
;   integrated with load_lib.obj by 
-
 
26
;---------------------------------------------------------------------
-
 
27
;   additions by M.Lisovin lisovin@26.ru
-
 
28
;---------------------------------------------------------------------
-
 
29
;   original author - VTurjanmaa
-
 
30
;------------------------------------------------------------------------------
-
 
31
format binary as ""
5
format binary as ""
Line 32... Line 6...
32
 
6
 
33
        use32
7
        use32
34
        org 0x0
8
        org 0x0
Line 274... Line 248...
274
        cmp     [draw_window_flag],1
248
        cmp     [draw_window_flag],1
275
        je      @f
249
        je      @f
276
        mov     ecx,[curposy]
250
        mov     ecx,[curposy]
277
        shl     ecx,16
251
        shl     ecx,16
278
        mov     cx,10   ; button height
252
        mov     cx,10   ; button height
279
        push    ecx
-
 
280
        add     ecx,3 shl 16
-
 
281
        mcall   13,<11,95>,,[btn_bacground_color]
-
 
282
        pop     ecx
-
 
283
 
-
 
284
        mcall   13,<111,393>,,[bar_bacground_color]
253
        mcall   13,<111,393>,,[bar_bacground_color]
285
;--------------------------------------
-
 
286
align 4
-
 
287
@@:
254
@@:
288
        ret
255
        ret
289
;------------------------------------------------------------------------------
256
;------------------------------------------------------------------------------
290
align 4
257
align 4
291
draw_next_process:
258
draw_next_process:
Line 293... Line 260...
293
;  edi - current slot
260
;  edi - current slot
294
;  [curposy] - y position
261
;  [curposy] - y position
295
;output:
262
;output:
296
;  edi - next slot (or -1 if no next slot)
263
;  edi - next slot (or -1 if no next slot)
297
;registers corrupted!
264
;registers corrupted!
298
;delete old button
-
 
299
        cmp     [draw_window_flag],0
-
 
300
        je      @f
-
 
301
        mov     edx,[index]
-
 
302
        add     edx,(1 shl 31)+11
-
 
303
        mcall   8
-
 
304
;--------------------------------------
-
 
305
align 4
-
 
306
@@:
-
 
307
;create terminate process button
265
;create terminate process button
308
        mov     ecx,[curposy]
266
        mov     ecx,[curposy]
309
        shl     ecx,16
267
        shl     ecx,16
310
        mov     cx,13   ; button height
268
        mov     cx,13   ; button height
311
        mov     edx,[index]
269
        mov     edx,[index]
312
        add     edx,11
270
        add     edx,11
313
        mov     esi,0xccddee    ; 0xaabbcc
271
        mov     esi,0xccddee
314
;contrast
-
 
315
        test    dword [index],1
272
        test    dword [index],1
316
        jz      .change_color_button
-
 
317
        mov     esi,0xaabbcc    ; 0x8899aa
-
 
318
;--------------------------------------
-
 
319
align 4
-
 
320
.change_color_button:
-
 
321
        cmp     [draw_window_flag],0
-
 
322
        je      @f
273
        jz      @f
323
        mcall   8,<10,99>
274
        mov     esi,0xaabbcc
324
;--------------------------------------
-
 
325
align 4
-
 
326
@@:
275
@@:
-
 
276
        mcall   8,<10,99>
327
        mov     [btn_bacground_color],esi
277
        mov     [btn_bacground_color],esi
328
;draw background for proccess information
278
;draw background for proccess information
329
; ecx was already set
-
 
330
        mov     edx,0xddffdd    ; 0x88ff88
279
        mov     edx,0xddffdd
331
;contrast
-
 
332
        test    dword [index],1
280
        test    dword [index],1
333
        jz      .change_color_info
281
        jz      @f
334
        mov     edx,0xffffff    ; 0xddffdd
282
        mov     edx,0xffffff
335
;--------------------------------------
-
 
336
align 4
283
@@:
337
.change_color_info:
-
 
338
        inc     cx
284
        inc     cx
339
        cmp     [draw_window_flag],0
285
        cmp     [draw_window_flag],0
340
        je      @f
286
        je      @f
341
        mcall   13,<110,395>
287
        mcall   13,<110,395>
342
;--------------------------------------
-
 
343
align 4
-
 
344
@@:
288
@@:
345
        mov     [bar_bacground_color],edx
289
        mov     [bar_bacground_color],edx
346
;nothing else should be done
-
 
347
;if there is no process for this button
290
;nothing else should be done if there is no process for this button
348
        cmp     edi,-1
291
        cmp     edi,-1
349
        jne     .return_1
292
        jne     .return_1
Line 350... Line 293...
350
 
293
 
351
        call    draw_empty_slot
294
        call    draw_empty_slot
Line 428... Line 371...
428
;       cdq
371
;       cdq
429
        xor     edx,edx ; for CPU more 2 GHz - mike.dld
372
        xor     edx,edx ; for CPU more 2 GHz - mike.dld
430
        div     ebx
373
        div     ebx
431
        mov     [cpu_percent],eax
374
        mov     [cpu_percent],eax
432
;set text color to display process information
375
;set text color to display process information
433
;([tcolor] variable)
-
 
434
;0%      : black
376
;0%      : black
435
;1-80%   : green
377
;1-80%   : green
436
;81-100% : red
378
;81-100% : red
437
        test    eax,eax
379
        test    eax,eax
438
        jnz     .no_black
380
        jnz     .no_black
Line 439... Line 381...
439
 
381
 
440
        mov     [tcolor],eax
382
        mov     esi,eax
441
        jmp     .color_set
383
        jmp     .color_set
442
;--------------------------------------
384
;--------------------------------------
443
align 4
385
align 4
444
.no_black:
386
.no_black:
445
        cmp     eax,80
387
        cmp     eax,80
Line 446... Line 388...
446
        ja      .no_green
388
        ja      .no_green
447
 
389
 
448
        mov     dword [tcolor],0x107a30
390
        mov     esi,0x107a30
449
        jmp     .color_set
391
        jmp     .color_set
450
;--------------------------------------
392
;--------------------------------------
451
align 4
393
align 4
452
.no_green:
394
.no_green:
453
        mov     dword [tcolor],0xac0000
395
        mov     esi,0xac0000
454
;--------------------------------------
396
;--------------------------------------
455
align 4
397
align 4
456
.color_set:
398
.color_set:
457
;show slot number
399
;show slot number
458
;ecx haven't changed since .process_found
400
;ecx haven't changed since .process_found
459
        push    edi
401
        push    edi
460
        mov     edx,[curposy]
402
        mov     edx,[curposy]
461
        add     edx,15*65536+3
-
 
462
        mov     esi,[tcolor]
-
 
463
        and     esi,0xffffff
-
 
464
        or      esi,0x40000000
403
        add     edx,15*65536+3
465
        mcall   47,<2,256>,,,,[btn_bacground_color]
404
        mcall   47,<2,256>
466
;show process name
405
;show process name
467
        mov     ebx,[curposy]
406
        mov     ebx,[curposy]
468
        add     ebx,40*65536+3
-
 
469
        mov     ecx,[tcolor]
-
 
470
        and     ecx,0xffffff
407
        add     ebx,40*65536+3
471
        or      ecx,0x40000000
408
        mov     ecx,esi
472
        mcall   4,,,process_info_buffer.process_name,11,[btn_bacground_color]
409
        mcall   4,,,process_info_buffer.process_name,11
473
;show pid
410
;show pid
474
        mov     edx,[curposy]
411
        mov     edx,[curposy]
475
        add     edx,125*65536+3
-
 
476
        mov     esi,[tcolor]
412
        add     edx,125*65536+3
477
        and     esi,0xffffff
413
        mov     esi,ecx
478
        or      esi,0x40000000
414
        or      esi,0x40000000
479
        mcall   47,<8,256>,[process_info_buffer.PID],,,[bar_bacground_color]
415
        mcall   47,<8,256>,[process_info_buffer.PID],,,[bar_bacground_color]
480
;show cpu usage
416
;show cpu usage
Line 798... Line 734...
798
sc system_colors
734
sc system_colors
799
winxpos         rd 1
735
winxpos         rd 1
800
winypos         rd 1
736
winypos         rd 1
801
mouse_dd        rd 1
737
mouse_dd        rd 1
802
cpu_percent     rd 1
738
cpu_percent     rd 1
803
tcolor          rd 1
-
 
804
list_add        rd 1
739
list_add        rd 1
805
curposy         rd 1
740
curposy         rd 1
806
index           rd 1
741
index           rd 1
807
tasklist        rd display_processes
742
tasklist        rd display_processes
808
time_counter    rd 1
743
time_counter    rd 1
Line 819... Line 754...
819
process_info_buffer process_information
754
process_info_buffer process_information
820
;------------------------------------------------------------------------------
755
;------------------------------------------------------------------------------
821
align 4
756
align 4
822
cur_dir_path:
757
cur_dir_path:
823
        rb 1024
758
        rb 1024
824
;------------------------------------------------------------------------------
-
 
825
align 4
-
 
826
        rb 1024
759
        rb 1024
827
stack_area:
760
stack_area:
828
;------------------------------------------------------------------------------
-
 
829
U_END:
761
U_END:
830
;------------------------------------------------------------------------------
-