CEdit: bugfixes, renaming system colors, update box_lib wrapper

git-svn-id: svn://kolibrios.org@9628 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2022-01-12 21:15:22 +00:00
parent 2ed999004a
commit 082ddccdfc
12 changed files with 238 additions and 184 deletions

Binary file not shown.

View File

@ -0,0 +1,68 @@
(*
Copyright 2022 Anton Krotov
This file is part of CEdit.
CEdit is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEdit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEdit. If not, see <http://www.gnu.org/licenses/>.
*)
MODULE Args;
IMPORT SYSTEM, KOSAPI;
VAR
argc*: INTEGER;
PROCEDURE ptr2str (ptr: INTEGER; VAR s: ARRAY OF CHAR);
VAR
i, n: INTEGER;
BEGIN
i := -1;
n := LEN(s) - 1;
REPEAT
INC(i);
SYSTEM.GET(ptr, s[i]);
INC(ptr)
UNTIL (i = n) OR (s[i] = 0X);
s[i] := 0X
END ptr2str;
PROCEDURE GetArg* (n: INTEGER; VAR s: ARRAY OF CHAR);
BEGIN
IF n = 0 THEN
ptr2str(KOSAPI.GetName(), s)
ELSIF (n = 1) & (argc = 2) THEN
ptr2str(KOSAPI.GetCommandLine(), s)
ELSE
s[0] := 0X
END
END GetArg;
PROCEDURE main;
VAR
c: CHAR;
BEGIN
SYSTEM.GET(KOSAPI.GetCommandLine(), c);
argc := ORD(c # 0X) + 1
END main;
BEGIN
main
END Args.

View File

@ -20,7 +20,7 @@
MODULE CEdit;
IMPORT
OpenDlg, K := KolibriOS,
OpenDlg, K := KolibriOS, Args,
U := Utils, Lines, Menu, List,
G := Graph, T := Text, E := Encodings,
CB := Clipboard, Languages,
@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (08-jan-2022)";
HEADER = "CEdit (13-jan-2022)";
ShellFilter = "";
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
@ -181,6 +181,7 @@ VAR
textsCount, curText: INTEGER;
winWidth, winHeight: INTEGER;
SkinHeight: INTEGER;
AppPath, runScript, buildScript, debugScript: RW.tFileName;
OD: OpenDlg.Dialog;
confirm, notFound, menuFindClicked, search, searchOpened: BOOLEAN;
@ -282,9 +283,9 @@ BEGIN
right := left + width - 1;
x := minWidth DIV 2 + left;
y := (height - fontHeight) DIV 2 + top;
K.DrawRect(left, top, width, height, K.winColor);
Rect(left, top, right, bottom, K.borderColor);
K.DrawText(x, y, K.textColor, s);
K.DrawRect(left, top, width, height, K.colors.work);
Rect(left, top, right, bottom, K.colors.line);
K.DrawText(x, y, K.colors.work_text, s);
END Message;
@ -404,7 +405,7 @@ BEGIN
CheckBox.paint(WH);
END;
G.SetColor(canvas, K.borderColor);
G.SetColor(canvas, K.colors.line);
G.VLine(canvas, 0, 0, canvas.height - 1);
G.DrawCanvas(canvas, LEFT, TOP);
NotFound;
@ -453,7 +454,7 @@ BEGIN
DEC(top, Tabs.tabHeight);
right := left + EditBox_Width + SEARCH_PADDING*2;
bottom := top + 395 + btnHeight + SEARCH_PADDING;
Rect(left, top, right, bottom, K.borderColor);
Rect(left, top, right, bottom, K.colors.line);
K.CreateButton(btnCloseSearch, right - 20, top, 20, 20, 0EF999FH, "");
K.DrawLine(right - 14, top + 5, right - 5, top + 14, 0FFFFFFH);
@ -463,15 +464,15 @@ BEGIN
K.DrawLine(right - 15, top + 15, right - 5, top + 5, 0FFFFFFH);
K.DrawLine(right - 14, top + 15, right - 5, top + 6, 0FFFFFFH);
K.CreateButton(btnHideSearch, right - 40, top, 20, 20, K.btnColor, "");
K.DrawLine(right - 34, top + 14, right - 26, top + 14, K.btnTextColor);
K.DrawLine(right - 34, top + 15, right - 26, top + 15, K.btnTextColor);
K.CreateButton(btnHideSearch, right - 40, top, 20, 20, K.colors.button, "");
K.DrawLine(right - 34, top + 14, right - 26, top + 14, K.colors.button_text);
K.DrawLine(right - 34, top + 15, right - 26, top + 15, K.colors.button_text);
INC(top, 15);
INC(left, SEARCH_PADDING);
K.DrawText866(left, top, K.textColor, "find");
K.DrawText866(left, top + 55, K.textColor, "replace with");
K.DrawText866(left, top + 330, K.textColor, "go to line");
K.DrawText866(left, top, K.colors.work_text, "find");
K.DrawText866(left, top + 55, K.colors.work_text, "replace with");
K.DrawText866(left, top + 330, K.colors.work_text, "go to line");
BKW.top := top + 110;
BKW.left := left;
CS.top := top + 140;
@ -488,10 +489,10 @@ BEGIN
EB.paint(ReplaceEdit);
EB.paint(GotoEdit);
y := top + 200;
K.CreateButton(btnFindNext, left, y, btnWidth, btnHeight, K.btnColor, "next"); INC(y, btnHeight + 10);
K.CreateButton(btnReplace, left, y, btnWidth, btnHeight, K.btnColor, "replace"); INC(y, btnHeight + 10);
K.CreateButton(btnReplaceAll, left, y, btnWidth + 5*fontWidth - 2, btnHeight, K.btnColor, "replace all");
K.CreateButton(btnGoto, left, top + 380, btnWidth, btnHeight, K.btnColor, "go");
K.CreateButton(btnFindNext, left, y, btnWidth, btnHeight, K.colors.button, "next"); INC(y, btnHeight + 10);
K.CreateButton(btnReplace, left, y, btnWidth, btnHeight, K.colors.button, "replace"); INC(y, btnHeight + 10);
K.CreateButton(btnReplaceAll, left, y, btnWidth + 5*fontWidth - 2, btnHeight, K.colors.button, "replace all");
K.CreateButton(btnGoto, left, top + 380, btnWidth, btnHeight, K.colors.button, "go");
END SearchPanel;
@ -500,7 +501,7 @@ VAR
width, height: INTEGER;
BEGIN
K.BeginDraw;
K.CreateWindow(30 + K.GetTickCount() MOD 128, 30 + K.GetTickCount() MOD 128, winWidth, winHeight, K.winColor, 73H, 0, 0, "");
K.CreateWindow(30 + K.GetTickCount() MOD 128, 30 + K.GetTickCount() MOD 128, winWidth, winHeight, K.colors.work, 73H, 0, 0, "");
IF (text # NIL) & ~K.RolledUp() THEN
IF confirm THEN
resetTimer
@ -508,10 +509,10 @@ BEGIN
confirm := FALSE;
K.ClientSize(width, height);
K.DrawRect(0, 0, width, TOP - 1, K.winColor);
K.DrawRect(0, 0, LEFT, height, K.winColor);
K.DrawRect(width - RIGHT_PADDING, 0, RIGHT_PADDING, height, K.winColor);
K.DrawRect(LEFT + canvas.width + 1, TOP + canvas.height + 1, scrollWidth - 1, scrollWidth - 1, K.winColor);
K.DrawRect(0, 0, width, TOP - 1, K.colors.work);
K.DrawRect(0, 0, LEFT, height, K.colors.work);
K.DrawRect(width - RIGHT_PADDING, 0, RIGHT_PADDING, height, K.colors.work);
K.DrawRect(LEFT + canvas.width + 1, TOP + canvas.height + 1, scrollWidth - 1, scrollWidth - 1, K.colors.work);
Menu.DrawMain(mainMenu);
Toolbar.draw(toolbar);
@ -688,11 +689,11 @@ BEGIN
top := (canvas.height - height) DIV 2 + TOP;
right := left + width - 1;
bottom := top + height - 1;
K.DrawRect(left, top, width, height, K.winColor);
Rect(left, top, right, bottom, K.borderColor);
K.DrawText866(left + (width - 10*fontWidth) DIV 2, top + 10, K.textColor, "save file?");
K.CreateButton(btnYes, left + 10, top + 35, btnWidth, btnHeight, K.btnColor, "yes");
K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.btnColor, "no");
K.DrawRect(left, top, width, height, K.colors.work);
Rect(left, top, right, bottom, K.colors.line);
K.DrawText866(left + (width - 10*fontWidth) DIV 2, top + 10, K.colors.work_text, "save file?");
K.CreateButton(btnYes, left + 10, top + 35, btnWidth, btnHeight, K.colors.button, "yes");
K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.colors.button, "no");
END Confirm;
@ -773,21 +774,28 @@ BEGIN
END SwitchTab;
PROCEDURE open;
PROCEDURE open (_fileName: RW.tFileName): BOOLEAN;
VAR
fileName: RW.tFileName;
nov: T.tText;
err, n: INTEGER;
res: BOOLEAN;
BEGIN
res := TRUE;
IF textsCount < maxTexts THEN
fileName := _fileName;
IF fileName = "" THEN
OD._type := OpenDlg.topen;
OpenFile(fileName, EditFilter);
OpenFile(fileName, EditFilter)
END;
IF fileName # "" THEN
n := getFileNum(fileName);
IF n = -1 THEN
nov := T.open(fileName, err);
IF nov = NIL THEN
error("error opening file")
error("error opening file");
SwitchTab(curText);
res := FALSE
ELSE
T.SetPos(nov, 0, 0);
insert(textsCount, nov);
@ -799,11 +807,21 @@ BEGIN
END
END
ELSE
error("too many files")
error("too many files");
res := FALSE
END
RETURN res
END open;
PROCEDURE OpenDial;
VAR
res: BOOLEAN;
BEGIN
res := open("")
END OpenDial;
PROCEDURE createSearchForm;
BEGIN
EB.create(LEFT_PADDING, TOP + 20, EditBox_Width, EDITBOX_MAXCHARS, FindEdit);
@ -1132,7 +1150,7 @@ BEGIN
|menuNew:
NewFile
|menuOpen:
open
OpenDial
|menuSave:
save(text);
repaint
@ -1672,7 +1690,7 @@ BEGIN
key := -1
|22: key := ORD("U")
|24: key := -1;
open
OpenDial
|30: key := ORD("A")
|31: key := -1;
save(text)
@ -1765,7 +1783,7 @@ BEGIN
NewFile;
repaint
|btnOpen:
open
OpenDial
|btnSave:
save(text);
repaint
@ -1930,7 +1948,11 @@ BEGIN
SetCaption(text.fileName);
K.SetEventsMask({0, 30, 31})
END;
draw_window
draw_window;
IF SkinHeight # K.SkinHeight() THEN
SkinHeight := K.SkinHeight();
Redraw(resized, width, height, cliWidth, cliHeight)
END
END Redraw;
@ -1950,11 +1972,10 @@ END ScrollChange;
PROCEDURE main;
VAR
err: INTEGER;
fileName, filePath: RW.tFileName;
width, height, cliWidth, cliHeight: INTEGER;
resized: BOOLEAN;
firstClickX, firstClickY, time, blink: INTEGER;
firstClickX, firstClickY, time, blink, i: INTEGER;
BEGIN
header := "";
K.GetSystemColors;
@ -1964,7 +1985,7 @@ BEGIN
curText := 0;
mainTID := K.ThreadID();
K.SetIPC(IPC);
U.ptr2str(K.GetName(), AppPath);
Args.GetArg(0, AppPath);
Ini.load(AppPath);
leftButton := FALSE;
resized := FALSE;
@ -1976,7 +1997,8 @@ BEGIN
cliWidth := winWidth;
cliHeight := winHeight;
LEFT := LEFT_PADDING;
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - K.SkinHeight());
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, "", {});
@ -1985,7 +2007,6 @@ BEGIN
G.SetFont(canvas, font);
T.init(resetTimer);
T.setCanvas(canvas);
U.ptr2str(K.GetCommandLine(), fileName);
context := CreateContextMenu();
menuFile := CreateMenuFile();
@ -2034,25 +2055,28 @@ BEGIN
Toolbar.add(toolbar, btnRun, 53, "");
Ini.getSettings(buildScript, runScript, debugScript);
IF fileName = "" THEN
filePath := "/sys";
IF Args.argc = 1 THEN
text := T.New();
filePath := "/sys"
ELSE
text := T.open(fileName, err);
IF text = NIL THEN
error("error opening file");
K.Exit
ELSE
insert(0, text);
T.SetPos(text, 0, 0)
END;
FOR i := 1 TO Args.argc - 1 DO
Args.GetArg(i, fileName);
IF open(fileName) THEN
U.getPath(fileName, filePath)
END
END;
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
insert(0, text);
IF textsCount = 0 THEN
K.Exit
END;
SwitchTab(textsCount - 1);
Scroll.init(ScrollChange);
Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth*3 DIV 2, hScroll);
Scroll.create(TRUE, scrollWidth, canvas.height + 2, scrollWidth, scrollWidth*3 DIV 2, vScroll);
T.resize(canvas.width, canvas.height);
T.SetPos(text, 0, 0);
confirm := FALSE;
notFound := FALSE;
menuFindClicked := FALSE;
@ -2065,6 +2089,9 @@ BEGIN
cs := FALSE;
whole := FALSE;
replaced := 0;
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
K.SetEventsMask({0, 1, 2, 5, 6, 31});
Menu.init(resetTimer);
draw_window;

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -48,11 +48,11 @@ VAR
BEGIN
canvas := chkbox.canvas;
IF canvas # NIL THEN
G.SetColor(canvas, K.winColor);
G.SetColor(canvas, K.colors.work);
G.clear(canvas);
G.SetColor(canvas, bColor);
G.FillRect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
G.SetColor(canvas, K.borderColor);
G.SetColor(canvas, K.colors.line);
G.Rect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
IF chkbox.value THEN
G.SetColor(canvas, fColor);
@ -65,8 +65,8 @@ BEGIN
G.DLine(canvas, 2, 6, 5, -1);
G.DLine(canvas, 7, 13, 8, 1);
END;
G.SetTextColor(canvas, K.textColor);
G.SetBkColor(canvas, K.winColor);
G.SetTextColor(canvas, K.colors.work_text);
G.SetBkColor(canvas, K.colors.work);
G.TextOut2(canvas, fontHeight + padding, 0, chkbox.text, LENGTH(chkbox.text));
G.DrawCanvas(canvas, chkbox.left, chkbox.top)
END

