forked from KolibriOS/kolibrios
CEdit: clipping text, small changes
git-svn-id: svn://kolibrios.org@9892 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2919153f32
commit
bd24d8a01e
@ -1,3 +1,3 @@
|
||||
#SHS
|
||||
/kolibrios/develop/oberon07/compiler.kex ./src/cedit.ob07 kosexe -out /tmp0/1/cedit.kex -stk 1 -nochk a
|
||||
/kolibrios/develop/oberon07/compiler.kex ./src/cedit.ob07 kosexe -out /tmp0/1/cedit -stk 1 -nochk a
|
||||
exit
|
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
#SHS
|
||||
/tmp0/1/cedit.kex
|
||||
/tmp0/1/cedit
|
||||
exit
|
@ -28,7 +28,7 @@ IMPORT
|
||||
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
||||
|
||||
CONST
|
||||
HEADER = "CEdit (13-jan-2023)";
|
||||
HEADER = "CEdit (21-jan-2023)";
|
||||
|
||||
ShellFilter = "";
|
||||
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||
@ -65,7 +65,7 @@ CONST
|
||||
|
||||
toolbarTop = Menu.MainMenuHeight + 3;
|
||||
|
||||
TOP = toolbarTop + Toolbar.BtnSize + 10 + Tabs.tabHeight;
|
||||
TOP = toolbarTop + Toolbar.BtnSize + 9 + Tabs.tabHeight;
|
||||
|
||||
minWinWidth = 635; minWinHeight = 550;
|
||||
|
||||
@ -169,6 +169,8 @@ CONST
|
||||
SHIFT = Menu.SHIFT;
|
||||
CTRL = Menu.CTRL;
|
||||
|
||||
ClippingArea = 50;
|
||||
|
||||
|
||||
VAR
|
||||
header: RW.tFileName;
|
||||
@ -446,7 +448,8 @@ BEGIN
|
||||
END;
|
||||
BOTTOM := SB.height() + scrollWidth - 1;
|
||||
G.destroy(canvas);
|
||||
canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), cliHeight - (TOP + BOTTOM + 1));
|
||||
canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), cliHeight - (TOP + BOTTOM + 1 - ClippingArea));
|
||||
DEC(canvas.height, ClippingArea);
|
||||
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 2 + RIGHT_PADDING), Tabs.tabHeight);
|
||||
G.SetFont(canvas, font);
|
||||
T.setCanvas(canvas);
|
||||
@ -2099,7 +2102,8 @@ BEGIN
|
||||
RIGHT := scrollWidth - 2;
|
||||
BOTTOM := SB.height() + scrollWidth - 1;
|
||||
SkinHeight := K.SkinHeight();
|
||||
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 - ClippingArea) - SkinHeight);
|
||||
DEC(canvas.height, ClippingArea);
|
||||
tabs := Tabs.create();
|
||||
Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight);
|
||||
font := G.fonts[Ini.font];
|
||||
|
@ -45,7 +45,7 @@ TYPE
|
||||
|
||||
tCanvas* = POINTER TO RECORD
|
||||
bitmap: INTEGER;
|
||||
width*, height*: INTEGER;
|
||||
width*, height*, sizeY: INTEGER;
|
||||
color, backColor, textColor: INTEGER;
|
||||
font*: tFont;
|
||||
mode: INTEGER
|
||||
@ -166,22 +166,18 @@ END VLine;
|
||||
|
||||
PROCEDURE notVLine* (canvas: tCanvas; x, y1, y2: INTEGER);
|
||||
BEGIN
|
||||
IF (0 <= y1) & (y1 < canvas.height) & (0 <= y2) & (y2 < canvas.height) THEN
|
||||
canvas.mode := modeNOT;
|
||||
VLine(canvas, x, y1, y2);
|
||||
canvas.mode := modeCOPY
|
||||
END
|
||||
END notVLine;
|
||||
|
||||
|
||||
PROCEDURE xorVLine* (canvas: tCanvas; x, y1, y2: INTEGER);
|
||||
BEGIN
|
||||
IF (0 <= y1) & (y1 < canvas.height) & (0 <= y2) & (y2 < canvas.height) THEN
|
||||
canvas.mode := modeXOR;
|
||||
SetColor(canvas, 0FF0000H);
|
||||
VLine(canvas, x, y1, y2);
|
||||
canvas.mode := modeCOPY
|
||||
END
|
||||
END xorVLine;
|
||||
|
||||
|
||||
@ -259,7 +255,7 @@ BEGIN
|
||||
w := canvas.width*4;
|
||||
ptr := canvas.bitmap;
|
||||
ptr2 := ptr;
|
||||
i := canvas.height - 1;
|
||||
i := canvas.sizeY - 1;
|
||||
WHILE i > 0 DO
|
||||
INC(ptr2, w);
|
||||
SYSTEM.MOVE(ptr, ptr2, w);
|
||||
@ -277,7 +273,7 @@ VAR
|
||||
c: WCHAR;
|
||||
BEGIN
|
||||
font := canvas.font;
|
||||
IF (0 <= y) & (y <= canvas.height - font.height - 1) THEN
|
||||
IF (0 <= y) & (y <= canvas.sizeY - font.height - 1) THEN
|
||||
IF x < 0 THEN
|
||||
i := -(x DIV font.width);
|
||||
INC(x, i*font.width);
|
||||
@ -339,6 +335,7 @@ BEGIN
|
||||
INC(canvas.bitmap, 8);
|
||||
canvas.width := width;
|
||||
canvas.height := height;
|
||||
canvas.sizeY := height;
|
||||
canvas.mode := modeCOPY
|
||||
RETURN canvas
|
||||
END CreateCanvas;
|
||||
|
@ -1,5 +1,5 @@
|
||||
(*
|
||||
Copyright 2021, 2022 Anton Krotov
|
||||
Copyright 2021-2023 Anton Krotov
|
||||
|
||||
This file is part of CEdit.
|
||||
|
||||
@ -434,7 +434,8 @@ BEGIN
|
||||
END EnterKW;
|
||||
|
||||
|
||||
PROCEDURE loadKW (VAR KW: ARRAY OF tKeyWords; VAR delim: tDelimiters; getStr: procGetStr; lang: ARRAY OF CHAR);
|
||||
PROCEDURE loadKW (lang: INTEGER; VAR KW: ARRAY OF tKeyWords; VAR delim: tDelimiters; getStr: procGetStr;
|
||||
lang_name: ARRAY OF CHAR);
|
||||
VAR
|
||||
s: ARRAY 16*1024 OF CHAR;
|
||||
key: ARRAY 4 OF CHAR;
|
||||
@ -443,7 +444,7 @@ BEGIN
|
||||
FOR i := 0 TO LEN(delim) - 1 DO
|
||||
delim[i] := FALSE
|
||||
END;
|
||||
getStr(lang, "delim", s);
|
||||
getStr(lang_name, "delim", s);
|
||||
i := 0;
|
||||
WHILE s[i] # 0X DO
|
||||
delim[ORD(s[i])] := TRUE;
|
||||
@ -453,7 +454,10 @@ BEGIN
|
||||
FOR i := 0 TO 2 DO
|
||||
KW[i].cnt := 0;
|
||||
key[2] := CHR(ORD("1") + i);
|
||||
getStr(lang, key, s);
|
||||
getStr(lang_name, key, s);
|
||||
IF ~(lang IN csLang) THEN
|
||||
Utils.upcase(s)
|
||||
END;
|
||||
EnterKW(s, KW[i])
|
||||
END
|
||||
END loadKW;
|
||||
@ -498,14 +502,14 @@ END getExt;
|
||||
PROCEDURE init* (getStr: procGetStr);
|
||||
BEGIN
|
||||
currentLang := langText;
|
||||
loadKW(KW[langText], Delim[langText], getStr, "lang_Text");
|
||||
loadKW(KW[langOberon], Delim[langOberon], getStr, "lang_Oberon");
|
||||
loadKW(KW[langC], Delim[langC], getStr, "lang_C");
|
||||
loadKW(KW[langPascal], Delim[langPascal], getStr, "lang_Pascal");
|
||||
loadKW(KW[langLua], Delim[langLua], getStr, "lang_Lua");
|
||||
loadKW(KW[langIni], Delim[langIni], getStr, "lang_Ini");
|
||||
loadKW(KW[langFasm], Delim[langFasm], getStr, "lang_Fasm");
|
||||
loadKW(KW[langJSON], Delim[langJSON], getStr, "lang_JSON");
|
||||
loadKW(langText, KW[langText], Delim[langText], getStr, "lang_Text");
|
||||
loadKW(langOberon, KW[langOberon], Delim[langOberon], getStr, "lang_Oberon");
|
||||
loadKW(langC, KW[langC], Delim[langC], getStr, "lang_C");
|
||||
loadKW(langPascal, KW[langPascal], Delim[langPascal], getStr, "lang_Pascal");
|
||||
loadKW(langLua, KW[langLua], Delim[langLua], getStr, "lang_Lua");
|
||||
loadKW(langIni, KW[langIni], Delim[langIni], getStr, "lang_Ini");
|
||||
loadKW(langFasm, KW[langFasm], Delim[langFasm], getStr, "lang_Fasm");
|
||||
loadKW(langJSON, KW[langJSON], Delim[langJSON], getStr, "lang_JSON");
|
||||
|
||||
fileExt[ 0].ext := "OB07"; fileExt[ 0].lang := langOberon;
|
||||
fileExt[ 1].ext := "C"; fileExt[ 1].lang := langC;
|
||||
|
@ -39,7 +39,7 @@ CONST
|
||||
|
||||
mark_width = 2;
|
||||
pad_left = mark_width + 3;
|
||||
pad_top = 0;
|
||||
pad_top = 1;
|
||||
inter = 2;
|
||||
|
||||
|
||||
@ -2234,7 +2234,7 @@ BEGIN
|
||||
cursor := text.cursor;
|
||||
scrollX := text.scroll.X;
|
||||
scrollY := text.scroll.Y;
|
||||
IF ~((scrollY > cursor.Y) OR (scrollY + textsize.Y <= cursor.Y) OR
|
||||
IF ~((scrollY > cursor.Y) OR (scrollY + textsize.Y + 1 <= cursor.Y) OR
|
||||
(scrollX > cursor.X) OR (scrollX + textsize.X <= cursor.X)) THEN
|
||||
x := (cursor.X - scrollX)*charWidth + padding.left;
|
||||
y1 := (cursor.Y - scrollY)*charHeight + padding.top + (inter DIV 2 + 1);
|
||||
@ -2336,9 +2336,10 @@ BEGIN
|
||||
y := padding.top + inter DIV 2;
|
||||
n := text.scroll.Y;
|
||||
firstLine := getLine2(text, n);
|
||||
|
||||
IF text.smallMove THEN
|
||||
line := text.curLine;
|
||||
cnt := textsize.Y - 1;
|
||||
cnt := textsize.Y;
|
||||
y := y + charHeight*(text.cursor.Y - text.scroll.Y);
|
||||
G.SetColor(canvas, colors.back);
|
||||
G.FillRect(canvas, padding.left - 2, y - inter DIV 2, size.X - 1, y - inter DIV 2 + charHeight);
|
||||
@ -2348,7 +2349,7 @@ BEGIN
|
||||
cnt := 0
|
||||
END;
|
||||
|
||||
WHILE (line # NIL) & (cnt < textsize.Y) DO
|
||||
WHILE (line # NIL) & (cnt <= textsize.Y) DO
|
||||
backColor := colors.back;
|
||||
IF (line = text.curLine) & ~selected(text) THEN
|
||||
G.SetColor(canvas, colors.curline);
|
||||
@ -2383,7 +2384,7 @@ BEGIN
|
||||
line := firstLine;
|
||||
SetColor(colors.numtext, colors.numback);
|
||||
y := padding.top + inter DIV 2;
|
||||
n := MIN(text.scroll.Y + textsize.Y, text.count);
|
||||
n := MIN(text.scroll.Y + textsize.Y + 1, text.count);
|
||||
FOR i := text.scroll.Y + 1 TO n DO
|
||||
IF lineNumbers THEN
|
||||
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
||||
@ -2396,8 +2397,8 @@ BEGIN
|
||||
END;
|
||||
IF line.label THEN
|
||||
FOR x := wNum DIV 2 TO (padding.left - pad_left) - wNum DIV 2 DO
|
||||
G.notVLine(canvas, x, y, y + charHeight - inter);
|
||||
G.xorVLine(canvas, x, y, y + charHeight - inter)
|
||||
G.notVLine(canvas, x, y, y + charHeight - (inter + 1));
|
||||
G.xorVLine(canvas, x, y, y + charHeight - (inter + 1))
|
||||
END
|
||||
END;
|
||||
NextLine(line);
|
||||
@ -2409,7 +2410,7 @@ BEGIN
|
||||
firstLine := text.curLine;
|
||||
lastLine := firstLine
|
||||
ELSE
|
||||
lastLine := getLine2(text, MIN(text.scroll.Y + textsize.Y, text.count) - 1)
|
||||
lastLine := getLine2(text, MIN(text.scroll.Y + textsize.Y + 1, text.count) - 1)
|
||||
END;
|
||||
p := text.foundList.first(Search.tPos);
|
||||
WHILE p # NIL DO
|
||||
|
Loading…
Reference in New Issue
Block a user