Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9059 → Rev 9060

/programs/develop/cedit/CEDIT
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programs/develop/cedit/README.TXT
9,7 → 9,7
ctrl+F показать панель поиска
Esc скрыть панель поиска
F3 найти следующий
Shift+F3 найти предыдущий
shift+F3 найти предыдущий
ctrl+Z отменить
ctrl+Y вернуть
ctrl+G перейти на строку...
18,9 → 18,15
ctrl+Up переместить строку вверх
ctrl+Down переместить строку вниз
 
ctrl+F2 установить/снять метку
F2 перейти к метке ниже
shift+F2 перейти к метке выше
 
ctrl+S сохранить
ctrl+O открыть
ctrl+N создать новый
ctrl+W закрыть файл
ctrl+Tab переключиться на следующую вкладку
 
ctrl+F9 компилировать
F9 выполнить
/programs/develop/cedit/SRC/CEdit.ob07
28,7 → 28,7
RW, Ini, box_lib, Icons, Tabs;
 
CONST
header = "CEdit (10-jul-2021)";
header = "CEdit (12-jul-2021)";
 
ShellFilter = "";
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI";
428,7 → 428,7
G.SetFont(canvas, font);
T.setCanvas(canvas);
T.resize(canvas.width, canvas.height);
Scroll.resize(vScroll, vScroll.xSize, canvas.height - scrollWidth*2 + 1);
Scroll.resize(vScroll, vScroll.xSize, canvas.height - scrollWidth*2 + 2);
Scroll.resize(hScroll, canvas.width - scrollWidth*2, hScroll.ySize);
END resize;
 
437,6 → 437,7
VAR
y, right, bottom, color: INTEGER;
BEGIN
DEC(top, Tabs.tabHeight);
right := left + EditBox_Width + SEARCH_PADDING*2;
bottom := top + 395 + btnHeight + SEARCH_PADDING;
color := K.borderColor;
571,7 → 572,7
 
toolbarIcons;
 
K.CreateButton(btnUp, LEFT + canvas.width - 1, TOP, scrollWidth - 1, scrollWidth, K.btnColor, 0X);
K.CreateButton(btnUp, LEFT + canvas.width - 1, TOP - 1, scrollWidth - 1, scrollWidth, K.btnColor, 0X);
K.DrawText69(LEFT + canvas.width - 1 + (scrollWidth - 6) DIV 2, TOP + (scrollWidth - 9) DIV 2, K.btnTextColor, 18X);
K.CreateButton(btnDown, LEFT + canvas.width - 1, TOP + canvas.height - scrollWidth - 1, scrollWidth - 1, scrollWidth, K.btnColor, 0X);
K.DrawText69(LEFT + canvas.width - 1 + (scrollWidth - 6) DIV 2, TOP + canvas.height - scrollWidth + (scrollWidth - 9) DIV 2, K.btnTextColor, 19X);
581,7 → 582,7
K.CreateButton(btnRight, LEFT + canvas.width - scrollWidth - 1, TOP + canvas.height - 1, scrollWidth, scrollWidth - 1, K.btnColor, 0X);
K.DrawText69(LEFT + canvas.width - scrollWidth - 1 + (scrollWidth - 6) DIV 2, TOP + canvas.height - 1 + (scrollWidth - 9) DIV 2 + 1, K.btnTextColor, 1AX);
 
K.PutPixel(LEFT + canvas.width + scrollWidth - 2, TOP, K.winColor);
K.PutPixel(LEFT + canvas.width + scrollWidth - 2, TOP - 1, K.winColor);
K.PutPixel(LEFT, TOP + canvas.height + scrollWidth - 2, K.winColor);
 
