Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3319 → Rev 3363

/programs/cmm/lib/figures.h
65,7 → 65,8
int progress_w;
static int fill_old;
if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;}
//if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;}
if (progress_percent<=0) || (progress_percent>=100) return;
DrawRectangle(st_x, st_y, st_w,st_h, col_border);
DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff);
83,4 → 84,55
WriteText(st_x+st_w+15, st_h/2-4+st_y, 0x80, col_text, status_text);
fill_old = strlen(status_text) * 6;
}
}
 
:void DrawLink(dword x,y,font_type,btn_id, inscription)
{
int w;
WriteText(x,y,font_type,0x4E00E7,inscription);
if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*7;
DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0);
DrawBar(x,y+8,w,1,0x4E00E7);
}
 
 
:void PutShadow(dword x,y,w,h,border,strength)
{
proc_info wForm;
dword shadow_buf, skin_height;
shadow_buf = mem_Alloc(w*h*3);
//skin_height = GetSkinHeight();
GetProcessInfo(#wForm, SelfInfo);
CopyScreen(shadow_buf, x+wForm.left, y+wForm.top, w, h);
ShadowImage(shadow_buf, w, h, strength);
_PutImage(x,y,w,h,shadow_buf);
mem_Free(shadow_buf);
}
 
:void GrayScaleImage(dword color_image, w, h)
{
dword i,j, gray,rr,gg,bb;
for (i = 0; i < w*h*3; i+=3)
{
rr = DSBYTE[i+color_image];
gg = DSBYTE[i+1+color_image];
bb = DSBYTE[i+2+color_image];
gray = rr*rr;
gray += gg*gg;
gray += bb*bb;
gray = sqrt(gray) / 3;
DSBYTE[i +color_image] = DSBYTE[i+1+color_image] = DSBYTE[i+2+color_image] = gray;
}
}
 
:void ShadowImage(dword color_image, w, h, strength)
{
dword col, to;
strength = 10 - strength;
to = w*h*3 + color_image;
for ( ; color_image < to; color_image++)
{
col = strength * DSBYTE[color_image] / 10;
DSBYTE[color_image] = col;
}
}
/programs/cmm/lib/file_system.h
28,7 → 28,7
// Çàïóñê ïðîãðàììû //
///////////////////////////
f70 run_file_70;
:int RunProgram(dword run_path, run_param)
signed int RunProgram(dword run_path, run_param)
{
run_file_70.func = 7;
run_file_70.param1 =
96,6 → 96,24
$int 0x40
}
 
:int GetFile(dword buf, filesize, read_path)
{
BDVK ReadFile_atr;
dword rBuf=0;
if (! GetFileInfo(read_path, #ReadFile_atr))
{
rBuf = malloc(ReadFile_atr.sizelo);
if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path))
{
ESDWORD[buf] = rBuf;
ESDWORD[filesize] = ReadFile_atr.sizelo;
return 1;
}
}
free(rBuf);
return 0;
}
 
////////////////////////////
// Çàïèñàòü ôàéë //
////////////////////////////
133,18 → 151,36
}
 
 
:int GetDir(dword dir_buf, file_count, path)
{
dword buf, fcount, error;
buf = malloc(32);
error = ReadDir(0, buf, path);
if (!error)
{
fcount = ESDWORD[buf+8];
buf = realloc(buf, fcount+1*304+32);
ReadDir(fcount, buf, path);
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
ESDWORD[dir_buf] = buf;
ESDWORD[file_count] = fcount;
}
return error;
}
 
 
///////////////////////////
// Ïàðàìåòðû ôàéëà //
///////////////////////////
f70 getinfo_file_70;
BDVK getinfo_file_info;
:dword GetFileInfo(dword file_path)
:dword GetFileInfo(dword file_path, bdvk_struct)
{
getinfo_file_70.func = 5;
getinfo_file_70.param1 =
getinfo_file_70.param2 =
getinfo_file_70.param3 = 0;
getinfo_file_70.param4 = #getinfo_file_info;
getinfo_file_70.param4 = bdvk_struct;
getinfo_file_70.rezerv = 0;
getinfo_file_70.name = file_path;
$mov eax,70
160,32 → 196,17
{
BDVK CopyFile_atr;
dword cBufer=0;
if (! GetFileInfo(copy_from))
char rezult = -1;
if (! GetFileInfo(copy_from, #CopyFile_atr))
{
mem_Init();
cBufer = mem_Alloc(CopyFile_atr.sizelo);
cBufer = malloc(CopyFile_atr.sizelo);
if (! ReadFile(0, CopyFile_atr.sizelo, cBufer, copy_from))
if (! WriteFile(CopyFile_atr.sizelo, cBufer, copy_in)) return 1;
{
rezult = WriteFile(CopyFile_atr.sizelo, cBufer, copy_in);
}
return 0;
}
 
 
//Asper
void ReadAttributes(dword read_buffer, file_path)
{
read_file_70.func = 5;
read_file_70.param1 = 0;
read_file_70.param2 = 0;
read_file_70.param3 = 0;
read_file_70.param4 = read_buffer;
read_file_70.rezerv = 0;
read_file_70.name = file_path;
$mov eax,70
$mov ebx,#read_file_70.func
$int 0x40
free(cBufer);
return rezult;
}
 
inline fastcall void SetCurDir( ECX)
/programs/cmm/lib/kolibri.h
7,18 → 7,18
dword os_version = 0x00000001;
dword start_addr = #main;
dword final_addr = #stop+32;
#ifdef MEMSIZE
dword alloc_mem = MEMSIZE;
dword x86esp_reg = MEMSIZE;
#else
dword alloc_mem = #0x00100000;
dword x86esp_reg = #0x00100000;
#endif
dword I_Param = #param;
dword I_Path = #program_path;
char param[4096];
char program_path[4096];
 
#define NULL 0
#define OLD -1
#define true 1
#define false 0
 
//Events
#define evMouse 6
#define evButton 3
25,12 → 25,6
#define evKey 2
#define evReDraw 1
 
#define OLD -1
#define true 1
#define false 0
 
#define NULL 0
 
//Button options
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
352,6 → 346,7
$pop eax
}
 
 
inline fastcall void debugch( ECX)
{
$push eax
399,6 → 394,7
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
ESI = 0;
$int 0x40;
$add ebx, 1<<16
$int 0x40
409,7 → 405,7
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$xor esi, esi
ESI = 0;
$int 0x40;
}
 
422,10 → 418,10
$int 0x40;
}
 
void CopyScreen(dword EBX, x, y, sizeX, sizeY)
void CopyScreen(dword EBX, x, y, w, h)
{
EAX = 36;
ECX = sizeX << 16 + sizeY;
ECX = w << 16 + h;
EDX = x << 16 + y;
$int 0x40;
}
437,13 → 433,6
$int 0x40
}
 
void PutImage(dword EBX,w,h,x,y)
{
EAX = 7;
ECX = w<<16+h;
EDX = x<<16+y;
$int 0x40
}
 
void _PutImage(dword x,y, w,h, EBX)
{
/programs/cmm/lib/lib.obj/box_lib.h
15,6 → 15,9
dword scrollbar_h_mouse = #aScrollbar_h_mouse;
dword version_scrollbar = #aVersion_scrollbar;
 
dword PathShow_prepare = #aPathShow_prepare;
dword PathShow_draw = #aPathShow_draw;
 
dword am__ = 0x0;
dword bm__ = 0x0;
 
38,7 → 41,33
char aOption_box_mouse[17] = "option_box_mouse\0";
char aVersion_op [11] = "version_op\0" ;
 
char aPathShow_prepare [17] = "PathShow_prepare\0";
char aPathShow_draw [14] = "PathShow_draw\0";
 
 
struct PathShow_data
{
dword type;// dd 0 ;+0
word start_y,// dw 28 ;+4
start_x,// dw 172 ;+6
font_size_x,// dw 6 ;+8 ; 6 - for font 0, 8 - for font 1
area_size_x;// dw 200 ;+10
dword font_number,// dd 0 ;+12 ; 0 - monospace, 1 - variable
background_flag,// dd 0 ;+16
font_color,// dd 0x0 ;+20
background_color,// dd 0x0 ;+24
text_pointer,// dd openfile_pach ;+28
work_area_pointer,// dd text_work_area ;+32
temp_text_length;// dd 0 ;+36
};
/*
char temp[128];
PathShow_data PathShow = {0, 100,20, 6, 200, 0, 1, 0x0, 0xFFFfff, #email_text, #temp, 0};
PathShow_prepare stdcall(#PathShow);
PathShow_draw stdcall(#PathShow);
*/
 
 
struct edit_box{
dword width, left, top, color, shift_color, focus_border_color, blur_border_color,
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
73,23 → 102,4
work_size,// equ [edi+76]
all_redraw,// equ [edi+80]
ar_offset;// equ [edi+84]
};
 
//ed_width equ [edi] ;è¨à¨­  ª®¬¯®­¥­â 
//ed_left equ [edi+4] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
//ed_top equ [edi+8] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
//ed_color equ [edi+12] ;梥â ä®­  ª®¬¯®­¥­â 
//shift_color equ [edi+16] ;=0x6a9480
//ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
//ed_blur_border_color equ [edi+24] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
//ed_text_color equ [edi+28] ;梥â ⥪áâ 
//ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
//ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
//ed_flags equ [edi+40] ;ä« £¨
//ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢
//ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à 
//ed_offset equ [edi+50] ;ᬥ饭¨¥
//cl_curs_x equ [edi+54] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® å
//cl_curs_y equ [edi+58] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® ã
//ed_shift_pos equ [edi+62] ;¯®«®¦¥­¨¥ ªãàá®à 
//ed_shift_pos_old equ [edi+66] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
};
/programs/cmm/lib/lib.obj/iconv.h
34,15 → 34,28
if (cd!=0)
{
debug("iconv: something is wrong with stdcall iconv()");
debug(itoa(cd));
debugi(cd);
debug("in_len");
debug(itoa(in_len));
debugi(in_len);
debug("out_len");
debug(itoa(out_len));
new_buf = 0;
debugi(out_len);
new_buf = free(new_buf);
return 0;
}
strcpy(conv_buf, new_buf);
free(new_buf);
return conv_buf;
}
}
 
 
char *charsets[] = { " ", "UTF-8", "KOI8-RU", "CP1251", "CP1252", "ISO8859-5", "CP866"};
int cur_charset;
enum {
CH_NULL,
CH_UTF8,
CH_KOI8,
CH_CP1251,
CH_CP1252,
CH_ISO8859_5,
CH_CP866
};
/programs/cmm/lib/strings.h
3,8 → 3,8
// strlen( EDI)
// strcpy( EDI, ESI) --- 0 if ==
// strcat( EDI, ESI)
// strchr( ESI,BL)
// strrchr( ESI,BL)
// strchr( ESI,BL) --- find first BL
// strrchr( ESI,BL) --- find last BL
// strstr( EBX, EDX)
// itoa( ESI)
// atoi( EAX)
60,7 → 60,7
}
 
 
inline fastcall strcpy( EDI, ESI)
inline fastcall void strcpy( EDI, ESI)
{
$cld
L2:
86,7 → 86,7
 
 
 
inline fastcall strcat( EDI, ESI)
inline fastcall void strcat( EDI, ESI)
{
asm {
mov ebx, edi
114,7 → 114,14
}
}
 
inline fastcall void chrcat(ESI, BL)
{
EDI = strlen(ESI);
ESBYTE[ESI+EDI] = BL;
ESBYTE[ESI+EDI+1] = 0;
}
 
 
inline fastcall signed int strchr( ESI,BL)
{
int jj=0;
151,7 → 158,7
}
 
 
inline fastcall dword strstr( EBX, EDX)
inline fastcall signed int strstr( EBX, EDX)
{
asm {
MOV EDI, EDX
343,6 → 350,7
debug(#tmpch);
}
 
 
/* strtok( LPSTR dest, src, divs);
src - óêàçàòåëü íà èñõîäíóþ ñòðîêó èëè ðåçóëüòàò ïðåäûäóùåãî âûçîâà
dest - óêàçàòåëü íà áóôåð, êóäà áóäåò ñêîïèðîâàíî ñëîâî