Rev 7489 | Rev 7507 | 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 |
||
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, |
||
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 |
||
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 |
||
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: |
||
127 | cmp [param_server_addr], 0 |
||
128 | jne gui.main |
||
129 | |||
130 | mov [str_error_addr], gui_str_no_srvr |
||
131 | jmp .redraw |
||
132 | |||
6582 | nisargshah | 133 | .error: |
134 | mov [str_error_addr], gui_str_error |
||
135 | jmp .server_addr |
||
136 | |||
137 | .exit: |
||
138 | jmp gui.exit |
||
139 | |||
7464 | leency | 140 | .tab: |
7465 | leency | 141 | test word [edit_usr.flags],ed_focus |
142 | je @f |
||
143 | sub word [edit_usr.flags],ed_focus |
||
144 | add word [edit_pass.flags],ed_focus |
||
145 | jmp .tab_end |
||
146 | @@: |
||
147 | test word [edit_pass.flags],ed_focus |
||
148 | je @f |
||
149 | sub word [edit_pass.flags],ed_focus |
||
150 | add word [edit_server.flags],ed_focus |
||
151 | jmp .tab_end |
||
152 | @@: |
||
153 | test word [edit_server.flags],ed_focus |
||
154 | je @f |
||
155 | sub word [edit_server.flags],ed_focus |
||
156 | add word [edit_port.flags],ed_focus |
||
157 | jmp .tab_end |
||
158 | @@: |
||
159 | test word [edit_port.flags],ed_focus |
||
160 | je @f |
||
161 | sub word [edit_port.flags],ed_focus |
||
162 | add word [edit_path.flags],ed_focus |
||
163 | jmp .tab_end |
||
164 | @@: |
||
165 | test word [edit_path.flags],ed_focus |
||
166 | je @f |
||
167 | sub word [edit_path.flags],ed_focus |
||
168 | add word [edit_usr.flags],ed_focus |
||
169 | ;jmp .tab_end |
||
170 | |||
171 | .tab_end: |
||
172 | call .draw_editboxes |
||
7464 | leency | 173 | jmp .still |
6582 | nisargshah | 174 | |
7465 | leency | 175 | ;========================================================= |
176 | ;DATA AREA |
||
177 | ;========================================================= |
||
178 | |||
6582 | nisargshah | 179 | gui_str_connect db 'Connect',0 |
180 | gui_str_usr db 'Username:',0 |
||
181 | gui_str_pass db 'Password:',0 |
||
182 | gui_str_server db 'Server:',0 |
||
183 | gui_str_port db 'Port:',0 |
||
184 | gui_str_path db 'Path:',0 |
||
7489 | leency | 185 | gui_str_error db 'Error! Check log file for details',0 |
7490 | leency | 186 | gui_str_no_srvr db 'Error! Please set server address',0 |
6582 | nisargshah | 187 | gui_str_null db ' ',0 |
188 | |||
189 | str_error_addr dd gui_str_null |
||
190 | |||
191 | ; login window components |
||
7464 | leency | 192 | edit_usr edit_box 300,75,5, 0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_user,mouse_dd,ed_focus |
193 | edit_pass edit_box 300,75,pad+5, 0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_password,mouse_dd,ed_pass |
||
194 | edit_server edit_box 300,75,pad*2+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_server_addr,mouse_dd,0 |
||
195 | edit_port edit_box 50, 75,pad*3+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_port,mouse_dd,ed_figure_only |
||
196 | edit_path edit_box 300,75,pad*4+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_path,mouse_dd,0 |
||
7489 | leency | 197 | editboxes_end: |
6582 | nisargshah | 198 | |
7489 | leency | 199 | mouse_dd rd 13,185>167,155>3,pad*4+8>3,pad*3+8>3,pad*2+8>3,pad*1+8>3,>150,25>162,65>> |