uPDF: clean

git-svn-id: svn://kolibrios.org@8505 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2021-01-03 15:07:11 +00:00
parent ce1814d274
commit b3b42b93c7
4 changed files with 33 additions and 70 deletions

View File

@ -27,17 +27,6 @@ void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs,
asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) ); asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) );
} }
void kol_wnd_move(unsigned x, unsigned y)
{
asm volatile ("int $0x40"::"a"(67), "b"(x), "c"(y), "d"(-1), "S"(-1));
}
void kol_wnd_size(unsigned x, unsigned y)
{
asm volatile ("int $0x40"::"a"(67), "b"(-1), "c"(-1), "d"(x), "S"(y));
};
void kol_event_mask(unsigned e) void kol_event_mask(unsigned e)
{ {
asm volatile ("int $0x40"::"a"(40), "b"(e)); asm volatile ("int $0x40"::"a"(40), "b"(e));

View File

@ -97,11 +97,6 @@ void *data;
void kol_exit(); void kol_exit();
void kol_sleep(unsigned d); 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_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t);
#define OLD -1
void kol_wnd_move(unsigned x, unsigned y);
void kol_wnd_size(unsigned x, unsigned y);
void kol_wnd_caption(char *s); void kol_wnd_caption(char *s);
void kol_event_mask(unsigned e); void kol_event_mask(unsigned e);
unsigned kol_event_wait(); unsigned kol_event_wait();
@ -167,34 +162,3 @@ int kos_get_mouse_wheels(void);
void kos_screen_max(int* x, int* y); void kos_screen_max(int* x, int* y);
int kos_get_key(); int kos_get_key();
void kos_text(int x, int y, int color, const char* text, int len); void kos_text(int x, int y, int color, const char* text, int len);
//// Struct from menuet/os.h
//// Need rewrite!
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)

View File

