Subversion Repositories Kolibri OS

Rev

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 -... Line 1...
-
 
1
#include "..\lib\list_box.h"
-
 
2
 
Line 1... Line 3...
1
int	downloader_id;
3
 
Line 2... Line 4...
2
 
4
int	downloader_id;
3
dword
5
 
Line 10... Line 12...
10
 
12
char search_path[]="http://nigma.ru/index.php?s=";
Line 11... Line 13...
11
 
13
 
12
struct TWebBrowser {
14
 
13
	int left, top, width, height, line_h;
15
struct TWebBrowser {
14
	void Scan(int);
16
	int left, top, width, height, line_h;
15
	void GetNewUrl();
17
	llist list;
16
	void OpenPage();
18
	void GetNewUrl();
17
	void ReadHtml(byte);
19
	void OpenPage();
18
	void ShowPage();
20
	void ReadHtml(byte);
Line 44... Line 46...
44
	parametr[1200],
46
	tagparam[10000],
45
	options[4096],
47
	parametr[1200],
46
	anchor[256];
48
	options[4096],
47
 
49
	anchor[256];
Line 48... Line -...
48
#include "..\TWB\history.h"
-
 
49
#include "..\TWB\colors.h"
50
 
50
#include "..\TWB\unicode_tags.h"
51
#include "..\TWB\colors.h"
51
#include "..\TWB\img_cache.h"
52
#include "..\TWB\unicode_tags.h"
52
#include "..\TWB\some_code.h"
53
#include "..\TWB\img_cache.h"
53
#include "..\TWB\parce_tag.h"
54
#include "..\TWB\some_code.h"
Line 88... Line 89...
88
	}
89
		stolbec += strlen(#line);
89
}
90
	}
90
//=======================================================================
91
}
91
 
92
//=======================================================================
Line 92... Line -...
92
void TWebBrowser::Scan(int id)
-
 
