Subversion Repositories Kolibri OS

Rev

Rev 4186 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4186 Rev 4509
Line 3... Line 3...
3
 
3
 
4
#define LIST_INFO_H 59
4
#define LIST_INFO_H 59
Line 5... Line 5...
5
int status_bar_h = 15;
5
int status_bar_h = 15;
6
 
-
 
7
scroll_bar scroll1 = { 17,200,210, LIST_INFO_H-3,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
-
 
8
scroll_bar scroll2 = { 17,200,210, LIST_INFO_H,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
-
 
Line 9... Line 6...
9
 
6
 
10
 
7
scroll_bar scroll1 = { 17,200,210, LIST_INFO_H-3,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
Line 11... Line 8...
11
 
8
 
Line 26... Line 23...
26
	EXIT_MAIL,
23
	EXIT_MAIL,
27
	CHANGE_CHARSET,
24
	CHANGE_CHARSET,
28
	CLOSE_CHANGE_CHARSET
25
	CLOSE_CHANGE_CHARSET
29
};
26
};
Line 30... Line 27...
30
 
27
 
31
void MailBoxNetworkProcess()
-
 
32
{
28
void MailBoxNetworkProcess() {
33
	int load_persent;
29
	int load_persent;
34
	if (aim) switch(aim)
30
	if (aim) switch(aim)
35
	{
31
	{
36
		case SEND_NSTAT:
32
		case SEND_NSTAT:
Line 91... Line 87...
91
				}
87
				}
92
				break;
88
				break;
Line 93... Line 89...
93
 
89
 
94
		case SEND_RETR:
90
		case SEND_RETR:
95
				from = to = date = subj = cur_charset = NULL;
91
				from = to = date = subj = cur_charset = NULL;
96
				letter_view.ClearList();
92
				WB1.list.ClearList();
97
				DrawMailBox();
93
				DrawMailBox();
98
				request_len = GetRequest("RETR", itoa(mail_list.current+1));
94
				request_len = GetRequest("RETR", itoa(mail_list.current+1));
99
				if (Send(socketnum, #request, request_len, 0) == 0xffffffff)
95
				if (Send(socketnum, #request, request_len, 0) == 0xffffffff)
100
				{
96
				{
Line 135... Line 131...
135
				ParseMail();
131
				ParseMail();
136
	}
132
	}
137
}
133
}
Line 138... Line 134...
138
 
134
 
139
 
-
 
140
void MailBoxLoop()
135
 
141
{
136
void MailBoxLoop() {
142
	int key, id;
137
	int key, id;
143
	mouse m;
138
	mouse m;
Line 161... Line 156...
161
				IF (!CheckActiveProcess(Form.ID)) break;
156
				IF (!CheckActiveProcess(Form.ID)) break;
162
				m.get();
157
				m.get();
Line 163... Line 158...
163
				
158
				
164
				if (!m.lkm) panels_drag=0;
159
				if (!m.lkm) panels_drag=0;
165
				if (m.lkm) && (m.y>mail_list.y+mail_list.h-1) && (m.y
160
				if (m.lkm) && (m.y>mail_list.y+mail_list.h-1) && (m.y
166
				&& (!scroll1.delta2) && (!scroll2.delta2) panels_drag = 1;
161
				&& (!scroll1.delta2) && (!scroll_wv.delta2) panels_drag = 1;
167
				if (panels_drag)
162
				if (panels_drag)
168
				{
163
				{
169
					if (m.yForm.cheight-letter_view.min_h-status_bar_h-LIST_INFO_H) break;
164
					if (m.yForm.cheight-WB1.list.min_h-status_bar_h-LIST_INFO_H) break;
170
					mail_list.h = m.y - mail_list.y-2;
165
					mail_list.h = m.y - mail_list.y-2;
171
					DrawMailBox();
166
					DrawMailBox();
172
					break;
167
					break;
Line -... Line 168...
-
 
168
				}
-
 
169
 
173
				}
170
				PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color);
174
 
171
 
Line 175... Line 172...
175
				if (!mail_list.count) break;
172
				if (!mail_list.count) break;
176
				if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll2); }
173
				if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll_wv); }
177
				
174
				
178
				if (mail_list.first <> scroll1.position)
175
				if (mail_list.first <> scroll1.position)
179
				{
176
				{
180
					mail_list.first = scroll1.position;
177
					mail_list.first = scroll1.position;
181
					DrawMailList();
178
					DrawMailList();
182
					break;
179
					break;
183
				};
180
				};
184
				if (letter_view.first <> scroll2.position)
181
				if (WB1.list.first <> scroll_wv.position)
185
				{
182
				{
186
					letter_view.first = scroll2.position;
183
					WB1.list.first = scroll_wv.position;
Line 187... Line 184...
187
					DrawLetter();
184
					DrawLetter();
188
					break;
185
					break;
189
				};
186
				};
190
				
187
				
191
				if (mail_list.y+mail_list.h + 10 > m.y)
188
				if (mail_list.y+mail_list.h + 10 > m.y)
192
				{
189
				{
193
					if (mail_list.MouseScroll(m.vert)) DrawMailList();
190
					if (mail_list.MouseScroll(m.vert)) DrawMailList();
194
				}
191
				}
195
				else
192
				else
196
				{
193
				{
197
					if (letter_view.MouseScroll(m.vert)) DrawLetter();
194
					if (WB1.list.MouseScroll(m.vert)) DrawLetter();
198
				}
195
				}
Line 256... Line 253...
256
				}
253
				}
Line 257... Line 254...
257
 
254
 
258
				break;
255
				break;
259
			case evReDraw: _MB_DRAW:
256
			case evReDraw: _MB_DRAW:
260
				if !(DefineWindow(MAILBOX_HEADER)) break;
257
				if !(DefineWindow(MAILBOX_HEADER)) break;
261
				scroll1.bckg_col = scroll2.bckg_col = 0xBBBbbb;
258
				scroll1.bckg_col = scroll_wv.bckg_col = 0xBBBbbb;
262
				scroll1.frnt_col = scroll2.frnt_col = sc.work;
259
				scroll1.frnt_col = scroll_wv.frnt_col = sc.work;
263
				scroll1.line_col = scroll2.line_col = sc.work_graph;
260
				scroll1.line_col = scroll_wv.line_col = sc.work_graph;
264
				DrawToolbar();
261
				DrawToolbar();
Line 265... Line 262...
265
				DrawMailBox();
262
				DrawMailBox();
266
 
263
 
Line 274... Line 271...
274
 
271
 
275
void DrawMailBox()
272
void DrawMailBox()
276
{
273
{
277
	DrawMailList();
274
	DrawMailList();
-
 
275
	DrawLetterInfo();
278
	DrawLetterInfo();
276
	InitTWB();
279
	DrawLetter();
277
	DrawLetter();
280
	DrawStatusBar();
278
	DrawStatusBar();
Line 281... Line 279...
281
}
279
}
282
 
-
 
283
 
280
 
284
void DrawToolbar()
281
 
285
{
282
void DrawToolbar() {
286
	#define BUT_Y 7
283
	#define BUT_Y 7
287
	#define BUT_H 22
284
	#define BUT_H 22
Line 297... Line 294...
297
	DrawBar(0, mail_list.y-3, mail_list.w,1, sc.work_graph);
294
	DrawBar(0, mail_list.y-3, mail_list.w,1, sc.work_graph);
298
	DrawBar(0, mail_list.y-2, mail_list.w,1, 0xdfdfdf);
295
	DrawBar(0, mail_list.y-2, mail_list.w,1, 0xdfdfdf);
299
	DrawBar(0, mail_list.y-1, mail_list.w,1, 0xf0f0f0);
296
	DrawBar(0, mail_list.y-1, mail_list.w,1, 0xf0f0f0);
300
}
297
}
Line 301... Line 298...
301
 
298
 
302
void DrawMailList()
-
 
303
{
299
void DrawMailList() {
304
	int i, on_y, on_x, direction;
300
	int i, on_y, on_x, direction;
305
	dword sel_col;
301
	dword sel_col;
Line 306... Line 302...
306
	mail_list.visible = mail_list.h / mail_list.line_h;
302
	mail_list.visible = mail_list.h / mail_list.line_h;
Line 323... Line 319...
323
	}
319
	}
324
	DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff);
320
	DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff);
