Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 9209 → Rev 9210

/programs/develop/cedit/CEDIT
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programs/develop/cedit/SRC/CEdit.ob07
28,10 → 28,10
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
 
CONST
header = "CEdit (28-sep-2021)";
HEADER = "CEdit (03-oct-2021)";
 
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;
fontHeight = K.fontHeight;
51,14 → 51,14
 
btnYes = 40;
btnNo = 41;
btnFindNext = 60;
btnReplace = 61;
btnReplaceAll = 62;
btnGoto = 63;
btnCloseSearch = 64;
btnHideSearch = 65;
btnFindNext = 42;
btnReplace = 43;
btnReplaceAll = 44;
btnGoto = 45;
btnCloseSearch = 46;
btnHideSearch = 47;
 
mainMenuBtn = 70;
mainMenuBtn = 60;
 
btnHeight = 25;
btnWidth = 75;
184,10 → 184,10
 
switch, closing: BOOLEAN;
leftButton: BOOLEAN;
hScroll, vScroll: Scroll.tScroll;
LEFT: INTEGER;
 
FindEdit, ReplaceEdit, GotoEdit: EB.tEditBox;
hScroll, vScroll: Scroll.tScroll;
CS, WH, BKW: CheckBox.tCheckBox;
 
new_searchText, searchText, replaceText, gotoText: T.tString;
226,14 → 226,7
 
 
PROCEDURE EditBox_Focus (edit: EB.tEditBox): BOOLEAN;
VAR
res: BOOLEAN;
BEGIN
res := FALSE;
IF edit # NIL THEN
res := 1 IN edit.flags
END
RETURN res
RETURN 1 IN edit.flags
END EditBox_Focus;
 
 
249,7 → 242,7
END resetTimer;
 
 
PROCEDURE EditBox_SetFocus (edit: EB.tEditBox; value: BOOLEAN);
PROCEDURE EditBox_SetFocus (VAR edit: EB.tEditBox; value: BOOLEAN);
BEGIN
IF value THEN
INCL(edit.flags, 1)
262,7 → 255,7
END EditBox_SetFocus;
 
 
PROCEDURE SetFocus (edit: EB.tEditBox; value: BOOLEAN);
PROCEDURE SetFocus (VAR edit: EB.tEditBox; value: BOOLEAN);
BEGIN
EditBox_SetFocus(FindEdit, FALSE);
EditBox_SetFocus(ReplaceEdit, FALSE);
413,17 → 406,21
VAR
y: INTEGER;
s: ARRAY 24 OF WCHAR;
header: RW.tFileName;
BEGIN
y := (btnHeight - fontHeight) DIV 2 + btnTop;
s := "";
U.append(s, RW.eolNames[text.eol]);
U.append(s, 20X);
U.append(s, 20X + 20X);
U.append(s, E.names[text.enc]);
K.DrawRect(width - LEN(s)*fontWidth, y, LEN(s)*fontWidth, fontHeight, K.winColor);
K.DrawText(width - LENGTH(s)*fontWidth, y, K.textColor, s);
header := HEADER;
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;
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
K.DrawText(width - (LENGTH(s) + 10)*fontWidth, y, K.textColor, s);
WriteModified(width - 8*fontWidth, y)
END DrawState;
 
576,7 → 573,7
 
BEGIN
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 confirm THEN
resetTimer
698,16 → 695,7
U.getFileName(text.fileName, OD.FileName, U.SLASH);
IF OD.FileName = "" THEN
OD.FileName := "NewFile.";
CASE text.lang OF
|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;
Languages.getExt(text.lang, ext);
U.append8(OD.FileName, ext)
END;
OpenFile(fileName, EditFilter);
923,26 → 911,11
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;
BEGIN
FindEdit := createEdit(searchLeft, TOP + 20);
ReplaceEdit := createEdit(searchLeft, TOP + 20 + 55);
GotoEdit := createEdit(searchLeft, TOP + 20 + 330);
EB.create(searchLeft, TOP + 20, EditBox_Width, EDITBOX_MAXCHARS, FindEdit);
EB.create(searchLeft, TOP + 20 + 55, EditBox_Width, EDITBOX_MAXCHARS, ReplaceEdit);
EB.create(searchLeft, TOP + 20 + 330, EditBox_Width, EDITBOX_MAXCHARS, GotoEdit);
INCL(GotoEdit.flags, 15);
CheckBox.create("backward", BKW);
CheckBox.create("match case", CS);
1041,8 → 1014,12
 
 
PROCEDURE MenuItemClick (menu: Menu.tMenu; id: INTEGER);
VAR
msg: ARRAY 2 OF INTEGER;
BEGIN
K.SendIPC(mainTID, id)
msg[0] := id;
msg[1] := 8;
K.SendIPC(mainTID, msg)
END MenuItemClick;
 
 
1565,7 → 1542,7
idx: INTEGER;
BEGIN
menu := List.create(NIL);
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
Menu.AddMenuItem(menu, menuFontSize, "x2");
Menu.delimiter(menu);
 