View File

@ -48,33 +48,13 @@ TYPE
offset, cl_curs_x, cl_curs_y, shift, shift_old, height, char_width: INTEGER
END;
EditBoxKey = PROCEDURE (eb: tEditBox);
VAR
key_proc: EditBoxKey;
paint *: PROCEDURE (eb: tEditBox);
mouse *: PROCEDURE (eb: tEditBox);
_setValue : PROCEDURE (eb: tEditBox; text: INTEGER);
PROCEDURE _key (key: INTEGER; key_proc: EditBoxKey; text: tEditBox);
BEGIN
SYSTEM.CODE(
08BH, 045H, 008H, (* mov eax, dword [ebp + 8] *)
08BH, 055H, 00CH, (* mov edx, dword [ebp + 12] *)
08BH, 04DH, 010H, (* mov ecx, dword [ebp + 16] *)
051H, (* push ecx *)
0FFH, 0D2H (* call edx *)
)
END _key;
PROCEDURE key* (text: tEditBox; key: INTEGER);
BEGIN
_key(key, key_proc, text)
END key;
key *: PROCEDURE (eb: tEditBox; key: INTEGER);
PROCEDURE getValue* (text: tEditBox; VAR str: ARRAY OF CHAR);
@ -144,8 +124,8 @@ VAR
BEGIN
Lib := KOSAPI.LoadLib("/sys/lib/box_lib.obj");
ASSERT(Lib # 0);
GetProc(Lib, SYSTEM.ADR(paint), "edit_box");
GetProc(Lib, SYSTEM.ADR(key_proc), "edit_box_key");
GetProc(Lib, SYSTEM.ADR(paint), "edit_box_draw");
GetProc(Lib, SYSTEM.ADR(key), "edit_box_key_safe");
GetProc(Lib, SYSTEM.ADR(mouse), "edit_box_mouse");
GetProc(Lib, SYSTEM.ADR(_setValue), "edit_box_set_text");
END main;

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -28,18 +28,18 @@ CONST
VAR
winColor*, textColor*, btnColor*, btnTextColor*,
borderColor*, (*darkColor,*) lightColor*: INTEGER;
PROCEDURE GetCommandLine* (): INTEGER;
RETURN KOSAPI.GetCommandLine()
END GetCommandLine;
PROCEDURE GetName* (): INTEGER;
RETURN KOSAPI.GetName()
END GetName;
colors*: RECORD
rsrvd,
taskbar,
dark*,
light*,
window_title*,
work*,
button*,
button_text*,
work_text*,
line*: INTEGER
END;
PROCEDURE CreateWindow* (x, y, w, h, color, style, hcolor, hstyle: INTEGER; htext: ARRAY OF CHAR);
@ -152,7 +152,7 @@ END DrawText69;
PROCEDURE DrawText866* (x, y, color: INTEGER; text: ARRAY OF CHAR);
BEGIN
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, winColor)
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, colors.work)
END DrawText866;
@ -179,7 +179,7 @@ BEGIN
KOSAPI.sysfunc5(8, LSL(Left, 16) + Width, LSL(Top, 16) + Height, id, Color);
x := Left + (Width - fontWidth * LENGTH(Caption)) DIV 2;
y := Top + (Height - fontHeight) DIV 2 + 1;
DrawText(x, y, btnTextColor, Caption)
DrawText(x, y, colors.button_text, Caption)
END CreateButton;
@ -330,18 +330,8 @@ END SendIPC;
PROCEDURE GetSystemColors*;
VAR
buf: ARRAY 10 OF INTEGER;
BEGIN
ASSERT(LEN(buf) >= 10);
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(buf[0]), 40);
(*darkColor := buf[2];*)
lightColor := buf[3];
winColor := buf[5];
btnColor := buf[6];
btnTextColor := buf[7];
textColor := buf[8];
borderColor := buf[9];
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(colors), 40)
END GetSystemColors;
@ -409,4 +399,6 @@ BEGIN
END PutPixel;
BEGIN
GetSystemColors
END KolibriOS.

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -134,15 +134,15 @@ VAR
menuColor, textColor, n: INTEGER;
BEGIN
IF item.menu.tid # 0 THEN
menuColor := K.textColor;
textColor := K.winColor
menuColor := K.colors.work_text;
textColor := K.colors.work
ELSE
menuColor := K.winColor;
textColor := K.textColor
menuColor := K.colors.work;
textColor := K.colors.work_text
END;
n := LENGTH(item.text);
K.DrawRect(item.x, 0, n*fontWidth + 2, MainMenuHeight, menuColor);
K.CreateButton(item.id + ORD({30}), item.x, 0, n*fontWidth + 2, MainMenuHeight, K.btnColor, "");
K.CreateButton(item.id + ORD({30}), item.x, 0, n*fontWidth + 2, MainMenuHeight, K.colors.button, "");
K.DrawText(item.x + 1, (MainMenuHeight - K.fontHeight) DIV 2 + 1, textColor, item.text)
END drawMainItem;
@ -217,7 +217,7 @@ END escape;
PROCEDURE repaint (m: tMenu);
VAR
y, i, X, Y: INTEGER;
y, i, X, Y, Y1: INTEGER;
item: tItem;
BkColor, TextColor: INTEGER;
canvas: G.tCanvas;
@ -272,9 +272,11 @@ BEGIN
G.DLine(canvas, 4, 7, Y + 5, -1);
G.DLine(canvas, 4, 7, Y + 6, -1);
G.DLine(canvas, 7, 12, Y + 8, 1);
G.DLine(canvas, 7, 12, Y + 9, 1);
G.DLine(canvas, 7, 12, Y + 9, 1)
ELSIF item.check = 2 THEN
G.FillRect(canvas, 6, y + fontHeight DIV 2 - 4, 10, y + fontHeight DIV 2)
Y1 := y + fontHeight DIV 2 - 2;
G.FillRect(canvas, 7, Y1 - 2, 9, Y1 + 2);
G.FillRect(canvas, 6, Y1 - 1, 10, Y1 + 1)
END;
IF item.child # NIL THEN

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -95,9 +95,9 @@ END TextOut;
PROCEDURE draw* (left, top: INTEGER);
BEGIN
G.SetColor(SB.canvas, K.winColor);
G.SetBkColor(SB.canvas, K.winColor);
G.SetTextColor(SB.canvas, K.textColor);
G.SetColor(SB.canvas, K.colors.work);
G.SetBkColor(SB.canvas, K.colors.work);
G.SetTextColor(SB.canvas, K.colors.work_text);
G.clear(SB.canvas);
TextOut(1, SB.pos);
TextOut(16*K.fontWidth, SB.sel);

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -61,25 +61,25 @@ BEGIN
IF id = t.current THEN
INC(height, curTabHeight - tabHeight);
DEC(y, curTabHeight - tabHeight);
color := K.lightColor
color := K.colors.light
ELSE
color := K.winColor
color := K.colors.work
END;
DEC(x); INC(width);
x2 := x + width - 1;
y2 := y + height - 1;
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(x, y, x2, y, K.colors.line);
K.DrawLine(x2, y, x2, y2, K.colors.line);
IF id # t.current THEN
K.DrawLine(x2 - 1, y2, x, y2, K.borderColor);
K.DrawLine(x2 - 1, y2, x, y2, K.colors.line);
END;
K.DrawLine(x, y2, x, y, K.borderColor);
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.textColor, color, s);
K.DrawText866bk(x + K.fontWidth + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, K.colors.work_text, color, s);
IF modified THEN
K.DrawText866bk(x + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, K.textColor, color, "*")
K.DrawText866bk(x + K.fontWidth DIV 2, y + (height - K.fontHeight) DIV 2, K.colors.work_text, color, "*")
END;
K.CreateButton(id + ORD({30}) + btnID, x + 1, y - 1, width - 1, height - 1, color, "");
END drawTab;
@ -115,13 +115,13 @@ VAR
BEGIN
y := t.y;
x := t.x;
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + (2*scrWidth + 2), t.height + (curTabHeight - tabHeight) - 1, K.winColor);
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + (2*scrWidth + 2), t.height + (curTabHeight - tabHeight) - 1, K.colors.work);
IF Width(t, 0, t.strings.count - 1) > t.width THEN
INC(x, 2*scrWidth);
K.DeleteButton(btnLeft);
K.DeleteButton(btnRight);
K.CreateButton(btnLeft, t.x, y, scrWidth, t.height - 1, K.btnColor, "<");
K.CreateButton(btnRight, t.x + scrWidth, y, scrWidth, t.height - 1, K.btnColor, ">");
K.CreateButton(btnLeft, t.x, y, scrWidth, t.height - 1, K.colors.button, "<");
K.CreateButton(btnRight, t.x + scrWidth, y, scrWidth, t.height - 1, K.colors.button, ">");
scroll := TRUE
ELSE
t.first := 0;
@ -145,8 +145,8 @@ BEGIN
t.first := n
END;
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);
K.DrawRect(x, y, t.width, t.height - 1, K.colors.work);
K.DrawLine(x, y + tabHeight - 1, x + t.width - 1 + 2*scrWidth*(1 - ORD(scroll)), y + tabHeight - 1, K.colors.line);
item := List.getItem(t.strings, t.first);
n := t.first;
WHILE (item # NIL) & (x <= xmax) DO

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -77,12 +77,12 @@ END drawIcons;
PROCEDURE setColors (VAR toolbar: tToolbar);
BEGIN
toolbar.colors.back := 0F2EFECH;//K.lightColor;
toolbar.colors.back := 0F2EFECH;
toolbar.colors.text := 00000FFH;
toolbar.colors.disText := 0808080H;//K.borderColor;
toolbar.colors.disText := 0808080H;
toolbar.colors.light := 0FEFEFEH;
toolbar.colors.shadow := 09F9C9AH;//K.borderColor;
toolbar.colors.window := K.winColor
toolbar.colors.shadow := 09F9C9AH;
toolbar.colors.window := K.colors.work
END setColors;

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -352,21 +352,6 @@ BEGIN
END sgn;
PROCEDURE ptr2str* (ptr: INTEGER; VAR s: ARRAY OF CHAR);
VAR
i, n: INTEGER;
BEGIN
i := -1;
n := LEN(s) - 1;
REPEAT
INC(i);
SYSTEM.GET(ptr, s[i]);
INC(ptr)
UNTIL (i = n) OR (s[i] = 0X);
s[i] := 0X
END ptr2str;
PROCEDURE between* (a, b, c: INTEGER): BOOLEAN;
RETURN (a <= b) & (b <= c)
END between;

View File

@ -1,5 +1,5 @@
(*
Copyright 2021 Anton Krotov
Copyright 2021, 2022 Anton Krotov
This file is part of CEdit.
@ -76,7 +76,7 @@ END create;
PROCEDURE Rect (canvas: G.tCanvas; left, top, right, bottom: INTEGER);
BEGIN
G.FillRect(canvas, left, top, right, bottom);
G.SetColor(canvas, K.borderColor);
G.SetColor(canvas, K.colors.line);
G.Rect(canvas, left, top, right, bottom);
END Rect;
@ -93,9 +93,9 @@ VAR
color: INTEGER;
BEGIN
IF c THEN
color := K.btnColor
color := K.colors.button
ELSE
color := K.btnTextColor
color := K.colors.button_text
END;
G.SetColor(canvas, color)
END SetColor;
@ -106,19 +106,19 @@ BEGIN
width := scroll.width;
height := scroll.height;
canvas := scroll.canvas;
G.SetColor(canvas, K.lightColor);
G.SetColor(canvas, K.colors.light);
G.clear(canvas);
G.SetColor(canvas, K.borderColor);
G.SetColor(canvas, K.colors.line);
G.Rect(canvas, 0, 0, width - 1, height - 1);
IF scroll.vertical THEN
SetColor(canvas, ~scroll.Dec);
Rect(canvas, 0, 0, width - 1, btn - 1);
SetColor(canvas, ~scroll.Inc);
Rect(canvas, 0, height - btn, width - 1, height - 1);
G.SetColor(canvas, K.btnColor);
G.SetColor(canvas, K.colors.button);
Rect(canvas, 0, btn + scroll.pos - 1, width - 1, btn + scroll.pos + scroll.sliderSize - 1);
G.SetColor(canvas, K.btnTextColor);
G.SetColor(canvas, K.colors.button_text);
y := btn + scroll.pos + scroll.sliderSize DIV 2 - 1;
G.HLine(canvas, y, width DIV 4, 3*width DIV 4);
@ -141,10 +141,10 @@ BEGIN
Rect(canvas, 0, 0, btn - 1, height - 1);
SetColor(canvas, ~scroll.Inc);
Rect(canvas, width - btn, 0, width - 1, height - 1);
G.SetColor(canvas, K.btnColor);
G.SetColor(canvas, K.colors.button);
Rect(canvas, btn + scroll.pos - 1, 0, btn + scroll.pos + scroll.sliderSize - 1, height - 1);
G.SetColor(canvas, K.btnTextColor);
G.SetColor(canvas, K.colors.button_text);
x := btn + scroll.pos + scroll.sliderSize DIV 2 - 1;
G.VLine(canvas, x, height DIV 4, 3*height DIV 4);