forked from KolibriOS/kolibrios
CEDIT: internal changes
git-svn-id: svn://kolibrios.org@9208 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d38b3890d2
commit
c2885eb759
Binary file not shown.
@ -28,7 +28,7 @@ IMPORT
|
|||||||
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
header = "CEdit (24-sep-2021)";
|
header = "CEdit (28-sep-2021)";
|
||||||
|
|
||||||
ShellFilter = "";
|
ShellFilter = "";
|
||||||
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||||
@ -195,7 +195,7 @@ VAR
|
|||||||
|
|
||||||
replaced: INTEGER;
|
replaced: INTEGER;
|
||||||
|
|
||||||
mainTID, delay: INTEGER;
|
mainTID: INTEGER;
|
||||||
|
|
||||||
context, menuFile, menuEdit, menuSearch, menuEncoding,
|
context, menuFile, menuEdit, menuSearch, menuEncoding,
|
||||||
menuView, menuLanguage, menuProgram, menuTools,
|
menuView, menuLanguage, menuProgram, menuTools,
|
||||||
@ -231,7 +231,7 @@ VAR
|
|||||||
BEGIN
|
BEGIN
|
||||||
res := FALSE;
|
res := FALSE;
|
||||||
IF edit # NIL THEN
|
IF edit # NIL THEN
|
||||||
res := 1 IN BITS(edit.flags)
|
res := 1 IN edit.flags
|
||||||
END
|
END
|
||||||
RETURN res
|
RETURN res
|
||||||
END EditBox_Focus;
|
END EditBox_Focus;
|
||||||
@ -252,9 +252,9 @@ END resetTimer;
|
|||||||
PROCEDURE EditBox_SetFocus (edit: EB.tEditBox; value: BOOLEAN);
|
PROCEDURE EditBox_SetFocus (edit: EB.tEditBox; value: BOOLEAN);
|
||||||
BEGIN
|
BEGIN
|
||||||
IF value THEN
|
IF value THEN
|
||||||
edit.flags := ORD(BITS(edit.flags) + {1})
|
INCL(edit.flags, 1)
|
||||||
ELSE
|
ELSE
|
||||||
edit.flags := ORD(BITS(edit.flags) - {1})
|
EXCL(edit.flags, 1)
|
||||||
END;
|
END;
|
||||||
IF search & searchOpened THEN
|
IF search & searchOpened THEN
|
||||||
EB.paint(edit)
|
EB.paint(edit)
|
||||||
@ -411,16 +411,16 @@ END WriteModified;
|
|||||||
|
|
||||||
PROCEDURE DrawState (text: T.tText; width, height: INTEGER);
|
PROCEDURE DrawState (text: T.tText; width, height: INTEGER);
|
||||||
VAR
|
VAR
|
||||||
y, w, x: INTEGER;
|
y: INTEGER;
|
||||||
|
s: ARRAY 24 OF WCHAR;
|
||||||
BEGIN
|
BEGIN
|
||||||
y := (btnHeight - fontHeight) DIV 2 + btnTop;
|
y := (btnHeight - fontHeight) DIV 2 + btnTop;
|
||||||
K.DrawRect(width - 32*fontWidth, y, 32*fontWidth, fontHeight, K.winColor);
|
s := "";
|
||||||
w := LENGTH(E.names[text.enc])*fontWidth;
|
U.append(s, RW.eolNames[text.eol]);
|
||||||
x := width - w;
|
U.append(s, 20X);
|
||||||
K.DrawText(x, y, K.textColor, E.names[text.enc]);
|
U.append(s, E.names[text.enc]);
|
||||||
w := LENGTH(RW.eolNames[text.eol])*fontWidth;
|
K.DrawRect(width - LEN(s)*fontWidth, y, LEN(s)*fontWidth, fontHeight, K.winColor);
|
||||||
DEC(x, w + 10);
|
K.DrawText(width - LENGTH(s)*fontWidth, y, K.textColor, s);
|
||||||
K.DrawText(x, y, K.textColor, RW.eolNames[text.eol]);
|
|
||||||
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
|
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
|
||||||
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
|
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
|
||||||
K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
|
K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
|
||||||
@ -639,15 +639,11 @@ END draw_window;
|
|||||||
|
|
||||||
PROCEDURE mouse (VAR x, y: INTEGER);
|
PROCEDURE mouse (VAR x, y: INTEGER);
|
||||||
VAR
|
VAR
|
||||||
mouseX, mouseY,
|
msState: SET;
|
||||||
cliX, cliY,
|
|
||||||
winX, winY: INTEGER;
|
|
||||||
BEGIN
|
BEGIN
|
||||||
K.MousePos(mouseX, mouseY);
|
K.mouse(msState, x, y);
|
||||||
K.WinPos(winX, winY);
|
DEC(x, LEFT);
|
||||||
K.ClientPos(cliX, cliY);
|
DEC(y, TOP)
|
||||||
x := mouseX - winX - cliX - LEFT;
|
|
||||||
y := mouseY - winY - cliY - TOP;
|
|
||||||
END mouse;
|
END mouse;
|
||||||
|
|
||||||
|
|
||||||
@ -935,7 +931,7 @@ BEGIN
|
|||||||
EditBox0.text := K.malloc(EDITBOX_MAXCHARS + 2);
|
EditBox0.text := K.malloc(EDITBOX_MAXCHARS + 2);
|
||||||
ASSERT(EditBox0.text # 0);
|
ASSERT(EditBox0.text # 0);
|
||||||
edit := EB.create(left, top, EditBox_Width, EDITBOX_MAXCHARS, EditBox0);
|
edit := EB.create(left, top, EditBox_Width, EDITBOX_MAXCHARS, EditBox0);
|
||||||
edit.flags := 4002H;
|
edit.flags := {1, 14};
|
||||||
edit.text_color := 30000000H;
|
edit.text_color := 30000000H;
|
||||||
EditBox_SetFocus(edit, FALSE)
|
EditBox_SetFocus(edit, FALSE)
|
||||||
RETURN edit
|
RETURN edit
|
||||||
@ -947,7 +943,7 @@ BEGIN
|
|||||||
FindEdit := createEdit(searchLeft, TOP + 20);
|
FindEdit := createEdit(searchLeft, TOP + 20);
|
||||||
ReplaceEdit := createEdit(searchLeft, TOP + 20 + 55);
|
ReplaceEdit := createEdit(searchLeft, TOP + 20 + 55);
|
||||||
GotoEdit := createEdit(searchLeft, TOP + 20 + 330);
|
GotoEdit := createEdit(searchLeft, TOP + 20 + 330);
|
||||||
GotoEdit.flags := ORD(BITS(GotoEdit.flags) + BITS(8000H));
|
INCL(GotoEdit.flags, 15);
|
||||||
CheckBox.create("backward", BKW);
|
CheckBox.create("backward", BKW);
|
||||||
CheckBox.create("match case", CS);
|
CheckBox.create("match case", CS);
|
||||||
CheckBox.create("whole word", WH);
|
CheckBox.create("whole word", WH);
|
||||||
@ -992,16 +988,9 @@ VAR
|
|||||||
shift, ctrl: BOOLEAN;
|
shift, ctrl: BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
K.getKBState(shift, ctrl);
|
K.getKBState(shift, ctrl);
|
||||||
Scroll.MouseDown(hScroll, x + LEFT, y + TOP);
|
|
||||||
Scroll.MouseDown(vScroll, x + LEFT, y + TOP);
|
|
||||||
T.getScroll(text, scrollX, scrollY);
|
T.getScroll(text, scrollX, scrollY);
|
||||||
T.scroll(text, hScroll.value - scrollX, vScroll.value - scrollY);
|
T.scroll(text, hScroll.value - scrollX, vScroll.value - scrollY);
|
||||||
IF search & searchOpened THEN
|
IF U.between(0, x, canvas.width - 1) & U.between(0, y, canvas.height - 1) THEN
|
||||||
CheckBox.MouseDown(BKW, x + LEFT, y + TOP);
|
|
||||||
CheckBox.MouseDown(CS, x + LEFT, y + TOP);
|
|
||||||
CheckBox.MouseDown(WH, x + LEFT, y + TOP);
|
|
||||||
END;
|
|
||||||
IF (0 <= x) & (x < canvas.width) & (0 <= y) & (y < canvas.height) THEN
|
|
||||||
leftButton := TRUE;
|
leftButton := TRUE;
|
||||||
SetFocus(FindEdit, FALSE);
|
SetFocus(FindEdit, FALSE);
|
||||||
IF ~shift THEN
|
IF ~shift THEN
|
||||||
@ -1014,17 +1003,6 @@ BEGIN
|
|||||||
END click;
|
END click;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE LeftButtonUp;
|
|
||||||
BEGIN
|
|
||||||
leftButton := FALSE;
|
|
||||||
Scroll.MouseUp(hScroll);
|
|
||||||
Scroll.MouseUp(vScroll);
|
|
||||||
CheckBox.MouseUp(BKW);
|
|
||||||
CheckBox.MouseUp(CS);
|
|
||||||
CheckBox.MouseUp(WH);
|
|
||||||
END LeftButtonUp;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE Close;
|
PROCEDURE Close;
|
||||||
VAR
|
VAR
|
||||||
cont: BOOLEAN;
|
cont: BOOLEAN;
|
||||||
@ -1143,7 +1121,7 @@ VAR
|
|||||||
BEGIN
|
BEGIN
|
||||||
IF menu = context THEN
|
IF menu = context THEN
|
||||||
mouse(x, y);
|
mouse(x, y);
|
||||||
IF ~((0 <= x) & (x < canvas.width) & (0 <= y) & (y < canvas.height)) THEN
|
IF ~(U.between(0, x, canvas.width - 1) & U.between(0, y, canvas.height - 1)) THEN
|
||||||
menu := NIL
|
menu := NIL
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
@ -1240,6 +1218,17 @@ BEGIN
|
|||||||
END ShowMenu;
|
END ShowMenu;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE setScript (VAR script: RW.tFileName);
|
||||||
|
VAR
|
||||||
|
temp: RW.tFileName;
|
||||||
|
BEGIN
|
||||||
|
OpenFile(temp, ShellFilter);
|
||||||
|
IF temp # "" THEN
|
||||||
|
script := temp
|
||||||
|
END
|
||||||
|
END setScript;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE receiveIPC;
|
PROCEDURE receiveIPC;
|
||||||
VAR
|
VAR
|
||||||
scrollIPC: BOOLEAN;
|
scrollIPC: BOOLEAN;
|
||||||
@ -1254,36 +1243,11 @@ BEGIN
|
|||||||
IPC[2] := 0
|
IPC[2] := 0
|
||||||
ELSIF IPC[0] = mainTID THEN
|
ELSIF IPC[0] = mainTID THEN
|
||||||
IF IPC[2] = Scroll.ScrollIPC THEN
|
IF IPC[2] = Scroll.ScrollIPC THEN
|
||||||
Scroll.change(hScroll);
|
Scroll.receiveIPC(IPC, scrollIPC)
|
||||||
Scroll.change(vScroll);
|
|
||||||
T.scroll(text, ORD(hScroll.Inc) - ORD(hScroll.Dec), ORD(vScroll.Inc) - ORD(vScroll.Dec));
|
|
||||||
|
|
||||||
IF menuActive THEN
|
|
||||||
draw_window;
|
|
||||||
menuActive := FALSE
|
|
||||||
ELSE
|
|
||||||
repaint
|
|
||||||
END;
|
|
||||||
|
|
||||||
IF 0 IN K.MouseState() THEN
|
|
||||||
WHILE (0 IN K.MouseState()) & (delay > 0) DO
|
|
||||||
K.Pause(1);
|
|
||||||
DEC(delay)
|
|
||||||
END;
|
|
||||||
IF delay = 0 THEN
|
|
||||||
IPC[0] := 0;
|
|
||||||
IPC[1] := 0;
|
|
||||||
scrollIPC := TRUE;
|
|
||||||
Scroll.SendIPC;
|
|
||||||
delay := 2
|
|
||||||
ELSE
|
|
||||||
delay := Scroll.Delay
|
|
||||||
END
|
|
||||||
ELSE
|
|
||||||
delay := Scroll.Delay
|
|
||||||
END
|
|
||||||
END;
|
END;
|
||||||
IPC[2] := 0
|
IF ~scrollIPC THEN
|
||||||
|
IPC[2] := 0
|
||||||
|
END
|
||||||
ELSE
|
ELSE
|
||||||
IF ~Menu.isSender(IPC[0]) THEN
|
IF ~Menu.isSender(IPC[0]) THEN
|
||||||
IPC[2] := 0
|
IPC[2] := 0
|
||||||
@ -1297,132 +1261,132 @@ BEGIN
|
|||||||
END
|
END
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
CASE IPC[2] OF
|
|
||||||
|0:
|
|
||||||
|menuCut: T.key(text, ORD("X"), FALSE, TRUE)
|
|
||||||
|menuCopy: T.key(text, ORD("C"), FALSE, TRUE)
|
|
||||||
|menuPaste: T.key(text, ORD("V"), FALSE, TRUE)
|
|
||||||
|menuDelete: T.key(text, 46, FALSE, FALSE)
|
|
||||||
|menuSelectAll: T.key(text, ORD("A"), FALSE, TRUE)
|
|
||||||
|
|
||||||
|menuNew:
|
|
||||||
NewFile
|
|
||||||
|menuOpen:
|
|
||||||
open
|
|
||||||
|menuSave:
|
|
||||||
save(text);
|
|
||||||
repaint
|
|
||||||
|menuSaveAs:
|
|
||||||
saveAs(text);
|
|
||||||
repaint
|
|
||||||
|menuSaveAll:
|
|
||||||
saveAll;
|
|
||||||
repaint
|
|
||||||
|menuClose:
|
|
||||||
closeFile(TRUE, curText)
|
|
||||||
|menuFolder:
|
|
||||||
K.Run("/rd/1/File Managers/Eolite", text.fileName)
|
|
||||||
|menuExit:
|
|
||||||
Close
|
|
||||||
|menuUndo:
|
|
||||||
T.undo(text);
|
|
||||||
repaint
|
|
||||||
|menuRedo:
|
|
||||||
T.redo(text);
|
|
||||||
repaint
|
|
||||||
|menuFind:
|
|
||||||
ShowSearchPanel(FALSE)
|
|
||||||
|menuFindNext:
|
|
||||||
notFound := ~T.findNext(text, BKW.value);
|
|
||||||
menuFindClicked := TRUE
|
|
||||||
|menuFindPrev:
|
|
||||||
notFound := ~T.findNext(text, ~BKW.value);
|
|
||||||
menuFindClicked := TRUE
|
|
||||||
|menuGoto:
|
|
||||||
ShowSearchPanel(TRUE)
|
|
||||||
|menuToggleBookmark:
|
|
||||||
T.toggleLabel(text)
|
|
||||||
|menuNextBookmark:
|
|
||||||
T.gotoLabel(text, TRUE)
|
|
||||||
|menuPrevBookmark:
|
|
||||||
T.gotoLabel(text, FALSE)
|
|
||||||
|menuNumbers:
|
|
||||||
T.toggleNumbers(text)
|
|
||||||
|menuFontSize:
|
|
||||||
IF font = font1 THEN
|
|
||||||
font := font2
|
|
||||||
ELSE
|
|
||||||
font := font1
|
|
||||||
END;
|
|
||||||
resize
|
|
||||||
|menuText:
|
|
||||||
T.setLang(text, Languages.langText)
|
|
||||||
|menuC:
|
|
||||||
T.setLang(text, Languages.langC)
|
|
||||||
|menuFasm:
|
|
||||||
T.setLang(text, Languages.langFasm)
|
|
||||||
|menuIni:
|
|
||||||
T.setLang(text, Languages.langIni)
|
|
||||||
|menuJSON:
|
|
||||||
T.setLang(text, Languages.langJSON)
|
|
||||||
|menuLua:
|
|
||||||
T.setLang(text, Languages.langLua)
|
|
||||||
|menuOberon:
|
|
||||||
T.setLang(text, Languages.langOberon)
|
|
||||||
|menuPascal:
|
|
||||||
T.setLang(text, Languages.langPascal)
|
|
||||||
|menuBuild:
|
|
||||||
Script(buildScript)
|
|
||||||
|menuBuildScript:
|
|
||||||
OpenFile(buildScript, ShellFilter)
|
|
||||||
|menuRun:
|
|
||||||
Script(runScript)
|
|
||||||
|menuRunScript:
|
|
||||||
OpenFile(runScript, ShellFilter)
|
|
||||||
|menuDebug:
|
|
||||||
Script(debugScript)
|
|
||||||
|menuDebugScript:
|
|
||||||
OpenFile(debugScript, ShellFilter)
|
|
||||||
|menuUTF8BOM:
|
|
||||||
text.enc := E.UTF8BOM
|
|
||||||
|menuUTF8:
|
|
||||||
text.enc := E.UTF8
|
|
||||||
|menuCP866:
|
|
||||||
text.enc := E.CP866
|
|
||||||
|menuWin1251:
|
|
||||||
text.enc := E.W1251
|
|
||||||
|menuLF:
|
|
||||||
text.eol := RW.EOL_LF
|
|
||||||
|menuCRLF:
|
|
||||||
text.eol := RW.EOL_CRLF
|
|
||||||
|menuCR:
|
|
||||||
text.eol := RW.EOL_CR
|
|
||||||
|menuPipet:
|
|
||||||
K.Run("/rd/1/develop/pipet", "")
|
|
||||||
|menuBoard:
|
|
||||||
K.Run("/rd/1/develop/board", "")
|
|
||||||
|menuSysFunc:
|
|
||||||
K.Run("/rd/1/docpack", "f")
|
|
||||||
|menuColors..menuMaxColors:
|
|
||||||
Ini.selectSection(IPC[2] - menuColors)
|
|
||||||
|menuMoveUp:
|
|
||||||
T.upLine(text)
|
|
||||||
|menuMoveDown:
|
|
||||||
T.downLine(text)
|
|
||||||
|menuDuplicate:
|
|
||||||
T.dupLine(text)
|
|
||||||
|menuRemove:
|
|
||||||
T.delLine(text)
|
|
||||||
|menuIncInd:
|
|
||||||
T.Indent(text, TRUE)
|
|
||||||
|menuDecInd:
|
|
||||||
T.Indent(text, FALSE)
|
|
||||||
|menuUpper:
|
|
||||||
T.chCase(text, TRUE)
|
|
||||||
|menuLower:
|
|
||||||
T.chCase(text, FALSE)
|
|
||||||
END;
|
|
||||||
IF ~scrollIPC THEN
|
IF ~scrollIPC THEN
|
||||||
|
CASE IPC[2] OF
|
||||||
|
|0:
|
||||||
|
|menuCut: T.key(text, ORD("X"), FALSE, TRUE)
|
||||||
|
|menuCopy: T.key(text, ORD("C"), FALSE, TRUE)
|
||||||
|
|menuPaste: T.key(text, ORD("V"), FALSE, TRUE)
|
||||||
|
|menuDelete: T.key(text, 46, FALSE, FALSE)
|
||||||
|
|menuSelectAll: T.key(text, ORD("A"), FALSE, TRUE)
|
||||||
|
|
||||||
|
|menuNew:
|
||||||
|
NewFile
|
||||||
|
|menuOpen:
|
||||||
|
open
|
||||||
|
|menuSave:
|
||||||
|
save(text);
|
||||||
|
repaint
|
||||||
|
|menuSaveAs:
|
||||||
|
saveAs(text);
|
||||||
|
repaint
|
||||||
|
|menuSaveAll:
|
||||||
|
saveAll;
|
||||||
|
repaint
|
||||||
|
|menuClose:
|
||||||
|
closeFile(TRUE, curText)
|
||||||
|
|menuFolder:
|
||||||
|
K.Run("/rd/1/File Managers/Eolite", text.fileName)
|
||||||
|
|menuExit:
|
||||||
|
Close
|
||||||
|
|menuUndo:
|
||||||
|
T.undo(text);
|
||||||
|
repaint
|
||||||
|
|menuRedo:
|
||||||
|
T.redo(text);
|
||||||
|
repaint
|
||||||
|
|menuFind:
|
||||||
|
ShowSearchPanel(FALSE)
|
||||||
|
|menuFindNext:
|
||||||
|
notFound := ~T.findNext(text, BKW.value);
|
||||||
|
menuFindClicked := TRUE
|
||||||
|
|menuFindPrev:
|
||||||
|
notFound := ~T.findNext(text, ~BKW.value);
|
||||||
|
menuFindClicked := TRUE
|
||||||
|
|menuGoto:
|
||||||
|
ShowSearchPanel(TRUE)
|
||||||
|
|menuToggleBookmark:
|
||||||
|
T.toggleLabel(text)
|
||||||
|
|menuNextBookmark:
|
||||||
|
T.gotoLabel(text, TRUE)
|
||||||
|
|menuPrevBookmark:
|
||||||
|
T.gotoLabel(text, FALSE)
|
||||||
|
|menuNumbers:
|
||||||
|
T.toggleNumbers(text)
|
||||||
|
|menuFontSize:
|
||||||
|
IF font = font1 THEN
|
||||||
|
font := font2
|
||||||
|
ELSE
|
||||||
|
font := font1
|
||||||
|
END;
|
||||||
|
resize
|
||||||
|
|menuText:
|
||||||
|
T.setLang(text, Languages.langText)
|
||||||
|
|menuC:
|
||||||
|
T.setLang(text, Languages.langC)
|
||||||
|
|menuFasm:
|
||||||
|
T.setLang(text, Languages.langFasm)
|
||||||
|
|menuIni:
|
||||||
|
T.setLang(text, Languages.langIni)
|
||||||
|
|menuJSON:
|
||||||
|
T.setLang(text, Languages.langJSON)
|
||||||
|
|menuLua:
|
||||||
|
T.setLang(text, Languages.langLua)
|
||||||
|
|menuOberon:
|
||||||
|
T.setLang(text, Languages.langOberon)
|
||||||
|
|menuPascal:
|
||||||
|
T.setLang(text, Languages.langPascal)
|
||||||
|
|menuBuild:
|
||||||
|
Script(buildScript)
|
||||||
|
|menuBuildScript:
|
||||||
|
setScript(buildScript)
|
||||||
|
|menuRun:
|
||||||
|
Script(runScript)
|
||||||
|
|menuRunScript:
|
||||||
|
setScript(runScript)
|
||||||
|
|menuDebug:
|
||||||
|
Script(debugScript)
|
||||||
|
|menuDebugScript:
|
||||||
|
setScript(debugScript)
|
||||||
|
|menuUTF8BOM:
|
||||||
|
text.enc := E.UTF8BOM
|
||||||
|
|menuUTF8:
|
||||||
|
text.enc := E.UTF8
|
||||||
|
|menuCP866:
|
||||||
|
text.enc := E.CP866
|
||||||
|
|menuWin1251:
|
||||||
|
text.enc := E.W1251
|
||||||
|
|menuLF:
|
||||||
|
text.eol := RW.EOL_LF
|
||||||
|
|menuCRLF:
|
||||||
|
text.eol := RW.EOL_CRLF
|
||||||
|
|menuCR:
|
||||||
|
text.eol := RW.EOL_CR
|
||||||
|
|menuPipet:
|
||||||
|
K.Run("/rd/1/develop/pipet", "")
|
||||||
|
|menuBoard:
|
||||||
|
K.Run("/rd/1/develop/board", "")
|
||||||
|
|menuSysFunc:
|
||||||
|
K.Run("/rd/1/docpack", "f")
|
||||||
|
|menuColors..menuMaxColors:
|
||||||
|
Ini.selectSection(IPC[2] - menuColors)
|
||||||
|
|menuMoveUp:
|
||||||
|
T.upLine(text)
|
||||||
|
|menuMoveDown:
|
||||||
|
T.downLine(text)
|
||||||
|
|menuDuplicate:
|
||||||
|
T.dupLine(text)
|
||||||
|
|menuRemove:
|
||||||
|
T.delLine(text)
|
||||||
|
|menuIncInd:
|
||||||
|
T.Indent(text, TRUE)
|
||||||
|
|menuDecInd:
|
||||||
|
T.Indent(text, FALSE)
|
||||||
|
|menuUpper:
|
||||||
|
T.chCase(text, TRUE)
|
||||||
|
|menuLower:
|
||||||
|
T.chCase(text, FALSE)
|
||||||
|
END;
|
||||||
IPC[0] := 0;
|
IPC[0] := 0;
|
||||||
IPC[1] := 0
|
IPC[1] := 0
|
||||||
END
|
END
|
||||||
@ -1820,7 +1784,7 @@ BEGIN
|
|||||||
|82, 91, 219, 92, 220: key := -1 (* insert, windows *)
|
|82, 91, 219, 92, 220: key := -1 (* insert, windows *)
|
||||||
|93: ShowMenu(context); key := -1
|
|93: ShowMenu(context); key := -1
|
||||||
|83: key := 46
|
|83: key := 46
|
||||||
|59, 62..66, 68, 87, 88: key := -1 (* F1, F4..F8, F10, F11, F12 *)
|
|59, 62..66, 87, 88: key := -1 (* F1, F4..F8, F11, F12 *)
|
||||||
ELSE
|
ELSE
|
||||||
IF ctrl THEN
|
IF ctrl THEN
|
||||||
CASE keyCode OF
|
CASE keyCode OF
|
||||||
@ -1996,7 +1960,7 @@ BEGIN
|
|||||||
IF ~resized THEN
|
IF ~resized THEN
|
||||||
msState := K.MouseState();
|
msState := K.MouseState();
|
||||||
IF ~(0 IN msState) OR (16 IN msState) THEN
|
IF ~(0 IN msState) OR (16 IN msState) THEN
|
||||||
LeftButtonUp
|
leftButton := FALSE
|
||||||
END;
|
END;
|
||||||
scroll := K.Scroll();
|
scroll := K.Scroll();
|
||||||
IF scroll # 0 THEN
|
IF scroll # 0 THEN
|
||||||
@ -2010,20 +1974,15 @@ BEGIN
|
|||||||
repaint
|
repaint
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
IF Scroll.isActive(hScroll) THEN
|
|
||||||
mouse(x, y);
|
Scroll.mouse(hScroll);
|
||||||
Scroll.MouseMove(hScroll, x + LEFT, y + TOP);
|
Scroll.mouse(vScroll);
|
||||||
T.getScroll(text, scrollX, scrollY);
|
T.getScroll(text, scrollX, scrollY);
|
||||||
T.scroll(text, hScroll.value - scrollX, 0);
|
IF (hScroll.value # scrollX) OR (vScroll.value # scrollY) THEN
|
||||||
repaint
|
T.scroll(text, hScroll.value - scrollX, vScroll.value - scrollY);
|
||||||
END;
|
repaint
|
||||||
IF Scroll.isActive(vScroll) THEN
|
END;
|
||||||
mouse(x, y);
|
|
||||||
Scroll.MouseMove(vScroll, x + LEFT, y + TOP);
|
|
||||||
T.getScroll(text, scrollX, scrollY);
|
|
||||||
T.scroll(text, 0, vScroll.value - scrollY);
|
|
||||||
repaint
|
|
||||||
END;
|
|
||||||
IF (8 IN msState) & ~(24 IN msState) THEN
|
IF (8 IN msState) & ~(24 IN msState) THEN
|
||||||
mouse(firstClickX, firstClickY);
|
mouse(firstClickX, firstClickY);
|
||||||
time := click(firstClickX, firstClickY)
|
time := click(firstClickX, firstClickY)
|
||||||
@ -2033,15 +1992,8 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
IF 24 IN msState THEN
|
IF 24 IN msState THEN
|
||||||
mouse(x, y);
|
mouse(x, y);
|
||||||
Scroll.MouseDown(hScroll, x + LEFT, y + TOP);
|
IF U.between(-4, x - firstClickX, 4) & U.between(-4, y - firstClickY, 4) THEN
|
||||||
Scroll.MouseDown(vScroll, x + LEFT, y + TOP);
|
IF U.between(0, x, canvas.width - 1) & U.between(0, y, canvas.height - 1) THEN
|
||||||
IF search & searchOpened THEN
|
|
||||||
CheckBox.MouseDown(BKW, x + LEFT, y + TOP);
|
|
||||||
CheckBox.MouseDown(CS, x + LEFT, y + TOP);
|
|
||||||
CheckBox.MouseDown(WH, x + LEFT, y + TOP);
|
|
||||||
END;
|
|
||||||
IF (ABS(x - firstClickX) < 5) & (ABS(y - firstClickY) < 5) THEN
|
|
||||||
IF (0 <= x) & (x < canvas.width) & (0 <= y) & (y < canvas.height) THEN
|
|
||||||
leftButton := FALSE;
|
leftButton := FALSE;
|
||||||
T.selectWord(text);
|
T.selectWord(text);
|
||||||
repaint
|
repaint
|
||||||
@ -2054,16 +2006,15 @@ BEGIN
|
|||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
IF search & searchOpened THEN
|
IF search & searchOpened THEN
|
||||||
|
CheckBox.mouse(BKW);
|
||||||
|
CheckBox.mouse(CS);
|
||||||
|
CheckBox.mouse(WH);
|
||||||
EditBox(FindEdit);
|
EditBox(FindEdit);
|
||||||
EditBox(ReplaceEdit);
|
EditBox(ReplaceEdit);
|
||||||
EditBox(GotoEdit);
|
EditBox(GotoEdit);
|
||||||
IF CS.value # cs THEN
|
IF (CS.value # cs) OR (WH.value # whole) THEN
|
||||||
cs := ~cs;
|
cs := CS.value;
|
||||||
notFound := ~T.search(text, searchText, cs, whole);
|
whole := WH.value;
|
||||||
repaint
|
|
||||||
END;
|
|
||||||
IF WH.value # whole THEN
|
|
||||||
whole := ~whole;
|
|
||||||
notFound := ~T.search(text, searchText, cs, whole);
|
notFound := ~T.search(text, searchText, cs, whole);
|
||||||
repaint
|
repaint
|
||||||
END
|
END
|
||||||
@ -2095,6 +2046,20 @@ BEGIN
|
|||||||
END Redraw;
|
END Redraw;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE ScrollChange;
|
||||||
|
BEGIN
|
||||||
|
Scroll.change(hScroll);
|
||||||
|
Scroll.change(vScroll);
|
||||||
|
T.scroll(text, ORD(hScroll.Inc) - ORD(hScroll.Dec), ORD(vScroll.Inc) - ORD(vScroll.Dec));
|
||||||
|
IF menuActive THEN
|
||||||
|
draw_window;
|
||||||
|
menuActive := FALSE
|
||||||
|
ELSE
|
||||||
|
repaint
|
||||||
|
END
|
||||||
|
END ScrollChange;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE main;
|
PROCEDURE main;
|
||||||
VAR
|
VAR
|
||||||
err: INTEGER;
|
err: INTEGER;
|
||||||
@ -2103,7 +2068,6 @@ VAR
|
|||||||
resized: BOOLEAN;
|
resized: BOOLEAN;
|
||||||
firstClickX, firstClickY, time: INTEGER;
|
firstClickX, firstClickY, time: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
delay := Scroll.Delay;
|
|
||||||
K.GetSystemColors;
|
K.GetSystemColors;
|
||||||
Icons.get(icons, grayIcons);
|
Icons.get(icons, grayIcons);
|
||||||
modified := FALSE;
|
modified := FALSE;
|
||||||
@ -2115,7 +2079,7 @@ BEGIN
|
|||||||
K.SetIPC(IPC);
|
K.SetIPC(IPC);
|
||||||
U.ptr2str(K.GetName(), AppPath);
|
U.ptr2str(K.GetName(), AppPath);
|
||||||
Ini.load(AppPath);
|
Ini.load(AppPath);
|
||||||
LeftButtonUp;
|
leftButton := FALSE;
|
||||||
resized := FALSE;
|
resized := FALSE;
|
||||||
K.ScreenSize(winWidth, winHeight);
|
K.ScreenSize(winWidth, winHeight);
|
||||||
winWidth := (winWidth*80) DIV 100 - (128 + 30);
|
winWidth := (winWidth*80) DIV 100 - (128 + 30);
|
||||||
@ -2181,6 +2145,7 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
|
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
|
||||||
insert(0, text);
|
insert(0, text);
|
||||||
|
Scroll.init(ScrollChange);
|
||||||
Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth, hScroll);
|
Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth, hScroll);
|
||||||
Scroll.create(TRUE, scrollWidth, canvas.height + 1, scrollWidth, scrollWidth, vScroll);
|
Scroll.create(TRUE, scrollWidth, canvas.height + 1, scrollWidth, scrollWidth, vScroll);
|
||||||
T.resize(canvas.width, canvas.height);
|
T.resize(canvas.width, canvas.height);
|
||||||
|
@ -84,26 +84,26 @@ BEGIN
|
|||||||
END create;
|
END create;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE MouseDown* (VAR chkbox: tCheckBox; x, y: INTEGER);
|
PROCEDURE mouse* (VAR chkbox: tCheckBox);
|
||||||
|
VAR
|
||||||
|
msState: SET;
|
||||||
|
x, y: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF (chkbox.canvas # NIL) & ~chkbox.mouse THEN
|
K.mouse(msState, x, y);
|
||||||
DEC(x, chkbox.left);
|
IF 0 IN msState THEN
|
||||||
DEC(y, chkbox.top);
|
IF (chkbox.canvas # NIL) & ~chkbox.mouse THEN
|
||||||
chkbox.mouse := TRUE;
|
DEC(x, chkbox.left);
|
||||||
IF U.between(0, x, chkbox.width) & U.between(0, y, chkbox.height) THEN
|
DEC(y, chkbox.top);
|
||||||
chkbox.value := ~chkbox.value;
|
chkbox.mouse := TRUE;
|
||||||
END;
|
IF U.between(0, x, chkbox.width - 1) & U.between(0, y, chkbox.height - 1) THEN
|
||||||
paint(chkbox)
|
chkbox.value := ~chkbox.value;
|
||||||
END
|
END;
|
||||||
END MouseDown;
|
paint(chkbox)
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
PROCEDURE MouseUp* (VAR chkbox: tCheckBox);
|
|
||||||
BEGIN
|
|
||||||
IF chkbox.canvas # NIL THEN
|
|
||||||
chkbox.mouse := FALSE
|
chkbox.mouse := FALSE
|
||||||
END
|
END
|
||||||
END MouseUp;
|
END mouse;
|
||||||
|
|
||||||
|
|
||||||
END CheckBox.
|
END CheckBox.
|
@ -40,7 +40,7 @@ TYPE
|
|||||||
max: INTEGER;
|
max: INTEGER;
|
||||||
text*: INTEGER;
|
text*: INTEGER;
|
||||||
mouse_variable: tEditBox;
|
mouse_variable: tEditBox;
|
||||||
flags*,
|
flags*: SET;
|
||||||
|
|
||||||
size,
|
size,
|
||||||
pos: INTEGER;
|
pos: INTEGER;
|
||||||
@ -129,7 +129,7 @@ BEGIN
|
|||||||
new_textbox.text := KOSAPI.malloc(max_chars + 2);
|
new_textbox.text := KOSAPI.malloc(max_chars + 2);
|
||||||
ASSERT(new_textbox.text # 0);
|
ASSERT(new_textbox.text # 0);
|
||||||
new_textbox.mouse_variable := editbox_interlock;
|
new_textbox.mouse_variable := editbox_interlock;
|
||||||
new_textbox.flags := 0
|
new_textbox.flags := {}
|
||||||
|
|
||||||
RETURN new_textbox
|
RETURN new_textbox
|
||||||
END create;
|
END create;
|
||||||
@ -159,5 +159,5 @@ END main;
|
|||||||
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
main
|
main
|
||||||
END EditBox.
|
END EditBox.
|
@ -185,24 +185,24 @@ END DLine;
|
|||||||
PROCEDURE Triangle* (canvas: tCanvas; x1, y1, x2, y2: INTEGER; orientation: BOOLEAN);
|
PROCEDURE Triangle* (canvas: tCanvas; x1, y1, x2, y2: INTEGER; orientation: BOOLEAN);
|
||||||
VAR
|
VAR
|
||||||
i, a, b, d: INTEGER;
|
i, a, b, d: INTEGER;
|
||||||
|
line: PROCEDURE (canvas: tCanvas; c, c1, c2: INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
|
line := NIL;
|
||||||
d := ORD(orientation)*2 - 1;
|
d := ORD(orientation)*2 - 1;
|
||||||
IF y1 = y2 THEN
|
IF y1 = y2 THEN
|
||||||
i := y1;
|
i := y1;
|
||||||
a := MIN(x1, x2);
|
a := MIN(x1, x2);
|
||||||
b := MAX(x1, x2);
|
b := MAX(x1, x2);
|
||||||
WHILE a <= b DO
|
line := HLine
|
||||||
HLine(canvas, i, a, b);
|
|
||||||
INC(i, d);
|
|
||||||
INC(a);
|
|
||||||
DEC(b)
|
|
||||||
END
|
|
||||||
ELSIF x1 = x2 THEN
|
ELSIF x1 = x2 THEN
|
||||||
i := x1;
|
i := x1;
|
||||||
a := MIN(y1, y2);
|
a := MIN(y1, y2);
|
||||||
b := MAX(y1, y2);
|
b := MAX(y1, y2);
|
||||||
|
line := VLine
|
||||||
|
END;
|
||||||
|
IF line # NIL THEN
|
||||||
WHILE a <= b DO
|
WHILE a <= b DO
|
||||||
VLine(canvas, i, a, b);
|
line(canvas, i, a, b);
|
||||||
INC(i, d);
|
INC(i, d);
|
||||||
INC(a);
|
INC(a);
|
||||||
DEC(b)
|
DEC(b)
|
||||||
@ -251,7 +251,7 @@ PROCEDURE TextOut* (canvas: tCanvas; x, y: INTEGER; text: INTEGER; n: INTEGER; d
|
|||||||
CONST
|
CONST
|
||||||
WCHAR_SIZE = 2;
|
WCHAR_SIZE = 2;
|
||||||
VAR
|
VAR
|
||||||
color, i, ecx: INTEGER;
|
color, i, font: INTEGER;
|
||||||
c: WCHAR;
|
c: WCHAR;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF (0 <= y) & (y <= canvas.height - canvas.font.height - 1) THEN
|
IF (0 <= y) & (y <= canvas.height - canvas.font.height - 1) THEN
|
||||||
@ -268,15 +268,16 @@ BEGIN
|
|||||||
canvas.color := canvas.backColor;
|
canvas.color := canvas.backColor;
|
||||||
FillRect(canvas, x, y, x + n*canvas.font.width, y + canvas.font.height);
|
FillRect(canvas, x, y, x + n*canvas.font.width, y + canvas.font.height);
|
||||||
canvas.color := color;
|
canvas.color := color;
|
||||||
|
font := LSL(28H + canvas.font.size, 24);
|
||||||
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
|
||||||
ecx := LSL(28H + canvas.font.size, 24) + delimColor
|
color := delimColor
|
||||||
ELSE
|
ELSE
|
||||||
ecx := LSL(28H + canvas.font.size, 24) + canvas.textColor
|
color := canvas.textColor
|
||||||
END;
|
END;
|
||||||
K.sysfunc6(4, x*65536 + y, ecx, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
|
K.sysfunc6(4, x*65536 + y, font + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8)
|
||||||
END;
|
END;
|
||||||
INC(x, canvas.font.width);
|
INC(x, canvas.font.width);
|
||||||
INC(i);
|
INC(i);
|
||||||
|
@ -369,4 +369,19 @@ BEGIN
|
|||||||
END getKBState;
|
END getKBState;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE mouse* (VAR msState: SET; VAR x, y: INTEGER);
|
||||||
|
VAR
|
||||||
|
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
|
||||||
|
END mouse;
|
||||||
|
|
||||||
|
|
||||||
END KolibriOS.
|
END KolibriOS.
|
@ -216,7 +216,7 @@ END escape;
|
|||||||
|
|
||||||
PROCEDURE repaint (m: tMenu);
|
PROCEDURE repaint (m: tMenu);
|
||||||
VAR
|
VAR
|
||||||
y, i, X, Y1, Y2: INTEGER;
|
y, i, X, Y: INTEGER;
|
||||||
item: tItem;
|
item: tItem;
|
||||||
BkColor, TextColor: INTEGER;
|
BkColor, TextColor: INTEGER;
|
||||||
canvas: G.tCanvas;
|
canvas: G.tCanvas;
|
||||||
@ -277,9 +277,8 @@ BEGIN
|
|||||||
|
|
||||||
IF item.child # NIL THEN
|
IF item.child # NIL THEN
|
||||||
X := m.width - 9;
|
X := m.width - 9;
|
||||||
Y1 := y + (fontHeight - 16) DIV 2 + 2;
|
Y := y + (fontHeight - 16) DIV 2 + 2;
|
||||||
Y2 := Y1 + 8;
|
G.Triangle(canvas, X, Y, X, Y + 8, G.triRight)
|
||||||
G.Triangle(canvas, X, Y1, X, Y2, G.triRight)
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
INC(y, fontHeight);
|
INC(y, fontHeight);
|
||||||
@ -303,16 +302,6 @@ BEGIN
|
|||||||
END draw_window;
|
END draw_window;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE mouse (m: tMenu; VAR x, y: INTEGER);
|
|
||||||
VAR
|
|
||||||
mouseX, mouseY: INTEGER;
|
|
||||||
BEGIN
|
|
||||||
K.MousePos(mouseX, mouseY);
|
|
||||||
x := mouseX - m.winX;
|
|
||||||
y := mouseY - m.winY;
|
|
||||||
END mouse;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE close* (m: tMenu);
|
PROCEDURE close* (m: tMenu);
|
||||||
VAR
|
VAR
|
||||||
temp: INTEGER;
|
temp: INTEGER;
|
||||||
@ -469,8 +458,7 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
repaint(m)
|
repaint(m)
|
||||||
|6:
|
|6:
|
||||||
msState := K.MouseState();
|
K.mouse(msState, x, y);
|
||||||
mouse(m, x, y);
|
|
||||||
IF (0 <= x) & (x < m.width) & (0 <= y) & (y < m.height) THEN
|
IF (0 <= x) & (x < m.width) & (0 <= y) & (y < m.height) THEN
|
||||||
m.active := TRUE;
|
m.active := TRUE;
|
||||||
m.selItem := (y - TOP) DIV fontHeight;
|
m.selItem := (y - TOP) DIV fontHeight;
|
||||||
|
@ -2128,12 +2128,9 @@ BEGIN
|
|||||||
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN
|
||||||
U.int2str(i, s);
|
U.int2str(i, s);
|
||||||
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
|
G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s))
|
||||||
ELSIF i MOD 5 = 0 THEN
|
|
||||||
G.SetColor(canvas, colors.numtext);
|
|
||||||
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum, xNum)
|
|
||||||
ELSE
|
ELSE
|
||||||
G.SetColor(canvas, colors.numtext);
|
G.SetColor(canvas, colors.numtext);
|
||||||
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum DIV 2, xNum)
|
G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum DIV (1 + ORD(i MOD 5 # 0)), xNum)
|
||||||
END
|
END
|
||||||
END;
|
END;
|
||||||
IF line.label THEN
|
IF line.label THEN
|
||||||
|
@ -24,7 +24,7 @@ IMPORT G := Graph, K := KolibriOS, U := Utils;
|
|||||||
CONST
|
CONST
|
||||||
|
|
||||||
ScrollIPC* = 0;
|
ScrollIPC* = 0;
|
||||||
Delay* = 40;
|
DELAY = 40;
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
|
|
||||||
@ -37,16 +37,29 @@ TYPE
|
|||||||
canvas*: G.tCanvas
|
canvas*: G.tCanvas
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
tProcedure* = PROCEDURE;
|
||||||
|
|
||||||
|
VAR
|
||||||
|
|
||||||
|
ScrollChange: tProcedure;
|
||||||
|
delay: INTEGER;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE MouseUp (VAR scroll: tScroll);
|
||||||
|
BEGIN
|
||||||
|
scroll.Slider := -1;
|
||||||
|
scroll.Inc := FALSE;
|
||||||
|
scroll.Dec := FALSE;
|
||||||
|
scroll.mouse := FALSE;
|
||||||
|
END MouseUp;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE create* (vertical: BOOLEAN; width, height: INTEGER; btnSize, sliderSize: INTEGER; VAR scroll: tScroll);
|
PROCEDURE create* (vertical: BOOLEAN; width, height: INTEGER; btnSize, sliderSize: INTEGER; VAR scroll: tScroll);
|
||||||
VAR
|
VAR
|
||||||
res: tScroll;
|
res: tScroll;
|
||||||
BEGIN
|
BEGIN
|
||||||
|
MouseUp(res);
|
||||||
res.vertical := vertical;
|
res.vertical := vertical;
|
||||||
res.Inc := FALSE;
|
|
||||||
res.Dec := FALSE;
|
|
||||||
res.Slider := -1;
|
|
||||||
res.mouse := FALSE;
|
|
||||||
res.left := 0;
|
res.left := 0;
|
||||||
res.top := 0;
|
res.top := 0;
|
||||||
res.width := width;
|
res.width := width;
|
||||||
@ -279,12 +292,7 @@ BEGIN
|
|||||||
END setPos;
|
END setPos;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE isActive* (scroll: tScroll): BOOLEAN;
|
PROCEDURE MouseMove (VAR scroll: tScroll; x, y: INTEGER);
|
||||||
RETURN scroll.Inc OR scroll.Dec OR (scroll.Slider # -1)
|
|
||||||
END isActive;
|
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE MouseMove* (VAR scroll: tScroll; x, y: INTEGER);
|
|
||||||
VAR
|
VAR
|
||||||
c: INTEGER;
|
c: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -300,13 +308,37 @@ BEGIN
|
|||||||
END MouseMove;
|
END MouseMove;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE SendIPC*;
|
PROCEDURE SendIPC;
|
||||||
BEGIN
|
BEGIN
|
||||||
K.SendIPC(K.ThreadID(), ScrollIPC)
|
K.SendIPC(K.ThreadID(), ScrollIPC)
|
||||||
END SendIPC;
|
END SendIPC;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE MouseDown* (VAR scroll: tScroll; x, y: INTEGER);
|
PROCEDURE receiveIPC* (VAR IPC: ARRAY OF INTEGER; VAR scrollIPC: BOOLEAN);
|
||||||
|
BEGIN
|
||||||
|
scrollIPC := FALSE;
|
||||||
|
ScrollChange;
|
||||||
|
IF 0 IN K.MouseState() THEN
|
||||||
|
WHILE (0 IN K.MouseState()) & (delay > 0) DO
|
||||||
|
K.Pause(1);
|
||||||
|
DEC(delay)
|
||||||
|
END;
|
||||||
|
IF delay = 0 THEN
|
||||||
|
IPC[0] := 0;
|
||||||
|
IPC[1] := 0;
|
||||||
|
scrollIPC := TRUE;
|
||||||
|
SendIPC;
|
||||||
|
delay := 4
|
||||||
|
ELSE
|
||||||
|
delay := DELAY
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
|
delay := DELAY
|
||||||
|
END
|
||||||
|
END receiveIPC;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE MouseDown (VAR scroll: tScroll; x, y: INTEGER);
|
||||||
VAR
|
VAR
|
||||||
c, size: INTEGER;
|
c, size: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -342,16 +374,27 @@ BEGIN
|
|||||||
END MouseDown;
|
END MouseDown;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE MouseUp* (VAR scroll: tScroll);
|
PROCEDURE mouse* (VAR scroll: tScroll);
|
||||||
|
VAR
|
||||||
|
msState: SET;
|
||||||
|
x, y: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF scroll.mouse THEN
|
K.mouse(msState, x, y);
|
||||||
scroll.Slider := -1;
|
IF 0 IN msState THEN
|
||||||
scroll.Inc := FALSE;
|
MouseDown(scroll, x, y);
|
||||||
scroll.Dec := FALSE;
|
MouseMove(scroll, x, y)
|
||||||
scroll.mouse := FALSE;
|
ELSIF scroll.mouse THEN
|
||||||
|
MouseUp(scroll);
|
||||||
paint(scroll)
|
paint(scroll)
|
||||||
END
|
END
|
||||||
END MouseUp;
|
END mouse;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE init* (_ScrollChange: tProcedure);
|
||||||
|
BEGIN
|
||||||
|
delay := DELAY;
|
||||||
|
ScrollChange := _ScrollChange
|
||||||
|
END init;
|
||||||
|
|
||||||
|
|
||||||
END Scroll.
|
END Scroll.
|
Loading…
Reference in New Issue
Block a user