Subversion Repositories Kolibri OS

Rev

Rev 3226 | Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                 ;;
  3. ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved.    ;;
  4. ;; Distributed under terms of the GNU General Public License       ;;
  5. ;;                                                                 ;;
  6. ;;                                                                 ;;
  7. ;;         GNU GENERAL PUBLIC LICENSE                              ;;
  8. ;;          Version 2, June 1991                                   ;;
  9. ;;                                                                 ;;
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12.  
  13. window_create:
  14.  
  15. ; allocate the window data block
  16.         mcall   68, 12, sizeof.window_data
  17.         test    eax, eax
  18.         jz      .fail
  19.  
  20. ; fill it with all zeros
  21.         push    eax
  22.         mov     edi, eax
  23.         mov     ecx, (sizeof.window_data+3)/4
  24.         xor     eax, eax
  25.         rep     stosd
  26.         pop     eax
  27.  
  28.   .fail:
  29.         ret
  30.  
  31.  
  32. window_set_name:    ; esi = ptr to name, ebx = window ptr
  33.  
  34.         pusha
  35.  
  36. ; Skip heading spaces
  37.   .spaceloop:
  38.         cmp     byte[esi], ' '
  39.         jne     .done
  40.         inc     esi
  41.         jmp     .spaceloop
  42.   .done:
  43.  
  44. ; Now copy it
  45.         lea     edi, [ebx + window.name]
  46.         mov     ecx, MAX_WINDOWNAME_LEN
  47.   .loop:
  48.         lodsb
  49.         cmp     al, 0x21
  50.         jbe     .addzero
  51.         stosb
  52.         dec     ecx
  53.         jnz     .loop
  54.   .addzero:
  55.         xor     al, al
  56.         stosb
  57.  
  58.         call    draw_windownames        ; redraw it
  59.  
  60.         popa
  61.  
  62.         ret
  63.  
  64.  
  65.  
  66. window_refresh:
  67.  
  68. ; set the correct buffer pointers       ; FIXME: what is it good for?
  69.         mov     eax, [textbox_width]    ;
  70.         imul    eax, 11                 ;
  71.         mov     [pos], eax              ;
  72.  
  73.         mov     eax, [window_print]
  74.         mov     eax, [eax + window.data_ptr]
  75.         add     eax, window_data.text
  76.         mov     [text_start], eax
  77.  
  78.         ret
  79.  
  80.  
  81. print_text:                             ; eax = start ptr
  82.                                         ; dl = end char
  83.         pusha
  84.   ptr2:
  85.         mov     bl, [eax]
  86.  
  87.         cmp     bl, dl
  88.         je      ptr_ret
  89.         cmp     bl, 0
  90.         je      ptr_ret
  91.         call    print_character
  92.  
  93.         inc     eax
  94.         jmp     ptr2
  95.  
  96.   ptr_ret:
  97.         popa
  98.         ret
  99.  
  100.  
  101. print_text2:                            ; esi = ptr to ASCIIZ string
  102.  
  103.         pusha
  104.   .loop:
  105.         lodsb
  106.         test    al, al
  107.         jz      .done
  108.         mov     bl, al
  109.         call    print_character
  110.         jmp     .loop
  111.  
  112.   .done:
  113.         popa
  114.         ret
  115.  
  116.  
  117. if TIMESTAMP
  118. print_timestamp:
  119.  
  120.         pusha
  121.         mcall   3                       ; get system time
  122.  
  123.         mov     bl, '['
  124.         call    print_character
  125.         mov     ecx, TIMESTAMP
  126.   .loop:
  127.         mov     bl, al
  128.         shr     bl, 4
  129.         add     bl, '0'
  130.         call    print_character
  131.  
  132.         mov     bl, al
  133.         and     bl, 0x0f
  134.         add     bl, '0'
  135.         call    print_character
  136.  
  137.         dec     ecx
  138.         jz      .done
  139.  
  140.         mov     bl, ':'
  141.         call    print_character
  142.         shr     eax, 8
  143.         jmp     .loop
  144.   .done:
  145.         mov     bl, ']'
  146.         call    print_character
  147.         mov     bl, ' '
  148.         call    print_character
  149.  
  150.         popa
  151.         ret
  152. end if