mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-23 01:11:19 +03:00
uPDF: working "open" button, update build script, start migration to kolibri.c from SHELL
git-svn-id: svn://kolibrios.org@7475 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
03386fe9f4
commit
448bc67a4f
@ -1,29 +1,23 @@
|
||||
#!/bin/sh
|
||||
red=`tput setaf 2`
|
||||
ok=`tput setaf 2`
|
||||
error=`tput setaf 1`
|
||||
reset=`tput sgr0`
|
||||
DROPBOX_UPDF="/home/leency/Dropbox/updf"
|
||||
|
||||
echo "${red}Removing kos_main.o...${reset}"
|
||||
clear
|
||||
rm build/kos_main.o
|
||||
rm build/mupdf
|
||||
|
||||
echo "${red}Building updf...${reset}"
|
||||
make
|
||||
|
||||
echo "${red}Converting to KolibriOS binnary...${reset}"
|
||||
cd build
|
||||
objcopy -O binary mupdf
|
||||
|
||||
if [ -f /home/leency/Dropbox/updf ]; then
|
||||
echo "${red}Removing mypdf from Dropbox...${reset}"
|
||||
rm $DROPBOX_UPDF
|
||||
fi
|
||||
|
||||
echo "${red}Copying new file to Dropbox...${reset}"
|
||||
cp mupdf $DROPBOX_UPDF
|
||||
|
||||
if [ ! -f $DROPBOX_UPDF ]; then
|
||||
echo "${error}Compilation error${reset}"
|
||||
if [ ! -f build/mupdf ]; then
|
||||
echo "${error} Compilation error ${reset}"
|
||||
$SHELL
|
||||
fi
|
||||
echo "${ok} OK ${reset}"
|
||||
objcopy -O binary build/mupdf
|
||||
rm updf
|
||||
cp build/mupdf updf
|
||||
ncftpput -u xxxx -p xxxx kolibri-n.org /public_ftp ~/Desktop/updf/updf
|
||||
if [ $? -ne 0 ]; then echo \"Upload failed\"; fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ GEN := generated
|
||||
|
||||
default: all
|
||||
LDFLAGS = -Tinclude/scripts/menuetos_app_v01.ld -nostdlib -L include/lib
|
||||
CFLAGS += -Ifitz -Ipdf -Ixps -Iscripts -fno-stack-protector -nostdinc -fno-builtin -m32 -I include -fno-pic
|
||||
CFLAGS += -Ifitz -Ipdf -Ixps -Iscripts -fno-stack-protector -nostdinc -fno-builtin -m32 -I include -fno-pic -w
|
||||
LIBS += -lfreetype2 -lpng -ljbig2dec -ljpeg -lopenjpeg -lz -lm -lc
|
||||
|
||||
#include Makerules
|
||||
|
445
contrib/media/updf/apps/kolibri.c
Normal file
445
contrib/media/updf/apps/kolibri.c
Normal file
@ -0,0 +1,445 @@
|
||||
#include "kolibri.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
extern char KOL_PATH[256];
|
||||
extern char KOL_PARAM[256];
|
||||
extern char KOL_DIR[256];
|
||||
|
||||
|
||||
void kol_exit()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(-1));
|
||||
}
|
||||
|
||||
|
||||
void kol_sleep(unsigned d)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(5), "b"(d));
|
||||
}
|
||||
|
||||
|
||||
// define a window
|
||||
// x, y - position; w, h - size; cs - color and style; c - caption; b - boder
|
||||
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t)
|
||||
{
|
||||
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_event_mask(unsigned e)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(40), "b"(e));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_event_wait()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(10));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_event_wait_time(unsigned time)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(23), "b"(time));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_event_check()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(11));
|
||||
}
|
||||
|
||||
|
||||
inline void __attribute__((__always_inline__)) kol_paint_start()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(12), "b"(1));
|
||||
}
|
||||
|
||||
|
||||
inline void __attribute__((__always_inline__)) kol_paint_end()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(12), "b"(2));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_pixel(unsigned x, unsigned y, unsigned c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(1), "b"(x), "c"(y), "d"(c));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_bar(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(13), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_line(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(38), "b"(x1*65536+x2), "c"(y1*65536+y2), "d"(c));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_string(unsigned x, unsigned y, char *s, unsigned c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(4), "b"(x*65536+y), "c"(c), "d"(s));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_image(unsigned x, unsigned y, unsigned w, unsigned h, char *d)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(7), "c"(w*65536+h), "d"(x*65536+y), "b"(d));
|
||||
}
|
||||
|
||||
|
||||
void kol_paint_image_24(unsigned x, unsigned y, unsigned w, unsigned h, char *d)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(65), "b"(d), "c"(w*65536+h), "d"(x*65536+y), "S"(32));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_key_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(2));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_key_control()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(66), "b"(3));
|
||||
}
|
||||
|
||||
|
||||
void kol_key_lang_set(unsigned lang)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(21), "b"(2), "c"(9), "d"(lang));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_key_lang_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(26), "b"(2), "c"(9));
|
||||
}
|
||||
|
||||
|
||||
void kol_key_mode_set(unsigned mode)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(66), "b"(1), "c"(mode));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_key_mode_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(66), "b"(2));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_btn_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(17));
|
||||
}
|
||||
|
||||
|
||||
void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(8), "b"(x*65536+w), "c"(y*65536+h), "d"(d), "S"(c));
|
||||
}
|
||||
|
||||
|
||||
void kol_btn_type(unsigned t)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(48), "b"(1), "c"(t));
|
||||
}
|
||||
|
||||
|
||||
void kol_wnd_caption(char *s)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(71), "b"(1), "c"(s));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_mouse_pos()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(37), "b"(0));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_mouse_posw()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(37), "b"(1));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_mouse_btn()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(37), "b"(2));
|
||||
}
|
||||
|
||||
|
||||
void kol_board_putc(char c)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(c));
|
||||
}
|
||||
|
||||
|
||||
void kol_board_puts(char *s)
|
||||
{
|
||||
unsigned i;
|
||||
i = 0;
|
||||
while (*(s+i))
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(*(s+i)));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void kol_board_puti(int n)
|
||||
{
|
||||
char c;
|
||||
|
||||
if ( n > 1 )
|
||||
kol_board_puti(n / 10);
|
||||
|
||||
c = n % 10 + '0';
|
||||
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(c));
|
||||
|
||||
}
|
||||
|
||||
|
||||
int kol_file_70(kol_struct70 *k)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(70), "b"(k));
|
||||
}
|
||||
|
||||
|
||||
kol_struct_import* kol_cofflib_load(char *name)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(68), "b"(19), "c"(name));
|
||||
}
|
||||
|
||||
|
||||
void* kol_cofflib_procload (kol_struct_import *imp, char *name)
|
||||
{
|
||||
int i;
|
||||
for (i=0;;i++)
|
||||
if ( NULL == ((imp+i) -> name))
|
||||
break;
|
||||
else
|
||||
if ( 0 == strcmp(name, (imp+i)->name) )
|
||||
return (imp+i)->data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_cofflib_procnum (kol_struct_import *imp)
|
||||
{
|
||||
unsigned i, n;
|
||||
|
||||
for (i=n=0;;i++)
|
||||
if ( NULL == ((imp+i) -> name))
|
||||
break;
|
||||
else
|
||||
n++;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
void kol_cofflib_procname (kol_struct_import *imp, char *name, unsigned n)
|
||||
{
|
||||
unsigned i;
|
||||
*name = 0;
|
||||
|
||||
for (i=0;;i++)
|
||||
if ( NULL == ((imp+i) -> name))
|
||||
break;
|
||||
else
|
||||
if ( i == n )
|
||||
{
|
||||
strcpy(name, ((imp+i)->name));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_cpufreq()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(5));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_mem()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(17));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_memfree()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(16));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_time_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(3));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_date_get()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(29));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_system_end(unsigned param)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(9), "c"(param));
|
||||
}
|
||||
|
||||
|
||||
void kol_path_file2dir(char *dir, char *fname)
|
||||
{
|
||||
unsigned i;
|
||||
strcpy (dir, fname);
|
||||
for ( i = strlen(dir);; --i)
|
||||
if ( '/' == dir[i])
|
||||
{
|
||||
dir[i] = '\0';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void kol_path_full(char *full, char *fname)
|
||||
{
|
||||
char temp[256];
|
||||
|
||||
switch (*fname)
|
||||
{
|
||||
|
||||
case '/':
|
||||
strncpy(temp, fname+1, 2);
|
||||
temp[2]=0;
|
||||
if ( (!strcmp("rd", temp)) || (!strcmp("hd", temp)) || (!strcmp("cd", temp)) )
|
||||
strcpy (full, fname);
|
||||
break;
|
||||
|
||||
case '.':
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void __attribute__((__always_inline__)) kol_screen_wait_rr()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(14));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void kol_screen_get_size(unsigned *w, unsigned *h)
|
||||
{
|
||||
unsigned size;
|
||||
asm volatile ("int $0x40":"=a"(size):"a"(14));
|
||||
*w = size / 65536;
|
||||
*h = size % 65536;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned kol_skin_height()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(48), "b"(4));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_thread_start(unsigned start, unsigned stack)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(51), "b"(1), "c"(start), "d"(stack));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_time_tick()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(26), "b"(9));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_sound_speaker(char data[])
|
||||
{
|
||||
asm volatile ("movl %0, %%esi"::"a"(data));
|
||||
asm volatile ("int $0x40"::"a"(55), "b"(55));
|
||||
}
|
||||
|
||||
|
||||
unsigned kol_process_info(unsigned slot, char buf1k[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(9), "b"(buf1k), "c"(slot));
|
||||
}
|
||||
|
||||
|
||||
int kol_process_kill_pid(unsigned process)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(18), "c"(process));
|
||||
}
|
||||
|
||||
int kol_kill_process(unsigned process)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(2), "c"(process));
|
||||
}
|
||||
|
||||
void kol_get_kernel_ver(char buff16b[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(18), "b"(13), "c"(buff16b));
|
||||
}
|
||||
|
||||
int kol_buffer_open(char name[], int mode, int size, char **buf)
|
||||
{
|
||||
int error;
|
||||
asm volatile ("int $0x40":"=a"(*buf), "=d"(error):"a"(68), "b"(22), "c"(name), "d"(size), "S"(mode));
|
||||
return error;
|
||||
}
|
||||
|
||||
void kol_buffer_close(char name[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(name));
|
||||
}
|
||||
|
||||
int kol_clip_num()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(0));
|
||||
}
|
||||
|
||||
char* kol_clip_get(int n)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(1), "c"(n));
|
||||
}
|
||||
|
||||
int kol_clip_set(int n, char buffer[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer));
|
||||
}
|
||||
|
||||
|
||||
int kos_random(int num)
|
||||
{
|
||||
srand(kol_time_tick());
|
||||
return rand() % num;
|
||||
}
|
||||
|
118
contrib/media/updf/apps/kolibri.h
Normal file
118
contrib/media/updf/apps/kolibri.h
Normal file
@ -0,0 +1,118 @@
|
||||
|
||||
#define NULL ((void*)0)
|
||||
|
||||
#define SHM_OPEN 0
|
||||
#define SHM_OPEN_ALWAYS 0x04
|
||||
#define SHM_CREATE 0x08
|
||||
#define SHM_READ 0x00
|
||||
#define SHM_WRITE 0x01
|
||||
|
||||
#define E_NOTFOUND 5
|
||||
#define E_ACCESS 10
|
||||
#define E_NOMEM 30
|
||||
#define E_PARAM 33
|
||||
|
||||
#define FILENAME_MAX 1024
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct
|
||||
{
|
||||
unsigned p00;
|
||||
unsigned p04;
|
||||
unsigned p08;
|
||||
unsigned p12;
|
||||
unsigned p16;
|
||||
char p20;
|
||||
char *p21;
|
||||
} kol_struct70;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct
|
||||
{
|
||||
unsigned p00;
|
||||
char p04;
|
||||
char p05[3];
|
||||
unsigned p08;
|
||||
unsigned p12;
|
||||
unsigned p16;
|
||||
unsigned p20;
|
||||
unsigned p24;
|
||||
unsigned p28;
|
||||
unsigned long long p32;
|
||||
unsigned p40;
|
||||
} kol_struct_BDVK;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
void *data;
|
||||
} kol_struct_import;
|
||||
#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_move(unsigned x, unsigned y);
|
||||
void kol_wnd_caption(char *s);
|
||||
void kol_event_mask(unsigned e);
|
||||
unsigned kol_event_wait();
|
||||
unsigned kol_event_wait_time(unsigned time);
|
||||
unsigned kol_event_check();
|
||||
void kol_paint_start();
|
||||
void kol_paint_end();
|
||||
void kol_paint_pixel(unsigned x, unsigned y, unsigned c);
|
||||
void kol_paint_bar(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c);
|
||||
void kol_paint_line(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned c);
|
||||
void kol_paint_string(unsigned x, unsigned y, char *s, unsigned c);
|
||||
void kol_paint_image(unsigned x, unsigned y, unsigned w, unsigned h, char *d);
|
||||
void kol_paint_image_pal(unsigned x, unsigned y, unsigned w, unsigned h, char *buf, unsigned bits, unsigned palette);
|
||||
unsigned kol_key_get();
|
||||
unsigned kol_key_control();
|
||||
void kol_key_lang_set(unsigned lang);
|
||||
unsigned kol_key_lang_get();
|
||||
void kol_key_mode_set(unsigned mode);
|
||||
unsigned kol_key_mode_get();
|
||||
void kol_paint_image_24(unsigned x, unsigned y, unsigned w, unsigned h, char *d);
|
||||
unsigned kol_btn_get();
|
||||
void kol_btn_type(unsigned t);
|
||||
unsigned kol_mouse_pos();
|
||||
unsigned kol_mouse_posw();
|
||||
unsigned kol_mouse_btn();
|
||||
void kol_board_putc(char c);
|
||||
void kol_board_puts(char *s);
|
||||
void kol_board_puti(int n);
|
||||
int kol_file_70(kol_struct70 *k);
|
||||
kol_struct_import* kol_cofflib_load(char *name);
|
||||
void* kol_cofflib_procload (kol_struct_import *imp, char *name);
|
||||
unsigned kol_cofflib_procnum (kol_struct_import *imp);
|
||||
void kol_cofflib_procname (kol_struct_import *imp, char *name, unsigned n);
|
||||
unsigned kol_system_end(unsigned param);
|
||||
unsigned kol_system_cpufreq();
|
||||
unsigned kol_system_mem();
|
||||
unsigned kol_system_memfree();
|
||||
unsigned kol_system_time_get();
|
||||
unsigned kol_system_date_get();
|
||||
void kol_path_file2dir(char *dir, char *fname);
|
||||
void kol_path_full(char *full, char *fname);
|
||||
void kol_screen_wait_rr();
|
||||
void kol_screen_get_size(unsigned *w, unsigned *h);
|
||||
unsigned kol_skin_height();
|
||||
unsigned kol_thread_start(unsigned start, unsigned stack);
|
||||
unsigned kol_time_tick();
|
||||
unsigned kol_sound_speaker(char data[]);
|
||||
unsigned kol_process_info(unsigned slot, char buf1k[]);
|
||||
int kol_process_kill_pid(unsigned process);
|
||||
void kol_get_kernel_ver(char buff16b[]);
|
||||
int kol_kill_process(unsigned process);
|
||||
int kol_buffer_open(char name[], int mode, int size, char **buf);
|
||||
void kol_buffer_close(char name[]);
|
||||
int kol_clip_num();
|
||||
char* kol_clip_get(int n);
|
||||
int kol_clip_set(int n, char buffer[]);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "muxps.h"
|
||||
#include "pdfapp.h"
|
||||
#include "icons/allbtns.h"
|
||||
#include "kolibri.c"
|
||||
|
||||
// need to be a part of menuet/os.h
|
||||
#define BT_DEL 0x80000000
|
||||
@ -77,7 +78,6 @@ int __menuet__get_mouse_wheels(void)
|
||||
/*==== DATA ====*/
|
||||
|
||||
static char Title[1024] = "uPDF";
|
||||
static char * filename = "/hd0/1/yand.pdf";
|
||||
static pdfapp_t gapp;
|
||||
char debugstr[256];
|
||||
char do_not_blit=0;
|
||||
@ -184,7 +184,7 @@ void winblit(pdfapp_t *app)
|
||||
if (Form.client_width > gapp.image->w) window_center = (Form.client_width - gapp.image->w) / 2; else window_center = 0;
|
||||
|
||||
gapp.panx = 0;
|
||||
if (gapp.image->n == 4)
|
||||
if (gapp.image->n == 4) {
|
||||
blit(window_center + Form.client_left,
|
||||
Form.client_top + TOOLBAR_HEIGHT,
|
||||
Form.client_width,
|
||||
@ -196,6 +196,7 @@ void winblit(pdfapp_t *app)
|
||||
gapp.image->w * gapp.image->n,
|
||||
gapp.image->samples
|
||||
);
|
||||
}
|
||||
else if (gapp.image->n == 2)
|
||||
{
|
||||
int i = gapp.image->w*gapp.image->h;
|
||||
@ -233,10 +234,10 @@ void DrawPageSides(void)
|
||||
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)
|
||||
{
|
||||
__menuet__bar(0, TOOLBAR_HEIGHT, window_center-1, Form.client_height - TOOLBAR_HEIGHT, DOCUMENT_BG);
|
||||
__menuet__bar(window_center-1, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
|
||||
__menuet__bar(window_center + gapp.image->w, TOOLBAR_HEIGHT, 1, draw_h, DOCUMENT_BORDER);
|
||||
__menuet__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(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)
|
||||
{
|
||||
@ -247,8 +248,8 @@ void DrawPageSides(void)
|
||||
window_center = 1;
|
||||
draw_w = Form.client_width;
|
||||
}
|
||||
__menuet__bar(window_center - 1, gapp.image->h - gapp.pany + TOOLBAR_HEIGHT, draw_w, 1, DOCUMENT_BORDER);
|
||||
__menuet__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, 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);
|
||||
}
|
||||
|
||||
|
||||
@ -257,25 +258,25 @@ int main (void)
|
||||
{
|
||||
char ii, mouse_wheels_state;
|
||||
char* original_command_line = *(char**)0x1C;
|
||||
__menuet__debug_out(original_command_line);
|
||||
kol_board_puts(original_command_line);
|
||||
kol_board_puts("\n");
|
||||
|
||||
char buf[128];
|
||||
int resolution = 72;
|
||||
int pageno = 1;
|
||||
fz_accelerate();
|
||||
__menuet__debug_out("PDF init\n");
|
||||
kol_board_puts("PDF init\n");
|
||||
pdfapp_init(&gapp);
|
||||
gapp.scrw = 600;
|
||||
gapp.scrh = 400;
|
||||
gapp.resolution = resolution;
|
||||
gapp.pageno = pageno;
|
||||
__menuet__debug_out("PDF Open\n");
|
||||
kol_board_puts("PDF Open\n");
|
||||
pdfapp_open(&gapp, original_command_line, 0, 0);
|
||||
__menuet__debug_out("PDF Opened\n");
|
||||
kol_board_puts("PDF Opened\n");
|
||||
wintitle(&gapp, 0);
|
||||
|
||||
|
||||
__menuet__debug_out("Inital paint\n");
|
||||
|
||||
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);
|
||||
@ -289,7 +290,9 @@ int main (void)
|
||||
case evReDraw:
|
||||
// gapp.shrinkwrap = 2;
|
||||
__menuet__window_redraw(1);
|
||||
__menuet__define_window(screen_max_x / 2 - 350, screen_max_y / 2 - 300, 700, 600, 0x73000000, 0x800000FF, Title);
|
||||
__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
|
||||
@ -322,14 +325,14 @@ int main (void)
|
||||
case evButton:
|
||||
butt = __menuet__get_button_id();
|
||||
if(butt==1) __menuet__sys_exit();
|
||||
if(butt==10) ;//mag open file
|
||||
if(butt==10) RunApp("/sys/lod", "*pdf* /kolibrios/media/updf");
|
||||
if(butt==11) PageZoomOut(); //magnify -
|
||||
if(butt==12) PageZoomIn(); //magnify +
|
||||
if(butt==13) //show help
|
||||
{
|
||||
__menuet__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.21", 0);
|
||||
__menuet__write_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.21", 0);
|
||||
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);
|
||||
}
|
||||
@ -348,7 +351,7 @@ int main (void)
|
||||
if (mouse_wheels_state==-1) { PageScrollUp(); PageScrollUp(); }
|
||||
}
|
||||
//sprintf (debugstr, "mouse_wheels_state: %d \n", mouse_wheels_state);
|
||||
//__menuet__debug_out(debugstr);
|
||||
//kol_board_puts(debugstr);
|
||||
//pdfapp_onmouse(&gapp, int x, int y, int btn, int modifiers, int state)
|
||||
break;
|
||||
}
|
||||
@ -389,7 +392,7 @@ void HandleNewPageNumber(unsigned char key)
|
||||
|
||||
itoa(new_page_number, label_new_page, 10);
|
||||
strcat(label_new_page, "_");
|
||||
__menuet__bar(show_area_x, 6, show_area_w, 22, 0xFDF88E);
|
||||
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));
|
||||
|
||||
if (new_page_number > gapp.pagecount) ApplyNewPageNumber();
|
||||
@ -405,7 +408,7 @@ void ApplyNewPageNumber(void)
|
||||
void DrawPagination(void)
|
||||
{
|
||||
char pages_display[12];
|
||||
__menuet__bar(show_area_x, 6, show_area_w, 22, 0xF4F4F4);
|
||||
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));
|
||||
}
|
||||
@ -415,8 +418,8 @@ void DrawPagination(void)
|
||||
|
||||
void DrawWindow(void)
|
||||
{
|
||||
__menuet__bar(0, 0, Form.client_width, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder)
|
||||
__menuet__bar(0, TOOLBAR_HEIGHT - 1, Form.client_width, 1, 0x7F7F7F);
|
||||
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);
|
||||
DrawToolbarButton(8,0); //open_folder
|
||||
DrawToolbarButton(42,1); //magnify -
|
||||
DrawToolbarButton(67,2); //magnify +
|
||||
@ -427,8 +430,8 @@ void DrawWindow(void)
|
||||
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);
|
||||
__menuet__bar(show_area_x, 5, show_area_w, 1, 0xA4A4A4);
|
||||
__menuet__bar(show_area_x, 28, show_area_w, 1, 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);
|
||||
DrawPageSides();
|
||||
}
|
||||
@ -472,11 +475,24 @@ void PageScrollUp(void)
|
||||
gapp.pany = gapp.image->h - SCROLL_H - Form.client_height + TOOLBAR_HEIGHT;
|
||||
if (gapp.pany < 0) gapp.pany = 0;
|
||||
//sprintf (debugstr, "gapp.pany: %d \n", gapp.pany);
|
||||
//__menuet__debug_out(debugstr);
|
||||
//kol_board_puts(debugstr);
|
||||
winblit(&gapp);
|
||||
}
|
||||
}
|
||||
|
||||
void RunApp(char app[], char param[])
|
||||
{
|
||||
kol_struct70 r;
|
||||
r.p00 = 7;
|
||||
r.p04 = 0;
|
||||
r.p08 = param;
|
||||
r.p12 = 0;
|
||||
r.p16 = 0;
|
||||
r.p20 = 0;
|
||||
r.p21 = app;
|
||||
kol_file_70(&r);
|
||||
}
|
||||
|
||||
|
||||
void PageZoomIn(void)
|
||||
{
|
||||
|
@ -430,7 +430,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
|
||||
|
||||
if (app->shrinkwrap)
|
||||
{
|
||||
// __menuet__debug_out ("SHRINK\n");
|
||||
//__menuet__debug_out ("SHRINK\n");
|
||||
int w = app->image->w;
|
||||
int h = app->image->h;
|
||||
if (app->winw == w)
|
||||
|
Binary file not shown.
@ -1,77 +1,2 @@
|
||||
@echo off
|
||||
cls
|
||||
set languages=en ru ge et sp
|
||||
set targets=kernel clean
|
||||
|
||||
call :Check_Target %1
|
||||
for %%a in (kernel) do if %%a==%target% call :Check_Lang %2
|
||||
call :Target_%target%
|
||||
|
||||
if ERRORLEVEL 0 goto Exit_OK
|
||||
|
||||
echo There was an error executing script.
|
||||
echo For any help, please send a report.
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
|
||||
|
||||
|
||||
:Check_Lang
|
||||
set res=%1
|
||||
:Check_Lang_loop
|
||||
for %%a in (%languages%) do if %%a==%res% set lang=%res%
|
||||
if defined lang goto :eof
|
||||
|
||||
echo Language '%res%' is incorrect
|
||||
echo Enter valid language [ %languages% ]:
|
||||
|
||||
set /P res=">
|
||||
goto Check_Lang_loop
|
||||
goto :eof
|
||||
|
||||
:Check_Target
|
||||
set res=%1
|
||||
:Check_Target_loop
|
||||
for %%a in (%targets%) do if %%a==%res% set target=%res%
|
||||
if defined target goto :eof
|
||||
|
||||
echo Target '%res%' is incorrect
|
||||
echo Enter valid target [ %targets% ]:
|
||||
|
||||
set /P res=">
|
||||
goto Check_Target_loop
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_kernel
|
||||
echo *** building kernel with language '%lang%' ...
|
||||
|
||||
if not exist bin mkdir bin
|
||||
echo lang fix %lang% > lang.inc
|
||||
fasm -m 65536 bootbios.asm bootbios.bin
|
||||
fasm -m 65536 kernel.asm bin\kernel.mnt
|
||||
fasm -m 65536 kernel.asm bin\kernel.bin -dUEFI=1
|
||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
||||
erase lang.inc
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_clean
|
||||
echo *** cleaning ...
|
||||
rmdir /S /Q bin
|
||||
goto :Exit_OK
|
||||
|
||||
|
||||
:Error_FasmFailed
|
||||
echo error: fasm execution failed
|
||||
erase lang.inc >nul 2>&1
|
||||
echo.
|
||||
pause
|
||||
exit 1
|
||||
|
||||
:Exit_OK
|
||||
echo.
|
||||
echo all operations have been done
|
||||
pause
|
||||
exit 0
|
||||
echo lang fix %lang% > lang.inc
|
||||
fasm -m 65536 kernel.asm kernel.mnt
|
||||
|
Loading…
Reference in New Issue
Block a user