forked from KolibriOS/kolibrios
CEDIT: minor fixes, refactoring
git-svn-id: svn://kolibrios.org@9210 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
683ccfc78f
commit
5410543f49
Binary file not shown.
@ -28,10 +28,10 @@ IMPORT
|
|||||||
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
header = "CEdit (28-sep-2021)";
|
HEADER = "CEdit (03-oct-2021)";
|
||||||
|
|
||||||
ShellFilter = "";
|
ShellFilter = "";
|
||||||
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||||
|
|
||||||
fontWidth = K.fontWidth;
|
fontWidth = K.fontWidth;
|
||||||
fontHeight = K.fontHeight;
|
fontHeight = K.fontHeight;
|
||||||
@ -51,14 +51,14 @@ CONST
|
|||||||
|
|
||||||
btnYes = 40;
|
btnYes = 40;
|
||||||
btnNo = 41;
|
btnNo = 41;
|
||||||
btnFindNext = 60;
|
btnFindNext = 42;
|
||||||
btnReplace = 61;
|
btnReplace = 43;
|
||||||
btnReplaceAll = 62;
|
btnReplaceAll = 44;
|
||||||
btnGoto = 63;
|
btnGoto = 45;
|
||||||
btnCloseSearch = 64;
|
btnCloseSearch = 46;
|
||||||
btnHideSearch = 65;
|
btnHideSearch = 47;
|
||||||
|
|
||||||
mainMenuBtn = 70;
|
mainMenuBtn = 60;
|
||||||
|
|
||||||
btnHeight = 25;
|
btnHeight = 25;
|
||||||
btnWidth = 75;
|
btnWidth = 75;
|
||||||
@ -184,10 +184,10 @@ VAR
|
|||||||
|
|
||||||
switch, closing: BOOLEAN;
|
switch, closing: BOOLEAN;
|
||||||
leftButton: BOOLEAN;
|
leftButton: BOOLEAN;
|
||||||
hScroll, vScroll: Scroll.tScroll;
|
|
||||||
LEFT: INTEGER;
|
LEFT: INTEGER;
|
||||||
|
|
||||||
FindEdit, ReplaceEdit, GotoEdit: EB.tEditBox;
|
FindEdit, ReplaceEdit, GotoEdit: EB.tEditBox;
|
||||||
|
hScroll, vScroll: Scroll.tScroll;
|
||||||
CS, WH, BKW: CheckBox.tCheckBox;
|
CS, WH, BKW: CheckBox.tCheckBox;
|
||||||
|
|
||||||
new_searchText, searchText, replaceText, gotoText: T.tString;
|
new_searchText, searchText, replaceText, gotoText: T.tString;
|
||||||
@ -226,14 +226,7 @@ END WritePos;
|
|||||||
|
|
||||||
|
|
||||||
PROCEDURE EditBox_Focus (edit: EB.tEditBox): BOOLEAN;
|
PROCEDURE EditBox_Focus (edit: EB.tEditBox): BOOLEAN;
|
||||||
VAR
|
RETURN 1 IN edit.flags
|
||||||
res: BOOLEAN;
|
|
||||||
BEGIN
|
|
||||||
res := FALSE;
|
|
||||||
IF edit # NIL THEN
|
|
||||||
res := 1 IN edit.flags
|
|
||||||
END
|
|
||||||
RETURN res
|
|
||||||
END EditBox_Focus;
|
END EditBox_Focus;
|
||||||
|
|
||||||
|
|
||||||
@ -249,7 +242,7 @@ BEGIN
|
|||||||
END resetTimer;
|
END resetTimer;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE EditBox_SetFocus (edit: EB.tEditBox; value: BOOLEAN);
|
PROCEDURE EditBox_SetFocus (VAR edit: EB.tEditBox; value: BOOLEAN);
|
||||||
BEGIN
|
BEGIN
|
||||||
IF value THEN
|
IF value THEN
|
||||||
INCL(edit.flags, 1)
|
INCL(edit.flags, 1)
|
||||||
@ -262,7 +255,7 @@ BEGIN
|
|||||||
END EditBox_SetFocus;
|
END EditBox_SetFocus;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE SetFocus (edit: EB.tEditBox; value: BOOLEAN);
|
PROCEDURE SetFocus (VAR edit: EB.tEditBox; value: BOOLEAN);
|
||||||
BEGIN
|
BEGIN
|
||||||
EditBox_SetFocus(FindEdit, FALSE);
|
EditBox_SetFocus(FindEdit, FALSE);
|
||||||
EditBox_SetFocus(ReplaceEdit, FALSE);
|
EditBox_SetFocus(ReplaceEdit, FALSE);
|
||||||
@ -413,17 +406,21 @@ PROCEDURE DrawState (text: T.tText; width, height: INTEGER);
|
|||||||
VAR
|
VAR
|
||||||
y: INTEGER;
|
y: INTEGER;
|
||||||
s: ARRAY 24 OF WCHAR;
|
s: ARRAY 24 OF WCHAR;
|
||||||
|
header: RW.tFileName;
|
||||||
BEGIN
|
BEGIN
|
||||||
y := (btnHeight - fontHeight) DIV 2 + btnTop;
|
|
||||||
s := "";
|
s := "";
|
||||||
U.append(s, RW.eolNames[text.eol]);
|
U.append(s, RW.eolNames[text.eol]);
|
||||||
U.append(s, 20X);
|
U.append(s, 20X + 20X);
|
||||||
U.append(s, E.names[text.enc]);
|
U.append(s, E.names[text.enc]);
|
||||||
K.DrawRect(width - LEN(s)*fontWidth, y, LEN(s)*fontWidth, fontHeight, K.winColor);
|
header := HEADER;
|
||||||
K.DrawText(width - LENGTH(s)*fontWidth, y, K.textColor, s);
|
IF text.fileName # "" THEN
|
||||||
|
U.append8(header, " - ");
|
||||||
|
U.append8(header, text.fileName)
|
||||||
|
END;
|
||||||
|
K.SetCaption(header);
|
||||||
|
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - (LEFT + 16*fontWidth), BOTTOM - scrollWidth + 1, K.winColor);
|
||||||
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
|
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
|
||||||
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
|
K.DrawText(width - (LENGTH(s) + 10)*fontWidth, y, K.textColor, s);
|
||||||
K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
|
|
||||||
WriteModified(width - 8*fontWidth, y)
|
WriteModified(width - 8*fontWidth, y)
|
||||||
END DrawState;
|
END DrawState;
|
||||||
|
|
||||||
@ -576,7 +573,7 @@ VAR
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
K.BeginDraw;
|
K.BeginDraw;
|
||||||
K.CreateWindow(30 + K.GetTickCount() MOD 128, 30 + K.GetTickCount() MOD 128, winWidth, winHeight, K.winColor, 73H, 0, 0, header);
|
K.CreateWindow(30 + K.GetTickCount() MOD 128, 30 + K.GetTickCount() MOD 128, winWidth, winHeight, K.winColor, 73H, 0, 0, "");
|
||||||
IF (text # NIL) & ~K.RolledUp() THEN
|
IF (text # NIL) & ~K.RolledUp() THEN
|
||||||
IF confirm THEN
|
IF confirm THEN
|
||||||
resetTimer
|
resetTimer
|
||||||
@ -698,16 +695,7 @@ BEGIN
|
|||||||
U.getFileName(text.fileName, OD.FileName, U.SLASH);
|
U.getFileName(text.fileName, OD.FileName, U.SLASH);
|
||||||
IF OD.FileName = "" THEN
|
IF OD.FileName = "" THEN
|
||||||
OD.FileName := "NewFile.";
|
OD.FileName := "NewFile.";
|
||||||
CASE text.lang OF
|
Languages.getExt(text.lang, ext);
|
||||||
|Languages.langText: ext := "txt"
|
|
||||||
|Languages.langC: ext := "c"
|
|
||||||
|Languages.langFasm: ext := "asm"
|
|
||||||
|Languages.langIni: ext := "ini"
|
|
||||||
|Languages.langJSON: ext := "json"
|
|
||||||
|Languages.langLua: ext := "lua"
|
|
||||||
|Languages.langOberon: ext := "ob07"
|
|
||||||
|Languages.langPascal: ext := "pas"
|
|
||||||
END;
|
|
||||||
U.append8(OD.FileName, ext)
|
U.append8(OD.FileName, ext)
|
||||||
END;
|
END;
|
||||||
OpenFile(fileName, EditFilter);
|
OpenFile(fileName, EditFilter);
|
||||||
@ -923,26 +911,11 @@ BEGIN
|
|||||||
END open;
|
END open;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE createEdit (left, top: INTEGER): EB.tEditBox;
|
|
||||||
VAR
|
|
||||||
edit, EditBox0: EB.tEditBox;
|
|
||||||
BEGIN
|
|
||||||
NEW(EditBox0);
|
|
||||||
EditBox0.text := K.malloc(EDITBOX_MAXCHARS + 2);
|
|
||||||
ASSERT(EditBox0.text # 0);
|
|
||||||
edit := EB.create(left, top, EditBox_Width, EDITBOX_MAXCHARS, EditBox0);
|
|
||||||
edit.flags := {1, 14};
|
|
||||||
edit.text_color := 30000000H;
|
|
||||||
EditBox_SetFocus(edit, FALSE)
|
|
||||||
RETURN edit
|
|
||||||
END createEdit;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE createSearchForm;
|
PROCEDURE createSearchForm;
|
||||||
BEGIN
|
BEGIN
|
||||||
FindEdit := createEdit(searchLeft, TOP + 20);
|
EB.create(searchLeft, TOP + 20, EditBox_Width, EDITBOX_MAXCHARS, FindEdit);
|
||||||
ReplaceEdit := createEdit(searchLeft, TOP + 20 + 55);
|
EB.create(searchLeft, TOP + 20 + 55, EditBox_Width, EDITBOX_MAXCHARS, ReplaceEdit);
|
||||||
GotoEdit := createEdit(searchLeft, TOP + 20 + 330);
|
EB.create(searchLeft, TOP + 20 + 330, EditBox_Width, EDITBOX_MAXCHARS, GotoEdit);
|
||||||
INCL(GotoEdit.flags, 15);
|
INCL(GotoEdit.flags, 15);
|
||||||
CheckBox.create("backward", BKW);
|
CheckBox.create("backward", BKW);
|
||||||
CheckBox.create("match case", CS);
|
CheckBox.create("match case", CS);
|
||||||
@ -1041,8 +1014,12 @@ END CloseMenu;
|
|||||||
|
|
||||||
|
|
||||||
PROCEDURE MenuItemClick (menu: Menu.tMenu; id: INTEGER);
|
PROCEDURE MenuItemClick (menu: Menu.tMenu; id: INTEGER);
|
||||||
|
VAR
|
||||||
|
msg: ARRAY 2 OF INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
K.SendIPC(mainTID, id)
|
msg[0] := id;
|
||||||
|
msg[1] := 8;
|
||||||
|
K.SendIPC(mainTID, msg)
|
||||||
END MenuItemClick;
|
END MenuItemClick;
|
||||||
|
|
||||||
|
|
||||||
@ -1940,9 +1917,10 @@ CONST
|
|||||||
VAR
|
VAR
|
||||||
msState: SET;
|
msState: SET;
|
||||||
scroll, x, y, scrollX, scrollY: INTEGER;
|
scroll, x, y, scrollX, scrollY: INTEGER;
|
||||||
|
pos1, pos2: T.tPoint;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE EditBox (eb: EB.tEditBox);
|
PROCEDURE EditBox (VAR eb: EB.tEditBox);
|
||||||
VAR
|
VAR
|
||||||
focus: BOOLEAN;
|
focus: BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -1969,10 +1947,14 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
IF leftButton THEN
|
IF leftButton THEN
|
||||||
IF K.GetTickCount() - time >= DELAY THEN
|
IF K.GetTickCount() - time >= DELAY THEN
|
||||||
|
T.getPos(text, pos1.Y, pos1.X);
|
||||||
mouse(x, y);
|
mouse(x, y);
|
||||||
T.mouse(text, x, y);
|
T.mouse(text, x, y);
|
||||||
|
T.getPos(text, pos2.Y, pos2.X);
|
||||||
|
IF (pos1.X # pos2.X) OR (pos1.Y # pos2.Y) THEN
|
||||||
repaint
|
repaint
|
||||||
END
|
END
|
||||||
|
END
|
||||||
END;
|
END;
|
||||||
|
|
||||||
Scroll.mouse(hScroll);
|
Scroll.mouse(hScroll);
|
||||||
|
@ -28,7 +28,7 @@ CONST
|
|||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
|
|
||||||
tEditBox* = POINTER TO RECORD
|
tEditBox* = RECORD
|
||||||
width*,
|
width*,
|
||||||
left*,
|
left*,
|
||||||
top*,
|
top*,
|
||||||
@ -39,7 +39,7 @@ TYPE
|
|||||||
text_color*,
|
text_color*,
|
||||||
max: INTEGER;
|
max: INTEGER;
|
||||||
text*: INTEGER;
|
text*: INTEGER;
|
||||||
mouse_variable: tEditBox;
|
mouse_variable: INTEGER;
|
||||||
flags*: SET;
|
flags*: SET;
|
||||||
|
|
||||||
size,
|
size,
|
||||||
@ -110,28 +110,21 @@ BEGIN
|
|||||||
END setValue;
|
END setValue;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE create* (tlx, tly, width, max_chars: INTEGER; editbox_interlock: tEditBox): tEditBox;
|
PROCEDURE create* (tlx, tly, width, max_chars: INTEGER; VAR editbox: tEditBox);
|
||||||
VAR
|
|
||||||
new_textbox: tEditBox;
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
NEW(new_textbox);
|
editbox.width := width;
|
||||||
|
editbox.left := tlx;
|
||||||
new_textbox.width := width;
|
editbox.top := tly;
|
||||||
new_textbox.left := tlx;
|
editbox.color := 0FFFFFFH;
|
||||||
new_textbox.top := tly;
|
editbox.shift_color := 06A9480H;
|
||||||
new_textbox.color := 0FFFFFFH;
|
editbox.focus_border_color := 0;
|
||||||
new_textbox.shift_color := 06A9480H;
|
editbox.blur_border_color := 06A9480H;
|
||||||
new_textbox.focus_border_color := 0;
|
editbox.text_color := 30000000H;
|
||||||
new_textbox.blur_border_color := 06A9480H;
|
editbox.max := max_chars;
|
||||||
new_textbox.text_color := 0;
|
editbox.text := KOSAPI.malloc(max_chars + 2);
|
||||||
new_textbox.max := max_chars;
|
ASSERT(editbox.text # 0);
|
||||||
new_textbox.text := KOSAPI.malloc(max_chars + 2);
|
editbox.mouse_variable := 0;
|
||||||
ASSERT(new_textbox.text # 0);
|
editbox.flags := {14}
|
||||||
new_textbox.mouse_variable := editbox_interlock;
|
|
||||||
new_textbox.flags := {}
|
|
||||||
|
|
||||||
RETURN new_textbox
|
|
||||||
END create;
|
END create;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ END GetName;
|
|||||||
|
|
||||||
PROCEDURE CreateWindow* (x, y, w, h, color, style, hcolor, hstyle: INTEGER; htext: ARRAY OF CHAR);
|
PROCEDURE CreateWindow* (x, y, w, h, color, style, hcolor, hstyle: INTEGER; htext: ARRAY OF CHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc6(0, x * 65536 + w, y * 65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(htext[0]))
|
KOSAPI.sysfunc6(0, x*65536 + w, y*65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(htext[0]))
|
||||||
END CreateWindow;
|
END CreateWindow;
|
||||||
|
|
||||||
|
|
||||||
@ -142,25 +142,25 @@ END SetWinSize;
|
|||||||
|
|
||||||
PROCEDURE DrawText* (x, y, color: INTEGER; text: ARRAY OF WCHAR);
|
PROCEDURE DrawText* (x, y, color: INTEGER; text: ARRAY OF WCHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(0A0H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0A0H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||||
END DrawText;
|
END DrawText;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE DrawText69* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
PROCEDURE DrawText69* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(080H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(080H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||||
END DrawText69;
|
END DrawText69;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE DrawText866* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
PROCEDURE DrawText866* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, winColor)
|
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, winColor)
|
||||||
END DrawText866;
|
END DrawText866;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE DrawText866bk* (x, y, color, bkColor: INTEGER; text: ARRAY OF CHAR);
|
PROCEDURE DrawText866bk* (x, y, color, bkColor: INTEGER; text: ARRAY OF CHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, bkColor)
|
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, bkColor)
|
||||||
END DrawText866bk;
|
END DrawText866bk;
|
||||||
|
|
||||||
|
|
||||||
@ -233,7 +233,14 @@ END ExitID;
|
|||||||
|
|
||||||
|
|
||||||
PROCEDURE CreateThread* (proc: INTEGER; stack: ARRAY OF INTEGER): INTEGER;
|
PROCEDURE CreateThread* (proc: INTEGER; stack: ARRAY OF INTEGER): INTEGER;
|
||||||
RETURN KOSAPI.sysfunc4(51, 1, proc, SYSTEM.ADR(stack[LEN(stack) - 2]))
|
VAR
|
||||||
|
tid: INTEGER;
|
||||||
|
BEGIN
|
||||||
|
tid := KOSAPI.sysfunc4(51, 1, proc, SYSTEM.ADR(stack[LEN(stack) - 2]));
|
||||||
|
IF tid = -1 THEN
|
||||||
|
tid := 0
|
||||||
|
END
|
||||||
|
RETURN tid
|
||||||
END CreateThread;
|
END CreateThread;
|
||||||
|
|
||||||
|
|
||||||
@ -323,18 +330,12 @@ BEGIN
|
|||||||
END SetIPC;
|
END SetIPC;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE SendIPC* (tid, msg: INTEGER);
|
PROCEDURE SendIPC* (tid: INTEGER; msg: ARRAY OF INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
KOSAPI.sysfunc5(60, 2, tid, SYSTEM.ADR(msg), SYSTEM.SIZE(INTEGER))
|
KOSAPI.sysfunc5(60, 2, tid, SYSTEM.ADR(msg[0]), SYSTEM.SIZE(INTEGER)*LEN(msg))
|
||||||
END SendIPC;
|
END SendIPC;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE PutPixel* (x, y, color: INTEGER);
|
|
||||||
BEGIN
|
|
||||||
KOSAPI.sysfunc4(1, x, y, color)
|
|
||||||
END PutPixel;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE GetSystemColors*;
|
PROCEDURE GetSystemColors*;
|
||||||
VAR
|
VAR
|
||||||
buf: ARRAY 10 OF INTEGER;
|
buf: ARRAY 10 OF INTEGER;
|
||||||
@ -384,4 +385,10 @@ BEGIN
|
|||||||
END mouse;
|
END mouse;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE SetCaption* (text: ARRAY OF CHAR);
|
||||||
|
BEGIN
|
||||||
|
KOSAPI.sysfunc4(71, 2, SYSTEM.ADR(text[0]), 0)
|
||||||
|
END SetCaption;
|
||||||
|
|
||||||
|
|
||||||
END KolibriOS.
|
END KolibriOS.
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
MODULE Languages;
|
MODULE Languages;
|
||||||
|
|
||||||
IMPORT Lines;
|
IMPORT Lines, Utils;
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
@ -49,6 +49,8 @@ VAR
|
|||||||
|
|
||||||
currentLang: INTEGER;
|
currentLang: INTEGER;
|
||||||
|
|
||||||
|
fileExt: ARRAY 11 OF RECORD ext: ARRAY 8 OF CHAR; lang: INTEGER END;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE isCS* (lang: INTEGER): BOOLEAN;
|
PROCEDURE isCS* (lang: INTEGER): BOOLEAN;
|
||||||
RETURN lang IN csLang
|
RETURN lang IN csLang
|
||||||
@ -395,6 +397,36 @@ BEGIN
|
|||||||
END setCurLang;
|
END setCurLang;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE getLang* (ext: ARRAY OF CHAR): INTEGER;
|
||||||
|
VAR
|
||||||
|
i: INTEGER;
|
||||||
|
BEGIN
|
||||||
|
i := 0;
|
||||||
|
WHILE (i < LEN(fileExt)) & (fileExt[i].ext # ext) DO
|
||||||
|
INC(i)
|
||||||
|
END;
|
||||||
|
IF i < LEN(fileExt) THEN
|
||||||
|
i := fileExt[i].lang
|
||||||
|
ELSE
|
||||||
|
i := langText
|
||||||
|
END
|
||||||
|
RETURN i
|
||||||
|
END getLang;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE getExt* (lang: INTEGER; VAR ext: ARRAY OF CHAR);
|
||||||
|
VAR
|
||||||
|
i: INTEGER;
|
||||||
|
BEGIN
|
||||||
|
i := 0;
|
||||||
|
WHILE fileExt[i].lang # lang DO
|
||||||
|
INC(i)
|
||||||
|
END;
|
||||||
|
COPY(fileExt[i].ext, ext);
|
||||||
|
Utils.lowcase(ext)
|
||||||
|
END getExt;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE init* (getStr: procGetStr);
|
PROCEDURE init* (getStr: procGetStr);
|
||||||
BEGIN
|
BEGIN
|
||||||
currentLang := langText;
|
currentLang := langText;
|
||||||
@ -406,6 +438,18 @@ BEGIN
|
|||||||
loadKW(KW[langIni], Delim[langIni], getStr, "lang_Ini");
|
loadKW(KW[langIni], Delim[langIni], getStr, "lang_Ini");
|
||||||
loadKW(KW[langFasm], Delim[langFasm], getStr, "lang_Fasm");
|
loadKW(KW[langFasm], Delim[langFasm], getStr, "lang_Fasm");
|
||||||
loadKW(KW[langJSON], Delim[langJSON], getStr, "lang_JSON");
|
loadKW(KW[langJSON], Delim[langJSON], getStr, "lang_JSON");
|
||||||
|
|
||||||
|
fileExt[ 0].ext := "OB07"; fileExt[ 0].lang := langOberon;
|
||||||
|
fileExt[ 1].ext := "C"; fileExt[ 1].lang := langC;
|
||||||
|
fileExt[ 2].ext := "H"; fileExt[ 2].lang := langC;
|
||||||
|
fileExt[ 3].ext := "CPP"; fileExt[ 3].lang := langC;
|
||||||
|
fileExt[ 4].ext := "PAS"; fileExt[ 4].lang := langPascal;
|
||||||
|
fileExt[ 5].ext := "PP"; fileExt[ 5].lang := langPascal;
|
||||||
|
fileExt[ 6].ext := "ASM"; fileExt[ 6].lang := langFasm;
|
||||||
|
fileExt[ 7].ext := "LUA"; fileExt[ 7].lang := langLua;
|
||||||
|
fileExt[ 8].ext := "INI"; fileExt[ 8].lang := langIni;
|
||||||
|
fileExt[ 9].ext := "JSON"; fileExt[ 9].lang := langJSON;
|
||||||
|
fileExt[10].ext := "TXT"; fileExt[10].lang := langText;
|
||||||
END init;
|
END init;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ CONST
|
|||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
|
|
||||||
tPoint = RECORD
|
tPoint* = RECORD
|
||||||
X, Y: INTEGER
|
X*, Y*: INTEGER
|
||||||
END;
|
END;
|
||||||
|
|
||||||
pPoint = POINTER TO tPoint;
|
pPoint = POINTER TO tPoint;
|
||||||
@ -67,22 +67,20 @@ TYPE
|
|||||||
scroll: tPoint;
|
scroll: tPoint;
|
||||||
CurX: INTEGER;
|
CurX: INTEGER;
|
||||||
modified*: BOOLEAN;
|
modified*: BOOLEAN;
|
||||||
|
|
||||||
edition*: tGuard;
|
edition*: tGuard;
|
||||||
comments, numbers*, guard,
|
comments, numbers*, guard,
|
||||||
search, cs, whole: BOOLEAN;
|
search, cs, whole: BOOLEAN;
|
||||||
curLine: tLine;
|
curLine: tLine;
|
||||||
fileName*: RW.tFileName;
|
|
||||||
lang*: INTEGER;
|
lang*: INTEGER;
|
||||||
enc*: INTEGER;
|
enc*, eol*: INTEGER;
|
||||||
eol*: INTEGER;
|
|
||||||
table: Search.IdxTable;
|
table: Search.IdxTable;
|
||||||
foundList: List.tList;
|
foundList: List.tList;
|
||||||
idxData: Search.tBuffer;
|
idxData: Search.tBuffer;
|
||||||
foundSel: INTEGER;
|
foundSel: INTEGER;
|
||||||
searchText: tString;
|
searchText: tString;
|
||||||
chLog*: ChangeLog.tLog;
|
chLog*: ChangeLog.tLog;
|
||||||
maxLength*: INTEGER
|
maxLength*: INTEGER;
|
||||||
|
fileName*: RW.tFileName
|
||||||
END;
|
END;
|
||||||
|
|
||||||
tProcedure = PROCEDURE;
|
tProcedure = PROCEDURE;
|
||||||
@ -104,34 +102,6 @@ VAR
|
|||||||
charWidth, charHeight: INTEGER;
|
charWidth, charHeight: INTEGER;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE setName* (text: tText; name: RW.tFileName);
|
|
||||||
VAR
|
|
||||||
ext: RW.tFileName;
|
|
||||||
BEGIN
|
|
||||||
text.fileName := name;
|
|
||||||
U.getFileName(text.fileName, ext, ".");
|
|
||||||
U.upcase(ext);
|
|
||||||
IF ext = "OB07" THEN
|
|
||||||
text.lang := Lang.langOberon
|
|
||||||
ELSIF (ext = "C") OR (ext = "H") OR (ext = "CPP") THEN
|
|
||||||
text.lang := Lang.langC
|
|
||||||
ELSIF (ext = "PAS") OR (ext = "PP") THEN
|
|
||||||
text.lang := Lang.langPascal
|
|
||||||
ELSIF ext = "ASM" THEN
|
|
||||||
text.lang := Lang.langFasm
|
|
||||||
ELSIF ext = "LUA" THEN
|
|
||||||
text.lang := Lang.langLua
|
|
||||||
ELSIF ext = "INI" THEN
|
|
||||||
text.lang := Lang.langIni
|
|
||||||
ELSIF ext = "JSON" THEN
|
|
||||||
text.lang := Lang.langJSON
|
|
||||||
ELSE
|
|
||||||
text.lang := Lang.langText
|
|
||||||
END;
|
|
||||||
Lang.setCurLang(text.lang)
|
|
||||||
END setName;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE setLang* (text: tText; lang: INTEGER);
|
PROCEDURE setLang* (text: tText; lang: INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
text.lang := lang;
|
text.lang := lang;
|
||||||
@ -140,6 +110,17 @@ BEGIN
|
|||||||
END setLang;
|
END setLang;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE setName* (text: tText; name: RW.tFileName);
|
||||||
|
VAR
|
||||||
|
ext: RW.tFileName;
|
||||||
|
BEGIN
|
||||||
|
text.fileName := name;
|
||||||
|
U.getFileName(name, ext, ".");
|
||||||
|
U.upcase(ext);
|
||||||
|
setLang(text, Lang.getLang(ext))
|
||||||
|
END setName;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE getPos* (text: tText; VAR x, y: INTEGER);
|
PROCEDURE getPos* (text: tText; VAR x, y: INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
x := text.cursor.X + 1;
|
x := text.cursor.X + 1;
|
||||||
@ -518,7 +499,7 @@ BEGIN
|
|||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
END;
|
END
|
||||||
|
|
||||||
ELSIF lang = Lang.langOberon THEN
|
ELSIF lang = Lang.langOberon THEN
|
||||||
|
|
||||||
@ -2089,7 +2070,7 @@ BEGIN
|
|||||||
line := getLine(text, n);
|
line := getLine(text, n);
|
||||||
firstLine := line;
|
firstLine := line;
|
||||||
cnt := 0;
|
cnt := 0;
|
||||||
WHILE (line # NIL) & (cnt <= textsize.Y) DO
|
WHILE (line # NIL) & (cnt < textsize.Y) DO
|
||||||
backColor := colors.back;
|
backColor := colors.back;
|
||||||
IF (line = text.curLine) & ~selected(text) THEN
|
IF (line = text.curLine) & ~selected(text) THEN
|
||||||
G.SetColor(canvas, colors.curline);
|
G.SetColor(canvas, colors.curline);
|
||||||
@ -2122,7 +2103,7 @@ BEGIN
|
|||||||
line := firstLine;
|
line := firstLine;
|
||||||
SetColor(colors.numtext, colors.numback);
|
SetColor(colors.numtext, colors.numback);
|
||||||
y := padding.top + inter DIV 2;
|
y := padding.top + inter DIV 2;
|
||||||
n := MIN(text.scroll.Y + textsize.Y + 1, text.count);
|
n := MIN(text.scroll.Y + textsize.Y, text.count);
|
||||||
FOR i := text.scroll.Y + 1 TO n DO
|
FOR i := text.scroll.Y + 1 TO n DO
|
||||||
IF text.numbers THEN
|
IF text.numbers THEN
|
||||||
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
||||||
@ -2147,7 +2128,7 @@ BEGIN
|
|||||||
cnt := 0;
|
cnt := 0;
|
||||||
line := firstLine;
|
line := firstLine;
|
||||||
lastLine := line;
|
lastLine := line;
|
||||||
WHILE (line # NIL) & (cnt <= textsize.Y) DO
|
WHILE (line # NIL) & (cnt < textsize.Y) DO
|
||||||
lastLine := line;
|
lastLine := line;
|
||||||
NextLine(line);
|
NextLine(line);
|
||||||
INC(cnt)
|
INC(cnt)
|
||||||
|
@ -50,7 +50,7 @@ BEGIN
|
|||||||
IF enabled THEN
|
IF enabled THEN
|
||||||
DEC(cnt, step);
|
DEC(cnt, step);
|
||||||
IF cnt <= 0 THEN
|
IF cnt <= 0 THEN
|
||||||
KOSAPI.sysfunc5(60, 2, mainTID, SYSTEM.ADR(msg[0]), msg[1]);
|
K.SendIPC(mainTID, msg);
|
||||||
cnt := time
|
cnt := time
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -200,7 +200,7 @@ BEGIN
|
|||||||
IF cap8(s[i]) THEN
|
IF cap8(s[i]) THEN
|
||||||
END;
|
END;
|
||||||
DEC(i)
|
DEC(i)
|
||||||
END;
|
END
|
||||||
END upcase;
|
END upcase;
|
||||||
|
|
||||||
|
|
||||||
@ -240,6 +240,20 @@ BEGIN
|
|||||||
END low;
|
END low;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE lowcase* (VAR s: ARRAY OF CHAR);
|
||||||
|
VAR
|
||||||
|
i: INTEGER;
|
||||||
|
BEGIN
|
||||||
|
i := LENGTH(s) - 1;
|
||||||
|
WHILE i >= 0 DO
|
||||||
|
IF ("A" <= s[i]) & (s[i] <= "Z") THEN
|
||||||
|
s[i] := CHR(ORD(s[i]) + 32)
|
||||||
|
END;
|
||||||
|
DEC(i)
|
||||||
|
END
|
||||||
|
END lowcase;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE str2int* (s: ARRAY OF WCHAR; VAR val: INTEGER): BOOLEAN;
|
PROCEDURE str2int* (s: ARRAY OF WCHAR; VAR val: INTEGER): BOOLEAN;
|
||||||
VAR
|
VAR
|
||||||
i, temp: INTEGER;
|
i, temp: INTEGER;
|
||||||
@ -262,8 +276,7 @@ BEGIN
|
|||||||
|
|
||||||
IF isDigit(s[i]) THEN
|
IF isDigit(s[i]) THEN
|
||||||
REPEAT
|
REPEAT
|
||||||
temp := temp * 10;
|
temp := temp*10 + ORD(s[i]) - ORD("0");
|
||||||
temp := temp + (ORD(s[i]) - ORD("0"));
|
|
||||||
INC(i)
|
INC(i)
|
||||||
UNTIL ~isDigit(s[i]);
|
UNTIL ~isDigit(s[i]);
|
||||||
IF neg THEN
|
IF neg THEN
|
||||||
|
@ -296,7 +296,6 @@ PROCEDURE MouseMove (VAR scroll: tScroll; x, y: INTEGER);
|
|||||||
VAR
|
VAR
|
||||||
c: INTEGER;
|
c: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF scroll.Slider # -1 THEN
|
|
||||||
IF scroll.vertical THEN
|
IF scroll.vertical THEN
|
||||||
c := y - scroll.top
|
c := y - scroll.top
|
||||||
ELSE
|
ELSE
|
||||||
@ -304,13 +303,16 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
setPos(scroll, scroll.pos0 + c - scroll.Slider);
|
setPos(scroll, scroll.pos0 + c - scroll.Slider);
|
||||||
paint(scroll)
|
paint(scroll)
|
||||||
END
|
|
||||||
END MouseMove;
|
END MouseMove;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE SendIPC;
|
PROCEDURE SendIPC;
|
||||||
|
VAR
|
||||||
|
msg: ARRAY 2 OF INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
K.SendIPC(K.ThreadID(), ScrollIPC)
|
msg[0] := ScrollIPC;
|
||||||
|
msg[1] := 8;
|
||||||
|
K.SendIPC(K.ThreadID(), msg)
|
||||||
END SendIPC;
|
END SendIPC;
|
||||||
|
|
||||||
|
|
||||||
@ -342,7 +344,6 @@ PROCEDURE MouseDown (VAR scroll: tScroll; x, y: INTEGER);
|
|||||||
VAR
|
VAR
|
||||||
c, size: INTEGER;
|
c, size: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF ~scroll.mouse THEN
|
|
||||||
DEC(x, scroll.left);
|
DEC(x, scroll.left);
|
||||||
DEC(y, scroll.top);
|
DEC(y, scroll.top);
|
||||||
scroll.mouse := TRUE;
|
scroll.mouse := TRUE;
|
||||||
@ -370,7 +371,6 @@ BEGIN
|
|||||||
paint(scroll)
|
paint(scroll)
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
END
|
|
||||||
END MouseDown;
|
END MouseDown;
|
||||||
|
|
||||||
|
|
||||||
@ -381,8 +381,11 @@ VAR
|
|||||||
BEGIN
|
BEGIN
|
||||||
K.mouse(msState, x, y);
|
K.mouse(msState, x, y);
|
||||||
IF 0 IN msState THEN
|
IF 0 IN msState THEN
|
||||||
MouseDown(scroll, x, y);
|
IF ~scroll.mouse THEN
|
||||||
|
MouseDown(scroll, x, y)
|
||||||
|
ELSIF scroll.Slider # -1 THEN
|
||||||
MouseMove(scroll, x, y)
|
MouseMove(scroll, x, y)
|
||||||
|
END
|
||||||
ELSIF scroll.mouse THEN
|
ELSIF scroll.mouse THEN
|
||||||
MouseUp(scroll);
|
MouseUp(scroll);
|
||||||
paint(scroll)
|
paint(scroll)
|
||||||
|
Loading…
Reference in New Issue
Block a user