93
{
-
 
94
	if (id >= 400)
-
 
95
	{
-
 
96
		GetURLfromPageLinks(id);
-
 
97
		
-
 
98
		//#1
-
 
99
		if (URL[0] == '#')
-
 
100
		{
-
 
101
			strcpy(#anchor, #URL+strrchr(#URL, '#'));
-
 
102
			
-
 
103
			strcpy(#URL, BrowserHistory.CurrentUrl());
-
 
104
			
-
 
105
			lines.first=lines.all-lines.visible;
-
 
106
			ShowPage();
-
 
107
			return;
-
 
108
		}
-
 
109
		//liner.ru#1
-
 
110
		if (strrchr(#URL, '#')<>-1)
-
 
111
		{
-
 
112
			strcpy(#anchor, #URL+strrchr(#URL, '#'));
-
 
113
			URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà
-
 
114
		}
-
 
115
		
-
 
116
		GetNewUrl();
-
 
117
		
-
 
118
		if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
-
 
119
		{
-
 
120
			//if (strstr(#URL,"http:")) 
-
 
121
			RunProgram("/sys/media/kiv", #URL);
-
 
122
			strcpy(#editURL, BrowserHistory.CurrentUrl());
-
 
123
			strcpy(#URL, BrowserHistory.CurrentUrl());
-
 
124
			return;
-
 
125
		}
-
 
126
		if (!strcmpn(#URL,"mailto:", 7))
-
 
127
		{
-
 
128
			RunProgram("@notify", #URL);
-
 
129
			strcpy(#editURL, BrowserHistory.CurrentUrl());
-
 
130
			strcpy(#URL, BrowserHistory.CurrentUrl());
-
 
131
			return;
-
 
132
		}
-
 
133
 
-
 
134
		OpenPage();
-
 
135
		return;
-
 
136
	}
-
 
137
	
-
 
138
	IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
-
 
139
	{ CASE 183: CASE 184: CASE 180: CASE 181: return; } 
-
 
140
	
-
 
141
	switch (id)
-
 
142
	{
-
 
143
		case 011: //Ctrk+K 
-
 
144
			ReadHtml(_KOI);
-
 
145
			break;
-
 
146
		case 021: //Ctrl+U
-
 
147
			ReadHtml(_UTF);
-
 
148
			break;
-
 
149
		case 004: //Ctrl+D
-
 
150
			ReadHtml(_DOS);
-
 
151
			break;
-
 
152
		case 002: //free img cache
-
 
153
			FreeImgCache();
-
 
154
			break;			
-
 
155
		case BACK:
-
 
156
			if (!BrowserHistory.GoBack()) return;
-
 
157
			OpenPage();
-
 
158
			return;
-
 
159
		case FORWARD:
-
 
160
			if (!BrowserHistory.GoForward()) return;
-
 
161
			OpenPage();
-
 
162
			return;
-
 
163
		case 052:  //F3
-
 
164
			if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path);
-
 
165
			return;
-
 
166
		case 054: //F5
-
 
167
			IF(address_box.flags & 0b10) break;
-
 
168
		case REFRESH:
-
 
169
			if (GetProcessSlot(downloader_id)<>0)
-
 
170
			{
-
 
171
				KillProcess(downloader_id);
-
 
172
				pause(20);
-
 
173
				Draw_Window();
-
 
174
				return;
-
 
175
			}
-
 
176
			anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð
-
 
177
			anchor[0]='|';
-
 
178
			OpenPage();
-
 
179
			return;
-
 
180
		case 014: //Ctrl+N íîâîå îêíî
-
 
181
		case 020: //Ctrl+T íîâàÿ âêëàäêà
-
 
182
		case NEWTAB:
-
 
183
			MoveSize(190,80,OLD,OLD);
-
 
184
			RunProgram(#program_path, #URL);
-
 
185
			return;
-
 
186
			
-
 
187
		case HOME:
-
 
188
			strcpy(#editURL, "http://kolibrios.org/en/index.htm");
-
 
189
		case GOTOURL:
-
 
190
		case 0x0D: //enter
-
 
191
			//ïî÷åìó ttp://? Ãîñïîäà, îòëè÷íûé âîïðîñ. Äåëî â òîì, ÷òî ýòî õàê. 
-
 
192
			//strstr() åñëè íå íàøëî âîçâðàùàåò 0 è â ñëó÷àå óñïåõà âîçâðàùàåò 0. Òàê ÷òî ýòî õàê.
-
 
193
			if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0;
-
 
194
			strcat(#URL, #editURL);
-
 
195
			OpenPage();
-
 
196
			return;
-
 
197
		case SEARCHWEB:
-
 
198
			strcpy(#URL, #search_path);
-
 
199
			strcat(#URL, #editURL);
-
 
200
			OpenPage();
-
 
201
			return;
-
 
202
 
-
 
203
		case ID1: //ìîòàåì ââåðõ
-
 
204
			IF(lines.first <= 0) return;
-
 
205
			lines.first--;
-
 
206
			break; 
-
 
207
		case ID2: //ìîòàåì âíèç
-
 
208
			IF(lines.visible + lines.first >= lines.all) return;
-
 
209
			lines.first++;
-
 
210
			break; 
-
 
211
		case 183: //PgDown
-
 
212
			IF(lines.first == lines.all - lines.visible) return;
-
 
213
			lines.first += lines.visible + 2;
-
 
214
			IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible;
-
 
215
			break;
-
 
216
		case 184: //PgUp
-
 
217
			IF(lines.first == 0) return;
-
 
218
			lines.first -= lines.visible - 2;
-
 
219
			IF(lines.first < 0) lines.first = 0;
-
 
220
			break;
-
 
221
		case 180: //home
-
 
222
			IF(lines.first == 0) return;
-
 
223
			lines.first = 0;
-
 
224
			break; 
-
 
225
		case 181: //end
-
 
226
			IF (lines.first == lines.all - lines.visible) return;
-
 
227
			lines.first = lines.all - lines.visible;
-
 
228
			break; 
-
 
229
		default:
-
 
230
			return;
-
 
231
	}
-
 
232
	ParseHTML(buf);
-
 
233
}
-
 
Line 234... Line 93...
234
 
93
 
235
 
94
 
236
char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0};
95