Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9667 → Rev 9668

/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,7 → 28,7
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
 
CONST
HEADER = "CEdit (20-jan-2022)";
HEADER = "CEdit (25-jan-2022)";
 
ShellFilter = "";
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
35,7 → 35,6
 
fontWidth = K.fontWidth;
fontHeight = K.fontHeight;
scrollWidth = 22;
 
btnClose = 1;
 
67,8 → 66,6
toolbarTop = Menu.MainMenuHeight + 3;
 
TOP = toolbarTop + Toolbar.BtnSize + 10 + Tabs.tabHeight;
RIGHT = scrollWidth - 2;
BOTTOM = scrollWidth + 18;
 
minWinWidth = 635; minWinHeight = 550;
 
111,7 → 108,9
menuExit = 17;
 
menuNumbers = 20;
menuFontSize = 21;
menuFontSmall = 21;
menuFontMedium = 22;
menuFontBig = 23;
menuColors = 1000;
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
 
176,7 → 175,7
VAR
header: RW.tFileName;
canvas: G.tCanvas;
font, font1, font2: G.tFont;
font: G.tFont;
 
tabs: Tabs.tTabs;
text: T.tText;
184,7 → 183,7
textsCount, curText: INTEGER;
 
winWidth, winHeight: INTEGER;
SkinHeight: INTEGER;
SkinHeight, scrollWidth: INTEGER;
AppPath, runScript, buildScript, debugScript, CurFolder: RW.tFileName;
OD: OpenDlg.Dialog;
confirm, notFound, menuFindClicked, search, searchOpened: BOOLEAN;
191,7 → 190,7
 
switch, closing: BOOLEAN;
leftButton: BOOLEAN;
LEFT: INTEGER;
LEFT, RIGHT, BOTTOM: INTEGER;
 
FindEdit, ReplaceEdit, GotoEdit: EB.tEditBox;
hScroll, vScroll: Scroll.tScroll;
370,6 → 369,14
END DrawScroll;
 
 
PROCEDURE drawText;
BEGIN
G.SetColor(canvas, K.colors.line);
G.VLine(canvas, 0, 0, canvas.height - 1);
G.DrawCanvas(canvas, LEFT, TOP)
END drawText;
 
 
PROCEDURE repaint;
VAR
width, height, scrollX, scrollY: INTEGER;
403,10 → 410,7
CheckBox.draw(CS);
CheckBox.draw(WH);
END;
 
G.SetColor(canvas, K.colors.line);
G.VLine(canvas, 0, 0, canvas.height - 1);
G.DrawCanvas(canvas, LEFT, TOP);
drawText;
NotFound;
Replaced;
Toolbar.enable(toolbar, btnSave, text.modified);
435,6 → 439,12
K.SetWinSize(winWidth, winHeight);
K.WinSize(winWidth, winHeight);
K.ClientSize(cliWidth, cliHeight);
IF font # G.font2 THEN
SB.SetFont(font)
ELSE
SB.SetFont(G.font1)
END;
BOTTOM := SB.height() + scrollWidth - 1;
G.destroy(canvas);
canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), cliHeight - (TOP + BOTTOM + 1));
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), Tabs.tabHeight);
1041,7 → 1051,9
INC(x, menuEncodingX)
ELSIF menu = menuView THEN
Menu.check(menu, menuNumbers, text.numbers);
Menu.check(menu, menuFontSize, font = font2);
Menu.option(menu, menuFontSmall, font = G.font0);
Menu.option(menu, menuFontMedium, font = G.font1);
Menu.option(menu, menuFontBig, font = G.font2);
FOR i := 0 TO Ini.sections.count - 1 DO
Menu.option(menu, menuColors + i, Ini.curSectionNum = i)
END;
1165,13 → 1177,15
T.gotoLabel(text, FALSE)
|menuNumbers:
T.toggleNumbers(text)
|menuFontSize:
IF font = font1 THEN
font := font2
ELSE
font := font1
END;
|menuFontSmall:
font := G.font0;
resize
|menuFontMedium:
font := G.font1;
resize
|menuFontBig:
font := G.font2;
resize
|menuText:
T.setLang(text, Languages.langText)
|menuC:
1359,8 → 1373,11
BEGIN
menu := List.create(NIL);
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
Menu.AddMenuItem(menu, menuFontSize, "x2");
Menu.delimiter(menu);
Menu.AddMenuItem(menu, menuFontSmall, "small");
Menu.AddMenuItem(menu, menuFontMedium, "medium");
Menu.AddMenuItem(menu, menuFontBig, "big");
Menu.delimiter(menu);
 
