Subversion Repositories Kolibri OS

Rev

Rev 7995 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7592 leency 1
 
2
#define NO_IMG true
8017 leency 3
7592 leency 4
 
5
#include "..\lib\gui.h"
6
#include "..\lib\draw_buf.h"
7
#include "..\lib\list_box.h"
8
#include "..\lib\cursor.h"
9
#include "..\lib\collection.h"
10
#include "..\lib\random.h"
11
#include "..\lib\clipboard.h"
12
13
 
14
#include "..\lib\obj\box_lib.h"
15
#include "..\lib\obj\libio.h"
16
#include "..\lib\obj\libimg.h"
17
#include "..\lib\obj\iconv.h"
18
#include "..\lib\obj\proc_lib.h"
7757 leency 19
7592 leency 20
 
7757 leency 21
#include "..\lib\patterns\simple_open_dialog.h"
22
#include "..\lib\patterns\toolbar_button.h"
7759 leency 23
7592 leency 24
 
25
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
26
27
 
28
char accept_language[]= "Accept-Language: en\n";
29
30
 
7757 leency 31
7592 leency 32
 
7759 leency 33
 
34
 
7592 leency 35
36
 
37
 
38
dword STATUSBAR_H = 0;
39
40
 
7752 leency 41
 
7592 leency 42
43
 
44
45
 
46
	REFRESH_BUTTON,
47
	EDIT_SOURCE,
48
	OPEN_PAGE,
7759 leency 49
};
7592 leency 50
51
 
7752 leency 52
#include "..\TWB\TWB.c"
7592 leency 53
TWebBrowser WB1;
7759 leency 54
#include "highlight_c.h"
7757 leency 55
7592 leency 56
 
7757 leency 57
od_filter filter2 = { 16, "C\0H\0C--\0H--\0CPP\0\0" };
58
59
 
60
char edit_path[URL_SIZE+1];
61
int	mouse_twb;
7592 leency 62
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,URL_SIZE-2,#edit_path,#mouse_twb,2,19,19};
7757 leency 63
7592 leency 64
 
65
66
 
