Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 8435 → Rev 8436

/contrib/media/updf/apps/Makefile
0,0 → 1,25
CC = kos32-gcc
LD = kos32-ld
 
SDK_DIR = $(abspath ../../../sdk)
LDFLAGS = -static -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0
 
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32
 
INCLUDES = -I ../SYSCALL/include -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/freetype/include -I $(SDK_DIR)/sources/zlib -I ../fitz -I ../pdf
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -L ../lib
 
APPS_SRC := $(notdir $(wildcard *.c))
 
default: $(patsubst %.c,%.o,$(APPS_SRC))
$(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lc.dll -lopenjpeg -lz -lc -lsyscall --subsystem native
# yet not work
# $(LD) $(LDFLAGS) $(LIBPATH) -o pdfdraw kolibri.o pdfapp.o pdfdraw.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lc.dll -lopenjpeg -lz -lc -lsyscall --subsystem native
objcopy updf -O binary
 
 
%.o : %.c Makefile $(APPS_SRC)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
 
clean:
rm *.o
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/contrib/media/updf/apps/kolibri.c
1,5 → 1,6
#include "kolibri.h"
#include "string.h"
#include <stdlib.h>
 
 
extern char KOL_PATH[256];
469,7 → 470,7
void kos_blit(int dstx, int dsty, int w, int h, int srcx,
int srcy,int srcw, int srch, int stride, char *d)
{
struct blit_call image;
volatile struct blit_call image;
image.dstx=dstx;
image.dsty=dsty;
image.w=w;
481,5 → 482,6
image.stride=stride;
image.d=d;
asm ("int $0x40"::"a"(73),"b"(0),"c"(&image));
}
 
/contrib/media/updf/apps/kolibri.h
1,5 → 1,7
 
#ifndef NULL
#define NULL ((void*)0)
#endif
 
#define SHM_OPEN 0
#define SHM_OPEN_ALWAYS 0x04
46,7 → 48,7
{
unsigned p00;
unsigned p04;
unsigned p08;
char *p08;
unsigned p12;
unsigned p16;
char p20;
143,3 → 145,6
char* kol_clip_get(int n);
int kol_clip_set(int n, char buffer[]);
 
void kos_blit(int dstx, int dsty, int w, int h, int srcx,
int srcy,int srcw, int srch, int stride, char *d);
int kos_random(int num);
/contrib/media/updf/apps/kos_main.c
1,10 → 1,12
// getrusage
#include "resource.h"
 
#include <menuet/os.h>
#define _WIN32
#include "fitz.h"
#include "mupdf.h"
#include "pdfapp.h"
#include "icons/allbtns.h"
#include "kolibri.c"
#include "kolibri.h"
 
void run_app()
{
53,6 → 55,13
};
 
/*==== CODE ====*/
// Prototypes //
void RunApp(char app[], char param[]);
void winblit(pdfapp_t *app);
void DrawPagination(void);
void HandleNewPageNumber(unsigned char key);
void ApplyNewPageNumber(void);
void DrawWindow(void);
 
 
// not implemented yet
101,12 → 110,14
void winclose(pdfapp_t *app)
{
pdfapp_close(&gapp);
__menuet__sys_exit();
exit(0);
}
 
void RunOpenApp()
void RunOpenApp(char name[])
{
RunApp("/sys/lod", "*pdf* /kolibrios/media/updf");
char cmd[250] = "*pdf* ";
strcat(cmd, name);
RunApp("/sys/lod", cmd);
}
 
 
353,18 → 364,17
DrawPageSides();
}
 
int main (void)
int main (int argc, char* argv[])
{
char ii, mouse_wheels_state;
char* original_command_line = *(char**)0x1C;
if (*original_command_line == 0) {
if (argc == 1) {
kol_board_puts("uPDF: no param set, showing OpenDialog");
RunOpenApp();
__menuet__sys_exit();
RunOpenApp(argv[0]);
exit(0);
}
 
kol_board_puts(original_command_line);
kol_board_puts(argv[1]);
kol_board_puts("\n");
char buf[128];
378,7 → 388,7
gapp.resolution = resolution;
gapp.pageno = pageno;
kol_board_puts("PDF Open\n");
pdfapp_open(&gapp, original_command_line, 0, 0);
pdfapp_open(&gapp, argv[1], 0, 0);
kol_board_puts("PDF Opened\n");
wintitle(&gapp, 0);
390,7 → 400,6
 
for(;;)
{
 
switch(__menuet__wait_for_event())
{
case evReDraw:
430,8 → 439,8
 
case evButton:
butt = __menuet__get_button_id();
if(butt==1) __menuet__sys_exit();
if(butt==10) RunOpenApp();
if(butt==1) exit(0);
if(butt==10) RunOpenApp(argv[0]);
if(butt==11) PageZoomOut(); //magnify -
if(butt==12) PageZoomIn(); //magnify +
if(butt==13) //show help
/contrib/media/updf/apps/pdfapp.c
1,6 → 1,7
#include "fitz.h"
#include "mupdf.h"
#include "pdfapp.h"
#include "kolibri.h"
 
#include <ctype.h> /* for tolower() */
 
109,12 → 110,12
/*
* Open PDF and load xref table
*/
__menuet__debug_out("FZ OPEN\n");
kol_board_puts("FZ OPEN\n");
//file = fz_open_fd(fd);
__menuet__debug_out("FZ ready\n");
kol_board_puts("FZ ready\n");
error = pdf_open_xref(&app->xref, filename, NULL);
if (error){
__menuet__debug_out("FZ can't open\n");
kol_board_puts("FZ can't open\n");
pdfapp_error(app, fz_rethrow(error, "cannot open document '%s'", filename));}
fz_close(file);
 
160,16 → 161,16
/*
* Start at first page
*/
__menuet__debug_out("Start at first page\n");
kol_board_puts("Start at first page\n");
 
error = pdf_load_page_tree(app->xref);
if (error) {
__menuet__debug_out("Can't load tree\n");
kol_board_puts("Can't load tree\n");
pdfapp_error(app, fz_rethrow(error, "cannot load page tree"));}
 
__menuet__debug_out("Page counter\n");
kol_board_puts("Page counter\n");
app->pagecount = pdf_count_pages(app->xref);
__menuet__debug_out("All is set!\n");
kol_board_puts("All is set!\n");
}
 
void pdfapp_open(pdfapp_t *app, char *filename, int fd, int reload)
375,7 → 376,7
 
if (app->shrinkwrap)
{
__menuet__debug_out ("SHRINK\n");
kol_board_puts ("SHRINK\n");
int w = app->image->w;
int h = app->image->h;
if (app->winw == w)
/contrib/media/updf/apps/resource.h
0,0 → 1,23
#include <time.h>
 
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss; /* integral max resident set size */
long ru_ixrss; /* integral shared text memory size */
long ru_idrss; /* integral unshared data size */
long ru_isrss; /* integral unshared stack size */
long ru_minflt; /* page reclaims */
long ru_majflt; /* page faults */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary context switches */
};
 
/// STUB ///
int getrusage(int _who, struct rusage *_rusage) {};
Property changes:
Added: svn:executable
+*
\ No newline at end of property