forked from KolibriOS/kolibrios
CEdit: minor fix
git-svn-id: svn://kolibrios.org@9906 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c682acbe2f
commit
f8df2f2297
Binary file not shown.
@ -28,7 +28,7 @@ IMPORT
|
||||
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
||||
|
||||
CONST
|
||||
HEADER = "CEdit (26-feb-2023)";
|
||||
HEADER = "CEdit (06-mar-2023)";
|
||||
|
||||
ShellFilter = "";
|
||||
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
|
||||
|
@ -20,80 +20,80 @@
|
||||
MODULE Encodings;
|
||||
|
||||
CONST
|
||||
CP866* = 0; CP1251* = 1; UTF8* = 2; UTF8BOM* = 3; (*UTF16LE* = 4;*)
|
||||
CP866* = 0; CP1251* = 1; UTF8* = 2; UTF8BOM* = 3; (*UTF16LE* = 4;*)
|
||||
|
||||
UNDEF* = ORD("?");
|
||||
UNDEF* = ORD("?");
|
||||
|
||||
EOL_CRLF* = 0; EOL_LF* = 1; EOL_CR* = 2;
|
||||
CR = 0DX; LF = 0AX;
|
||||
EOL_CRLF* = 0; EOL_LF* = 1; EOL_CR* = 2;
|
||||
CR = 0DX; LF = 0AX;
|
||||
|
||||
TYPE
|
||||
CP* = ARRAY 256 OF INTEGER;
|
||||
CP* = ARRAY 256 OF INTEGER;
|
||||
|
||||
tEOL* = ARRAY 3 OF WCHAR;
|
||||
tEOL* = ARRAY 3 OF WCHAR;
|
||||
|
||||
VAR
|
||||
cp1251*, cp866*: CP;
|
||||
names*: ARRAY 4, 16 OF WCHAR;
|
||||
UNI*: ARRAY 65536, 2 OF BYTE;
|
||||
cp1251*, cp866*: CP;
|
||||
names*: ARRAY 4, 16 OF WCHAR;
|
||||
UNI*: ARRAY 65536, 2 OF BYTE;
|
||||
|
||||
eol*: ARRAY 3 OF tEOL;
|
||||
eolNames*: ARRAY 3, 16 OF WCHAR;
|
||||
eol*: ARRAY 3 OF tEOL;
|
||||
eolNames*: ARRAY 3, 16 OF WCHAR;
|
||||
|
||||
|
||||
PROCEDURE InitCP (VAR cp: CP);
|
||||
VAR
|
||||
i: INTEGER;
|
||||
i: INTEGER;
|
||||
BEGIN
|
||||
FOR i := 0H TO 7FH DO
|
||||
cp[i] := i
|
||||
END
|
||||
FOR i := 0H TO 7FH DO
|
||||
cp[i] := i
|
||||
END
|
||||
END InitCP;
|
||||
|
||||
|
||||
PROCEDURE Init8 (VAR cp: CP; VAR n: INTEGER; a, b, c, d, e, f, g, h: INTEGER);
|
||||
BEGIN
|
||||
cp[n] := a; INC(n);
|
||||
cp[n] := b; INC(n);
|
||||
cp[n] := c; INC(n);
|
||||
cp[n] := d; INC(n);
|
||||
cp[n] := e; INC(n);
|
||||
cp[n] := f; INC(n);
|
||||
cp[n] := g; INC(n);
|
||||
cp[n] := h; INC(n);
|
||||
cp[n] := a; INC(n);
|
||||
cp[n] := b; INC(n);
|
||||
cp[n] := c; INC(n);
|
||||
cp[n] := d; INC(n);
|
||||
cp[n] := e; INC(n);
|
||||
cp[n] := f; INC(n);
|
||||
cp[n] := g; INC(n);
|
||||
cp[n] := h; INC(n);
|
||||
END Init8;
|
||||
|
||||
|
||||
PROCEDURE InitCP1251 (VAR cp: CP);
|
||||
VAR
|
||||
n, i: INTEGER;
|
||||
n, i: INTEGER;
|
||||
BEGIN
|
||||
InitCP(cp);
|
||||
FOR i := 0410H TO 044FH DO
|
||||
cp[i - 350H] := i
|
||||
END;
|
||||
n := 80H;
|
||||
Init8(cp, n, 0402H, 0403H, 201AH, 0453H, 201EH, 2026H, 2020H, 2021H);
|
||||
Init8(cp, n, 20ACH, 2030H, 0409H, 2039H, 040AH, 040CH, 040BH, 040FH);
|
||||
Init8(cp, n, 0452H, 2018H, 2019H, 201CH, 201DH, 2022H, 2013H, 2014H);
|
||||
Init8(cp, n, UNDEF, 2122H, 0459H, 203AH, 045AH, 045CH, 045BH, 045FH);
|
||||
Init8(cp, n, 00A0H, 040EH, 045EH, 0408H, 00A4H, 0490H, 00A6H, 00A7H);
|
||||
Init8(cp, n, 0401H, 00A9H, 0404H, 00ABH, 00ACH, 00ADH, 00AEH, 0407H);
|
||||
Init8(cp, n, 00B0H, 00B1H, 0406H, 0456H, 0491H, 00B5H, 00B6H, 00B7H);
|
||||
Init8(cp, n, 0451H, 2116H, 0454H, 00BBH, 0458H, 0405H, 0455H, 0457H);
|
||||
FOR i := 0410H TO 044FH DO
|
||||
cp[i - 350H] := i
|
||||
END;
|
||||
n := 80H;
|
||||
Init8(cp, n, 0402H, 0403H, 201AH, 0453H, 201EH, 2026H, 2020H, 2021H);
|
||||
Init8(cp, n, 20ACH, 2030H, 0409H, 2039H, 040AH, 040CH, 040BH, 040FH);
|
||||
Init8(cp, n, 0452H, 2018H, 2019H, 201CH, 201DH, 2022H, 2013H, 2014H);
|
||||
Init8(cp, n, UNDEF, 2122H, 0459H, 203AH, 045AH, 045CH, 045BH, 045FH);
|
||||
Init8(cp, n, 00A0H, 040EH, 045EH, 0408H, 00A4H, 0490H, 00A6H, 00A7H);
|
||||
Init8(cp, n, 0401H, 00A9H, 0404H, 00ABH, 00ACH, 00ADH, 00AEH, 0407H);
|
||||
Init8(cp, n, 00B0H, 00B1H, 0406H, 0456H, 0491H, 00B5H, 00B6H, 00B7H);
|
||||
Init8(cp, n, 0451H, 2116H, 0454H, 00BBH, 0458H, 0405H, 0455H, 0457H);
|
||||
END InitCP1251;
|
||||
|
||||
|
||||
PROCEDURE InitCP866 (VAR cp: CP);
|
||||
VAR
|
||||
n, i: INTEGER;
|
||||
n, i: INTEGER;
|
||||
BEGIN
|
||||
InitCP(cp);
|
||||
FOR i := 0410H TO 043FH DO
|
||||
cp[i - 390H] := i
|
||||
cp[i - 390H] := i
|
||||
END;
|
||||
FOR i := 0440H TO 044FH DO
|
||||
cp[i - 360H] := i
|
||||
cp[i - 360H] := i
|
||||
END;
|
||||
n := 0B0H;
|
||||
Init8(cp, n, 2591H, 2592H, 2593H, 2502H, 2524H, 2561H, 2562H, 2556H);
|
||||
@ -110,31 +110,31 @@ END InitCP866;
|
||||
|
||||
PROCEDURE setUNI;
|
||||
VAR
|
||||
i: INTEGER;
|
||||
i: INTEGER;
|
||||
BEGIN
|
||||
FOR i := 0 TO 65535 DO
|
||||
UNI[i, CP866] := UNDEF;
|
||||
UNI[i, CP1251] := UNDEF
|
||||
END;
|
||||
FOR i := 0 TO 255 DO
|
||||
UNI[cp1251[i], CP1251] := i;
|
||||
UNI[cp866[i], CP866] := i
|
||||
END
|
||||
FOR i := 0 TO 65535 DO
|
||||
UNI[i, CP866] := UNDEF;
|
||||
UNI[i, CP1251] := UNDEF
|
||||
END;
|
||||
FOR i := 0 TO 255 DO
|
||||
UNI[cp1251[i], CP1251] := i;
|
||||
UNI[cp866[i], CP866] := i
|
||||
END
|
||||
END setUNI;
|
||||
|
||||
|
||||
BEGIN
|
||||
eol[EOL_CRLF] := CR + LF;
|
||||
eol[EOL_LF] := LF;
|
||||
eol[EOL_CR] := CR;
|
||||
eolNames[EOL_CRLF] := "CRLF";
|
||||
eolNames[EOL_LF] := "LF";
|
||||
eolNames[EOL_CR] := "CR";
|
||||
names[CP866] := "CP866";
|
||||
names[CP1251] := "CP1251";
|
||||
names[UTF8] := "UTF-8";
|
||||
names[UTF8BOM] := "UTF-8-BOM";
|
||||
InitCP1251(cp1251);
|
||||
InitCP866(cp866);
|
||||
setUNI
|
||||
eol[EOL_CRLF] := CR + LF;
|
||||
eol[EOL_LF] := LF;
|
||||
eol[EOL_CR] := CR;
|
||||
eolNames[EOL_CRLF] := "CRLF";
|
||||
eolNames[EOL_LF] := "LF";
|
||||
eolNames[EOL_CR] := "CR";
|
||||
names[CP866] := "CP866";
|
||||
names[CP1251] := "CP1251";
|
||||
names[UTF8] := "UTF-8";
|
||||
names[UTF8BOM] := "UTF-8-BOM";
|
||||
InitCP1251(cp1251);
|
||||
InitCP866(cp866);
|
||||
setUNI
|
||||
END Encodings.
|
@ -23,33 +23,33 @@ IMPORT SYSTEM, KOSAPI, Lines, Languages, E := Encodings;
|
||||
|
||||
CONST
|
||||
|
||||
modeCOPY = 0;
|
||||
modeNOT = 1;
|
||||
modeXOR = 2;
|
||||
modeCOPY = 0;
|
||||
modeNOT = 1;
|
||||
modeXOR = 2;
|
||||
|
||||
triUp* = FALSE;
|
||||
triDown* = TRUE;
|
||||
triLeft* = FALSE;
|
||||
triRight* = TRUE;
|
||||
triUp* = FALSE;
|
||||
triDown* = TRUE;
|
||||
triLeft* = FALSE;
|
||||
triRight* = TRUE;
|
||||
|
||||
TYPE
|
||||
|
||||
tFont* = POINTER TO RECORD
|
||||
handle*: INTEGER;
|
||||
height*: INTEGER;
|
||||
width*: INTEGER;
|
||||
size: INTEGER;
|
||||
flags: INTEGER;
|
||||
name*: ARRAY 256 OF WCHAR
|
||||
END;
|
||||
tFont* = POINTER TO RECORD
|
||||
handle*: INTEGER;
|
||||
height*: INTEGER;
|
||||
width*: INTEGER;
|
||||
size: INTEGER;
|
||||
flags: INTEGER;
|
||||
name*: ARRAY 256 OF WCHAR
|
||||
END;
|
||||
|
||||
tCanvas* = POINTER TO RECORD
|
||||
bitmap: INTEGER;
|
||||
width*, height*, sizeY: INTEGER;
|
||||
color, backColor, textColor: INTEGER;
|
||||
font*: tFont;
|
||||
mode: INTEGER
|
||||
END;
|
||||
tCanvas* = POINTER TO RECORD
|
||||
bitmap: INTEGER;
|
||||
width*, height*, sizeY: INTEGER;
|
||||
color, backColor, textColor: INTEGER;
|
||||
font*: tFont;
|
||||
mode: INTEGER
|
||||
END;
|
||||
|
||||
VAR
|
||||
|
||||
@ -66,101 +66,101 @@ END getRGB;
|
||||
|
||||
PROCEDURE DrawCanvas* (canvas: tCanvas; x, y: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc7(65, canvas.bitmap, canvas.width*65536 + canvas.height, x*65536 + y, 32, 0, 0)
|
||||
KOSAPI.sysfunc7(65, canvas.bitmap, canvas.width*65536 + canvas.height, x*65536 + y, 32, 0, 0)
|
||||
END DrawCanvas;
|
||||
|
||||
|
||||
PROCEDURE SetColor* (canvas: tCanvas; color: INTEGER);
|
||||
BEGIN
|
||||
canvas.color := color
|
||||
canvas.color := color
|
||||
END SetColor;
|
||||
|
||||
|
||||
PROCEDURE SetTextColor* (canvas: tCanvas; color: INTEGER);
|
||||
BEGIN
|
||||
canvas.textColor := color
|
||||
canvas.textColor := color
|
||||
END SetTextColor;
|
||||
|
||||
|
||||
PROCEDURE SetBkColor* (canvas: tCanvas; color: INTEGER);
|
||||
BEGIN
|
||||
canvas.backColor := color
|
||||
canvas.backColor := color
|
||||
END SetBkColor;
|
||||
|
||||
|
||||
PROCEDURE CreateFont (size: INTEGER; name: ARRAY OF WCHAR; attr: SET): tFont;
|
||||
VAR
|
||||
font: tFont;
|
||||
font: tFont;
|
||||
BEGIN
|
||||
ASSERT(size IN {0, 1, 2});
|
||||
NEW(font);
|
||||
font.size := size;
|
||||
IF size = 0 THEN
|
||||
font.width := 6;
|
||||
font.height := 9;
|
||||
font.flags := 08000000H
|
||||
ELSE
|
||||
font.width := size*8;
|
||||
font.height := size*16;
|
||||
IF size = 1 THEN
|
||||
font.flags := 28000000H
|
||||
ELSIF size = 2 THEN
|
||||
font.flags := 29000000H
|
||||
END
|
||||
END;
|
||||
font.name := name
|
||||
RETURN font
|
||||
NEW(font);
|
||||
font.size := size;
|
||||
IF size = 0 THEN
|
||||
font.width := 6;
|
||||
font.height := 9;
|
||||
font.flags := 08000000H
|
||||
ELSE
|
||||
font.width := size*8;
|
||||
font.height := size*16;
|
||||
IF size = 1 THEN
|
||||
font.flags := 28000000H
|
||||
ELSIF size = 2 THEN
|
||||
font.flags := 29000000H
|
||||
END
|
||||
END;
|
||||
font.name := name
|
||||
RETURN font
|
||||
END CreateFont;
|
||||
|
||||
|
||||
PROCEDURE SetFont* (canvas: tCanvas; font: tFont);
|
||||
BEGIN
|
||||
canvas.font := font
|
||||
canvas.font := font
|
||||
END SetFont;
|
||||
|
||||
|
||||
PROCEDURE HLine* (canvas: tCanvas; y, x1, x2: INTEGER);
|
||||
VAR
|
||||
X1, X2, i: INTEGER;
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
X1, X2, i: INTEGER;
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
BEGIN
|
||||
X1 := MAX(MIN(x1, x2), 0);
|
||||
X2 := MIN(MAX(x1, x2), canvas.width - 1);
|
||||
IF (0 <= y) & (y < canvas.height) THEN
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(y*canvas.width + X1);
|
||||
FOR i := X1 TO X2 DO
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, 4)
|
||||
END
|
||||
END
|
||||
X1 := MAX(MIN(x1, x2), 0);
|
||||
X2 := MIN(MAX(x1, x2), canvas.width - 1);
|
||||
IF (0 <= y) & (y < canvas.height) THEN
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(y*canvas.width + X1);
|
||||
FOR i := X1 TO X2 DO
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, 4)
|
||||
END
|
||||
END
|
||||
END HLine;
|
||||
|
||||
|
||||
PROCEDURE VLine* (canvas: tCanvas; x, y1, y2: INTEGER);
|
||||
VAR
|
||||
Y1, Y2, i: INTEGER;
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
Y1, Y2, i: INTEGER;
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
BEGIN
|
||||
Y1 := MAX(MIN(y1, y2), 0);
|
||||
Y2 := MIN(MAX(y1, y2), canvas.height - 1);
|
||||
IF (0 <= x) & (x < canvas.width) THEN
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(Y1*canvas.width + x);
|
||||
FOR i := Y1 TO Y2 DO
|
||||
IF canvas.mode = modeNOT THEN
|
||||
SYSTEM.GET32(ptr, color);
|
||||
color := ORD(-BITS(color)*{0..23})
|
||||
ELSIF canvas.mode = modeXOR THEN
|
||||
SYSTEM.GET32(ptr, color);
|
||||
color := ORD((BITS(color)/BITS(canvas.color))*{0..23})
|
||||
END;
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, canvas.width*4)
|
||||
END
|
||||
END
|
||||
Y1 := MAX(MIN(y1, y2), 0);
|
||||
Y2 := MIN(MAX(y1, y2), canvas.height - 1);
|
||||
IF (0 <= x) & (x < canvas.width) THEN
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(Y1*canvas.width + x);
|
||||
FOR i := Y1 TO Y2 DO
|
||||
IF canvas.mode = modeNOT THEN
|
||||
SYSTEM.GET32(ptr, color);
|
||||
color := ORD(-BITS(color)*{0..23})
|
||||
ELSIF canvas.mode = modeXOR THEN
|
||||
SYSTEM.GET32(ptr, color);
|
||||
color := ORD((BITS(color)/BITS(canvas.color))*{0..23})
|
||||
END;
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, canvas.width*4)
|
||||
END
|
||||
END
|
||||
END VLine;
|
||||
|
||||
|
||||
@ -183,19 +183,19 @@ END xorVLine;
|
||||
|
||||
PROCEDURE DLine* (canvas: tCanvas; x1, x2, y: INTEGER; k: INTEGER);
|
||||
VAR
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
d: INTEGER;
|
||||
ptr: INTEGER;
|
||||
color: INTEGER;
|
||||
d: INTEGER;
|
||||
BEGIN
|
||||
ASSERT(ABS(k) = 1);
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(y*canvas.width + x1);
|
||||
d := 4*(1 - canvas.width*k);
|
||||
WHILE x1 <= x2 DO
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, d);
|
||||
INC(x1)
|
||||
END
|
||||
color := canvas.color;
|
||||
ptr := canvas.bitmap + 4*(y*canvas.width + x1);
|
||||
d := 4*(1 - canvas.width*k);
|
||||
WHILE x1 <= x2 DO
|
||||
SYSTEM.PUT32(ptr, color);
|
||||
INC(ptr, d);
|
||||
INC(x1)
|
||||
END
|
||||
END DLine;
|
||||
|
||||
|
||||
@ -230,123 +230,123 @@ END Triangle;
|
||||
|
||||
PROCEDURE FillRect* (canvas: tCanvas; left, top, right, bottom: INTEGER);
|
||||
VAR
|
||||
y: INTEGER;
|
||||
y: INTEGER;
|
||||
BEGIN
|
||||
FOR y := top TO bottom DO
|
||||
HLine(canvas, y, left, right)
|
||||
END
|
||||
FOR y := top TO bottom DO
|
||||
HLine(canvas, y, left, right)
|
||||
END
|
||||
END FillRect;
|
||||
|
||||
|
||||
PROCEDURE Rect* (canvas: tCanvas; left, top, right, bottom: INTEGER);
|
||||
BEGIN
|
||||
HLine(canvas, top, left, right);
|
||||
HLine(canvas, bottom, left, right);
|
||||
VLine(canvas, left, top, bottom);
|
||||
VLine(canvas, right, top, bottom)
|
||||
HLine(canvas, top, left, right);
|
||||
HLine(canvas, bottom, left, right);
|
||||
VLine(canvas, left, top, bottom);
|
||||
VLine(canvas, right, top, bottom)
|
||||
END Rect;
|
||||
|
||||
|
||||
PROCEDURE clear* (canvas: tCanvas);
|
||||
VAR
|
||||
ptr, ptr2, w, i: INTEGER;
|
||||
ptr, ptr2, w, i: INTEGER;
|
||||
BEGIN
|
||||
HLine(canvas, 0, 0, canvas.width - 1);
|
||||
w := canvas.width*4;
|
||||
ptr := canvas.bitmap;
|
||||
ptr2 := ptr;
|
||||
i := canvas.sizeY - 1;
|
||||
WHILE i > 0 DO
|
||||
INC(ptr2, w);
|
||||
SYSTEM.MOVE(ptr, ptr2, w);
|
||||
DEC(i)
|
||||
END
|
||||
HLine(canvas, 0, 0, canvas.width - 1);
|
||||
w := canvas.width*4;
|
||||
ptr := canvas.bitmap;
|
||||
ptr2 := ptr;
|
||||
i := canvas.sizeY - 1;
|
||||
WHILE i > 0 DO
|
||||
INC(ptr2, w);
|
||||
SYSTEM.MOVE(ptr, ptr2, w);
|
||||
DEC(i)
|
||||
END
|
||||
END clear;
|
||||
|
||||
|
||||
PROCEDURE TextOut* (canvas: tCanvas; x, y: INTEGER; text: INTEGER; n: INTEGER; delimColor: INTEGER);
|
||||
CONST
|
||||
WCHAR_SIZE = 2;
|
||||
WCHAR_SIZE = 2;
|
||||
VAR
|
||||
color, i: INTEGER;
|
||||
font: tFont;
|
||||
c: WCHAR;
|
||||
color, i: INTEGER;
|
||||
font: tFont;
|
||||
c: WCHAR;
|
||||
BEGIN
|
||||
font := canvas.font;
|
||||
IF (0 <= y) & (y <= canvas.sizeY - font.height - 1) THEN
|
||||
IF x < 0 THEN
|
||||
i := -(x DIV font.width);
|
||||
INC(x, i*font.width);
|
||||
DEC(n, i)
|
||||
ELSE
|
||||
i := 0
|
||||
END;
|
||||
IF n > 0 THEN
|
||||
n := MAX(MIN(n, (canvas.width - x) DIV font.width), 0);
|
||||
color := canvas.color;
|
||||
canvas.color := canvas.backColor;
|
||||
FillRect(canvas, x, y, x + n*font.width - 1, y + font.height);
|
||||
canvas.color := color;
|
||||
WHILE n > 0 DO
|
||||
SYSTEM.GET(text + i*WCHAR_SIZE, c);
|
||||
IF ~Lines.isSpace(c) THEN
|
||||
IF Languages.isDelim(c) THEN
|
||||
color := delimColor
|
||||
ELSE
|
||||
color := canvas.textColor
|
||||
END;
|
||||
IF (0 <= y) & (y <= canvas.sizeY - font.height - 1) THEN
|
||||
IF x < 0 THEN
|
||||
i := -(x DIV font.width);
|
||||
INC(x, i*font.width);
|
||||
DEC(n, i)
|
||||
ELSE
|
||||
i := 0
|
||||
END;
|
||||
IF n > 0 THEN
|
||||
n := MAX(MIN(n, (canvas.width - x) DIV font.width), 0);
|
||||
color := canvas.color;
|
||||
canvas.color := canvas.backColor;
|
||||
FillRect(canvas, x, y, x + n*font.width - 1, y + font.height);
|
||||
canvas.color := color;
|
||||
WHILE n > 0 DO
|
||||
SYSTEM.GET(text + i*WCHAR_SIZE, c);
|
||||
IF ~Lines.isSpace(c) THEN
|
||||
IF Languages.isDelim(c) THEN
|
||||
color := delimColor
|
||||
ELSE
|
||||
color := canvas.textColor
|
||||
END;
|
||||
IF c = Lines.NUL THEN
|
||||
c := 0X
|
||||
c := 0X
|
||||
END;
|
||||
IF font = fonts[0] THEN
|
||||
c := WCHR(E.UNI[ORD(c), E.CP866])
|
||||
END;
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, font.flags + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
|
||||
END;
|
||||
INC(x, font.width);
|
||||
INC(i);
|
||||
DEC(n)
|
||||
END
|
||||
END
|
||||
END
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, font.flags + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
|
||||
END;
|
||||
INC(x, font.width);
|
||||
INC(i);
|
||||
DEC(n)
|
||||
END
|
||||
END
|
||||
END
|
||||
END TextOut;
|
||||
|
||||
|
||||
PROCEDURE TextOut2* (canvas: tCanvas; x, y: INTEGER; text: ARRAY OF WCHAR; n: INTEGER);
|
||||
BEGIN
|
||||
TextOut(canvas, x, y, SYSTEM.ADR(text[0]), n, canvas.textColor)
|
||||
TextOut(canvas, x, y, SYSTEM.ADR(text[0]), n, canvas.textColor)
|
||||
END TextOut2;
|
||||
|
||||
|
||||
PROCEDURE CreateCanvas* (width, height: INTEGER): tCanvas;
|
||||
VAR
|
||||
canvas: tCanvas;
|
||||
canvas: tCanvas;
|
||||
BEGIN
|
||||
NEW(canvas);
|
||||
canvas.bitmap := KOSAPI.malloc(width*height*4 + 8);
|
||||
ASSERT(canvas.bitmap # 0);
|
||||
SYSTEM.PUT32(canvas.bitmap, width);
|
||||
SYSTEM.PUT32(canvas.bitmap + 4, height);
|
||||
INC(canvas.bitmap, 8);
|
||||
canvas.width := width;
|
||||
canvas.height := height;
|
||||
canvas.sizeY := height;
|
||||
canvas.mode := modeCOPY
|
||||
RETURN canvas
|
||||
NEW(canvas);
|
||||
canvas.bitmap := KOSAPI.malloc(width*height*4 + 8);
|
||||
ASSERT(canvas.bitmap # 0);
|
||||
SYSTEM.PUT32(canvas.bitmap, width);
|
||||
SYSTEM.PUT32(canvas.bitmap + 4, height);
|
||||
INC(canvas.bitmap, 8);
|
||||
canvas.width := width;
|
||||
canvas.height := height;
|
||||
canvas.sizeY := height;
|
||||
canvas.mode := modeCOPY
|
||||
RETURN canvas
|
||||
END CreateCanvas;
|
||||
|
||||
|
||||
PROCEDURE destroy* (VAR canvas: tCanvas);
|
||||
BEGIN
|
||||
IF canvas # NIL THEN
|
||||
canvas.bitmap := KOSAPI.free(canvas.bitmap - 8);
|
||||
DISPOSE(canvas)
|
||||
END
|
||||
IF canvas # NIL THEN
|
||||
canvas.bitmap := KOSAPI.free(canvas.bitmap - 8);
|
||||
DISPOSE(canvas)
|
||||
END
|
||||
END destroy;
|
||||
|
||||
|
||||
BEGIN
|
||||
fonts[0] := CreateFont(0, "", {});
|
||||
fonts[1] := CreateFont(1, "", {});
|
||||
fonts[2] := CreateFont(2, "", {});
|
||||
fonts[0] := CreateFont(0, "", {});
|
||||
fonts[1] := CreateFont(1, "", {});
|
||||
fonts[2] := CreateFont(2, "", {});
|
||||
END Graph.
|
@ -1,5 +1,5 @@
|
||||
(*
|
||||
Copyright 2021, 2022 Anton Krotov
|
||||
Copyright 2021-2023 Anton Krotov
|
||||
|
||||
This file is part of CEdit.
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
MODULE KolibriOS;
|
||||
|
||||
IMPORT
|
||||
KOSAPI, SYSTEM, U := Utils;
|
||||
KOSAPI, SYSTEM, U := Utils;
|
||||
|
||||
CONST
|
||||
fontWidth* = 8;
|
||||
fontHeight* = 16;
|
||||
fontWidth* = 8;
|
||||
fontHeight* = 16;
|
||||
|
||||
VAR
|
||||
|
||||
@ -44,189 +44,189 @@ VAR
|
||||
|
||||
PROCEDURE CreateWindow* (x, y, w, h, color, style, hcolor, hstyle: INTEGER; htext: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(0, x*65536 + w, y*65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(htext[0]))
|
||||
KOSAPI.sysfunc6(0, x*65536 + w, y*65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(htext[0]))
|
||||
END CreateWindow;
|
||||
|
||||
|
||||
PROCEDURE BeginDraw*;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(12, 1)
|
||||
KOSAPI.sysfunc2(12, 1)
|
||||
END BeginDraw;
|
||||
|
||||
|
||||
PROCEDURE EndDraw*;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(12, 2)
|
||||
KOSAPI.sysfunc2(12, 2)
|
||||
END EndDraw;
|
||||
|
||||
|
||||
PROCEDURE EventTimeout* (t: INTEGER): INTEGER;
|
||||
RETURN KOSAPI.sysfunc2(23, t)
|
||||
RETURN KOSAPI.sysfunc2(23, t)
|
||||
END EventTimeout;
|
||||
|
||||
|
||||
PROCEDURE ThreadInfo (offsa, offsb: INTEGER; VAR a, b: INTEGER);
|
||||
VAR
|
||||
buffer: ARRAY 1024 OF BYTE;
|
||||
buffer: ARRAY 1024 OF BYTE;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc3(9, SYSTEM.ADR(buffer[0]), -1);
|
||||
SYSTEM.GET32(SYSTEM.ADR(buffer[0]) + offsa, a);
|
||||
SYSTEM.GET32(SYSTEM.ADR(buffer[0]) + offsb, b);
|
||||
KOSAPI.sysfunc3(9, SYSTEM.ADR(buffer[0]), -1);
|
||||
SYSTEM.GET32(SYSTEM.ADR(buffer[0]) + offsa, a);
|
||||
SYSTEM.GET32(SYSTEM.ADR(buffer[0]) + offsb, b);
|
||||
END ThreadInfo;
|
||||
|
||||
|
||||
PROCEDURE WinSize* (VAR width, height: INTEGER);
|
||||
BEGIN
|
||||
ThreadInfo(42, 46, width, height)
|
||||
ThreadInfo(42, 46, width, height)
|
||||
END WinSize;
|
||||
|
||||
|
||||
PROCEDURE WinPos* (VAR x, y: INTEGER);
|
||||
BEGIN
|
||||
ThreadInfo(34, 38, x, y)
|
||||
ThreadInfo(34, 38, x, y)
|
||||
END WinPos;
|
||||
|
||||
|
||||
PROCEDURE ClientSize* (VAR width, height: INTEGER);
|
||||
BEGIN
|
||||
ThreadInfo(62, 66, width, height)
|
||||
ThreadInfo(62, 66, width, height)
|
||||
END ClientSize;
|
||||
|
||||
|
||||
PROCEDURE ClientPos* (VAR x, y: INTEGER);
|
||||
BEGIN
|
||||
ThreadInfo(54, 58, x, y)
|
||||
ThreadInfo(54, 58, x, y)
|
||||
END ClientPos;
|
||||
|
||||
|
||||
PROCEDURE ScreenSize* (VAR width, height: INTEGER);
|
||||
VAR
|
||||
eax, ebx: INTEGER;
|
||||
right, left, top, bottom: INTEGER;
|
||||
eax, ebx: INTEGER;
|
||||
right, left, top, bottom: INTEGER;
|
||||
BEGIN
|
||||
eax := KOSAPI.sysfunc22(48, 5, ebx);
|
||||
left := LSR(eax, 16);
|
||||
right := eax MOD 65536;
|
||||
top := LSR(ebx, 16);
|
||||
bottom := ebx MOD 65536;
|
||||
width := right - left + 1;
|
||||
height := bottom - top + 1
|
||||
eax := KOSAPI.sysfunc22(48, 5, ebx);
|
||||
left := LSR(eax, 16);
|
||||
right := eax MOD 65536;
|
||||
top := LSR(ebx, 16);
|
||||
bottom := ebx MOD 65536;
|
||||
width := right - left + 1;
|
||||
height := bottom - top + 1
|
||||
END ScreenSize;
|
||||
|
||||
|
||||
PROCEDURE ThreadID* (): INTEGER;
|
||||
VAR
|
||||
id: INTEGER;
|
||||
id: INTEGER;
|
||||
BEGIN
|
||||
ThreadInfo(30, 30, id, id)
|
||||
RETURN id
|
||||
ThreadInfo(30, 30, id, id)
|
||||
RETURN id
|
||||
END ThreadID;
|
||||
|
||||
|
||||
PROCEDURE RolledUp* (): BOOLEAN;
|
||||
VAR
|
||||
buffer: ARRAY 1024 OF BYTE;
|
||||
buffer: ARRAY 1024 OF BYTE;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc3(9, SYSTEM.ADR(buffer[0]), -1)
|
||||
RETURN ODD(LSR(buffer[70], 2))
|
||||
KOSAPI.sysfunc3(9, SYSTEM.ADR(buffer[0]), -1)
|
||||
RETURN ODD(LSR(buffer[70], 2))
|
||||
END RolledUp;
|
||||
|
||||
|
||||
PROCEDURE SetWinSize* (width, height: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc5(67, -1, -1, width, height)
|
||||
KOSAPI.sysfunc5(67, -1, -1, width, height)
|
||||
END SetWinSize;
|
||||
|
||||
|
||||
PROCEDURE DrawText* (x, y, color: INTEGER; text: ARRAY OF WCHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0A0H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0A0H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||
END DrawText;
|
||||
|
||||
|
||||
PROCEDURE DrawText69* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(080H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(080H, 24), SYSTEM.ADR(text[0]), 0, 0)
|
||||
END DrawText69;
|
||||
|
||||
|
||||
PROCEDURE DrawText866* (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, colors.work)
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, colors.work)
|
||||
END DrawText866;
|
||||
|
||||
|
||||
PROCEDURE DrawText866bk* (x, y, color, bkColor: INTEGER; text: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, bkColor)
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(0D0H, 24), SYSTEM.ADR(text[0]), 0, bkColor)
|
||||
END DrawText866bk;
|
||||
|
||||
|
||||
PROCEDURE MousePos* (VAR x, y: INTEGER);
|
||||
VAR
|
||||
res: INTEGER;
|
||||
res: INTEGER;
|
||||
BEGIN
|
||||
res := KOSAPI.sysfunc2(37, 0);
|
||||
y := res MOD 65536;
|
||||
x := res DIV 65536
|
||||
res := KOSAPI.sysfunc2(37, 0);
|
||||
y := res MOD 65536;
|
||||
x := res DIV 65536
|
||||
END MousePos;
|
||||
|
||||
|
||||
PROCEDURE CreateButton* (id, Left, Top, Width, Height, Color: INTEGER; Caption: ARRAY OF WCHAR);
|
||||
VAR
|
||||
x, y: INTEGER;
|
||||
x, y: INTEGER;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc5(8, LSL(Left, 16) + Width, LSL(Top, 16) + Height, id, Color);
|
||||
x := Left + (Width - fontWidth * LENGTH(Caption)) DIV 2;
|
||||
y := Top + (Height - fontHeight) DIV 2 + 1;
|
||||
DrawText(x, y, colors.button_text, Caption)
|
||||
KOSAPI.sysfunc5(8, LSL(Left, 16) + Width, LSL(Top, 16) + Height, id, Color);
|
||||
x := Left + (Width - fontWidth * LENGTH(Caption)) DIV 2;
|
||||
y := Top + (Height - fontHeight) DIV 2 + 1;
|
||||
DrawText(x, y, colors.button_text, Caption)
|
||||
END CreateButton;
|
||||
|
||||
|
||||
PROCEDURE DeleteButton* (id: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc5(8, 0, 0, id + 80000000H, 0)
|
||||
KOSAPI.sysfunc5(8, 0, 0, id + 80000000H, 0)
|
||||
END DeleteButton;
|
||||
|
||||
|
||||
PROCEDURE GetTickCount* (): INTEGER;
|
||||
RETURN KOSAPI.sysfunc2(26, 9)
|
||||
RETURN KOSAPI.sysfunc2(26, 9)
|
||||
END GetTickCount;
|
||||
|
||||
|
||||
PROCEDURE Pause* (time: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(5, time)
|
||||
KOSAPI.sysfunc2(5, time)
|
||||
END Pause;
|
||||
|
||||
|
||||
PROCEDURE ButtonCode* (VAR middle: BOOLEAN): INTEGER;
|
||||
VAR
|
||||
res: INTEGER;
|
||||
res: INTEGER;
|
||||
BEGIN
|
||||
middle := FALSE;
|
||||
res := KOSAPI.sysfunc1(17);
|
||||
IF res MOD 256 = 0 THEN
|
||||
res := LSR(res, 8)
|
||||
ELSIF res MOD 256 = 4 THEN
|
||||
res := LSR(res, 8);
|
||||
middle := TRUE
|
||||
ELSE
|
||||
res := 0
|
||||
END
|
||||
RETURN res
|
||||
middle := FALSE;
|
||||
res := KOSAPI.sysfunc1(17);
|
||||
IF res MOD 256 = 0 THEN
|
||||
res := LSR(res, 8)
|
||||
ELSIF res MOD 256 = 4 THEN
|
||||
res := LSR(res, 8);
|
||||
middle := TRUE
|
||||
ELSE
|
||||
res := 0
|
||||
END
|
||||
RETURN res
|
||||
END ButtonCode;
|
||||
|
||||
|
||||
PROCEDURE Exit*;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc1(-1)
|
||||
KOSAPI.sysfunc1(-1)
|
||||
END Exit;
|
||||
|
||||
|
||||
PROCEDURE ExitID* (tid: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc3(18, 18, tid)
|
||||
KOSAPI.sysfunc3(18, 18, tid)
|
||||
END ExitID;
|
||||
|
||||
|
||||
@ -234,37 +234,37 @@ PROCEDURE CreateThread* (proc: INTEGER; stack: ARRAY OF INTEGER): INTEGER;
|
||||
VAR
|
||||
tid: INTEGER;
|
||||
BEGIN
|
||||
tid := KOSAPI.sysfunc4(51, 1, proc, SYSTEM.ADR(stack[LEN(stack) - 2]));
|
||||
IF tid = -1 THEN
|
||||
tid := 0
|
||||
END
|
||||
RETURN tid
|
||||
tid := KOSAPI.sysfunc4(51, 1, proc, SYSTEM.ADR(stack[LEN(stack) - 2]));
|
||||
IF tid = -1 THEN
|
||||
tid := 0
|
||||
END
|
||||
RETURN tid
|
||||
END CreateThread;
|
||||
|
||||
|
||||
PROCEDURE Run* (program, param: ARRAY OF CHAR);
|
||||
TYPE
|
||||
|
||||
info_struct = RECORD
|
||||
subfunc : INTEGER;
|
||||
flags : INTEGER;
|
||||
param : INTEGER;
|
||||
rsrvd1 : INTEGER;
|
||||
rsrvd2 : INTEGER;
|
||||
fname : ARRAY 1024 OF CHAR
|
||||
END;
|
||||
info_struct = RECORD
|
||||
subfunc : INTEGER;
|
||||
flags : INTEGER;
|
||||
param : INTEGER;
|
||||
rsrvd1 : INTEGER;
|
||||
rsrvd2 : INTEGER;
|
||||
fname : ARRAY 1024 OF CHAR
|
||||
END;
|
||||
|
||||
VAR
|
||||
info: info_struct;
|
||||
info: info_struct;
|
||||
|
||||
BEGIN
|
||||
info.subfunc := 7;
|
||||
info.flags := 0;
|
||||
info.param := SYSTEM.ADR(param[0]);
|
||||
info.rsrvd1 := 0;
|
||||
info.rsrvd2 := 0;
|
||||
COPY(program, info.fname);
|
||||
KOSAPI.sysfunc2(70, SYSTEM.ADR(info))
|
||||
info.subfunc := 7;
|
||||
info.flags := 0;
|
||||
info.param := SYSTEM.ADR(param[0]);
|
||||
info.rsrvd1 := 0;
|
||||
info.rsrvd2 := 0;
|
||||
COPY(program, info.fname);
|
||||
KOSAPI.sysfunc2(70, SYSTEM.ADR(info))
|
||||
END Run;
|
||||
|
||||
|
||||
@ -276,81 +276,81 @@ END SetCurFolder;
|
||||
|
||||
PROCEDURE DrawRect* (x, y, width, height, color: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(13, x*65536 + width, y*65536 + height, color)
|
||||
KOSAPI.sysfunc4(13, x*65536 + width, y*65536 + height, color)
|
||||
END DrawRect;
|
||||
|
||||
|
||||
PROCEDURE DrawLine* (x1, y1, x2, y2: INTEGER; color: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(38, x1*65536 + x2, y1*65536 + y2, color)
|
||||
KOSAPI.sysfunc4(38, x1*65536 + x2, y1*65536 + y2, color)
|
||||
END DrawLine;
|
||||
|
||||
|
||||
PROCEDURE DrawImage* (data, sizeX, sizeY, x, y: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(7, data, sizeX*65536 + sizeY, x*65536 + y)
|
||||
KOSAPI.sysfunc4(7, data, sizeX*65536 + sizeY, x*65536 + y)
|
||||
END DrawImage;
|
||||
|
||||
|
||||
PROCEDURE SetEventsMask* (mask: SET);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(40, ORD(mask))
|
||||
KOSAPI.sysfunc2(40, ORD(mask))
|
||||
END SetEventsMask;
|
||||
|
||||
|
||||
PROCEDURE SkinHeight* (): INTEGER;
|
||||
RETURN KOSAPI.sysfunc2(48, 4)
|
||||
RETURN KOSAPI.sysfunc2(48, 4)
|
||||
END SkinHeight;
|
||||
|
||||
|
||||
PROCEDURE GetKey* (): INTEGER;
|
||||
RETURN KOSAPI.sysfunc1(2)
|
||||
RETURN KOSAPI.sysfunc1(2)
|
||||
END GetKey;
|
||||
|
||||
|
||||
PROCEDURE MouseState* (): SET;
|
||||
RETURN BITS(KOSAPI.sysfunc2(37, 3))
|
||||
RETURN BITS(KOSAPI.sysfunc2(37, 3))
|
||||
END MouseState;
|
||||
|
||||
|
||||
PROCEDURE Scroll* (): INTEGER;
|
||||
RETURN ASR(LSL(KOSAPI.sysfunc2(37, 7), 16), 16)
|
||||
RETURN ASR(LSL(KOSAPI.sysfunc2(37, 7), 16), 16)
|
||||
END Scroll;
|
||||
|
||||
|
||||
PROCEDURE GetControlKeys* (): SET;
|
||||
RETURN BITS(KOSAPI.sysfunc2(66, 3))
|
||||
RETURN BITS(KOSAPI.sysfunc2(66, 3))
|
||||
END GetControlKeys;
|
||||
|
||||
|
||||
PROCEDURE GetSystemColors*;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(colors), 40)
|
||||
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(colors), 40)
|
||||
END GetSystemColors;
|
||||
|
||||
|
||||
PROCEDURE getKBState* (VAR shift, ctrl: BOOLEAN);
|
||||
VAR
|
||||
kbState: SET;
|
||||
kbState: SET;
|
||||
BEGIN
|
||||
kbState := GetControlKeys();
|
||||
shift := {0, 1} * kbState # {};
|
||||
ctrl := {2, 3} * kbState # {};
|
||||
kbState := GetControlKeys();
|
||||
shift := {0, 1} * kbState # {};
|
||||
ctrl := {2, 3} * kbState # {};
|
||||
END getKBState;
|
||||
|
||||
|
||||
PROCEDURE mouse* (VAR msState: SET; VAR x, y: INTEGER);
|
||||
VAR
|
||||
mouseX, mouseY,
|
||||
cliX, cliY,
|
||||
winX, winY: INTEGER;
|
||||
mouseX, mouseY,
|
||||
cliX, cliY,
|
||||
winX, winY: INTEGER;
|
||||
BEGIN
|
||||
msState := MouseState();
|
||||
MousePos(mouseX, mouseY);
|
||||
WinPos(winX, winY);
|
||||
ClientPos(cliX, cliY);
|
||||
x := mouseX - winX - cliX;
|
||||
y := mouseY - winY - cliY
|
||||
MousePos(mouseX, mouseY);
|
||||
WinPos(winX, winY);
|
||||
ClientPos(cliX, cliY);
|
||||
x := mouseX - winX - cliX;
|
||||
y := mouseY - winY - cliY
|
||||
END mouse;
|
||||
|
||||
|
||||
@ -433,7 +433,7 @@ BEGIN
|
||||
ptr2 := KOSAPI.malloc(size);
|
||||
IF ptr2 # 0 THEN
|
||||
SYSTEM.MOVE(ptr + 16, ptr2, size)
|
||||
END
|
||||
END
|
||||
END;
|
||||
ptr := KOSAPI.free(ptr)
|
||||
END
|
||||
|
@ -28,6 +28,7 @@ CONST
|
||||
TAB* = 9X;
|
||||
NUL* = 0FDD0X;
|
||||
TAB1* = 0FDD1X;
|
||||
MAX_TAB_WIDTH* = 16;
|
||||
|
||||
TYPE
|
||||
|
||||
@ -540,8 +541,8 @@ BEGIN
|
||||
END;
|
||||
tabs := _tab > 0;
|
||||
tab := ABS(_tab);
|
||||
IF tab > 32 THEN
|
||||
tab := 32
|
||||
IF tab > MAX_TAB_WIDTH THEN
|
||||
tab := MAX_TAB_WIDTH
|
||||
END
|
||||
END setTabs;
|
||||
|
||||
|
@ -597,7 +597,7 @@ BEGIN
|
||||
WHILE U.isDigit(Lines.getChar(line, i)) DO
|
||||
INC(i)
|
||||
END;
|
||||
IF Lines.getChar(line, i) = "E" THEN
|
||||
IF upper(Lines.getChar(line, i)) = "E" THEN
|
||||
INC(i);
|
||||
IF (Lines.getChar(line, i) = "+") OR (Lines.getChar(line, i) = "-") THEN
|
||||
INC(i)
|
||||
@ -606,9 +606,9 @@ BEGIN
|
||||
INC(i)
|
||||
END
|
||||
END
|
||||
ELSIF Lines.getChar(line, i) = "H" THEN
|
||||
ELSIF upper(Lines.getChar(line, i)) = "H" THEN
|
||||
INC(i)
|
||||
ELSIF Lines.getChar(line, i) = "X" THEN
|
||||
ELSIF upper(Lines.getChar(line, i)) = "X" THEN
|
||||
color := colors.string;
|
||||
INC(i)
|
||||
END
|
||||
|
@ -25,10 +25,10 @@ IMPORT
|
||||
CONST
|
||||
max = 14;
|
||||
|
||||
BtnSize* = 26;
|
||||
BtnInter = 5;
|
||||
DelimSize = 7;
|
||||
IconPad = (BtnSize - Icons.SIZE) DIV 2;
|
||||
BtnSize* = 26;
|
||||
BtnInter = 5;
|
||||
DelimSize = 7;
|
||||
IconPad = (BtnSize - Icons.SIZE) DIV 2;
|
||||
|
||||
TYPE
|
||||
tButtonText = ARRAY 4 OF CHAR;
|
||||
@ -66,8 +66,8 @@ BEGIN
|
||||
IF button.icon # -1 THEN
|
||||
Icons.draw(icons, button.icon, button.x + IconPad, toolbar.y + IconPad)
|
||||
ELSE
|
||||
K.DrawRect(button.x + 1, toolbar.y + 1, BtnSize - 1, BtnSize - 1, toolbar.colors.back);
|
||||
K.DrawText69(button.x + (BtnSize - LENGTH(button.text)*6) DIV 2, toolbar.y + (BtnSize - 9) DIV 2 + 2, color, button.text)
|
||||
K.DrawRect(button.x + 1, toolbar.y + 1, BtnSize - 1, BtnSize - 1, toolbar.colors.back);
|
||||
K.DrawText69(button.x + (BtnSize - LENGTH(button.text)*6) DIV 2, toolbar.y + (BtnSize - 9) DIV 2 + 2, color, button.text)
|
||||
END
|
||||
END;
|
||||
INC(i)
|
||||
|
@ -23,27 +23,27 @@ IMPORT SYSTEM;
|
||||
|
||||
CONST
|
||||
|
||||
SPACE* = 20X;
|
||||
SLASH* = "/";
|
||||
SPACE* = 20X;
|
||||
SLASH* = "/";
|
||||
|
||||
OS* = "KOS";
|
||||
OS* = "KOS";
|
||||
|
||||
|
||||
PROCEDURE streq* (s1, s2: INTEGER; n: INTEGER): BOOLEAN;
|
||||
VAR
|
||||
c1, c2: WCHAR;
|
||||
res: BOOLEAN;
|
||||
c1, c2: WCHAR;
|
||||
res: BOOLEAN;
|
||||
BEGIN
|
||||
res := TRUE;
|
||||
WHILE (n > 0) & res DO
|
||||
SYSTEM.GET(s1, c1);
|
||||
SYSTEM.GET(s2, c2);
|
||||
res := c1 = c2;
|
||||
INC(s1, SYSTEM.SIZE(WCHAR));
|
||||
INC(s2, SYSTEM.SIZE(WCHAR));
|
||||
DEC(n)
|
||||
END
|
||||
RETURN res
|
||||
WHILE (n > 0) & res DO
|
||||
SYSTEM.GET(s1, c1);
|
||||
SYSTEM.GET(s2, c2);
|
||||
res := c1 = c2;
|
||||
INC(s1, SYSTEM.SIZE(WCHAR));
|
||||
INC(s2, SYSTEM.SIZE(WCHAR));
|
||||
DEC(n)
|
||||
END
|
||||
RETURN res
|
||||
END streq;
|
||||
|
||||
|
||||
@ -137,26 +137,26 @@ END int2str;
|
||||
|
||||
|
||||
PROCEDURE isDigit* (ch: WCHAR): BOOLEAN;
|
||||
RETURN ("0" <= ch) & (ch <= "9")
|
||||
RETURN ("0" <= ch) & (ch <= "9")
|
||||
END isDigit;
|
||||
|
||||
|
||||
PROCEDURE isOct* (ch: WCHAR): BOOLEAN;
|
||||
RETURN ("0" <= ch) & (ch <= "7")
|
||||
RETURN ("0" <= ch) & (ch <= "7")
|
||||
END isOct;
|
||||
|
||||
|
||||
PROCEDURE isHex* (ch: WCHAR): BOOLEAN;
|
||||
RETURN ("0" <= ch) & (ch <= "9") OR ("A" <= ch) & (ch <= "F")
|
||||
RETURN ("0" <= ch) & (ch <= "9") OR ("A" <= ch) & (ch <= "F")
|
||||
END isHex;
|
||||
|
||||
|
||||
PROCEDURE isLetter* (ch: WCHAR): BOOLEAN;
|
||||
RETURN ("a" <= ch) & (ch <= "z") OR ("A" <= ch) & (ch <= "Z") OR
|
||||
(* cyrillic *)
|
||||
(430X <= ch) & (ch <= 44FX) OR (410X <= ch) & (ch <= 42FX) OR
|
||||
(ch = 491X) OR (ch = 490X) OR (450X <= ch) & (ch <= 45FX) OR
|
||||
(400X <= ch) & (ch <= 40FX)
|
||||
RETURN ("a" <= ch) & (ch <= "z") OR ("A" <= ch) & (ch <= "Z") OR
|
||||
(* cyrillic *)
|
||||
(430X <= ch) & (ch <= 44FX) OR (410X <= ch) & (ch <= 42FX) OR
|
||||
(ch = 491X) OR (ch = 490X) OR (450X <= ch) & (ch <= 45FX) OR
|
||||
(400X <= ch) & (ch <= 40FX)
|
||||
END isLetter;
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
(*
|
||||
Copyright 2021, 2022 Anton Krotov
|
||||
Copyright 2021-2023 Anton Krotov
|
||||
|
||||
This file is part of CEdit.
|
||||
|
||||
@ -108,8 +108,8 @@ BEGIN
|
||||
G.clear(canvas);
|
||||
G.SetColor(canvas, K.colors.line);
|
||||
G.Rect(canvas, 0, 0, width - 1, height - 1);
|
||||
SetColor(canvas, scroll.btn # -1);
|
||||
IF scroll.vertical THEN
|
||||
SetColor(canvas, scroll.btn # -1);
|
||||
Rect(canvas, 0, 0, width - 1, btn - 1);
|
||||
SetColor(canvas, scroll.btn # 1);
|
||||
Rect(canvas, 0, height - btn, width - 1, height - 1);
|
||||
@ -135,7 +135,6 @@ BEGIN
|
||||
y := y + height - btn - d DIV 2 + 1;
|
||||
G.Triangle(canvas, x1 - 1, y, x2, y, G.triDown);
|
||||
ELSE
|
||||
SetColor(canvas, scroll.btn # -1);
|
||||
Rect(canvas, 0, 0, btn - 1, height - 1);
|
||||
SetColor(canvas, scroll.btn # 1);
|
||||
Rect(canvas, width - btn, 0, width - 1, height - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user