gui.h: add DrawTextViewArea(), upload drvinst

git-svn-id: svn://kolibrios.org@6631 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-10-28 16:06:18 +00:00
parent 357d191859
commit eb2812b317
6 changed files with 156 additions and 7 deletions

View File

@ -123,9 +123,9 @@ void DrawWindowContent()
DrawBar(0,Form.cheight-PANEL_BOTTOM_H, Form.cwidth, PANEL_BOTTOM_H, system.color.work);
DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light);
DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_LAST_SLOT, system.color.work_button, system.color.work_button_text, T_DELETE_LAST_SLOT);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_ALL_SLOTS, system.color.work_button, system.color.work_button_text, T_DELETE_ALL_SLOTS);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_UNLOCK, system.color.work_button, system.color.work_button_text, T_RESET_BUFFER_LOCK);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_LAST_SLOT, T_DELETE_LAST_SLOT);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_ALL_SLOTS, T_DELETE_ALL_SLOTS);
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_UNLOCK, T_RESET_BUFFER_LOCK);
DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph);
WriteText(list.x+12, list.y - 23, list.font_type, system.color.work_text, T_COLUMNS_TITLE);
WriteText(list.x+list.w-68, list.y - 23, list.font_type, system.color.work_text, T_COLUMN_VIEW);

View File

@ -0,0 +1,6 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("drvinst.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "end.com")

View File

@ -0,0 +1,9 @@
@del *.kex
@c-- drvinst.c
@rename *.com *.kex
@del warning.txt
@pause

View File

@ -0,0 +1,27 @@
[ahci]
title=ACHI
ver=rc06
description=Поиск контроллеров и определение подключённых АТА дисков. В случае успеха, делает видимыми в Клобири жесткие диски подключенные через ACHI.
readme=ahci/readme.txt
app=ahci/ahci
[atikms]
title=ATI KMS
ver=4.4
description=Драйвера для видеокарт ATI Radeon. Поддерживаются дискретные и интегрированные чипсеты семейств ATI R100-R600, Evergreen, Northern Islands, Southern Islands. Устанавливает видеорежима при первом запуске и делает доступным смену видеорежима в процессе работы (SYSPANEL -> VideoMode).
readme=atikms/readme.txt
app=atikms/atikms
[i915]
title=Intel i915
ver=4.4.1
description=Драйвера для видеокарт Intel. Поддерживаются все PCI Express видеоядра Intel от i915 до Skylake. Устанавливает видеорежима при первом запуске и делает доступным смену видеорежима в процессе работы (SYSPANEL -> VideoMode).
readme=i915/readme.txt
app=i915/i915
[vmware]
title=VmWare
ver=3.14-rc2
description=Драйвера для видеокарт Intel. Поддерживаются все PCI Express видеоядра Intel от i915 до Skylake. Устанавливает видеорежима при первом запуске и делает доступным смену видеорежима в процессе работы (SYSPANEL -> VideoMode).
readme=i915/readme.txt
app=i915/i915

View File

@ -0,0 +1,49 @@
#define MEMSIZE 4096*10
#include "../lib/gui.h"
proc_info Form;
#define WINDOW_TITLE "Driver Installer"
#define T_CAUTION_TITLE "CAUTION"
#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
#define T_ASSEPT_RISK "I assept the risk"
#define BUTTON_ID_ASSEPT_RISK 10
void main()
{
word id;
loop() switch(WaitEvent())
{
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
break;
case evKey:
GetKeys();
break;
case evReDraw:
draw_window();
break;
}
}
void draw_window()
{
incn y;
y.n=40;
system.color.get();
DefineAndDrawWindow(215, 100, 450, 250, 0x33, system.color.work, WINDOW_TITLE);
GetProcessInfo(#Form, SelfInfo);
WriteTextB(30+2,y.n+2,0x81,MixColors(system.color.work, 0xB92234,220),T_CAUTION_TITLE);
WriteTextB(30,y.n,0x81,0xB92234,T_CAUTION_TITLE);
y.n = DrawTextViewArea(30, y.inc(30), Form.cwidth-60, Form.cheight-140, 15,
T_CAUTION_PARAGRAPH, -1, system.color.work_text);
DrawStandartCaptButton(30, y.inc(10), BUTTON_ID_ASSEPT_RISK, T_ASSEPT_RISK);
}

View File

@ -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