Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 7623 → Rev 7624

/contrib/media/updf/freetypesrc
File deleted
/contrib/media/updf/stub/osrules.mak
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/contrib/media/updf/stub/crt0_coff.asm
File deleted
/contrib/media/updf/stub/crt0_elf_nounderscores.asm
File deleted
/contrib/media/updf/stub/crt0.asm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/contrib/media/updf/stub/crt0_elf.asm
File deleted
/contrib/media/updf/stub/Makefile
File deleted
/contrib/media/updf/Makefile
10,15 → 10,8
CFLAGS += -Ifitz -Ipdf -Iscripts -fno-stack-protector -nostdinc -fno-builtin -m32 -I include -fno-pic -w
LIBS += -lfreetype2 -lpng -ljbig2dec -ljpeg -lopenjpeg -lz -lm -lc
 
#include Makerules
#include Makethird
THIRD_LIBS := $(FREETYPE_LIB) $(JBIG2DEC_LIB) $(JPEG_LIB) $(OPENJPEG_LIB) $(ZLIB_LIB)
 
THIRD_LIBS := $(FREETYPE_LIB)
THIRD_LIBS += $(JBIG2DEC_LIB)
THIRD_LIBS += $(JPEG_LIB)
THIRD_LIBS += $(OPENJPEG_LIB)
THIRD_LIBS += $(ZLIB_LIB)
 
ifeq "$(verbose)" ""
QUIET_AR = @ echo ' ' ' ' AR $@ ;
QUIET_CC = @ echo ' ' ' ' CC $@ ;
54,8 → 47,6
$(OUT)/%.o : scripts/%.c | $(OUT)
$(CC_CMD)
 
.PRECIOUS : $(OUT)/%.o # Keep intermediates from chained rules
 
# --- Fitz and MuPDF libraries ---
 
FITZ_LIB := $(OUT)/libfitz.a
68,12 → 59,10
$(MUPDF_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o))
 
libs: $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
@ echo MuPDF and underlying libraries built
 
# --- Generated CMAP and FONT files ---
 
CMAPDUMP := scripts/cmapdump
# FONTDUMP := scripts/fontdump
 