colors := Ini.sections.first(Ini.tSection);
idx := menuColors;
1763,11 → 1780,13
goto
END;
 
IF ~middle THEN
IF exit THEN
Close
ELSE
repaint
END
END
END BtnClick;
 
 
1921,6 → 1940,7
firstClickX, firstClickY, time, blink, i: INTEGER;
key, scr: INTEGER;
BEGIN
font := G.font1;
header := "";
K.GetSystemColors;
switch := FALSE;
1932,6 → 1952,7
leftButton := FALSE;
resized := FALSE;
K.ScreenSize(winWidth, winHeight);
scrollWidth := winHeight DIV 35;
winWidth := (winWidth*80) DIV 100 - (128 + 30);
winHeight := winHeight - (128 + 30);
winWidth := MAX(winWidth, minWinWidth);
1938,14 → 1959,14
winHeight := MAX(winHeight, minWinHeight);
cliWidth := winWidth;
cliHeight := winHeight;
 
LEFT := LEFT_PADDING;
RIGHT := scrollWidth - 2;
BOTTOM := SB.height() + scrollWidth - 1;
SkinHeight := K.SkinHeight();
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - SkinHeight);
tabs := Tabs.create();
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight);
font1 := G.CreateFont(1, "", {});
font2 := G.CreateFont(2, "", {});
font := font1;
G.SetFont(canvas, font);
T.init(resetTimer);
T.setCanvas(canvas);
2050,8 → 2071,8
CurrentTime := K.GetTickCount();
IF (CurrentTime - CursorTime > blink) & (blink > 0) & timerEnabled & ~K.RolledUp() THEN
CursorTime := CurrentTime;
T.toggleCursor;
repaint
T.cursor(text);
drawText
END;
 
CASE K.EventTimeout(10) OF
/programs/develop/cedit/SRC/ChangeLog.ob07
46,7 → 46,7
 
tLog* = POINTER TO RECORD
Log*, Pointers*: List.tList;
guard: tGuard;
guard, first: tGuard;
isLast: BOOLEAN
END;
 
