Subversion Repositories Kolibri OS

Rev

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

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