forked from KolibriOS/kolibrios
CEdit: minor changes
git-svn-id: svn://kolibrios.org@9731 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ae0fe17afd
commit
0ac65fda97
Binary file not shown.
@ -28,7 +28,7 @@ IMPORT
|
|||||||
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
HEADER = "CEdit (25-feb-2022)";
|
HEADER = "CEdit (26-feb-2022)";
|
||||||
|
|
||||||
ShellFilter = "";
|
ShellFilter = "";
|
||||||
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||||
@ -732,20 +732,6 @@ BEGIN
|
|||||||
END closeFile;
|
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;
|
PROCEDURE getFileNum (fileName: RW.tFileName): INTEGER;
|
||||||
VAR
|
VAR
|
||||||
i: INTEGER;
|
i: INTEGER;
|
||||||
@ -783,12 +769,27 @@ BEGIN
|
|||||||
END SwitchTab;
|
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;
|
PROCEDURE open (_fileName: RW.tFileName): BOOLEAN;
|
||||||
VAR
|
VAR
|
||||||
fileName: RW.tFileName;
|
fileName: RW.tFileName;
|
||||||
nov: T.tText;
|
nov: T.tText;
|
||||||
err, n: INTEGER;
|
err, n: INTEGER;
|
||||||
res: BOOLEAN;
|
res, empty: BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
res := TRUE;
|
res := TRUE;
|
||||||
IF textsCount < maxTexts THEN
|
IF textsCount < maxTexts THEN
|
||||||
@ -806,8 +807,15 @@ BEGIN
|
|||||||
SwitchTab(curText);
|
SwitchTab(curText);
|
||||||
res := FALSE
|
res := FALSE
|
||||||
ELSE
|
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);
|
T.SetPos(nov, 0, 0);
|
||||||
insert(textsCount, nov);
|
insert(textsCount, nov);
|
||||||
|
IF empty THEN
|
||||||
|
closeFile(FALSE, 0)
|
||||||
|
END;
|
||||||
Scroll.setValue(hScroll, 0);
|
Scroll.setValue(hScroll, 0);
|
||||||
Scroll.setValue(vScroll, 0)
|
Scroll.setValue(vScroll, 0)
|
||||||
END
|
END
|
||||||
@ -1801,13 +1809,11 @@ BEGIN
|
|||||||
btn := 0
|
btn := 0
|
||||||
ELSIF U.between(Tabs.btnClose, btn, Tabs.btnClose + maxTexts - 1) THEN
|
ELSIF U.between(Tabs.btnClose, btn, Tabs.btnClose + maxTexts - 1) THEN
|
||||||
DEC(btn, Tabs.btnClose);
|
DEC(btn, Tabs.btnClose);
|
||||||
IF ~middle THEN
|
IF texts[btn].modified THEN
|
||||||
IF texts[btn].modified THEN
|
SwitchTab(btn)
|
||||||
SwitchTab(btn)
|
|
||||||
END;
|
|
||||||
closeFile(TRUE, btn);
|
|
||||||
middle := TRUE
|
|
||||||
END;
|
END;
|
||||||
|
closeFile(TRUE, btn);
|
||||||
|
middle := TRUE;
|
||||||
btn := 0
|
btn := 0
|
||||||
ELSE
|
ELSE
|
||||||
IF middle THEN
|
IF middle THEN
|
||||||
|
@ -145,28 +145,23 @@ END CreateMain;
|
|||||||
|
|
||||||
PROCEDURE drawMainItem (item: tMainItem);
|
PROCEDURE drawMainItem (item: tMainItem);
|
||||||
VAR
|
VAR
|
||||||
menuColor, textColor, n: INTEGER;
|
menuColor, textColor, n: INTEGER;
|
||||||
canvas: G.tCanvas;
|
canvas: G.tCanvas;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF item.menu.tid # 0 THEN
|
IF item.selected OR (item.menu.tid # 0) THEN
|
||||||
menuColor := K.colors.work_text;
|
menuColor := K.colors.button;
|
||||||
textColor := K.colors.work
|
textColor := K.colors.button_text
|
||||||
ELSE
|
ELSE
|
||||||
IF item.selected THEN
|
menuColor := K.colors.work;
|
||||||
menuColor := K.colors.button;
|
textColor := K.colors.work_text
|
||||||
textColor := K.colors.button_text
|
END;
|
||||||
ELSE
|
n := LENGTH(item.text);
|
||||||
menuColor := K.colors.work;
|
canvas := item.main.canvas;
|
||||||
textColor := K.colors.work_text
|
G.SetColor(canvas, menuColor);
|
||||||
END
|
G.FillRect(canvas, item.x, 0, item.x + n*fontWidth + 2, MainMenuHeight - 1);
|
||||||
END;
|
G.SetTextColor(canvas, textColor);
|
||||||
n := LENGTH(item.text);
|
G.SetBkColor(canvas, menuColor);
|
||||||
canvas := item.main.canvas;
|
G.TextOut2(canvas, item.x + 1, (MainMenuHeight - K.fontHeight) DIV 2 + 1, item.text, n);
|
||||||
G.SetColor(canvas, menuColor);
|
|
||||||
G.FillRect(canvas, item.x, 0, item.x + n*fontWidth + 2, MainMenuHeight - 1);
|
|
||||||
G.SetTextColor(canvas, textColor);
|
|
||||||
G.SetBkColor(canvas, menuColor);
|
|
||||||
G.TextOut2(canvas, item.x + 1, (MainMenuHeight - K.fontHeight) DIV 2 + 1, item.text, n);
|
|
||||||
END drawMainItem;
|
END drawMainItem;
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +188,7 @@ BEGIN
|
|||||||
item := main.first(tMainItem);
|
item := main.first(tMainItem);
|
||||||
WHILE item # NIL DO
|
WHILE item # NIL DO
|
||||||
item.selected :=
|
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);
|
U.between(0, y, MainMenuHeight - 1);
|
||||||
drawMainItem(item);
|
drawMainItem(item);
|
||||||
item := item.next(tMainItem)
|
item := item.next(tMainItem)
|
||||||
|
@ -60,16 +60,15 @@ PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR;
|
|||||||
CONST
|
CONST
|
||||||
btnCloseSize = 14;
|
btnCloseSize = 14;
|
||||||
VAR
|
VAR
|
||||||
x2, y2, color: INTEGER;
|
x2, y2, color, closeColor, closeForeColor, textColor: INTEGER;
|
||||||
left, top: INTEGER;
|
left, top: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF id = t.current THEN
|
IF id = t.current THEN
|
||||||
INC(height, curTabHeight - tabHeight);
|
INC(height, curTabHeight - tabHeight);
|
||||||
DEC(y, curTabHeight - tabHeight);
|
DEC(y, curTabHeight - tabHeight)
|
||||||
color := K.colors.light
|
|
||||||
ELSE
|
|
||||||
color := K.colors.work
|
|
||||||
END;
|
END;
|
||||||
|
color := K.colors.work;
|
||||||
|
textColor := K.colors.work_text;
|
||||||
DEC(x); INC(width);
|
DEC(x); INC(width);
|
||||||
x2 := x + width - 1;
|
x2 := x + width - 1;
|
||||||
y2 := y + height - 1;
|
y2 := y + height - 1;
|
||||||
@ -80,25 +79,29 @@ BEGIN
|
|||||||
|
|
||||||
top := y + 3;
|
top := y + 3;
|
||||||
IF id # t.current THEN
|
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
|
ELSE
|
||||||
INC(top, (curTabHeight - tabHeight) DIV 2)
|
INC(top, (curTabHeight - tabHeight) DIV 2);
|
||||||
|
closeColor := btnCloseColor;
|
||||||
|
closeForeColor := 0FFFFFFH
|
||||||
END;
|
END;
|
||||||
K.DrawLine(x, y2, x, y, K.colors.line);
|
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
|
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;
|
END;
|
||||||
K.CreateButton(id + ORD({30}) + btnID, x + 1, y - 1, width - 1, height - 1, 0, "");
|
K.CreateButton(id + ORD({30}) + btnID, x + 1, y - 1, width - 1, height - 1, 0, "");
|
||||||
left := x + width - btnCloseSize - 5;
|
left := x + width - btnCloseSize - 5;
|
||||||
K.CreateButton(id + btnClose, left, top, btnCloseSize, btnCloseSize, btnCloseColor, "");
|
K.CreateButton(id + btnClose, left, top, btnCloseSize, btnCloseSize, closeColor, "");
|
||||||
K.DrawLine(left + 5, top + 4, left + btnCloseSize - 4, top + btnCloseSize - 5, 0FFFFFFH);
|
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, 0FFFFFFH);
|
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, 0FFFFFFH);
|
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, 0FFFFFFH);
|
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, 0FFFFFFH);
|
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, 0FFFFFFH);
|
K.DrawLine(left + 5, top + btnCloseSize - 4, left + btnCloseSize - 4, top + 5, closeForeColor);
|
||||||
END drawTab;
|
END drawTab;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2799,6 +2799,11 @@ BEGIN
|
|||||||
END New;
|
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);
|
PROCEDURE init* (pShowCursor: tProcedure; _lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN);
|
||||||
BEGIN
|
BEGIN
|
||||||
ShowCursor := pShowCursor;
|
ShowCursor := pShowCursor;
|
||||||
|
Loading…
Reference in New Issue
Block a user