forked from KolibriOS/kolibrios
cedit: update by akron1
git-svn-id: svn://kolibrios.org@8772 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
188fe71c10
commit
590455aed4
Binary file not shown.
@ -6,8 +6,10 @@
|
|||||||
ctrl+X вырезать
|
ctrl+X вырезать
|
||||||
ctrl+L преобразовать буквы A..Z слева от курсора в a..z
|
ctrl+L преобразовать буквы A..Z слева от курсора в a..z
|
||||||
ctrl+U преобразовать буквы a..z слева от курсора в A..Z
|
ctrl+U преобразовать буквы a..z слева от курсора в A..Z
|
||||||
ctrl+F поиск/замена
|
ctrl+F показать панель поиска
|
||||||
|
Esc скрыть панель поиска
|
||||||
F3 найти следующий
|
F3 найти следующий
|
||||||
|
Shift+F3 найти предыдущий
|
||||||
ctrl+Z отменить
|
ctrl+Z отменить
|
||||||
ctrl+Y вернуть
|
ctrl+Y вернуть
|
||||||
ctrl+G перейти на строку...
|
ctrl+G перейти на строку...
|
||||||
|
@ -28,7 +28,7 @@ IMPORT
|
|||||||
RW, Ini, box_lib, Icons;
|
RW, Ini, box_lib, Icons;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
header = "CEdit (03-jun-2021)";
|
header = "CEdit (06-jun-2021)";
|
||||||
|
|
||||||
ShellFilter = "";
|
ShellFilter = "";
|
||||||
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI";
|
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI";
|
||||||
@ -118,6 +118,7 @@ CONST
|
|||||||
menuExit = 15;
|
menuExit = 15;
|
||||||
|
|
||||||
menuNumbers = 20;
|
menuNumbers = 20;
|
||||||
|
menuFontSize = 21;
|
||||||
menuColors = 1000;
|
menuColors = 1000;
|
||||||
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
|
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ CONST
|
|||||||
|
|
||||||
VAR
|
VAR
|
||||||
canvas: G.tCanvas;
|
canvas: G.tCanvas;
|
||||||
font: G.tFont;
|
font, font1, font2: G.tFont;
|
||||||
text: T.tText;
|
text: T.tText;
|
||||||
winWidth, winHeight: INTEGER;
|
winWidth, winHeight: INTEGER;
|
||||||
shift: SET;
|
shift: SET;
|
||||||
@ -461,23 +462,25 @@ VAR
|
|||||||
|
|
||||||
PROCEDURE drawMainMenu (menu: Menu.tMenu; x: INTEGER; btn: INTEGER; caption: ARRAY OF WCHAR);
|
PROCEDURE drawMainMenu (menu: Menu.tMenu; x: INTEGER; btn: INTEGER; caption: ARRAY OF WCHAR);
|
||||||
VAR
|
VAR
|
||||||
menuColor, n: INTEGER;
|
menuColor, textColor, n: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF menu.tid # 0 THEN
|
IF menu.tid # 0 THEN
|
||||||
menuColor := K.selMenuColor
|
menuColor := K.textColor;
|
||||||
|
textColor := K.winColor
|
||||||
ELSE
|
ELSE
|
||||||
menuColor := K.winColor
|
menuColor := K.winColor;
|
||||||
|
textColor := K.textColor
|
||||||
END;
|
END;
|
||||||
n := LENGTH(caption);
|
n := LENGTH(caption);
|
||||||
K.DrawRect(x, 0, n*fontWidth + 2, MainMenuHeight, menuColor);
|
K.DrawRect(x, 0, n*fontWidth + 2, MainMenuHeight, menuColor);
|
||||||
K.CreateButton(btn + ORD({30}), x, 0, n*fontWidth + 2, MainMenuHeight, K.btnColor, "");
|
K.CreateButton(btn + ORD({30}), x, 0, n*fontWidth + 2, MainMenuHeight, K.btnColor, "");
|
||||||
K.DrawText(x + 1, (MainMenuHeight - fontHeight) DIV 2 + 1, K.textColor, caption)
|
K.DrawText(x + 1, (MainMenuHeight - fontHeight) DIV 2 + 1, textColor, caption)
|
||||||
END drawMainMenu;
|
END drawMainMenu;
|
||||||
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
K.BeginDraw;
|
K.BeginDraw;
|
||||||
K.CreateWindow(50 + K.GetTickCount() MOD 128, 50 + K.GetTickCount() MOD 128, winWidth, winHeight, K.winColor, 73H, 0, 0, header);
|
K.CreateWindow(30 + K.GetTickCount() MOD 128, 30 + K.GetTickCount() MOD 128, winWidth, winHeight, K.winColor, 73H, 0, 0, header);
|
||||||
IF (text # NIL) & ~K.RolledUp() THEN
|
IF (text # NIL) & ~K.RolledUp() THEN
|
||||||
confirm := FALSE;
|
confirm := FALSE;
|
||||||
K.ClientSize(width, height);
|
K.ClientSize(width, height);
|
||||||
@ -891,6 +894,13 @@ BEGIN
|
|||||||
EditBox_SetFocus(ReplaceEdit, FALSE)
|
EditBox_SetFocus(ReplaceEdit, FALSE)
|
||||||
|menuNumbers:
|
|menuNumbers:
|
||||||
T.toggleNumbers(text)
|
T.toggleNumbers(text)
|
||||||
|
|menuFontSize:
|
||||||
|
IF font = font1 THEN
|
||||||
|
font := font2
|
||||||
|
ELSE
|
||||||
|
font := font1
|
||||||
|
END;
|
||||||
|
resize
|
||||||
|menuNone:
|
|menuNone:
|
||||||
T.setLang(text, Languages.langNone)
|
T.setLang(text, Languages.langNone)
|
||||||
|menuC:
|
|menuC:
|
||||||
@ -1053,6 +1063,7 @@ VAR
|
|||||||
BEGIN
|
BEGIN
|
||||||
menu := List.create(NIL);
|
menu := List.create(NIL);
|
||||||
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
|
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
|
||||||
|
Menu.AddMenuItem(menu, menuFontSize, "x2");
|
||||||
Menu.delimiter(menu);
|
Menu.delimiter(menu);
|
||||||
|
|
||||||
colors := Ini.sections.first(Ini.tSection);
|
colors := Ini.sections.first(Ini.tSection);
|
||||||
@ -1172,6 +1183,7 @@ BEGIN
|
|||||||
INC(x, menuEncodingX)
|
INC(x, menuEncodingX)
|
||||||
ELSIF menu = menuView THEN
|
ELSIF menu = menuView THEN
|
||||||
Menu.setCheck(menu, menuNumbers, ORD(text.numbers));
|
Menu.setCheck(menu, menuNumbers, ORD(text.numbers));
|
||||||
|
Menu.setCheck(menu, menuFontSize, ORD(font = font2));
|
||||||
FOR i := 0 TO Ini.sections.count - 1 DO
|
FOR i := 0 TO Ini.sections.count - 1 DO
|
||||||
Menu.setCheck(menu, menuColors + i, ORD(Ini.curSectionNum = i)*2)
|
Menu.setCheck(menu, menuColors + i, ORD(Ini.curSectionNum = i)*2)
|
||||||
END;
|
END;
|
||||||
@ -1205,7 +1217,7 @@ END ShowMenu;
|
|||||||
|
|
||||||
PROCEDURE main;
|
PROCEDURE main;
|
||||||
VAR
|
VAR
|
||||||
width, height, x, y, scrollX, scrollY: INTEGER;
|
width, height, x, y, scrollX, scrollY, i: INTEGER;
|
||||||
key: INTEGER;
|
key: INTEGER;
|
||||||
msState: SET;
|
msState: SET;
|
||||||
scroll: INTEGER;
|
scroll: INTEGER;
|
||||||
@ -1226,13 +1238,18 @@ BEGIN
|
|||||||
LeftButtonUp;
|
LeftButtonUp;
|
||||||
resized := FALSE;
|
resized := FALSE;
|
||||||
shift := {};
|
shift := {};
|
||||||
winWidth := minWinWidth;
|
K.ScreenSize(winWidth, winHeight);
|
||||||
winHeight := minWinHeight;
|
winWidth := (winWidth * 80) DIV 100 - (128 + 30);
|
||||||
|
winHeight := winHeight - (128 + 30);
|
||||||
|
winWidth := MAX(winWidth, minWinWidth);
|
||||||
|
winHeight := MAX(winHeight, minWinHeight);
|
||||||
cliWidth := winWidth;
|
cliWidth := winWidth;
|
||||||
cliHeight := winHeight;
|
cliHeight := winHeight;
|
||||||
LEFT := 10;
|
LEFT := 10;
|
||||||
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight());
|
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight());
|
||||||
font := G.CreateFont(1, "", {});
|
font1 := G.CreateFont(1, "", {});
|
||||||
|
font2 := G.CreateFont(2, "", {});
|
||||||
|
font := font1;
|
||||||
G.SetFont(canvas, font);
|
G.SetFont(canvas, font);
|
||||||
T.init(NIL);
|
T.init(NIL);
|
||||||
T.setCanvas(canvas);
|
T.setCanvas(canvas);
|
||||||
@ -1280,6 +1297,7 @@ BEGIN
|
|||||||
WHILE TRUE DO
|
WHILE TRUE DO
|
||||||
CASE K.WaitForEvent() OF
|
CASE K.WaitForEvent() OF
|
||||||
|1:
|
|1:
|
||||||
|
FOR i := 0 TO 1 DO
|
||||||
K.GetSystemColors;
|
K.GetSystemColors;
|
||||||
Icons.get(icons, grayIcons);
|
Icons.get(icons, grayIcons);
|
||||||
IF ~K.RolledUp() THEN
|
IF ~K.RolledUp() THEN
|
||||||
@ -1288,21 +1306,27 @@ BEGIN
|
|||||||
cliWidth := width;
|
cliWidth := width;
|
||||||
cliHeight := height;
|
cliHeight := height;
|
||||||
resize;
|
resize;
|
||||||
resized := TRUE
|
resized := TRUE;
|
||||||
END;
|
END;
|
||||||
K.SetEventsMask({0, 1, 2, 5, 6, 31})
|
K.SetEventsMask({0, 1, 2, 5, 6, 31})
|
||||||
ELSE
|
ELSE
|
||||||
K.SetEventsMask({0, 30, 31})
|
K.SetEventsMask({0, 30, 31})
|
||||||
END;
|
END;
|
||||||
draw_window
|
draw_window
|
||||||
|
END
|
||||||
|
|
||||||
|2:
|
|2:
|
||||||
key := K.GetKey();
|
key := K.GetKey();
|
||||||
getKBState;
|
getKBState;
|
||||||
IF key DIV 65536 = 61 THEN (* F3 *)
|
IF key DIV 65536 = 61 THEN (* F3 *)
|
||||||
key := -1;
|
key := -1;
|
||||||
IF search & (searchText # "") THEN
|
IF search & (searchText # "") THEN
|
||||||
|
IF T.SHIFT IN shift THEN
|
||||||
|
notFound := ~T.findNext(text, ~box_lib.check_box_get_value(BKW))
|
||||||
|
ELSE
|
||||||
notFound := ~T.findNext(text, box_lib.check_box_get_value(BKW))
|
notFound := ~T.findNext(text, box_lib.check_box_get_value(BKW))
|
||||||
END
|
END
|
||||||
|
END
|
||||||
ELSIF key DIV 65536 = 67 THEN (* F9 *)
|
ELSIF key DIV 65536 = 67 THEN (* F9 *)
|
||||||
key := -1;
|
key := -1;
|
||||||
IF T.CTRL IN shift THEN
|
IF T.CTRL IN shift THEN
|
||||||
@ -1310,6 +1334,11 @@ BEGIN
|
|||||||
ELSE
|
ELSE
|
||||||
Script(runScript)
|
Script(runScript)
|
||||||
END
|
END
|
||||||
|
ELSIF key DIV 65536 = 1 THEN
|
||||||
|
key := -1; (* Esc *)
|
||||||
|
IF search THEN
|
||||||
|
Search
|
||||||
|
END
|
||||||
ELSIF (key DIV 65536 = 55) & (key DIV 256 MOD 256 = 52) THEN
|
ELSIF (key DIV 65536 = 55) & (key DIV 256 MOD 256 = 52) THEN
|
||||||
key := -1 (* PrtScn *)
|
key := -1 (* PrtScn *)
|
||||||
ELSIF (T.CTRL IN shift) & (key DIV 65536 = 33) THEN
|
ELSIF (T.CTRL IN shift) & (key DIV 65536 = 33) THEN
|
||||||
|
@ -115,6 +115,21 @@ BEGIN
|
|||||||
END ClientPos;
|
END ClientPos;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE ScreenSize* (VAR width, height: INTEGER);
|
||||||
|
VAR
|
||||||
|
eax, ebx: INTEGER;
|
||||||
|
right, left, top, bottom: INTEGER;
|
||||||
|
BEGIN
|
||||||
|
eax := KOSAPI.sysfunc22(48, 5, ebx);
|
||||||
|
left := LSR(eax, 16);
|
||||||
|
right := eax MOD 65536;
|
||||||
|
top := LSR(ebx, 16);
|
||||||
|
bottom := ebx MOD 65536;
|
||||||
|
width := right - left + 1;
|
||||||
|
height := bottom - top + 1
|
||||||
|
END ScreenSize;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE ThreadID* (): INTEGER;
|
PROCEDURE ThreadID* (): INTEGER;
|
||||||
VAR
|
VAR
|
||||||
id: INTEGER;
|
id: INTEGER;
|
||||||
|
Loading…
Reference in New Issue
Block a user