Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7226 → Rev 7227

/programs/cmm/lib/fs.h
124,7 → 124,7
}
 
:f70 write_file_70;
:int WriteFile(dword data_size, buffer, file_path)
:int CreateFile(dword data_size, buffer, file_path)
{
write_file_70.func = 2;
write_file_70.param1 = 0;
142,7 → 142,7
// WriteInFileThatAlredyExists //
////////////////////////////////////////
:f70 write_file_offset_70;
:int WriteFileWithOffset(dword offset, data_size, buffer, file_path)
:int WriteFile(dword offset, data_size, buffer, file_path)
{
write_file_offset_70.func = 3;
write_file_offset_70.param1 = offset;
354,7 → 354,7
}
else
{
if (error = WriteFile(size, cbuf, copyTo)) debugln("Error: CopyFileAtOnce->WriteFile");
if (error = CreateFile(size, cbuf, copyTo)) debugln("Error: CopyFileAtOnce->CreateFile");
}
free(cbuf);
return error;
364,20 → 364,34
dword cbuf;
int error=-1;
dword offpos=0;
int block_size=1024*1024*4; //copy by 4 MiBs
int block_size=1024*1024*4; //copy by 4 MiB
{
if (GetFreeRAM()>1024*78) {
//Set block size 32 MiB
block_size <<= 3;
}
cbuf = malloc(block_size);
WriteFile(0, 0, copyTo); //create file
if (error = CreateFile(0, 0, copyTo))
{
debugln("Error: CopyFileByBlocks->CreateFile");
size = -1;
}
while(offpos < size)
{
error = ReadFile(offpos, block_size, cbuf, copyFrom);
if (error = 6) { //File ended before last byte was readed
block_size = EBX;
error=0;
if (block_size+offpos>=size) error=0;
}
else
if (error!=0) break;
if (error = WriteFileWithOffset(offpos, block_size, cbuf, copyTo)) break;
if (error!=0) {
debugln("Error: CopyFileByBlocks->ReadFile");
break;
}
if (error = WriteFile(offpos, block_size, cbuf, copyTo)) {
debugln("Error: CopyFileByBlocks->WriteFile");
break;
}
offpos += block_size;
}
free(cbuf);
/programs/cmm/lib/gui/more_less_box.h
4,6 → 4,7
unsigned value, min, max;
unsigned bt_id_more, bt_id_less;
dword text;
int click_delta;
bool click();
void draw();
};
10,8 → 11,9
 
:bool more_less_box::click(unsigned id)
{
if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; }
if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; }
if (!click_delta) click_delta = 1;
if (id==bt_id_less) { value = math.max(value-click_delta, min); draw(); return 1; }
if (id==bt_id_more) { value = math.min(value+click_delta, max); draw(); return 1; }
return 0;
}
 
/programs/cmm/lib/gui.h
346,8 → 346,30
return n;
}
 
//block with hover
struct block {
int x,y,w,h;
bool hovered();
void set_size();
};
 
:bool block::hovered() {
if ((mouse.x>x) && (mouse.y>y)
&& (mouse.y<y+h) && (mouse.x<x+w))
return true;
return false;
}
 
:void block::set_size(dword _x, _y, _w, _h)
{
x=_x;
y=_y;
w=_w;
h=_h;
}
 
 
 
 
 
#endif
/programs/cmm/lib/kolibri.h
621,20 → 621,6
CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
}
 
:struct rect
{
dword x,y,w,h;
void set_size();
};
 
:void rect::set_size(dword _x, _y, _w, _h)
{
x=_x;
y=_y;
w=_w;
h=_h;
}
 
:struct _screen
{
dword width,height;
/programs/cmm/lib/list_box.h
33,25 → 33,24
int KeyLeft();
int KeyRight();
void CheckDoesValuesOkey();
//void debug();
void debug();
};
 
/*
void llist::debug()
:void llist::debug()
{
char yi[128];
sprintf(#yi, "%s %d %s %d %s %d %s %d %s %d %s %d", "first:", first, "visible:", visible, "count:", count, "col_max:", column_max, "cur_y:", cur_y, "cur_x:", cur_x);
debugln(#yi);
}*/
}
 
 
void llist::ClearList()
:void llist::ClearList()
{
count = visible = first = cur_y = cur_x = 0;
}
 
 
void llist::SetSizes(int xx, yy, ww, hh, item_hh)
:void llist::SetSizes(int xx, yy, ww, hh, item_hh)
{
x = xx;
y = yy;
64,7 → 63,8
CheckDoesValuesOkey();
}
 
