CEdit: setting current folder when running script; added build/run scripts

git-svn-id: svn://kolibrios.org@9630 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2022-01-13 15:13:47 +00:00
parent 235d20b0d6
commit 28e207c0cc
8 changed files with 38 additions and 24 deletions

View File

@ -0,0 +1,3 @@
#SHS
/kolibrios/develop/oberon07/compiler.kex ./src/cedit.ob07 kosexe -out /tmp0/1/cedit.kex -stk 1 -nochk a
exit

Binary file not shown.

View File

@ -0,0 +1,3 @@
#SHS
/tmp0/1/cedit.kex
exit

View File

@ -182,7 +182,7 @@ VAR
winWidth, winHeight: INTEGER; winWidth, winHeight: INTEGER;
SkinHeight: INTEGER; SkinHeight: INTEGER;
AppPath, runScript, buildScript, debugScript: RW.tFileName; AppPath, runScript, buildScript, debugScript, CurFolder: RW.tFileName;
OD: OpenDlg.Dialog; OD: OpenDlg.Dialog;
confirm, notFound, menuFindClicked, search, searchOpened: BOOLEAN; confirm, notFound, menuFindClicked, search, searchOpened: BOOLEAN;
@ -243,7 +243,7 @@ BEGIN
EXCL(edit.flags, 1) EXCL(edit.flags, 1)
END; END;
IF search & searchOpened THEN IF search & searchOpened THEN
EB.paint(edit) EB.draw(edit)
END END
END EditBox_SetFocus; END EditBox_SetFocus;
@ -367,7 +367,7 @@ BEGIN
scroll.left := left; scroll.left := left;
scroll.top := top; scroll.top := top;
Scroll.setValue(scroll, value); Scroll.setValue(scroll, value);
Scroll.paint(scroll) Scroll.draw(scroll)
END DrawScroll; END DrawScroll;
@ -400,9 +400,9 @@ BEGIN
DrawScroll(vScroll, LEFT + canvas.width, TOP - 1, scrollY, text.count - 1); DrawScroll(vScroll, LEFT + canvas.width, TOP - 1, scrollY, text.count - 1);
DrawScroll(hScroll, LEFT, TOP + canvas.height, scrollX, text.maxLength); DrawScroll(hScroll, LEFT, TOP + canvas.height, scrollX, text.maxLength);
IF search & searchOpened THEN IF search & searchOpened THEN
CheckBox.paint(BKW); CheckBox.draw(BKW);
CheckBox.paint(CS); CheckBox.draw(CS);
CheckBox.paint(WH); CheckBox.draw(WH);
END; END;
G.SetColor(canvas, K.colors.line); G.SetColor(canvas, K.colors.line);
@ -485,9 +485,9 @@ BEGIN
FindEdit.left := left; FindEdit.left := left;
ReplaceEdit.left := left; ReplaceEdit.left := left;
GotoEdit.left := left; GotoEdit.left := left;
EB.paint(FindEdit); EB.draw(FindEdit);
EB.paint(ReplaceEdit); EB.draw(ReplaceEdit);
EB.paint(GotoEdit); EB.draw(GotoEdit);
y := top + 200; y := top + 200;
K.CreateButton(btnFindNext, left, y, btnWidth, btnHeight, K.colors.button, "next"); INC(y, btnHeight + 10); K.CreateButton(btnFindNext, left, y, btnWidth, btnHeight, K.colors.button, "next"); INC(y, btnHeight + 10);
K.CreateButton(btnReplace, left, y, btnWidth, btnHeight, K.colors.button, "replace"); INC(y, btnHeight + 10); K.CreateButton(btnReplace, left, y, btnWidth, btnHeight, K.colors.button, "replace"); INC(y, btnHeight + 10);
@ -948,6 +948,8 @@ END goto;
PROCEDURE Script (script: ARRAY OF CHAR); PROCEDURE Script (script: ARRAY OF CHAR);
BEGIN BEGIN
IF script # "" THEN IF script # "" THEN
U.getPath(script, CurFolder);
K.SetCurFolder(CurFolder);
K.Run("/sys/@open", script) K.Run("/sys/@open", script)
END END
END Script; END Script;

View File

@ -42,7 +42,7 @@ TYPE
END; END;
PROCEDURE paint* (chkbox: tCheckBox); PROCEDURE draw* (chkbox: tCheckBox);
VAR VAR
canvas: G.tCanvas; canvas: G.tCanvas;
BEGIN BEGIN
@ -70,7 +70,7 @@ BEGIN
G.TextOut2(canvas, fontHeight + padding, 0, chkbox.text, LENGTH(chkbox.text)); G.TextOut2(canvas, fontHeight + padding, 0, chkbox.text, LENGTH(chkbox.text));
G.DrawCanvas(canvas, chkbox.left, chkbox.top) G.DrawCanvas(canvas, chkbox.left, chkbox.top)
END END
END paint; END draw;
PROCEDURE create* (text: ARRAY OF WCHAR; VAR chkbox: tCheckBox); PROCEDURE create* (text: ARRAY OF WCHAR; VAR chkbox: tCheckBox);
@ -104,7 +104,7 @@ BEGIN
IF U.between(0, x, chkbox.width - 1) & U.between(0, y, chkbox.height - 1) THEN IF U.between(0, x, chkbox.width - 1) & U.between(0, y, chkbox.height - 1) THEN
chkbox.value := ~chkbox.value; chkbox.value := ~chkbox.value;
END; END;
paint(chkbox) draw(chkbox)
END END
ELSE ELSE
chkbox.mouse := FALSE chkbox.mouse := FALSE