1940,9 → 1917,10
VAR
msState: SET;
scroll, x, y, scrollX, scrollY: INTEGER;
pos1, pos2: T.tPoint;
 
 
PROCEDURE EditBox (eb: EB.tEditBox);
PROCEDURE EditBox (VAR eb: EB.tEditBox);
VAR
focus: BOOLEAN;
BEGIN
1969,9 → 1947,13
END;
IF leftButton THEN
IF K.GetTickCount() - time >= DELAY THEN
T.getPos(text, pos1.Y, pos1.X);
mouse(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;
 
/programs/develop/cedit/SRC/EditBox.ob07
28,7 → 28,7
 
TYPE
 
tEditBox* = POINTER TO RECORD
tEditBox* = RECORD
width*,
left*,
top*,
39,7 → 39,7
text_color*,
max: INTEGER;
text*: INTEGER;
mouse_variable: tEditBox;
mouse_variable: INTEGER;
flags*: SET;
 
size,
110,28 → 110,21
END setValue;
 
 
PROCEDURE create* (tlx, tly, width, max_chars: INTEGER; editbox_interlock: tEditBox): tEditBox;
VAR
new_textbox: tEditBox;
 
PROCEDURE create* (tlx, tly, width, max_chars: INTEGER; VAR editbox: tEditBox);
BEGIN
NEW(new_textbox);
 
new_textbox.width := width;
new_textbox.left := tlx;
new_textbox.top := tly;
new_textbox.color := 0FFFFFFH;
new_textbox.shift_color := 06A9480H;
new_textbox.focus_border_color := 0;
new_textbox.blur_border_color := 06A9480H;
new_textbox.text_color := 0;
new_textbox.max := max_chars;
new_textbox.text := KOSAPI.malloc(max_chars + 2);
ASSERT(new_textbox.text # 0);
new_textbox.mouse_variable := editbox_interlock;
new_textbox.flags := {}
 
RETURN new_textbox
editbox.width := width;
editbox.left := tlx;
editbox.top := tly;
editbox.color := 0FFFFFFH;
editbox.shift_color := 06A9480H;
editbox.focus_border_color := 0;
editbox.blur_border_color := 06A9480H;
editbox.text_color := 30000000H;
editbox.max := max_chars;
editbox.text := KOSAPI.malloc(max_chars + 2);
ASSERT(editbox.text # 0);
editbox.mouse_variable := 0;
editbox.flags := {14}
END create;
 
 
/programs/develop/cedit/SRC/KolibriOS.ob07
46,7 → 46,7
 
PROCEDURE CreateWindow* (x, y, w, h, color, style, hcolor, hstyle: INTEGER; htext: ARRAY OF CHAR);
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;
 
 
142,25 → 142,25
 
PROCEDURE DrawText* (x, y, color: INTEGER; text: ARRAY OF WCHAR);
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;
 
 
PROCEDURE DrawText69* (x, y, color: INTEGER; text: ARRAY OF CHAR);
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;
 
 
PROCEDURE DrawText866* (x, y, color: INTEGER; text: ARRAY OF CHAR);
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;
 
 
PROCEDURE DrawText866bk* (x, y, color, bkColor: INTEGER; text: ARRAY OF CHAR);
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;
 
 
233,7 → 233,14
 
 
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;
 
 
323,18 → 330,12
END SetIPC;
 
 
PROCEDURE SendIPC* (tid, msg: INTEGER);
PROCEDURE SendIPC* (tid: INTEGER; msg: ARRAY OF INTEGER);
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;
 
 
PROCEDURE PutPixel* (x, y, color: INTEGER);
BEGIN
KOSAPI.sysfunc4(1, x, y, color)
END PutPixel;
 
 
PROCEDURE GetSystemColors*;
VAR
buf: ARRAY 10 OF INTEGER;
384,4 → 385,10
END mouse;
 
 
PROCEDURE SetCaption* (text: ARRAY OF CHAR);
BEGIN
KOSAPI.sysfunc4(71, 2, SYSTEM.ADR(text[0]), 0)
END SetCaption;
 
 
END KolibriOS.
/programs/develop/cedit/SRC/Languages.ob07
19,7 → 19,7
 
MODULE Languages;
 
IMPORT Lines;
IMPORT Lines, Utils;
 
 
CONST
49,7 → 49,9
 
currentLang: INTEGER;
 
fileExt: ARRAY 11 OF RECORD ext: ARRAY 8 OF CHAR; lang: INTEGER END;
 
 
PROCEDURE isCS* (lang: INTEGER): BOOLEAN;
RETURN lang IN csLang
END isCS;
395,6 → 397,36
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);
BEGIN
currentLang := langText;
406,6 → 438,18
loadKW(KW[langIni], Delim[langIni], getStr, "lang_Ini");
loadKW(KW[langFasm], Delim[langFasm], getStr, "lang_Fasm");
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;
 
 
/programs/develop/cedit/SRC/Text.ob07
46,8 → 46,8
 
TYPE
 
tPoint = RECORD
X, Y: INTEGER
tPoint* = RECORD
X*, Y*: INTEGER
END;
 
pPoint = POINTER TO tPoint;
67,15 → 67,12
scroll: tPoint;
CurX: INTEGER;
modified*: BOOLEAN;
 
edition*: tGuard;
comments, numbers*, guard,
search, cs, whole: BOOLEAN;
curLine: tLine;
fileName*: RW.tFileName;
lang*: INTEGER;
enc*: INTEGER;
eol*: INTEGER;
enc*, eol*: INTEGER;
table: Search.IdxTable;
foundList: List.tList;
idxData: Search.tBuffer;
82,7 → 79,8
foundSel: INTEGER;
searchText: tString;
chLog*: ChangeLog.tLog;
maxLength*: INTEGER
maxLength*: INTEGER;
fileName*: RW.tFileName
END;
 
tProcedure = PROCEDURE;
104,42 → 102,25
charWidth, charHeight: INTEGER;
 
 
PROCEDURE setLang* (text: tText; lang: INTEGER);
BEGIN
text.lang := lang;
text.comments := TRUE;
Lang.setCurLang(text.lang)
END setLang;
 
 
PROCEDURE setName* (text: tText; name: RW.tFileName);
VAR
ext: RW.tFileName;
BEGIN
text.fileName := name;
U.getFileName(text.fileName, ext, ".");
U.getFileName(name, 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)
setLang(text, Lang.getLang(ext))
END setName;
 
 
PROCEDURE setLang* (text: tText; lang: INTEGER);
BEGIN
text.lang := lang;
text.comments := TRUE;
Lang.setCurLang(text.lang)
END setLang;
 
 
PROCEDURE getPos* (text: tText; VAR x, y: INTEGER);
BEGIN
x := text.cursor.X + 1;
422,387 → 403,387
 
ELSIF (lang = Lang.langC) OR (lang = Lang.langJSON) THEN
 
IF depth = 0 THEN
IF c = "/" THEN
IF cond = 0 THEN
cond := 1
ELSE
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
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)
IF depth = 0 THEN
IF c = "/" THEN
IF cond = 0 THEN
cond := 1
ELSE
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
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;
IF getChar(line, i + 1) = ":" THEN
PrintLex(text, line, k, i, y, colors.key1, backColor)
END
END;
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
INC(i);
c := getChar(line, i);
IF c = "." THEN
DEC(i);
c := getChar(line, i)
END;
IF (cap(c) = "X") & (getChar(line, i - 1) = "0") THEN
REPEAT
INC(i);
c := getChar(line, i)
UNTIL ~U.isHex(cap(c));
IF UL(c) THEN
INC(i)
END
ELSIF UL(c) THEN
INC(i)
ELSIF U.isDigit(c) THEN
REPEAT
INC(i)
UNTIL ~U.isDigit(getChar(line, i));
c := getChar(line, i);
IF UL(c) THEN
INC(i)
ELSIF c = "." THEN
INC(i);
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
c := getChar(line, i);
IF cap(c) = "E" THEN
INC(i);
c := getChar(line, i);
IF (c = "+") OR (c = "-") THEN
INC(i)
END;
IF U.isDigit(getChar(line, i)) THEN
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
c := getChar(line, i);
IF FL(c) THEN
INC(i)
END
END
ELSIF FL(c) THEN
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;
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
INC(i);
c := getChar(line, i);
IF c = "." THEN
DEC(i);
c := getChar(line, i)
END;
IF (cap(c) = "X") & (getChar(line, i - 1) = "0") THEN
REPEAT
INC(i);
c := getChar(line, i)
UNTIL ~U.isHex(cap(c));
IF UL(c) THEN
INC(i)
END
ELSIF UL(c) THEN
INC(i)
ELSIF U.isDigit(c) THEN
REPEAT
INC(i)
UNTIL ~U.isDigit(getChar(line, i));
c := getChar(line, i);
IF UL(c) THEN
INC(i)
ELSIF c = "." THEN
INC(i);
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
c := getChar(line, i);
IF cap(c) = "E" THEN
INC(i);
c := getChar(line, i);
IF (c = "+") OR (c = "-") THEN
INC(i)
END;
IF U.isDigit(getChar(line, i)) THEN
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
c := getChar(line, i);
IF FL(c) THEN
INC(i)
END
END
ELSIF FL(c) THEN
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
 
IF (depth = 0) & (c = "/") THEN
IF cond = 3 THEN
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
i := n
ELSE
cond := 3
END
ELSIF (depth = 0) & ((c = "'") OR (c = '"')) THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF (depth = 0) & U.isDigit(c) THEN
color := colors.num;
k := i;
INC(i);
WHILE U.isHex(getChar(line, i)) DO
INC(i)
END;
IF i <= n THEN
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF getChar(line, i) = "E" THEN
INC(i);
IF (getChar(line, i) = "+") OR (getChar(line, i) = "-") THEN
INC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END
END
ELSIF getChar(line, i) = "H" THEN
INC(i)
ELSIF getChar(line, i) = "X" THEN
color := colors.string;
INC(i)
END
END;
DEC(i);
PrintLex(text, line, k, i, y, color, backColor);
cond := 0
ELSIF (depth = 0) & (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSIF c = "(" THEN
cond := 1
ELSIF c = "*" THEN
IF cond = 1 THEN
INC(depth);
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
ELSE
cond := 2
END
ELSIF c = ")" THEN
IF cond = 2 THEN
IF depth > 0 THEN
DEC(depth)
END
END;
cond := 0
ELSE
cond := 0
END
IF (depth = 0) & (c = "/") THEN
IF cond = 3 THEN
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
i := n
ELSE
cond := 3
END
ELSIF (depth = 0) & ((c = "'") OR (c = '"')) THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF (depth = 0) & U.isDigit(c) THEN
color := colors.num;
k := i;
INC(i);
WHILE U.isHex(getChar(line, i)) DO
INC(i)
END;
IF i <= n THEN
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF getChar(line, i) = "E" THEN
INC(i);
IF (getChar(line, i) = "+") OR (getChar(line, i) = "-") THEN
INC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END
END
ELSIF getChar(line, i) = "H" THEN
INC(i)
ELSIF getChar(line, i) = "X" THEN
color := colors.string;
INC(i)
END
END;
DEC(i);
PrintLex(text, line, k, i, y, color, backColor);
cond := 0
ELSIF (depth = 0) & (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSIF c = "(" THEN
cond := 1
ELSIF c = "*" THEN
IF cond = 1 THEN
INC(depth);
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
ELSE
cond := 2
END
ELSIF c = ")" THEN
IF cond = 2 THEN
IF depth > 0 THEN
DEC(depth)
END
END;
cond := 0
ELSE
cond := 0
END
 
ELSIF lang = Lang.langLua THEN
 
IF depth = 0 THEN
IF c = "-" THEN
IF cond = 1 THEN
IF Lang.LuaLong(line, i + 1) >= 0 THEN
depth := Lang.LuaLong(line, i + 1)*2 + 1;
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor)
ELSE
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
i := n
END;
cond := 0
ELSE
cond := 1
END
ELSIF c = "[" THEN
cond := 0;
k := Lang.LuaLong(line, i);
IF k >= 0 THEN
depth := (k + 1)*2;
INC(i, 2);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
END
ELSIF (c = "'") OR (c = '"') THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
IF (c = "0") & (cap(getChar(line, i + 1)) = "X") THEN
isDgt := U.isHex;
hex := TRUE;
INC(i, 2)
ELSE
isDgt := U.isDigit;
hex := FALSE
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END;
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END
END;
IF (cap(getChar(line, i)) = "E") OR hex & (cap(getChar(line, i)) = "P") THEN
INC(i);
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
INC(i)
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor);
cond := 0
ELSIF U.isLetter(c) OR (c = "_") THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSE
cond := 0
END
IF depth = 0 THEN
IF c = "-" THEN
IF cond = 1 THEN
IF Lang.LuaLong(line, i + 1) >= 0 THEN
depth := Lang.LuaLong(line, i + 1)*2 + 1;
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor)
ELSE
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
i := n
END;
cond := 0
ELSE
cond := 1
END
ELSIF c = "[" THEN
cond := 0;
k := Lang.LuaLong(line, i);
IF k >= 0 THEN
depth := (k + 1)*2;
INC(i, 2);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
END
ELSIF (c = "'") OR (c = '"') THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
IF (c = "0") & (cap(getChar(line, i + 1)) = "X") THEN
isDgt := U.isHex;
hex := TRUE;
INC(i, 2)
ELSE
isDgt := U.isDigit;
hex := FALSE
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END;
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END
END;
IF (cap(getChar(line, i)) = "E") OR hex & (cap(getChar(line, i)) = "P") THEN
INC(i);
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
INC(i)
END;
WHILE isDgt(cap(getChar(line, i))) DO
INC(i)
END
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor);
cond := 0
ELSIF U.isLetter(c) OR (c = "_") THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSE
cond := 0
END
 
