- added line spacing setting
- disabled highlighting of anonymous labels


git-svn-id: svn://kolibrios.org@9946 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2023-10-01 12:50:05 +00:00
parent 9ab6258bfe
commit 9398cd7961
5 changed files with 35 additions and 9 deletions

Binary file not shown.

View File

@ -1,5 +1,6 @@
[settings] [settings]
tab=4 tab=4
line_spacing=2
blink=70 blink=70
line_numbers=1 line_numbers=1
auto_indents=1 auto_indents=1

View File

@ -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 (07-may-2023)"; HEADER = "CEdit (01-oct-2023)";
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";
@ -101,6 +101,8 @@ CONST
menuFontSmall = 20; menuFontSmall = 20;
menuFontMedium = menuFontSmall + 1; menuFontMedium = menuFontSmall + 1;
menuFontLarge = menuFontMedium + 1; menuFontLarge = menuFontMedium + 1;
menuIncLS = menuFontLarge + 1;
menuDecLS = menuIncLS + 1;
menuColors = 1000; menuColors = 1000;
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1; menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
@ -169,7 +171,7 @@ CONST
SHIFT = Menu.SHIFT; SHIFT = Menu.SHIFT;
CTRL = Menu.CTRL; CTRL = Menu.CTRL;
ClippingArea = 32 + T.LineSpacing; ClippingArea = 32 + T.MaxLineSpacing;
VAR VAR
@ -1073,6 +1075,8 @@ BEGIN
Menu.option(menu, menuFontSmall, font = G.fonts[0]); Menu.option(menu, menuFontSmall, font = G.fonts[0]);
Menu.option(menu, menuFontMedium, font = G.fonts[1]); Menu.option(menu, menuFontMedium, font = G.fonts[1]);
Menu.option(menu, menuFontLarge, font = G.fonts[2]); Menu.option(menu, menuFontLarge, font = G.fonts[2]);
Menu.setEnabled(menu, menuIncLS, T.LineSpacing < T.MaxLineSpacing);
Menu.setEnabled(menu, menuDecLS, T.LineSpacing > 0);
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
@ -1258,6 +1262,9 @@ BEGIN
font := G.fonts[Menu.MenuItem - menuFontSmall]; font := G.fonts[Menu.MenuItem - menuFontSmall];
Ini.setInt("settings", "font", Menu.MenuItem - menuFontSmall); Ini.setInt("settings", "font", Menu.MenuItem - menuFontSmall);
resize resize
|menuIncLS, menuDecLS:
T.setLineSpacing(canvas, T.LineSpacing + ORD(Menu.MenuItem = menuIncLS)*2 - 1);
Ini.setInt("settings", "line_spacing", T.LineSpacing)
|menuText: |menuText:
T.setLang(text, Languages.langText) T.setLang(text, Languages.langText)
|menuC: |menuC:
@ -1470,6 +1477,9 @@ BEGIN
Menu.AddMenuItem(menu, menuFontMedium, "medium"); Menu.AddMenuItem(menu, menuFontMedium, "medium");
Menu.AddMenuItem(menu, menuFontLarge, "large"); Menu.AddMenuItem(menu, menuFontLarge, "large");
Menu.delimiter(menu); Menu.delimiter(menu);
Menu.AddMenuItem(menu, menuIncLS, "line spacing ++");
Menu.AddMenuItem(menu, menuDecLS, "line spacing --");
Menu.delimiter(menu);
colors := Ini.sections.first(Ini.tSection); colors := Ini.sections.first(Ini.tSection);
idx := menuColors; idx := menuColors;
@ -2152,7 +2162,7 @@ BEGIN
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]; font := G.fonts[Ini.font];
G.SetFont(canvas, font); G.SetFont(canvas, font);
T.init(resetTimer, Ini.lineNumbers, Ini.autoIndents, Ini.autoBrackets, Ini.trimSpace); T.init(resetTimer, Ini.lineNumbers, Ini.autoIndents, Ini.autoBrackets, Ini.trimSpace, Ini.lineSpacing);
Ini.selectSection(Ini.theme); Ini.selectSection(Ini.theme);
T.setCanvas(canvas); T.setCanvas(canvas);

