CEdit: small changes; added tools->magnify and view->Tinypad

git-svn-id: svn://kolibrios.org@9457 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2021-12-22 15:56:11 +00:00
parent 770f4559be
commit 78e0396849
5 changed files with 51 additions and 24 deletions

Binary file not shown.

View File

@ -45,6 +45,26 @@ key1=0,0,128
key2=0,128,128 key2=0,128,128
key3=0,128,128 key3=0,128,128
[color_Tinypad]
text=0,0,0
back=255,255,255
seltext=255,255,255
selback=10,36,106
modified=255,238,98
saved=108,226,108
curline=255,255,255
numtext=0,0,0
numback=221,215,207
comment=128,128,128
string=176,0,0
escape=176,0,0
num=0,144,0
delim=48,48,240
key1=48,48,240
key2=0,128,128
key3=0,128,128
[lang_Oberon] [lang_Oberon]
KW1 = ARRAY,BEGIN,BY,CASE,CONST,DIV,DO,ELSE,ELSIF,END,FALSE,FOR,IF,IMPORT,IN,IS,MOD,MODULE,NIL,OF,OR,POINTER,PROCEDURE,RECORD,REPEAT,RETURN,THEN,TO,TRUE,TYPE,UNTIL,VAR,WHILE KW1 = ARRAY,BEGIN,BY,CASE,CONST,DIV,DO,ELSE,ELSIF,END,FALSE,FOR,IF,IMPORT,IN,IS,MOD,MODULE,NIL,OF,OR,POINTER,PROCEDURE,RECORD,REPEAT,RETURN,THEN,TO,TRUE,TYPE,UNTIL,VAR,WHILE
KW2 = ABS,ASR,ASSERT,BITS,BOOLEAN,BYTE,CHAR,CHR,COPY,DEC,DISPOSE,EXCL,FLOOR,FLT,INC,INCL,INTEGER,LEN,LENGTH,LSL,LSR,MAX,MIN,NEW,ODD,ORD,PACK,REAL,ROR,SET,UNPK,WCHAR,WCHR KW2 = ABS,ASR,ASSERT,BITS,BOOLEAN,BYTE,CHAR,CHR,COPY,DEC,DISPOSE,EXCL,FLOOR,FLT,INC,INCL,INTEGER,LEN,LENGTH,LSL,LSR,MAX,MIN,NEW,ODD,ORD,PACK,REAL,ROR,SET,UNPK,WCHAR,WCHR

View File

