Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 6263 → Rev 6264

/programs/cmm/appearance/icons.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programs/cmm/appearance/icons.raw
File deleted
\ No newline at end of file
/programs/cmm/appearance/appearance.c
31,17 → 31,13
?define T_WALLPAPERS " Wallpappers"
#endif
 
unsigned char icons[]= FROM "icons.raw";
 
#define PANEL_H 40
#define LIST_PADDING 20
#define TAB_PADDING 16
#define TAB_HEIGHT 25
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
 
llist list;
signed int active_tab, active_skin=-1, active_wallpaper=-1;
signed int active_skin=-1, active_wallpaper=-1;
enum { SKINS=2, WALLPAPERS };
 
char folder_path[4096];
111,7 → 107,7
GetKeys();
if (list.ProcessKey(key_scancode)) EventApply();
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
if (key_scancode==SCAN_CODE_TAB) if (active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS);
if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS);
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
for (id=list.cur_y+1; id<list.count; id++)
{
152,33 → 148,13
DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, 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);
DrawTab(list.x+10, list.y, SKINS, T_SKINS);
if (dir_exists(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS);
tabs.draw(list.x+10, list.y, SKINS, T_SKINS);
if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS);
DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph);
 
Draw_List();
}
 
void DrawTab(dword x,y, but_id, text)
{
dword col_bg, col_text;
dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT;
y -= h;
 
if (but_id==active_tab)
{
col_bg=system.color.work_button;
col_text=system.color.work_button_text;
}
else
{
col_bg=system.color.work;
col_text=system.color.work_text;
}
DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text);
_PutImage(x+10,h-16/2+y+1, 16,15, but_id-2*16*15*3+#icons);
}
 
