Eolite 5.2:
- show icon 32x32 in Properties window - fix "Contains:" value in Properties window - do not read ini file each time when we draw an icon, instead use a collection with a cached values git-svn-id: svn://kolibrios.org@9576 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
02bb1aee0e
commit
31c56c9a2c
@ -11,9 +11,9 @@ TODO:
|
|||||||
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
|
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ABOUT_TITLE "EOLITE 5.19"
|
#define ABOUT_TITLE "EOLITE 5.2"
|
||||||
#define TITLE_EOLITE "Eolite File Manager 5.19"
|
#define TITLE_EOLITE "Eolite File Manager 5.2"
|
||||||
#define TITLE_KFM "Kolibri File Manager 2.19";
|
#define TITLE_KFM "Kolibri File Manager 2.2";
|
||||||
|
|
||||||
#define MEMSIZE 1024 * 250
|
#define MEMSIZE 1024 * 250
|
||||||
#include "../lib/clipboard.h"
|
#include "../lib/clipboard.h"
|
||||||
|
@ -1,25 +1,46 @@
|
|||||||
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
|
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
|
||||||
|
|
||||||
|
struct ICONS_INI {
|
||||||
|
collection exts;
|
||||||
|
collection_int i18;
|
||||||
|
collection_int i32;
|
||||||
|
int get();
|
||||||
|
} ini_icons;
|
||||||
|
|
||||||
|
int ICONS_INI::get(dword _file_path, _ext, int size)
|
||||||
|
{
|
||||||
|
char file_4bytes[4], ext[7];
|
||||||
|
int ext_pos;
|
||||||
|
if (!_ext) {
|
||||||
|
ReadFile(0,4,#file_4bytes,_file_path);
|
||||||
|
IF(DSDWORD[#file_4bytes]=='KCPK')
|
||||||
|
||(DSDWORD[#file_4bytes]=='UNEM') {
|
||||||
|
_ext = "kex";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strlcpy(#ext, _ext, sizeof(ext));
|
||||||
|
strlwr(#ext);
|
||||||
|
ext_pos = exts.get_pos_by_name(#ext);
|
||||||
|
if (ext_pos != -1) {
|
||||||
|
if (size == 18) return i18.get(ext_pos);
|
||||||
|
else if (size == 32) return i32.get(ext_pos);
|
||||||
|
} else {
|
||||||
|
exts.add(#ext);
|
||||||
|
icons_ini.section = "icons16";
|
||||||
|
i18.set(exts.count-1, icons_ini.GetInt(#ext, 2));
|
||||||
|
|
||||||
|
icons_ini.section = "icons32";
|
||||||
|
i32.set(exts.count-1, icons_ini.GetInt(#ext, 95));
|
||||||
|
return get(#ext, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
||||||
{
|
{
|
||||||
char BYTE_HEAD_FILE[4];
|
char ext[7];
|
||||||
char ext[512];
|
|
||||||
int icon_n = 2;
|
int icon_n = 2;
|
||||||
dword selected_image;
|
dword selected_image;
|
||||||
dword default_image;
|
dword default_image;
|
||||||
dword default_icon;
|
|
||||||
|
|
||||||
if (big_icons.checked) {
|
|
||||||
icons_ini.section = "icons32";
|
|
||||||
selected_image = icons32_selected.image;
|
|
||||||
default_image = icons32_default.image;
|
|
||||||
default_icon=95;
|
|
||||||
} else {
|
|
||||||
icons_ini.section = "icons16";
|
|
||||||
selected_image = icons16_selected.image;
|
|
||||||
default_image = icons16_default.image;
|
|
||||||
default_icon=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ESBYTE[file_path+1]!='k') && (ESBYTE[file_path+1]!='s') && (chrnum(file_path, '/')==2) {
|
if (ESBYTE[file_path+1]!='k') && (ESBYTE[file_path+1]!='s') && (chrnum(file_path, '/')==2) {
|
||||||
if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2];
|
if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2];
|
||||||
@ -32,14 +53,16 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
|||||||
icons_ini.section = "drives16";
|
icons_ini.section = "drives16";
|
||||||
icon_n = icons_ini.GetInt(#ext, 50);
|
icon_n = icons_ini.GetInt(#ext, 50);
|
||||||
}
|
}
|
||||||
} else if (extension) {
|
} else {
|
||||||
strcpy(#ext, extension);
|
icon_n = ini_icons.get(file_path, extension, icon_size);
|
||||||
strlwr(#ext);
|
}
|
||||||
icon_n = icons_ini.GetInt(#ext, default_icon);
|
|
||||||
} else if (file_path) {
|
if (big_icons.checked) {
|
||||||
ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
|
selected_image = icons32_selected.image;
|
||||||
IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM')
|
default_image = icons32_default.image;
|
||||||
icon_n = icons_ini.GetInt("kex", 2);
|
} else {
|
||||||
|
selected_image = icons16_selected.image;
|
||||||
|
default_image = icons16_default.image;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fairing_color==col.selec) {
|
if (fairing_color==col.selec) {
|
||||||
|
@ -263,7 +263,7 @@ void DrawPropertiesWindow()
|
|||||||
if (!itdir) {
|
if (!itdir) {
|
||||||
element_size = file_info_general.sizelo;
|
element_size = file_info_general.sizelo;
|
||||||
} else {
|
} else {
|
||||||
sprintf(#folder_info,PR_T_CONTAINS,dir_size.files,dir_size.folders);
|
sprintf(#folder_info,T_FILES_FOLDERS,more_files_count.files,more_files_count.folders);
|
||||||
WriteText(10, 117, 0x90, sc.work_text, PR_T_CONTAINS);
|
WriteText(10, 117, 0x90, sc.work_text, PR_T_CONTAINS);
|
||||||
WriteText(120, 117, 0x90, sc.work_text, #folder_info);
|
WriteText(120, 117, 0x90, sc.work_text, #folder_info);
|
||||||
element_size = dir_size.bytes;
|
element_size = dir_size.bytes;
|
||||||
@ -288,9 +288,8 @@ void DrawPropertiesWindow()
|
|||||||
|
|
||||||
void PropertiesDrawIcon(dword file_path, extension)
|
void PropertiesDrawIcon(dword file_path, extension)
|
||||||
{
|
{
|
||||||
#define ICON_PADDING 11
|
int icon_n = ini_icons.get(file_path, extension, 32);
|
||||||
DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff);
|
draw_icon_32(12, 22, sc.work, icon_n);
|
||||||
DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventApplyProperties()
|
void EventApplyProperties()
|
||||||
|
@ -83,20 +83,22 @@
|
|||||||
#define padding_h 15
|
#define padding_h 15
|
||||||
#define right_margin 12
|
#define right_margin 12
|
||||||
#define h padding_v + padding_v + 16 //16 font height
|
#define h padding_v + padding_v + 16 //16 font height
|
||||||
int tx = x + padding_h;
|
|
||||||
int ty = y + padding_v+1;
|
|
||||||
int tw = strlen(text)*8;
|
int tw = strlen(text)*8;
|
||||||
int w = tw + padding_h + padding_h;
|
int w = tw + padding_h + padding_h;
|
||||||
unsigned darker_color = MixColors(sc.button,0,230);
|
unsigned darker_color = MixColors(sc.button,0,230);
|
||||||
|
|
||||||
DefineButton(x,y,w,h,id,sc.button);
|
DefineButton(x,y,w,h,id,sc.button);
|
||||||
|
|
||||||
WriteText(tx+1,ty+1,0x90,darker_color,text);
|
x += padding_h;
|
||||||
WriteText(tx,ty,0x90,sc.button_text,text);
|
y += padding_v+1;
|
||||||
|
|
||||||
|
WriteText(x+1,y+1,0x90,darker_color,text);
|
||||||
|
WriteText(x,y,0x90,sc.button_text,text);
|
||||||
|
|
||||||
if (active_button_id==id) {
|
if (active_button_id==id) {
|
||||||
DrawBar(tx,ty+15,tw,1, darker_color);
|
|
||||||
DrawBar(tx,ty+14,tw,1, sc.button_text);
|
DrawBar(x,y+15,tw,1, darker_color);
|
||||||
|
DrawBar(x,y+14,tw,1, sc.button_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return w + right_margin;
|
return w + right_margin;
|
||||||
@ -152,21 +154,21 @@
|
|||||||
#define DOT_W 37
|
#define DOT_W 37
|
||||||
:void DrawFileBox(dword edit_box_pointer, title, btn)
|
:void DrawFileBox(dword edit_box_pointer, title, btn)
|
||||||
{
|
{
|
||||||
dword x,y,w,h,bg,t;
|
dword x,y,w,bg,t;
|
||||||
ESI = edit_box_pointer;
|
ESI = edit_box_pointer;
|
||||||
x = ESI.edit_box.left;
|
x = ESI.edit_box.left;
|
||||||
y = ESI.edit_box.top;
|
y = ESI.edit_box.top;
|
||||||
w = ESI.edit_box.width+1;
|
w = ESI.edit_box.width+1;
|
||||||
h = 22;
|
#define box_h 22
|
||||||
|
|
||||||
if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
|
if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
|
||||||
edit_box_draw stdcall (edit_box_pointer);
|
edit_box_draw stdcall (edit_box_pointer);
|
||||||
DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg);
|
DrawRectangle3D(x-1, y-1, w+1, box_h+1, 0xE7E7E7, bg);
|
||||||
DrawRectangle(x-2, y-2, w+3, h+3, sc.work_graph);
|
DrawRectangle(x-2, y-2, w+3, box_h+3, sc.work_graph);
|
||||||
DrawRectangle3D(x-3, y-3, w+DOT_W+5, h+5, sc.work_dark, sc.work_light);
|
DrawRectangle3D(x-3, y-3, w+DOT_W+5, box_h+5, sc.work_dark, sc.work_light);
|
||||||
|
|
||||||
WriteText(x-2, y-19, 0x90, sc.work_text, title);
|
WriteText(x-2, y-19, 0x90, sc.work_text, title);
|
||||||
DrawCaptButton(x+w+1, y-2, DOT_W, h+3, btn, sc.button, sc.button_text, "...");
|
DrawCaptButton(x+w+1, y-2, DOT_W, box_h+3, btn, sc.button, sc.button_text, "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
:void DrawEditBoxPos(dword x,y, edit_box_pointer)
|
:void DrawEditBoxPos(dword x,y, edit_box_pointer)
|
||||||
|
@ -324,7 +324,7 @@ void EventMagnifyMinus()
|
|||||||
|
|
||||||
void EventMagnifyPlus()
|
void EventMagnifyPlus()
|
||||||
{
|
{
|
||||||
font_size = math.min(3, font_size+1);
|
font_size = math.min(5, font_size+1);
|
||||||
SetFontSize(font_size);
|
SetFontSize(font_size);
|
||||||
ParseAndPaint();
|
ParseAndPaint();
|
||||||
}
|
}
|
||||||
@ -719,6 +719,8 @@ void SetFontSize(char _size)
|
|||||||
if (font_size == 1) list.SetFont( 8, 14, 00011000b);
|
if (font_size == 1) list.SetFont( 8, 14, 00011000b);
|
||||||
if (font_size == 2) list.SetFont(2*6, 2*9, 00001001b);
|
if (font_size == 2) list.SetFont(2*6, 2*9, 00001001b);
|
||||||
if (font_size == 3) list.SetFont(2*8, 2*14-2, 00011001b);
|
if (font_size == 3) list.SetFont(2*8, 2*14-2, 00011001b);
|
||||||
|
if (font_size == 4) list.SetFont(3*6, 3*9, 00001010b);
|
||||||
|
if (font_size == 5) list.SetFont(3*8, 3*14-2, 00011010b);
|
||||||
list.item_w = list.font_w;
|
list.item_w = list.font_w;
|
||||||
list.horisontal_selelection = true;
|
list.horisontal_selelection = true;
|
||||||
list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1,
|
list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1,
|
||||||
|
Loading…
Reference in New Issue
Block a user