Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
5663 hidnplayr 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3545 hidnplayr 14
 
5668 hidnplayr 15
draw_gui:
5663 hidnplayr 16
        mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
3545 hidnplayr 17
 
5663 hidnplayr 18
  .redraw:
5668 hidnplayr 19
        mcall   12, 1                           ; start window draw
5663 hidnplayr 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
3545 hidnplayr 27
 
5668 hidnplayr 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
 
5663 hidnplayr 39
        mov     ebx, 220 shl 16 + 85
40
        mov     ecx, 47 shl 16 + 16
41
        mov     edx, 2
42
        mov     esi, 0xCCCCCC
5668 hidnplayr 43
        mcall   8                               ; Connect button
3545 hidnplayr 44
 
5668 hidnplayr 45
        mov     ebx, 240 shl 16 + 49
46
        mov     edx, connectstr
47
        mov     esi, loginstr-connectstr
48
        mcall   4                               ; Connect button text
3545 hidnplayr 49
 
5668 hidnplayr 50
        jmp     .redraw_done
51
 
52
  @@:
53
        cmp     [status], STATUS_LOGIN
54
        jne     @f
55
 
56
        mov     ebx, 25 shl 16 + 15
5663 hidnplayr 57
        xor     ecx, ecx
5668 hidnplayr 58
        mov     edx, userstr
59
        mov     esi, passstr-userstr
60
        mcall   4                               ; "user" text
3545 hidnplayr 61
 
5663 hidnplayr 62
        add     bl, 19
5668 hidnplayr 63
        mov     edx, passstr
64
        mov     esi, connectstr-passstr         ; "password" text
5663 hidnplayr 65
        mcall
3545 hidnplayr 66
 
5668 hidnplayr 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
3545 hidnplayr 72
 
5668 hidnplayr 73
        mov     ebx, 240 shl 16 + 49
74
        mov     edx, loginstr
75
        mov     esi, loginstr_e-loginstr
76
        mcall   4                               ; Login button text
3545 hidnplayr 77
 
5668 hidnplayr 78
        jmp     .redraw_done
3545 hidnplayr 79
 
5668 hidnplayr 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
3545 hidnplayr 87
 
5668 hidnplayr 88
  .redraw_done:
89
        mov     [update_gui], 0
90
        mcall   12, 2
3545 hidnplayr 91
 
5663 hidnplayr 92
  .loop:
5668 hidnplayr 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 ?
5663 hidnplayr 100
        jz      .redraw
5668 hidnplayr 101
        dec     eax                             ; key in buffer ?
5663 hidnplayr 102
        jz      .key
5668 hidnplayr 103
        dec     eax                             ; button in buffer ?
5663 hidnplayr 104
        jz      .btn
105
        sub     eax, 3
106
        jz      .mouse
107
        jmp     .loop
3545 hidnplayr 108
 
5668 hidnplayr 109
  .connected:
110
        ret
3545 hidnplayr 111
 
5668 hidnplayr 112
  .key:                                         ; key event handler
113
        mcall   2                               ; read key
114
 
115
        cmp     [status], STATUS_INITIAL
116
        jne     @f
5663 hidnplayr 117
        test    [URLbox.flags], ed_focus
118
        jz      mainloop
5668 hidnplayr 119
        cmp     ah, 13                          ; enter (return) key
120
        je      .connect
5663 hidnplayr 121
        invoke  edit_box_key, URLbox
5668 hidnplayr 122
  @@:
5663 hidnplayr 123
        jmp     .loop
3545 hidnplayr 124
 
5663 hidnplayr 125
  .btn:
5668 hidnplayr 126
        mcall   17                              ; get id
3545 hidnplayr 127
 
5668 hidnplayr 128
        cmp     ah, 1                           ; close ?
5663 hidnplayr 129
        jz      .close
5668 hidnplayr 130
        cmp     ah, 2                           ; connect ?
131
        je      .connect
132
        cmp     ah, 3                           ; login ?
133
        je      .login
3545 hidnplayr 134
 
5663 hidnplayr 135
        jmp     .loop
3545 hidnplayr 136
 
5668 hidnplayr 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
 
5663 hidnplayr 154
  .mouse:
155
        mcall   23
5668 hidnplayr 156
        cmp     [status], STATUS_INITIAL
157
        jne     @f
5663 hidnplayr 158
        invoke  edit_box_mouse, URLbox
5668 hidnplayr 159
  @@:
5663 hidnplayr 160
        jmp     .loop
3545 hidnplayr 161
 
5663 hidnplayr 162
  .close:
5668 hidnplayr 163
        mcall   -1