- 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]
tab=4
line_spacing=2
blink=70
line_numbers=1
auto_indents=1

View File

@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (07-may-2023)";
HEADER = "CEdit (01-oct-2023)";
ShellFilter = "";
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
@ -101,6 +101,8 @@ CONST
menuFontSmall = 20;
menuFontMedium = menuFontSmall + 1;
menuFontLarge = menuFontMedium + 1;
menuIncLS = menuFontLarge + 1;
menuDecLS = menuIncLS + 1;
menuColors = 1000;
menuMaxColors = menuColors + Ini.MAX_SECTIONS - 1;
@ -169,7 +171,7 @@ CONST
SHIFT = Menu.SHIFT;
CTRL = Menu.CTRL;
ClippingArea = 32 + T.LineSpacing;
ClippingArea = 32 + T.MaxLineSpacing;
VAR
@ -1073,6 +1075,8 @@ BEGIN
Menu.option(menu, menuFontSmall, font = G.fonts[0]);
Menu.option(menu, menuFontMedium, font = G.fonts[1]);
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
Menu.option(menu, menuColors + i, Ini.curSectionNum = i)
END
@ -1258,6 +1262,9 @@ BEGIN
font := G.fonts[Menu.MenuItem - menuFontSmall];
Ini.setInt("settings", "font", Menu.MenuItem - menuFontSmall);
resize
|menuIncLS, menuDecLS:
T.setLineSpacing(canvas, T.LineSpacing + ORD(Menu.MenuItem = menuIncLS)*2 - 1);
Ini.setInt("settings", "line_spacing", T.LineSpacing)
|menuText:
T.setLang(text, Languages.langText)
|menuC:
@ -1470,6 +1477,9 @@ BEGIN
Menu.AddMenuItem(menu, menuFontMedium, "medium");
Menu.AddMenuItem(menu, menuFontLarge, "large");
Menu.delimiter(menu);
Menu.AddMenuItem(menu, menuIncLS, "line spacing ++");
Menu.AddMenuItem(menu, menuDecLS, "line spacing --");
Menu.delimiter(menu);
colors := Ini.sections.first(Ini.tSection);
idx := menuColors;
@ -2152,7 +2162,7 @@ BEGIN
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight);
font := G.fonts[Ini.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);
T.setCanvas(canvas);

View File

@ -53,7 +53,7 @@ VAR
curSection*: tASCIISectionName;
curSectionNum*: INTEGER;
blink*, font*, theme*: INTEGER;
blink*, font*, theme*, lineSpacing*: INTEGER;
buildScript*, runScript*, debugScript*: RW.tFileName;
lineNumbers*, autoIndents*, autoBrackets*, trimSpace*: BOOLEAN;
@ -171,6 +171,10 @@ BEGIN
IF (font < 0) OR (font > 2) THEN
font := 1
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);
IF (theme < 0) OR (theme >= sections.count) THEN
theme := 0

View File

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