mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-26 16:37:30 +03:00
CEdit: bug fixes; added "options" menu; saving settings
git-svn-id: svn://kolibrios.org@9671 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
498f3ad1a7
commit
b67dfd8e55
Binary file not shown.
@ -1,6 +1,12 @@
|
|||||||
[settings]
|
[settings]
|
||||||
tab=4
|
tab=4
|
||||||
blink=70
|
blink=70
|
||||||
|
line_numbers=1
|
||||||
|
auto_indents=1
|
||||||
|
auto_brackets=0
|
||||||
|
trim_space=1
|
||||||
|
font=1
|
||||||
|
theme=0
|
||||||
build=
|
build=
|
||||||
run=
|
run=
|
||||||
debug=
|
debug=
|
||||||
@ -77,7 +83,7 @@ KW3 =
|
|||||||
|
|
||||||
[lang_C]
|
[lang_C]
|
||||||
KW1 = auto,break,case,char,const,continue,default,do,double,else,enum,extern,float,for,goto,if,int,long,register,return,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile,while,dword,byte,bool,NULL
|
KW1 = auto,break,case,char,const,continue,default,do,double,else,enum,extern,float,for,goto,if,int,long,register,return,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile,while,dword,byte,bool,NULL
|
||||||
KW2 = define,error,include,elif,if,line,else,ifdef,pragma,endif,ifndef,undef
|
KW2 = #define,#error,#include,#elif,#if,#line,#else,#ifdef,#pragma,#endif,#ifndef,#undef
|
||||||
KW3 =
|
KW3 =
|
||||||
|
|
||||||
[lang_Lua]
|
[lang_Lua]
|
||||||
|
@ -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-jan-2022)";
|
HEADER = "CEdit (26-jan-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";
|
||||||
@ -76,15 +76,6 @@ CONST
|
|||||||
EditBox_Width = 180;
|
EditBox_Width = 180;
|
||||||
EDITBOX_MAXCHARS = 500;
|
EDITBOX_MAXCHARS = 500;
|
||||||
|
|
||||||
menuFileX = Menu.MainMenuX;
|
|
||||||
menuEditX = menuFileX + 4*fontWidth + 9;
|
|
||||||
menuSearchX = menuEditX + 4*fontWidth + 9;
|
|
||||||
menuEncodingX = menuSearchX + 6*fontWidth + 9;
|
|
||||||
menuViewX = menuEncodingX + 8*fontWidth + 9;
|
|
||||||
menuLanguageX = menuViewX + 4*fontWidth + 9;
|
|
||||||
menuProgramX = menuLanguageX + 8*fontWidth + 9;
|
|
||||||
menuToolsX = menuProgramX + 7*fontWidth + 9;
|
|
||||||
|
|
||||||
menuCut = 1;
|
menuCut = 1;
|
||||||
menuCopy = 2;
|
menuCopy = 2;
|
||||||
menuPaste = 3;
|
menuPaste = 3;
|
||||||
@ -107,10 +98,9 @@ CONST
|
|||||||
menuClose = 16;
|
menuClose = 16;
|
||||||
menuExit = 17;
|
menuExit = 17;
|
||||||
|
|
||||||
menuNumbers = 20;
|
menuFontSmall = 20;
|
||||||
menuFontSmall = 21;
|
menuFontMedium = menuFontSmall + 1;
|
||||||
menuFontMedium = 22;
|
menuFontLarge = menuFontMedium + 1;
|
||||||
menuFontBig = 23;
|
|
||||||
menuColors = 1000;
|
menuColors = 1000;
|
||||||
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
|
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
|
||||||
|
|
||||||
@ -147,6 +137,11 @@ CONST
|
|||||||
menuGoto = 83;
|
menuGoto = 83;
|
||||||
menuBookmark = 130;
|
menuBookmark = 130;
|
||||||
|
|
||||||
|
menuLineNumbers = 90;
|
||||||
|
menuAutoIndents = 91;
|
||||||
|
menuAutoBrackets = 92;
|
||||||
|
menuTrimSpace = 93;
|
||||||
|
|
||||||
menuMoveUp = 101;
|
menuMoveUp = 101;
|
||||||
menuMoveDown = 102;
|
menuMoveDown = 102;
|
||||||
menuDuplicate = 103;
|
menuDuplicate = 103;
|
||||||
@ -202,7 +197,7 @@ VAR
|
|||||||
replaced: INTEGER;
|
replaced: INTEGER;
|
||||||
|
|
||||||
context, menuFile, menuEdit, menuSearch, menuEncoding,
|
context, menuFile, menuEdit, menuSearch, menuEncoding,
|
||||||
menuView, menuLanguage, menuProgram, menuTools,
|
menuView, menuLanguage, menuProgram, menuTools, menuOptions,
|
||||||
subCurLine, subIndent, subCase, subBookmark, subEOL: Menu.tMenu;
|
subCurLine, subIndent, subCase, subBookmark, subEOL: Menu.tMenu;
|
||||||
|
|
||||||
mainMenu: Menu.tMain;
|
mainMenu: Menu.tMain;
|
||||||
@ -439,10 +434,10 @@ BEGIN
|
|||||||
K.SetWinSize(winWidth, winHeight);
|
K.SetWinSize(winWidth, winHeight);
|
||||||
K.WinSize(winWidth, winHeight);
|
K.WinSize(winWidth, winHeight);
|
||||||
K.ClientSize(cliWidth, cliHeight);
|
K.ClientSize(cliWidth, cliHeight);
|
||||||
IF font # G.font2 THEN
|
IF font # G.fonts[2] THEN
|
||||||
SB.SetFont(font)
|
SB.SetFont(font)
|
||||||
ELSE
|
ELSE
|
||||||
SB.SetFont(G.font1)
|
SB.SetFont(G.fonts[1])
|
||||||
END;
|
END;
|
||||||
BOTTOM := SB.height() + scrollWidth - 1;
|
BOTTOM := SB.height() + scrollWidth - 1;
|
||||||
G.destroy(canvas);
|
G.destroy(canvas);
|
||||||
@ -929,6 +924,7 @@ BEGIN
|
|||||||
Menu.close(menuLanguage);
|
Menu.close(menuLanguage);
|
||||||
Menu.close(menuProgram);
|
Menu.close(menuProgram);
|
||||||
Menu.close(menuTools);
|
Menu.close(menuTools);
|
||||||
|
Menu.close(menuOptions);
|
||||||
Menu.close(context)
|
Menu.close(context)
|
||||||
END CloseMenu;
|
END CloseMenu;
|
||||||
|
|
||||||
@ -1023,8 +1019,7 @@ BEGIN
|
|||||||
WHILE (i < textsCount) & ~texts[i].modified DO
|
WHILE (i < textsCount) & ~texts[i].modified DO
|
||||||
INC(i)
|
INC(i)
|
||||||
END;
|
END;
|
||||||
Menu.setEnabled(menu, menuSaveAll, i < textsCount);
|
Menu.setEnabled(menu, menuSaveAll, i < textsCount)
|
||||||
INC(x, menuFileX)
|
|
||||||
ELSIF (menu = menuEdit) OR (menu = context) THEN
|
ELSIF (menu = menuEdit) OR (menu = context) THEN
|
||||||
Menu.setEnabled(menu, menuUndo, ~ChangeLog.isFirstGuard(text.edition));
|
Menu.setEnabled(menu, menuUndo, ~ChangeLog.isFirstGuard(text.edition));
|
||||||
Menu.setEnabled(menu, menuRedo, ~ChangeLog.isLastGuard(text.edition));
|
Menu.setEnabled(menu, menuRedo, ~ChangeLog.isLastGuard(text.edition));
|
||||||
@ -1032,32 +1027,29 @@ BEGIN
|
|||||||
Menu.setEnabled(menu, menuCopy, selected);
|
Menu.setEnabled(menu, menuCopy, selected);
|
||||||
Menu.setEnabled(menu, menuDelete, selected);
|
Menu.setEnabled(menu, menuDelete, selected);
|
||||||
Menu.setEnabled(menu, menuPaste, CB.available());
|
Menu.setEnabled(menu, menuPaste, CB.available());
|
||||||
IF menu = menuEdit THEN
|
IF menu = context THEN
|
||||||
INC(x, menuEditX)
|
|
||||||
ELSE
|
|
||||||
IF y + menu.height >= canvas.height THEN
|
IF y + menu.height >= canvas.height THEN
|
||||||
DEC(y, menu.height)
|
DEC(y, menu.height)
|
||||||
END;
|
END;
|
||||||
IF x + menu.width >= canvas.width THEN
|
IF x + menu.width >= canvas.width THEN
|
||||||
DEC(x, menu.width)
|
DEC(x, menu.width)
|
||||||
END;
|
END;
|
||||||
CanvasToScreen(x, y)
|
CanvasToScreen(x, y);
|
||||||
|
menu.x := x;
|
||||||
|
x := 0
|
||||||
END
|
END
|
||||||
ELSIF menu = menuEncoding THEN
|
ELSIF menu = menuEncoding THEN
|
||||||
Menu.option(menu, menuUTF8BOM, T.getEnc(text) = E.UTF8BOM);
|
Menu.option(menu, menuUTF8BOM, T.getEnc(text) = E.UTF8BOM);
|
||||||
Menu.option(menu, menuUTF8, T.getEnc(text) = E.UTF8);
|
Menu.option(menu, menuUTF8, T.getEnc(text) = E.UTF8);
|
||||||
Menu.option(menu, menuCP866, T.getEnc(text) = E.CP866);
|
Menu.option(menu, menuCP866, T.getEnc(text) = E.CP866);
|
||||||
Menu.option(menu, menuWin1251, T.getEnc(text) = E.W1251);
|
Menu.option(menu, menuWin1251, T.getEnc(text) = E.W1251)
|
||||||
INC(x, menuEncodingX)
|
|
||||||
ELSIF menu = menuView THEN
|
ELSIF menu = menuView THEN
|
||||||
Menu.check(menu, menuNumbers, text.numbers);
|
Menu.option(menu, menuFontSmall, font = G.fonts[0]);
|
||||||
Menu.option(menu, menuFontSmall, font = G.font0);
|
Menu.option(menu, menuFontMedium, font = G.fonts[1]);
|
||||||
Menu.option(menu, menuFontMedium, font = G.font1);
|
Menu.option(menu, menuFontLarge, font = G.fonts[2]);
|
||||||
Menu.option(menu, menuFontBig, font = G.font2);
|
|
||||||
FOR i := 0 TO Ini.sections.count - 1 DO
|
FOR i := 0 TO Ini.sections.count - 1 DO
|
||||||
Menu.option(menu, menuColors + i, Ini.curSectionNum = i)
|
Menu.option(menu, menuColors + i, Ini.curSectionNum = i)
|
||||||
END;
|
END
|
||||||
INC(x, menuViewX)
|
|
||||||
ELSIF menu = menuLanguage THEN
|
ELSIF menu = menuLanguage THEN
|
||||||
Menu.option(menu, menuText, text.lang = Languages.langText);
|
Menu.option(menu, menuText, text.lang = Languages.langText);
|
||||||
Menu.option(menu, menuC, text.lang = Languages.langC);
|
Menu.option(menu, menuC, text.lang = Languages.langC);
|
||||||
@ -1067,16 +1059,15 @@ BEGIN
|
|||||||
Menu.option(menu, menuLua, text.lang = Languages.langLua);
|
Menu.option(menu, menuLua, text.lang = Languages.langLua);
|
||||||
Menu.option(menu, menuOberon, text.lang = Languages.langOberon);
|
Menu.option(menu, menuOberon, text.lang = Languages.langOberon);
|
||||||
Menu.option(menu, menuPascal, text.lang = Languages.langPascal);
|
Menu.option(menu, menuPascal, text.lang = Languages.langPascal);
|
||||||
INC(x, menuLanguageX)
|
|
||||||
ELSIF menu = menuProgram THEN
|
ELSIF menu = menuProgram THEN
|
||||||
Menu.setEnabled(menu, menuBuild, buildScript # "");
|
Menu.setEnabled(menu, menuBuild, buildScript # "");
|
||||||
Menu.setEnabled(menu, menuDebug, debugScript # "");
|
Menu.setEnabled(menu, menuDebug, debugScript # "");
|
||||||
Menu.setEnabled(menu, menuRun, runScript # "");
|
Menu.setEnabled(menu, menuRun, runScript # "")
|
||||||
INC(x, menuProgramX)
|
ELSIF menu = menuOptions THEN
|
||||||
ELSIF menu = menuTools THEN
|
Menu.check(menu, menuLineNumbers, T.lineNumbers);
|
||||||
INC(x, menuToolsX)
|
Menu.check(menu, menuAutoIndents, T.autoIndents);
|
||||||
ELSIF menu = menuSearch THEN
|
Menu.check(menu, menuAutoBrackets, T.autoBrackets);
|
||||||
INC(x, menuSearchX)
|
Menu.check(menu, menuTrimSpace, T.trimSpace)
|
||||||
END;
|
END;
|
||||||
|
|
||||||
enabled := search & (searchText # "");
|
enabled := search & (searchText # "");
|
||||||
@ -1098,7 +1089,7 @@ BEGIN
|
|||||||
IF Menu.opened(menu) THEN
|
IF Menu.opened(menu) THEN
|
||||||
Menu.close(menu)
|
Menu.close(menu)
|
||||||
END;
|
END;
|
||||||
Menu.open(menu, x, y);
|
Menu.open(menu, menu.x + x, y);
|
||||||
menuActive := TRUE
|
menuActive := TRUE
|
||||||
END
|
END
|
||||||
END ShowMenu;
|
END ShowMenu;
|
||||||
@ -1175,16 +1166,9 @@ BEGIN
|
|||||||
T.gotoLabel(text, TRUE)
|
T.gotoLabel(text, TRUE)
|
||||||
|menuPrevBookmark:
|
|menuPrevBookmark:
|
||||||
T.gotoLabel(text, FALSE)
|
T.gotoLabel(text, FALSE)
|
||||||
|menuNumbers:
|
|menuFontSmall..menuFontLarge:
|
||||||
T.toggleNumbers(text)
|
font := G.fonts[Menu.MenuItem - menuFontSmall];
|
||||||
|menuFontSmall:
|
Ini.setInt("settings", "font", Menu.MenuItem - menuFontSmall);
|
||||||
font := G.font0;
|
|
||||||
resize
|
|
||||||
|menuFontMedium:
|
|
||||||
font := G.font1;
|
|
||||||
resize
|
|
||||||
|menuFontBig:
|
|
||||||
font := G.font2;
|
|
||||||
resize
|
resize
|
||||||
|menuText:
|
|menuText:
|
||||||
T.setLang(text, Languages.langText)
|
T.setLang(text, Languages.langText)
|
||||||
@ -1236,8 +1220,21 @@ BEGIN
|
|||||||
K.Run("/sys/develop/board", "")
|
K.Run("/sys/develop/board", "")
|
||||||
|menuSysFunc:
|
|menuSysFunc:
|
||||||
K.Run("/sys/docpack", "f")
|
K.Run("/sys/docpack", "f")
|
||||||
|
|menuLineNumbers:
|
||||||
|
T.toggleNumbers;
|
||||||
|
Ini.setInt("settings", "line_numbers", ORD(T.lineNumbers))
|
||||||
|
|menuAutoIndents:
|
||||||
|
T.toggleIndents;
|
||||||
|
Ini.setInt("settings", "auto_indents", ORD(T.autoIndents))
|
||||||
|
|menuAutoBrackets:
|
||||||
|
T.toggleBrackets;
|
||||||
|
Ini.setInt("settings", "auto_brackets", ORD(T.autoBrackets))
|
||||||
|
|menuTrimSpace:
|
||||||
|
T.toggleTrimSpace;
|
||||||
|
Ini.setInt("settings", "trim_space", ORD(T.trimSpace))
|
||||||
|menuColors..menuMaxColors:
|
|menuColors..menuMaxColors:
|
||||||
Ini.selectSection(Menu.MenuItem - menuColors)
|
Ini.selectSection(Menu.MenuItem - menuColors);
|
||||||
|
Ini.setInt("settings", "theme", Menu.MenuItem - menuColors)
|
||||||
|menuMoveUp:
|
|menuMoveUp:
|
||||||
T.MoveLines(text, FALSE)
|
T.MoveLines(text, FALSE)
|
||||||
|menuMoveDown:
|
|menuMoveDown:
|
||||||
@ -1372,11 +1369,9 @@ VAR
|
|||||||
idx: INTEGER;
|
idx: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
menu := List.create(NIL);
|
menu := List.create(NIL);
|
||||||
Menu.AddMenuItem(menu, menuNumbers, "line numbers");
|
|
||||||
Menu.delimiter(menu);
|
|
||||||
Menu.AddMenuItem(menu, menuFontSmall, "small");
|
Menu.AddMenuItem(menu, menuFontSmall, "small");
|
||||||
Menu.AddMenuItem(menu, menuFontMedium, "medium");
|
Menu.AddMenuItem(menu, menuFontMedium, "medium");
|
||||||
Menu.AddMenuItem(menu, menuFontBig, "big");
|
Menu.AddMenuItem(menu, menuFontLarge, "large");
|
||||||
Menu.delimiter(menu);
|
Menu.delimiter(menu);
|
||||||
|
|
||||||
colors := Ini.sections.first(Ini.tSection);
|
colors := Ini.sections.first(Ini.tSection);
|
||||||
@ -1439,6 +1434,19 @@ BEGIN
|
|||||||
END CreateMenuTools;
|
END CreateMenuTools;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE CreateMenuOptions (): Menu.tMenu;
|
||||||
|
VAR
|
||||||
|
menu: List.tList;
|
||||||
|
BEGIN
|
||||||
|
menu := List.create(NIL);
|
||||||
|
Menu.AddMenuItem(menu, menuLineNumbers, "line numbers");
|
||||||
|
Menu.AddMenuItem(menu, menuAutoIndents, "automatic indents");
|
||||||
|
Menu.AddMenuItem(menu, menuAutoBrackets, "automatic brackets");
|
||||||
|
Menu.AddMenuItem(menu, menuTrimSpace, "trim trailing space");
|
||||||
|
RETURN Menu.create(menu)
|
||||||
|
END CreateMenuOptions;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE CreateMenuCurLine(): Menu.tMenu;
|
PROCEDURE CreateMenuCurLine(): Menu.tMenu;
|
||||||
VAR
|
VAR
|
||||||
menu: List.tList;
|
menu: List.tList;
|
||||||
@ -1940,7 +1948,6 @@ VAR
|
|||||||
firstClickX, firstClickY, time, blink, i: INTEGER;
|
firstClickX, firstClickY, time, blink, i: INTEGER;
|
||||||
key, scr: INTEGER;
|
key, scr: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
font := G.font1;
|
|
||||||
header := "";
|
header := "";
|
||||||
K.GetSystemColors;
|
K.GetSystemColors;
|
||||||
switch := FALSE;
|
switch := FALSE;
|
||||||
@ -1949,6 +1956,10 @@ BEGIN
|
|||||||
curText := 0;
|
curText := 0;
|
||||||
Args.GetArg(0, AppPath);
|
Args.GetArg(0, AppPath);
|
||||||
Ini.load(AppPath);
|
Ini.load(AppPath);
|
||||||
|
Ini.getSettings;
|
||||||
|
runScript := Ini.runScript;
|
||||||
|
buildScript := Ini.buildScript;
|
||||||
|
debugScript := Ini.debugScript;
|
||||||
leftButton := FALSE;
|
leftButton := FALSE;
|
||||||
resized := FALSE;
|
resized := FALSE;
|
||||||
K.ScreenSize(winWidth, winHeight);
|
K.ScreenSize(winWidth, winHeight);
|
||||||
@ -1967,8 +1978,10 @@ BEGIN
|
|||||||
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - SkinHeight);
|
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11 + RIGHT_PADDING), winHeight - (TOP + BOTTOM + 5) - 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);
|
||||||
|
font := G.fonts[Ini.font];
|
||||||
G.SetFont(canvas, font);
|
G.SetFont(canvas, font);
|
||||||
T.init(resetTimer);
|
T.init(resetTimer, Ini.lineNumbers, Ini.autoIndents, Ini.autoBrackets, Ini.trimSpace);
|
||||||
|
Ini.selectSection(Ini.theme);
|
||||||
T.setCanvas(canvas);
|
T.setCanvas(canvas);
|
||||||
|
|
||||||
Menu.init(resetTimer);
|
Menu.init(resetTimer);
|
||||||
@ -1991,6 +2004,7 @@ BEGIN
|
|||||||
menuLanguage := CreateMenuLanguage();
|
menuLanguage := CreateMenuLanguage();
|
||||||
menuProgram := CreateMenuProgram();
|
menuProgram := CreateMenuProgram();
|
||||||
menuTools := CreateMenuTools();
|
menuTools := CreateMenuTools();
|
||||||
|
menuOptions := CreateMenuOptions();
|
||||||
|
|
||||||
mainMenu := Menu.CreateMain(mainMenuBtn);
|
mainMenu := Menu.CreateMain(mainMenuBtn);
|
||||||
Menu.AddMainItem(mainMenu, "file", menuFile);
|
Menu.AddMainItem(mainMenu, "file", menuFile);
|
||||||
@ -2001,6 +2015,7 @@ BEGIN
|
|||||||
Menu.AddMainItem(mainMenu, "language", menuLanguage);
|
Menu.AddMainItem(mainMenu, "language", menuLanguage);
|
||||||
Menu.AddMainItem(mainMenu, "program", menuProgram);
|
Menu.AddMainItem(mainMenu, "program", menuProgram);
|
||||||
Menu.AddMainItem(mainMenu, "tools", menuTools);
|
Menu.AddMainItem(mainMenu, "tools", menuTools);
|
||||||
|
Menu.AddMainItem(mainMenu, "options", menuOptions);
|
||||||
Shortcuts;
|
Shortcuts;
|
||||||
|
|
||||||
Toolbar.create(toolbar, LEFT_PADDING + 5, toolbarTop);
|
Toolbar.create(toolbar, LEFT_PADDING + 5, toolbarTop);
|
||||||
@ -2019,8 +2034,6 @@ BEGIN
|
|||||||
Toolbar.add(toolbar, btnBuild, 54, "");
|
Toolbar.add(toolbar, btnBuild, 54, "");
|
||||||
Toolbar.add(toolbar, btnRun, 53, "");
|
Toolbar.add(toolbar, btnRun, 53, "");
|
||||||
|
|
||||||
Ini.getSettings(buildScript, runScript, debugScript);
|
|
||||||
|
|
||||||
filePath := "/sys";
|
filePath := "/sys";
|
||||||
IF Args.argc = 1 THEN
|
IF Args.argc = 1 THEN
|
||||||
text := T.New();
|
text := T.New();
|
||||||
|
@ -82,7 +82,7 @@ BEGIN
|
|||||||
res.mouse := FALSE;
|
res.mouse := FALSE;
|
||||||
COPY(text, res.text);
|
COPY(text, res.text);
|
||||||
res.canvas := G.CreateCanvas(fontHeight + padding + LENGTH(res.text)*fontWidth, fontHeight + 1);
|
res.canvas := G.CreateCanvas(fontHeight + padding + LENGTH(res.text)*fontWidth, fontHeight + 1);
|
||||||
G.SetFont(res.canvas, G.font1);
|
G.SetFont(res.canvas, G.fonts[1]);
|
||||||
chkbox := res
|
chkbox := res
|
||||||
END create;
|
END create;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ TYPE
|
|||||||
|
|
||||||
VAR
|
VAR
|
||||||
|
|
||||||
font0*, font1*, font2*: tFont;
|
fonts*: ARRAY 3 OF tFont;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE getRGB* (color: INTEGER; VAR r, g, b: BYTE);
|
PROCEDURE getRGB* (color: INTEGER; VAR r, g, b: BYTE);
|
||||||
@ -302,7 +302,7 @@ BEGIN
|
|||||||
IF c = Lines.NUL THEN
|
IF c = Lines.NUL THEN
|
||||||
c := 0X
|
c := 0X
|
||||||
END;
|
END;
|
||||||
IF font = font0 THEN
|
IF font = fonts[0] THEN
|
||||||
ch := E.UNI[ORD(c), E.CP866];
|
ch := E.UNI[ORD(c), E.CP866];
|
||||||
IF ch = E.UNDEF THEN
|
IF ch = E.UNDEF THEN
|
||||||
c := "?"
|
c := "?"
|
||||||
@ -354,7 +354,7 @@ END destroy;
|
|||||||
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
font0 := CreateFont(0, "", {});
|
fonts[0] := CreateFont(0, "", {});
|
||||||
font1 := CreateFont(1, "", {});
|
fonts[1] := CreateFont(1, "", {});
|
||||||
font2 := CreateFont(2, "", {});
|
fonts[2] := CreateFont(2, "", {});
|
||||||
END Graph.
|
END Graph.
|
@ -51,13 +51,17 @@ VAR
|
|||||||
|
|
||||||
curSection*: tASCIISectionName;
|
curSection*: tASCIISectionName;
|
||||||
curSectionNum*: INTEGER;
|
curSectionNum*: INTEGER;
|
||||||
blink*: INTEGER;
|
|
||||||
|
blink*, font*, theme*: INTEGER;
|
||||||
|
buildScript*, runScript*, debugScript*: RW.tFileName;
|
||||||
|
lineNumbers*, autoIndents*, autoBrackets*, trimSpace*: BOOLEAN;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE [stdcall, "libini.obj", "ini_get_color"] get_color (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
|
PROCEDURE [stdcall, "libini.obj", "ini_get_color"] get_color (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
|
||||||
PROCEDURE [stdcall, "libini.obj", "ini_get_int"] get_int (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
|
PROCEDURE [stdcall, "libini.obj", "ini_get_int"] get_int (f_name: RW.tFileName; sec_name: tASCIISectionName; key_name: tString; def_val: INTEGER): INTEGER; END;
|
||||||
PROCEDURE [stdcall, "libini.obj", "ini_get_str"] get_str (f_name, sec_name, key_name, buffer, buf_len, def_val: INTEGER): INTEGER; END;
|
PROCEDURE [stdcall, "libini.obj", "ini_get_str"] get_str (f_name, sec_name, key_name, buffer, buf_len, def_val: INTEGER): INTEGER; END;
|
||||||
PROCEDURE [stdcall, "libini.obj", "ini_enum_sections"] enum_sections (f_name: RW.tFileName; callback: INTEGER); END;
|
PROCEDURE [stdcall, "libini.obj", "ini_enum_sections"] enum_sections (f_name: RW.tFileName; callback: INTEGER); END;
|
||||||
|
PROCEDURE [stdcall-, "libini.obj", "ini_set_int"] set_int (f_name, sec_name, key_name, val: INTEGER): INTEGER; END;
|
||||||
|
|
||||||
PROCEDURE getColor (key: tString; def: INTEGER): INTEGER;
|
PROCEDURE getColor (key: tString; def: INTEGER): INTEGER;
|
||||||
RETURN get_color(IniFileName, curSection, key, def)
|
RETURN get_color(IniFileName, curSection, key, def)
|
||||||
@ -72,6 +76,12 @@ BEGIN
|
|||||||
END getStr;
|
END getStr;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE setInt* (secName, keyName: ARRAY OF CHAR; val: INTEGER);
|
||||||
|
BEGIN
|
||||||
|
set_int(SYSTEM.ADR(IniFileName[0]), SYSTEM.ADR(secName[0]), SYSTEM.ADR(keyName[0]), val)
|
||||||
|
END setInt;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE [stdcall] section_callback (fileName, sectionName: RW.tFileName): INTEGER;
|
PROCEDURE [stdcall] section_callback (fileName, sectionName: RW.tFileName): INTEGER;
|
||||||
VAR
|
VAR
|
||||||
section: tSection;
|
section: tSection;
|
||||||
@ -148,13 +158,25 @@ BEGIN
|
|||||||
END selectSection;
|
END selectSection;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE getSettings* (VAR build, run, debug: RW.tFileName);
|
PROCEDURE getSettings*;
|
||||||
BEGIN
|
BEGIN
|
||||||
Lines.setTabs(get_int(IniFileName, "settings", "tab", 4));
|
Lines.setTabs(get_int(IniFileName, "settings", "tab", 4));
|
||||||
blink := get_int(IniFileName, "settings", "blink", 70);
|
blink := get_int(IniFileName, "settings", "blink", 70);
|
||||||
getStr("settings", "build", build);
|
lineNumbers := get_int(IniFileName, "settings", "line_numbers", 1) # 0;
|
||||||
getStr("settings", "run", run);
|
autoIndents := get_int(IniFileName, "settings", "auto_indents", 1) # 0;
|
||||||
getStr("settings", "debug", debug)
|
autoBrackets := get_int(IniFileName, "settings", "auto_brackets", 0) # 0;
|
||||||
|
trimSpace := get_int(IniFileName, "settings", "trim_space", 1) # 0;
|
||||||
|
font := get_int(IniFileName, "settings", "font", 1);
|
||||||
|
IF ~((0 <= font) & (font <= 2)) THEN
|
||||||
|
font := 1
|
||||||
|
END;
|
||||||
|
theme := get_int(IniFileName, "settings", "theme", 0);
|
||||||
|
IF ~((0 <= theme) & (theme <= sections.count - 1)) THEN
|
||||||
|
theme := 0
|
||||||
|
END;
|
||||||
|
getStr("settings", "build", buildScript);
|
||||||
|
getStr("settings", "run", runScript);
|
||||||
|
getStr("settings", "debug", debugScript);
|
||||||
END getSettings;
|
END getSettings;
|
||||||
|
|
||||||
|
|
||||||
@ -167,12 +189,12 @@ BEGIN
|
|||||||
Utils.append8(IniFileName, fileName);
|
Utils.append8(IniFileName, fileName);
|
||||||
|
|
||||||
IF ~File.Exists(IniFileName) THEN
|
IF ~File.Exists(IniFileName) THEN
|
||||||
IniFileName := "/sys/settings/cedit.ini"
|
IniFileName := "/sys/settings/" + fileName
|
||||||
END;
|
END;
|
||||||
|
|
||||||
enum_sections(IniFileName, SYSTEM.ADR(section_callback));
|
enum_sections(IniFileName, SYSTEM.ADR(section_callback));
|
||||||
Languages.init(getStr);
|
Languages.init(getStr);
|
||||||
selectSection(0);
|
selectSection(theme);
|
||||||
END load;
|
END load;
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ BEGIN
|
|||||||
END comments;
|
END comments;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE EnterKW (s: ARRAY OF CHAR; VAR KW: tKeyWords; CPrep: BOOLEAN);
|
PROCEDURE EnterKW (s: ARRAY OF CHAR; VAR KW: tKeyWords);
|
||||||
CONST
|
CONST
|
||||||
SPACE = 20X; CR = 0DX; LF = 0AX; TAB = 9X; COMMA = ",";
|
SPACE = 20X; CR = 0DX; LF = 0AX; TAB = 9X; COMMA = ",";
|
||||||
VAR
|
VAR
|
||||||
@ -418,8 +418,7 @@ BEGIN
|
|||||||
k := KW.cnt;
|
k := KW.cnt;
|
||||||
i := 0;
|
i := 0;
|
||||||
REPEAT
|
REPEAT
|
||||||
KW.words[k, 0] := "#";
|
j := 0;
|
||||||
j := ORD(CPrep);
|
|
||||||
WHILE (s[i] # 0X) & ~delim(s[i]) DO
|
WHILE (s[i] # 0X) & ~delim(s[i]) DO
|
||||||
KW.words[k, j] := WCHR(ORD(s[i]));
|
KW.words[k, j] := WCHR(ORD(s[i]));
|
||||||
INC(i);
|
INC(i);
|
||||||
@ -455,7 +454,7 @@ BEGIN
|
|||||||
KW[i].cnt := 0;
|
KW[i].cnt := 0;
|
||||||
key[2] := CHR(ORD("1") + i);
|
key[2] := CHR(ORD("1") + i);
|
||||||
getStr(lang, key, s);
|
getStr(lang, key, s);
|
||||||
EnterKW(s, KW[i], (lang = "lang_C") & (i = 1))
|
EnterKW(s, KW[i])
|
||||||
END
|
END
|
||||||
END loadKW;
|
END loadKW;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ IMPORT
|
|||||||
SYSTEM, G := Graph, List, K := KolibriOS;
|
SYSTEM, G := Graph, List, K := KolibriOS;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
fontHeight = 22;
|
itemHeight = 22;
|
||||||
fontWidth = 8;
|
fontWidth = 8;
|
||||||
|
|
||||||
MainMenuHeight* = K.fontHeight + 7;
|
MainMenuHeight* = K.fontHeight + 7;
|
||||||
@ -61,7 +61,7 @@ TYPE
|
|||||||
active*, keyboard: BOOLEAN;
|
active*, keyboard: BOOLEAN;
|
||||||
parent*, child: tMenu;
|
parent*, child: tMenu;
|
||||||
mainID: INTEGER;
|
mainID: INTEGER;
|
||||||
winX, winY, width*, height*: INTEGER;
|
x*, winX, winY, width*, height*: INTEGER;
|
||||||
selItem, cliItem: INTEGER;
|
selItem, cliItem: INTEGER;
|
||||||
|
|
||||||
font: G.tFont;
|
font: G.tFont;
|
||||||
@ -118,7 +118,8 @@ BEGIN
|
|||||||
item.x := prev.x + LENGTH(prev.text)*fontWidth + 9
|
item.x := prev.x + LENGTH(prev.text)*fontWidth + 9
|
||||||
ELSE
|
ELSE
|
||||||
item.x := MainMenuX
|
item.x := MainMenuX
|
||||||
END
|
END;
|
||||||
|
menu.x := item.x
|
||||||
END AddMainItem;
|
END AddMainItem;
|
||||||
|
|
||||||
|
|
||||||
@ -265,9 +266,9 @@ BEGIN
|
|||||||
TextColor := disSelForeColor
|
TextColor := disSelForeColor
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
Y := y + (fontHeight - 16) DIV 2;
|
Y := y + (itemHeight - 16) DIV 2;
|
||||||
G.SetColor(canvas, BkColor);
|
G.SetColor(canvas, BkColor);
|
||||||
G.FillRect(canvas, 1, y, m.width - 1, y + fontHeight - 4);
|
G.FillRect(canvas, 1, y, m.width - 1, y + itemHeight - 4);
|
||||||
G.SetTextColor(canvas, TextColor);
|
G.SetTextColor(canvas, TextColor);
|
||||||
G.SetBkColor(canvas, BkColor);
|
G.SetBkColor(canvas, BkColor);
|
||||||
G.TextOut2(canvas, LEFT, Y - 2, item.text, LENGTH(item.text));
|
G.TextOut2(canvas, LEFT, Y - 2, item.text, LENGTH(item.text));
|
||||||
@ -279,7 +280,7 @@ BEGIN
|
|||||||
G.DLine(canvas, 7, 12, Y + 8, 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
|
ELSIF item.check = 2 THEN
|
||||||
Y1 := y + fontHeight DIV 2 - 2;
|
Y1 := y + itemHeight DIV 2 - 2;
|
||||||
G.FillRect(canvas, 7, Y1 - 2, 9, Y1 + 2);
|
G.FillRect(canvas, 7, Y1 - 2, 9, Y1 + 2);
|
||||||
G.FillRect(canvas, 6, Y1 - 1, 10, Y1 + 1)
|
G.FillRect(canvas, 6, Y1 - 1, 10, Y1 + 1)
|
||||||
END;
|
END;
|
||||||
@ -289,7 +290,7 @@ BEGIN
|
|||||||
G.Triangle(canvas, X, Y + 2, X, Y + 10, G.triRight)
|
G.Triangle(canvas, X, Y + 2, X, Y + 10, G.triRight)
|
||||||
END;
|
END;
|
||||||
|
|
||||||
INC(y, fontHeight);
|
INC(y, itemHeight);
|
||||||
IF item.delim THEN
|
IF item.delim THEN
|
||||||
G.SetColor(canvas, foreColor);
|
G.SetColor(canvas, foreColor);
|
||||||
G.HLine(canvas, y - 2, 1, m.width - 1)
|
G.HLine(canvas, y - 2, 1, m.width - 1)
|
||||||
@ -392,7 +393,7 @@ BEGIN
|
|||||||
IF ~opened(item(tItem).child) THEN
|
IF ~opened(item(tItem).child) THEN
|
||||||
closeChild(m);
|
closeChild(m);
|
||||||
item(tItem).child.keyboard := keyboard;
|
item(tItem).child.keyboard := keyboard;
|
||||||
_open(item(tItem).child, m.winX + m.width - 2, m.winY + m.selItem*fontHeight);
|
_open(item(tItem).child, m.winX + m.width - 2, m.winY + m.selItem*itemHeight);
|
||||||
m.child := item(tItem).child;
|
m.child := item(tItem).child;
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
@ -486,9 +487,9 @@ BEGIN
|
|||||||
K.mouse(msState, x, y);
|
K.mouse(msState, x, y);
|
||||||
IF (0 <= x) & (x < m.width) & (0 <= y) & (y < m.height) THEN
|
IF (0 <= x) & (x < m.width) & (0 <= y) & (y < m.height) THEN
|
||||||
m.active := TRUE;
|
m.active := TRUE;
|
||||||
m.selItem := (y - TOP) DIV fontHeight;
|
m.selItem := (y - TOP) DIV itemHeight;
|
||||||
IF 8 IN msState THEN
|
IF 8 IN msState THEN
|
||||||
m.cliItem := (y - TOP) DIV fontHeight
|
m.cliItem := (y - TOP) DIV itemHeight
|
||||||
END;
|
END;
|
||||||
IF 16 IN msState THEN
|
IF 16 IN msState THEN
|
||||||
IF m.cliItem = m.selItem THEN
|
IF m.cliItem = m.selItem THEN
|
||||||
@ -640,10 +641,10 @@ BEGIN
|
|||||||
item := item.next(tItem)
|
item := item.next(tItem)
|
||||||
END;
|
END;
|
||||||
m.width := maxLength*fontWidth + LEFT + RIGHT;
|
m.width := maxLength*fontWidth + LEFT + RIGHT;
|
||||||
m.height := items.count*fontHeight - 2;
|
m.height := items.count*itemHeight - 2;
|
||||||
m.font := G.font1;
|
m.font := G.fonts[1];
|
||||||
m.canvas := G.CreateCanvas(m.width + 1, m.height + 1);
|
m.canvas := G.CreateCanvas(m.width + 1, m.height + 1);
|
||||||
G.SetFont(m.canvas, m.font);
|
G.SetFont(m.canvas, m.font)
|
||||||
RETURN m
|
RETURN m
|
||||||
END create;
|
END create;
|
||||||
|
|
||||||
|
@ -291,10 +291,10 @@ BEGIN
|
|||||||
cnt := text.cnt;
|
cnt := text.cnt;
|
||||||
WHILE (text.cnt > 0) & (res = -1) DO
|
WHILE (text.cnt > 0) & (res = -1) DO
|
||||||
c := text.getChar(text);
|
c := text.getChar(text);
|
||||||
IF CHR(c) = LF THEN
|
IF c = ORD(LF) THEN
|
||||||
res := E.EOL_LF
|
res := E.EOL_LF
|
||||||
ELSIF CHR(c) = CR THEN
|
ELSIF c = ORD(CR) THEN
|
||||||
IF CHR(text.getChar(text)) = LF THEN
|
IF text.getChar(text) = ORD(LF) THEN
|
||||||
res := E.EOL_CRLF
|
res := E.EOL_CRLF
|
||||||
ELSE
|
ELSE
|
||||||
res := E.EOL_CR
|
res := E.EOL_CR
|
||||||
|
@ -122,5 +122,5 @@ END SetFont;
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
SB.canvas := NIL;
|
SB.canvas := NIL;
|
||||||
font := G.font1
|
font := G.fonts[1]
|
||||||
END StatusBar.
|
END StatusBar.
|
@ -66,10 +66,10 @@ TYPE
|
|||||||
scroll: tPoint;
|
scroll: tPoint;
|
||||||
CurX: INTEGER;
|
CurX: INTEGER;
|
||||||
smallChange: INTEGER;
|
smallChange: INTEGER;
|
||||||
modified*, smallMove: BOOLEAN;
|
modified*, smallMove,
|
||||||
edition*: tGuard;
|
comments, guard,
|
||||||
comments, numbers*, guard,
|
|
||||||
search, cs, whole: BOOLEAN;
|
search, cs, whole: BOOLEAN;
|
||||||
|
edition*: tGuard;
|
||||||
curLine: tLine;
|
curLine: tLine;
|
||||||
lang*: INTEGER;
|
lang*: INTEGER;
|
||||||
enc, eol: INTEGER;
|
enc, eol: INTEGER;
|
||||||
@ -91,7 +91,7 @@ VAR
|
|||||||
pdelete: PROCEDURE (text: tText);
|
pdelete: PROCEDURE (text: tText);
|
||||||
ShowCursor: PROCEDURE;
|
ShowCursor: PROCEDURE;
|
||||||
|
|
||||||
colors*: RECORD
|
colors: RECORD
|
||||||
text, back, seltext, selback, modified, saved, curline, numtext, numback: INTEGER;
|
text, back, seltext, selback, modified, saved, curline, numtext, numback: INTEGER;
|
||||||
comment, string, escape, num, delim, key1, key2, key3: INTEGER
|
comment, string, escape, num, delim, key1, key2, key3: INTEGER
|
||||||
END;
|
END;
|
||||||
@ -100,6 +100,7 @@ VAR
|
|||||||
padding: RECORD left, top: INTEGER END;
|
padding: RECORD left, top: INTEGER END;
|
||||||
size, textsize: tPoint;
|
size, textsize: tPoint;
|
||||||
charWidth, charHeight: INTEGER;
|
charWidth, charHeight: INTEGER;
|
||||||
|
autoIndents*, lineNumbers*, autoBrackets*, trimSpace*: BOOLEAN;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE setLang* (text: tText; lang: INTEGER);
|
PROCEDURE setLang* (text: tText; lang: INTEGER);
|
||||||
@ -151,12 +152,30 @@ BEGIN
|
|||||||
END getTextRect;
|
END getTextRect;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE toggleNumbers* (text: tText);
|
PROCEDURE toggleNumbers*;
|
||||||
BEGIN
|
BEGIN
|
||||||
text.numbers := ~text.numbers
|
lineNumbers := ~lineNumbers
|
||||||
END toggleNumbers;
|
END toggleNumbers;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE toggleIndents*;
|
||||||
|
BEGIN
|
||||||
|
autoIndents := ~autoIndents
|
||||||
|
END toggleIndents;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE toggleBrackets*;
|
||||||
|
BEGIN
|
||||||
|
autoBrackets := ~autoBrackets
|
||||||
|
END toggleBrackets;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE toggleTrimSpace*;
|
||||||
|
BEGIN
|
||||||
|
trimSpace := ~trimSpace
|
||||||
|
END toggleTrimSpace;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE showCursor*;
|
PROCEDURE showCursor*;
|
||||||
BEGIN
|
BEGIN
|
||||||
drawCursor := TRUE
|
drawCursor := TRUE
|
||||||
@ -1146,7 +1165,11 @@ BEGIN
|
|||||||
IF text.cursor.X > 0 THEN
|
IF text.cursor.X > 0 THEN
|
||||||
INC(text.smallChange);
|
INC(text.smallChange);
|
||||||
i := text.cursor.X;
|
i := text.cursor.X;
|
||||||
n := leadingSpaces(curLine);
|
IF autoIndents THEN
|
||||||
|
n := leadingSpaces(curLine)
|
||||||
|
ELSE
|
||||||
|
n := 0
|
||||||
|
END;
|
||||||
modify(text);
|
modify(text);
|
||||||
IF n < i THEN
|
IF n < i THEN
|
||||||
move(text, -1);
|
move(text, -1);
|
||||||
@ -1205,7 +1228,7 @@ BEGIN
|
|||||||
SetPos(text, 0, text.cursor.Y + 1);
|
SetPos(text, 0, text.cursor.Y + 1);
|
||||||
line := text.curLine.prev(tLine);
|
line := text.curLine.prev(tLine);
|
||||||
n := -1;
|
n := -1;
|
||||||
WHILE (line # NIL) & (n = -1) DO
|
WHILE (line # NIL) & (n = -1) & autoIndents DO
|
||||||
IF (*line.length*)Lines.trimLength(line) # 0 THEN
|
IF (*line.length*)Lines.trimLength(line) # 0 THEN
|
||||||
n := leadingSpaces(line);
|
n := leadingSpaces(line);
|
||||||
line2 := line
|
line2 := line
|
||||||
@ -1335,6 +1358,20 @@ BEGIN
|
|||||||
delSelect(text);
|
delSelect(text);
|
||||||
curLine := text.curLine;
|
curLine := text.curLine;
|
||||||
Lines.insert(curLine, text.cursor.X, WCHR(code));
|
Lines.insert(curLine, text.cursor.X, WCHR(code));
|
||||||
|
IF autoBrackets THEN
|
||||||
|
IF code = ORD("(") THEN
|
||||||
|
code := ORD(")")
|
||||||
|
ELSIF code = ORD("[") THEN
|
||||||
|
code := ORD("]")
|
||||||
|
ELSIF code = ORD("{") THEN
|
||||||
|
code := ORD("}")
|
||||||
|
ELSE
|
||||||
|
code := -1
|
||||||
|
END;
|
||||||
|
IF code # -1 THEN
|
||||||
|
Lines.insert(curLine, text.cursor.X + 1, WCHR(code))
|
||||||
|
END
|
||||||
|
END;
|
||||||
Lines.modify(curLine);
|
Lines.modify(curLine);
|
||||||
modify(text);
|
modify(text);
|
||||||
SetPos(text, text.cursor.X + 1, text.cursor.Y)
|
SetPos(text, text.cursor.X + 1, text.cursor.Y)
|
||||||
@ -1373,6 +1410,7 @@ VAR
|
|||||||
line: tLine;
|
line: tLine;
|
||||||
file: RW.tOutput;
|
file: RW.tOutput;
|
||||||
res: BOOLEAN;
|
res: BOOLEAN;
|
||||||
|
Len: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
ChangeLog.setGuard(text.edition);
|
ChangeLog.setGuard(text.edition);
|
||||||
file := RW.create(tempFile, text.enc, text.eol);
|
file := RW.create(tempFile, text.enc, text.eol);
|
||||||
@ -1380,7 +1418,12 @@ BEGIN
|
|||||||
ChangeLog.delSaved;
|
ChangeLog.delSaved;
|
||||||
line := text.first(tLine);
|
line := text.first(tLine);
|
||||||
WHILE line # NIL DO
|
WHILE line # NIL DO
|
||||||
RW.putString(file, line, Lines.trimLength(line));
|
IF trimSpace THEN
|
||||||
|
Len := Lines.trimLength(line)
|
||||||
|
ELSE
|
||||||
|
Len := line.length
|
||||||
|
END;
|
||||||
|
RW.putString(file, line, Len);
|
||||||
NextLine(line);
|
NextLine(line);
|
||||||
IF line # NIL THEN
|
IF line # NIL THEN
|
||||||
RW.newLine(file)
|
RW.newLine(file)
|
||||||
@ -2262,7 +2305,7 @@ BEGIN
|
|||||||
G.clear(canvas)
|
G.clear(canvas)
|
||||||
END;
|
END;
|
||||||
wNum := charWidth;
|
wNum := charWidth;
|
||||||
IF text.numbers THEN
|
IF lineNumbers THEN
|
||||||
numWidth := U.lg10(text.count) + 2;
|
numWidth := U.lg10(text.count) + 2;
|
||||||
xNum := numWidth*wNum - wNum DIV 2;
|
xNum := numWidth*wNum - wNum DIV 2;
|
||||||
setPadding(numWidth*wNum + pad_left, padding.top);
|
setPadding(numWidth*wNum + pad_left, padding.top);
|
||||||
@ -2322,7 +2365,7 @@ BEGIN
|
|||||||
y := padding.top + inter DIV 2;
|
y := padding.top + inter DIV 2;
|
||||||
n := MIN(text.scroll.Y + textsize.Y, text.count);
|
n := MIN(text.scroll.Y + textsize.Y, text.count);
|
||||||
FOR i := text.scroll.Y + 1 TO n DO
|
FOR i := text.scroll.Y + 1 TO n DO
|
||||||
IF text.numbers THEN
|
IF lineNumbers THEN
|
||||||
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
||||||
U.int2str(i, s);
|
U.int2str(i, s);
|
||||||
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
|
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
|
||||||
@ -2346,7 +2389,7 @@ BEGIN
|
|||||||
firstLine := text.curLine;
|
firstLine := text.curLine;
|
||||||
lastLine := firstLine
|
lastLine := firstLine
|
||||||
ELSE
|
ELSE
|
||||||
lastLine := getLine2(text, text.scroll.Y + textsize.Y - 1)
|
lastLine := getLine2(text, MIN(text.scroll.Y + textsize.Y, text.count) - 1)
|
||||||
END;
|
END;
|
||||||
p := text.foundList.first(Search.tPos);
|
p := text.foundList.first(Search.tPos);
|
||||||
WHILE p # NIL DO
|
WHILE p # NIL DO
|
||||||
@ -2426,7 +2469,6 @@ BEGIN
|
|||||||
text.search := TRUE;
|
text.search := TRUE;
|
||||||
text.cs := FALSE;
|
text.cs := FALSE;
|
||||||
text.whole := FALSE;
|
text.whole := FALSE;
|
||||||
text.numbers := TRUE;
|
|
||||||
text.guard := TRUE;
|
text.guard := TRUE;
|
||||||
text.edition := NIL;
|
text.edition := NIL;
|
||||||
text.foundList := List.create(NIL);
|
text.foundList := List.create(NIL);
|
||||||
@ -2674,11 +2716,15 @@ BEGIN
|
|||||||
END New;
|
END New;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE init* (pShowCursor: tProcedure);
|
PROCEDURE init* (pShowCursor: tProcedure; _lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN);
|
||||||
BEGIN
|
BEGIN
|
||||||
ShowCursor := pShowCursor;
|
ShowCursor := pShowCursor;
|
||||||
pdelete := delete;
|
pdelete := delete;
|
||||||
drawCursor := TRUE;
|
drawCursor := TRUE;
|
||||||
|
lineNumbers := _lineNumbers;
|
||||||
|
autoIndents := _autoIndents;
|
||||||
|
autoBrackets := _autoBrackets;
|
||||||
|
trimSpace := _trimSpace;
|
||||||
padding.left := pad_left;
|
padding.left := pad_left;
|
||||||
padding.top := pad_top;
|
padding.top := pad_top;
|
||||||
END init;
|
END init;
|
||||||
|
Loading…
Reference in New Issue
Block a user