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;
|
||||||
|
|
||||||
|
|
||||||
@ -1565,7 +1542,7 @@ VAR
|
|||||||
idx: INTEGER;
|
idx: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
menu := List.create(NIL);
|
menu := List.create(NIL);
|
||||||
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
|
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
|
||||||
Menu.AddMenuItem(menu, menuFontSize, "x2");
|
Menu.AddMenuItem(menu, menuFontSize, "x2");
|
||||||
Menu.delimiter(menu);
|
Menu.delimiter(menu);
|
||||||
|
|
||||||
@ -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,9 +1947,13 @@ 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);
|
||||||
repaint
|
T.getPos(text, pos2.Y, pos2.X);
|
||||||
|
IF (pos1.X # pos2.X) OR (pos1.Y # pos2.Y) THEN
|
||||||
|
repaint
|
||||||
|
END
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
@ -422,387 +403,387 @@ BEGIN
|
|||||||
|
|
||||||
ELSIF (lang = Lang.langC) OR (lang = Lang.langJSON) THEN
|
ELSIF (lang = Lang.langC) OR (lang = Lang.langJSON) THEN
|
||||||
|
|
||||||
IF depth = 0 THEN
|
IF depth = 0 THEN
|
||||||
IF c = "/" THEN
|
IF c = "/" THEN
|
||||||
IF cond = 0 THEN
|
IF cond = 0 THEN
|
||||||
cond := 1
|
cond := 1
|
||||||
ELSE
|
ELSE
|
||||||
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
||||||
cond := 0;
|
cond := 0;
|
||||||
i := n
|
i := n
|
||||||
END
|
|
||||||
ELSIF (c = "*") & (cond = 1) THEN
|
|
||||||
depth := 1;
|
|
||||||
INC(i);
|
|
||||||
PrintComment(text, line, depth, i, 2, y, backColor);
|
|
||||||
cond := 0
|
|
||||||
ELSIF U.isLetter(c) OR (c = "_") OR (c = "'") OR (c = '"') THEN
|
|
||||||
k := i;
|
|
||||||
IF (c = "'") OR (c = '"') THEN
|
|
||||||
String(text, line, i, y, backColor);
|
|
||||||
ELSE
|
|
||||||
ident(text, i, i - ORD((lang = Lang.langC) & (i > 0) & (getChar(line, i - 1) = "#")), y, line, backColor, Lang.isCS(lang))
|
|
||||||
END;
|
|
||||||
IF lang = Lang.langJSON THEN
|
|
||||||
WHILE Lines.isSpace(getChar(line, i + 1)) DO
|
|
||||||
INC(i)
|
|
||||||
END;
|
|
||||||
IF getChar(line, i + 1) = ":" THEN
|
|
||||||
PrintLex(text, line, k, i, y, colors.key1, backColor)
|
|
||||||
END
|
END
|
||||||
END;
|
ELSIF (c = "*") & (cond = 1) THEN
|
||||||
cond := 0
|
depth := 1;
|
||||||
ELSIF U.isDigit(c) THEN
|
INC(i);
|
||||||
k := i;
|
PrintComment(text, line, depth, i, 2, y, backColor);
|
||||||
INC(i);
|
cond := 0
|
||||||
c := getChar(line, i);
|
ELSIF U.isLetter(c) OR (c = "_") OR (c = "'") OR (c = '"') THEN
|
||||||
IF c = "." THEN
|
k := i;
|
||||||
DEC(i);
|
IF (c = "'") OR (c = '"') THEN
|
||||||
c := getChar(line, i)
|
String(text, line, i, y, backColor);
|
||||||
END;
|
ELSE
|
||||||
IF (cap(c) = "X") & (getChar(line, i - 1) = "0") THEN
|
ident(text, i, i - ORD((lang = Lang.langC) & (i > 0) & (getChar(line, i - 1) = "#")), y, line, backColor, Lang.isCS(lang))
|
||||||
REPEAT
|
END;
|
||||||
INC(i);
|
IF lang = Lang.langJSON THEN
|
||||||
c := getChar(line, i)
|
WHILE Lines.isSpace(getChar(line, i + 1)) DO
|
||||||
UNTIL ~U.isHex(cap(c));
|
INC(i)
|
||||||
IF UL(c) THEN
|
END;
|
||||||
INC(i)
|
IF getChar(line, i + 1) = ":" THEN
|
||||||
END
|
PrintLex(text, line, k, i, y, colors.key1, backColor)
|
||||||
ELSIF UL(c) THEN
|
END
|
||||||
INC(i)
|
END;
|
||||||
ELSIF U.isDigit(c) THEN
|
cond := 0
|
||||||
REPEAT
|
ELSIF U.isDigit(c) THEN
|
||||||
INC(i)
|
k := i;
|
||||||
UNTIL ~U.isDigit(getChar(line, i));
|
INC(i);
|
||||||
c := getChar(line, i);
|
c := getChar(line, i);
|
||||||
IF UL(c) THEN
|
IF c = "." THEN
|
||||||
INC(i)
|
DEC(i);
|
||||||
ELSIF c = "." THEN
|
c := getChar(line, i)
|
||||||
INC(i);
|
END;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
IF (cap(c) = "X") & (getChar(line, i - 1) = "0") THEN
|
||||||
INC(i)
|
REPEAT
|
||||||
END;
|
INC(i);
|
||||||
c := getChar(line, i);
|
c := getChar(line, i)
|
||||||
IF cap(c) = "E" THEN
|
UNTIL ~U.isHex(cap(c));
|
||||||
INC(i);
|
IF UL(c) THEN
|
||||||
c := getChar(line, i);
|
INC(i)
|
||||||
IF (c = "+") OR (c = "-") THEN
|
END
|
||||||
INC(i)
|
ELSIF UL(c) THEN
|
||||||
END;
|
INC(i)
|
||||||
IF U.isDigit(getChar(line, i)) THEN
|
ELSIF U.isDigit(c) THEN
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
REPEAT
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
UNTIL ~U.isDigit(getChar(line, i));
|
||||||
c := getChar(line, i);
|
c := getChar(line, i);
|
||||||
IF FL(c) THEN
|
IF UL(c) THEN
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
ELSIF c = "." THEN
|
||||||
END
|
INC(i);
|
||||||
ELSIF FL(c) THEN
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END;
|
||||||
END
|
c := getChar(line, i);
|
||||||
END;
|
IF cap(c) = "E" THEN
|
||||||
DEC(i);
|
INC(i);
|
||||||
PrintLex(text, line, k, i, y, colors.num, backColor);
|
c := getChar(line, i);
|
||||||
cond := 0
|
IF (c = "+") OR (c = "-") THEN
|
||||||
ELSE
|
INC(i)
|
||||||
cond := 0
|
END;
|
||||||
END
|
IF U.isDigit(getChar(line, i)) THEN
|
||||||
ELSIF depth = 1 THEN
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
IF c = "*" THEN
|
INC(i)
|
||||||
cond := 1
|
END;
|
||||||
ELSIF (c = "/") & (cond = 1) THEN
|
c := getChar(line, i);
|
||||||
cond := 0;
|
IF FL(c) THEN
|
||||||
depth := 0
|
INC(i)
|
||||||
ELSE
|
END
|
||||||
cond := 0
|
END
|
||||||
END
|
ELSIF FL(c) THEN
|
||||||
END;
|
INC(i)
|
||||||
|
END
|
||||||
|
END
|
||||||
|
END;
|
||||||
|
DEC(i);
|
||||||
|
PrintLex(text, line, k, i, y, colors.num, backColor);
|
||||||
|
cond := 0
|
||||||
|
ELSE
|
||||||
|
cond := 0
|
||||||
|
END
|
||||||
|
ELSIF depth = 1 THEN
|
||||||
|
IF c = "*" THEN
|
||||||
|
cond := 1
|
||||||
|
ELSIF (c = "/") & (cond = 1) THEN
|
||||||
|
cond := 0;
|
||||||
|
depth := 0
|
||||||
|
ELSE
|
||||||
|
cond := 0
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
ELSIF lang = Lang.langOberon THEN
|
ELSIF lang = Lang.langOberon THEN
|
||||||
|
|
||||||
IF (depth = 0) & (c = "/") THEN
|
IF (depth = 0) & (c = "/") THEN
|
||||||
IF cond = 3 THEN
|
IF cond = 3 THEN
|
||||||
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
||||||
cond := 0;
|
cond := 0;
|
||||||
i := n
|
i := n
|
||||||
ELSE
|
ELSE
|
||||||
cond := 3
|
cond := 3
|
||||||
END
|
END
|
||||||
ELSIF (depth = 0) & ((c = "'") OR (c = '"')) THEN
|
ELSIF (depth = 0) & ((c = "'") OR (c = '"')) THEN
|
||||||
String(text, line, i, y, backColor);
|
String(text, line, i, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF (depth = 0) & U.isDigit(c) THEN
|
ELSIF (depth = 0) & U.isDigit(c) THEN
|
||||||
color := colors.num;
|
color := colors.num;
|
||||||
k := i;
|
k := i;
|
||||||
INC(i);
|
INC(i);
|
||||||
WHILE U.isHex(getChar(line, i)) DO
|
WHILE U.isHex(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
IF i <= n THEN
|
IF i <= n THEN
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
DEC(i)
|
DEC(i)
|
||||||
END;
|
END;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
IF getChar(line, i) = "E" THEN
|
IF getChar(line, i) = "E" THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF (getChar(line, i) = "+") OR (getChar(line, i) = "-") THEN
|
IF (getChar(line, i) = "+") OR (getChar(line, i) = "-") THEN
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
ELSIF getChar(line, i) = "H" THEN
|
ELSIF getChar(line, i) = "H" THEN
|
||||||
INC(i)
|
INC(i)
|
||||||
ELSIF getChar(line, i) = "X" THEN
|
ELSIF getChar(line, i) = "X" THEN
|
||||||
color := colors.string;
|
color := colors.string;
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, color, backColor);
|
PrintLex(text, line, k, i, y, color, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF (depth = 0) & (U.isLetter(c) OR (c = "_")) THEN
|
ELSIF (depth = 0) & (U.isLetter(c) OR (c = "_")) THEN
|
||||||
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF c = "(" THEN
|
ELSIF c = "(" THEN
|
||||||
cond := 1
|
cond := 1
|
||||||
ELSIF c = "*" THEN
|
ELSIF c = "*" THEN
|
||||||
IF cond = 1 THEN
|
IF cond = 1 THEN
|
||||||
INC(depth);
|
INC(depth);
|
||||||
INC(i);
|
INC(i);
|
||||||
PrintComment(text, line, depth, i, 2, y, backColor);
|
PrintComment(text, line, depth, i, 2, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 2
|
cond := 2
|
||||||
END
|
END
|
||||||
ELSIF c = ")" THEN
|
ELSIF c = ")" THEN
|
||||||
IF cond = 2 THEN
|
IF cond = 2 THEN
|
||||||
IF depth > 0 THEN
|
IF depth > 0 THEN
|
||||||
DEC(depth)
|
DEC(depth)
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
|
|
||||||
ELSIF lang = Lang.langLua THEN
|
ELSIF lang = Lang.langLua THEN
|
||||||
|
|
||||||
IF depth = 0 THEN
|
IF depth = 0 THEN
|
||||||
IF c = "-" THEN
|
IF c = "-" THEN
|
||||||
IF cond = 1 THEN
|
IF cond = 1 THEN
|
||||||
IF Lang.LuaLong(line, i + 1) >= 0 THEN
|
IF Lang.LuaLong(line, i + 1) >= 0 THEN
|
||||||
depth := Lang.LuaLong(line, i + 1)*2 + 1;
|
depth := Lang.LuaLong(line, i + 1)*2 + 1;
|
||||||
INC(i);
|
INC(i);
|
||||||
PrintComment(text, line, depth, i, 2, y, backColor)
|
PrintComment(text, line, depth, i, 2, y, backColor)
|
||||||
ELSE
|
ELSE
|
||||||
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
||||||
i := n
|
i := n
|
||||||
END;
|
END;
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 1
|
cond := 1
|
||||||
END
|
END
|
||||||
ELSIF c = "[" THEN
|
ELSIF c = "[" THEN
|
||||||
cond := 0;
|
cond := 0;
|
||||||
k := Lang.LuaLong(line, i);
|
k := Lang.LuaLong(line, i);
|
||||||
IF k >= 0 THEN
|
IF k >= 0 THEN
|
||||||
depth := (k + 1)*2;
|
depth := (k + 1)*2;
|
||||||
INC(i, 2);
|
INC(i, 2);
|
||||||
PrintComment(text, line, depth, i, 2, y, backColor);
|
PrintComment(text, line, depth, i, 2, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
ELSIF (c = "'") OR (c = '"') THEN
|
ELSIF (c = "'") OR (c = '"') THEN
|
||||||
String(text, line, i, y, backColor);
|
String(text, line, i, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF U.isDigit(c) THEN
|
ELSIF U.isDigit(c) THEN
|
||||||
k := i;
|
k := i;
|
||||||
IF (c = "0") & (cap(getChar(line, i + 1)) = "X") THEN
|
IF (c = "0") & (cap(getChar(line, i + 1)) = "X") THEN
|
||||||
isDgt := U.isHex;
|
isDgt := U.isHex;
|
||||||
hex := TRUE;
|
hex := TRUE;
|
||||||
INC(i, 2)
|
INC(i, 2)
|
||||||
ELSE
|
ELSE
|
||||||
isDgt := U.isDigit;
|
isDgt := U.isDigit;
|
||||||
hex := FALSE
|
hex := FALSE
|
||||||
END;
|
END;
|
||||||
WHILE isDgt(cap(getChar(line, i))) DO
|
WHILE isDgt(cap(getChar(line, i))) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
DEC(i)
|
DEC(i)
|
||||||
END;
|
END;
|
||||||
WHILE isDgt(cap(getChar(line, i))) DO
|
WHILE isDgt(cap(getChar(line, i))) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
IF (cap(getChar(line, i)) = "E") OR hex & (cap(getChar(line, i)) = "P") THEN
|
IF (cap(getChar(line, i)) = "E") OR hex & (cap(getChar(line, i)) = "P") THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
|
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
WHILE isDgt(cap(getChar(line, i))) DO
|
WHILE isDgt(cap(getChar(line, i))) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, colors.num, backColor);
|
PrintLex(text, line, k, i, y, colors.num, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF U.isLetter(c) OR (c = "_") THEN
|
ELSIF U.isLetter(c) OR (c = "_") THEN
|
||||||
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
|
|
||||||
ELSIF depth > 0 THEN
|
ELSIF depth > 0 THEN
|
||||||
IF (cond = 0) & (c = "]") THEN
|
IF (cond = 0) & (c = "]") THEN
|
||||||
cond := 1
|
cond := 1
|
||||||
ELSIF (cond >= 1) & (c = "=") THEN
|
ELSIF (cond >= 1) & (c = "=") THEN
|
||||||
INC(cond)
|
INC(cond)
|
||||||
ELSIF (cond >= 1) & (c = "]") & (cond * 2 - depth MOD 2 = depth) THEN
|
ELSIF (cond >= 1) & (c = "]") & (cond * 2 - depth MOD 2 = depth) THEN
|
||||||
depth := 0;
|
depth := 0;
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
ELSIF lang = Lang.langPascal THEN
|
ELSIF lang = Lang.langPascal THEN
|
||||||
|
|
||||||
IF depth = 0 THEN
|
IF depth = 0 THEN
|
||||||
IF c = "(" THEN
|
IF c = "(" THEN
|
||||||
cond := 1
|
cond := 1
|
||||||
ELSIF (c = "*") & (cond = 1) THEN
|
ELSIF (c = "*") & (cond = 1) THEN
|
||||||
depth := 2;
|
depth := 2;
|
||||||
INC(i);
|
INC(i);
|
||||||
PrintComment(text, line, depth, i, 2, y, backColor);
|
PrintComment(text, line, depth, i, 2, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF c = "/" THEN
|
ELSIF c = "/" THEN
|
||||||
IF cond = 2 THEN
|
IF cond = 2 THEN
|
||||||
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
|
||||||
cond := 0;
|
cond := 0;
|
||||||
i := n
|
i := n
|
||||||
ELSE
|
ELSE
|
||||||
cond := 2
|
cond := 2
|
||||||
END
|
END
|
||||||
ELSIF c = "'" THEN
|
ELSIF c = "'" THEN
|
||||||
String(text, line, i, y, backColor);
|
String(text, line, i, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF c = "{" THEN
|
ELSIF c = "{" THEN
|
||||||
IF getChar(line, i + 1) = "$" THEN
|
IF getChar(line, i + 1) = "$" THEN
|
||||||
depth := 3
|
depth := 3
|
||||||
ELSE
|
ELSE
|
||||||
depth := 1
|
depth := 1
|
||||||
END;
|
END;
|
||||||
INC(i);
|
INC(i);
|
||||||
PrintComment(text, line, depth, i, 1, y, backColor);
|
PrintComment(text, line, depth, i, 1, y, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF c = "#" THEN
|
ELSIF c = "#" THEN
|
||||||
k := i;
|
k := i;
|
||||||
INC(i);
|
INC(i);
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, colors.string, backColor);
|
PrintLex(text, line, k, i, y, colors.string, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF c = "$" THEN
|
ELSIF c = "$" THEN
|
||||||
IF (i > 0 ) & (getChar(line, i - 1) = "#") THEN
|
IF (i > 0 ) & (getChar(line, i - 1) = "#") THEN
|
||||||
color := colors.string
|
color := colors.string
|
||||||
ELSE
|
ELSE
|
||||||
color := colors.num
|
color := colors.num
|
||||||
END;
|
END;
|
||||||
k := i;
|
k := i;
|
||||||
INC(i);
|
INC(i);
|
||||||
WHILE U.isHex(cap(getChar(line, i))) DO
|
WHILE U.isHex(cap(getChar(line, i))) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, color, backColor);
|
PrintLex(text, line, k, i, y, color, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF U.isDigit(c) THEN
|
ELSIF U.isDigit(c) THEN
|
||||||
k := i;
|
k := i;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF getChar(line, i) = "." THEN
|
IF getChar(line, i) = "." THEN
|
||||||
DEC(i)
|
DEC(i)
|
||||||
END;
|
END;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
IF cap(getChar(line, i)) = "E" THEN
|
IF cap(getChar(line, i)) = "E" THEN
|
||||||
INC(i);
|
INC(i);
|
||||||
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
|
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, colors.num, backColor);
|
PrintLex(text, line, k, i, y, colors.num, backColor);
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSIF (U.isLetter(c) OR (c = "_")) THEN
|
ELSIF (U.isLetter(c) OR (c = "_")) THEN
|
||||||
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
ELSIF depth IN {1, 3} THEN
|
ELSIF depth IN {1, 3} THEN
|
||||||
IF c = "}" THEN
|
IF c = "}" THEN
|
||||||
depth := 0
|
depth := 0
|
||||||
END
|
END
|
||||||
ELSIF depth = 2 THEN
|
ELSIF depth = 2 THEN
|
||||||
IF c = "*" THEN
|
IF c = "*" THEN
|
||||||
cond := 1
|
cond := 1
|
||||||
ELSIF (c = ")") & (cond = 1) THEN
|
ELSIF (c = ")") & (cond = 1) THEN
|
||||||
depth := 0;
|
depth := 0;
|
||||||
cond := 0
|
cond := 0
|
||||||
ELSE
|
ELSE
|
||||||
cond := 0
|
cond := 0
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
ELSIF lang = Lang.langIni THEN
|
ELSIF lang = Lang.langIni THEN
|
||||||
|
|
||||||
IF depth = 0 THEN
|
IF depth = 0 THEN
|
||||||
IF (c = ";") OR (c = "#") THEN
|
IF (c = ";") OR (c = "#") THEN
|
||||||
PrintLex(text, line, i, n, y, colors.comment, backColor);
|
PrintLex(text, line, i, n, y, colors.comment, backColor);
|
||||||
i := n
|
i := n
|
||||||
ELSIF c = '"' THEN
|
ELSIF c = '"' THEN
|
||||||
String(text, line, i, y, backColor)
|
String(text, line, i, y, backColor)
|
||||||
ELSIF c = "[" THEN
|
ELSIF c = "[" THEN
|
||||||
depth := 1;
|
depth := 1;
|
||||||
INC(i);
|
INC(i);
|
||||||
PrintComment(text, line, depth, i, 1, y, backColor)
|
PrintComment(text, line, depth, i, 1, y, backColor)
|
||||||
ELSIF U.isDigit(c) THEN
|
ELSIF U.isDigit(c) THEN
|
||||||
k := i;
|
k := i;
|
||||||
WHILE U.isDigit(getChar(line, i)) DO
|
WHILE U.isDigit(getChar(line, i)) DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
DEC(i);
|
DEC(i);
|
||||||
PrintLex(text, line, k, i, y, colors.num, backColor)
|
PrintLex(text, line, k, i, y, colors.num, backColor)
|
||||||
ELSIF (U.isLetter(c) OR (c = "_")) THEN
|
ELSIF (U.isLetter(c) OR (c = "_")) THEN
|
||||||
ident(text, i, i, y, line, backColor, Lang.isCS(lang))
|
ident(text, i, i, y, line, backColor, Lang.isCS(lang))
|
||||||
END
|
END
|
||||||
ELSIF depth = 1 THEN
|
ELSIF depth = 1 THEN
|
||||||
IF c = "]" THEN
|
IF c = "]" THEN
|
||||||
depth := 0
|
depth := 0
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
END;
|
END;
|
||||||
INC(i)
|
INC(i)
|
||||||
@ -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,21 +296,23 @@ 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
|
c := x - scroll.left
|
||||||
c := x - scroll.left
|
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,33 +344,31 @@ 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;
|
IF U.between(1, x, scroll.width - 2) & U.between(1, y, scroll.height - 2) THEN
|
||||||
IF U.between(1, x, scroll.width - 2) & U.between(1, y, scroll.height - 2) THEN
|
IF scroll.vertical THEN
|
||||||
IF scroll.vertical THEN
|
c := y;
|
||||||
c := y;
|
size := scroll.height
|
||||||
size := scroll.height
|
ELSE
|
||||||
ELSE
|
c := x;
|
||||||
c := x;
|
size := scroll.width
|
||||||
size := scroll.width
|
END;
|
||||||
END;
|
IF U.between(scroll.btnSize + scroll.pos - 1, c, scroll.btnSize + scroll.pos + scroll.sliderSize - 1) THEN
|
||||||
IF U.between(scroll.btnSize + scroll.pos - 1, c, scroll.btnSize + scroll.pos + scroll.sliderSize - 1) THEN
|
scroll.pos0 := scroll.pos;
|
||||||
scroll.pos0 := scroll.pos;
|
scroll.Slider := c
|
||||||
scroll.Slider := c
|
ELSIF U.between(0, c, scroll.btnSize - 1) THEN
|
||||||
ELSIF U.between(0, c, scroll.btnSize - 1) THEN
|
scroll.Dec := TRUE;
|
||||||
scroll.Dec := TRUE;
|
SendIPC
|
||||||
SendIPC
|
ELSIF U.between(size - scroll.btnSize, c, size - 1) THEN
|
||||||
ELSIF U.between(size - scroll.btnSize, c, size - 1) THEN
|
scroll.Inc := TRUE;
|
||||||
scroll.Inc := TRUE;
|
SendIPC
|
||||||
SendIPC
|
ELSE
|
||||||
ELSE
|
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
|
||||||
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
|
scroll.pos0 := scroll.pos;
|
||||||
scroll.pos0 := scroll.pos;
|
scroll.Slider := c;
|
||||||
scroll.Slider := c;
|
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
|
||||||
MouseMove(scroll, x, y)
|
MouseDown(scroll, x, y)
|
||||||
|
ELSIF scroll.Slider # -1 THEN
|
||||||
|
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