ELSIF depth > 0 THEN
IF (cond = 0) & (c = "]") THEN
cond := 1
ELSIF (cond >= 1) & (c = "=") THEN
INC(cond)
ELSIF (cond >= 1) & (c = "]") & (cond * 2 - depth MOD 2 = depth) THEN
depth := 0;
cond := 0
ELSE
cond := 0
END
END
ELSIF depth > 0 THEN
IF (cond = 0) & (c = "]") THEN
cond := 1
ELSIF (cond >= 1) & (c = "=") THEN
INC(cond)
ELSIF (cond >= 1) & (c = "]") & (cond * 2 - depth MOD 2 = depth) THEN
depth := 0;
cond := 0
ELSE
cond := 0
END
END
 
ELSIF lang = Lang.langPascal THEN
 
IF depth = 0 THEN
IF c = "(" THEN
cond := 1
ELSIF (c = "*") & (cond = 1) THEN
depth := 2;
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
ELSIF c = "/" THEN
IF cond = 2 THEN
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
i := n
ELSE
cond := 2
END
ELSIF c = "'" THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF c = "{" THEN
IF getChar(line, i + 1) = "$" THEN
depth := 3
ELSE
depth := 1
END;
INC(i);
PrintComment(text, line, depth, i, 1, y, backColor);
cond := 0
ELSIF c = "#" THEN
k := i;
INC(i);
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.string, backColor);
cond := 0
ELSIF c = "$" THEN
IF (i > 0 ) & (getChar(line, i - 1) = "#") THEN
color := colors.string
ELSE
color := colors.num
END;
k := i;
INC(i);
WHILE U.isHex(cap(getChar(line, i))) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, color, backColor);
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF cap(getChar(line, i)) = "E" THEN
INC(i);
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
INC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END
END
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor);
cond := 0
ELSIF (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSE
cond := 0
END
ELSIF depth IN {1, 3} THEN
IF c = "}" THEN
depth := 0
END
ELSIF depth = 2 THEN
IF c = "*" THEN
cond := 1
ELSIF (c = ")") & (cond = 1) THEN
depth := 0;
cond := 0
ELSE
cond := 0
END
END
IF depth = 0 THEN
IF c = "(" THEN
cond := 1
ELSIF (c = "*") & (cond = 1) THEN
depth := 2;
INC(i);
PrintComment(text, line, depth, i, 2, y, backColor);
cond := 0
ELSIF c = "/" THEN
IF cond = 2 THEN
PrintLex(text, line, i - 1, n, y, colors.comment, backColor);
cond := 0;
i := n
ELSE
cond := 2
END
ELSIF c = "'" THEN
String(text, line, i, y, backColor);
cond := 0
ELSIF c = "{" THEN
IF getChar(line, i + 1) = "$" THEN
depth := 3
ELSE
depth := 1
END;
INC(i);
PrintComment(text, line, depth, i, 1, y, backColor);
cond := 0
ELSIF c = "#" THEN
k := i;
INC(i);
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.string, backColor);
cond := 0
ELSIF c = "$" THEN
IF (i > 0 ) & (getChar(line, i - 1) = "#") THEN
color := colors.string
ELSE
color := colors.num
END;
k := i;
INC(i);
WHILE U.isHex(cap(getChar(line, i))) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, color, backColor);
cond := 0
ELSIF U.isDigit(c) THEN
k := i;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF getChar(line, i) = "." THEN
INC(i);
IF getChar(line, i) = "." THEN
DEC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
IF cap(getChar(line, i)) = "E" THEN
INC(i);
IF (getChar(line, i) = "-") OR (getChar(line, i) = "+") THEN
INC(i)
END;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END
END
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor);
cond := 0
ELSIF (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang));
cond := 0
ELSE
cond := 0
END
ELSIF depth IN {1, 3} THEN
IF c = "}" THEN
depth := 0
END
ELSIF depth = 2 THEN
IF c = "*" THEN
cond := 1
ELSIF (c = ")") & (cond = 1) THEN
depth := 0;
cond := 0
ELSE
cond := 0
END
END
 
