CEdit: minor changes

git-svn-id: svn://kolibrios.org@9731 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2022-02-26 05:08:51 +00:00
parent ae0fe17afd
commit 0ac65fda97
5 changed files with 69 additions and 60 deletions

Binary file not shown.

View File

@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (25-feb-2022)";
HEADER = "CEdit (26-feb-2022)";
ShellFilter = "";
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
@ -732,20 +732,6 @@ BEGIN
END closeFile;
PROCEDURE NewFile;
VAR
nov: T.tText;
BEGIN
IF textsCount < maxTexts THEN
nov := T.New();
T.SetPos(nov, 0, 0);
insert(textsCount, nov)
ELSE
error("too many files")
END
END NewFile;
PROCEDURE getFileNum (fileName: RW.tFileName): INTEGER;
VAR
i: INTEGER;
@ -783,12 +769,27 @@ BEGIN
END SwitchTab;
PROCEDURE NewFile;
VAR
nov: T.tText;
BEGIN
IF textsCount < maxTexts THEN
nov := T.New();
T.SetPos(nov, 0, 0);
insert(textsCount, nov);
SwitchTab(curText)
ELSE
error("too many files")
END
END NewFile;
PROCEDURE open (_fileName: RW.tFileName): BOOLEAN;
VAR
fileName: RW.tFileName;
nov: T.tText;
err, n: INTEGER;
res: BOOLEAN;
res, empty: BOOLEAN;
BEGIN
res := TRUE;
IF textsCount < maxTexts THEN
@ -806,8 +807,15 @@ BEGIN
SwitchTab(curText);
res := FALSE
ELSE
T.switch(text);
empty := (textsCount = 1) & (text.fileName = "") & T.empty(text) &
ChangeLog.isFirstGuard(text.edition) & ChangeLog.isLastGuard(text.edition);
T.switch(nov);
T.SetPos(nov, 0, 0);
insert(textsCount, nov);
IF empty THEN
closeFile(FALSE, 0)
END;
Scroll.setValue(hScroll, 0);
Scroll.setValue(vScroll, 0)
END
@ -1801,13 +1809,11 @@ BEGIN
btn := 0
ELSIF U.between(Tabs.btnClose, btn, Tabs.btnClose + maxTexts - 1) THEN
DEC(btn, Tabs.btnClose);
IF ~middle THEN
IF texts[btn].modified THEN
SwitchTab(btn)
END;
closeFile(TRUE, btn);
middle := TRUE
END;
middle := TRUE;
btn := 0
ELSE
IF middle THEN

View File

@ -148,17 +148,12 @@ VAR
menuColor, textColor, n: INTEGER;
canvas: G.tCanvas;
BEGIN
IF item.menu.tid # 0 THEN
menuColor := K.colors.work_text;
textColor := K.colors.work
ELSE
IF item.selected THEN
IF item.selected OR (item.menu.tid # 0) THEN
menuColor := K.colors.button;
textColor := K.colors.button_text
ELSE
menuColor := K.colors.work;
textColor := K.colors.work_text
END
END;
n := LENGTH(item.text);
canvas := item.main.canvas;
@ -193,7 +188,7 @@ BEGIN
item := main.first(tMainItem);
WHILE item # NIL DO
item.selected :=
U.between(item.x, x, item.x + LENGTH(item.text)*fontWidth - 1) &
U.between(item.x, x, item.x + LENGTH(item.text)*fontWidth + 1) &
U.between(0, y, MainMenuHeight - 1);
drawMainItem(item);
item := item.next(tMainItem)

View File

@ -60,16 +60,15 @@ PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR;
CONST
btnCloseSize = 14;
VAR
x2, y2, color: INTEGER;
x2, y2, color, closeColor, closeForeColor, textColor: INTEGER;
left, top: INTEGER;
BEGIN
IF id = t.current THEN
INC(height, curTabHeight - tabHeight);
DEC(y, curTabHeight - tabHeight);
color := K.colors.light
ELSE
color := K.colors.work
DEC(y, curTabHeight - tabHeight)
END;
color := K.colors.work;
textColor := K.colors.work_text;
DEC(x); INC(width);
x2 := x + width - 1;
y2 := y + height - 1;
@ -80,25 +79,29 @@ BEGIN
top := y + 3;
IF id # t.current THEN
K.DrawLine(x2 - 1, y2, x, y2, K.colors.line)
K.DrawLine(x2 - 1, y2, x, y2, K.colors.line);
closeColor := K.colors.button;
closeForeColor := K.colors.button_text
ELSE
INC(top, (curTabHeight - tabHeight) DIV 2)
INC(top, (curTabHeight - tabHeight) DIV 2);
closeColor := btnCloseColor;
closeForeColor := 0FFFFFFH
END;
K.DrawLine(x, y2, x, y, K.colors.line);
K.DrawText866bk(x + K.fontWidth + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, K.colors.work_text, color, s);
K.DrawText866bk(x + K.fontWidth + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, textColor, color, s);
IF modified THEN
K.DrawText866bk(x + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, K.colors.work_text, color, "*")
K.DrawText866bk(x + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, textColor, color, "*")
END;
K.CreateButton(id + ORD({30}) + btnID, x + 1, y - 1, width - 1, height - 1, 0, "");
left := x + width - btnCloseSize - 5;
K.CreateButton(id + btnClose, left, top, btnCloseSize, btnCloseSize, btnCloseColor, "");
K.DrawLine(left + 5, top + 4, left + btnCloseSize - 4, top + btnCloseSize - 5, 0FFFFFFH);
K.DrawLine(left + 4, top + 4, left + btnCloseSize - 4, top + btnCloseSize - 4, 0FFFFFFH);
K.DrawLine(left + 4, top + 5, left + btnCloseSize - 5, top + btnCloseSize - 4, 0FFFFFFH);
K.DrawLine(left + 4, top + btnCloseSize - 4, left + btnCloseSize - 4, top + 4, 0FFFFFFH);
K.DrawLine(left + 4, top + btnCloseSize - 5, left + btnCloseSize - 5, top + 4, 0FFFFFFH);
K.DrawLine(left + 5, top + btnCloseSize - 4, left + btnCloseSize - 4, top + 5, 0FFFFFFH);
K.CreateButton(id + btnClose, left, top, btnCloseSize, btnCloseSize, closeColor, "");
K.DrawLine(left + 5, top + 4, left + btnCloseSize - 4, top + btnCloseSize - 5, closeForeColor);
K.DrawLine(left + 4, top + 4, left + btnCloseSize - 4, top + btnCloseSize - 4, closeForeColor);
K.DrawLine(left + 4, top + 5, left + btnCloseSize - 5, top + btnCloseSize - 4, closeForeColor);
K.DrawLine(left + 4, top + btnCloseSize - 4, left + btnCloseSize - 4, top + 4, closeForeColor);
K.DrawLine(left + 4, top + btnCloseSize - 5, left + btnCloseSize - 5, top + 4, closeForeColor);
K.DrawLine(left + 5, top + btnCloseSize - 4, left + btnCloseSize - 4, top + 5, closeForeColor);
END drawTab;

View File

@ -2799,6 +2799,11 @@ BEGIN
END New;
PROCEDURE empty* (text: tText): BOOLEAN;
RETURN (text.count = 1) & (text.curLine.length = 0)
END empty;
PROCEDURE init* (pShowCursor: tProcedure; _lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN);
BEGIN
ShowCursor := pShowCursor;