325
	DrawScroller1();
321
	DrawScroller1();
326
}
322
}
Line 327... Line 323...
327
 
323
 
328
void DrawLetterInfo()
-
 
329
{
324
void DrawLetterInfo() {
330
	int lt_y = mail_list.y+mail_list.h;
325
	int lt_y = mail_list.y+mail_list.h;
331
	DrawBar(0, lt_y, mail_list.w, 1, sc.work_graph);
326
	DrawBar(0, lt_y, mail_list.w, 1, sc.work_graph);
332
	DrawBar(0, lt_y+1, Form.cwidth, 1, LBUMP);
327
	DrawBar(0, lt_y+1, Form.cwidth, 1, LBUMP);
333
	DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, sc.work);
328
	DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, sc.work);
Line 344... Line 339...
344
	WriteText (45, lt_y+32, 0x80, sc.work_text, #date);
339
	WriteText (45, lt_y+32, 0x80, sc.work_text, #date);
345
	WriteTextB(10, lt_y+44, 0x80, sc.work_text, "Subj:");
340
	WriteTextB(10, lt_y+44, 0x80, sc.work_text, "Subj:");
346
	WriteText (45, lt_y+44, 0x80, sc.work_text, #subj);
341
	WriteText (45, lt_y+44, 0x80, sc.work_text, #subj);
347
}
342
}
Line 348... Line -...
348
 
-
 
349
void DrawLetter()
-
 
350
{
-
 
351
	int i=0;
-
 
352
	dword cur_line, next_line, line_text;
-
 
Line -... Line 343...
-
 
343
 
353
	cur_line = mdata;
344
 
354
 
345
void InitTWB() {
-
 
346
	WB1.list.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll_wv.size_x - 1, 
-
 
347
		Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 60, 12);
-
 
348
	WB1.list.column_max = WB1.list.w - 30 / 6;
Line 355... Line 349...
355
	letter_view.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll2.size_x - 1, 
349
	WB1.list.visible = WB1.list.h / WB1.list.line_h;
356
		Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 60, 12);
-
 
357
 
-
 
358
	if (mailstart) && (!aim)
-
 
359
	{
350
	WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h, WB1.list.line_h);
360
		for ( ; i < letter_view.first; i++) cur_line = GetNextLine(cur_line);
-
 
361
 
351
 
362
		for (i=0; i < letter_view.visible; i++)
352
	strcpy(#URL, "/sys/yavu.htm");
363
		{
353
	strcpy(#header, #version);
364
			next_line = GetNextLine(cur_line);
-
 
365
			line_text = CopyBetweenOffsets(cur_line, next_line);
-
 
366
			cur_line = next_line;
-
 
367
			if (cur_line >= mailend) || (cur_line==1) break;
-
 
368
			DrawBar(letter_view.x, i*letter_view.line_h + letter_view.y, letter_view.w, letter_view.line_h, 0xFFFfff);
354
	pre_text = 0;
369
			if (line_text) { WriteText(letter_view.x+5, i*letter_view.line_h+letter_view.y+3, 0x80, 0, line_text); free(line_text);}
-
 
-
 
355
	WB1.list.first = WB1.list.count = 0;
370
		}
356
	WB1.ReadHtml(_WIN);
371
	}
357
}
372
	DrawBar(letter_view.x, i*letter_view.line_h + letter_view.y, letter_view.w, -i*letter_view.line_h + letter_view.h-1, 0xFFFfff);
358
 
Line -... Line 359...
-
 
359
void DrawLetter() {
373
	DrawBar(letter_view.x, letter_view.y + letter_view.h-1, letter_view.w, 1, sc.work_graph);
360
	WB1.ParseHTML(buf);
374
	DrawScroller2();
-
 
375
}
361
}
376
 
362
 
377
void DrawScroller1()
363
 
378
{
-
 
379
	scroll1.max_area = mail_list.count;
364
void DrawScroller1() {
380
	scroll1.cur_area = mail_list.visible;
365
	scroll1.max_area = mail_list.count;
381
	scroll1.position = mail_list.first;
366
	scroll1.cur_area = mail_list.visible;
382
 
367
	scroll1.position = mail_list.first;
383
	scroll1.all_redraw=1;
368
	scroll1.all_redraw=1;
384
	scroll1.start_x = mail_list.x + mail_list.w;
369
	scroll1.start_x = mail_list.x + mail_list.w;
Line 385... Line -...
385
	scroll1.start_y = mail_list.y - 3;
-
 
386
	scroll1.size_y = mail_list.h + 4;
-
 
387
	scrollbar_v_draw(#scroll1);
-
 
388
}
-
 
389
 
-
 
390
void DrawScroller2()
-
 
391
{
-
 
392
	scroll2.max_area = letter_view.count;
-
 
393
	scroll2.cur_area = letter_view.visible;
-
 
394
	scroll2.position = letter_view.first;
-
 
395
 
-
 
396
	scroll2.all_redraw=1;
-
 
397
	scroll2.start_x = letter_view.x + letter_view.w;
-
 
Line 398... Line 370...
398
	scroll2.start_y = letter_view.y - 3;
370
	scroll1.start_y = mail_list.y - 3;
399
	scroll2.size_y = letter_view.h + 3;
-
 
400
	scrollbar_v_draw(#scroll2);
371
	scroll1.size_y = mail_list.h + 4;
401
}
372
	scrollbar_v_draw(#scroll1);
402
 
373
}
403
 
374
 
404
 
375
 
Line 413... Line 384...
413
	DrawCaptButton(Form.cwidth - 100, st_y+1, 70, status_bar_h-2, CHANGE_CHARSET+BT_HIDE, sc.work, sc.work_text,charsets[cur_charset]);
384
	DrawCaptButton(Form.cwidth - 100, st_y+1, 70, status_bar_h-2, CHANGE_CHARSET+BT_HIDE, sc.work, sc.work_text,charsets[cur_charset]);
414
}
385
}
Line 415... Line 386...
415
 
386
 
416
 
-
 
417
 
387
 
418
void SetMailBoxStatus(dword percent1, text1)
388
 
419
{
389
void SetMailBoxStatus(dword percent1, text1) {
420
	DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, sc.work, 0xC3C3C3, 0x54B1D6, sc.work_text, percent1, text1);
390
	DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, sc.work, 0xC3C3C3, 0x54B1D6, sc.work_text, percent1, text1);
Line 421... Line 391...
421
	cur_st_percent = percent1;
391
	cur_st_percent = percent1;
422
	cur_st_text = text1;
-
 
423
}
392
	cur_st_text = text1;
424
 
393
}
425
 
394
 
426
void StopLoading()
395
 
Line 427... Line 396...
427
{
396
void StopLoading() {
428
	aim = NULL;
-
 
429
	mailstart = free(mailstart);
397
	aim = NULL;
430
	to = from = date = subj = cur_charset = NULL;
398
	mailstart = free(mailstart);
431
}
399
	to = from = date = subj = cur_charset = NULL;
432
 
400
}
433
int GetLetterSize_(int number)
401