ELSIF lang = Lang.langIni THEN
 
IF depth = 0 THEN
IF (c = ";") OR (c = "#") THEN
PrintLex(text, line, i, n, y, colors.comment, backColor);
i := n
ELSIF c = '"' THEN
String(text, line, i, y, backColor)
ELSIF c = "[" THEN
depth := 1;
INC(i);
PrintComment(text, line, depth, i, 1, y, backColor)
ELSIF U.isDigit(c) THEN
k := i;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor)
ELSIF (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang))
END
ELSIF depth = 1 THEN
IF c = "]" THEN
depth := 0
END
END
IF depth = 0 THEN
IF (c = ";") OR (c = "#") THEN
PrintLex(text, line, i, n, y, colors.comment, backColor);
i := n
ELSIF c = '"' THEN
String(text, line, i, y, backColor)
ELSIF c = "[" THEN
depth := 1;
INC(i);
PrintComment(text, line, depth, i, 1, y, backColor)
ELSIF U.isDigit(c) THEN
k := i;
WHILE U.isDigit(getChar(line, i)) DO
INC(i)
END;
DEC(i);
PrintLex(text, line, k, i, y, colors.num, backColor)
ELSIF (U.isLetter(c) OR (c = "_")) THEN
ident(text, i, i, y, line, backColor, Lang.isCS(lang))
END
ELSIF depth = 1 THEN
IF c = "]" THEN
depth := 0
END
END
 
