Subversion Repositories Kolibri OS

Rev

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

Rev 5663 Rev 5668
Line 10... Line 10...
10
;;          GNU GENERAL PUBLIC LICENSE                             ;;
10
;;          GNU GENERAL PUBLIC LICENSE                             ;;
11
;;             Version 2, June 1991                                ;;
11
;;             Version 2, June 1991                                ;;
12
;;                                                                 ;;
12
;;                                                                 ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 14... Line 14...
14
 
14
 
15
logon:
15
draw_gui:
Line 16... Line 16...
16
        mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
16
        mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
17
 
17
 
18
  .redraw:
-
 
19
        mcall   12, 1           ; start window draw
18
  .redraw:
20
        pusha
19
        mcall   12, 1                           ; start window draw
21
                                                ; DRAW WINDOW
20
                                                ; DRAW WINDOW
22
        xor     eax, eax                        ; function 0 _logon: define and draw window
21
        xor     eax, eax                        ; function 0 _logon: define and draw window
23
        mov     ebx, 160 shl 16 + 330           ; [x start]:[x size]
22
        mov     ebx, 160 shl 16 + 330           ; [x start]:[x size]
24
        mov     ecx, 160 shl 16 + 100           ; [y start]:[y size]
23
        mov     ecx, 160 shl 16 + 100           ; [y start]:[y size]
25
        mov     edx, 0x34DDDDDD                 ; color of work area RRGGBB
24
        mov     edx, 0x34DDDDDD                 ; color of work area RRGGBB
Line -... Line 25...
-
 
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
26
        mov     edi, name                       ; WINDOW LABEL
32
        xor     ecx, ecx
-
 
33
        mov     edx, serverstr
-
 
34
        mov     esi, userstr-serverstr
-
 
35
        mcall   4                               ; "server" text
27
        mcall
36
 
28
 
37
        invoke  edit_box_draw, URLbox           ; Server textbox
29
        mov     eax, 8                          ; LOGON BUTTON
38
 
30
        mov     ebx, 220 shl 16 + 85
39
        mov     ebx, 220 shl 16 + 85
31
        mov     ecx, 47 shl 16 + 16
40
        mov     ecx, 47 shl 16 + 16
Line -... Line 41...
-
 
41
        mov     edx, 2
32
        mov     edx, 2
42
        mov     esi, 0xCCCCCC
33
        mov     esi, 0xCCCCCC
43
        mcall   8                               ; Connect button
-
 
44
 
Line 34... Line -...
34
        mcall
-
 
35
 
-
 
36
        cmp     byte[mode], 0
45
        mov     ebx, 240 shl 16 + 49
37
        je      .servermode
-
 
38
 
-
 
39
        mov     eax, 4                          ; function 4 write text to window
-
 
40
        mov     ebx, 25 shl 16 + 15             ; [x start]:[y start]
-
 
41
        xor     ecx, ecx
-
 
42
        mov     edx, userstr                    ; pointer to text beginning
-
 
43
        mov     esi, passstr-userstr            ; text length
-
 
44
        mcall
-
 
Line -... Line 46...
-
 
46
        mov     edx, connectstr
-
 
47
        mov     esi, loginstr-connectstr
45
 
48
        mcall   4                               ; Connect button text
Line 46... Line -...
46
        add     bl, 19
-
 
47
        mov     edx, passstr                    ; pointer to text beginning
-
 
48
        mov     esi, connectstr-passstr         ; text length
49
 
49
        mcall
50
        jmp     .redraw_done
50
 
51
 
51
        jmp     .drawtherest
52
  @@:
52
 
-
 
53
   .servermode:
-
 
54
        mov     eax, 4                          ; function 4 write text to window
53
        cmp     [status], STATUS_LOGIN
Line 55... Line 54...
55
        mov     ebx, 25 shl 16 + 15             ; [x start] *65536 + [y start]
54
        jne     @f
56
        xor     ecx, ecx
-
 
57
        mov     edx, serverstr                  ; pointer to text beginning
55
 
58
        mov     esi, userstr-serverstr          ; text length
56
        mov     ebx, 25 shl 16 + 15