CMAP_CNS_SRC := $(wildcard cmaps/cns/*)
CMAP_GB_SRC := $(wildcard cmaps/gb/*)
115,10 → 104,6
 
# --- Tools and Apps ---
 
PDF_APPS := $(addprefix $(OUT)/, pdfdraw pdfclean pdfextract pdfinfo pdfshow)
 
$(PDF_APPS) : $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
 
MUPDF := $(OUT)/mupdf
$(MUPDF) : $(MUPDF_LIB) $(FITZ_LIB) $(THIRD_LIBS)
ifeq "$(NOX11)" ""
/contrib/media/updf/apps/pdfclean.c
File deleted
/contrib/media/updf/apps/pdfshow.c
File deleted
/contrib/media/updf/apps/pdfinfo.c
File deleted
/contrib/media/updf/apps/kolibri.c
436,7 → 436,6
asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer));
}
 
 
int kos_random(int num)
{
srand(kol_time_tick());
443,3 → 442,44
return rand() % num;
}
 
int kos_get_mouse_wheels(void)
{
int val;
asm ("int $0x40":"=a"(val):"a"(37),"b"(7));
return val;
};
 
 
struct blit_call
{
int dstx;
int dsty;
int w;
int h;
 
int srcx;
int srcy;
int srcw;
int srch;
 
unsigned char *d;
int stride;
};
 
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;
image.dstx=dstx;
image.dsty=dsty;
image.w=w;
image.h=h;
image.srcx=srcx;
image.srcy=srcy;
image.srcw=srcw;
image.srch=srch;
image.stride=stride;
image.d=d;
asm ("int $0x40"::"a"(73),"b"(0),"c"(&image));
}
 
/contrib/media/updf/apps/kolibri.h
14,6 → 14,33
 
#define FILENAME_MAX 1024
 
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
 
#define evReDraw 1
#define evKey 2
#define evButton 3
#define evMouse 6
#define evNetwork 8
 
#define ASCII_KEY_LEFT 176
#define ASCII_KEY_RIGHT 179
#define ASCII_KEY_DOWN 177
#define ASCII_KEY_UP 178
#define ASCII_KEY_HOME 180
#define ASCII_KEY_END 181
#define ASCII_KEY_PGDN 183
#define ASCII_KEY_PGUP 184
 
#define ASCII_KEY_BS 8
#define ASCII_KEY_TAB 9
#define ASCII_KEY_ENTER 13
#define ASCII_KEY_ESC 27
#define ASCII_KEY_DEL 182
#define ASCII_KEY_INS 185
#define ASCII_KEY_SPACE 032
 
#pragma pack(push,1)
typedef struct
{
/contrib/media/updf/apps/kos_main.c
6,79 → 6,11
#include "icons/allbtns.h"
#include "kolibri.c"
 
// need to be a part of menuet/os.h
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
 
#define evReDraw 1
#define evKey 2
#define evButton 3
#define evMouse 6
#define evNetwork 8
 
#define ASCII_KEY_LEFT 176
#define ASCII_KEY_RIGHT 179
#define ASCII_KEY_DOWN 177
#define ASCII_KEY_UP 178
#define ASCII_KEY_HOME 180
#define ASCII_KEY_END 181
#define ASCII_KEY_PGDN 183
#define ASCII_KEY_PGUP 184
 
#define ASCII_KEY_BS 8
#define ASCII_KEY_TAB 9
#define ASCII_KEY_ENTER 13
#define ASCII_KEY_ESC 27
#define ASCII_KEY_DEL 182
#define ASCII_KEY_INS 185
#define ASCII_KEY_SPACE 032
 
struct blit_call
{
int dstx;
int dsty;
int w;
int h;
 
int srcx;
int srcy;
int srcw;
int srch;
 
unsigned char *d;
int stride;
};
 
void blit(int dstx, int dsty, int w, int h, int srcx, int srcy,int srcw, int srch, int stride, char *d) //Вызов сисфункции Blitter
{
struct blit_call image;
image.dstx=dstx;
image.dsty=dsty;
image.w=w;
image.h=h;
image.srcx=srcx;
image.srcy=srcy;
image.srcw=srcw;
image.srch=srch;
image.stride=stride;
image.d=d;
asm ("int $0x40"::"a"(73),"b"(0),"c"(&image));
}
 
void run_app()
{
return;
}
 
 
int __menuet__get_mouse_wheels(void)
{
int val;
asm ("int $0x40":"=a"(val):"a"(37),"b"(7));
return val;
};
 
/*==== DATA ====*/
 
static char Title[1024] = "uPDF";
195,7 → 127,7
 
gapp.panx = 0;
if (gapp.image->n == 4) {
blit(window_center + Form.client_left,
kos_blit(window_center + Form.client_left,
Form.client_top + TOOLBAR_HEIGHT,
Form.client_width,
Form.client_height - TOOLBAR_HEIGHT,
221,7 → 153,7
d[3] = *s++;
d += 4;
}
blit(window_center + Form.client_left,
kos_blit(window_center + Form.client_left,
Form.client_top + TOOLBAR_HEIGHT,
Form.client_width,
Form.client_height - TOOLBAR_HEIGHT,
240,142 → 172,30
 
void DrawPageSides(void)
{
if (Form.client_width > gapp.image->w) window_center = (Form.client_width - gapp.image->w) / 2; else window_center = 0;
if (gapp.image->h < Form.client_height - TOOLBAR_HEIGHT) draw_h = gapp.image->h - gapp.pany; else draw_h = Form.client_height - TOOLBAR_HEIGHT;
if (gapp.image->w < Form.client_width)
{
if (gapp.image->h < Form.client_height - TOOLBAR_HEIGHT) {
draw_h = gapp.image->h - gapp.pany;
} else {
draw_h = Form.client_height - TOOLBAR_HEIGHT;
}
if (gapp.image->w < Form.client_width) {
window_center = (Form.client_width - gapp.image->w) / 2;
draw_w = gapp.image->w + 2;
kol_paint_bar(0, TOOLBAR_HEIGHT, window_center-1, Form.client_height - TOOLBAR_HEIGHT, DOCUMENT_BG);
kol_paint_bar(window_center-1, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
kol_paint_bar(window_center + gapp.image->w, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
kol_paint_bar(window_center + gapp.image->w+1, TOOLBAR_HEIGHT, Form.client_width - window_center - gapp.image->w - 1, Form.client_height - TOOLBAR_HEIGHT, DOCUMENT_BG);
}
if (gapp.image->w < Form.client_width)
{
draw_w = gapp.image->w + 2;
}
else
{
} else {
window_center = 1;
draw_w = Form.client_width;
}
kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT, draw_w, 1, DOCUMENT_BORDER);
kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT + 1, draw_w, Form.client_height - gapp.image->h - TOOLBAR_HEIGHT + gapp.pany - 1, DOCUMENT_BG);
kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT + 1,
draw_w, Form.client_height - gapp.image->h - TOOLBAR_HEIGHT + gapp.pany - 1, DOCUMENT_BG);
}
 
 
 
int main (void)
{
char ii, mouse_wheels_state;
char* original_command_line = *(char**)0x1C;
if (*original_command_line == 0) {
kol_board_puts("Running uPDF without any param");
RunOpenApp();
__menuet__sys_exit();
}
 
kol_board_puts(original_command_line);
kol_board_puts("\n");
char buf[128];
int resolution = 72;
int pageno = 1;
fz_accelerate();
kol_board_puts("PDF init\n");
pdfapp_init(&gapp);
gapp.scrw = 600;
gapp.scrh = 400;
gapp.resolution = resolution;
gapp.pageno = pageno;
kol_board_puts("PDF Open\n");
pdfapp_open(&gapp, original_command_line, 0, 0);
kol_board_puts("PDF Opened\n");
wintitle(&gapp, 0);
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);
 
for(;;)
{
 
switch(__menuet__wait_for_event())
{
case evReDraw:
// gapp.shrinkwrap = 2;
__menuet__window_redraw(1);
__menuet__define_window(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
Form.client_width++; //fix for Menuet kernel bug
Form.client_height++; //fix for Menuet kernel bug
DrawWindow();
break;
 
case evKey:
key = __menuet__getkey();
if (key_mode_enter_page_number)
{
HandleNewPageNumber(key);
break;
}
if (key==ASCII_KEY_ESC) DrawWindow(); //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');
if (key==ASCII_KEY_END ) pdfapp_onkey(&gapp, 'G');
if (key=='g' ) pdfapp_onkey(&gapp, 'c');
if ((key=='[' ) || (key=='l')) PageRotateLeft();
if ((key==']' ) || (key=='r')) PageRotateRight();
if (key==ASCII_KEY_DOWN ) PageScrollDown();
if (key==ASCII_KEY_UP ) PageScrollUp();
if (key=='-') PageZoomOut();
if ((key=='=') || (key=='+')) PageZoomIn();
break;
 
case evButton:
butt = __menuet__get_button_id();
if(butt==1) __menuet__sys_exit();
if(butt==10) RunOpenApp();
if(butt==11) PageZoomOut(); //magnify -
if(butt==12) PageZoomIn(); //magnify +
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);
for (ii=0; help[ii]!=0; ii++) {
__menuet__write_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0);
}
}
if(butt==14) pdfapp_onkey(&gapp, '['); //previous page
if(butt==15) pdfapp_onkey(&gapp, ']'); //next page
if(butt==16) PageRotateLeft();
if(butt==17) PageRotateRight();
if(butt==20) GetNewPageNumber();
break;
 
case evMouse:
if (mouse_wheels_state = __menuet__get_mouse_wheels())
{
if (mouse_wheels_state==1) { PageScrollDown(); PageScrollDown(); }
if (mouse_wheels_state==-1) { PageScrollUp(); PageScrollUp(); }
}
//sprintf (debugstr, "mouse_wheels_state: %d \n", mouse_wheels_state);
//kol_board_puts(debugstr);
//pdfapp_onmouse(&gapp, int x, int y, int btn, int modifiers, int state)
break;
}
}
}
 
 
void GetNewPageNumber(void)
{
new_page_number = gapp.pageno;
430,9 → 250,12
__menuet__write_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);
}
 
 
 
void DrawWindow(void)
{
kol_paint_bar(0, 0, Form.client_width, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder)
453,13 → 276,7
DrawPageSides();
}
 
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);
}
 
 
/* Actions */
 
