Subversion Repositories Kolibri OS

Rev

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

Rev 5693 Rev 5720
Line 24... Line 24...
24
        mov     edx, 0x34DDDDDD                 ; color of work area RRGGBB
24
        mov     edx, 0x34DDDDDD                 ; color of work area RRGGBB
25
        mov     edi, name                       ; WINDOW LABEL
25
        mov     edi, name                       ; WINDOW LABEL
26
        mcall
26
        mcall
Line 27... Line 27...
27
 
27
 
28
        cmp     [status], STATUS_CONNECTING
28
        cmp     [status], STATUS_CONNECTING
Line 29... Line 29...
29
        ja      @f
29
        ja      .login?
30
 
30
 
31
        mov     ebx, 25 shl 16 + 24
31
        mov     ebx, 25 shl 16 + 24
32
        xor     ecx, ecx
32
        xor     ecx, ecx
33
        mov     edx, serverstr
33
        mov     edx, serverstr
Line 34... Line 34...
34
        mov     esi, userstr-serverstr
34
        mov     esi, userstr-serverstr
Line 35... Line 35...
35
        mcall   4                               ; "server" text
35
        mcall   4                               ; "server" text
-
 
36
 
-
 
37
        invoke  edit_box_draw, URLbox           ; Server textbox
-
 
38
 
-
 
39
        cmp     [status], STATUS_CONNECTING
-
 
40
        jne     @f
-
 
41
 
-
 
42
        mov     ebx, 220 shl 16 + 85
-
 
43
        mov     ecx, 47 shl 16 + 16
-
 
44
        mov     edx, 4
-
 
45
        mov     esi, 0xCCCCCC
-
 
46
        mcall   8                               ; Cancel button
-
 
47
 
-
 
48
        mov     ebx, 240 shl 16 + 52
-
 
49
        mov     edx, cancelstr
-
 
50
        mov     esi, okstr-cancelstr
-
 
51
        mcall   4                               ; Cancel button text
-
 
52
 
36
 
53
        jmp     .redraw_done
Line 37... Line 54...
37
        invoke  edit_box_draw, URLbox           ; Server textbox
54
 
38
 
55
  @@:
39
        cmp     [status], STATUS_INITIAL
56
        cmp     [status], STATUS_CONNECT
Line 50... Line 67...
50
        mov     esi, loginstr-connectstr
67
        mov     esi, loginstr-connectstr
51
        mcall   4                               ; Connect button text
68
        mcall   4                               ; Connect button text
Line 52... Line 69...
52
 
69
 
Line 53... Line 70...
53
        jmp     .redraw_done
70
        jmp     .redraw_done
54
 
71
 
55
  @@:
72
  .login?:
Line 56... Line 73...
56
        cmp     [status], STATUS_LOGIN
73
        cmp     [status], STATUS_LOGIN
57
        ja      @f
74
        ja      @f
Line 79... Line 96...
79
        mov     esi, 0xCCCCCC
96
        mov     esi, 0xCCCCCC
80
        mcall   8                               ; Login button
97
        mcall   8                               ; Login button
Line 81... Line 98...
81
 
98
 
82
        mov     ebx, 240 shl 16 + 52
99
        mov     ebx, 240 shl 16 + 52
83
        mov     edx, loginstr
100
        mov     edx, loginstr
84
        mov     esi, loginstr_e-loginstr
101
        mov     esi, cancelstr-loginstr
Line -... Line 102...
-
 
102
        mcall   4                               ; Login button text
-
 
103
 
-
 
104
        mov     ebx, 120 shl 16 + 85
-
 
105
        mov     ecx, 47 shl 16 + 16
-
 
106
        mov     edx, 4
-
 
107
        mov     esi, 0xCCCCCC
-
 
108
        mcall   8                               ; Cancel button
-
 
109
 
-
 
110
        mov     ebx, 140 shl 16 + 52
-
 
111
        mov     edx, cancelstr
-
 
112
        mov     esi, okstr-cancelstr
85
        mcall   4                               ; Login button text
113
        mcall   4                               ; Cancel button text
Line 86... Line 114...
86
 
114
 
87
        jmp     .redraw_done
115
        jmp     .redraw_done
88
 
116
 
Line 89... Line 117...
89
  @@:
117
  @@:
90
        cmp     [status], STATUS_DISCONNECTED
118
        cmp     [status], STATUS_DISCONNECTED
91
        jb      .redraw_done
119
        jb      .redraw_done
92
 
120
 
93
        mov     ebx, 25 shl 16 + 15
121
        mov     ebx, 15 shl 16 + 10
-
 
122
        mov     ecx, 0x00ca0000                 ; red ASCIIZ string
-
 
123
        mov     edx, [status]
-
 
124
        sub     edx, 10
-
 
125
        mov     edx, [err_msg+4*edx]
-
 
126
  .restart:
-
 
127
        xor     esi, esi
-
 
128
  .pr_loop:
-
 
129
        cmp     byte[edx+esi], 0
-
 
130
        je      .last
-
 
131
        cmp     byte[edx+esi], 0x0a
-
 
132
        je      .print
-
 
133
        inc     esi
-
 
134
        jmp     .pr_loop
-
 
135
  .print:
-
 
136
        mcall   4
-
 
137
        add     edx, esi
94
        mov     ecx, 0x80ca0000                 ; red ASCIIZ string
138
        inc     edx
Line -... Line 139...
-
 
139
        add     ebx, 10
-
 
140
        jmp     .restart
-
 
141
  .last:
-
 
142
        mcall   4                               ; print error message to window
-
 
143
 
-
 
144
        mov     ebx, 220 shl 16 + 85
-
 
145
        mov     ecx, 47 shl 16 + 16