59
        mcall
57
        xor     ecx, ecx
Line -... Line 58...
-
 
58
        mov     edx, userstr
-
 
59
        mov     esi, passstr-userstr
60
 
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
61
        invoke  edit_box_draw, URLbox
75
        mov     esi, loginstr_e-loginstr
-
 
76
        mcall   4                               ; Login button text
-
 
77
 
-
 
78
        jmp     .redraw_done
-
 
79
 
-
 
80
  @@:
62
 
81
        mov     ebx, 25 shl 16 + 15
Line 63... Line 82...
63
   .drawtherest:
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
 
64
        mov     ebx, 240 shl 16 + 49            ; [x start] *65536 + [y start]
88
  .redraw_done:
65
        mov     edx, connectstr                 ; pointer to text beginning
89
        mov     [update_gui], 0
66
        mov     esi, connect_e-connectstr       ; text length
90
        mcall   12, 2
67
        mcall
91
 
68
 
92
  .loop:
69
        popa
93
        cmp     [update_gui], 0
70
        inc     ebx
94
        jne     .redraw
71
        mcall
95
        cmp     [status], STATUS_CONNECTED
72
 
96
        je      .connected
73
  .loop:
97
 
Line -... Line 98...
-
 
98
        mcall   23, 10                          ; wait for event
-
 
99
        dec     eax                             ; redraw request ?
-
 
100
        jz      .redraw
74
        mcall   10                      ; wait for event
101
        dec     eax                             ; key in buffer ?
75
        dec     eax             ; redraw request ?
102
        jz      .key
Line -... Line 103...
-
 
103
        dec     eax                             ; button in buffer ?
-
 
104
        jz      .btn
76
        jz      .redraw
105
        sub     eax, 3
77
        dec     eax             ; key in buffer ?
106
        jz      .mouse
78
        jz      .key
107
        jmp     .loop
79
        dec     eax             ; button in buffer ?
108
 
80
        jz      .btn
109
  .connected:
-
 
110
        ret
81
        sub     eax, 3
111
 
Line 82... Line -...
82
        jz      .mouse
-
 
83
        jmp     .loop
-
 
84
 
-
 
85
  .key:                         ; key event handler
-
 
86
        mcall   2               ; read key
-
 
87
 
112
  .key:                                         ; key event handler
88
        test    [URLbox.flags], ed_focus
113
        mcall   2                               ; read key
Line 89... Line 114...
89
        jz      mainloop
114
 
90
        cmp     ah, 13          ; enter (return) key
115
        cmp     [status], STATUS_INITIAL
-
 
116
        jne     @f
-
 
117
        test    [URLbox.flags], ed_focus
91
        je      .go
118
        jz      mainloop
92
        invoke  edit_box_key, URLbox
119
        cmp     ah, 13                          ; enter (return) key
Line 93... Line 120...
93
        jmp     .loop
120
        je      .connect
Line -... Line 121...
-
 
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:
94
 
138
        mov     eax, [URLbox.pos]
95
  .go:
139
        mov     byte[serveraddr+eax], 0
-
 
140
 
-
 
141
; Create network thread
96
        mov     eax, [URLbox.pos]
142
        mcall   51, 1, thread_start, thread_stack
97
        mov     byte[serveraddr+eax], 0
143
        cmp     eax, -1
98
        ret
144
        jne     @f
Line 99... Line 145...
99
 
145
        mov     [status], STATUS_THREAD_ERR
100
  .btn:
146
        inc     [update_gui]
101
        mcall   17              ; get id
-
 
102
 
-
 
103
        cmp     ah, 1           ; close ?
-
 
104
        jz      .close
-
 
105
        cmp     ah, 2           ; logon ?
-
 
106
        je      .go
-
 
107
 
-
 
108
        jmp     .loop
-
 
109
 
-
 
110
  .mouse:
-
 
111
        mcall   23
-
 
112
        invoke  edit_box_mouse, URLbox
-
 
113
 
-
 
114
        jmp     .loop
-
 
115
 
-
 
116
  .close:
-
 
117
        mcall   -1
-
 
118
 
-