DrawState(text, width, height);
787,7 → 788,7
END Confirm;
 
 
PROCEDURE closeFile (conf: BOOLEAN);
PROCEDURE closeFile (conf: BOOLEAN; n: INTEGER);
VAR
i: INTEGER;
BEGIN
794,12 → 795,12
IF text.modified & conf THEN
Confirm
ELSE
Tabs.delete(tabs, curText);
FOR i := curText + 1 TO textsCount - 1 DO
Tabs.delete(tabs, n);
FOR i := n + 1 TO textsCount - 1 DO
texts[i - 1] := texts[i]
END;
DEC(textsCount);
IF curText = textsCount THEN
IF (curText = textsCount) OR (n < curText) THEN
DEC(curText)
END;
IF curText >= 0 THEN
1000,7 → 1001,7
Confirm;
cont := FALSE
ELSE
closeFile(FALSE);
closeFile(FALSE, curText);
repaint
END
END
1057,7 → 1058,7
saveAll;
repaint
|menuClose:
closeFile(TRUE)
closeFile(TRUE, curText)
|menuFolder:
K.Run("/rd/1/File Managers/Eolite", text.fileName)
|menuExit:
1145,6 → 1146,7
getKBState;
IF (T.CTRL IN shift) THEN
CASE key DIV 65536 OF
|17: menuItem := menuClose
|21: menuItem := menuRedo
|30: menuItem := menuSelectAll
|33: menuItem := menuSearch
1207,7 → 1209,7
Menu.AddMenuItem(menu, menuSaveAll, "save all");
Menu.AddMenuItem(menu, menuFolder, "folder");
Menu.delimiter(menu);
Menu.AddMenuItem(menu, menuClose, "close");
Menu.AddMenuItem(menu, menuClose, "close ctrl-W");
Menu.delimiter(menu);
Menu.AddMenuItem(menu, menuExit, "exit");
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
1422,7 → 1424,7
err: INTEGER;
fileName, filePath: RW.tFileName;
cliWidth, cliHeight: INTEGER;
resized: BOOLEAN;
resized, middle: BOOLEAN;
firstClickX, firstClickY, time: INTEGER;
BEGIN
K.GetSystemColors;
1480,7 → 1482,7
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
insert(0, text);
 
vScroll := Scroll.create(scrollWidth, canvas.height - scrollWidth*2 + 1);
vScroll := Scroll.create(scrollWidth, canvas.height - scrollWidth*2 + 2);
hScroll := Scroll.create(canvas.width - scrollWidth*2, scrollWidth);
T.resize(canvas.width, canvas.height);
T.SetPos(text, 0, 0);
1526,7 → 1528,7
IF key DIV 65536 = 28 THEN (* Enter *)
save(text);
IF ~text.modified THEN
closeFile(FALSE)
closeFile(FALSE, curText)
END;
repaint
END;
1541,6 → 1543,13
notFound := ~T.findNext(text, box_lib.check_box_get_value(BKW))
END
END
ELSIF key DIV 65536 = 60 THEN (* F2 *)
key := -1;
IF T.CTRL IN shift THEN
T.toggleLabel(text)
ELSE
T.gotoLabel(text, ~(T.SHIFT IN shift))
END
ELSIF key DIV 65536 = 67 THEN (* F9 *)
key := -1;
IF T.CTRL IN shift THEN
1555,6 → 1564,12
END
ELSIF (key DIV 65536 = 55) & (key DIV 256 MOD 256 = 52) THEN
key := -1 (* PrtScn *)
ELSIF (T.CTRL IN shift) & (key DIV 65536 = 15) THEN (* ctrl+Tab *)
key := -1;
curText := (curText + 1) MOD textsCount;
Tabs.switch(tabs, curText);
Switch(texts[curText]);
draw_window
ELSIF (T.CTRL IN shift) & (key DIV 65536 = 33) THEN
key := -1;
IF ~search THEN
1562,7 → 1577,7
END;
EditBox_SetFocus(FindEdit, TRUE);
EditBox_SetFocus(ReplaceEdit, FALSE);
EditBox_SetFocus(GotoEdit, FALSE);
EditBox_SetFocus(GotoEdit, FALSE)
ELSIF (T.CTRL IN shift) & (key DIV 65536 = 34) THEN
key := -1;
IF ~search THEN
1604,6 → 1619,8
ELSE
IF (T.CTRL IN shift) THEN
CASE key DIV 65536 OF
|17: closeFile(TRUE, curText);
key := -2
|21: T.redo(text);
key := -1
|22: key := ORD("U")
1629,20 → 1646,38
key := -1
END
END;
IF key # -1 THEN
IF key >= 0 THEN
T.key(text, key, shift)
END
END;
IF key # -2 THEN
repaint
END
|3:
btn := K.ButtonCode();
CASE btn OF
|Tabs.btnID .. Tabs.btnID + maxTexts - 1:
btn := K.ButtonCode(middle);
IF (Tabs.btnID <= btn) & (btn <= Tabs.btnID + maxTexts - 1) THEN
DEC(btn, Tabs.btnID);
IF middle THEN
IF texts[btn].modified THEN
curText := btn;
Tabs.switch(tabs, btn);
Switch(texts[btn]);
draw_window;
END;
closeFile(TRUE, btn)
ELSE
curText := btn;
Tabs.switch(tabs, btn);
Switch(texts[btn]);
draw_window
END;
btn := 0
ELSE
IF middle THEN
btn := 0
END
END;
CASE btn OF
|Tabs.btnID - 1: Tabs.scroll(tabs, -1); switch := TRUE; repaint
|Tabs.btnID - 2: Tabs.scroll(tabs, +1); switch := TRUE; repaint
 