void DrawScroller()
{
scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80);
207,8 → 183,8
{
strcpy(#temp_filename, io.dir.position(j));
strlwr(#temp_filename);
if (active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
if (active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
if (tabs.active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
if (tabs.active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
cur = list.count;
files_mas[cur]=j;
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[list.count];
252,8 → 228,8
 
void EventTabClick(int N)
{
active_tab = N;
if (active_tab == SKINS)
tabs.click(N);
if (tabs.active_tab == SKINS)
{
active_wallpaper = list.cur_y;
strcpy(#folder_path, SKINS_STANDART_PATH);
262,7 → 238,7
if (!list.count) notify("'No skins were found' -E");
list.cur_y = active_skin;
}
if (active_tab == WALLPAPERS)
if (tabs.active_tab == WALLPAPERS)
{
active_skin = list.cur_y;
strcpy(#folder_path, WALP_STANDART_PATH);
271,6 → 247,7
if (!list.count) notify("'No wallpapers were found' -E");
list.cur_y = active_wallpaper;
}
if (list.cur_y>list.visible) list.first=list.cur_y; list.CheckDoesValuesOkey();
if (list.w) DrawWindowContent();
}
 
283,13 → 260,13
 
void EventApply()
{
if (active_tab==SKINS)
if (tabs.active_tab==SKINS)
{
cur = list.cur_y;
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
SetSystemSkin(#cur_file_path);
}
if (active_tab==WALLPAPERS)
if (tabs.active_tab==WALLPAPERS)
{
cur = list.cur_y;
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
300,8 → 277,8
 
void EventOpenFile()
{
if (active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
if (active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
}
 
stop:
/programs/cmm/appearance/compile_en.bat
6,5 → 6,4
@rename appearance.com appearance
@del warning.txt
@del lang.h--
@pause
kpack appearance
@pause
/programs/cmm/appearance/compile_ru.bat
6,5 → 6,4
@rename appearance.com appearance
@del warning.txt
@del lang.h--
@pause
kpack appearance
@pause
/programs/cmm/eolite/include/icons.h
10,7 → 10,7
"exe", 7, "msi", 7,
"sys", 8, "ocx", 8, "drv", 8, "so", 8,
"inc", 9,
"chr", 10, "mt", 10, "ttf", 10, "fon", 10,
"chr", 10, "mt", 10, "ttf", 10, "fon", 10, "kf", 10,
"asm", 11,
"mp3", 12, "wav", 12, "mid", 12, "midi",12, "ogg", 12, "wma", 12, "flac",12,
"skn", 13,
/programs/cmm/kf_font_viewer/compile.bat
File deleted
\ No newline at end of file
/programs/cmm/kf_font_viewer/compile_en.bat
0,0 → 1,5
C-- "font_viewer.c"
@del "font_viewer"
@rename "font_viewer.com" "font_viewer"
@del warning.txt
@pause
/programs/cmm/kf_font_viewer/font_viewer.c
4,45 → 4,64
#include "../lib/gui.h"
 
#define PANELH 30
proc_info Form;
 
enum {
STRONG_BTN=10, ITALIC_BTN, SMOOTH_BTN,
PHRASE_TAB=20, CHARS_TAB
};
 
 
void main()
{
proc_info Form;
int i, y, btn;
char line[256], title[4196];
int btn;
char title[4196];
if (!param) strcpy(#param, DEFAULT_FONT);
label.init(#param);
tabs.active_tab=PHRASE_TAB;
strcpy(#title, "Font preview: ");
strcat(#title, #param);
loop()
loop() switch(WaitEvent())
{
switch(WaitEvent())
{
case evButton:
btn = GetButtonID();
if (btn==1) ExitProcess();
if (btn==2) label.bold ^=1;
if (btn==3) label.italic ^=1;
if (btn==4) label.smooth ^=1;
if (btn==STRONG_BTN) label.bold ^=1;
if (btn==ITALIC_BTN) label.italic ^=1;
if (btn==SMOOTH_BTN) label.smooth ^=1;
if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
goto _DRAW_WINDOW_CONTENT;
case evReDraw:
system.color.get();
DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title);
DefineAndDrawWindow(215,100,500,320+skin_height,0x74,0xFFFFFF,#title);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
_DRAW_WINDOW_CONTENT:
DrawBar(0, 0, Form.cwidth, PANELH, system.color.work);
CheckBox(10, 8, 2, "Bold", label.bold);
CheckBox(83, 8, 3, "Italic", label.italic);
CheckBox(170, 8, 4, "Smooth", label.smooth);
label.raw_size = free(label.raw);
DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work);
CheckBox(10, 8, STRONG_BTN, "Bold", label.bold);
CheckBox(83, 8, ITALIC_BTN, "Italic", label.italic);
CheckBox(170,8, SMOOTH_BTN, "Smooth", label.smooth);
tabs.draw(Form.cwidth-150, PANELH, PHRASE_TAB, "Phrase");
tabs.draw(Form.cwidth-70, PANELH, CHARS_TAB, "Chars");
DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph);
if (!label.font)
{
DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
break;
}
else for (i=10, y=5; i<22; i++, y+=label.height;) //not flexible, need to calculate font count and max line length
if (tabs.active_tab==PHRASE_TAB) DrawPreviewPhrase();
if (tabs.active_tab==CHARS_TAB) DrawPreviewChars();
}
}
 
void DrawPreviewPhrase()
{
dword i, y;
char line[256];
label.raw_size = free(label.raw);
for (i=10, y=5; i<22; i++, y+=label.height;) //not flexible, need to calculate font count and max line length
{
sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
label.write_buf(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line);
}
49,5 → 68,23
if (label.smooth) label.apply_smooth();
label.show_buf(0, PANELH);
}
 
void DrawPreviewChars()
{
dword i, x=20, y=0;
char line[2];
line[1]=NULL;
label.raw_size = free(label.raw);
for (i=0; i<255; i++) //not flexible, need to calculate font count and max line length
{
line[0]=i;
label.write_buf(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line);
x+= label.height+2;
if (x>=Form.cwidth-30) {
x=20;
y+=label.height+2;
}
}
if (label.smooth) label.apply_smooth();
label.show_buf(0, PANELH);
}
/programs/cmm/lib/font.h
133,7 → 133,7
}
size.width += rw;
IF(bold) size.width+=size.TMP_WEIGHT;
IF(s=='_') size.width--;
//IF(s=='_') size.width--; //http://board.kolibrios.org/viewtopic.php?f=44&t=973&start=645
IF(size.offset_x<0)size.offset_x = X;
}
:byte LABEL::symbol(signed x,y; byte s; dword image_raw)
275,7 → 275,7
len = size.offset_x;
WHILE(DSBYTE[text1])
{
IF(DSBYTE[text1]=='_') len--;
//IF(DSBYTE[text1]=='_') len--; //http://board.kolibrios.org/viewtopic.php?f=44&t=973&start=645
len+=symbol(len,0,DSBYTE[text1], raw);
IF(bold)len+=math.ceil(size.pt/17);
text1++;
/programs/cmm/lib/gui.h
267,4 → 267,49
return n;
}
 
 
/*=========================================================
==
== TABS
==
/========================================================*/
 
#define TAB_PADDING 25
#define TAB_HEIGHT 25
 
struct _tabs
{
int active_tab;
void draw();
int click();
} tabs;
 
void _tabs::draw(dword x,y, but_id, text)
{
dword col_bg, col_text;
dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT;
y -= h;
 
if (but_id==active_tab)
{
col_bg=system.color.work_button;
col_text=system.color.work_button_text;
}
else
{
col_bg=system.color.work;
col_text=system.color.work_text;
}
DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text);
}
 
int _tabs::click(int N)
{
if (N==active_tab) return false;
active_tab = N;
return true;
}
 
 
 
#endif