73,16 → 73,25
END isLastGuard;
 
 
PROCEDURE isFirstGuard* (guard: tGuard): BOOLEAN;
PROCEDURE getFirstGuard (): tGuard;
VAR
item: List.tItem;
BEGIN
ASSERT(guard # NIL);
item := CL.Log.first;
WHILE ~(item IS tGuard) DO
item := item.next
END
RETURN guard = item
RETURN item(tGuard)
END getFirstGuard;
 
 
PROCEDURE isFirstGuard* (guard: tGuard): BOOLEAN;
BEGIN
ASSERT(guard # NIL);
IF CL.first = NIL THEN
CL.first := getFirstGuard()
END
RETURN guard = CL.first
END isFirstGuard;
 
 
285,6 → 294,7
BEGIN
NEW(newLog);
newLog.guard := NIL;
newLog.first := NIL;
newLog.isLast := TRUE;
newLog.Log := List.create(NIL);
newLog.Pointers := List.create(NIL);
/programs/develop/cedit/SRC/CheckBox.ob07
82,7 → 82,7
res.mouse := FALSE;
COPY(text, res.text);
res.canvas := G.CreateCanvas(fontHeight + padding + LENGTH(res.text)*fontWidth, fontHeight + 1);
G.SetFont(res.canvas, G.CreateFont(1, "", {}));
G.SetFont(res.canvas, G.font1);
chkbox := res
END create;
 
/programs/develop/cedit/SRC/Graph.ob07
19,7 → 19,7
 
MODULE Graph;
 
IMPORT SYSTEM, KOSAPI, Lines, Languages;
IMPORT SYSTEM, KOSAPI, Lines, Languages, E := Encodings;
 
CONST
 
39,6 → 39,7
height*: INTEGER;
width*: INTEGER;
size: INTEGER;
flags: INTEGER;
name*: ARRAY 256 OF WCHAR
END;
 
50,7 → 51,11
mode: INTEGER
END;
 
VAR
 
font0*, font1*, font2*: tFont;
 
 
PROCEDURE getRGB* (color: INTEGER; VAR r, g, b: BYTE);
BEGIN
b := color MOD 256;
83,15 → 88,26
END SetBkColor;
 
 
PROCEDURE CreateFont* (height: INTEGER; name: ARRAY OF WCHAR; attr: SET): tFont;
PROCEDURE CreateFont (size: INTEGER; name: ARRAY OF WCHAR; attr: SET): tFont;
VAR
font: tFont;
BEGIN
ASSERT(size IN {0, 1, 2});
NEW(font);
font.size := MAX(MIN(height, 8), 1);
font.width := font.size*8;
font.height := font.size*16;
DEC(font.size);
font.size := size;
IF size = 0 THEN
font.width := 6;
font.height := 9;
font.flags := 08000000H
ELSE
font.width := size*8;
font.height := size*16;
IF size = 1 THEN
font.flags := 28000000H
ELSIF size = 2 THEN
font.flags := 29000000H
END
END;
font.name := name
RETURN font
END CreateFont;
256,24 → 272,25
CONST
WCHAR_SIZE = 2;
VAR
color, i, font: INTEGER;
color, i, ch: INTEGER;
font: tFont;
c: WCHAR;
BEGIN
IF (0 <= y) & (y <= canvas.height - canvas.font.height - 1) THEN
font := canvas.font;
IF (0 <= y) & (y <= canvas.height - font.height - 1) THEN
IF x < 0 THEN
i := -(x DIV canvas.font.width);
INC(x, i*canvas.font.width);
i := -(x DIV font.width);
INC(x, i*font.width);
DEC(n, i)
ELSE
i := 0
END;
IF n > 0 THEN
n := MAX(MIN(n, (canvas.width - x) DIV canvas.font.width), 0);
n := MAX(MIN(n, (canvas.width - x) DIV font.width), 0);
color := canvas.color;
canvas.color := canvas.backColor;
FillRect(canvas, x, y, x + n*canvas.font.width, y + canvas.font.height);
FillRect(canvas, x, y, x + n*font.width, y + font.height);
canvas.color := color;
font := LSL(28H + canvas.font.size, 24);
WHILE n > 0 DO
SYSTEM.GET(text + i*WCHAR_SIZE, c);
IF ~Lines.isSpace(c) THEN
285,9 → 302,17
IF c = Lines.NUL THEN
c := 0X
END;
KOSAPI.sysfunc6(4, x*65536 + y, font + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
IF font = font0 THEN
ch := E.UNI[ORD(c), E.CP866];
IF ch = E.UNDEF THEN
c := "?"
ELSE
c := WCHR(ch)
END
END;
INC(x, canvas.font.width);
KOSAPI.sysfunc6(4, x*65536 + y, font.flags + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
END;
INC(x, font.width);
INC(i);
DEC(n)
END
322,10 → 347,14
PROCEDURE destroy* (VAR canvas: tCanvas);
BEGIN
IF canvas # NIL THEN
canvas.bitmap := KOSAPI.free(canvas.bitmap);
canvas.bitmap := KOSAPI.free(canvas.bitmap - 8);
DISPOSE(canvas)
END
END destroy;
 
 
BEGIN
font0 := CreateFont(0, "", {});
font1 := CreateFont(1, "", {});
font2 := CreateFont(2, "", {});
END Graph.
/programs/develop/cedit/SRC/Icons.ob07
56,7 → 56,7
END GetInf;
 
 
PROCEDURE GetImg* (ptr, size: INTEGER): INTEGER;
PROCEDURE GetImg (ptr, size: INTEGER): INTEGER;
VAR
image_data, dst, x, type: INTEGER;
BEGIN
133,7 → 133,7
(*ELSE
copy(source, icons);
copy(source, grayIcons)*)
END;
END
END get;
 
 
/programs/develop/cedit/SRC/Lines.ob07
45,7 → 45,13
PTypedPtr = PROCEDURE (p: List.tItem);
PUntypedPtr = PROCEDURE (p: INTEGER);
 
tVector* = POINTER TO RECORD
size, data: INTEGER
END;
 
tVectorItem = tLine;
 
 
VAR
 
_movInt: PmovInt;
58,6 → 64,57
tabs*: BOOLEAN;
 
 
PROCEDURE createVector* (size: INTEGER): tVector;
VAR
res: tVector;
BEGIN
IF size > 0 THEN
NEW(res);
res.size := size;
IF size < 4096 THEN
size := 4096
END;
res.data := API._NEW(size*SYSTEM.SIZE(tVectorItem));
IF res.data = 0 THEN
DISPOSE(res)
END
ELSE
res := NIL
END
RETURN res
END createVector;
 
 
PROCEDURE destroyVector* (VAR vector: tVector);
BEGIN
IF vector # NIL THEN
IF vector.data # 0 THEN
vector.data := API._DISPOSE(vector.data)
END;
DISPOSE(vector)
END
END destroyVector;
 
 
PROCEDURE setVectorItem* (vector: tVector; idx: INTEGER; item: tVectorItem);
BEGIN
ASSERT(vector # NIL);
ASSERT((0 <= idx) & (idx < vector.size));
SYSTEM.PUT(vector.data + idx*SYSTEM.SIZE(tVectorItem), item)
END setVectorItem;
 
 
PROCEDURE getVectorItem* (vector: tVector; idx: INTEGER): tVectorItem;
VAR
res: tVectorItem;
BEGIN
ASSERT(vector # NIL);
ASSERT((0 <= idx) & (idx < vector.size));
SYSTEM.GET(vector.data + idx*SYSTEM.SIZE(tVectorItem), res)
RETURN res
END getVectorItem;
 
 
PROCEDURE movInt (VAR v: INTEGER; x: INTEGER);
BEGIN
_movInt(v, x)
/programs/develop/cedit/SRC/List.ob07
22,7 → 22,7
TYPE
 
tItem* = POINTER TO RECORD
prev*, next*: tItem
next*, prev*: tItem
END;
 
tList* = POINTER TO RECORD
56,15 → 56,24
VAR
item: tItem;
BEGIN
IF idx < 0 THEN
IF (idx < 0) OR (idx >= list.count) THEN
item := NIL
ELSE
IF list.count DIV 2 < idx THEN
item := list.last;
idx := list.count - idx - 1;
WHILE idx > 0 DO
item := item.prev;
DEC(idx)
END
ELSE
item := list.first;
WHILE (idx > 0) & (item # NIL) DO
WHILE idx > 0 DO
item := item.next;
DEC(idx)
END
END
END
RETURN item
END getItem;
 
/programs/develop/cedit/SRC/Menu.ob07
641,7 → 641,7
END;
m.width := maxLength*fontWidth + LEFT + RIGHT;
m.height := items.count*fontHeight - 2;
m.font := G.CreateFont(1, "", {});
m.font := G.font1;
m.canvas := G.CreateCanvas(m.width + 1, m.height + 1);
G.SetFont(m.canvas, m.font);
RETURN m
/programs/develop/cedit/SRC/StatusBar.ob07
76,12 → 76,17
END setEnc;
 
 
PROCEDURE height* (): INTEGER;
RETURN font.height + 3
END height;
 
 
PROCEDURE setWidth* (width: INTEGER);
BEGIN
ASSERT(width > 0);
IF (SB.canvas = NIL) OR (SB.canvas.width # width) THEN
IF (SB.canvas = NIL) OR (SB.canvas.width # width) OR (SB.canvas.height # height()) THEN
G.destroy(SB.canvas);
SB.canvas := G.CreateCanvas(width, 19);
SB.canvas := G.CreateCanvas(width, height());
G.SetFont(SB.canvas, font)
END
END setWidth;
100,13 → 105,22
G.SetTextColor(SB.canvas, K.colors.work_text);
G.clear(SB.canvas);
TextOut(1, SB.pos);
TextOut(16*K.fontWidth, SB.sel);
TextOut(SB.canvas.width - LENGTH(SB.enc)*K.fontWidth - 1, SB.enc);
TextOut(16*font.width, SB.sel);
TextOut(SB.canvas.width - LENGTH(SB.enc)*font.width - 1, SB.enc);
G.DrawCanvas(SB.canvas, left, top)
END draw;
 
 
PROCEDURE SetFont* (_font: G.tFont);
BEGIN
font := _font;
IF SB.canvas # NIL THEN
setWidth(SB.canvas.width)
END
END SetFont;
 
 
BEGIN
SB.canvas := NIL;
font := G.CreateFont(1, "", {})
font := G.font1
END StatusBar.
/programs/develop/cedit/SRC/Text.ob07
65,7 → 65,8
cursor, select, select2: pPoint;
scroll: tPoint;
CurX: INTEGER;
modified*: BOOLEAN;
smallChange: INTEGER;
modified*, smallMove: BOOLEAN;
edition*: tGuard;
comments, numbers*, guard,
search, cs, whole: BOOLEAN;
76,6 → 77,7
foundList: List.tList;
foundSel: INTEGER;
searchText: tString;
LinesVector: Lines.tVector;
chLog*: ChangeLog.tLog;
maxLength*: INTEGER;
fileName*: RW.tFileName
155,12 → 157,6
END toggleNumbers;
 
 
PROCEDURE toggleCursor*;
BEGIN
drawCursor := ~drawCursor
END toggleCursor;
 
 
PROCEDURE showCursor*;
BEGIN
drawCursor := TRUE
223,12 → 219,46
END ProcessComments;
 
 
PROCEDURE getLine2 (text: tText; n: INTEGER): tLine;
VAR
item: tLine;
BEGIN
IF (0 <= n) & (n < text.count) THEN
item := Lines.getVectorItem(text.LinesVector, n)
ELSE
item := NIL
END
RETURN item
END getLine2;
 
 
PROCEDURE Comments (text: tText);
VAR
line: tLine;
i: INTEGER;
i, k, cout: INTEGER;
BEGIN
IF text.smallChange = 1 THEN
line := getLine2(text, text.cursor.Y);
IF line.prev # NIL THEN
line.cin := line.prev(tLine).cout
ELSE
line.cin := 0
END;
cout := line.cout;
line.cout := line.cin;
i := 0;
ProcessComments(line, line.cout, i, -1, line.length - 1, text.lang);
IF line.cout # cout THEN
text.smallChange := 0;
Comments(text)
END
ELSE
Lines.destroyVector(text.LinesVector);
text.LinesVector := Lines.createVector(text.count);
k := 0;
line := text.first(tLine);
Lines.setVectorItem(text.LinesVector, k, line);
INC(k);
line.cin := 0;
line.cout := 0;
i := 0;
235,12 → 265,16
ProcessComments(line, line.cout, i, -1, line.length - 1, text.lang);
NextLine(line);
WHILE line # NIL DO
Lines.setVectorItem(text.LinesVector, k, line);
INC(k);
line.cin := line.prev(tLine).cout;
line.cout := line.cin;
i := 0;
ProcessComments(line, line.cout, i, -1, line.length - 1, text.lang);
NextLine(line)
END
END;
text.smallChange := 0;
text.comments := FALSE
END Comments;
 
933,7 → 967,7
VAR
item: List.tItem;
BEGIN
item := List.getItem(text, n);
item := List.getItem(text, n)
RETURN item(tLine)
END getLine;
 
1110,6 → 1144,7
resetSelect(text);
curLine := text.curLine;
IF text.cursor.X > 0 THEN
INC(text.smallChange);
i := text.cursor.X;
n := leadingSpaces(curLine);
modify(text);
1236,7 → 1271,7
BEGIN
getSelect(text, selBeg, selEnd);
i := selEnd.Y - selBeg.Y + 1;
line := getLine(text, selBeg.Y);
line := getLine2(text, selBeg.Y);
modified := incr;
WHILE i > 0 DO
IF incr THEN
1247,11 → 1282,12
NextLine(line);
DEC(i)
END;
line := getLine(text, selEnd.Y);
line := getLine2(text, selEnd.Y);
text.select^ := selBeg;
text.select.X := 0;
SetPos(text, line.length, selEnd.Y);
IF modified THEN
INC(text.smallChange);
modify(text)
END
END Indent;
1293,6 → 1329,9
 
BEGIN
IF (code >= ORD(SPACE)) & (code # 127) THEN
IF ~selected(text) THEN
INC(text.smallChange)
END;
delSelect(text);
curLine := text.curLine;
Lines.insert(curLine, text.cursor.X, WCHR(code));
1309,6 → 1348,7
IF selected(text) THEN
Indent(text, TRUE)
ELSE
INC(text.smallChange);
tab(text)
END
ELSIF code = 13 THEN
1461,8 → 1501,8
BEGIN
IF selected(text) THEN
getSelect(text, selBeg, selEnd);
first := getLine(text, selBeg.Y);
last := getLine(text, selEnd.Y);
first := getLine2(text, selBeg.Y);
last := getLine2(text, selEnd.Y);
lines := selEnd.Y - selBeg.Y + 1;
 
IF lines > 1 THEN
1505,7 → 1545,7
BEGIN
getSelect(text, selBeg, selEnd);
 
first := getLine(text, selBeg.Y);
first := getLine2(text, selBeg.Y);
line := first;
 
n := selEnd.Y - selBeg.Y;
1697,6 → 1737,7
END;
 
IF Lines.chCase(line, i + 1, text.cursor.X - 1, upper) THEN
INC(text.smallChange);
modify(text)
END
END changeCase;
1712,7 → 1753,7
modified := FALSE;
IF selected(text) THEN
getSelect(text, selBeg, selEnd);
first := getLine(text, selBeg.Y);
first := getLine2(text, selBeg.Y);
line := first;
cnt := selEnd.Y - selBeg.Y;
IF cnt = 0 THEN
1737,6 → 1778,7
END
END;
IF modified THEN
INC(text.smallChange);
modify(text)
END
END chCase;
1757,6 → 1799,7
 
PROCEDURE delLine* (text: tText);
BEGIN
text.smallChange := 2;
resetSelect(text);
IF text.curLine.length > 0 THEN
Lines.delCharN(text.curLine, 0, text.curLine.length)
1905,6 → 1948,9
str := ""
END
END;
IF text.searchText # str THEN
text.smallMove := FALSE
END;
IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END
END wordSel;
 
1934,12 → 1980,16
PROCEDURE key* (text: tText; code: INTEGER; shift, ctrl: BOOLEAN);
VAR
n, wPos: INTEGER;
scrX, scrY: INTEGER;
resSel: BOOLEAN;
BEGIN
resSel := FALSE;
IF shift THEN
setSelect(text)
ELSE
IF (33 <= code) & (code <= 40) THEN
IF ~(((code = 38) OR (code = 40)) & ctrl) THEN
resSel := selected(text);
resetSelect(text)
END
END
1980,6 → 2030,8
IF (text.cursor.X = 0) & (text.curLine.prev # NIL) THEN
SetPos(text, text.curLine.prev(tLine).length, text.cursor.Y - 1)
ELSE
scrX := text.scroll.X;
scrY := text.scroll.Y;
IF ctrl THEN
wPos := 0;
REPEAT
1989,8 → 2041,9
move(text, n - text.cursor.X)
ELSE
move(text, -1)
END;
text.smallMove := (scrX = text.scroll.X) & (scrY = text.scroll.Y) & ~resSel
END
END
|38:
IF ctrl THEN
MoveLines(text, FALSE)
2001,12 → 2054,15
IF (text.cursor.X = text.curLine.length) & (text.curLine.next # NIL) THEN
SetPos(text, 0, text.cursor.Y + 1)
ELSE
scrX := text.scroll.X;
scrY := text.scroll.Y;
IF ctrl THEN
move(text, getWordPos(text.curLine, text.cursor.X) - text.cursor.X)
ELSE
move(text, 1)
END;
text.smallMove := (scrX = text.scroll.X) & (scrY = text.scroll.Y) & ~resSel
END
END
|40:
IF ctrl THEN
MoveLines(text, TRUE)
2017,6 → 2073,9
IF ctrl THEN
delLine(text)
ELSE
IF ~selected(text) & (text.cursor.X < text.curLine.length) THEN
INC(text.smallChange)
END;
delete(text);
ShowCursor
END
2103,11 → 2162,12
END selectWord;
 
 
PROCEDURE cursor (text: tText);
PROCEDURE cursor* (text: tText);
VAR
x, y1, y2, scrollX, scrollY: INTEGER;
cursor: pPoint;
BEGIN
IF drawCursor THEN
cursor := text.cursor;
scrollX := text.scroll.X;
scrollY := text.scroll.Y;
2119,6 → 2179,7
G.notVLine(canvas, x, y1, y2);
G.notVLine(canvas, x - 1, y1, y2)
END
END
END cursor;
 
 
2168,7 → 2229,7
 
PROCEDURE draw* (text: tText);
VAR
y, n, Len, cnt, i, x: INTEGER;
y, n, cnt, i, x: INTEGER;
line, firstLine, lastLine: tLine;
selBeg, selEnd: tPoint;
s: ARRAY 12 OF WCHAR;
2176,10 → 2237,10
p: Search.tPos;
guard: tGuard;
BEGIN
IF text.search & search(text, text.searchText, text.cs, text.whole) THEN END;
IF (text.lang # Lang.langText) & text.comments THEN
IF text.comments THEN
Comments(text)
END;
IF text.search & search(text, text.searchText, text.cs, text.whole) THEN END;
IF text.guard THEN
NEW(guard);
List.append(ChangeLog.CL.Log, guard);
2197,7 → 2258,9
guard.selected := text.select = text.select2;
 
G.SetColor(canvas, colors.back);
G.clear(canvas);
IF ~text.smallMove THEN
G.clear(canvas)
END;
wNum := charWidth;
IF text.numbers THEN
numWidth := U.lg10(text.count) + 2;
2209,9 → 2272,19
getSelect(text, selBeg, selEnd);
y := padding.top + inter DIV 2;
n := text.scroll.Y;
line := getLine(text, n);
firstLine := line;
cnt := 0;
firstLine := getLine2(text, n);
IF text.smallMove THEN
line := text.curLine;
cnt := textsize.Y - 1;
y := y + charHeight*(text.cursor.Y - text.scroll.Y);
G.SetColor(canvas, colors.back);
G.FillRect(canvas, padding.left - 2, y - inter DIV 2, size.X - 1, y - inter DIV 2 + charHeight);
n := text.cursor.Y
ELSE
line := firstLine;
cnt := 0
END;
 
WHILE (line # NIL) & (cnt < textsize.Y) DO
backColor := colors.back;
IF (line = text.curLine) & ~selected(text) THEN
2220,15 → 2293,15
backColor := colors.curline
END;
SetColor(colors.text, backColor);
Len := MAX(line.length - text.scroll.X, 0);
G.TextOut(canvas, padding.left, y, Lines.getPChar(line, text.scroll.X), MIN(Len, textsize.X + 1), colors.delim);
IF (selBeg.Y < n) & (n < selEnd.Y) THEN
drawSelect(text, line, 0, line.length, y)
ELSE
G.TextOut(canvas, padding.left, y, Lines.getPChar(line, text.scroll.X), MIN(MAX(line.length - text.scroll.X, 0), textsize.X + 1), colors.delim);
IF text.lang # Lang.langText THEN
parse(text, line, y, backColor, text.lang)
END
END;
mark(line, y - inter DIV 2);
IF (selBeg.Y < n) & (n < selEnd.Y) THEN
drawSelect(text, line, 0, line.length, y)
ELSIF (selBeg.Y = n) & (selEnd.Y = n) & (selBeg.X # selEnd.X) THEN
IF (selBeg.Y = n) & (selEnd.Y = n) & (selBeg.X # selEnd.X) THEN
drawSelect(text, line, selBeg.X, selEnd.X, y)
ELSIF (selBeg.Y = n) & (selEnd.Y # n) THEN
drawSelect(text, line, selBeg.X, line.length, y)
2235,11 → 2308,13
ELSIF (selBeg.Y # n) & (selEnd.Y = n) THEN
drawSelect(text, line, 0, selEnd.X, y)
END;
mark(line, y - inter DIV 2);
NextLine(line);
INC(y, charHeight);
INC(n);
INC(cnt)
END;
 
G.SetColor(canvas, colors.numback);
G.FillRect(canvas, 0, 0, padding.left - pad_left (*+ 1*), size.Y - 1);
line := firstLine;
2267,17 → 2342,18
END;
 
IF text.searchText # "" THEN
cnt := 0;
line := firstLine;
lastLine := line;
WHILE (line # NIL) & (cnt < textsize.Y) DO
lastLine := line;
NextLine(line);
INC(cnt)
IF text.smallMove THEN
firstLine := text.curLine;
lastLine := firstLine
ELSE
lastLine := getLine2(text, text.scroll.Y + textsize.Y - 1)
END;
p := text.foundList.first(Search.tPos);
WHILE p # NIL DO
y := padding.top + inter DIV 2;
IF text.smallMove THEN
y := y + charHeight*(text.cursor.Y - text.scroll.Y)
END;
IF (firstLine.pos <= p.pos) & (p.pos <= lastLine.pos + lastLine.length) THEN
line := firstLine;
WHILE (line.pos <= p.pos) & (line # lastLine) DO
2296,12 → 2372,14
END;
INC(x);
DEC(n)
END
END;
END;
p := p.next(Search.tPos)
END
END;
 
text.smallMove := FALSE;
 
IF text.foundSel > 0 THEN
x := (text.cursor.X - text.scroll.X)*charWidth + padding.left;
y := (text.cursor.Y - text.scroll.Y)*charHeight + padding.top + inter DIV 2;
2314,10 → 2392,7
DEC(n)
END
END;
 
IF drawCursor THEN
cursor(text)
END
END draw;
 
 
2346,6 → 2421,7
setPadding(padding.left, padding.top);
text.curLine := NIL;
text.modified := FALSE;
text.smallMove := FALSE;
text.comments := TRUE;
text.search := TRUE;
text.cs := FALSE;
2357,7 → 2433,9
text.searchText := "";
text.foundSel := 0;
text.CurX := -1;
text.smallChange := 0;
text.lang := Lang.langText;
text.LinesVector := NIL;
Lang.setCurLang(Lang.langText);
setName(text, fileName);
ASSERT(text = List.create(text))
2408,6 → 2486,7
BEGIN
IF search(text, "", FALSE, FALSE) THEN END;
ChangeLog.destroy(text.chLog);
Lines.destroyVector(text.LinesVector);
DISPOSE(text.foundList);
DISPOSE(text.cursor);
DISPOSE(text.select2);
2450,12 → 2529,10
RW.destroy(file);
text.curLine := text.first(tLine);
SetPos(text, 0, 0);
resetSelect(text)
resetSelect(text);
Comments(text)
ELSE
errno := 1
END;
IF (text # NIL) & (text.lang # Lang.langText) THEN
Comments(text)
END
RETURN text
END open;