Eskin: if skin file was not defined then no skin set. Default system skin will be used in this case. Probably a bit speedup system boot.
TxtRead: autodetect encoding, fix about encoding git-svn-id: svn://kolibrios.org@7872 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -20,6 +20,5 @@ program=/sys/demos/spiral
|
|||||||
|
|
||||||
[style]
|
[style]
|
||||||
buttons_gradient=1
|
buttons_gradient=1
|
||||||
skin=/rd1/1/default.skn
|
|
||||||
bg_program=/rd/1/media/kiv
|
bg_program=/rd/1/media/kiv
|
||||||
bg_param=\T__/rd/1/home.png
|
bg_param=\T__/rd/1/home.png
|
||||||
|
@@ -16,8 +16,8 @@ $DD 2 dup 0
|
|||||||
char aIconv_open[] = "iconv_open";
|
char aIconv_open[] = "iconv_open";
|
||||||
char aIconv[] = "iconv";
|
char aIconv[] = "iconv";
|
||||||
|
|
||||||
char charsets[] = "UTF-8\0 KOI8-RU\0 CP1251\0 CP1252\0 ISO8859-5\0CP866";
|
char charsets[] = "UTF-8\0 KOI8-RU\0 CP1251\0 CP1252\0 ISO8859-5\0CP866 \0AUTO";
|
||||||
enum { CH_UTF8, CH_KOI8, CH_CP1251, CH_CP1252, CH_ISO8859_5, CH_CP866, CH_NULL };
|
enum { CH_UTF8, CH_KOI8, CH_CP1251, CH_CP1252, CH_ISO8859_5, CH_CP866, CH_AUTO };
|
||||||
|
|
||||||
dword ChangeCharset(dword from_chs, to_chs, conv_buf)
|
dword ChangeCharset(dword from_chs, to_chs, conv_buf)
|
||||||
{
|
{
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
|
|
||||||
#define INTRO_TEXT "<22><><EFBFBD> <20><><EFBFBD><EFBFBD>⮩ <20><><EFBFBD>ᬮ<EFBFBD><E1ACAE>騪 ⥪<><E2A5AA><EFBFBD>.\n<><6E><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥪<>⮢<EFBFBD><E2AEA2> 䠩<>."
|
#define INTRO_TEXT "<22><><EFBFBD> <20><><EFBFBD><EFBFBD>⮩ <20><><EFBFBD>ᬮ<EFBFBD><E1ACAE>騪 ⥪<><E2A5AA><EFBFBD>.\n<><6E><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥪<>⮢<EFBFBD><E2AEA2> 䠩<>."
|
||||||
#define VERSION "Text Reader v1.4"
|
#define VERSION "Text Reader v1.41"
|
||||||
#define ABOUT "<22><><EFBFBD><EFBFBD>: Leency, punk_joker
|
#define ABOUT "<22><><EFBFBD><EFBFBD>: Leency, punk_joker
|
||||||
<EFBFBD><EFBFBD><EFBFBD>: Leency, Veliant, KolibriOS Team
|
<EFBFBD><EFBFBD><EFBFBD>: Leency, Veliant, KolibriOS Team
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ char color_scheme_names[] =
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
|
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
|
||||||
#define VERSION "Text Reader v1.4"
|
#define VERSION "Text Reader v1.41"
|
||||||
#define ABOUT "Idea: Leency, punk_joker
|
#define ABOUT "Idea: Leency, punk_joker
|
||||||
Code: Leency, Veliant, KolibriOS Team
|
Code: Leency, Veliant, KolibriOS Team
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ _ini ini = { "/sys/settings/app.ini", "Txtread" };
|
|||||||
void LoadIniSettings()
|
void LoadIniSettings()
|
||||||
{
|
{
|
||||||
kfont.size.pt = ini.GetInt("FontSize", 14);
|
kfont.size.pt = ini.GetInt("FontSize", 14);
|
||||||
encoding = ini.GetInt("Encoding", CH_CP866);
|
encoding = ini.GetInt("Encoding", CH_AUTO);
|
||||||
curcol_scheme = ini.GetInt("ColorScheme", 2);
|
curcol_scheme = ini.GetInt("ColorScheme", 2);
|
||||||
Form.left = ini.GetInt("WinX", 150);
|
Form.left = ini.GetInt("WinX", 150);
|
||||||
Form.top = ini.GetInt("WinY", 50);
|
Form.top = ini.GetInt("WinY", 50);
|
||||||
|
@@ -68,19 +68,20 @@ bool SEARCH::edit_mouse()
|
|||||||
|
|
||||||
void SEARCH::draw_found()
|
void SEARCH::draw_found()
|
||||||
{
|
{
|
||||||
strcpy(#param, "Matches: ");
|
char matches[30];
|
||||||
strcat(#param, itoa(found_count));
|
strcpy(#matches, "Matches: ");
|
||||||
strcat(#param, " ");
|
strcat(#matches, itoa(found_count));
|
||||||
WriteTextWithBg(search_box.left+search_box.width+14+110, search_box.top+3, 0xD0, sc.work_text, #param, sc.work);
|
strcat(#matches, " ");
|
||||||
|
WriteTextWithBg(search_box.left+search_box.width+14+110, search_box.top+3, 0xD0, sc.work_text, #matches, sc.work);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SEARCH::draw(dword _btn_find, _btn_hide)
|
bool SEARCH::draw(dword _btn_find, _btn_hide, _y)
|
||||||
{
|
{
|
||||||
if (!visible) return false;
|
if (!visible) return false;
|
||||||
DrawBar(0,Form.cheight - SEARCH_H, Form.cwidth, 1, sc.work_graph);
|
DrawBar(0, _y, Form.cwidth, 1, sc.work_graph);
|
||||||
DrawBar(0,Form.cheight - SEARCH_H+1, Form.cwidth, SEARCH_H-1, sc.work);
|
DrawBar(0, _y+1, Form.cwidth, SEARCH_H-1, sc.work);
|
||||||
|
|
||||||
search_box.top = Form.cheight - SEARCH_H + 6;
|
search_box.top = _y + 6;
|
||||||
search_box.width = math.min(Form.width - 200, 250);
|
search_box.width = math.min(Form.width - 200, 250);
|
||||||
|
|
||||||
DrawRectangle(search_box.left-1, search_box.top-1, search_box.width+2, 23,sc.work_graph);
|
DrawRectangle(search_box.left-1, search_box.top-1, search_box.width+2, 23,sc.work_graph);
|
||||||
@@ -144,10 +145,10 @@ int SEARCH::highlight(dword _color, _bg_color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_bar(dword _x, _y, _w, _h, _color)
|
:void draw_bar(dword _x, _y, _w, _h, _color)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = _y*list.w+_x*KFONT_BPP+kfont.raw ; i<_y*list.w+_x+_w*KFONT_BPP+kfont.raw ; i+=KFONT_BPP)
|
for (i = _y*list.w+_x*4+kfont.raw ; i<_y*list.w+_x+_w*4+kfont.raw ; i+=4)
|
||||||
{
|
{
|
||||||
ESDWORD[i] = _color;
|
ESDWORD[i] = _color;
|
||||||
}
|
}
|
||||||
|
@@ -312,7 +312,7 @@ void EventShowCharsetsList()
|
|||||||
{
|
{
|
||||||
menu_id = CHANGE_CHARSET;
|
menu_id = CHANGE_CHARSET;
|
||||||
open_lmenu(Form.left+5 + charsets_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT,
|
open_lmenu(Form.left+5 + charsets_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT,
|
||||||
encoding+1, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866");
|
encoding+1, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866\nAUTO");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowReopenMenu()
|
void EventShowReopenMenu()
|
||||||
@@ -342,7 +342,7 @@ void EventShowInfo() {
|
|||||||
help_opened = true;
|
help_opened = true;
|
||||||
DrawBar(list.x, list.y, list.w, list.h, bg_color);
|
DrawBar(list.x, list.y, list.w, list.h, bg_color);
|
||||||
WriteText(list.x + 10, list.y + 10, 10000001b, text_color, VERSION);
|
WriteText(list.x + 10, list.y + 10, 10000001b, text_color, VERSION);
|
||||||
WriteTextLines(list.x + 10, list.y+40, 10110000b, text_color, ABOUT, 20);
|
WriteTextLines(list.x + 10, list.y+40, 10010000b, text_color, ABOUT, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventChangeCharset(dword id)
|
void EventChangeCharset(dword id)
|
||||||
@@ -417,7 +417,15 @@ void LoadFile(dword f_path)
|
|||||||
io.buffer_data = INTRO_TEXT;
|
io.buffer_data = INTRO_TEXT;
|
||||||
strcpy(#title, "Text Reader");
|
strcpy(#title, "Text Reader");
|
||||||
}
|
}
|
||||||
if (encoding!=CH_CP866) ChangeCharset(encoding, "CP866", io.buffer_data);
|
|
||||||
|
// Autodetecting encoding
|
||||||
|
if (encoding==CH_AUTO) {
|
||||||
|
if (strstr(io.buffer_data, "\208\190")) ChangeCharset(CH_UTF8, "CP866", io.buffer_data);
|
||||||
|
else if (chrnum(io.buffer_data, '\246')>5) || (strstr(io.buffer_data, "<EFBFBD><EFBFBD>")) ChangeCharset(CH_CP1251, "CP866", io.buffer_data);
|
||||||
|
} else {
|
||||||
|
if (encoding!=CH_CP866) ChangeCharset(encoding, "CP866", io.buffer_data);
|
||||||
|
}
|
||||||
|
|
||||||
list.ClearList();
|
list.ClearList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,7 +476,7 @@ void draw_window()
|
|||||||
DrawToolbarButton(SHOW_INFO, x.n);
|
DrawToolbarButton(SHOW_INFO, x.n);
|
||||||
colscheme_mx = DrawToolbarButton(COLOR_SCHEME, x.inc(-TOOLBAR_BUTTON_WIDTH - BUTTONS_GAP));
|
colscheme_mx = DrawToolbarButton(COLOR_SCHEME, x.inc(-TOOLBAR_BUTTON_WIDTH - BUTTONS_GAP));
|
||||||
|
|
||||||
if (search.draw(BTN_FIND_NEXT+10, BTN_FIND_CLOSE+10)) {
|
if (search.draw(BTN_FIND_NEXT+10, BTN_FIND_CLOSE+10, Form.cheight - SEARCH_H)) {
|
||||||
DrawRectangle3D(search_mx+1, 6, TOOLBAR_ICON_WIDTH-1,
|
DrawRectangle3D(search_mx+1, 6, TOOLBAR_ICON_WIDTH-1,
|
||||||
TOOLBAR_ICON_HEIGHT-1, 0xCCCccc, 0xF8FCF8);
|
TOOLBAR_ICON_HEIGHT-1, 0xCCCccc, 0xF8FCF8);
|
||||||
}
|
}
|
||||||
|
@@ -1 +1 @@
|
|||||||
use32
|
use32
|
Reference in New Issue
Block a user