Rev 8429 | Rev 8438 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8429 | Rev 8436 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | // getrusage |
|
- | 2 | #include "resource.h" |
|
- | 3 | ||
1 | #include |
4 | #include |
2 | #define _WIN32 |
- | |
3 | #include "fitz.h" |
5 | #include "fitz.h" |
4 | #include "mupdf.h" |
6 | #include "mupdf.h" |
5 | #include "pdfapp.h" |
7 | #include "pdfapp.h" |
6 | #include "icons/allbtns.h" |
8 | #include "icons/allbtns.h" |
7 | #include "kolibri.c" |
9 | #include "kolibri.h" |
Line 8... | Line 10... | ||
8 | 10 | ||
9 | void run_app() |
11 | void run_app() |
10 | { |
12 | { |
11 | return; |
13 | return; |
Line 51... | Line 53... | ||
51 | "Press Escape to hide help", |
53 | "Press Escape to hide help", |
52 | 0 |
54 | 0 |
53 | }; |
55 | }; |
Line 54... | Line 56... | ||
54 | 56 | ||
- | 57 | /*==== CODE ====*/ |
|
- | 58 | // Prototypes // |
|
- | 59 | void RunApp(char app[], char param[]); |
|
- | 60 | void winblit(pdfapp_t *app); |
|
- | 61 | void DrawPagination(void); |
|
- | 62 | void HandleNewPageNumber(unsigned char key); |
|
- | 63 | void ApplyNewPageNumber(void); |
|
Line 55... | Line 64... | ||
55 | /*==== CODE ====*/ |
64 | void DrawWindow(void); |
56 | 65 | ||
57 | 66 | ||
Line 99... | Line 108... | ||
99 | } |
108 | } |
Line 100... | Line 109... | ||
100 | 109 | ||
101 | void winclose(pdfapp_t *app) |
110 | void winclose(pdfapp_t *app) |
102 | { |
111 | { |
103 | pdfapp_close(&gapp); |
112 | pdfapp_close(&gapp); |
104 | __menuet__sys_exit(); |
113 | exit(0); |
Line 105... | Line 114... | ||
105 | } |
114 | } |
106 | 115 | ||
- | 116 | void RunOpenApp(char name[]) |
|
- | 117 | { |
|
107 | void RunOpenApp() |
118 | char cmd[250] = "*pdf* "; |
108 | { |
119 | strcat(cmd, name); |
Line 109... | Line 120... | ||
109 | RunApp("/sys/lod", "*pdf* /kolibrios/media/updf"); |
120 | RunApp("/sys/lod", cmd); |
110 | } |
121 | } |
Line 351... | Line 362... | ||
351 | { |
362 | { |
352 | pdfapp_onkey(&gapp, 'R'); |
363 | pdfapp_onkey(&gapp, 'R'); |
353 | DrawPageSides(); |
364 | DrawPageSides(); |
354 | } |
365 | } |
Line 355... | Line 366... | ||
355 | 366 | ||
356 | int main (void) |
367 | int main (int argc, char* argv[]) |
357 | { |
368 | { |
358 | char ii, mouse_wheels_state; |
- | |
Line 359... | Line 369... | ||
359 | char* original_command_line = *(char**)0x1C; |
369 | char ii, mouse_wheels_state; |
360 | 370 | ||
361 | if (*original_command_line == 0) { |
371 | if (argc == 1) { |
362 | kol_board_puts("uPDF: no param set, showing OpenDialog"); |
372 | kol_board_puts("uPDF: no param set, showing OpenDialog"); |
363 | RunOpenApp(); |
373 | RunOpenApp(argv[0]); |
Line 364... | Line 374... | ||
364 | __menuet__sys_exit(); |
374 | exit(0); |
365 | } |
375 | } |
Line 366... | Line 376... | ||
366 | 376 | ||
367 | kol_board_puts(original_command_line); |
377 | kol_board_puts(argv[1]); |
368 | kol_board_puts("\n"); |
378 | kol_board_puts("\n"); |
Line 376... | Line 386... | ||
376 | gapp.scrw = 600; |
386 | gapp.scrw = 600; |
377 | gapp.scrh = 400; |
387 | gapp.scrh = 400; |
378 | gapp.resolution = resolution; |
388 | gapp.resolution = resolution; |
379 | gapp.pageno = pageno; |
389 | gapp.pageno = pageno; |
380 | kol_board_puts("PDF Open\n"); |
390 | kol_board_puts("PDF Open\n"); |
381 | pdfapp_open(&gapp, original_command_line, 0, 0); |
391 | pdfapp_open(&gapp, argv[1], 0, 0); |
382 | kol_board_puts("PDF Opened\n"); |
392 | kol_board_puts("PDF Opened\n"); |
383 | wintitle(&gapp, 0); |
393 | wintitle(&gapp, 0); |
Line 384... | Line 394... | ||
384 | 394 | ||
Line 388... | Line 398... | ||
388 | __menuet__get_screen_max(&screen_max_x, &screen_max_y); |
398 | __menuet__get_screen_max(&screen_max_x, &screen_max_y); |
389 | __menuet__set_bitfield_for_wanted_events(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); |
399 | __menuet__set_bitfield_for_wanted_events(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); |
Line 390... | Line 400... | ||
390 | 400 | ||
391 | for(;;) |
401 | for(;;) |
392 | { |
- | |
393 | 402 | { |
|
394 | switch(__menuet__wait_for_event()) |
403 | switch(__menuet__wait_for_event()) |
395 | { |
404 | { |
396 | case evReDraw: |
405 | case evReDraw: |
397 | // gapp.shrinkwrap = 2; |
406 | // gapp.shrinkwrap = 2; |
Line 428... | Line 437... | ||
428 | if ((key=='=') || (key=='+')) PageZoomIn(); |
437 | if ((key=='=') || (key=='+')) PageZoomIn(); |
429 | break; |
438 | break; |
Line 430... | Line 439... | ||
430 | 439 | ||
431 | case evButton: |
440 | case evButton: |
432 | butt = __menuet__get_button_id(); |
441 | butt = __menuet__get_button_id(); |
433 | if(butt==1) __menuet__sys_exit(); |
442 | if(butt==1) exit(0); |
434 | if(butt==10) RunOpenApp(); |
443 | if(butt==10) RunOpenApp(argv[0]); |
435 | if(butt==11) PageZoomOut(); //magnify - |
444 | if(butt==11) PageZoomOut(); //magnify - |
436 | if(butt==12) PageZoomIn(); //magnify + |
445 | if(butt==12) PageZoomIn(); //magnify + |
437 | if(butt==13) //show help |
446 | if(butt==13) //show help |
438 | { |
447 | { |