/data/Tupfile.lua |
---|
15,7 → 15,7 |
{"MACROS.INC", PROGS .. "/macros.inc"}, |
{"CONFIG.INC", PROGS .. "/config.inc"}, |
{"STRUCT.INC", PROGS .. "/struct.inc"}, |
{"TOOLBAR.PNG", PROGS .. "/cmm/textreader/toolbar.png"}, |
{"TOOLBAR.PNG", PROGS .. "/cmm/txtread/toolbar.png"}, |
{"DEVELOP/TE_ICON.PNG", PROGS .. "/other/t_edit/te_icon.png"}, |
{"DEVELOP/TL_NOD_16.PNG", PROGS .. "/other/t_edit/tl_nod_16.png"}, |
{"DEVELOP/TL_SYS_16.PNG", PROGS .. "/media/log_el/trunk/tl_sys_16.png"}, |
547,7 → 547,7 |
{"MOUSECFG", PROGS .. "/cmm/mousecfg/mousecfg.com"}, |
{"NETWORK/WEBVIEW", PROGS .. "/cmm/browser/WebView.com"}, |
{"PANELS_CFG", PROGS .. "/cmm/panels_cfg/panels_cfg.com"}, |
{"TEXTREADER", PROGS .. "/cmm/textreader/textreader.com"}, |
{"txtread", PROGS .. "/cmm/txtread/txtread.com"}, |
{"TMPDISK", PROGS .. "/cmm/tmpdisk/tmpdisk.com"}, |
{"GAME_CENTER", PROGS .. "/cmm/software_widget/software_widget.com"}, |
{"SYSPANEL", PROGS .. "/cmm/software_widget/software_widget.com"}, |
/data/common/icons32.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/data/common/settings/assoc.ini |
---|
14,8 → 14,8 |
next=$Text Reader |
[Text Reader] |
exec=/sys/textreader |
icon=55 |
exec=/sys/txtread |
icon=85 |
next=$HexEditor |
[zSea] |
/programs/cmm/textreader/prepare_page.h |
---|
File deleted |
/programs/cmm/textreader/ini.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/textreader/toolbar.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/textreader/Tupfile.lua |
---|
File deleted |
/programs/cmm/textreader/textreader.c |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/textreader/gui.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/textreader/compile.bat |
---|
File deleted |
/programs/cmm/textreader |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/cmm/diff/diff_gui.h |
---|
28,8 → 28,6 |
OpenDialog_init stdcall (#o_dialog); |
SetEventMask(0x27); |
debugln("GUI"); |
loop() switch(WaitEvent()) |
{ |
case evMouse: |
/programs/cmm/lib/io.h |
---|
229,22 → 229,10 |
dword pos; |
if(!PATH) return self.dir; |
pos = PATH; |
if(DSBYTE[pos]=='/') |
if(DSBYTE[pos]=='/') || (!strncmp(PATH,"./",2)) |
{ |
pos++; |
if(!strncmp(pos,"sys/",4)) return PATH; |
if(!strncmp(pos,"kolibrios/",10)) return PATH; |
if(!strncmp(pos,"rd/",3)) return PATH; |
if(!strncmp(pos,"fd/",3)) return PATH; |
if(!strncmp(pos,"cd",2)) return PATH; |
if(!strncmp(pos,"hd",2)) return PATH; |
if(!strncmp(pos,"bd",2)) return PATH; |
if(!strncmp(pos,"tmp",3)) return PATH; |
if(!strncmp(pos,"usbhd",5)) return PATH; |
sprintf(#__PATH_NEW,"/sys%s",PATH); |
return #__PATH_NEW; |
return PATH; |
} |
if(!strncmp(PATH,"./",2)) return PATH; |
sprintf(#__PATH_NEW,"%s/%s",self.dir,PATH); |
return #__PATH_NEW; |
} |
337,6 → 325,7 |
__file_F70.rezerv = 0; |
__file_F70.param2 = rparam; |
__file_F70.name = path.path(rpath); |
debugln(__file_F70.name); |
$mov eax,70 |
$mov ebx,#__file_F70.func |
$int 0x40 |
/programs/cmm/lib/kolibri.h |
---|
608,6 → 608,8 |
//The initialization of the initial data before running |
void ______INIT______() |
{ |
if (program_path[0]!='/') I_Path++; |
self.dir = #__BUF_DIR__; |
self.file = 0; |
self.path = I_Path; |
622,7 → 624,6 |
mem_init(); |
if (program_path[0]!='/') I_Path++; |
main(); |
ExitProcess(); |
/programs/cmm/txtread/Tupfile.lua |
---|
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("txtread.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "txtread.com") |
/programs/cmm/txtread/ini.h |
---|
0,0 → 1,24 |
char ini_path[4096]; |
char config_section[] = "Config"; |
int encoding; |
void LoadIniSettings() |
{ |
strcpy(#ini_path, "/sys/settings/txtread.ini"); |
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); label.size.pt = EAX; |
ini_get_int stdcall (#ini_path, #config_section, "Encoding", CH_CP866); encoding = EAX; |
ini_get_int stdcall (#ini_path, #config_section, "WinX", 150); Form.left = EAX; |
ini_get_int stdcall (#ini_path, #config_section, "WinY", 50); Form.top = EAX; |
ini_get_int stdcall (#ini_path, #config_section, "WinW", 640); Form.width = EAX; |
ini_get_int stdcall (#ini_path, #config_section, "WinH", 560); Form.height = EAX; |
} |
void SaveIniSettings() |
{ |
ini_set_int stdcall (#ini_path, #config_section, "FontSize", label.size.pt); |
ini_set_int stdcall (#ini_path, #config_section, "Encoding", encoding); |
ini_set_int stdcall (#ini_path, #config_section, "WinX", Form.left); |
ini_set_int stdcall (#ini_path, #config_section, "WinY", Form.top); |
ini_set_int stdcall (#ini_path, #config_section, "WinW", Form.width); |
ini_set_int stdcall (#ini_path, #config_section, "WinH", Form.height); |
} |
/programs/cmm/txtread/txtread.c |
---|
0,0 → 1,296 |
#define MEMSIZE 4096*25 |
#include "../lib/font.h" |
#include "../lib/io.h" |
#include "../lib/gui.h" |
#include "../lib/list_box.h" |
#include "../lib/menu.h" |
#include "../lib/obj/box_lib.h" |
#include "../lib/obj/libini.h" |
#include "../lib/obj/iconv.h" |
#include "../lib/obj/proc_lib.h" |
#include "../lib/patterns/libimg_load_skin.h" |
#include "../lib/patterns/simple_open_dialog.h" |
#define TOOLBAR_H 34 |
#define TOOLBAR_ICON_WIDTH 26 |
#define TOOLBAR_ICON_HEIGHT 24 |
#define DEFAULT_EDITOR "/sys/tinypad" |
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file." |
#define VERSION "Text Reader v1.2" |
#define ABOUT "Idea: Leency, punk_joker |
Code: Leency, Veliant, KolibriOS Team |
Hotkeys: |
Ctrl+O - open file |
Ctrl+Up - bigger font |
Ctrl+Down - smaller font |
Ctrl+Tab - select charset |
Ctrl+E - edit current document |
Press any key..." |
char default_dir[] = "/rd/1"; |
od_filter filter2 = {0,0}; |
scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
llist list; |
proc_info Form; |
char title[4196]; |
byte help_opened = false; |
enum { |
OPEN_FILE, |
MAGNIFY_MINUS, |
MAGNIFY_PLUS, |
CHANGE_ENCODING, |
RUN_EDIT, |
SHOW_INFO, |
}; |
#include "ini.h" |
#include "gui.h" |
#include "prepare_page.h" |
void InitDlls() |
{ |
load_dll(boxlib, #box_lib_init, 0); |
load_dll(libio, #libio_init, 1); |
load_dll(libimg, #libimg_init, 1); |
load_dll(libini, #lib_init, 1); |
load_dll(iconv_lib, #iconv_open, 0); |
load_dll(Proc_lib, #OpenDialog_init,0); |
} |
void main() |
{ |
InitDlls(); |
OpenDialog_init stdcall (#o_dialog); |
label.init(DEFAULT_FONT); |
Libimg_LoadImage(#skin, abspath("toolbar.png")); |
LoadIniSettings(); |
OpenFile(#param); |
list.no_selection = true; |
SetEventMask(10000000000000000000000001100111b); |
loop() |
{ |
switch(WaitEvent()) |
{ |
case evMouse: |
HandleMouseEvent(); |
break; |
case evKey: |
HandleKeyEvent(); |
break; |
case evButton: |
HandleButtonEvent(); |
break; |
case evReDraw: |
if (menu.list.cur_y) { |
encoding = menu.list.cur_y - 10; |
OpenFile(#param); |
PreparePage(); |
menu.list.cur_y = NULL; |
}; |
draw_window(); |
} |
} |
} |
void HandleButtonEvent() |
{ |
byte btn = GetButtonID(); |
if (btn==1) { |
SaveIniSettings(); |
ExitProcess(); |
} |
btn-=10; |
switch(btn) |
{ |
case OPEN_FILE: |
EventOpenFile(); |
break; |
case MAGNIFY_PLUS: |
EventMagnifyPlus(); |
break; |
case MAGNIFY_MINUS: |
EventMagnifyMinus(); |
break; |
case CHANGE_ENCODING: |
EventChangeEncoding(); |
break; |
case RUN_EDIT: |
EventRunEdit(); |
break; |
case SHOW_INFO: |
EventShowInfo(); |
break; |
} |
} |
void HandleKeyEvent() |
{ |
if (help_opened) { |
help_opened = false; |
DrawPage(); |
return; |
} |
GetKeys(); |
if (key_scancode==059) { |
EventShowInfo(); |
return; |
} |
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) { |
switch (key_scancode) |
{ |
case 024: |
EventOpenFile(); |
break; |
case SCAN_CODE_UP: |
EventMagnifyPlus(); |
break; |
case SCAN_CODE_DOWN: |
EventMagnifyMinus(); |
break; |
case 018: |
EventRunEdit(); |
break; |
case SCAN_CODE_TAB: |
EventChangeEncoding(); |
break; |
} |
return; |
} |
if (list.ProcessKey(key_scancode)) |
DrawPage(); |
} |
void HandleMouseEvent() |
{ |
mouse.get(); |
list.wheel_size = 7; |
if (list.MouseScroll(mouse.vert)) { |
DrawPage(); |
return; |
} |
scrollbar_v_mouse (#scroll); |
if (list.first != scroll.position) { |
list.first = scroll.position; |
DrawPage(); |
} |
} |
/* ----------------------------------------------------- */ |
void EventOpenFile() |
{ |
OpenDialog_start stdcall (#o_dialog); |
OpenFile(#openfile_path); |
PreparePage(); |
} |
void EventMagnifyPlus() |
{ |
label.size.pt++; |
if(!label.changeSIZE()) |
label.size.pt--; |
else |
PreparePage(); |
} |
void EventMagnifyMinus() |
{ |
label.size.pt--; |
if(!label.changeSIZE()) |
label.size.pt++; |
else |
PreparePage(); |
} |
void EventRunEdit() |
{ |
io.run(DEFAULT_EDITOR, #param); |
} |
void EventChangeEncoding() |
{ |
menu.selected = encoding + 1; |
menu.show(Form.left+104, Form.top+29+skin_height, 130, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10); |
} |
void EventShowInfo() { |
help_opened = true; |
DrawBar(list.x, list.y, list.w, list.h, 0xFFFfff); |
WriteText(list.x + 10, list.y + 10, 10000001b, 0x555555, VERSION); |
WriteTextLines(list.x + 10, list.y+40, 10110000b, 0, ABOUT, 20); |
} |
/* ------------------------------------------- */ |
void OpenFile(dword f_path) |
{ |
int tmp; |
if (ESBYTE[f_path]) { |
strcpy(#param, f_path); |
io.read(#param); |
strcpy(#title, #param); |
strcat(#title, " - Text Reader"); |
} |
else { |
if (list.count) return; |
io.buffer_data = INTRO_TEXT; |
strcpy(#title, "Text Reader"); |
} |
if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", io.buffer_data); |
list.KeyHome(); |
list.ClearList(); |
} |
void draw_window() |
{ |
DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title,0); |
GetProcessInfo(#Form, SelfInfo); |
if (Form.status_window>2) return; |
if (Form.width < 200) { MoveSize(OLD,OLD,200,OLD); return; } |
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; } |
DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1); |
DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F); |
DrawToolbarButton(OPEN_FILE, 8); |
DrawToolbarButton(MAGNIFY_PLUS, 42); |
DrawToolbarButton(MAGNIFY_MINUS, 67); |
DrawToolbarButton(CHANGE_ENCODING, 101); |
DrawToolbarButton(RUN_EDIT, 135); |
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34); |
if ((Form.cwidth-scroll.size_x-1 == list.w) && |
(Form.cheight-TOOLBAR_H == list.h) && |
(list.count) |
) |
{ |
DrawPage(); |
} else { |
PreparePage(); |
} |
DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col); |
} |
void DrawPage() |
{ |
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + label.raw); |
DrawScroller(); |
} |
/programs/cmm/txtread/gui.h |
---|
0,0 → 1,19 |
void DrawToolbarButton(char image_id, int x) |
{ |
DefineButton(x+1, 7, TOOLBAR_ICON_WIDTH-2, TOOLBAR_ICON_HEIGHT-2, 10+image_id + BT_HIDE, 0); |
img_draw stdcall(skin.image, x, 6, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT); |
} |
void DrawScroller() |
{ |
scroll.max_area = list.count; |
scroll.cur_area = list.visible; |
scroll.position = list.first; |
scroll.all_redraw = 0; |
scroll.start_x = list.x + list.w; |
scroll.start_y = list.y; |
scroll.size_y = list.h; |
scroll.start_x = list.x + list.w; |
scrollbar_v_draw(#scroll); |
} |
/programs/cmm/txtread/prepare_page.h |
---|
0,0 → 1,73 |
char char_width[255]; |
enum { |
COUNT_BUF_HEIGHT, |
DRAW_BUF |
}; |
void Parcer(byte mode) |
{ |
dword bufoff, buflen; |
byte ch; |
char line[4096]=0; |
int srch_pos; |
dword stroka=0; |
dword stroka_y=5; |
dword line_length=30; |
dword line_start=io.buffer_data; |
buflen = strlen(io.buffer_data) + io.buffer_data; |
for (bufoff=io.buffer_data; bufoff<buflen; bufoff++) |
{ |
ch = ESBYTE[bufoff]; |
line_length += char_width[ch]; |
if (line_length>=list.w) || (ch==10) { |
srch_pos = bufoff; |
loop() |
{ |
if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break |
if (srch_pos == line_start) break; //no white space found in whole line |
srch_pos--; |
} |
if (mode==COUNT_BUF_HEIGHT) { |
line_start = bufoff; |
line_length = 30; |
list.count++; |
} |
if (mode==DRAW_BUF) { |
EBX = bufoff-line_start; |
strlcpy(#line, line_start, EBX); |
label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, #line); |
stroka_y += list.item_h; |
line_start = bufoff; |
line_length = 30; |
} |
} |
} |
if (mode==COUNT_BUF_HEIGHT) list.count+=2; |
if (mode==DRAW_BUF) label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, line_start); |
} |
void PreparePage() |
{ |
//get font chars width, need to increase performance |
int i; |
label.changeSIZE(); |
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i); |
//get font buffer height |
list.w = Form.cwidth-scroll.size_x-1; |
list.count=0; |
Parcer(COUNT_BUF_HEIGHT); |
//draw text in buffer |
list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, label.size.pt+3); |
if (list.count < list.visible) list.count = list.visible; |
label.size.height = list.count+1*list.item_h; |
label.raw_size = 0; |
Parcer(DRAW_BUF); |
//draw result |
label.apply_smooth(); |
DrawPage(); |
} |
/programs/cmm/txtread/toolbar.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/cmm/txtread/compile.bat |
---|
0,0 → 1,5 |
@C-- "textreader.c" |
@del "textreader" |
@rename "textreader.com" "textreader" |
@del warning.txt |
@pause |
/programs/cmm/txtread |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/system/RunOD/RunOD.asm |
---|