Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9914 → Rev 9915

/programs/develop/cedit/CEDIT
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programs/develop/cedit/SHORTCUT.TXT
42,6 → 42,8
F9 выполнить
ctrl+F8 отладка
 
shift+wheel горизонтальная прокрутка
 
перемещение по тексту:
(ctrl+)Home, (ctrl+)End, (ctrl+)PageUp, (ctrl+)PageDown
ctrl+Left, ctrl+Right
/programs/develop/cedit/SRC/CEdit.ob07
28,7 → 28,7
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
 
CONST
HEADER = "CEdit (13-apr-2023)";
HEADER = "CEdit (07-may-2023)";
 
ShellFilter = "";
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
169,7 → 169,7
SHIFT = Menu.SHIFT;
CTRL = Menu.CTRL;
 
ClippingArea = 50;
ClippingArea = 32 + T.LineSpacing;
 
 
VAR
354,7 → 354,11
T.getSelCnt(text, chars, lines);
SB.setWidth(canvas.width + scrollWidth);
SB.setPos(line, col);
SB.setSel(chars, lines);
IF text.foundSel # 0 THEN
SB.setSel("", text.foundCur, text.foundCnt, " / ")
ELSE
SB.setSel("sel: ", chars, lines, " | ")
END;
SB.setEnc(E.eolNames[T.getEol(text)], E.names[T.getEnc(text)]);
SB.draw(LEFT, height - BOTTOM + scrollWidth - 1);
Tabs.modify(tabs, getIdx(text), text.modified)
1945,6 → 1949,7
msState: SET;
scroll, x, y, scrollX, scrollY: INTEGER;
pos1, pos2: T.tPoint;
shift, ctrl: BOOLEAN;
 
 
PROCEDURE EditBox (VAR eb: EB.tEditBox);
1969,7 → 1974,12
END;
scroll := K.Scroll();
IF scroll # 0 THEN
T.scroll(text, 0, scroll*3);
K.getKBState(shift, ctrl);
IF shift THEN
T.scroll(text, scroll*3, 0)
ELSE
T.scroll(text, 0, scroll*3)
END;
repaint
END;
IF leftButton THEN
/programs/develop/cedit/SRC/StatusBar.ob07
1,5 → 1,5
(*
Copyright 2021, 2022 Anton Krotov
Copyright 2021-2023 Anton Krotov
 
This file is part of CEdit.
 
50,16 → 50,16
END setPos;
 
 
PROCEDURE setSel* (chars, lines: INTEGER);
PROCEDURE setSel* (text: ARRAY OF WCHAR; first, second: INTEGER; delimiter: ARRAY OF WCHAR);
VAR
s1, s2: tString;
BEGIN
IF chars # 0 THEN
s1 := "sel: ";
U.int2str(chars, s2);
IF first # 0 THEN
s1 := text;
U.int2str(first, s2);
U.append(s1, s2);
U.append(s1, " | ");
U.int2str(lines, s2);
U.append(s1, delimiter);
U.int2str(second, s2);
U.append(s1, s2);
SB.sel := s1
ELSE
/programs/develop/cedit/SRC/Text.ob07
40,7 → 40,7
mark_width = 2;
pad_left = mark_width + 3;
pad_top = 1;
inter = 2;
LineSpacing* = 2;
 
 
TYPE
74,7 → 74,7
lang*: INTEGER;
enc, eol: INTEGER;
foundList: List.tList;
foundSel: INTEGER;
foundSel*, foundCur*, foundCnt*: INTEGER;
searchText: tString;
LinesVector: Lines.tVector;
chLog*: ChangeLog.tLog;
2389,8 → 2389,8
IF ~((scrollY > cursor.Y) OR (scrollY + textsize.Y + 1 <= cursor.Y) OR
(scrollX > cursor.X) OR (scrollX + textsize.X <= cursor.X)) THEN
x := (cursor.X - scrollX)*charWidth + padding.left;
y1 := (cursor.Y - scrollY)*charHeight + padding.top + (inter DIV 2 + 1);
y2 := y1 + charHeight - (inter + 2);
y1 := (cursor.Y - scrollY)*charHeight + padding.top + (LineSpacing DIV 2 + 1);
y2 := y1 + charHeight - (LineSpacing + 2);
G.notVLine(canvas, x, y1, y2);
G.notVLine(canvas, x - 1, y1, y2)
END
2409,7 → 2409,8
pos := MAX((selBeg - text.scroll.X), 0);
x := pos*charWidth + padding.left;
G.SetColor(canvas, colors.selback);
G.FillRect(canvas, x - 1, y - inter DIV 2, x + Len*charWidth, y - inter DIV 2 + charHeight);
G.FillRect(canvas, x - 1, y - LineSpacing DIV 2,
x + Len*charWidth, y - LineSpacing DIV 2 + charHeight);
G.TextOut(canvas, pos*charWidth + padding.left, y, Lines.getPChar(line, firstCharIdx), Len, colors.seltext)
END drawSelect;
 
2485,7 → 2486,7
setPadding(pad_left + wNum*2, padding.top)
END;
getSelect(text, selBeg, selEnd);
y := padding.top + inter DIV 2;
y := padding.top + LineSpacing DIV 2;
n := text.scroll.Y;
firstLine := getLine2(text, n);
 
2494,7 → 2495,8
cnt := textsize.Y;
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);
G.FillRect(canvas, padding.left - 2, y - LineSpacing DIV 2,
size.X - 1, y - LineSpacing DIV 2 + charHeight);
n := text.cursor.Y
ELSE
line := firstLine;
2505,7 → 2507,8
backColor := colors.back;
IF (line = text.curLine) & ~selected(text) THEN
G.SetColor(canvas, colors.curline);
G.FillRect(canvas, padding.left - 2, y - inter DIV 2, size.X - 1, y - inter DIV 2 + charHeight);
G.FillRect(canvas, padding.left - 2, y - LineSpacing DIV 2,
size.X - 1, y - LineSpacing DIV 2 + charHeight);
backColor := colors.curline
END;
SetColor(colors.text, backColor);
2524,7 → 2527,7
ELSIF (selBeg.Y # n) & (selEnd.Y = n) THEN
drawSelect(text, line, 0, selEnd.X, y)
END;
mark(line, y - inter DIV 2);
mark(line, y - LineSpacing DIV 2);
NextLine(line);
INC(y, charHeight);
INC(n);
2535,7 → 2538,7
G.FillRect(canvas, 0, 0, padding.left - pad_left (*+ 1*), size.Y - 1);
line := firstLine;
SetColor(colors.numtext, colors.numback);
y := padding.top + inter DIV 2;
y := padding.top + LineSpacing DIV 2;
n := MIN(text.scroll.Y + textsize.Y + 1, text.count);
FOR i := text.scroll.Y + 1 TO n DO
IF lineNumbers THEN
2544,13 → 2547,14
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
ELSE
G.SetColor(canvas, colors.numtext);
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum DIV (1 + ORD(i MOD 5 # 0)), xNum)
G.HLine(canvas, y - LineSpacing DIV 2 + charHeight DIV 2,
xNum - wNum DIV (1 + ORD(i MOD 5 # 0)), xNum)
END
END;
IF line.label THEN
FOR x := wNum DIV 2 TO (padding.left - pad_left) - wNum DIV 2 DO
G.notVLine(canvas, x, y, y + charHeight - (inter + 1));
G.xorVLine(canvas, x, y, y + charHeight - (inter + 1))
G.notVLine(canvas, x, y, y + charHeight - (LineSpacing + 1));
G.xorVLine(canvas, x, y, y + charHeight - (LineSpacing + 1))
END
END;
NextLine(line);
2569,7 → 2573,7
p := text.foundList.first(Search.tPos);
pos := Search.next(p, i);
WHILE pos # -1 DO
y := padding.top + inter DIV 2;
y := padding.top + LineSpacing DIV 2;
IF text.smallMove THEN
y := y + charHeight*(text.cursor.Y - text.scroll.Y)
END;
2587,7 → 2591,7
n := LENGTH(text.searchText)*charWidth;
WHILE n > 0 DO
IF x >= padding.left THEN
G.notVLine(canvas, x, y, y + charHeight - inter)
G.notVLine(canvas, x, y, y + charHeight - LineSpacing)
END;
INC(x);
DEC(n)
2601,11 → 2605,11
 
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;
y := (text.cursor.Y - text.scroll.Y)*charHeight + padding.top + LineSpacing DIV 2;
n := text.foundSel*charWidth;
WHILE n > 0 DO
IF x >= padding.left THEN
G.xorVLine(canvas, x, y, y + charHeight - inter)
G.xorVLine(canvas, x, y, y + charHeight - LineSpacing)
END;
INC(x);
DEC(n)
2689,7 → 2693,7
BEGIN
canvas := _canvas;
charWidth := _canvas.font.width;
charHeight := _canvas.font.height + inter
charHeight := _canvas.font.height + LineSpacing
END setCanvas;
 
 
2766,7 → 2770,7
cursorPos, x, y, X, Y, Len: INTEGER;
line: tLine;
res: BOOLEAN;
pos, i, pos0: INTEGER;
pos, i, pos0, first, last, num, cnt: INTEGER;
p: Search.tPos;
BEGIN
X := text.cursor.X;
2774,16 → 2778,47
text.cursor.X := MIN(text.cursor.X, text.curLine.length);
cursorPos := text.curLine.pos + text.cursor.X - ORD(prev) - ORD(~prev & (text.foundSel = 0));
pos0 := -1;
 
cnt := 0;
IF text.foundList.count # 0 THEN
p := text.foundList.first(Search.tPos);
first := p.pos[0];
WHILE p # NIL DO
INC(cnt, p.cnt);
p := p.next(Search.tPos)
END;
p := text.foundList.last(Search.tPos);
last := p.pos[p.cnt - 1]
ELSE
first := -1;
last := -1
END;
text.foundCnt := cnt;
 
num := 1;
i := 0;
p := text.foundList.first(Search.tPos);
pos := Search.next(p, i);
WHILE (pos # -1) & (pos <= cursorPos) DO
pos0 := pos;
pos := Search.next(p, i)
pos := Search.next(p, i);
INC(num)
END;
IF prev THEN
pos := pos0
pos := pos0;
DEC(num)
END;
 
IF pos = -1 THEN
IF prev THEN
pos := last;
num := cnt
ELSE
pos := first;
num := 1
END
END;
 
res := pos # -1;
IF res THEN
y := 0;
2806,9 → 2841,11
text.scroll.X := MAX(x - 3, 0)
END;
SetPos(text, x, y);
text.foundSel := Len
text.foundSel := Len;
text.foundCur := num
ELSE
SetPos(text, X, Y)
SetPos(text, X, Y);
text.foundCur := 0
END
RETURN res
END findNext;