Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6630 → Rev 6631

/programs/cmm/lib/gui.h
51,7 → 51,7
WriteText(tx,ty,0x90,color_t,text);
}
 
:int DrawStandartCaptButton(dword x, y, id, color_b, color_t, text)
:int DrawStandartCaptButton(dword x, y, id, text)
{
int padding_v = 5;
int padding_h = 15;
61,9 → 61,9
int h = padding_v + padding_v + 16; //16 font height
int w = strlen(text)*8 + padding_h + padding_h;
 
if (id>0) DefineButton(x,y,w,h,id,color_b);
WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text);
WriteText(tx,ty,0x90,color_t,text);
if (id>0) DefineButton(x,y,w,h,id,system.color.work_button);
WriteText(tx+1,ty+1,0x90,MixColors(system.color.work_button,0,230),text);
WriteText(tx,ty,0x90,system.color.work_button_text,text);
return w + right_margin;
}
 
273,6 → 273,64
ESBYTE[next_word_pointer] = '\n';
}
 
/*
We have a long text and need to show it in block.
Normal line break '\n' must be applied.
Long lines should be breaked by word.
TODO: scroll
*/
:int DrawTextViewArea(int x,y,w,h,line_h, dword buf_start, bg_col, text_col)
{
dword write_start;
dword buf_end;
int label_length_max;
int write_length;
bool end_found;
 
write_start = buf_start;
buf_end = strlen(buf_start) + buf_start;
label_length_max = w / 8; // 8 big font char width
 
//DrawRectangle(x-2, y-2, w+4, h+4, system.color.work_graph);
//DrawRectangle3D(x-1, y-1, w+2, h+2, 0xDDDddd, 0xffffff);
 
loop()
{
if (bg_col!=-1) DrawBar(x, y, w+1, line_h, bg_col);
end_found = false;
write_length = strchr(write_start, '\n') - write_start; //search normal line break
if (write_length > label_length_max) || (write_length<=0) //check its position: exceeds maximum line length or not found
{
if (buf_end - write_start < label_length_max) //check does current line the last
{
write_length = buf_end - write_start;
end_found = true;
}
else
{
for (write_length=label_length_max; write_length>0; write_length--) { //search for white space to make the line break
if (ESBYTE[write_start+write_length] == ' ') {
end_found = true;
break;
}
}
}
if (end_found != true) write_length = label_length_max; //no white space, so we write label_length_max
}
ESI = write_length; //set text length attribute for WriteText()
WriteText(x+1, y, 0x10, text_col, write_start);
// if (editpos >= write_start-buf_start) && (editpos <= write_start-buf_start + write_length) {
// WriteTextB(-write_start+buf_start+editpos * 8 + x - 5 +1, y, 0x90, 0xFF0000, "|");
// }
write_start += write_length + 1;
y += line_h;
if (write_start >= buf_end) break;
}
if (bg_col!=-1) DrawBar(x,y,w+1,h-y+line_h-4,bg_col);
return y+line_h;
}
 
 
//this function increase falue and return it
//useful for list of controls which goes one after one
struct incn