Subversion Repositories Kolibri OS

Rev

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, 10
  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_find:                            ; esi is ptr to windowname
  67.  
  68. ;        mov     [current_window],
  69. ;        call    reset_gui
  70.  
  71.   .fail:
  72.         ret
  73.  
  74.  
  75.  
  76.  
  77. window_refresh:
  78.  
  79. ; set the correct buffer pointers       ; FIXME: what is it good for?
  80.         mov     eax, [textbox_width]    ;
  81.         imul    eax, 11                 ;
  82.         mov     [pos], eax              ;
  83.  
  84.         mov     eax, [window_open]
  85.         mov     eax, [eax + window.data_ptr]
  86.         add     eax, window_data.text
  87.         mov     [text_start], eax
  88.  
  89.         ret
  90.  
  91.  
  92. print_text:                             ; eax = start ptr
  93.                                         ; dl = end char
  94.         pusha
  95.   ptr2:
  96.         mov     bl, [eax]
  97.  
  98.         cmp     bl, dl
  99.         je      ptr_ret
  100.         cmp     bl, 0
  101.         je      ptr_ret
  102.         call    print_character
  103.  
  104.         inc     eax
  105.         jmp     ptr2
  106.  
  107.   ptr_ret:
  108.         popa
  109.         ret
  110.  
  111.  
  112. print_text2:                            ; esi = ptr to ASCIIZ string
  113.  
  114.         pusha
  115.   .loop:
  116.         lodsb
  117.         test    al, al
  118.         jz      .done
  119.         mov     bl, al
  120.         call    print_character
  121.         jmp     .loop
  122.  
  123.   .done:
  124.         popa
  125.         ret
  126.  
  127.  
  128. if TIMESTAMP
  129. print_timestamp:
  130.  
  131.         pusha
  132.         mcall   3                       ; get system time
  133.  
  134.         mov     bl, '['
  135.         call    print_character
  136.         mov     ecx, TIMESTAMP
  137.   .loop:
  138.         mov     bl, al
  139.         shr     bl, 4
  140.         add     bl, '0'
  141.         call    print_character
  142.  
  143.         mov     bl, al
  144.         and     bl, 0x0f
  145.         add     bl, '0'
  146.         call    print_character
  147.  
  148.         dec     ecx
  149.         jz      .done
  150.  
  151.         mov     bl, ':'
  152.         call    print_character
  153.         shr     eax, 8
  154.         jmp     .loop
  155.   .done:
  156.         mov     bl, ']'
  157.         call    print_character
  158.         mov     bl, ' '
  159.         call    print_character
  160.  
  161.         popa
  162.         ret
  163. end if