@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar; RW, Ini, EB := EditBox, Tabs, Toolbar;
CONST CONST
HEADER = "CEdit (21-dec-2021)"; HEADER = "CEdit (22-dec-2021)";
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";
@ -73,11 +73,13 @@ CONST
minWinWidth = 635; minWinHeight = 550; minWinWidth = 635; minWinHeight = 550;
SEARCH_PADDING = 10; SEARCH_PADDING = 10;
searchLeft = 0; LEFT_PADDING = 1;
RIGHT_PADDING = 1;
EditBox_Width = 180; EditBox_Width = 180;
EDITBOX_MAXCHARS = 500; EDITBOX_MAXCHARS = 500;
menuFileX = searchLeft; menuFileX = Menu.MainMenuX;
menuEditX = menuFileX + 4*fontWidth + 9; menuEditX = menuFileX + 4*fontWidth + 9;
menuSearchX = menuEditX + 4*fontWidth + 9; menuSearchX = menuEditX + 4*fontWidth + 9;
menuEncodingX = menuSearchX + 6*fontWidth + 9; menuEncodingX = menuSearchX + 6*fontWidth + 9;
@ -136,8 +138,9 @@ CONST
menuEOL = 140; menuEOL = 140;
menuPipet = 70; menuPipet = 70;
menuBoard = 71; menuMagnify = 71;
menuSysFunc = 72; menuBoard = 72;
menuSysFunc = 73;
menuFind = 80; menuFind = 80;
menuFindNext = 81; menuFindNext = 81;
@ -375,7 +378,7 @@ BEGIN
SetCaption(text.fileName); SetCaption(text.fileName);
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - (LEFT + 16*fontWidth), BOTTOM - scrollWidth + 1, K.winColor); K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - (LEFT + 16*fontWidth), BOTTOM - scrollWidth + 1, K.winColor);
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2; y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
K.DrawText(width - LENGTH(s)*fontWidth, y, K.textColor, s); K.DrawText(width - LENGTH(s)*fontWidth - (RIGHT_PADDING + 1), y, K.textColor, s);
MarkModified MarkModified
END DrawState; END DrawState;
@ -394,7 +397,7 @@ PROCEDURE repaint;
VAR VAR
width, height, scrollX, scrollY, y: INTEGER; width, height, scrollX, scrollY, y: INTEGER;
BEGIN BEGIN
IF text # NIL THEN IF (text # NIL) & ~K.RolledUp() THEN
IF confirm THEN IF confirm THEN
K.DeleteButton(btnYes); K.DeleteButton(btnYes);
K.DeleteButton(btnNo); K.DeleteButton(btnNo);
@ -462,8 +465,8 @@ BEGIN
K.WinSize(winWidth, winHeight); K.WinSize(winWidth, winHeight);
K.ClientSize(cliWidth, cliHeight); K.ClientSize(cliWidth, cliHeight);
G.destroy(canvas); G.destroy(canvas);
canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2), cliHeight - (TOP + BOTTOM + 1)); canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), cliHeight - (TOP + BOTTOM + 1));
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 2), Tabs.tabHeight); Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), Tabs.tabHeight);
G.SetFont(canvas, font); G.SetFont(canvas, font);
T.setCanvas(canvas); T.setCanvas(canvas);
T.resize(canvas.width, canvas.height); T.resize(canvas.width, canvas.height);
@ -537,6 +540,7 @@ BEGIN
K.DrawRect(0, 0, width, TOP, K.winColor); K.DrawRect(0, 0, width, TOP, K.winColor);
K.DrawRect(0, 0, LEFT, height, 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, scrollWidth - 1, scrollWidth, K.winColor); K.DrawRect(LEFT + canvas.width + 1, TOP + canvas.height, scrollWidth - 1, scrollWidth, K.winColor);
Menu.DrawMain(mainMenu); Menu.DrawMain(mainMenu);
@ -544,7 +548,7 @@ BEGIN
DrawState(text, width, height); DrawState(text, width, height);
IF search & searchOpened THEN IF search & searchOpened THEN
SearchPanel(searchLeft, TOP) SearchPanel(LEFT_PADDING, TOP)
END; END;
Tabs.draw(tabs); Tabs.draw(tabs);
repaint repaint
@ -704,7 +708,6 @@ PROCEDURE Confirm;
CONST CONST
width = btnWidth*2 + 30; width = btnWidth*2 + 30;
height = btnHeight*2 + 20; height = btnHeight*2 + 20;
lineColor = 808080H;
VAR VAR
left, top, right, bottom: INTEGER; left, top, right, bottom: INTEGER;
BEGIN BEGIN
@ -716,7 +719,7 @@ BEGIN
right := left + width - 1; right := left + width - 1;
bottom := top + height - 1; bottom := top + height - 1;
K.DrawRect(left, top, width, height, K.winColor); K.DrawRect(left, top, width, height, K.winColor);
Rect(left, top, right, bottom, lineColor); Rect(left, top, right, bottom, K.borderColor);
K.DrawText866(left + (width - 10*fontWidth) DIV 2, top + 10, K.textColor, "save file?"); 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(btnYes, left + 10, top + 35, btnWidth, btnHeight, K.btnColor, "yes");
K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.btnColor, "no"); K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.btnColor, "no");
@ -833,9 +836,9 @@ END open;
PROCEDURE createSearchForm; PROCEDURE createSearchForm;
BEGIN BEGIN
EB.create(searchLeft, TOP + 20, EditBox_Width, EDITBOX_MAXCHARS, FindEdit); EB.create(LEFT_PADDING, TOP + 20, EditBox_Width, EDITBOX_MAXCHARS, FindEdit);
EB.create(searchLeft, TOP + 20 + 55, EditBox_Width, EDITBOX_MAXCHARS, ReplaceEdit); EB.create(LEFT_PADDING, TOP + 20 + 55, EditBox_Width, EDITBOX_MAXCHARS, ReplaceEdit);
EB.create(searchLeft, TOP + 20 + 330, EditBox_Width, EDITBOX_MAXCHARS, GotoEdit); EB.create(LEFT_PADDING, TOP + 20 + 330, EditBox_Width, EDITBOX_MAXCHARS, GotoEdit);
INCL(GotoEdit.flags, 15); INCL(GotoEdit.flags, 15);
CheckBox.create("backward", BKW); CheckBox.create("backward", BKW);
CheckBox.create("match case", CS); CheckBox.create("match case", CS);
@ -861,10 +864,10 @@ END EditBox_GetValue;
PROCEDURE Search; PROCEDURE Search;
BEGIN BEGIN
search := ~search; search := ~search;
LEFT := searchLeft; LEFT := LEFT_PADDING;
IF search THEN IF search THEN
searchOpened := TRUE; searchOpened := TRUE;
INC(LEFT, EditBox_Width + SEARCH_PADDING*2 + 5); INC(LEFT, EditBox_Width + SEARCH_PADDING*2 + 4);
IF T.search(text, searchText, cs, whole) THEN END IF T.search(text, searchText, cs, whole) THEN END
ELSE ELSE
IF T.search(text, "", FALSE, FALSE) THEN END IF T.search(text, "", FALSE, FALSE) THEN END
@ -1250,6 +1253,8 @@ BEGIN
T.setEol(text, RW.EOL_CR) T.setEol(text, RW.EOL_CR)
|menuPipet: |menuPipet:
K.Run("/rd/1/develop/pipet", "") K.Run("/rd/1/develop/pipet", "")
|menuMagnify:
K.Run("/rd/1/magnify", "")
|menuBoard: |menuBoard:
K.Run("/rd/1/develop/board", "") K.Run("/rd/1/develop/board", "")
|menuSysFunc: |menuSysFunc:
@ -1509,6 +1514,7 @@ VAR
BEGIN BEGIN
menu := List.create(NIL); menu := List.create(NIL);
Menu.AddMenuItem(menu, menuPipet, "pipet"); Menu.AddMenuItem(menu, menuPipet, "pipet");
Menu.AddMenuItem(menu, menuMagnify, "magnify");
Menu.AddMenuItem(menu, menuBoard, "board"); Menu.AddMenuItem(menu, menuBoard, "board");
Menu.AddMenuItem(menu, menuSysFunc, "system functions"); Menu.AddMenuItem(menu, menuSysFunc, "system functions");
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown) RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
@ -1566,7 +1572,7 @@ PROCEDURE HideSearch;
BEGIN BEGIN
SetFocus(FindEdit, FALSE); SetFocus(FindEdit, FALSE);
searchOpened := FALSE; searchOpened := FALSE;
LEFT := searchLeft; LEFT := LEFT_PADDING;
resize; resize;
draw_window draw_window
END HideSearch; END HideSearch;
@ -2000,8 +2006,8 @@ BEGIN
winHeight := MAX(winHeight, minWinHeight); winHeight := MAX(winHeight, minWinHeight);
cliWidth := winWidth; cliWidth := winWidth;
cliHeight := winHeight; cliHeight := winHeight;
LEFT := searchLeft; LEFT := LEFT_PADDING;
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11), winHeight - (TOP + BOTTOM + 5) - K.SkinHeight()); canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - K.SkinHeight());
tabs := Tabs.create(); tabs := Tabs.create();
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight); Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight);
font1 := G.CreateFont(1, "", {}); font1 := G.CreateFont(1, "", {});
@ -2042,7 +2048,7 @@ BEGIN
Menu.AddMainItem(mainMenu, "program", menuProgram); Menu.AddMainItem(mainMenu, "program", menuProgram);
Menu.AddMainItem(mainMenu, "tools", menuTools); Menu.AddMainItem(mainMenu, "tools", menuTools);
Toolbar.create(toolbar, searchLeft, toolbarTop); Toolbar.create(toolbar, LEFT_PADDING + 1, toolbarTop);
Toolbar.add(toolbar, btnNew, 2, ""); Toolbar.add(toolbar, btnNew, 2, "");
Toolbar.add(toolbar, btnOpen, 0, ""); Toolbar.add(toolbar, btnOpen, 0, "");
Toolbar.add(toolbar, btnSave, 5, ""); Toolbar.add(toolbar, btnSave, 5, "");