void llist::SetFont(dword font_ww, font_hh, font_tt)
 
:void llist::SetFont(dword font_ww, font_hh, font_tt)
{
font_w = font_ww;
font_h = font_hh;
72,7 → 72,7
}
 
 
int llist::MouseScroll(dword scroll_state)
:int llist::MouseScroll(dword scroll_state)
{
if (count<=visible) return 0;
if (scroll_state == 65535)
91,13 → 91,13
}
 
 
int llist::MouseOver(int xx, yy)
:int llist::MouseOver(int xx, yy)
{
if (xx>x) && (xx<x+w) && (yy>y) && (yy<y+h) return 1;
return 0;
}
 
int llist::ProcessMouse(int xx, yy)
:int llist::ProcessMouse(int xx, yy)
{
int cur_y_temp, cur_x_temp, ret=0;
if (MouseOver(xx, yy))
121,7 → 121,7
return ret;
}
 
int llist::ProcessKey(dword key)
:int llist::ProcessKey(dword key)
{
switch(key)
{
140,7 → 140,7
return 0;
}
 
int llist::KeyDown()
:int llist::KeyDown()
{
if (no_selection)
{
168,7 → 168,7
return 1;
}
 
int llist::KeyUp()
:int llist::KeyUp()
{
if (no_selection)
{
195,7 → 195,7
return 1;
}
 
int llist::KeyHome()
:int llist::KeyHome()
{
if (cur_y==0) && (first==0) return 0;
cur_y = first = 0;
202,7 → 202,7
return 1;
}
 
int llist::KeyEnd()
:int llist::KeyEnd()
{
if (cur_y==count-1) && (first==count-visible) return 0;
cur_y = count-1;
210,7 → 210,7
return 1;
}
 
int llist::KeyPgUp()
:int llist::KeyPgUp()
{
if (count <= visible) return KeyHome();
if (first == 0) return 0;
220,7 → 220,7
return 1;
}
 
int llist::KeyPgDown()
:int llist::KeyPgDown()
{
if (count <= visible) return KeyEnd();
if (first == count - visible) return 0;
230,7 → 230,7
return 1;
}
 
void llist::CheckDoesValuesOkey()
:void llist::CheckDoesValuesOkey()
{
if (visible + first > count) first = count - visible;
if (first < 0) first = 0;
239,7 → 239,7
if (cur_x < 0) cur_x = 0;
}
 
int llist::KeyRight()
:int llist::KeyRight()
{
if (cur_x < column_max)
{
253,7 → 253,7
return 1;
}
 
int llist::KeyLeft()
:int llist::KeyLeft()
{
if (cur_x > 0)
{
268,7 → 268,7
}
 
 
void llist_copy(dword dest, src)
:void llist_copy(dword dest, src)
{
EDI = dest;
ESI = src;
/programs/cmm/lib/obj/box_lib.h
155,7 → 155,7
struct frame
{
dword type;
word size_x;
word size_x; //start_x, size_x => Mario, WTF? Is this so complex to use x/y/w/h ?
word start_x;
word size_y;
word start_y;
170,4 → 170,21
dword font_backgr_color;
};
 
:frame frame123 = { 0, 260, 10, 60, 16, NULL, 0xFFFfff, 1, NULL, 0, 1, 12, 0x000111, 0xCCCccc };
:void DrawFrame(dword x,y,w,h,text)
{
frame123.font_color = system.color.work_text;
frame123.ext_col = system.color.work_graph;
frame123.int_col = system.color.work_light;
frame123.font_backgr_color = system.color.work;
 
frame123.start_x = x;
frame123.start_y = y;
frame123.size_x = w;
frame123.size_y = h;
frame123.text_pointer = text;
frame_draw stdcall (#frame123);
}
 
 
#endif
/programs/cmm/lib/obj/libimg.h
218,7 → 218,7
notify("'Error saving file, incorrect data!' -E");
}
else {
if (WriteFile(encoded_size, encoded_data, _path) == 0) {
if (CreateFile(encoded_size, encoded_data, _path) == 0) {
sprintf(#save_success_message, "'File saved as %s' -O", _path);
notify(#save_success_message);
}
/programs/cmm/lib/window.h
13,7 → 13,7
proc_info Form;
};
 
void window::create()
:void window::create()
{
word id=0;
IF(!caption)caption = "Window";