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