Rev 7464 | Go to most recent revision | Details | 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 | |||
5 | ;;================================================================================================;; |
||
6 | login_gui: ;//////////////////////////////////////////////////////////////////////////////////////;; |
||
7 | ;;------------------------------------------------------------------------------------------------;; |
||
8 | ;? Login GUI-specific functions ;; |
||
9 | ;;------------------------------------------------------------------------------------------------;; |
||
10 | ;> none ;; |
||
11 | ;;------------------------------------------------------------------------------------------------;; |
||
12 | ;< none ;; |
||
13 | ;;================================================================================================;; |
||
14 | |||
15 | ; TODO: print error strings (wrong user, pass, etc.) |
||
16 | |||
17 | .server_addr: |
||
18 | mov [initial_login], 1 |
||
19 | |||
20 | .get_username: |
||
21 | ; in case of error when either login_gui.server_addr or |
||
22 | ; login_gui.get_username is called, should resize window |
||
23 | mcall 67, 320, 300, 390, 200 ; resize to login gui window size |
||
24 | |||
25 | .redraw: |
||
26 | call .draw |
||
27 | jmp .still |
||
28 | |||
29 | |||
30 | align 4 |
||
31 | .draw: |
||
32 | mcall 12, 1 |
||
33 | mcall 0, <320,390>, <300,200>, 0x34000000+SYS_COL, 0x805080DD, hed |
||
34 | |||
35 | stdcall [edit_box_draw], edit_usr |
||
36 | stdcall [edit_box_draw], edit_pass |
||
37 | stdcall [edit_box_draw], edit_server |
||
38 | stdcall [edit_box_draw], edit_port |
||
39 | stdcall [edit_box_draw], edit_path |
||
40 | |||
41 | ; draw "connect" button |
||
42 | mcall 8, <162,65>, <140,25>, 2, BT_COL |
||
43 | |||
44 | ; draw strings |
||
45 | mcall 4, <3,5>, 0xb0000000, gui_str_usr |
||
46 | mcall 4, <3,25>, 0xb0000000, gui_str_pass |
||
47 | mcall 4, <3,45>, 0xb0000000, gui_str_server |
||
48 | mcall 4, <3,65>, 0xb0000000, gui_str_port |
||
49 | mcall 4, <3,85>, 0xb0000000, gui_str_path |
||
50 | mcall 4, <167,145>, 0xb0000000+STR_COL, gui_str_connect |
||
51 | mcall 4, <3,115>, 0xb0ff0000, [str_error_addr] |
||
52 | mov [str_error_addr], gui_str_null ; reset error string address |
||
53 | |||
54 | mcall 12, 2 |
||
55 | ret |
||
56 | |||
57 | align 4 |
||
58 | .still: |
||
59 | mcall 10 ; wait for event |
||
60 | dec eax |
||
61 | jz .redraw |
||
62 | dec eax |
||
63 | jz .key |
||
64 | dec eax |
||
65 | jz .button |
||
66 | |||
67 | stdcall [edit_box_mouse], edit_usr |
||
68 | stdcall [edit_box_mouse], edit_pass |
||
69 | stdcall [edit_box_mouse], edit_server |
||
70 | stdcall [edit_box_mouse], edit_port |
||
71 | stdcall [edit_box_mouse], edit_path |
||
72 | |||
73 | jmp .still |
||
74 | |||
75 | .button: |
||
76 | mcall 17 |
||
77 | |||
78 | dec ah |
||
79 | jz .exit |
||
80 | |||
81 | dec ah ; 'Connect' button clicked |
||
82 | jz gui.main |
||
83 | |||
84 | jmp .still |
||
85 | |||
86 | .key: |
||
87 | mcall 2 |
||
88 | |||
89 | stdcall [edit_box_key], edit_usr |
||
90 | stdcall [edit_box_key], edit_pass |
||
91 | stdcall [edit_box_key], edit_server |
||
92 | stdcall [edit_box_key], edit_port |
||
93 | stdcall [edit_box_key], edit_path |
||
94 | |||
95 | jmp .still |
||
96 | |||
97 | .error: |
||
98 | mov [str_error_addr], gui_str_error |
||
99 | jmp .server_addr |
||
100 | |||
101 | .exit: |
||
102 | jmp gui.exit |
||
103 | |||
104 | |||
105 | gui_str_connect db 'Connect',0 |
||
106 | gui_str_usr db 'Username:',0 |
||
107 | gui_str_pass db 'Password:',0 |
||
108 | gui_str_server db 'Server:',0 |
||
109 | gui_str_port db 'Port:',0 |
||
110 | gui_str_path db 'Path:',0 |
||
111 | gui_str_error db 'ERROR! Check log file for details',0 |
||
112 | gui_str_null db ' ',0 |
||
113 | |||
114 | str_error_addr dd gui_str_null |
||
115 | |||
116 | ; login window components |
||
117 | edit_usr edit_box 300,75,5, 0xffffff,0x6f9480,0,0xAABBCC,0,99,param_user,mouse_dd,ed_focus |
||
118 | edit_pass edit_box 300,75,25,0xffffff,0x6a9480,0,0xAABBCC,0,99,param_password,mouse_dd,ed_pass |
||
119 | edit_server edit_box 300,75,45,0xffffff,0x6a9480,0,0xAABBCC,0,99,param_server_addr,mouse_dd,0 |
||
120 | edit_port edit_box 50,75,65,0xffffff,0x6a9480,0,0xAABBCC,0,99,param_port,mouse_dd,ed_figure_only |
||
121 | edit_path edit_box 300,75,85,0xffffff,0x6a9480,0,0xAABBCC,0,99,param_path,mouse_dd,0 |
||
122 | |||
123 | mouse_dd rd 13,115>167,145>3,85>3,65>3,45>3,25>3,5>140,25>162,65>300,200>320,390>> |