Subversion Repositories Kolibri OS

Rev

Rev 8461 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8461 Rev 8505
Line 14... Line 14...
14
static pdfapp_t gapp;
14
static pdfapp_t gapp;
15
char debugstr[256];
15
char debugstr[256];
16
char do_not_blit=0;
16
char do_not_blit=0;
Line 17... Line 17...
17
 
17
 
18
#define TOOLBAR_HEIGHT 34
18
#define TOOLBAR_HEIGHT 34
Line 19... Line 19...
19
struct process_table_entry Form;
19
struct proc_info Form;
20
 
20
 
Line 21... Line 21...
21
#define DOCUMENT_BORDER 0x979797
21
#define DOCUMENT_BORDER 0x979797
Line 126... Line 126...
126
 
126
 
Line 127... Line 127...
127
	if (do_not_blit) return;
127
	if (do_not_blit) return;
Line 128... Line 128...
128
 
128
 
Line 129... Line 129...
129
	if (key_mode_enter_page_number==1) HandleNewPageNumber(0); else DrawPagination();
129
	if (key_mode_enter_page_number==1) HandleNewPageNumber(0); else DrawPagination();
Line 130... Line 130...
130
 
130
 
131
	if (Form.client_width > gapp.image->w) window_center = (Form.client_width - gapp.image->w) / 2; else window_center = 0;
131
	if (Form.cwidth > gapp.image->w) window_center = (Form.cwidth - gapp.image->w) / 2; else window_center = 0;
132
 
132
 
133
	gapp.panx = 0;
133
	gapp.panx = 0;
134
	
134
	
135
	kos_blit(window_center + Form.client_left, 
135
	kos_blit(window_center + Form.cleft, 
136
		Form.client_top + TOOLBAR_HEIGHT, 
136
		Form.ctop + TOOLBAR_HEIGHT, 
137
		Form.client_width, 
137
		Form.cwidth, 
138
		Form.client_height - TOOLBAR_HEIGHT, 
138
		Form.cheight - TOOLBAR_HEIGHT, 
Line 151... Line 151...
151
}
151
}
Line 152... Line 152...
152
 
152
 
153
 
153
 
