Subversion Repositories Kolibri OS

Rev

Rev 7464 | Rev 7489 | Go to most recent revision | 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
 
10
pad = 28 ; padding between editboxes
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
7464 leency 48
        mcall   0, , , 0x34000000+SYS_COL, 0x805080DD, str_title
6582 nisargshah 49
 
7465 leency 50
		call    .draw_editboxes
6582 nisargshah 51
 
52
        ; draw "connect" button
7464 leency 53
        mcall   8, <162,65>, <150,25>, 2, BT_COL
6582 nisargshah 54
 
55
        ; draw strings
7464 leency 56
        mcall   4, <3,      8>, 0xb0000000, gui_str_usr
57
        mcall    , <3,pad*1+8>,           , gui_str_pass
58
        mcall    , <3,pad*2+8>,           , gui_str_server
59
        mcall    , <3,pad*3+8>,           , gui_str_port
60
        mcall    , <3,pad*4+8>,           , gui_str_path
61
        mcall    , <167,155>, 0xb0000000+STR_COL, gui_str_connect
62
        mcall    , <3,115>, 0xb0ff0000, [str_error_addr]
6582 nisargshah 63
        mov     [str_error_addr], gui_str_null ; reset error string address
64
 
65
        mcall   12, 2
66
        ret
67
 
68
  align 4
69
  .still:
70
        mcall    10     ; wait for event
71
        dec      eax
72
        jz       .redraw
73
        dec      eax
74
        jz       .key
75
        dec      eax
76
        jz       .button
77
 
78
        stdcall [edit_box_mouse], edit_usr
79
        stdcall [edit_box_mouse], edit_pass
80
        stdcall [edit_box_mouse], edit_server
81
        stdcall [edit_box_mouse], edit_port
82
        stdcall [edit_box_mouse], edit_path
83
 
84
        jmp     .still
85
 
86
  .button:
87
        mcall   17
88
 
89
        dec     ah
90
        jz      .exit
91
 
92
        dec     ah   ; 'Connect' button clicked
93
        jz      gui.main
94
 
95
        jmp     .still
96
 
97
  .key:
98
        mcall   2
99
 
7464 leency 100
        cmp     ah,13
101
        je      gui.main
102
 
103
        cmp     ah,9
104
        je      .tab
105
 
6582 nisargshah 106
        stdcall [edit_box_key], edit_usr
107
        stdcall [edit_box_key], edit_pass
108
        stdcall [edit_box_key], edit_server
109
        stdcall [edit_box_key], edit_port
110
        stdcall [edit_box_key], edit_path
111
 
112
        jmp     .still
113
 
114
  .error:
115
        mov     [str_error_addr], gui_str_error
116
        jmp     .server_addr
117
 
118
  .exit:
119
        jmp     gui.exit
120
 
7464 leency 121
  .tab:
7465 leency 122
        test word [edit_usr.flags],ed_focus
123
		je @f
124
		sub     word [edit_usr.flags],ed_focus
125
		add     word [edit_pass.flags],ed_focus
126
		jmp     .tab_end
127
  @@:
128
        test word [edit_pass.flags],ed_focus
129
		je @f
130
		sub     word [edit_pass.flags],ed_focus
131
		add     word [edit_server.flags],ed_focus
132
		jmp     .tab_end
133
  @@:
134
        test word [edit_server.flags],ed_focus
135
		je @f
136
		sub     word [edit_server.flags],ed_focus
137
		add     word [edit_port.flags],ed_focus
138
		jmp     .tab_end
139
  @@:
140
        test word [edit_port.flags],ed_focus
141
		je @f
142
		sub     word [edit_port.flags],ed_focus
143
		add     word [edit_path.flags],ed_focus
144
		jmp     .tab_end
145
  @@:
146
        test word [edit_path.flags],ed_focus
147
		je @f
148
		sub     word [edit_path.flags],ed_focus
149
		add     word [edit_usr.flags],ed_focus
150
		;jmp     .tab_end
151
 
152
	.tab_end:
153
	    call    .draw_editboxes
7464 leency 154
        jmp     .still
6582 nisargshah 155
 
7465 leency 156
;=========================================================
157
;DATA AREA
158
;=========================================================
159
 
6582 nisargshah 160
gui_str_connect db 'Connect',0
161
gui_str_usr     db 'Username:',0
162
gui_str_pass    db 'Password:',0
163
gui_str_server  db 'Server:',0
164
gui_str_port    db 'Port:',0
165
gui_str_path    db 'Path:',0
166
gui_str_error   db 'ERROR! Check log file for details',0
167
gui_str_null    db ' ',0
168
 
169
str_error_addr  dd gui_str_null
170
 
171
; login window components
7464 leency 172
edit_usr    edit_box 300,75,5,      0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_user,mouse_dd,ed_focus
173
edit_pass   edit_box 300,75,pad+5,  0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_password,mouse_dd,ed_pass
174
edit_server edit_box 300,75,pad*2+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_server_addr,mouse_dd,0
175
edit_port   edit_box 50, 75,pad*3+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_port,mouse_dd,ed_figure_only
176
edit_path   edit_box 300,75,pad*4+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_path,mouse_dd,0
6582 nisargshah 177
 
178
mouse_dd rd 1