View File

@ -27,6 +27,7 @@ CONST
fontWidth = 8; fontWidth = 8;
MainMenuHeight* = K.fontHeight + 7; MainMenuHeight* = K.fontHeight + 7;
MainMenuX* = 0;
RIGHT = 16; RIGHT = 16;
LEFT = 16; LEFT = 16;
@ -111,7 +112,7 @@ BEGIN
IF prev # NIL THEN IF prev # NIL THEN
item.x := prev.x + LENGTH(prev.text)*fontWidth + 9 item.x := prev.x + LENGTH(prev.text)*fontWidth + 9
ELSE ELSE
item.x := 0 item.x := MainMenuX
END END
END AddMainItem; END AddMainItem;

View File

@ -1501,7 +1501,7 @@ BEGIN
n := selEnd.Y - selBeg.Y; n := selEnd.Y - selBeg.Y;
cnt := 0; cnt := 0;
WHILE n >= 0 DO WHILE n >= 0 DO
INC(cnt, line.length + (lenEOL + 1)); INC(cnt, line.length + (lenEOL + ORD(U.OS = "KOS")));
NextLine(line); NextLine(line);
DEC(n) DEC(n)
END; END;
@ -1511,7 +1511,7 @@ BEGIN
n := selEnd.Y - selBeg.Y; n := selEnd.Y - selBeg.Y;
line := first; line := first;
IF n = 0 THEN IF n = 0 THEN
CB.append(buffer, line, selBeg.X, selEnd.X - 1) append(buffer, line, selBeg.X, selEnd.X - 1)
ELSE ELSE
append(buffer, line, selBeg.X, line.length - 1); append(buffer, line, selBeg.X, line.length - 1);
REPEAT REPEAT