-
 
146
        mov     edx, 5
-
 
147
        mov     esi, 0xCCCCCC
-
 
148
        mcall   8                               ; OK button
-
 
149
 
95
        mov     edx, [status]
150
        mov     ebx, 256 shl 16 + 52
96
        sub     edx, 10
151
        mov     edx, okstr
97
        mov     edx, [err_msg+4*edx]
152
        mov     esi, okstr_e-okstr
Line 98... Line 153...
98
        mcall   4                               ; print error message to window
153
        mcall   4                               ; OK button text
Line 122... Line 177...
122
        ret
177
        ret
Line 123... Line 178...
123
 
178
 
124
  .key:                                         ; key event handler
179
  .key:                                         ; key event handler
Line 125... Line 180...
125
        mcall   2                               ; read key
180
        mcall   2                               ; read key
126
 
181
 
127
        cmp     [status], STATUS_INITIAL
182
        cmp     [status], STATUS_CONNECT
128
        jne     @f
183
        jne     @f
129
        test    [URLbox.flags], ed_focus
184
        test    [URLbox.flags], ed_focus
130
        jz      mainloop
185
        jz      mainloop
131
        cmp     ah, 13                          ; enter (return) key
186
        cmp     ah, 13                          ; enter (return) key
-
 
187
        je      .connect
132
        je      .connect
188
        invoke  edit_box_key, URLbox
133
        invoke  edit_box_key, URLbox
189
        jmp     .loop
134
  @@:
190
  @@:
135
        cmp     [status], STATUS_REQ_LOGIN
191
        cmp     [status], STATUS_REQ_LOGIN
136
        jne     .loop
192
        jne     @f
137
        cmp     ah, 13                          ; enter (return) key
193
        cmp     ah, 13                          ; enter (return) key
138
        je      .login
194
        je      .login
-
 
195
        invoke  edit_box_key, USERbox
-
 
196
        invoke  edit_box_key, PASSbox
-
 
197
        jmp     .loop
-
 
198
  @@:
-
 
199
        cmp     [status], STATUS_DISCONNECTED
-
 
200
        jb      @f
139
        invoke  edit_box_key, USERbox
201
        cmp     ah, 13
140
        invoke  edit_box_key, PASSbox
202
        je      .ok
Line 141... Line 203...
141
  @@:
203
  @@:
142
        jmp     .loop
204
        jmp     .loop
Line 148... Line 210...
148
        jz      .close
210
        jz      .close
149
        cmp     ah, 2                           ; connect ?
211
        cmp     ah, 2                           ; connect ?
150
        je      .connect
212
        je      .connect
151
        cmp     ah, 3                           ; login ?
213
        cmp     ah, 3                           ; login ?
152
        je      .login
214
        je      .login
-
 
215
        cmp     ah, 4
-
 
216
        je      .cancel
-
 
217
        cmp     ah, 5
-
 
218
        je      .ok
Line 153... Line 219...
153
 
219
 
Line 154... Line 220...
154
        jmp     .loop
220
        jmp     .loop
155
 
221
 
156
  .connect:
222
  .connect:
157
        mov     eax, [URLbox.pos]
-
 
158
        mov     byte[serveraddr+eax], 0
-
 
159
 
223
        mov     eax, [URLbox.pos]
160
        mov     [status], STATUS_CONNECTING
-
 
161
        inc     [update_gui]
-
 
162
 
-
 
163
; Create network thread
-
 
164
        mcall   51, 1, thread_start, thread_stack
-
 
165
        cmp     eax, -1
-
 
166
        jne     @f
-
 
167
        mov     [status], STATUS_THREAD_ERR
-
 
168
;        inc     [update_gui]
224
        mov     byte[serveraddr+eax], 0
Line 169... Line 225...
169
  @@:
225
        call    open_connection
170
        jmp     .loop
226
        jmp     .loop
171
 
227
 
172
  .login:
228
  .login:
Line -... Line 229...
-
 
229
        mov     [status], STATUS_LOGIN
-
 
230
        inc     [update_gui]
-
 
231
        jmp     .loop
-
 
232
 
-
 
233
  .cancel:
-
 
234
        mcall   18, 18, [thread_id]             ; kill thread
-
 
235
  .ok:
-
 
236
        and     [URLbox.flags], not ed_disabled
173
        mov     [status], STATUS_LOGIN
237
        mov     [status], STATUS_CONNECT
174
        inc     [update_gui]
238
        inc     [update_gui]
175
        jmp     .loop
239
        jmp     .loop
176
 
240
 
177
  .mouse:
241
  .mouse:
178
        cmp     [status], STATUS_INITIAL
242
        cmp     [status], STATUS_CONNECT
179
        jne     @f
243
        jne     @f
Line 187... Line 251...
187
        jmp     .loop
251
        jmp     .loop
Line 188... Line 252...
188
 
252
 
189
  .close:
253
  .close:
190
        mov     [status], STATUS_CLOSED
254
        mov     [status], STATUS_CLOSED
191
        mcall   -1
255
        mcall   -1
-
 
256
 
-
 
257
 
-
 
258
open_connection:
-
 
259
 
-
 
260
        or      [URLbox.flags], ed_disabled
-
 
261
        mov     [status], STATUS_CONNECTING
-
 
262
 
-
 
263
; Create network thread
-
 
264
        mcall   51, 1, thread_start, thread_stack
-
 
265
        cmp     eax, -1
-
 
266
        jne     @f
-
 
267
        mov     [status], STATUS_THREAD_ERR
-
 
268
  @@:
-
 
269
        mov     [thread_id], eax
-
 
270
        inc     [update_gui]
-
 
271
 
-
 
272
        ret
192
273