forked from KolibriOS/kolibrios
Update: lib font.h, fixed bugs, new font software_widget.c
git-svn-id: svn://kolibrios.org@5814 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
53cb2d6dc4
commit
832a6dcbfe
@ -6,7 +6,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//libraries
|
//libraries
|
||||||
#define MEMSIZE 530000
|
#define MEMSIZE 540000
|
||||||
#include "..\lib\clipboard.h"
|
#include "..\lib\clipboard.h"
|
||||||
#include "..\lib\strings.h"
|
#include "..\lib\strings.h"
|
||||||
#include "..\lib\mem.h"
|
#include "..\lib\mem.h"
|
||||||
@ -708,8 +708,8 @@ void Line_ReDraw(dword bgcol, filenum){
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
font.bg_color = bgcol;
|
font.bg_color = bgcol;
|
||||||
font.prepare(0, 0, file_name_off);
|
font.prepare(files.x + 23, files.line_h - font.height / 2 + y, file_name_off);
|
||||||
font.show(files.x + 23, files.line_h - font.height / 2 + y);
|
font.show();
|
||||||
}
|
}
|
||||||
DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1
|
DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1
|
||||||
DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2
|
DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
__SIZE size;
|
__SIZE size;
|
||||||
byte r,g,b,weight,italic, smooth;
|
byte r,g,b,weight,italic, smooth;
|
||||||
byte width,height;
|
byte width,height;
|
||||||
|
word left,top;
|
||||||
byte encoding;
|
byte encoding;
|
||||||
dword color;
|
dword color;
|
||||||
dword file_size;
|
dword file_size;
|
||||||
@ -39,7 +40,7 @@
|
|||||||
byte symbol_size(byte s);
|
byte symbol_size(byte s);
|
||||||
dword prepare(word x,y;dword text1);
|
dword prepare(word x,y;dword text1);
|
||||||
void prepare_buf(word x,y,w,h;dword text1);
|
void prepare_buf(word x,y,w,h;dword text1);
|
||||||
void show(word x,y);
|
void show();
|
||||||
byte textcenter(word x,y,w,h;dword txt);
|
byte textcenter(word x,y,w,h;dword txt);
|
||||||
dword getsize(dword text1);
|
dword getsize(dword text1);
|
||||||
byte changeSIZE();
|
byte changeSIZE();
|
||||||
@ -92,7 +93,7 @@ FONT font = 0;
|
|||||||
ECX = size.width/2;
|
ECX = size.width/2;
|
||||||
EDX -= ECX;
|
EDX -= ECX;
|
||||||
x += EDX;
|
x += EDX;
|
||||||
return text(x,y,txt);
|
prepare(x,y,txt);
|
||||||
}
|
}
|
||||||
:dword FONT::getsize(dword text1)
|
:dword FONT::getsize(dword text1)
|
||||||
{
|
{
|
||||||
@ -178,12 +179,13 @@ FONT font = 0;
|
|||||||
proc_info Form_SELF_FONTS;
|
proc_info Form_SELF_FONTS;
|
||||||
dword c;
|
dword c;
|
||||||
c = color;
|
c = color;
|
||||||
|
left = x;
|
||||||
IF(!text1)return false;
|
IF(!text1)return false;
|
||||||
IF(size.text)IF(!changeSIZE())return false;
|
IF(size.text)IF(!changeSIZE())return false;
|
||||||
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
||||||
getsize(text1);
|
getsize(text1);
|
||||||
y -= size.offset.y;
|
y -= size.offset.y;
|
||||||
|
top = y;
|
||||||
EDX = size.width*size.height*3;
|
EDX = size.width*size.height*3;
|
||||||
IF(!buffer_size)
|
IF(!buffer_size)
|
||||||
{
|
{
|
||||||
@ -209,7 +211,6 @@ FONT font = 0;
|
|||||||
ELSE
|
ELSE
|
||||||
{
|
{
|
||||||
GetProcessInfo(#Form_SELF_FONTS, SelfInfo);
|
GetProcessInfo(#Form_SELF_FONTS, SelfInfo);
|
||||||
y-=size.offset.y;
|
|
||||||
CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),size.width,size.height);
|
CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),size.width,size.height);
|
||||||
}
|
}
|
||||||
len = size.offset.x;
|
len = size.offset.x;
|
||||||
@ -223,10 +224,9 @@ FONT font = 0;
|
|||||||
IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height);
|
IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
:void FONT::show(word x,y)
|
:void FONT::show()
|
||||||
{
|
{
|
||||||
y-=size.offset.y;
|
_PutImage(left,top,size.width,size.height,buffer);
|
||||||
_PutImage(x,y,size.width,size.height,buffer);
|
|
||||||
}
|
}
|
||||||
inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
||||||
:void SmoothFont(dword image, w, h)
|
:void SmoothFont(dword image, w, h)
|
||||||
@ -252,12 +252,12 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
|||||||
:byte FONT::symbol(signed x,y;byte s)
|
:byte FONT::symbol(signed x,y;byte s)
|
||||||
{
|
{
|
||||||
dword xi,yi;
|
dword xi,yi;
|
||||||
dword _;
|
|
||||||
dword iii;
|
dword iii;
|
||||||
float ital = -size.w_italic;
|
float ital = -size.w_italic;
|
||||||
dword ___x;
|
dword ___x;
|
||||||
byte _TMP_WEIGHT;
|
//byte _TMP_WEIGHT;
|
||||||
byte rw=0;
|
byte rw=0;
|
||||||
|
//_TMP_WEIGHT=2;
|
||||||
IF(s==32)return width/4;
|
IF(s==32)return width/4;
|
||||||
IF(s==9)return width;
|
IF(s==9)return width;
|
||||||
IF(!encoding)
|
IF(!encoding)
|
||||||
@ -291,10 +291,12 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
|||||||
___x = x+xi;
|
___x = x+xi;
|
||||||
IF(italic)___x+=math.ceil(ital);
|
IF(italic)___x+=math.ceil(ital);
|
||||||
PixelRGB(___x,EDI);
|
PixelRGB(___x,EDI);
|
||||||
FOR(_TMP_WEIGHT=size.TMP_WEIGHT; _TMP_WEIGHT; _TMP_WEIGHT--)
|
//_TMP_WEIGHT = 2;
|
||||||
{
|
//WHILE(_TMP_WEIGHT)
|
||||||
IF(weight) PixelRGB(___x+_TMP_WEIGHT,EDI);
|
//{
|
||||||
}
|
// _TMP_WEIGHT--;
|
||||||
|
IF(weight) PixelRGB(___x+1,EDI);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
iii++;
|
iii++;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOFTWARE CENTER v2.32
|
SOFTWARE CENTER v2.32
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MEMSIZE 0x5000
|
#define MEMSIZE 0x9000
|
||||||
#include "..\lib\strings.h"
|
#include "..\lib\strings.h"
|
||||||
#include "..\lib\mem.h"
|
#include "..\lib\mem.h"
|
||||||
#include "..\lib\file_system.h"
|
#include "..\lib\file_system.h"
|
||||||
@ -11,7 +11,7 @@ SOFTWARE CENTER v2.32
|
|||||||
#include "..\lib\obj\libio_lib.h"
|
#include "..\lib\obj\libio_lib.h"
|
||||||
#include "..\lib\obj\libimg_lib.h"
|
#include "..\lib\obj\libimg_lib.h"
|
||||||
#include "..\lib\obj\libini.h"
|
#include "..\lib\obj\libini.h"
|
||||||
|
#include "..\lib\font.h"
|
||||||
#include "..\lib\patterns\libimg_load_skin.h"
|
#include "..\lib\patterns\libimg_load_skin.h"
|
||||||
|
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
@ -58,7 +58,7 @@ void load_config()
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
dword id, key;
|
dword id, key;
|
||||||
|
font.load("/sys/fonts/Tahoma.kf");
|
||||||
load_dll(libio, #libio_init,1);
|
load_dll(libio, #libio_init,1);
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(libini, #lib_init,1);
|
load_dll(libini, #lib_init,1);
|
||||||
@ -145,8 +145,16 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name)
|
|||||||
icon_char_pos = strchr(key_value, ',');
|
icon_char_pos = strchr(key_value, ',');
|
||||||
if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon;
|
if (icon_char_pos) icon_id = atoi(icon_char_pos+1); else icon_id = default_icon;
|
||||||
img_draw stdcall(skin.image, col*cell_w+tmp-10, row*cell_h+5 + list_pos, 32, 32, 0, icon_id*32);
|
img_draw stdcall(skin.image, col*cell_w+tmp-10, row*cell_h+5 + list_pos, 32, 32, 0, icon_id*32);
|
||||||
WriteTextCenter(col*cell_w+7,row*cell_h+47 + list_pos,cell_w,0xDCDCDC,key_name);
|
//WriteTextCenter(col*cell_w+7,row*cell_h+47 + list_pos,cell_w,0xDCDCDC,key_name);
|
||||||
WriteTextCenter(col*cell_w+6,row*cell_h+46 + list_pos,cell_w,0x000000,key_name);
|
//WriteTextCenter(col*cell_w+6,row*cell_h+46 + list_pos,cell_w,0x000000,key_name);
|
||||||
|
font.size = 12;
|
||||||
|
font.color = 0xDCDCDC;
|
||||||
|
font.weight = false;
|
||||||
|
font.textcenter(col*cell_w+7,row*cell_h+47 + list_pos,cell_w,0,key_name);
|
||||||
|
font.show();
|
||||||
|
font.color = 0;
|
||||||
|
font.textcenter(col*cell_w+6,row*cell_h+46 + list_pos,cell_w,0,key_name);
|
||||||
|
font.show();
|
||||||
current_item_id++;
|
current_item_id++;
|
||||||
col++;
|
col++;
|
||||||
return true;
|
return true;
|
||||||
@ -165,7 +173,7 @@ byte process_sections(dword sec_name, f_name)
|
|||||||
{
|
{
|
||||||
if ((col==0) && (row==old_row))
|
if ((col==0) && (row==old_row))
|
||||||
{
|
{
|
||||||
list_pos -= 20;
|
list_pos -= 25;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -173,9 +181,13 @@ byte process_sections(dword sec_name, f_name)
|
|||||||
}
|
}
|
||||||
col = 0;
|
col = 0;
|
||||||
old_row = row;
|
old_row = row;
|
||||||
DrawBar(0, row * cell_h + list_pos, Form.cwidth , 20, LIST_BACKGROUND_COLOR);
|
DrawBar(0, row * cell_h + list_pos, Form.cwidth , 26, LIST_BACKGROUND_COLOR);
|
||||||
WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name);
|
//WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name);
|
||||||
list_pos += 20;
|
font.size=14;
|
||||||
|
font.weight = true;
|
||||||
|
font.prepare(10, row * cell_h + 9 + list_pos,sec_name);
|
||||||
|
font.show();
|
||||||
|
list_pos += 26;
|
||||||
ini_enum_keys stdcall (f_name, sec_name, #draw_icons_from_section);
|
ini_enum_keys stdcall (f_name, sec_name, #draw_icons_from_section);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -183,10 +195,17 @@ byte process_sections(dword sec_name, f_name)
|
|||||||
|
|
||||||
void draw_top_bar()
|
void draw_top_bar()
|
||||||
{
|
{
|
||||||
int top_position = 25;
|
int top_position = 26;
|
||||||
DrawBar(0,0,Form.cwidth, top_position-1, system.color.work);
|
DrawBar(0,0,Form.cwidth, top_position-1, system.color.work);
|
||||||
DrawBar(0,top_position-1, Form.cwidth, 1, system.color.work_graph);
|
DrawBar(0,top_position-1, Form.cwidth, 1, system.color.work_graph);
|
||||||
WriteTextB(Form.cwidth/2-70, 9, 0x90, system.color.work_text, #window_title);
|
//WriteTextB(Form.cwidth/2-70, 9, 0x90, system.color.work_text, #window_title);
|
||||||
|
font.size = 19;
|
||||||
|
font.getsize(#window_title);
|
||||||
|
ECX = EAX/2;
|
||||||
|
EBX = Form.cwidth/2-ECX;
|
||||||
|
font.weight = false;
|
||||||
|
font.prepare(EBX,0,#window_title);
|
||||||
|
font.show();
|
||||||
list_top = top_position;
|
list_top = top_position;
|
||||||
list_pos = list_top;
|
list_pos = list_top;
|
||||||
row = -1;
|
row = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user