7757 leency 67
{
7592 leency 68
	load_dll(boxlib, #box_lib_init,0);
69
	load_dll(libio, #libio_init,1);
70
	load_dll(libimg, #libimg_init,1);
71
	load_dll(iconv_lib, #iconv_open,0);
72
	load_dll(Proc_lib,  #OpenDialog_init,0);
7757 leency 73
	OpenDialog_init stdcall (#o_dialog);
74
}
75
76
 
77
{
78
	int i, id;
7759 leency 79
	LoadLibraries();
7757 leency 80
	if (param) strcpy(#current_path, #param); else strcpy(#current_path, URL_SERVICE_HOME);
81
	WB1.list.SetFont(8, 14, 10011000b);
7592 leency 82
	WB1.list.no_selection = true;
83
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
84
	loop() switch(WaitEvent())
85
	{
86
		case evMouse:
87
			edit_box_mouse stdcall (#address_box);
88
			mouse.get();
89
			if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
90
			scrollbar_v_mouse (#scroll_wv);
91
			if (WB1.list.first != scroll_wv.position)
92
			{
93
				WB1.list.first = scroll_wv.position;
94
				WB1.DrawPage();
95
				break;
96
			}
97
			break;
98
99
 
100
			id = GetButtonID();
7759 leency 101
			if (1==id) ExitProcess();
102
			if (OPEN_PAGE==id) EventOpenDialog();
103
			break;
7592 leency 104
105
 
106
			GetKeys();
107
108
 
109
				OpenPage(#current_path);
7757 leency 110
			}
7592 leency 111
			if (SCAN_CODE_F3 == key_scancode) {
112
				RunProgram("/rd/1/tinypad", #current_path);
7757 leency 113
			}
7592 leency 114
115
 
7757 leency 116
				if (key_scancode == SCAN_CODE_KEY_O) {EventOpenDialog();break;}
117
			}
118
119
 
7592 leency 120
			{
121
				if (key_ascii == ASCII_KEY_ENTER) {
7757 leency 122
					OpenPage(#edit_path);
123
				}
124
				else {
7592 leency 125
					EAX = key_editbox;
126
					edit_box_key stdcall(#address_box);
127
				}
128
			}
129
			else
130
			{
131
				#define KEY_SCROLL_N 11
132
				if (SCAN_CODE_UP   == key_scancode) for (i=0;i
133
				if (SCAN_CODE_DOWN == key_scancode) for (i=0;i
134
				if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
135
			}
136
			break;
137
138
 
139
			DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,sc.work,0,0);
7806 leency 140
			GetProcessInfo(#Form, SelfInfo);
7592 leency 141
			sc.get();
7806 leency 142
			if (Form.status_window>2) break;
7759 leency 143
			if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
7592 leency 144
			if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
145
			SetElementSizes();
7757 leency 146
			draw_window();
147
			break;
7592 leency 148
	}
149
}
150
151
 
152
{
153
	address_box.top = TOOLBAR_H/2-10;
154
	address_box.left = address_box.top+43;
7759 leency 155
	address_box.width = Form.cwidth - address_box.left - address_box.left -14;
7592 leency 156
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
157
		Form.cheight - TOOLBAR_H - STATUSBAR_H, BASIC_LINE_H);
7759 leency 158
	WB1.list.wheel_size = 7 * BASIC_LINE_H;
159
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
7592 leency 160
	WB1.list.visible = WB1.list.h;
161
	if (WB1.list.w!=DrawBuf.bufw) {
7771 leency 162
		DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700);
163
		OpenPage(#current_path);
7757 leency 164
	}
7592 leency 165
}
166
167
 
7757 leency 168
{
7592 leency 169
	DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, sc.work);
7806 leency 170
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
7592 leency 171
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.work_graph);
7806 leency 172
	DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+4, 25,sc.work_graph);
173
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, sc.work);
174
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph);
175
	DrawEditBoxWebView();
7592 leency 176
	if (!WB1.header) {
7759 leency 177
		OpenPage(#current_path);
7757 leency 178
	} else {
179
		WB1.DrawPage();
7592 leency 180
		DrawEditBoxWebView();
181
	}
182
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
183
	DrawTopPanelButton(OPEN_PAGE, 10, address_box.top-3, 0, false);
7910 leency 184
}
7592 leency 185
186
 
187
 
7757 leency 188
{
7592 leency 189
	dword buf, size;
7757 leency 190
	strcpy(#current_path, _path);
191
	if (streq(_path, URL_SERVICE_HOME)) {
192
		LoadInternalPage(#homepage, sizeof(homepage));
193
		return;
7592 leency 194
	}
195
	file_size stdcall (_path);
7757 leency 196
	if (EBX)
197
	{
7592 leency 198
		size = EBX;
7757 leency 199
		buf = malloc(size);
200
		ReadFile(0, size, buf, _path);
201
		ShowCodeSource();
202
		free(buf);
203
		return;
204
	}
7592 leency 205
	LoadInternalPage(NULL,NULL);
7757 leency 206
}
7592 leency 207
208
 
209
{
210
	int skin_x_offset;
211
	DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
212
	DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
213
	address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#edit_path);
7757 leency 214
	address_box.offset = 0;
7592 leency 215
	edit_box_draw stdcall(#address_box);
216
	skin_x_offset = 51;
217
}
218
219
 
7757 leency 220
{
221
	if (!_bufpos) || (!_bufsize) {
222
		LoadInternalPage(#page_not_found, sizeof(page_not_found));
223
		return;
224
	}
225
	strcpy(#edit_path, #current_path);
226
	DrawEditBoxWebView();
7592 leency 227
7757 leency 228
 
229
	WB1.ParseHtml(_bufpos, _bufsize);
7759 leency 230
	WB1.DrawPage();
7755 leency 231
}
7592 leency 232
233
 
7757 leency 234
{
235
	OpenDialog_start stdcall (#o_dialog);
236
	if (o_dialog.status) {
237
		OpenPage(#openfile_path);
238
	}
239
}
240
241
 
242
 
7592 leency 243
void EventClickLink() {return;};
7742 leency 244
void EventShowLinkMenu() {return;};
7592 leency 245
246
 
247
248
 
249