/contrib/media/updf/apps/Makefile |
---|
12,7 → 12,7 |
APPS_SRC := kolibri.c kos_main.c pdfapp.c |
default: $(patsubst %.c,%.o,$(APPS_SRC)) |
$(LD) $(LDFLAGS) $(LIBPATH) --subsystem native -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll |
$(LD) $(LDFLAGS) $(LIBPATH) --subsystem native -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz.dll -lc.dll |
objcopy updf -O binary |
/contrib/media/updf/apps/kolibri.c |
---|
27,6 → 27,12 |
asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) ); |
} |
void kol_wnd_change(int new_x, int new_y, int new_w, int new_h) |
{ |
asm volatile("int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w),"S"(new_h)); |
} |
void kol_event_mask(unsigned e) |
{ |
asm volatile ("int $0x40"::"a"(40), "b"(e)); |
137,7 → 143,12 |
unsigned kol_btn_get() |
{ |
asm volatile ("int $0x40"::"a"(17)); |
unsigned val; |
asm volatile( |
"int $0x40" |
: "=a"(val) |
: "a"(17)); |
return val >> 8; |
} |
/contrib/media/updf/apps/kolibri.h |
---|
93,11 → 93,32 |
} kol_struct_import; |
#pragma pack(pop) |
#pragma pack(push, 1) |
struct proc_info |
{ |
unsigned long cpu_usage; |
unsigned short pos_in_stack; |
unsigned short slot; |
unsigned short reserved2; |
char name[12]; |
unsigned long address; |
unsigned long memory_usage; |
unsigned long ID; |
unsigned long left,top; |
unsigned long width,height; |
unsigned short thread_state; |
unsigned short reserved3; |
unsigned long cleft, ctop, cwidth, cheight; |
unsigned char window_state; |
unsigned char reserved4[1024-71]; |
}; |
#pragma pack(pop) |
void kol_exit(); |
void kol_sleep(unsigned d); |
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t); |
void kol_wnd_caption(char *s); |
void kol_wnd_change(int new_x, int new_y, int new_w, int new_h); |
void kol_event_mask(unsigned e); |
unsigned kol_event_wait(); |
unsigned kol_event_wait_time(unsigned time); |
/contrib/media/updf/apps/kos_main.c |
---|
1,6 → 1,5 |
/*==== INCLUDES ====*/ |
#include <kos32sys.h> |
#include "fitz.h" |
#include "mupdf.h" |
#include "pdfapp.h" |
234,7 → 233,7 |
void DrawToolbarButton(int x, char image_id) |
{ |
kol_btn_define(x, 5, 26-1, 24-1, 10 + image_id + BT_HIDE, 0); |
draw_bitmap(image_id * 24 * 26 * 3 + toolbar_image, x, 5, 26, 24); |
kol_paint_image(x, 5, 26, 24, image_id * 24 * 26 * 3 + toolbar_image); |
} |
void DrawMainWindow(void) |
376,22 → 375,22 |
for(;;) |
{ |
switch(get_os_event()) |
switch(kol_event_wait()) |
{ |
case evReDraw: |
// gapp.shrinkwrap = 2; |
BeginDraw(); |
kol_paint_start(); |
kol_wnd_define(screen_max_x / 2 - 350-50+kos_random(50), |
screen_max_y / 2 - 300-50+kos_random(50), |
700, 600, 0x73000000, 0x800000FF, Title); |
EndDraw(); |
get_proc_info((char*)&Form); |
kol_paint_end(); |
kol_process_info(-1, (char*)&Form); |
if (Form.window_state > 2) continue; // if Rolled-up |
if (Form.window_state & 4) continue; // if Rolled-up |
// Minimal size (700x600) |
if (Form.width < 700) sys_change_window(OLD, OLD, 700, OLD); |
if (Form.height < 600) sys_change_window(OLD, OLD, OLD, 600); |
if (Form.width < 700) kol_wnd_change(-1, -1, 700, -1); |
if (Form.height < 600) kol_wnd_change(-1, -1, -1, 600); |
DrawMainWindow(); |
break; |
418,7 → 417,7 |
break; |
case evButton: |
butt = get_os_button(); |
butt = kol_btn_get(); |
if(butt==1) exit(0); |
if(butt==10) RunOpenApp(argv[0]); |
if(butt==11) PageZoomOut(); //magnify - |