END;
INC(i)
2089,7 → 2070,7
line := getLine(text, n);
firstLine := line;
cnt := 0;
WHILE (line # NIL) & (cnt <= textsize.Y) DO
WHILE (line # NIL) & (cnt < textsize.Y) DO
backColor := colors.back;
IF (line = text.curLine) & ~selected(text) THEN
G.SetColor(canvas, colors.curline);
2122,7 → 2103,7
line := firstLine;
SetColor(colors.numtext, colors.numback);
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
IF text.numbers THEN
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
2147,7 → 2128,7
cnt := 0;
line := firstLine;
lastLine := line;
WHILE (line # NIL) & (cnt <= textsize.Y) DO
WHILE (line # NIL) & (cnt < textsize.Y) DO
lastLine := line;
NextLine(line);
INC(cnt)
/programs/develop/cedit/SRC/Timer.ob07
50,7 → 50,7
IF enabled THEN
DEC(cnt, step);
IF cnt <= 0 THEN
KOSAPI.sysfunc5(60, 2, mainTID, SYSTEM.ADR(msg[0]), msg[1]);
K.SendIPC(mainTID, msg);
cnt := time
END
END
/programs/develop/cedit/SRC/Utils.ob07
200,7 → 200,7
IF cap8(s[i]) THEN
END;
DEC(i)
END;
END
END upcase;
 
 
240,6 → 240,20
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;
VAR
i, temp: INTEGER;
262,8 → 276,7
 
IF isDigit(s[i]) THEN
REPEAT
temp := temp * 10;
temp := temp + (ORD(s[i]) - ORD("0"));
temp := temp*10 + ORD(s[i]) - ORD("0");
INC(i)
UNTIL ~isDigit(s[i]);
IF neg THEN
/programs/develop/cedit/SRC/scroll.ob07
296,21 → 296,23
VAR
c: INTEGER;
BEGIN
IF scroll.Slider # -1 THEN
IF scroll.vertical THEN
c := y - scroll.top
ELSE
c := x - scroll.left
END;
setPos(scroll, scroll.pos0 + c - scroll.Slider);
paint(scroll)
END
IF scroll.vertical THEN
c := y - scroll.top
ELSE
c := x - scroll.left
END;
setPos(scroll, scroll.pos0 + c - scroll.Slider);
paint(scroll)
END MouseMove;
 
 
PROCEDURE SendIPC;
VAR
msg: ARRAY 2 OF INTEGER;
BEGIN
K.SendIPC(K.ThreadID(), ScrollIPC)
msg[0] := ScrollIPC;
msg[1] := 8;
K.SendIPC(K.ThreadID(), msg)
END SendIPC;
 
 
342,33 → 344,31
VAR
c, size: INTEGER;
BEGIN
IF ~scroll.mouse THEN
DEC(x, scroll.left);
DEC(y, scroll.top);
scroll.mouse := TRUE;
IF U.between(1, x, scroll.width - 2) & U.between(1, y, scroll.height - 2) THEN
IF scroll.vertical THEN
c := y;
size := scroll.height
ELSE
c := x;
size := scroll.width
END;
IF U.between(scroll.btnSize + scroll.pos - 1, c, scroll.btnSize + scroll.pos + scroll.sliderSize - 1) THEN
scroll.pos0 := scroll.pos;
scroll.Slider := c
ELSIF U.between(0, c, scroll.btnSize - 1) THEN
scroll.Dec := TRUE;
SendIPC
ELSIF U.between(size - scroll.btnSize, c, size - 1) THEN
scroll.Inc := TRUE;
SendIPC
ELSE
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
scroll.pos0 := scroll.pos;
scroll.Slider := c;
paint(scroll)
END
DEC(x, scroll.left);
DEC(y, scroll.top);
scroll.mouse := TRUE;
IF U.between(1, x, scroll.width - 2) & U.between(1, y, scroll.height - 2) THEN
IF scroll.vertical THEN
c := y;
size := scroll.height
ELSE
c := x;
size := scroll.width
END;
IF U.between(scroll.btnSize + scroll.pos - 1, c, scroll.btnSize + scroll.pos + scroll.sliderSize - 1) THEN
scroll.pos0 := scroll.pos;
scroll.Slider := c
ELSIF U.between(0, c, scroll.btnSize - 1) THEN
scroll.Dec := TRUE;
SendIPC
ELSIF U.between(size - scroll.btnSize, c, size - 1) THEN
scroll.Inc := TRUE;
SendIPC
ELSE
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
scroll.pos0 := scroll.pos;
scroll.Slider := c;
paint(scroll)
END
END
END MouseDown;
381,8 → 381,11
BEGIN
K.mouse(msState, x, y);
IF 0 IN msState THEN
MouseDown(scroll, x, y);
MouseMove(scroll, x, y)
IF ~scroll.mouse THEN
MouseDown(scroll, x, y)
ELSIF scroll.Slider # -1 THEN
MouseMove(scroll, x, y)
END
ELSIF scroll.mouse THEN
MouseUp(scroll);
paint(scroll)