void PageScrollDown(void)
536,3 → 353,113
DrawPageSides();
}
 
int main (void)
{
char ii, mouse_wheels_state;
char* original_command_line = *(char**)0x1C;
if (*original_command_line == 0) {
kol_board_puts("uPDF: no param set, showing OpenDialog");
RunOpenApp();
__menuet__sys_exit();
}
 
kol_board_puts(original_command_line);
kol_board_puts("\n");
char buf[128];
int resolution = 72;
int pageno = 1;
fz_accelerate();
kol_board_puts("PDF init\n");
pdfapp_init(&gapp);
gapp.scrw = 600;
gapp.scrh = 400;
gapp.resolution = resolution;
gapp.pageno = pageno;
kol_board_puts("PDF Open\n");
pdfapp_open(&gapp, original_command_line, 0, 0);
kol_board_puts("PDF Opened\n");
wintitle(&gapp, 0);
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);
 
for(;;)
{
 
switch(__menuet__wait_for_event())
{
case evReDraw:
// gapp.shrinkwrap = 2;
__menuet__window_redraw(1);
__menuet__define_window(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
Form.client_width++; //fix for Menuet kernel bug
Form.client_height++; //fix for Menuet kernel bug
DrawWindow();
break;
 
case evKey:
key = __menuet__getkey();
if (key_mode_enter_page_number)
{
HandleNewPageNumber(key);
break;
}
if (key==ASCII_KEY_ESC) DrawWindow(); //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');
if (key==ASCII_KEY_END ) pdfapp_onkey(&gapp, 'G');
if (key=='g' ) pdfapp_onkey(&gapp, 'c');
if ((key=='[' ) || (key=='l')) PageRotateLeft();
if ((key==']' ) || (key=='r')) PageRotateRight();
if (key==ASCII_KEY_DOWN ) PageScrollDown();
if (key==ASCII_KEY_UP ) PageScrollUp();
if (key=='-') PageZoomOut();
if ((key=='=') || (key=='+')) PageZoomIn();
break;
 
case evButton:
butt = __menuet__get_button_id();
if(butt==1) __menuet__sys_exit();
if(butt==10) RunOpenApp();
if(butt==11) PageZoomOut(); //magnify -
if(butt==12) PageZoomIn(); //magnify +
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);
for (ii=0; help[ii]!=0; ii++) {
__menuet__write_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0);
}
}
if(butt==14) pdfapp_onkey(&gapp, '['); //previous page
if(butt==15) pdfapp_onkey(&gapp, ']'); //next page
if(butt==16) PageRotateLeft();
if(butt==17) PageRotateRight();
if(butt==20) GetNewPageNumber();
break;
 
case evMouse:
if (mouse_wheels_state = kos_get_mouse_wheels())
{
if (mouse_wheels_state==1) { PageScrollDown(); PageScrollDown(); }
if (mouse_wheels_state==-1) { PageScrollUp(); PageScrollUp(); }
}
//sprintf (debugstr, "mouse_wheels_state: %d \n", mouse_wheels_state);
//kol_board_puts(debugstr);
//pdfapp_onmouse(&gapp, int x, int y, int btn, int modifiers, int state)
break;
}
}
}
/contrib/media/updf/build.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property