View File

@ -53,7 +53,7 @@ VAR
curSection*: tASCIISectionName; curSection*: tASCIISectionName;
curSectionNum*: INTEGER; curSectionNum*: INTEGER;
blink*, font*, theme*: INTEGER; blink*, font*, theme*, lineSpacing*: INTEGER;
buildScript*, runScript*, debugScript*: RW.tFileName; buildScript*, runScript*, debugScript*: RW.tFileName;
lineNumbers*, autoIndents*, autoBrackets*, trimSpace*: BOOLEAN; lineNumbers*, autoIndents*, autoBrackets*, trimSpace*: BOOLEAN;
@ -171,6 +171,10 @@ BEGIN
IF (font < 0) OR (font > 2) THEN IF (font < 0) OR (font > 2) THEN
font := 1 font := 1
END; END;
lineSpacing := get_int(IniFileName, "settings", "line_spacing", 2);
IF (lineSpacing < 0) OR (lineSpacing > Text.MaxLineSpacing) THEN
lineSpacing := 2
END;
theme := get_int(IniFileName, "settings", "theme", 0); theme := get_int(IniFileName, "settings", "theme", 0);
IF (theme < 0) OR (theme >= sections.count) THEN IF (theme < 0) OR (theme >= sections.count) THEN
theme := 0 theme := 0

View File

@ -40,7 +40,7 @@ CONST
mark_width = 2; mark_width = 2;
pad_left = mark_width + 3; pad_left = mark_width + 3;
pad_top = 1; pad_top = 1;
LineSpacing* = 2; MaxLineSpacing* = 8;
TYPE TYPE
@ -98,7 +98,7 @@ VAR
drawCursor: BOOLEAN; drawCursor: BOOLEAN;
padding: RECORD left, top: INTEGER END; padding: RECORD left, top: INTEGER END;
size, textsize: tPoint; size, textsize: tPoint;
charWidth, charHeight: INTEGER; charWidth, charHeight, LineSpacing*: INTEGER;
autoIndents*, lineNumbers*, autoBrackets*, trimSpace*: BOOLEAN; autoIndents*, lineNumbers*, autoBrackets*, trimSpace*: BOOLEAN;
@ -2164,9 +2164,9 @@ BEGIN
IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END; IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END;
text.wordSel := FALSE text.wordSel := FALSE
END; END;
IF (text.lang = Lang.langFasm) & ~selected(text) THEN (*IF (text.lang = Lang.langFasm) & ~selected(text) THEN
fasm_anon(text) fasm_anon(text)
END END*)
END wordSel; END wordSel;
@ -3005,7 +3005,17 @@ PROCEDURE empty* (text: tText): BOOLEAN;
END empty; END empty;
PROCEDURE init* (pShowCursor: tProcedure; _lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN); PROCEDURE setLineSpacing* (canvas: G.tCanvas; value: INTEGER);
BEGIN
IF (0 <= value) & (value <= MaxLineSpacing) THEN
LineSpacing := value;
setCanvas(canvas)
END
END setLineSpacing;
PROCEDURE init* (pShowCursor: tProcedure;
_lineNumbers, _autoIndents, _autoBrackets, _trimSpace: BOOLEAN; _lineSpacing: INTEGER);
BEGIN BEGIN
ShowCursor := pShowCursor; ShowCursor := pShowCursor;
pdelete := delete; pdelete := delete;
@ -3016,6 +3026,7 @@ BEGIN
trimSpace := _trimSpace; trimSpace := _trimSpace;
padding.left := pad_left; padding.left := pad_left;
padding.top := pad_top; padding.top := pad_top;
LineSpacing := _lineSpacing
END init; END init;