- Can open files with space in name
- Move getrusage stub to libopenjpeg

git-svn-id: svn://kolibrios.org@8438 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-12-17 13:43:15 +00:00
parent fa071aa312
commit 9220a9a313
7 changed files with 21 additions and 36 deletions

View File

@ -12,9 +12,9 @@ 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
$(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -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
# $(LD) $(LDFLAGS) $(LIBPATH) -o pdfdraw kolibri.o pdfapp.o pdfdraw.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -lsyscall --subsystem native
objcopy updf -O binary

View File

@ -148,3 +148,4 @@ 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);
int kos_get_mouse_wheels(void);

View File

@ -1,6 +1,3 @@
// getrusage
#include "resource.h"
#include <menuet/os.h>
#include "fitz.h"
#include "mupdf.h"
@ -94,9 +91,8 @@ char *winpassword(pdfapp_t *app, char *filename)
}
void wintitle(pdfapp_t *app, char *s)
void wintitle(pdfapp_t *app, char *s, char param[])
{
char* param = *(char**)0x1C;
sprintf(Title,"%s - uPDF", strrchr(param, '/') + 1 );
}
@ -368,13 +364,20 @@ int main (int argc, char* argv[])
{
char ii, mouse_wheels_state;
// argv without spaces
char full_argv[1024];
for (int i = 1; i<argc; i++) {
if (i != 1) strcat(full_argv, " ");
strcat(full_argv, argv[i]);
}
if (argc == 1) {
kol_board_puts("uPDF: no param set, showing OpenDialog");
RunOpenApp(argv[0]);
exit(0);
}
kol_board_puts(argv[1]);
kol_board_puts(full_argv);
kol_board_puts("\n");
char buf[128];
@ -388,9 +391,9 @@ int main (int argc, char* argv[])
gapp.resolution = resolution;
gapp.pageno = pageno;
kol_board_puts("PDF Open\n");
pdfapp_open(&gapp, argv[1], 0, 0);
pdfapp_open(&gapp, full_argv, 0, 0);
kol_board_puts("PDF Opened\n");
wintitle(&gapp, 0);
wintitle(&gapp, 0, full_argv);
kol_board_puts("Inital paint\n");
@ -411,8 +414,11 @@ int main (int argc, char* argv[])
__menuet__window_redraw(2);
__menuet__get_process_table(&Form, PID_WHOAMI);
if (Form.window_state > 2) continue; //fix rolled up
// ??
Form.client_width++; //fix for Menuet kernel bug
Form.client_height++; //fix for Menuet kernel bug
DrawWindow();
break;

View File

@ -347,7 +347,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
{
sprintf(buf, "%s - %d/%d (%d dpi)", app->doctitle,
app->pageno, app->pagecount, app->resolution);
wintitle(app, buf);
/// wintitle(app, buf);
ctm = pdfapp_viewctm(app);
bbox = fz_round_rect(fz_transform_rect(ctm, app->page_bbox));

View File

@ -13,7 +13,7 @@ enum { ARROW, HAND, WAIT };
extern void winwarn(pdfapp_t*, char *s);
extern void winerror(pdfapp_t*, fz_error error);
extern void wintitle(pdfapp_t*, char *title);
extern void wintitle(pdfapp_t*, char *title, char param[]);
extern void winresize(pdfapp_t*, int w, int h);
extern void winrepaint(pdfapp_t*);
extern void winrepaintsearch(pdfapp_t*);

View File

@ -1,23 +0,0 @@
#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) {};

View File

@ -48,7 +48,8 @@ double opj_clock(void) {
struct rusage t;
double procTime;
/* (1) Get the rusage data structure at this moment (man getrusage) */
getrusage(0,&t);
/// STUB ///
/// getrusage(0,&t);
/* (2) What is the elapsed time ? - CPU time = User time + System time */
/* (2a) Get the seconds */
procTime = t.ru_utime.tv_sec + t.ru_stime.tv_sec;