154
void DrawPageSides(void)
154
void DrawPageSides(void)
155
{	
155
{	
156
	if (gapp.image->h < Form.client_height - TOOLBAR_HEIGHT) {
156
	if (gapp.image->h < Form.cheight - TOOLBAR_HEIGHT) {
157
		draw_h = gapp.image->h - gapp.pany; 
157
		draw_h = gapp.image->h - gapp.pany; 
158
	} else {
158
	} else {
Line 159... Line 159...
159
		draw_h = Form.client_height - TOOLBAR_HEIGHT;
159
		draw_h = Form.cheight - TOOLBAR_HEIGHT;
160
	}
160
	}
161
	
161
	
162
	if (gapp.image->w < Form.client_width) {
162
	if (gapp.image->w < Form.cwidth) {
163
		window_center = (Form.client_width - gapp.image->w) / 2;
163
		window_center = (Form.cwidth - gapp.image->w) / 2;
164
		draw_w = gapp.image->w + 2;
164
		draw_w = gapp.image->w + 2;
165
		kol_paint_bar(0, TOOLBAR_HEIGHT, window_center-1, Form.client_height - TOOLBAR_HEIGHT, DOCUMENT_BG);
165
		kol_paint_bar(0, TOOLBAR_HEIGHT, window_center-1, Form.cheight - TOOLBAR_HEIGHT, DOCUMENT_BG);
166
		kol_paint_bar(window_center-1, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
166
		kol_paint_bar(window_center-1, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
167
		kol_paint_bar(window_center + gapp.image->w, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
167
		kol_paint_bar(window_center + gapp.image->w, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
168
		kol_paint_bar(window_center + gapp.image->w+1, TOOLBAR_HEIGHT, Form.client_width - window_center - gapp.image->w - 1, Form.client_height - TOOLBAR_HEIGHT, DOCUMENT_BG);
168
		kol_paint_bar(window_center + gapp.image->w+1, TOOLBAR_HEIGHT, Form.cwidth - window_center - gapp.image->w - 1, Form.cheight - TOOLBAR_HEIGHT, DOCUMENT_BG);
169
	} else {
169
	} else {
Line 170... Line 170...
170
		window_center = 1;
170
		window_center = 1;
171
		draw_w = Form.client_width;
171
		draw_w = Form.cwidth;
172
	}
172
	}
173
	
173
	
Line 174... Line 174...
174
	kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT, draw_w, 1, DOCUMENT_BORDER);
174
	kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT, draw_w, 1, DOCUMENT_BORDER);
175
	kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT + 1, 
175
	kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT + 1, 
Line 237... Line 237...
237
	draw_bitmap(image_id * 24 * 26 * 3 + toolbar_image, x, 5, 26, 24);
237
	draw_bitmap(image_id * 24 * 26 * 3 + toolbar_image, x, 5, 26, 24);
238
}
238
}
Line 239... Line 239...
239
 
239
 
240
void DrawMainWindow(void)
240
void DrawMainWindow(void)
241
{
241
{
242
	kol_paint_bar(0, 0, Form.client_width, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder)
242
	kol_paint_bar(0, 0, Form.cwidth, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder)
243
	kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.client_width, 1, 0x7F7F7F);
243
	kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.cwidth, 1, 0x7F7F7F);
244
	DrawToolbarButton(8,0); //open_folder
244
	DrawToolbarButton(8,0); //open_folder
245
	DrawToolbarButton(42,1); //magnify -
245
	DrawToolbarButton(42,1); //magnify -
246
	DrawToolbarButton(67,2);  //magnify +
246
	DrawToolbarButton(67,2);  //magnify +
247
	DrawToolbarButton(101,6); //rotate left
247
	DrawToolbarButton(101,6); //rotate left
248
	DrawToolbarButton(126,7); //rotate right
248
	DrawToolbarButton(126,7); //rotate right
249
	DrawToolbarButton(Form.client_width - 160,3); //show help
249
	DrawToolbarButton(Form.cwidth - 160,3); //show help
250
	show_area_x = Form.client_width - show_area_w - 34;
250
	show_area_x = Form.cwidth - show_area_w - 34;
251
	DrawToolbarButton(show_area_x - 26,4); //prev page
251
	DrawToolbarButton(show_area_x - 26,4); //prev page
252
	DrawToolbarButton(show_area_x + show_area_w,5); //nex page
252
	DrawToolbarButton(show_area_x + show_area_w,5); //nex page
253
	kol_btn_define(show_area_x-1,  5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4);
253
	kol_btn_define(show_area_x-1,  5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4);
254
	kol_paint_bar(show_area_x,  5, show_area_w, 1, 0xA4A4A4);
254
	kol_paint_bar(show_area_x,  5, show_area_w, 1, 0xA4A4A4);
Line 261... Line 261...
261
/* Actions */
261
/* Actions */
Line 262... Line 262...
262
 
262
 
263
void PageScrollDown(void)
263
void PageScrollDown(void)
264
{
264
{
265
	//pdfapp_onkey(&gapp, 'k'); //move down
265
	//pdfapp_onkey(&gapp, 'k'); //move down
266
	if (gapp.image->h - gapp.pany - SCROLL_H < Form.client_height - TOOLBAR_HEIGHT)
266
	if (gapp.image->h - gapp.pany - SCROLL_H < Form.cheight - TOOLBAR_HEIGHT)
267
	{
267
	{
268
		pdfapp_onkey(&gapp, '.');
268
		pdfapp_onkey(&gapp, '.');
269
	}
269
	}
270
	else {
270
	else {
Line 285... Line 285...
285
		//not very nice way of using do_not_blit, but it simple
285
		//not very nice way of using do_not_blit, but it simple
286
		if (gapp.pageno == 1) return;
286
		if (gapp.pageno == 1) return;
287
		do_not_blit = 1;
287
		do_not_blit = 1;
288
		pdfapp_onkey(&gapp, ',');
288
		pdfapp_onkey(&gapp, ',');
289
		do_not_blit = 0;
289
		do_not_blit = 0;
290
		gapp.pany = gapp.image->h - SCROLL_H - Form.client_height + TOOLBAR_HEIGHT;
290
		gapp.pany = gapp.image->h - SCROLL_H - Form.cheight + TOOLBAR_HEIGHT;
291
		if (gapp.pany < 0) gapp.pany = 0;
291
		if (gapp.pany < 0) gapp.pany = 0;
292
		//sprintf (debugstr, "gapp.pany: %d \n", gapp.pany);
292
		//sprintf (debugstr, "gapp.pany: %d \n", gapp.pany);
293
		//kol_board_puts(debugstr);
293
		//kol_board_puts(debugstr);
294
		winblit(&gapp);
294
		winblit(&gapp);
295
	}
295
	}
Line 388... Line 388...
388
				get_proc_info((char*)&Form);
388
				get_proc_info((char*)&Form);
Line 389... Line 389...
389
				
389
				
Line 390... Line 390...
390
				if (Form.window_state > 2) continue; // if Rolled-up
390
				if (Form.window_state > 2) continue; // if Rolled-up
391
				
391
				
392
				// Minimal size (700x600)
392
				// Minimal size (700x600)
Line 393... Line 393...
393
				if (Form.winx_size < 700) kol_wnd_size(700, OLD);
393
				if (Form.width < 700) sys_change_window(OLD, OLD, 700, OLD);
394
				if (Form.winy_size < 600) kol_wnd_size(OLD, 600);
394
				if (Form.height < 600) sys_change_window(OLD, OLD, OLD, 600);
Line 395... Line 395...
395
				
395
				
Line 423... Line 423...
423
				if(butt==10) RunOpenApp(argv[0]);
423
				if(butt==10) RunOpenApp(argv[0]);
424
				if(butt==11) PageZoomOut(); //magnify -
424
				if(butt==11) PageZoomOut(); //magnify -
425
				if(butt==12) PageZoomIn(); //magnify +
425
				if(butt==12) PageZoomIn(); //magnify +
426
				if(butt==13) //show help
426
				if(butt==13) //show help
427
				{
427
				{
428
					kol_paint_bar(0, TOOLBAR_HEIGHT, Form.client_width, Form.client_height - TOOLBAR_HEIGHT, 0xF2F2F2);	
428
					kol_paint_bar(0, TOOLBAR_HEIGHT, Form.cwidth, Form.cheight - TOOLBAR_HEIGHT, 0xF2F2F2);	
429
					kos_text(20, TOOLBAR_HEIGHT + 20      , 0x90000000, "uPDF for KolibriOS v1.2", 0);
429
					kos_text(20, TOOLBAR_HEIGHT + 20      , 0x90000000, "uPDF for KolibriOS v1.2", 0);
430
					kos_text(21, TOOLBAR_HEIGHT + 20      , 0x90000000, "uPDF for KolibriOS v1.2", 0);
430
					kos_text(21, TOOLBAR_HEIGHT + 20      , 0x90000000, "uPDF for KolibriOS v1.2", 0);
431
					for (ii=0; help[ii]!=0; ii++) {
431
					for (ii=0; help[ii]!=0; ii++) {
432
						kos_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0);
432
						kos_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0);
433
					}
433
					}