/contrib/media/updf/SYSCALL/src/cofflib.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/bar.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/thread.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/window.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/exit.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/pci.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/button.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/ipc.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/date.c |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/process.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/file.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/screen.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/pixel.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/event.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/image.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/text.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/mpu401.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/debug.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/line.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/sound.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/backgr.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/keyb.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/irq.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/clock.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/dga.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/Makefile |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/delay.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/systree.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/SYSCALL/src/param.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/contrib/media/updf/apps/Makefile |
---|
6,15 → 6,13 |
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 |
INCLUDES = -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 -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 -lopenjpeg -lz -lc.dll -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 --subsystem native |
objcopy updf -O binary |
/contrib/media/updf/apps/kolibri.c |
---|
485,3 → 485,37 |
} |
void kos_move_window(int posx, int posy, int sizex, int sizey) |
{ |
__asm__ __volatile__( |
"int $0x40" |
::"a"(67), |
"b"(posx), |
"c"(posy), |
"d"(sizex), |
"S"(sizey)); |
}; |
void kos_text(int x, int y, int color, const char* text, int len) |
{ |
asm volatile ("int $0x40"::"a"(4),"b"((x<<16) | y),"c"(color),"d"((unsigned long)text),"S"(len)); |
}; |
void kos_screen_max(int* x, int* y) |
{ |
unsigned long v; |
__asm__ __volatile__( |
"int $0x40" |
:"=a"(v) |
:"a"(14)); |
if(x) *x = v >> 16; |
if(y) *y = v & 0xFFFF; |
}; |
int kol_get_key() |
{ |
unsigned short __ret; |
asm volatile("int $0x40":"=a"(__ret):"0"(2)); |
if(!(__ret & 0xFF)) return (__ret>>8)&0xFF; else return 0; |
} |
/contrib/media/updf/apps/kolibri.h |
---|
3,6 → 3,16 |
#define NULL ((void*)0) |
#endif |
#define EVENT_REDRAW 0x00000001 |
#define EVENT_KEY 0x00000002 |
#define EVENT_BUTTON 0x00000004 |
#define EVENT_END_REQUEST 0x00000008 |
#define EVENT_DESKTOP_BACK_DRAW 0x00000010 |
#define EVENT_MOUSE_CHANGE 0x00000020 |
#define EVENT_IPC 0x00000040 |
#define EVENT_MOUSE_CURSOR_MASK 0x40000000 |
#define EVENT_MOUSE_WINDOW_MASK 0x80000000 |
#define SHM_OPEN 0 |
#define SHM_OPEN_ALWAYS 0x04 |
#define SHM_CREATE 0x08 |
149,3 → 159,41 |
int srcy,int srcw, int srch, int stride, char *d); |
int kos_random(int num); |
int kos_get_mouse_wheels(void); |
#define OLD -1 |
void kos_move_window(int posx, int posy, int sizex, int sizey); |
void kos_text(int x, int y, int color, const char* text, int len); |
void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c); |
void kos_screen_max(int* x, int* y); |
int kol_get_key(); |
//// Struct from menuet/os.h |
typedef unsigned char __u8; |
typedef unsigned short __u16; |
typedef unsigned long __u32; |
#pragma pack(push,1) |
struct process_table_entry |
{ |
__u32 cpu_usage; |
__u16 pos_in_windowing_stack; |
__u16 win_stack_val_at_ecx; |
__u16 reserved1; |
char name[12]; |
__u32 memstart; |
__u32 memused; |
__u32 pid; |
__u32 winx_start,winy_start; |
__u32 winx_size,winy_size; |
__u16 thread_state; |
__u16 reserved2; |
__u32 client_left,client_top,client_width,client_height; |
__u8 window_state; |
__u8 reserved3[1024-71]; |
}; |
#pragma pack(pop) |
/contrib/media/updf/apps/kos_main.c |
---|
1,4 → 1,7 |
#include <menuet/os.h> |
/*==== INCLUDES ====*/ |
//#include <menuet/os.h> |
#include <kos32sys.h> |
#include "fitz.h" |
#include "mupdf.h" |
#include "pdfapp.h" |
5,10 → 8,6 |
#include "icons/allbtns.h" |
#include "kolibri.h" |
void run_app() |
{ |
return; |
} |
/*==== DATA ====*/ |
58,7 → 57,7 |
void DrawPagination(void); |
void HandleNewPageNumber(unsigned char key); |
void ApplyNewPageNumber(void); |
void DrawWindow(void); |
void DrawMainWindow(void); |
// not implemented yet |
230,7 → 229,7 |
if (key==ASCII_KEY_ESC) |
{ |
key_mode_enter_page_number = 0; |
DrawWindow(); |
DrawMainWindow(); |
return; |
} |
237,7 → 236,7 |
itoa(new_page_number, label_new_page, 10); |
strcat(label_new_page, "_"); |
kol_paint_bar(show_area_x, 6, show_area_w, 22, 0xFDF88E); |
__menuet__write_text(show_area_x + show_area_w/2 - strlen(label_new_page)*6/2, 14, 0x000000, label_new_page, strlen(label_new_page)); |
kos_text(show_area_x + show_area_w/2 - strlen(label_new_page)*6/2, 14, 0x000000, label_new_page, strlen(label_new_page)); |
if (new_page_number > gapp.pagecount) ApplyNewPageNumber(); |
} |
254,16 → 253,16 |
char pages_display[12]; |
kol_paint_bar(show_area_x, 6, show_area_w, 22, 0xF4F4F4); |
sprintf (pages_display, "%d/%d", gapp.pageno, gapp.pagecount); |
__menuet__write_text(show_area_x + show_area_w/2 - strlen(pages_display)*6/2, 14, 0x000000, pages_display, strlen(pages_display)); |
kos_text(show_area_x + show_area_w/2 - strlen(pages_display)*6/2, 14, 0x000000, pages_display, strlen(pages_display)); |
} |
void DrawToolbarButton(int x, char image_id) |
{ |
__menuet__make_button(x, 5, 26-1, 24-1, 10 + image_id + BT_HIDE, 0); |
__menuet__putimage(x, 5, 26, 24, image_id * 24 * 26 * 3 + toolbar_image); |
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); |
} |
void DrawWindow(void) |
void DrawMainWindow(void) |
{ |
kol_paint_bar(0, 0, Form.client_width, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder) |
kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.client_width, 1, 0x7F7F7F); |
276,7 → 275,7 |
show_area_x = Form.client_width - show_area_w - 34; |
DrawToolbarButton(show_area_x - 26,4); //prev page |
DrawToolbarButton(show_area_x + show_area_w,5); //nex page |
__menuet__make_button(show_area_x-1, 5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4); |
kol_btn_define(show_area_x-1, 5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4); |
kol_paint_bar(show_area_x, 5, show_area_w, 1, 0xA4A4A4); |
kol_paint_bar(show_area_x, 28, show_area_w, 1, 0xA4A4A4); |
winblit(&gapp); |
334,7 → 333,6 |
kol_file_70(&r); |
} |
void PageZoomIn(void) |
{ |
pdfapp_onkey(&gapp, '+'); |
398,38 → 396,39 |
kol_board_puts("Inital paint\n"); |
int butt, key, screen_max_x, screen_max_y; |
__menuet__get_screen_max(&screen_max_x, &screen_max_y); |
__menuet__set_bitfield_for_wanted_events(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); |
kos_screen_max(&screen_max_x, &screen_max_y); |
kol_event_mask(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); |
for(;;) |
{ |
switch(__menuet__wait_for_event()) |
switch(get_os_event()) |
{ |
case evReDraw: |
// gapp.shrinkwrap = 2; |
__menuet__window_redraw(1); |
__menuet__define_window(screen_max_x / 2 - 350-50+kos_random(50), |
BeginDraw(); |
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); |
__menuet__window_redraw(2); |
__menuet__get_process_table(&Form, PID_WHOAMI); |
if (Form.window_state > 2) continue; //fix rolled up |
EndDraw(); |
get_proc_info((char*)&Form); |
// ?? |
Form.client_width++; //fix for Menuet kernel bug |
Form.client_height++; //fix for Menuet kernel bug |
if (Form.window_state > 2) continue; // if Rolled-up |
DrawWindow(); |
// Minimal size (700x600) |
if (Form.winx_size < 700) kos_move_window(OLD, OLD, 700, OLD); |
if (Form.winy_size < 600) kos_move_window(OLD, OLD, OLD, 600); |
DrawMainWindow(); |
break; |
case evKey: |
key = __menuet__getkey(); |
key = kol_get_key(); |
if (key_mode_enter_page_number) |
{ |
HandleNewPageNumber(key); |
break; |
} |
if (key==ASCII_KEY_ESC) DrawWindow(); //close help |
if (key==ASCII_KEY_ESC) DrawMainWindow(); //close help |
if (key==ASCII_KEY_PGDN) pdfapp_onkey(&gapp, ']'); |
if (key==ASCII_KEY_PGUP) pdfapp_onkey(&gapp, '['); |
if (key==ASCII_KEY_HOME) pdfapp_onkey(&gapp, 'g'); |
444,7 → 443,7 |
break; |
case evButton: |
butt = __menuet__get_button_id(); |
butt = get_os_button(); |
if(butt==1) exit(0); |
if(butt==10) RunOpenApp(argv[0]); |
if(butt==11) PageZoomOut(); //magnify - |
452,10 → 451,10 |
if(butt==13) //show help |
{ |
kol_paint_bar(0, TOOLBAR_HEIGHT, Form.client_width, Form.client_height - TOOLBAR_HEIGHT, 0xF2F2F2); |
__menuet__write_text(20, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); |
__menuet__write_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); |
kos_text(20, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); |
kos_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); |
for (ii=0; help[ii]!=0; ii++) { |
__menuet__write_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0); |
kos_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0); |
} |
} |
if(butt==14) pdfapp_onkey(&gapp, '['); //previous page |