Rev 6964 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6964 | Rev 6969 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
6 | #define OPEN_FILE_TEXT "âªàëâì ä ©«" |
6 | #define OPEN_FILE_TEXT "âªàëâì ä ©«" |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
8 | #define KB_RECEIVED " ¯®«ã祮" |
8 | #define KB_RECEIVED "¤¥â ᪠稢 ¨¥... %s ¯®«ã祮" |
9 | #else |
9 | #else |
10 | #define DL_WINDOW_HEADER "Download Manager" |
10 | #define DL_WINDOW_HEADER "Download Manager" |
11 | #define START_DOWNLOADING "Start downloading" |
11 | #define START_DOWNLOADING "Start downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
13 | #define SHOW_IN_FOLDER "Show in folder" |
13 | #define SHOW_IN_FOLDER "Show in folder" |
14 | #define OPEN_FILE_TEXT "Open file" |
14 | #define OPEN_FILE_TEXT "Open file" |
15 | #define FILE_SAVED_AS "'Download manager\nFile saved as " |
15 | #define FILE_SAVED_AS "'Download manager\nFile saved as " |
16 | #define KB_RECEIVED " received" |
16 | #define KB_RECEIVED "Downloading... %s received" |
17 | #endif |
17 | #endif |
18 | char save_to[4096] = "/tmp0/1/Downloads"; |
18 | char save_to[4096] = "/tmp0/1/Downloads"; |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | proc_info DL_Form; |
20 | proc_info DL_Form; |
21 | char downloader_edit[10000]; |
21 | char downloader_edit[10000]; |
22 | char filepath[4096]; |
22 | char filepath[4096]; |
23 | int mouse_twbi; |
23 | int mouse_twbi; |
- | 24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
|
24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
25 | progress_bar pb = {0, 20, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
- | 26 | //progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
|
- | 27 | //progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color; |
|
Line 25... | Line 28... | ||
25 | progress_bar pb = {0, 200, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
28 | |
26 | 29 | ||
27 | byte downloader_opened; |
30 | byte downloader_opened; |
28 | char downloader_stak[4096]; |
31 | char downloader_stak[4096]; |
Line 36... | Line 39... | ||
36 | int key, i; |
39 | int key, i; |
37 | char notify_message[4296]; |
40 | char notify_message[4296]; |
38 | downloader_opened = 1; |
41 | downloader_opened = 1; |
39 | SetEventMask(0x27); |
42 | SetEventMask(0x27); |
Line -... | Line 43... | ||
- | 43 | ||
- | 44 | system.color.get(); |
|
- | 45 | pb.frame_color = system.color.work_dark; |
|
40 | 46 | ||
Line 41... | Line 47... | ||
41 | filepath[0] = NULL; |
47 | filepath[0] = NULL; |
42 | 48 | ||
43 | downloader.Stop(); |
49 | downloader.Stop(); |
Line 58... | Line 64... | ||
58 | Key_Scan(GetButtonID()); |
64 | Key_Scan(GetButtonID()); |
59 | break; |
65 | break; |
Line 60... | Line 66... | ||
60 | 66 | ||
61 | case evKey: |
67 | case evKey: |
62 | GetKeys(); |
- | |
63 | EAX = key_ascii << 8; |
68 | GetKeys(); |
64 | edit_box_key stdcall(#ed); |
69 | edit_box_key stdcall(#ed); |
65 | if (key_scancode==SCAN_CODE_ENTER) Key_Scan(301); |
70 | if (key_scancode==SCAN_CODE_ENTER) Key_Scan(301); |
Line 66... | Line 71... | ||
66 | break; |
71 | break; |
67 | - | ||
68 | case evReDraw: |
72 | |
69 | system.color.get(); |
73 | case evReDraw: |
70 | DefineAndDrawWindow(215, 100, 580, 120, 0x74, system.color.work, DL_WINDOW_HEADER, 0); |
74 | DefineAndDrawWindow(215, 100, 580, 130, 0x74, system.color.work, DL_WINDOW_HEADER, 0); |
71 | GetProcessInfo(#DL_Form, SelfInfo); |
75 | GetProcessInfo(#DL_Form, SelfInfo); |
72 | if (DL_Form.status_window>2) break; |
76 | if (DL_Form.status_window>2) break; |
73 | if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120); |
77 | if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120); |
Line 123... | Line 127... | ||
123 | 127 | ||
124 | void DL_Draw_Window() |
128 | void DL_Draw_Window() |
125 | { |
129 | { |
126 | int cleft = 15; |
130 | int cleft = 15; |
- | 131 | int but_x = 0; |
|
127 | int but_x = 0; |
132 | int but_y = 58; |
128 | DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, system.color.work); |
133 | DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, system.color.work); |
129 | DeleteButton(305); |
134 | DeleteButton(305); |
130 | DeleteButton(306); |
135 | DeleteButton(306); |
131 | if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED) |
136 | if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED) |
132 | { |
137 | { |
- | 138 | but_x = cleft + DrawStandartCaptButton(cleft, but_y, 301, START_DOWNLOADING); |
|
- | 139 | if (filepath[0]) |
|
- | 140 | { |
|
- | 141 | but_x += DrawStandartCaptButton(but_x, but_y, 305, SHOW_IN_FOLDER); |
|
- | 142 | DrawStandartCaptButton(but_x, but_y, 306, OPEN_FILE_TEXT); |
|
133 | but_x = cleft + DrawStandartCaptButton(cleft, 55, 301, START_DOWNLOADING); |
143 | } |
134 | } |
144 | } |
135 | if (downloader.state == STATE_IN_PROGRESS) |
145 | if (downloader.state == STATE_IN_PROGRESS) |
136 | { |
146 | { |
137 | DrawStandartCaptButton(cleft, 55, 302, STOP_DOWNLOADING); |
147 | DrawCaptButton(DL_Form.width - 190, but_y, 167, 26, 302, system.color.work_button, system.color.work_button_text, STOP_DOWNLOADING); |
138 | DrawDownloading(); |
148 | DrawDownloading(); |
139 | } |
- | |
140 | if (filepath[0]) |
- | |
141 | { |
- | |
142 | but_x += DrawStandartCaptButton(but_x, 55, 305, SHOW_IN_FOLDER); |
- | |
143 | DrawStandartCaptButton(but_x, 55, 306, OPEN_FILE_TEXT); |
- | |
144 | } |
149 | } |
145 | WriteText(cleft, ed.top + 4, 0x90, system.color.work_text, "URL:"); |
150 | WriteText(cleft, ed.top + 4, 0x90, system.color.work_text, "URL:"); |
146 | ed.left = strlen("URL:")*8 + 10 + cleft; |
151 | ed.left = strlen("URL:")*8 + 10 + cleft; |
147 | ed.width = DL_Form.cwidth - ed.left - cleft - 3; |
152 | ed.width = DL_Form.cwidth - ed.left - cleft - 3; |
148 | ed.offset=0; |
153 | ed.offset=0; |
Line 168... | Line 173... | ||
168 | } |
173 | } |
Line 169... | Line 174... | ||
169 | 174 | ||
170 | void DrawDownloading() |
175 | void DrawDownloading() |
171 | { |
176 | { |
172 | char bytes_received[70]; |
177 | char bytes_received[70]; |
173 | dword tmp = ConvertSizeToKb(downloader.data_downloaded_size); |
- | |
174 | sprintf(#bytes_received, "%s%s", tmp, KB_RECEIVED); |
178 | sprintf(#bytes_received, KB_RECEIVED, ConvertSizeToKb(downloader.data_downloaded_size) ); |
175 | DrawBar(pb.left, pb.top + 17, DL_Form.cwidth - pb.left, 9, system.color.work); |
179 | DrawBar(15, pb.top + 22, strlen(#bytes_received+4)*12, 16, system.color.work); |
176 | WriteText(pb.left, pb.top + 17, 0x80, system.color.work_text, #bytes_received); |
180 | WriteText(15, pb.top + 22, 0x90, system.color.work_text, #bytes_received); |
177 | progressbar_draw stdcall(#pb); |
181 | progressbar_draw stdcall(#pb); |
Line 178... | Line 182... | ||
178 | } |
182 | } |
179 | 183 |