1663,12 → 1698,12
|btnTools:
ShowMenu(menuTools)
|btnNo:
closeFile(FALSE);
closeFile(FALSE, curText);
repaint
|btnYes:
save(text);
IF ~text.modified THEN
closeFile(FALSE)
closeFile(FALSE, curText)
END;
repaint
|btnClose:
/programs/develop/cedit/SRC/KolibriOS.ob07
30,7 → 30,7
 
winColor*, textColor*, btnColor*, btnTextColor*,
toolbarColor*, scrollColor*, scrollBkColor*,
borderColor*, shadowColor*,
borderColor*, shadowColor*, (*darkColor*, lightColor*,*)
caseColor*, disCaseColor*: INTEGER;
 
 
202,13 → 202,17
END Pause;
 
 
PROCEDURE ButtonCode* (): INTEGER;
PROCEDURE ButtonCode* (VAR middle: BOOLEAN): INTEGER;
VAR
res: INTEGER;
BEGIN
middle := FALSE;
res := KOSAPI.sysfunc1(17);
IF res MOD 256 = 0 THEN
res := LSR(res, 8)
ELSIF res MOD 256 = 4 THEN
res := LSR(res, 8);
middle := TRUE
ELSE
res := 0
END
343,6 → 347,8
ASSERT(LEN(buf) >= 10);
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(buf[0]), 40);
 
(* darkColor := buf[2];
lightColor := buf[3];*)
winColor := buf[5];
textColor := buf[8];
btnColor := buf[6];
/programs/develop/cedit/SRC/Lines.ob07
31,7 → 31,7
tLine* = POINTER TO RECORD (List.tItem)
ptr: INTEGER;
length*: INTEGER;
modified*, saved*, temp: BOOLEAN;
modified*, saved*, temp, label*: BOOLEAN;
cin*, cout*, pos*: INTEGER
END;
 
113,6 → 113,7
line: tLine;
BEGIN
NEW(line);
line.label := FALSE;
ASSERT(line # NIL);
(* IF ~temp THEN
_typedPtr(line)
/programs/develop/cedit/SRC/Tabs.ob07
1,4 → 1,4
(*
(*
Copyright 2021 Anton Krotov
 
This file is part of CEdit.
26,6 → 26,7
btnID* = 100;
tabHeight* = 22;
curTabHeight = 26;
scrWidth = 10;
 
 
TYPE
48,21 → 49,29
 
PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR);
VAR
x2, y2: INTEGER;
x2, y2, color: INTEGER;
BEGIN
IF id = t.current THEN
INC(height, curTabHeight - tabHeight);
DEC(y, curTabHeight - tabHeight)
DEC(y, curTabHeight - tabHeight);
(*color := K.lightColor
ELSE
color := K.darkColor*)
END;
color := K.winColor;
DEC(x); INC(width);
x2 := x + width - 1;
y2 := y + height - 1;
K.DrawRect(x, y, width, height, K.winColor);
 
K.DrawRect(x, y, width, height,color);
K.DrawLine(x, y, x2, y, K.borderColor);
K.DrawLine(x2, y, x2, y2, K.borderColor);
K.DrawLine(x2, y2, x, y2, K.borderColor);
IF id # t.current THEN
K.DrawLine(x2 - 1, y2, x, y2, K.borderColor);
END;
K.DrawLine(x, y2, x, y, K.borderColor);
K.DrawText866bk(x + K.fontWidth, y + (height - K.fontHeight) DIV 2, K.textColor, K.winColor, s);
K.CreateButton(id + ORD({30}) + btnID, x, y - 1, width, height - 1, K.winColor, "");
K.DrawText866bk(x + K.fontWidth, y + (height - K.fontHeight) DIV 2, K.textColor, color, s);
K.CreateButton(id + ORD({30}) + btnID, x, y - 1, width, height - 1, color, "");
END drawTab;
 
 
89,21 → 98,22
 
 
PROCEDURE draw* (t: tTabs);
CONST
scrWidth = 10;
VAR
x, y, xmax, n, width: INTEGER;
item: List.tItem;
scroll: BOOLEAN;
BEGIN
y := t.y;
x := t.x;
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + 2*scrWidth, t.height + (curTabHeight - tabHeight), K.winColor);
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + 2*scrWidth, t.height + (curTabHeight - tabHeight) - 1, K.winColor);
IF Width(t, 0, t.strings.count - 1) > t.width THEN
INC(x, 2*scrWidth);
K.CreateButton(btnID - 1, t.x, t.y, scrWidth, t.height - 1, K.btnColor, "<");
K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">")
K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">");
scroll := TRUE
ELSE
t.first := 0
t.first := 0;
scroll := FALSE
END;
xmax := x + t.width - 1;
 
