Subversion Repositories Kolibri OS

Rev

Rev 7507 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6582 nisargshah 1
SYS_COL  = 0xe6e6e6
2
BT_COL   = 0xcccccc
3
STR_COL  = 0x595959 ;0x000000
4
 
7464 leency 5
WIN_X = 320
6
WIN_Y = 300
7
WIN_W = 390
8
WIN_H = 230
9
 
7959 leency 10
PAD = 28 ; padding between editboxes
7464 leency 11
 
6582 nisargshah 12
;;================================================================================================;;
13
login_gui: ;//////////////////////////////////////////////////////////////////////////////////////;;
14
;;------------------------------------------------------------------------------------------------;;
15
;? Login GUI-specific functions                                                                   ;;
16
;;------------------------------------------------------------------------------------------------;;
17
;> none                                                                                           ;;
18
;;------------------------------------------------------------------------------------------------;;
19
;< none                                                                                           ;;
20
;;================================================================================================;;
21
 
22
    ; TODO: print error strings (wrong user, pass, etc.)
23
 
24
  .server_addr:
25
        mov     [initial_login], 1
26
 
27
  .get_username:
28
        ; in case of error when either login_gui.server_addr or
29
        ; login_gui.get_username is called, should resize window
7464 leency 30
        mcall   67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
6582 nisargshah 31
 
32
  .redraw:
33
        call    .draw
34
        jmp     .still
7465 leency 35
 
36
  .draw_editboxes:
37
        stdcall [edit_box_draw], edit_usr
38
        stdcall [edit_box_draw], edit_pass
39
        stdcall [edit_box_draw], edit_server
40
        stdcall [edit_box_draw], edit_port
41
        stdcall [edit_box_draw], edit_path
42
		ret
6582 nisargshah 43
 
44
 
45
  align 4
46
  .draw:
47
        mcall   12, 1
7489 leency 48
        mcall   48, 3, sc, 40
49
        edit_boxes_set_sys_color edit_usr,editboxes_end,sc
50
        mov     edx, 0x34000000
51
        or      edx, [sc.work]
52
        mcall   0, , , , 0x805080DD, str_title
6582 nisargshah 53
 
7465 leency 54
		call    .draw_editboxes
6582 nisargshah 55
 
56
        ; draw "connect" button
7489 leency 57
        mcall   8, <162,65>, <150,25>, 2, [sc.work_button]
6582 nisargshah 58
 
59
        ; draw strings
7489 leency 60
        mov     ecx, 0x90000000
61
        or      ecx, [sc.work_text]
62
        mcall   4, <3,      8>, , gui_str_usr
7959 leency 63
        mcall    , <3,PAD*1+8>, , gui_str_pass
64
        mcall    , <3,PAD*2+8>, , gui_str_server
65
        mcall    , <3,PAD*3+8>, , gui_str_port
66
        mcall    , <3,PAD*4+8>, , gui_str_path
7489 leency 67
 
68
		mov     ecx, 0x90000000
69
        or      ecx, [sc.work_button_text]
70
        mcall    , <167,155>, , gui_str_connect
71
 
72
		mcall    , <3,185>, 0xb0ff0000, [str_error_addr]
73
		add     ebx, 1*65536
74
		mcall
6582 nisargshah 75
        mov     [str_error_addr], gui_str_null ; reset error string address
76
 
77
        mcall   12, 2
78
        ret
79
 
80
  align 4
81
  .still:
82
        mcall    10     ; wait for event
83
        dec      eax
84
        jz       .redraw
85
        dec      eax
86
        jz       .key
87
        dec      eax
88
        jz       .button
89
 
90
        stdcall [edit_box_mouse], edit_usr
91
        stdcall [edit_box_mouse], edit_pass
92
        stdcall [edit_box_mouse], edit_server
93
        stdcall [edit_box_mouse], edit_port
94
        stdcall [edit_box_mouse], edit_path
95
 
96
        jmp     .still
97
 
98
  .button:
99
        mcall   17
100
 
101
        dec     ah
102
        jz      .exit
103
 
104
        dec     ah   ; 'Connect' button clicked