@ -16,7 +16,7 @@ char debugstr[256];
char do_not_blit=0; char do_not_blit=0;
#define TOOLBAR_HEIGHT 34 #define TOOLBAR_HEIGHT 34
struct process_table_entry Form; struct proc_info Form;
#define DOCUMENT_BORDER 0x979797 #define DOCUMENT_BORDER 0x979797
#define DOCUMENT_BG 0xABABAB #define DOCUMENT_BG 0xABABAB
@ -128,14 +128,14 @@ void winblit(pdfapp_t *app)
if (key_mode_enter_page_number==1) HandleNewPageNumber(0); else DrawPagination(); if (key_mode_enter_page_number==1) HandleNewPageNumber(0); else DrawPagination();
if (Form.client_width > gapp.image->w) window_center = (Form.client_width - gapp.image->w) / 2; else window_center = 0; if (Form.cwidth > gapp.image->w) window_center = (Form.cwidth - gapp.image->w) / 2; else window_center = 0;
gapp.panx = 0; gapp.panx = 0;
kos_blit(window_center + Form.client_left, kos_blit(window_center + Form.cleft,
Form.client_top + TOOLBAR_HEIGHT, Form.ctop + TOOLBAR_HEIGHT,
Form.client_width, Form.cwidth,
Form.client_height - TOOLBAR_HEIGHT, Form.cheight - TOOLBAR_HEIGHT,
gapp.panx, gapp.panx,
gapp.pany, gapp.pany,
gapp.image->w, gapp.image->w,
@ -153,27 +153,27 @@ void winblit(pdfapp_t *app)
void DrawPageSides(void) void DrawPageSides(void)
{ {
if (gapp.image->h < Form.client_height - TOOLBAR_HEIGHT) { if (gapp.image->h < Form.cheight - TOOLBAR_HEIGHT) {
draw_h = gapp.image->h - gapp.pany; draw_h = gapp.image->h - gapp.pany;
} else { } else {
draw_h = Form.client_height - TOOLBAR_HEIGHT; draw_h = Form.cheight - TOOLBAR_HEIGHT;
} }
if (gapp.image->w < Form.client_width) { if (gapp.image->w < Form.cwidth) {
window_center = (Form.client_width - gapp.image->w) / 2; window_center = (Form.cwidth - gapp.image->w) / 2;
draw_w = 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(0, TOOLBAR_HEIGHT, window_center-1, Form.cheight - TOOLBAR_HEIGHT, DOCUMENT_BG);
kol_paint_bar(window_center-1, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER); 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, 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); kol_paint_bar(window_center + gapp.image->w+1, TOOLBAR_HEIGHT, Form.cwidth - window_center - gapp.image->w - 1, Form.cheight - TOOLBAR_HEIGHT, DOCUMENT_BG);
} else { } else {
window_center = 1; window_center = 1;
draw_w = Form.client_width; draw_w = Form.cwidth;
} }
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, draw_w, 1, DOCUMENT_BORDER);
kol_paint_bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT + 1, 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); draw_w, Form.cheight - gapp.image->h - TOOLBAR_HEIGHT + gapp.pany - 1, DOCUMENT_BG);
} }
@ -239,15 +239,15 @@ void DrawToolbarButton(int x, char image_id)
void DrawMainWindow(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, 0, Form.cwidth, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder)
kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.client_width, 1, 0x7F7F7F); kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.cwidth, 1, 0x7F7F7F);
DrawToolbarButton(8,0); //open_folder DrawToolbarButton(8,0); //open_folder
DrawToolbarButton(42,1); //magnify - DrawToolbarButton(42,1); //magnify -
DrawToolbarButton(67,2); //magnify + DrawToolbarButton(67,2); //magnify +
DrawToolbarButton(101,6); //rotate left DrawToolbarButton(101,6); //rotate left
DrawToolbarButton(126,7); //rotate right DrawToolbarButton(126,7); //rotate right
DrawToolbarButton(Form.client_width - 160,3); //show help DrawToolbarButton(Form.cwidth - 160,3); //show help
show_area_x = Form.client_width - show_area_w - 34; show_area_x = Form.cwidth - show_area_w - 34;
DrawToolbarButton(show_area_x - 26,4); //prev page DrawToolbarButton(show_area_x - 26,4); //prev page
DrawToolbarButton(show_area_x + show_area_w,5); //nex page DrawToolbarButton(show_area_x + show_area_w,5); //nex page
kol_btn_define(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);
@ -263,7 +263,7 @@ void DrawMainWindow(void)
void PageScrollDown(void) void PageScrollDown(void)
{ {
//pdfapp_onkey(&gapp, 'k'); //move down //pdfapp_onkey(&gapp, 'k'); //move down
if (gapp.image->h - gapp.pany - SCROLL_H < Form.client_height - TOOLBAR_HEIGHT) if (gapp.image->h - gapp.pany - SCROLL_H < Form.cheight - TOOLBAR_HEIGHT)
{ {
pdfapp_onkey(&gapp, '.'); pdfapp_onkey(&gapp, '.');
} }
@ -287,7 +287,7 @@ void PageScrollUp(void)
do_not_blit = 1; do_not_blit = 1;
pdfapp_onkey(&gapp, ','); pdfapp_onkey(&gapp, ',');
do_not_blit = 0; do_not_blit = 0;
gapp.pany = gapp.image->h - SCROLL_H - Form.client_height + TOOLBAR_HEIGHT; gapp.pany = gapp.image->h - SCROLL_H - Form.cheight + TOOLBAR_HEIGHT;
if (gapp.pany < 0) gapp.pany = 0; if (gapp.pany < 0) gapp.pany = 0;
//sprintf (debugstr, "gapp.pany: %d \n", gapp.pany); //sprintf (debugstr, "gapp.pany: %d \n", gapp.pany);
//kol_board_puts(debugstr); //kol_board_puts(debugstr);
@ -390,8 +390,8 @@ int main (int argc, char* argv[])
if (Form.window_state > 2) continue; // if Rolled-up if (Form.window_state > 2) continue; // if Rolled-up
// Minimal size (700x600) // Minimal size (700x600)
if (Form.winx_size < 700) kol_wnd_size(700, OLD); if (Form.width < 700) sys_change_window(OLD, OLD, 700, OLD);
if (Form.winy_size < 600) kol_wnd_size(OLD, 600); if (Form.height < 600) sys_change_window(OLD, OLD, OLD, 600);
DrawMainWindow(); DrawMainWindow();
break; break;
@ -425,7 +425,7 @@ int main (int argc, char* argv[])
if(butt==12) PageZoomIn(); //magnify + if(butt==12) PageZoomIn(); //magnify +
if(butt==13) //show help if(butt==13) //show help
{ {
kol_paint_bar(0, TOOLBAR_HEIGHT, Form.client_width, Form.client_height - TOOLBAR_HEIGHT, 0xF2F2F2); kol_paint_bar(0, TOOLBAR_HEIGHT, Form.cwidth, Form.cheight - TOOLBAR_HEIGHT, 0xF2F2F2);
kos_text(20, 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); kos_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0);
for (ii=0; help[ii]!=0; ii++) { for (ii=0; help[ii]!=0; ii++) {

View File

@ -0,0 +1,10 @@
if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../../programs" or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_newlib.lua")
CFLAGS = CFLAGS .. " -std=c99 -DHAVE_CONFIG_H"
INCLUDES = INCLUDES .. " -I ."
compile_gcc{"jbig2_arith.c", "jbig2_arith_iaid.c", "jbig2_arith_int.c", "jbig2.c", "jbig2dec.c", "jbig2_generic.c", "jbig2_halftone.c", "jbig2_huffman.c", "jbig2_image.c", "jbig2_image_pbm.c", "jbig2_metadata.c", "jbig2_mmr.c", "jbig2_page.c", "jbig2_refinement.c", "jbig2_segment.c", "jbig2_symbol_dict.c", "jbig2_text.c", "memcmp.c", "sha1.c"}
tup.rule(OBJS, "kos32-ar rcs %o %f", {"../lib/libjbig2dec.a", "<../lib/libjbig2dec>"})