120,13 → 130,14
t.first := n
END;
 
K.DrawRect(x, y, t.width, t.height, K.winColor);
K.DrawRect(x, y, t.width, t.height - 1, K.winColor);
K.DrawLine(x, y + tabHeight - 1, x + t.width - 1 + 2*scrWidth*(1 - ORD(scroll)), y + tabHeight - 1, K.borderColor);
item := List.getItem(t.strings, t.first);
n := t.first;
WHILE (item # NIL) & (x <= xmax) DO
width := tabWidth(item(tItem));
IF x + width - 1 <= xmax THEN
drawTab(t, n, x, y, width, t.height, item(tItem).val)
drawTab(t, n, x + 1, y, width, t.height, item(tItem).val)
END;
INC(n);
INC(x, width);
195,7 → 206,7
BEGIN
t.x := x;
t.y := y;
t.width := width;
t.width := width - 2*scrWidth;
t.height := height
END setArea;
 
/programs/develop/cedit/SRC/Text.ob07
41,7 → 41,7
 
mark_width = 2;
pad_left = mark_width + 3;
pad_top = 1;
pad_top = 0;
inter = 2;
 
 
1422,6 → 1422,36
END goto;
 
 
PROCEDURE toggleLabel* (text: tText);
BEGIN
text.curLine.label := ~text.curLine.label
END toggleLabel;
 
 
PROCEDURE gotoLabel* (text: tText; frw: BOOLEAN);
VAR
line: tLine;
n: INTEGER;
BEGIN
n := text.cursor.Y;
line := text.curLine;
IF frw THEN
REPEAT
line := line.next(tLine);
INC(n)
UNTIL (line = NIL) OR line.label
ELSE
REPEAT
line := line.prev(tLine);
DEC(n)
UNTIL (line = NIL) OR line.label
END;
IF line # NIL THEN
IF goto(text, n + 1) THEN END
END
END gotoLabel;
 
 
PROCEDURE changeCase (text: tText; upper: BOOLEAN);
VAR
i: INTEGER;
1826,13 → 1856,13
 
G.SetColor(canvas, colors.back);
G.clear(canvas);
wNum := charWidth;
IF text.numbers THEN
numWidth := U.lg10(text.count) + 2;
wNum := charWidth;
xNum := numWidth*wNum - wNum DIV 2;
setPadding(numWidth*wNum + pad_left, padding.top);
ELSE
setPadding(pad_left, padding.top)
setPadding(pad_left + wNum*2, padding.top)
END;
getSelect(text, selBeg, selEnd);
y := padding.top + inter DIV 2;
1868,16 → 1898,17
INC(n);
INC(cnt)
END;
IF text.numbers THEN
G.SetColor(canvas, colors.numback);
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;
n := MIN(text.scroll.Y + textsize.Y + 1, text.count);
FOR i := text.scroll.Y + 1 TO n DO
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) THEN
IF text.numbers THEN
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
U.int2str(i, s);
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s));
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
ELSIF i MOD 5 = 0 THEN
G.SetColor(canvas, colors.numtext);
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum, xNum)
1884,10 → 1915,17
ELSE
G.SetColor(canvas, colors.numtext);
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum DIV 2, xNum)
END
END;
INC(y, charHeight)
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);
G.xorVLine(canvas, x, y, y + charHeight - inter)
END
END;
NextLine(line);
INC(y, charHeight)
END;
 
IF text.searchText # "" THEN
cnt := 0;
1942,7 → 1980,9
cursor(text)
END;
G.SetColor(canvas, K.borderColor);
G.Rect(canvas, 0, 0, size.X - 1, size.Y - 1);
G.HLine(canvas, size.Y - 1, 0, size.X - 1);
G.VLine(canvas, 0, 0, size.Y - 1);
G.VLine(canvas, size.X - 1, 0, size.Y - 1)
END draw;