7489 leency 105
        jz      .connect
6582 nisargshah 106
 
107
        jmp     .still
108
 
109
  .key:
110
        mcall   2
111
 
7464 leency 112
        cmp     ah,13
7489 leency 113
        je      .connect
7464 leency 114
 
115
        cmp     ah,9
116
        je      .tab
117
 
6582 nisargshah 118
        stdcall [edit_box_key], edit_usr
119
        stdcall [edit_box_key], edit_pass
120
        stdcall [edit_box_key], edit_server
121
        stdcall [edit_box_key], edit_port
122
        stdcall [edit_box_key], edit_path
123
 
124
        jmp     .still
7489 leency 125
 
126
  .connect:
7959 leency 127
		mcall   67, 35, 20, 830, 555 ; resize to main gui window's coordinates
7489 leency 128
        cmp     [param_server_addr], 0
129
		jne     gui.main
130
 
131
        mov     [str_error_addr], gui_str_no_srvr
132
        jmp     .redraw
133
 
6582 nisargshah 134
  .error:
135
        mov     [str_error_addr], gui_str_error
136
        jmp     .server_addr
137
 
138
  .exit:
139
        jmp     gui.exit
140
 
7464 leency 141
  .tab:
7465 leency 142
        test word [edit_usr.flags],ed_focus
143
		je @f
144
		sub     word [edit_usr.flags],ed_focus
145
		add     word [edit_pass.flags],ed_focus
146
		jmp     .tab_end
147
  @@:
148
        test word [edit_pass.flags],ed_focus
149
		je @f
150
		sub     word [edit_pass.flags],ed_focus
151
		add     word [edit_server.flags],ed_focus
152
		jmp     .tab_end
153
  @@:
154
        test word [edit_server.flags],ed_focus
155
		je @f
156
		sub     word [edit_server.flags],ed_focus
157
		add     word [edit_port.flags],ed_focus
158
		jmp     .tab_end
159
  @@:
160
        test word [edit_port.flags],ed_focus
161
		je @f
162
		sub     word [edit_port.flags],ed_focus
163
		add     word [edit_path.flags],ed_focus
164
		jmp     .tab_end
165
  @@:
166
        test word [edit_path.flags],ed_focus
167
		je @f
168
		sub     word [edit_path.flags],ed_focus
169
		add     word [edit_usr.flags],ed_focus
7507 leency 170
		jmp     .tab_end
171
  @@:
172
		add     word [edit_usr.flags],ed_focus
7465 leency 173
 
174
	.tab_end:
175
	    call    .draw_editboxes
7464 leency 176
        jmp     .still
6582 nisargshah 177
 
7465 leency 178
;=========================================================
179
;DATA AREA
180
;=========================================================
181
 
6582 nisargshah 182
gui_str_connect db 'Connect',0
183
gui_str_usr     db 'Username:',0
184
gui_str_pass    db 'Password:',0
185
gui_str_server  db 'Server:',0
186
gui_str_port    db 'Port:',0
187
gui_str_path    db 'Path:',0
7489 leency 188
gui_str_error   db 'Error! Check log file for details',0
7490 leency 189
gui_str_no_srvr db 'Error! Please set server address',0
6582 nisargshah 190
gui_str_null    db ' ',0
191
 
192
str_error_addr  dd gui_str_null
193
 
194
; login window components
7959 leency 195
edit_usr    edit_box 300,75,5,      0xffffff,0x94AECE,0,0xAABBCC,0x10000000,64,param_user,mouse_dd,ed_focus,9,9
196
edit_pass   edit_box 300,75,PAD+5,  0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_password,mouse_dd,ed_pass
197
edit_server edit_box 300,75,PAD*2+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,1024,param_server_addr,mouse_dd,0,13,13
198
edit_port   edit_box 50, 75,PAD*3+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_port,mouse_dd,ed_figure_only
199
edit_path   edit_box 300,75,PAD*4+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_path,mouse_dd,0
7489 leency 200
editboxes_end:
6582 nisargshah 201
 
7489 leency 202
mouse_dd rd 1