Subversion Repositories Kolibri OS

Rev

Rev 5663 | Rev 5670 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                 ;;
  3. ;; Copyright (C) KolibriOS team 2010-2015. All rights reserved.    ;;
  4. ;; Distributed under terms of the GNU General Public License       ;;
  5. ;;                                                                 ;;
  6. ;;  VNC client for KolibriOS                                       ;;
  7. ;;                                                                 ;;
  8. ;;  Written by hidnplayr@kolibrios.org                             ;;
  9. ;;                                                                 ;;
  10. ;;          GNU GENERAL PUBLIC LICENSE                             ;;
  11. ;;             Version 2, June 1991                                ;;
  12. ;;                                                                 ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15. draw_gui:
  16.         mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
  17.  
  18.   .redraw:
  19.         mcall   12, 1                           ; start window draw
  20.                                                 ; DRAW WINDOW
  21.         xor     eax, eax                        ; function 0 _logon: define and draw window
  22.         mov     ebx, 160 shl 16 + 330           ; [x start]:[x size]
  23.         mov     ecx, 160 shl 16 + 100           ; [y start]:[y size]
  24.         mov     edx, 0x34DDDDDD                 ; color of work area RRGGBB
  25.         mov     edi, name                       ; WINDOW LABEL
  26.         mcall
  27.  
  28.         cmp     [status], STATUS_INITIAL
  29.         jne     @f
  30.  
  31.         mov     ebx, 25 shl 16 + 15
  32.         xor     ecx, ecx
  33.         mov     edx, serverstr
  34.         mov     esi, userstr-serverstr
  35.         mcall   4                               ; "server" text
  36.  
  37.         invoke  edit_box_draw, URLbox           ; Server textbox
  38.  
  39.         mov     ebx, 220 shl 16 + 85
  40.         mov     ecx, 47 shl 16 + 16
  41.         mov     edx, 2
  42.         mov     esi, 0xCCCCCC
  43.         mcall   8                               ; Connect button
  44.  
  45.         mov     ebx, 240 shl 16 + 49
  46.         mov     edx, connectstr
  47.         mov     esi, loginstr-connectstr
  48.         mcall   4                               ; Connect button text
  49.  
  50.         jmp     .redraw_done
  51.  
  52.   @@:
  53.         cmp     [status], STATUS_LOGIN
  54.         jne     @f
  55.  
  56.         mov     ebx, 25 shl 16 + 15
  57.         xor     ecx, ecx
  58.         mov     edx, userstr
  59.         mov     esi, passstr-userstr
  60.         mcall   4                               ; "user" text
  61.  
  62.         add     bl, 19
  63.         mov     edx, passstr
  64.         mov     esi, connectstr-passstr         ; "password" text
  65.         mcall
  66.  
  67.         mov     ebx, 220 shl 16 + 85
  68.         mov     ecx, 47 shl 16 + 16
  69.         mov     edx, 3
  70.         mov     esi, 0xCCCCCC
  71.         mcall   8                               ; Login button
  72.  
  73.         mov     ebx, 240 shl 16 + 49
  74.         mov     edx, loginstr
  75.         mov     esi, loginstr_e-loginstr
  76.         mcall   4                               ; Login button text
  77.  
  78.         jmp     .redraw_done
  79.  
  80.   @@:
  81.         mov     ebx, 25 shl 16 + 15
  82.         mov     ecx, 0x80ca0000                 ; red ASCIIZ string
  83.         mov     edx, [status]
  84.         sub     edx, 10
  85.         mov     edx, [err_msg+4*edx]
  86.         mcall   4                               ; print error message to window
  87.  
  88.   .redraw_done:
  89.         mov     [update_gui], 0
  90.         mcall   12, 2
  91.  
  92.   .loop:
  93.         cmp     [update_gui], 0
  94.         jne     .redraw
  95.         cmp     [status], STATUS_CONNECTED
  96.         je      .connected
  97.  
  98.         mcall   23, 10                          ; wait for event
  99.         dec     eax                             ; redraw request ?
  100.         jz      .redraw
  101.         dec     eax                             ; key in buffer ?
  102.         jz      .key
  103.         dec     eax                             ; button in buffer ?
  104.         jz      .btn
  105.         sub     eax, 3
  106.         jz      .mouse
  107.         jmp     .loop
  108.  
  109.   .connected:
  110.         ret
  111.  
  112.   .key:                                         ; key event handler
  113.         mcall   2                               ; read key
  114.  
  115.         cmp     [status], STATUS_INITIAL
  116.         jne     @f
  117.         test    [URLbox.flags], ed_focus
  118.         jz      mainloop
  119.         cmp     ah, 13                          ; enter (return) key
  120.         je      .connect
  121.         invoke  edit_box_key, URLbox
  122.   @@:
  123.         jmp     .loop
  124.  
  125.   .btn:
  126.         mcall   17                              ; get id
  127.  
  128.         cmp     ah, 1                           ; close ?
  129.         jz      .close
  130.         cmp     ah, 2                           ; connect ?
  131.         je      .connect
  132.         cmp     ah, 3                           ; login ?
  133.         je      .login
  134.  
  135.         jmp     .loop
  136.  
  137.   .connect:
  138.         mov     eax, [URLbox.pos]
  139.         mov     byte[serveraddr+eax], 0
  140.  
  141. ; Create network thread
  142.         mcall   51, 1, thread_start, thread_stack
  143.         cmp     eax, -1
  144.         jne     @f
  145.         mov     [status], STATUS_THREAD_ERR
  146.         inc     [update_gui]
  147.   @@:
  148.         jmp     .loop
  149.  
  150.   .login:
  151.   ;;;
  152.         ret
  153.  
  154.   .mouse:
  155.         mcall   23
  156.         cmp     [status], STATUS_INITIAL
  157.         jne     @f
  158.         invoke  edit_box_mouse, URLbox
  159.   @@:
  160.         jmp     .loop
  161.  
  162.   .close:
  163.         mcall   -1