View File

@ -51,7 +51,7 @@ TYPE
VAR VAR
paint *: PROCEDURE (eb: tEditBox); draw *: PROCEDURE (eb: tEditBox);
mouse *: PROCEDURE (eb: tEditBox); mouse *: PROCEDURE (eb: tEditBox);
_setValue : PROCEDURE (eb: tEditBox; text: INTEGER); _setValue : PROCEDURE (eb: tEditBox; text: INTEGER);
key *: PROCEDURE (eb: tEditBox; key: INTEGER); key *: PROCEDURE (eb: tEditBox; key: INTEGER);
@ -124,7 +124,7 @@ VAR
BEGIN BEGIN
Lib := KOSAPI.LoadLib("/sys/lib/box_lib.obj"); Lib := KOSAPI.LoadLib("/sys/lib/box_lib.obj");
ASSERT(Lib # 0); ASSERT(Lib # 0);
GetProc(Lib, SYSTEM.ADR(paint), "edit_box_draw"); GetProc(Lib, SYSTEM.ADR(draw), "edit_box_draw");
GetProc(Lib, SYSTEM.ADR(key), "edit_box_key_safe"); GetProc(Lib, SYSTEM.ADR(key), "edit_box_key_safe");
GetProc(Lib, SYSTEM.ADR(mouse), "edit_box_mouse"); GetProc(Lib, SYSTEM.ADR(mouse), "edit_box_mouse");
GetProc(Lib, SYSTEM.ADR(_setValue), "edit_box_set_text"); GetProc(Lib, SYSTEM.ADR(_setValue), "edit_box_set_text");

View File

@ -268,6 +268,12 @@ BEGIN
END Run; END Run;
PROCEDURE SetCurFolder* (folder: ARRAY OF CHAR);
BEGIN
KOSAPI.sysfunc3(30, 1, SYSTEM.ADR(folder[0]));
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)

View File

@ -81,7 +81,7 @@ BEGIN
END Rect; END Rect;
PROCEDURE _paint (scroll: tScroll); PROCEDURE _draw (scroll: tScroll);
VAR VAR
canvas: G.tCanvas; canvas: G.tCanvas;
x, y, d, x1, x2, y1, y2, x, y, d, x1, x2, y1, y2,
@ -164,15 +164,15 @@ BEGIN
G.Triangle(canvas, x, y1 - 1, x, y2, G.triRight); G.Triangle(canvas, x, y1 - 1, x, y2, G.triRight);
END; END;
G.DrawCanvas(scroll.canvas, scroll.left, scroll.top) G.DrawCanvas(scroll.canvas, scroll.left, scroll.top)
END _paint; END _draw;
PROCEDURE paint* (scroll: tScroll); PROCEDURE draw* (scroll: tScroll);
BEGIN BEGIN
IF scroll.canvas # NIL THEN IF scroll.canvas # NIL THEN
_paint(scroll) _draw(scroll)
END END
END paint; END draw;
PROCEDURE resize* (VAR scroll: tScroll; width, height: INTEGER); PROCEDURE resize* (VAR scroll: tScroll; width, height: INTEGER);
@ -181,7 +181,7 @@ BEGIN
scroll.canvas := G.CreateCanvas(width, height); scroll.canvas := G.CreateCanvas(width, height);
scroll.width := width; scroll.width := width;
scroll.height := height; scroll.height := height;
paint(scroll) draw(scroll)
END resize; END resize;
@ -226,7 +226,7 @@ BEGIN
ELSIF scroll.Dec THEN ELSIF scroll.Dec THEN
setValue(scroll, scroll.value - 1) setValue(scroll, scroll.value - 1)
END; END;
paint(scroll) draw(scroll)
END change; END change;
@ -302,7 +302,7 @@ BEGIN
c := x - scroll.left c := x - scroll.left
END; END;
setPos(scroll, scroll.pos0 + c - scroll.Slider); setPos(scroll, scroll.pos0 + c - scroll.Slider);
paint(scroll) draw(scroll)
END MouseMove; END MouseMove;
@ -368,7 +368,7 @@ BEGIN
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2); setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
scroll.pos0 := scroll.pos; scroll.pos0 := scroll.pos;
scroll.Slider := c; scroll.Slider := c;
paint(scroll) draw(scroll)
END END
END END
END MouseDown; END MouseDown;
@ -388,7 +388,7 @@ BEGIN
END END
ELSIF scroll.mouse THEN ELSIF scroll.mouse THEN
MouseUp(scroll); MouseUp(scroll);
paint(scroll) draw(scroll)
END END
END mouse; END mouse;