mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-25 08:06:49 +03:00
c--: add example, libs updated
git-svn-id: svn://kolibrios.org@3225 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6937c024aa
commit
41fcb88df4
@ -120,14 +120,14 @@ void Draw_Window()
|
||||
edit1.width=Form.width-edit1.left-edit1.left-9;
|
||||
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
|
||||
DefineButton(edit1.left+edit1.width-80,35, 80,20, 10, sc.work_button);
|
||||
WriteText(edit1.left+edit1.width-80+14,35+7,0x80,sc.work_button_text,#translate_caption, 0);
|
||||
WriteText(edit1.left+edit1.width-80+14,35+7,0x80,sc.work_button_text,#translate_caption);
|
||||
DrawBar(0, 69, Form.width-9, 1, sc.work_graph);
|
||||
|
||||
WriteText(edit1.left,35+7,0x80,sc.work_text,#direction, 0);
|
||||
WriteText(edit1.left,35+7,0x80,sc.work_text,#direction);
|
||||
DefineButton(edit1.left+130,35, 120,20, 11, sc.work_button);
|
||||
WriteText(edit1.left+130+112,35+7,0x80,sc.work_button_text,"\x19", 0);
|
||||
WriteText(edit1.left+130+112,35+7,0x80,sc.work_button_text,"\x19");
|
||||
DrawBar(edit1.left+130+1,36, 107,19, 0xFFFFFF);
|
||||
WriteText(edit1.left+130+8,35+7,0x80,0x000000,#cur_dict, 0);
|
||||
WriteText(edit1.left+130+8,35+7,0x80,0x000000,#cur_dict);
|
||||
|
||||
|
||||
DrawTranslation();
|
||||
@ -169,14 +169,14 @@ void ShowDictList()
|
||||
ReadDir(fcount, files_buf, #program_path);
|
||||
|
||||
fcount-=2;
|
||||
mem_Move(files_buf,files_buf+608,fcount*304);
|
||||
memmov(files_buf,files_buf+608,fcount*304);
|
||||
|
||||
|
||||
DefineButton(0,0, Form.width,Form.height, 12+BT_HIDE+BT_NOFRAME, sc.work_button);
|
||||
for (j=0; j<fcount; j++;)
|
||||
{
|
||||
DefineButton(edit1.left+130,j+1*20+35, 107,20, 20+j, sc.work_button);
|
||||
WriteText(edit1.left+130+8,j+1*20+35+7,0x80,sc.work_button_text, j*304+files_buf+72, 0);
|
||||
WriteText(edit1.left+130+8,j+1*20+35+7,0x80,sc.work_button_text, j*304+files_buf+72);
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,20 +250,20 @@ void DrawTranslation()
|
||||
|
||||
DrawBar(0, y_pos, Form.width-9, Form.height - y_pos-skin_height-4, 0xFFFFFF);
|
||||
strttl(#draw_buf);
|
||||
WriteText(10+1, y_pos+8, 0x90, 0x800080, #search_word, 0);
|
||||
WriteText(10 , y_pos+8, 0x90, 0x800080, #search_word, 0);
|
||||
WriteText(10+1, y_pos+8, 0x90, 0x800080, #search_word);
|
||||
WriteText(10 , y_pos+8, 0x90, 0x800080, #search_word);
|
||||
while (draw_buf)
|
||||
{
|
||||
text_break= Form.width/6-6;
|
||||
if (text_break>strlen(#draw_buf))
|
||||
{
|
||||
WriteText(10, y_pos+21, 0x80, 0, #draw_buf, 0);
|
||||
WriteText(10, y_pos+21, 0x80, 0, #draw_buf);
|
||||
return;
|
||||
}
|
||||
while (draw_buf[text_break]<>' ') && (text_break>0) text_break--;
|
||||
strcpy(#tt, #draw_buf+text_break+1);
|
||||
draw_buf[text_break]=0x0;
|
||||
WriteText(10, y_pos+21, 0x80, 0, #draw_buf, 0);
|
||||
WriteText(10, y_pos+21, 0x80, 0, #draw_buf);
|
||||
strcpy(#draw_buf, #tt);
|
||||
y_pos+=12;
|
||||
if (y_pos+24+skin_height+12>Form.height) return; //÷òîá íå çàëåçàëî íà íèæíèé îáîäîê
|
||||
|
6
programs/cmm/example/compile.bat
Normal file
6
programs/cmm/example/compile.bat
Normal file
@ -0,0 +1,6 @@
|
||||
..\C--\C-- example.c
|
||||
del example
|
||||
rename example.com example
|
||||
..\C--\kpack example
|
||||
pause
|
||||
del warning.txt
|
41
programs/cmm/example/example.c
Normal file
41
programs/cmm/example/example.c
Normal file
@ -0,0 +1,41 @@
|
||||
#include "..\lib\kolibri.h"
|
||||
#include "..\lib\file_system.h"
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
int id, key;
|
||||
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
IF (key==013){ //Enter
|
||||
WriteText(50,90,0x80,0xFF00FF,"Pressed Enter");
|
||||
}
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
draw_window();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Window header");
|
||||
WriteText(50,80,0x80,0,"Press Enter");
|
||||
|
||||
}
|
||||
|
||||
|
||||
stop:
|
@ -1,25 +1,27 @@
|
||||
//#include "strings.h"
|
||||
|
||||
void DrawRectangle(dword x,y,width,height,color1)
|
||||
void DrawRectangle(dword x,y,w,h,color1)
|
||||
{
|
||||
DrawBar(x,y,width,1,color1);
|
||||
DrawBar(x,y+height,width,1,color1);
|
||||
DrawBar(x,y,1,height,color1);
|
||||
DrawBar(x+width,y,1,height+1,color1);
|
||||
if (w<=0) || (h<=0) return;
|
||||
DrawBar(x,y,w,1,color1);
|
||||
DrawBar(x,y+h,w,1,color1);
|
||||
DrawBar(x,y,1,h,color1);
|
||||
DrawBar(x+w,y,1,h+1,color1);
|
||||
}
|
||||
|
||||
void DrawRectangle3D(dword x,y,width,height,color1,color2)
|
||||
void DrawRectangle3D(dword x,y,w,h,color1,color2)
|
||||
{
|
||||
DrawBar(x,y,width+1,1,color1);
|
||||
DrawBar(x,y+1,1,height-1,color1);
|
||||
DrawBar(x+width,y+1,1,height,color2);
|
||||
DrawBar(x,y+height,width,1,color2);
|
||||
if (w<=0) || (h<=0) return;
|
||||
DrawBar(x,y,w+1,1,color1);
|
||||
DrawBar(x,y+1,1,h-1,color1);
|
||||
DrawBar(x+w,y+1,1,h,color2);
|
||||
DrawBar(x,y+h,w,1,color2);
|
||||
}
|
||||
|
||||
void DrawCaptButton(dword x,y,width,height,id,color_b, color_t,text)
|
||||
void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
|
||||
{
|
||||
DefineButton(x,y,width,height,id,color_b);
|
||||
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,color_t,text);
|
||||
DefineButton(x,y,w,h,id,color_b);
|
||||
WriteText(-strlen(text)*6+w/2+x+1,h/2-3+y,0x80,color_t,text);
|
||||
}
|
||||
|
||||
void DrawCircle(int x, y, r)
|
||||
@ -60,15 +62,20 @@ void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked)
|
||||
|
||||
void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent, status_text)
|
||||
{
|
||||
int progress_w = progress_percent * st_w / 100 - 3;
|
||||
int progress_w;
|
||||
static int fill_old;
|
||||
|
||||
if (!progress_percent) {DrawBar(st_x,st_y, st_x + st_y + fill_old + 15,st_h+1, col_fon); 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;}
|
||||
|
||||
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);
|
||||
if (progress_percent) DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill);
|
||||
if (progress_percent<100) DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff);
|
||||
|
||||
if (progress_percent>0) && (progress_percent<=100)
|
||||
{
|
||||
progress_w = st_w - 3 * progress_percent / 100;
|
||||
DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill);
|
||||
DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff);
|
||||
}
|
||||
|
||||
if (status_text)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ inline fastcall void PutPixel( EBX,ECX,EDX)
|
||||
|
||||
void DrawBar(dword x,y,w,h,EDX)
|
||||
{
|
||||
if (h<=0) || (h>65000) return; //bad boy :)
|
||||
if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
|
||||
EAX = 13;
|
||||
EBX = x<<16+w;
|
||||
ECX = y<<16+h;
|
||||
|
45
programs/cmm/lib/list_box.h
Normal file
45
programs/cmm/lib/list_box.h
Normal file
@ -0,0 +1,45 @@
|
||||
//list_box
|
||||
|
||||
struct llist
|
||||
{
|
||||
int x, y, w, h, min_h;
|
||||
int line_h;
|
||||
int count, visible, first, current;
|
||||
void ClearList();
|
||||
void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
|
||||
int MouseScroll(dword scroll_state);
|
||||
};
|
||||
|
||||
|
||||
void llist::ClearList()
|
||||
{
|
||||
count = visible = first = current = 0;
|
||||
}
|
||||
|
||||
|
||||
void llist::SetSizes(int xx, yy, ww, hh, min_hh, line_hh)
|
||||
{
|
||||
x = xx;
|
||||
y = yy;
|
||||
w = ww;
|
||||
h = hh;
|
||||
min_h = min_hh;
|
||||
line_h = line_hh;
|
||||
}
|
||||
|
||||
|
||||
int llist::MouseScroll(dword scroll_state)
|
||||
{
|
||||
if (scroll_state == 65535)
|
||||
{
|
||||
if (first == 0) return 0;
|
||||
if (first > 3) first -= 2; else first=0;
|
||||
return 1;
|
||||
}
|
||||
if (scroll_state == 1)
|
||||
{
|
||||
if (visible+first+3 >= count) first = count - visible; else first+=2;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -210,11 +210,11 @@ dword strstri(dword searchin, usestr_s)
|
||||
}
|
||||
|
||||
|
||||
void strcpyb(dword searchin, copyin, startstr, endstr)
|
||||
void strcpyb(dword search_in, copyin, startstr, endstr)
|
||||
{
|
||||
dword startp, endp;
|
||||
startp = strstr(searchin, startstr) + strlen(startstr);
|
||||
endp = strstr(startp, endstr);
|
||||
startp = strstr(search_in, startstr) + strlen(startstr);
|
||||
endp = strstri(startp, endstr);
|
||||
if (startp==endp) return;
|
||||
do
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user