Rev 4411 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4411 | Rev 4413 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | #include "..\lib\dll.h" |
18 | #include "..\lib\dll.h" |
19 | //*.obj libraries |
19 | //*.obj libraries |
20 | #include "..\lib\lib.obj\box_lib.h" |
20 | #include "..\lib\lib.obj\box_lib.h" |
21 | #include "..\lib\lib.obj\libio_lib.h" |
21 | #include "..\lib\lib.obj\libio_lib.h" |
22 | #include "..\lib\lib.obj\libimg_lib.h" |
22 | #include "..\lib\lib.obj\libimg_lib.h" |
23 | #include "..\lib\list_box.h" |
- | |
24 | //images |
23 | //images |
25 | #include "img\toolbar_icons.c" |
24 | #include "img\toolbar_icons.c" |
26 | #include "img\URLgoto.txt"; |
25 | #include "img\URLgoto.txt"; |
Line 27... | Line 26... | ||
27 | 26 | ||
Line 58... | Line 57... | ||
58 | char stak[4096]; |
57 | char stak[4096]; |
59 | mouse m; |
58 | mouse m; |
Line 60... | Line 59... | ||
60 | 59 | ||
Line -... | Line 60... | ||
- | 60 | int action_buf; |
|
61 | int action_buf; |
61 | |
62 | 62 | #include "history.h" |
|
Line 63... | Line 63... | ||
63 | #include "..\TWB\TWB.c" |
63 | #include "..\TWB\TWB.c" |
Line 121... | Line 121... | ||
121 | 121 | ||
122 | if (m.vert==65535) |
122 | if (m.vert==65535) |
123 | { |
123 | { |
124 | if (lines.first==0) break; |
124 | if (lines.first==0) break; |
125 | if (lines.first>3) lines.first-=2; ELSE lines.first=1; |
125 | if (lines.first>3) lines.first-=2; ELSE lines.first=1; |
126 | WB1.Scan(ID1); |
126 | Scan(ID1); |
127 | break; |
127 | break; |
128 | } |
128 | } |
129 | if (m.vert==1) |
129 | if (m.vert==1) |
130 | { |
130 | { |
131 | if(lines.visible+lines.first+3>=lines.all) WB1.Scan(181); |
131 | if(lines.visible+lines.first+3>=lines.all) Scan(181); |
132 | else |
132 | else |
133 | { |
133 | { |
134 | lines.first+=2; |
134 | lines.first+=2; |
135 | WB1.Scan(ID2); |
135 | Scan(ID2); |
136 | } |
136 | } |
137 | break; |
137 | break; |
Line 138... | Line 138... | ||
138 | } |
138 | } |
Line 163... | Line 163... | ||
163 | KillProcess(downloader_id); |
163 | KillProcess(downloader_id); |
164 | ExitProcess(); |
164 | ExitProcess(); |
165 | } |
165 | } |
166 | ELSE |
166 | ELSE |
167 | { |
167 | { |
168 | WB1.Scan(btn); |
168 | Scan(btn); |
169 | } |
169 | } |
170 | break; |
170 | break; |
171 | case evKey: |
171 | case evKey: |
172 | key = GetKey(); |
172 | key = GetKey(); |
Line 173... | Line 173... | ||
173 | 173 | ||
174 | if (address_box.flags & 0b10) SWITCH(key) //åñëè àêòèâíà ñòðîêà àäðåñà èãíîðèðóåì íåêîòîðûå êíîïêè |
174 | if (address_box.flags & 0b10) SWITCH(key) //åñëè àêòèâíà ñòðîêà àäðåñà èãíîðèðóåì íåêîòîðûå êíîïêè |
Line 175... | Line 175... | ||
175 | { CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } |
175 | { CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } |
Line 176... | Line 176... | ||
176 | 176 | ||
177 | WB1.Scan(key); |
177 | Scan(key); |
178 | 178 | ||
179 | _EDIT_MARK: |
179 | _EDIT_MARK: |
180 | if (key<>0x0d) && (key<>183) && (key<>184) {EAX=key<<8; edit_box_key stdcall(#address_box);} //àäðåñíàÿ ñòðîêà |
180 | if (key<>0x0d) && (key<>183) && (key<>184) {EAX=key<<8; edit_box_key stdcall(#address_box);} //àäðåñíàÿ ñòðîêà |
181 | break; |
181 | break; |
182 | case evReDraw: |
182 | case evReDraw: |
183 | if (action_buf) { WB1.Scan(action_buf); action_buf=0;} |
183 | if (action_buf) { Scan(action_buf); action_buf=0;} |
184 | Draw_Window(); |
184 | Draw_Window(); |
185 | break; |
185 | break; |
Line 242... | Line 242... | ||
242 | DefineButton(scroll1.start_x+1, scroll1.start_y+1, 16, 16, ID1+BT_HIDE, 0xE4DFE1); |
242 | DefineButton(scroll1.start_x+1, scroll1.start_y+1, 16, 16, ID1+BT_HIDE, 0xE4DFE1); |
243 | DefineButton(scroll1.start_x+1, scroll1.start_y+scroll1.size_y-18, 16, 16, ID2+BT_HIDE, 0xE4DFE1); |
243 | DefineButton(scroll1.start_x+1, scroll1.start_y+scroll1.size_y-18, 16, 16, ID2+BT_HIDE, 0xE4DFE1); |
244 | } |
244 | } |
Line -... | Line 245... | ||
- | 245 | ||
- | 246 | ||
- | 247 | void Scan(int id) |
|
- | 248 | { |
|
- | 249 | if (id >= 400) |
|
- | 250 | { |
|
- | 251 | GetURLfromPageLinks(id); |
|
- | 252 | ||
- | 253 | //#1 |
|
- | 254 | if (URL[0] == '#') |
|
- | 255 | { |
|
- | 256 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
|
- | 257 | ||
- | 258 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
|
- | 259 | ||
- | 260 | lines.first=lines.all-lines.visible; |
|
- | 261 | WB1.ShowPage(); |
|
- | 262 | return; |
|
- | 263 | } |
|
- | 264 | //liner.ru#1 |
|
- | 265 | if (strrchr(#URL, '#')<>-1) |
|
- | 266 | { |
|
- | 267 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
|
- | 268 | URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
|
- | 269 | } |
|
- | 270 | ||
- | 271 | WB1.GetNewUrl(); |
|
- | 272 | ||
- | 273 | if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) |
|
- | 274 | { |
|
- | 275 | //if (strstr(#URL,"http:")) |
|
- | 276 | RunProgram("/sys/media/kiv", #URL); |
|
- | 277 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
|
- | 278 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
|
- | 279 | return; |
|
- | 280 | } |
|
- | 281 | if (!strcmpn(#URL,"mailto:", 7)) |
|
- | 282 | { |
|
- | 283 | RunProgram("@notify", #URL); |
|
- | 284 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
|
- | 285 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
|
- | 286 | return; |
|
- | 287 | } |
|
- | 288 | ||
- | 289 | WB1.OpenPage(); |
|
- | 290 | return; |
|
- | 291 | } |
|
- | 292 | ||
- | 293 | IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
|
- | 294 | { CASE 183: CASE 184: CASE 180: CASE 181: return; } |
|
- | 295 | ||
- | 296 | switch (id) |
|
- | 297 | { |
|
- | 298 | case 011: //Ctrk+K |
|
- | 299 | WB1.ReadHtml(_KOI); |
|
- | 300 | break; |
|
- | 301 | case 021: //Ctrl+U |
|
- | 302 | WB1.ReadHtml(_UTF); |
|
- | 303 | break; |
|
- | 304 | case 004: //Ctrl+D |
|
- | 305 | WB1.ReadHtml(_DOS); |
|
- | 306 | break; |
|
- | 307 | case 002: //free img cache |
|
- | 308 | FreeImgCache(); |
|
- | 309 | break; |
|
- | 310 | case BACK: |
|
- | 311 | if (!BrowserHistory.GoBack()) return; |
|
- | 312 | WB1.OpenPage(); |
|
- | 313 | return; |
|
- | 314 | case FORWARD: |
|
- | 315 | if (!BrowserHistory.GoForward()) return; |
|
- | 316 | WB1.OpenPage(); |
|
- | 317 | return; |
|
- | 318 | case 052: //F3 |
|
- | 319 | if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); |
|
- | 320 | return; |
|
- | 321 | case 054: //F5 |
|
- | 322 | IF(address_box.flags & 0b10) break; |
|
- | 323 | case REFRESH: |
|
- | 324 | if (GetProcessSlot(downloader_id)<>0) |
|
- | 325 | { |
|
- | 326 | KillProcess(downloader_id); |
|
- | 327 | pause(20); |
|
- | 328 | Draw_Window(); |
|
- | 329 | return; |
|
- | 330 | } |
|
- | 331 | anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
|
- | 332 | anchor[0]='|'; |
|
- | 333 | WB1.OpenPage(); |
|
- | 334 | return; |
|
- | 335 | case 014: //Ctrl+N íîâîå îêíî |
|
- | 336 | case 020: //Ctrl+T íîâàÿ âêëàäêà |
|
- | 337 | case NEWTAB: |
|
- | 338 | MoveSize(190,80,OLD,OLD); |
|
- | 339 | RunProgram(#program_path, #URL); |
|
- | 340 | return; |
|
- | 341 | ||
- | 342 | case HOME: |
|
- | 343 | strcpy(#editURL, "http://kolibrios.org/en/index.htm"); |
|
- | 344 | case GOTOURL: |
|
- | 345 | case 0x0D: //enter |
|
- | 346 | //ïî÷åìó ttp://? Ãîñïîäà, îòëè÷íûé âîïðîñ. Äåëî â òîì, ÷òî ýòî õàê. |
|
- | 347 | //strstr() åñëè íå íàøëî âîçâðàùàåò 0 è â ñëó÷àå óñïåõà âîçâðàùàåò 0. Òàê ÷òî ýòî õàê. |
|
- | 348 | if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; |
|
- | 349 | strcat(#URL, #editURL); |
|
- | 350 | WB1.OpenPage(); |
|
- | 351 | return; |
|
- | 352 | case SEARCHWEB: |
|
- | 353 | strcpy(#URL, #search_path); |
|
- | 354 | strcat(#URL, #editURL); |
|
- | 355 | WB1.OpenPage(); |
|
- | 356 | return; |
|
- | 357 | ||
- | 358 | case ID1: //ìîòàåì ââåðõ |
|
- | 359 | IF(lines.first <= 0) return; |
|
- | 360 | lines.first--; |
|
- | 361 | break; |
|
- | 362 | case ID2: //ìîòàåì âíèç |
|
- | 363 | IF(lines.visible + lines.first >= lines.all) return; |
|
- | 364 | lines.first++; |
|
- | 365 | break; |
|
- | 366 | case 183: //PgDown |
|
- | 367 | IF(lines.first == lines.all - lines.visible) return; |
|
- | 368 | lines.first += lines.visible + 2; |
|
- | 369 | IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
|
- | 370 | break; |
|
- | 371 | case 184: //PgUp |
|
- | 372 | IF(lines.first == 0) return; |
|
- | 373 | lines.first -= lines.visible - 2; |
|
- | 374 | IF(lines.first < 0) lines.first = 0; |
|
- | 375 | break; |
|
- | 376 | case 180: //home |
|
- | 377 | IF(lines.first == 0) return; |
|
- | 378 | lines.first = 0; |
|
- | 379 | break; |
|
- | 380 | case 181: //end |
|
- | 381 | IF (lines.first == lines.all - lines.visible) return; |
|
- | 382 | lines.first = lines.all - lines.visible; |
|
- | 383 | break; |
|
- | 384 | default: |
|
- | 385 | return; |
|
- | 386 | } |
|
- | 387 | WB1.ParseHTML(buf); |
|
- | 388 | } |
|
- | 389 | ||
- | 390 | ||
245 | 391 |