forked from KolibriOS/kolibrios
CEdit: refactoring
oberon07: update examples git-svn-id: svn://kolibrios.org@9648 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3cace9dd7a
commit
0eb1f22eab
Binary file not shown.
@ -28,7 +28,7 @@ IMPORT
|
||||
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
||||
|
||||
CONST
|
||||
HEADER = "CEdit (16-jan-2022)";
|
||||
HEADER = "CEdit (18-jan-2022)";
|
||||
|
||||
ShellFilter = "";
|
||||
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||
@ -169,6 +169,9 @@ CONST
|
||||
|
||||
maxTexts = 32;
|
||||
|
||||
SHIFT = Menu.SHIFT;
|
||||
CTRL = Menu.CTRL;
|
||||
|
||||
|
||||
VAR
|
||||
header: RW.tFileName;
|
||||
@ -199,8 +202,6 @@ VAR
|
||||
|
||||
replaced: INTEGER;
|
||||
|
||||
mainTID: INTEGER;
|
||||
|
||||
context, menuFile, menuEdit, menuSearch, menuEncoding,
|
||||
menuView, menuLanguage, menuProgram, menuTools,
|
||||
subCurLine, subIndent, subCase, subBookmark, subEOL: Menu.tMenu;
|
||||
@ -211,8 +212,6 @@ VAR
|
||||
|
||||
toolbar: Toolbar.tToolbar;
|
||||
|
||||
IPC: ARRAY 64 OF INTEGER;
|
||||
|
||||
CursorTime, CurrentTime: INTEGER;
|
||||
timerEnabled: BOOLEAN;
|
||||
|
||||
@ -924,16 +923,6 @@ BEGIN
|
||||
END CloseMenu;
|
||||
|
||||
|
||||
PROCEDURE MenuItemClick (menu: Menu.tMenu; id: INTEGER);
|
||||
VAR
|
||||
msg: ARRAY 2 OF INTEGER;
|
||||
BEGIN
|
||||
msg[0] := id;
|
||||
msg[1] := 8;
|
||||
K.SendIPC(mainTID, msg)
|
||||
END MenuItemClick;
|
||||
|
||||
|
||||
PROCEDURE goto;
|
||||
VAR
|
||||
gotoVal: INTEGER;
|
||||
@ -1114,224 +1103,146 @@ BEGIN
|
||||
END setScript;
|
||||
|
||||
|
||||
PROCEDURE receiveIPC;
|
||||
PROCEDURE ClickMenu;
|
||||
VAR
|
||||
scrollIPC: BOOLEAN;
|
||||
item: List.tItem;
|
||||
BEGIN
|
||||
scrollIPC := FALSE;
|
||||
IF IPC[0] = mainTID THEN
|
||||
IF IPC[2] = Scroll.ScrollIPC THEN
|
||||
Scroll.receiveIPC(IPC, scrollIPC)
|
||||
END;
|
||||
IF ~scrollIPC THEN
|
||||
IPC[2] := 0
|
||||
END
|
||||
ELSE
|
||||
IF ~Menu.isSender(IPC[0]) THEN
|
||||
IPC[2] := 0
|
||||
ELSE
|
||||
IF IPC[2] < 0 THEN
|
||||
item := List.getItem(mainMenu, (-IPC[2] - mainMenuBtn) MOD mainMenu.count);
|
||||
IF item # NIL THEN
|
||||
ShowMenu(item(Menu.tMainItem).menu)
|
||||
END;
|
||||
IPC[2] := 0
|
||||
END
|
||||
END
|
||||
END;
|
||||
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)
|
||||
IF Menu.MenuItem < 0 THEN
|
||||
item := List.getItem(mainMenu, (-Menu.MenuItem - mainMenuBtn) MOD mainMenu.count);
|
||||
IF item # NIL THEN
|
||||
ShowMenu(item(Menu.tMainItem).menu)
|
||||
END;
|
||||
Menu.SetItem(0)
|
||||
END;
|
||||
CASE Menu.MenuItem 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:
|
||||
OpenDial
|
||||
|menuSave:
|
||||
save(text);
|
||||
repaint
|
||||
|menuSaveAs:
|
||||
saveAs(text);
|
||||
repaint
|
||||
|menuSaveAll:
|
||||
saveAll;
|
||||
repaint
|
||||
|menuClose:
|
||||
closeFile(TRUE, curText)
|
||||
|menuFolder:
|
||||
K.Run("/sys/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:
|
||||
T.setEnc(text, E.UTF8BOM)
|
||||
|menuUTF8:
|
||||
T.setEnc(text, E.UTF8)
|
||||
|menuCP866:
|
||||
T.setEnc(text, E.CP866)
|
||||
|menuWin1251:
|
||||
T.setEnc(text, E.W1251)
|
||||
|menuLF:
|
||||
T.setEol(text, RW.EOL_LF)
|
||||
|menuCRLF:
|
||||
T.setEol(text, RW.EOL_CRLF)
|
||||
|menuCR:
|
||||
T.setEol(text, RW.EOL_CR)
|
||||
|menuPipet:
|
||||
K.Run("/sys/develop/pipet", "")
|
||||
|menuMagnify:
|
||||
K.Run("/sys/magnify", "")
|
||||
|menuBoard:
|
||||
K.Run("/sys/develop/board", "")
|
||||
|menuSysFunc:
|
||||
K.Run("/sys/docpack", "f")
|
||||
|menuColors..menuMaxColors:
|
||||
Ini.selectSection(IPC[2] - menuColors)
|
||||
|menuMoveUp:
|
||||
T.MoveLines(text, FALSE)
|
||||
|menuMoveDown:
|
||||
T.MoveLines(text, TRUE)
|
||||
|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[1] := 0
|
||||
END
|
||||
END receiveIPC;
|
||||
|
||||
|
||||
PROCEDURE MenuKeyDown (menu: Menu.tMenu; key: INTEGER): BOOLEAN;
|
||||
VAR
|
||||
menuItem: INTEGER;
|
||||
shift, ctrl: BOOLEAN;
|
||||
BEGIN
|
||||
menuItem := -1;
|
||||
K.getKBState(shift, ctrl);
|
||||
IF ctrl THEN
|
||||
CASE key DIV 65536 OF
|
||||
|17: menuItem := menuClose
|
||||
|21: menuItem := menuRedo
|
||||
|30: menuItem := menuSelectAll
|
||||
|32: menuItem := menuDuplicate
|
||||
|33,
|
||||
35: menuItem := menuFind
|
||||
|34: menuItem := menuGoto
|
||||
|44: menuItem := menuUndo
|
||||
|45: menuItem := menuCut
|
||||
|46: menuItem := menuCopy
|
||||
|47: menuItem := menuPaste
|
||||
|24: menuItem := menuOpen
|
||||
|31: menuItem := menuSave
|
||||
|49: menuItem := menuNew
|
||||
|67: menuItem := menuBuild
|
||||
|83: menuItem := menuRemove
|
||||
|22: menuItem := menuUpper
|
||||
|38: menuItem := menuLower
|
||||
|60: menuItem := menuToggleBookmark
|
||||
|72: menuItem := menuMoveUp
|
||||
|80: menuItem := menuMoveDown
|
||||
|menuNew:
|
||||
NewFile
|
||||
|menuOpen:
|
||||
OpenDial
|
||||
|menuSave:
|
||||
save(text);
|
||||
repaint
|
||||
|menuSaveAs:
|
||||
saveAs(text);
|
||||
repaint
|
||||
|menuSaveAll:
|
||||
saveAll;
|
||||
repaint
|
||||
|menuClose:
|
||||
closeFile(TRUE, curText)
|
||||
|menuFolder:
|
||||
K.Run("/sys/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
|
||||
END
|
||||
ELSE
|
||||
IF key DIV 65536 = 83 THEN
|
||||
menuItem := menuDelete
|
||||
ELSIF key DIV 65536 = 67 THEN
|
||||
menuItem := menuRun
|
||||
ELSIF key DIV 65536 = 15 THEN
|
||||
menuItem := menuIncInd
|
||||
ELSIF (key DIV 65536 = 14) & shift THEN
|
||||
menuItem := menuDecInd
|
||||
ELSIF key DIV 65536 = 60 THEN
|
||||
IF shift THEN
|
||||
menuItem := menuPrevBookmark
|
||||
ELSE
|
||||
menuItem := menuNextBookmark
|
||||
END
|
||||
END
|
||||
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:
|
||||
T.setEnc(text, E.UTF8BOM)
|
||||
|menuUTF8:
|
||||
T.setEnc(text, E.UTF8)
|
||||
|menuCP866:
|
||||
T.setEnc(text, E.CP866)
|
||||
|menuWin1251:
|
||||
T.setEnc(text, E.W1251)
|
||||
|menuLF:
|
||||
T.setEol(text, RW.EOL_LF)
|
||||
|menuCRLF:
|
||||
T.setEol(text, RW.EOL_CRLF)
|
||||
|menuCR:
|
||||
T.setEol(text, RW.EOL_CR)
|
||||
|menuPipet:
|
||||
K.Run("/sys/develop/pipet", "")
|
||||
|menuMagnify:
|
||||
K.Run("/sys/magnify", "")
|
||||
|menuBoard:
|
||||
K.Run("/sys/develop/board", "")
|
||||
|menuSysFunc:
|
||||
K.Run("/sys/docpack", "f")
|
||||
|menuColors..menuMaxColors:
|
||||
Ini.selectSection(Menu.MenuItem - menuColors)
|
||||
|menuMoveUp:
|
||||
T.MoveLines(text, FALSE)
|
||||
|menuMoveDown:
|
||||
T.MoveLines(text, TRUE)
|
||||
|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 menuItem # -1 THEN
|
||||
IF Menu.isEnabled(menu, menuItem) THEN
|
||||
MenuItemClick(menu, menuItem)
|
||||
ELSE
|
||||
menuItem := -1
|
||||
END
|
||||
END
|
||||
RETURN menuItem # -1
|
||||
END MenuKeyDown;
|
||||
Menu.SetItem(0)
|
||||
END ClickMenu;
|
||||
|
||||
|
||||
PROCEDURE CreateContextMenu (): Menu.tMenu;
|
||||
@ -1348,7 +1259,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuDelete, "delete");
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuSelectAll, "select all ctrl-A");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateContextMenu;
|
||||
|
||||
|
||||
@ -1367,7 +1278,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuClose, "close ctrl-W");
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuExit, "exit");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuFile;
|
||||
|
||||
|
||||
@ -1392,7 +1303,7 @@ BEGIN
|
||||
Menu.child(menu, subIndent);
|
||||
Menu.AddMenuItem(menu, menuCase, "case");
|
||||
Menu.child(menu, subCase);
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuEdit;
|
||||
|
||||
|
||||
@ -1408,7 +1319,7 @@ BEGIN
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuBookmark, "bookmark");
|
||||
Menu.child(menu, subBookmark);
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuSearch;
|
||||
|
||||
|
||||
@ -1424,7 +1335,7 @@ BEGIN
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuEOL, "EOL");
|
||||
Menu.child(menu, subEOL);
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuEncoding;
|
||||
|
||||
|
||||
@ -1436,7 +1347,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuCRLF, RW.eolNames[RW.EOL_CRLF]);
|
||||
Menu.AddMenuItem(menu, menuLF, RW.eolNames[RW.EOL_LF]);
|
||||
Menu.AddMenuItem(menu, menuCR, RW.eolNames[RW.EOL_CR]);
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuEOL;
|
||||
|
||||
|
||||
@ -1459,7 +1370,7 @@ BEGIN
|
||||
colors := colors.next(Ini.tSection)
|
||||
END;
|
||||
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuView;
|
||||
|
||||
|
||||
@ -1477,7 +1388,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuPascal, "Pascal");
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuText, "Text");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuLanguage;
|
||||
|
||||
|
||||
@ -1494,7 +1405,7 @@ BEGIN
|
||||
Menu.delimiter(menu);
|
||||
Menu.AddMenuItem(menu, menuDebug, "debug");
|
||||
Menu.AddMenuItem(menu, menuDebugScript, "script");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuProgram;
|
||||
|
||||
|
||||
@ -1507,7 +1418,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuMagnify, "magnify");
|
||||
Menu.AddMenuItem(menu, menuBoard, "board");
|
||||
Menu.AddMenuItem(menu, menuSysFunc, "system functions");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuTools;
|
||||
|
||||
|
||||
@ -1520,7 +1431,7 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuMoveDown, "move down ctrl-Down");
|
||||
Menu.AddMenuItem(menu, menuDuplicate, "duplicate ctrl-D");
|
||||
Menu.AddMenuItem(menu, menuRemove, "remove ctrl-Del");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuCurLine;
|
||||
|
||||
|
||||
@ -1531,7 +1442,7 @@ BEGIN
|
||||
menu := List.create(NIL);
|
||||
Menu.AddMenuItem(menu, menuIncInd, "increase Tab");
|
||||
Menu.AddMenuItem(menu, menuDecInd, "decrease shift-Bksp");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuIndent;
|
||||
|
||||
|
||||
@ -1542,7 +1453,7 @@ BEGIN
|
||||
menu := List.create(NIL);
|
||||
Menu.AddMenuItem(menu, menuUpper, "UPPER ctrl-U");
|
||||
Menu.AddMenuItem(menu, menuLower, "lower ctrl-L");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuCase;
|
||||
|
||||
|
||||
@ -1554,10 +1465,44 @@ BEGIN
|
||||
Menu.AddMenuItem(menu, menuToggleBookmark, "toggle ctrl-F2");
|
||||
Menu.AddMenuItem(menu, menuNextBookmark, "next F2");
|
||||
Menu.AddMenuItem(menu, menuPrevBookmark, "previous shift-F2");
|
||||
RETURN Menu.create(menu, MenuItemClick, MenuKeyDown)
|
||||
RETURN Menu.create(menu)
|
||||
END CreateMenuBookmark;
|
||||
|
||||
|
||||
PROCEDURE Shortcuts;
|
||||
BEGIN
|
||||
Menu.AddShortcut(17 + CTRL, menuClose);
|
||||
Menu.AddShortcut(21 + CTRL, menuRedo);
|
||||
Menu.AddShortcut(30 + CTRL, menuSelectAll);
|
||||
Menu.AddShortcut(32 + CTRL, menuDuplicate);
|
||||
Menu.AddShortcut(33 + CTRL, menuFind);
|
||||
Menu.AddShortcut(35 + CTRL, menuFind);
|
||||
Menu.AddShortcut(34 + CTRL, menuGoto);
|
||||
Menu.AddShortcut(44 + CTRL, menuUndo);
|
||||
Menu.AddShortcut(45 + CTRL, menuCut);
|
||||
Menu.AddShortcut(46 + CTRL, menuCopy);
|
||||
Menu.AddShortcut(47 + CTRL, menuPaste);
|
||||
Menu.AddShortcut(24 + CTRL, menuOpen);
|
||||
Menu.AddShortcut(31 + CTRL, menuSave);
|
||||
Menu.AddShortcut(49 + CTRL, menuNew);
|
||||
Menu.AddShortcut(67 + CTRL, menuBuild);
|
||||
Menu.AddShortcut(83 + CTRL, menuRemove);
|
||||
Menu.AddShortcut(22 + CTRL, menuUpper);
|
||||
Menu.AddShortcut(38 + CTRL, menuLower);
|
||||
Menu.AddShortcut(60 + CTRL, menuToggleBookmark);
|
||||
Menu.AddShortcut(72 + CTRL, menuMoveUp);
|
||||
Menu.AddShortcut(80 + CTRL, menuMoveDown);
|
||||
Menu.AddShortcut(83, menuDelete);
|
||||
Menu.AddShortcut(67, menuRun);
|
||||
Menu.AddShortcut(15, menuIncInd);
|
||||
Menu.AddShortcut(14 + SHIFT, menuDecInd);
|
||||
Menu.AddShortcut(60 + SHIFT, menuPrevBookmark);
|
||||
Menu.AddShortcut(60, menuNextBookmark);
|
||||
Menu.AddShortcut(61 + SHIFT, menuFindPrev);
|
||||
Menu.AddShortcut(61, menuFindNext);
|
||||
END Shortcuts;
|
||||
|
||||
|
||||
PROCEDURE HideSearch;
|
||||
BEGIN
|
||||
SetFocus(FindEdit, FALSE);
|
||||
@ -1732,6 +1677,7 @@ VAR
|
||||
middle, exit: BOOLEAN;
|
||||
menu: Menu.tMenu;
|
||||
BEGIN
|
||||
exit := FALSE;
|
||||
btn := K.ButtonCode(middle);
|
||||
IF U.between(Tabs.btnID, btn, Tabs.btnID + maxTexts - 1) THEN
|
||||
DEC(btn, Tabs.btnID);
|
||||
@ -1756,58 +1702,45 @@ BEGIN
|
||||
btn := 0
|
||||
END
|
||||
END;
|
||||
|
||||
CASE btn OF
|
||||
|Tabs.btnLeft: Tabs.scroll(tabs, -1); switch := TRUE; repaint
|
||||
|Tabs.btnRight: Tabs.scroll(tabs, +1); switch := TRUE; repaint
|
||||
|
||||
|0:
|
||||
|
||||
|Tabs.btnLeft, Tabs.btnRight:
|
||||
Tabs.scroll(tabs, btn);
|
||||
switch := TRUE
|
||||
|btnNo:
|
||||
exit := closing;
|
||||
closeFile(FALSE, curText);
|
||||
repaint;
|
||||
IF exit THEN
|
||||
Close
|
||||
END
|
||||
repaint
|
||||
|btnYes:
|
||||
exit := closing;
|
||||
save(text);
|
||||
IF ~text.modified THEN
|
||||
closeFile(FALSE, curText)
|
||||
END;
|
||||
repaint;
|
||||
IF exit THEN
|
||||
Close
|
||||
END
|
||||
|btnClose:
|
||||
Close
|
||||
|btnNew:
|
||||
NewFile;
|
||||
repaint
|
||||
|btnClose:
|
||||
exit := TRUE
|
||||
|btnNew:
|
||||
NewFile
|
||||
|btnOpen:
|
||||
OpenDial
|
||||
|btnSave:
|
||||
save(text);
|
||||
repaint
|
||||
save(text)
|
||||
|btnSearch:
|
||||
ShowSearchPanel(FALSE);
|
||||
repaint
|
||||
ShowSearchPanel(FALSE)
|
||||
|btnCloseSearch:
|
||||
Search
|
||||
|btnHideSearch:
|
||||
HideSearch
|
||||
|btnUndo:
|
||||
T.undo(text);
|
||||
repaint
|
||||
T.undo(text)
|
||||
|btnRedo:
|
||||
T.redo(text);
|
||||
repaint
|
||||
T.redo(text)
|
||||
|btnUpper:
|
||||
T.chCase(text, TRUE);
|
||||
repaint
|
||||
T.chCase(text, TRUE)
|
||||
|btnLower:
|
||||
T.chCase(text, FALSE);
|
||||
repaint
|
||||
T.chCase(text, FALSE)
|
||||
|btnBuild:
|
||||
Script(buildScript)
|
||||
|btnRun:
|
||||
@ -1815,24 +1748,26 @@ BEGIN
|
||||
|btnFindNext:
|
||||
IF searchText # "" THEN
|
||||
notFound := ~T.findNext(text, BKW.value);
|
||||
SetFocus(FindEdit, FALSE);
|
||||
repaint
|
||||
SetFocus(FindEdit, FALSE)
|
||||
END
|
||||
|btnReplace:
|
||||
T.replace(text, replaceText, LENGTH(searchText));
|
||||
SetFocus(FindEdit, FALSE);
|
||||
repaint
|
||||
SetFocus(FindEdit, FALSE)
|
||||
|btnReplaceAll:
|
||||
notFound := ~T.search(text, searchText, cs, whole);
|
||||
IF ~notFound THEN
|
||||
replaced := T.replaceAll(text, replaceText, LENGTH(searchText));
|
||||
END;
|
||||
SetFocus(FindEdit, FALSE);
|
||||
repaint
|
||||
SetFocus(FindEdit, FALSE)
|
||||
|btnGoto:
|
||||
goto;
|
||||
repaint
|
||||
END
|
||||
goto
|
||||
END;
|
||||
|
||||
IF exit THEN
|
||||
Close
|
||||
ELSE
|
||||
repaint
|
||||
END
|
||||
END BtnClick;
|
||||
|
||||
|
||||
@ -1884,6 +1819,7 @@ BEGIN
|
||||
|
||||
Scroll.mouse(hScroll);
|
||||
Scroll.mouse(vScroll);
|
||||
msState := K.MouseState();
|
||||
T.getScroll(text, scrollX, scrollY);
|
||||
IF (hScroll.value # scrollX) OR (vScroll.value # scrollY) THEN
|
||||
T.scroll(text, hScroll.value - scrollX, vScroll.value - scrollY);
|
||||
@ -1935,7 +1871,13 @@ END MouseEvent;
|
||||
|
||||
|
||||
PROCEDURE Redraw (VAR resized: BOOLEAN; VAR width, height, cliWidth, cliHeight: INTEGER);
|
||||
VAR
|
||||
onClose: BOOLEAN;
|
||||
BEGIN
|
||||
onClose := (Menu.MenuItem = menuClose) OR (Menu.MenuItem = menuExit);
|
||||
IF ~onClose THEN
|
||||
ClickMenu
|
||||
END;
|
||||
K.GetSystemColors;
|
||||
IF ~K.RolledUp() THEN
|
||||
K.ClientSize(width, height);
|
||||
@ -1945,7 +1887,7 @@ BEGIN
|
||||
resize;
|
||||
resized := TRUE
|
||||
END;
|
||||
K.SetEventsMask({0, 1, 2, 5, 6, 31})
|
||||
K.SetEventsMask({0, 1, 2, 5, 31})
|
||||
ELSE
|
||||
SetCaption(text.fileName);
|
||||
K.SetEventsMask({0, 30, 31})
|
||||
@ -1954,15 +1896,16 @@ BEGIN
|
||||
IF SkinHeight # K.SkinHeight() THEN
|
||||
SkinHeight := K.SkinHeight();
|
||||
Redraw(resized, width, height, cliWidth, cliHeight)
|
||||
END;
|
||||
IF onClose THEN
|
||||
ClickMenu
|
||||
END
|
||||
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));
|
||||
T.scroll(text, hScroll.btn, vScroll.btn);
|
||||
IF menuActive THEN
|
||||
draw_window;
|
||||
menuActive := FALSE
|
||||
@ -1985,8 +1928,6 @@ BEGIN
|
||||
closing := FALSE;
|
||||
textsCount := 0;
|
||||
curText := 0;
|
||||
mainTID := K.ThreadID();
|
||||
K.SetIPC(IPC);
|
||||
Args.GetArg(0, AppPath);
|
||||
Ini.load(AppPath);
|
||||
leftButton := FALSE;
|
||||
@ -2010,6 +1951,7 @@ BEGIN
|
||||
T.init(resetTimer);
|
||||
T.setCanvas(canvas);
|
||||
|
||||
Menu.init(resetTimer);
|
||||
context := CreateContextMenu();
|
||||
menuFile := CreateMenuFile();
|
||||
subCurLine := CreateMenuCurLine();
|
||||
@ -2039,6 +1981,7 @@ BEGIN
|
||||
Menu.AddMainItem(mainMenu, "language", menuLanguage);
|
||||
Menu.AddMainItem(mainMenu, "program", menuProgram);
|
||||
Menu.AddMainItem(mainMenu, "tools", menuTools);
|
||||
Shortcuts;
|
||||
|
||||
Toolbar.create(toolbar, LEFT_PADDING + 5, toolbarTop);
|
||||
Toolbar.add(toolbar, btnNew, 2, "");
|
||||
@ -2075,9 +2018,8 @@ BEGIN
|
||||
END;
|
||||
SwitchTab(textsCount - 1);
|
||||
|
||||
Scroll.init(ScrollChange);
|
||||
Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth*3 DIV 2, hScroll);
|
||||
Scroll.create(TRUE, scrollWidth, canvas.height + 2, scrollWidth, scrollWidth*3 DIV 2, vScroll);
|
||||
Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth*3 DIV 2, ScrollChange, hScroll);
|
||||
Scroll.create(TRUE, scrollWidth, canvas.height + 2, scrollWidth, scrollWidth*3 DIV 2, ScrollChange, vScroll);
|
||||
T.resize(canvas.width, canvas.height);
|
||||
confirm := FALSE;
|
||||
notFound := FALSE;
|
||||
@ -2094,8 +2036,7 @@ BEGIN
|
||||
|
||||
OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, "");
|
||||
|
||||
K.SetEventsMask({0, 1, 2, 5, 6, 31});
|
||||
Menu.init(resetTimer);
|
||||
K.SetEventsMask({0, 1, 2, 5, 31});
|
||||
draw_window;
|
||||
blink := Ini.blink;
|
||||
IF blink <= 0 THEN
|
||||
@ -2112,13 +2053,13 @@ BEGIN
|
||||
T.toggleCursor;
|
||||
repaint
|
||||
END;
|
||||
|
||||
CASE K.EventTimeout(10) OF
|
||||
|0:
|
||||
|1: Redraw(resized, width, height, cliWidth, cliHeight)
|
||||
|2: KeyDown(K.GetKey())
|
||||
|3: BtnClick
|
||||
|6: MouseEvent(resized, firstClickX, firstClickY, time)
|
||||
|7: receiveIPC
|
||||
END
|
||||
END
|
||||
END main;
|
||||
|
@ -323,18 +323,6 @@ PROCEDURE GetControlKeys* (): SET;
|
||||
END GetControlKeys;
|
||||
|
||||
|
||||
PROCEDURE SetIPC* (buffer: ARRAY OF INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(60, 1, SYSTEM.ADR(buffer[0]), LEN(buffer)*SYSTEM.SIZE(INTEGER))
|
||||
END SetIPC;
|
||||
|
||||
|
||||
PROCEDURE SendIPC* (tid: INTEGER; msg: ARRAY OF INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc5(60, 2, tid, SYSTEM.ADR(msg[0]), SYSTEM.SIZE(INTEGER)*LEN(msg))
|
||||
END SendIPC;
|
||||
|
||||
|
||||
PROCEDURE GetSystemColors*;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc4(48, 3, SYSTEM.ADR(colors), 40)
|
||||
|
@ -44,6 +44,9 @@ CONST
|
||||
disSelBackColor = 0E4E4E4H;
|
||||
disSelForeColor = disForeColor;
|
||||
|
||||
SHIFT* = 256;
|
||||
CTRL* = 512;
|
||||
|
||||
|
||||
TYPE
|
||||
|
||||
@ -64,9 +67,7 @@ TYPE
|
||||
font: G.tFont;
|
||||
canvas: G.tCanvas;
|
||||
|
||||
items: List.tList;
|
||||
click: PROCEDURE (menu: tMenu; id: INTEGER);
|
||||
key: PROCEDURE (menu: tMenu; key: INTEGER): BOOLEAN
|
||||
items: List.tList
|
||||
END;
|
||||
|
||||
tItem* = POINTER TO RECORD (List.tItem)
|
||||
@ -83,15 +84,20 @@ TYPE
|
||||
main: tMain
|
||||
END;
|
||||
|
||||
tShortcut = POINTER TO RECORD (List.tItem)
|
||||
key, MenuItem: INTEGER
|
||||
END;
|
||||
|
||||
tClick = PROCEDURE (menu: tMenu; id: INTEGER);
|
||||
tKey = PROCEDURE (menu: tMenu; key: INTEGER): BOOLEAN;
|
||||
tProc = PROCEDURE;
|
||||
|
||||
VAR
|
||||
MenuItem*: INTEGER;
|
||||
stack: ARRAY maxLEVEL + 1, 2500 OF INTEGER;
|
||||
TIDs: ARRAY maxLEVEL + 1 OF INTEGER;
|
||||
resetTimer: tProc;
|
||||
_open: PROCEDURE (m: tMenu; x, y: INTEGER);
|
||||
shortcuts: List.tList;
|
||||
(*
|
||||
backColor, foreColor, selBackColor, selForeColor,
|
||||
disBackColor, disForeColor, disSelBackColor, disSelForeColor: INTEGER;
|
||||
@ -322,6 +328,12 @@ BEGIN
|
||||
END close;
|
||||
|
||||
|
||||
PROCEDURE SetItem* (id: INTEGER);
|
||||
BEGIN
|
||||
MenuItem := id
|
||||
END SetItem;
|
||||
|
||||
|
||||
PROCEDURE click (m: tMenu; i: INTEGER);
|
||||
VAR
|
||||
item: List.tItem;
|
||||
@ -338,7 +350,7 @@ BEGIN
|
||||
END
|
||||
END;
|
||||
IF id # -1 THEN
|
||||
m.click(m, id);
|
||||
SetItem(id);
|
||||
p := m.parent;
|
||||
WHILE p # NIL DO
|
||||
p.child := NIL;
|
||||
@ -391,6 +403,25 @@ BEGIN
|
||||
END submenu;
|
||||
|
||||
|
||||
PROCEDURE getShortcut (key: INTEGER): BOOLEAN;
|
||||
VAR
|
||||
item: tShortcut;
|
||||
res: INTEGER;
|
||||
BEGIN
|
||||
item := shortcuts.first(tShortcut);
|
||||
WHILE (item # NIL) & (item.key # key) DO
|
||||
item := item.next(tShortcut)
|
||||
END;
|
||||
IF item # NIL THEN
|
||||
res := item.MenuItem
|
||||
ELSE
|
||||
res := 0
|
||||
END;
|
||||
SetItem(res)
|
||||
RETURN res # 0
|
||||
END getShortcut;
|
||||
|
||||
|
||||
PROCEDURE [stdcall] window (m: tMenu);
|
||||
VAR
|
||||
x, y: INTEGER;
|
||||
@ -409,50 +440,47 @@ BEGIN
|
||||
draw_window(m)
|
||||
|2:
|
||||
K.getKBState(shift, ctrl);
|
||||
key := K.GetKey();
|
||||
IF ~shift & ~ ctrl THEN
|
||||
IF key DIV 65536 = 72 THEN
|
||||
m.selItem := (m.selItem - 1) MOD m.items.count
|
||||
ELSIF key DIV 65536 = 80 THEN
|
||||
m.selItem := (m.selItem + 1) MOD m.items.count
|
||||
ELSIF key DIV 65536 = 28 THEN
|
||||
IF m.selItem >= 0 THEN
|
||||
click(m, m.selItem)
|
||||
END;
|
||||
m.cliItem := -1
|
||||
ELSIF key DIV 65536 = 77 THEN
|
||||
IF ~submenu(m, TRUE) THEN
|
||||
click(m, -(getMainID(m) + 1))
|
||||
END;
|
||||
m.cliItem := -1
|
||||
ELSIF key DIV 65536 = 75 THEN
|
||||
IF m.parent # NIL THEN
|
||||
escape(m)
|
||||
ELSE
|
||||
click(m, -(getMainID(m) - 1))
|
||||
END;
|
||||
m.cliItem := -1
|
||||
ELSIF key DIV 65536 = 1 THEN
|
||||
escape(m)
|
||||
ELSE
|
||||
IF m.key(m, key) THEN
|
||||
IF m.parent # NIL THEN
|
||||
temp := m.parent.tid;
|
||||
m.parent.tid := 0;
|
||||
K.ExitID(temp)
|
||||
END;
|
||||
exit(m)
|
||||
END
|
||||
END
|
||||
key := K.GetKey() DIV 65536;
|
||||
IF shift THEN
|
||||
INC(key, SHIFT)
|
||||
END;
|
||||
IF ctrl THEN
|
||||
INC(key, CTRL)
|
||||
END;
|
||||
|
||||
CASE key OF
|
||||
|72:
|
||||
m.selItem := (m.selItem - 1) MOD m.items.count
|
||||
|80:
|
||||
m.selItem := (m.selItem + 1) MOD m.items.count
|
||||
|28:
|
||||
IF m.selItem >= 0 THEN
|
||||
click(m, m.selItem)
|
||||
END;
|
||||
m.cliItem := -1
|
||||
|77:
|
||||
IF ~submenu(m, TRUE) THEN
|
||||
click(m, -(getMainID(m) + 1))
|
||||
END;
|
||||
m.cliItem := -1
|
||||
|75:
|
||||
IF m.parent # NIL THEN
|
||||
escape(m)
|
||||
ELSE
|
||||
click(m, -(getMainID(m) - 1))
|
||||
END;
|
||||
m.cliItem := -1
|
||||
|1:
|
||||
escape(m)
|
||||
ELSE
|
||||
IF m.key(m, key) THEN
|
||||
IF m.parent # NIL THEN
|
||||
temp := m.parent.tid;
|
||||
m.parent.tid := 0;
|
||||
K.ExitID(temp)
|
||||
END;
|
||||
exit(m)
|
||||
END
|
||||
IF getShortcut(key) THEN
|
||||
IF m.parent # NIL THEN
|
||||
temp := m.parent.tid;
|
||||
m.parent.tid := 0;
|
||||
K.ExitID(temp)
|
||||
END;
|
||||
exit(m)
|
||||
END
|
||||
END;
|
||||
repaint(m)
|
||||
|6:
|
||||
@ -593,7 +621,7 @@ BEGIN
|
||||
END isEnabled;
|
||||
|
||||
|
||||
PROCEDURE create* (items: List.tList; click: tClick; key: tKey): tMenu;
|
||||
PROCEDURE create* (items: List.tList): tMenu;
|
||||
VAR
|
||||
m: tMenu;
|
||||
maxLength: INTEGER;
|
||||
@ -606,8 +634,6 @@ BEGIN
|
||||
m.child := NIL;
|
||||
m.mainID := 0;
|
||||
m.items := items;
|
||||
m.click := click;
|
||||
m.key := key;
|
||||
maxLength := 0;
|
||||
item := items.first(tItem);
|
||||
WHILE item # NIL DO
|
||||
@ -623,10 +649,23 @@ BEGIN
|
||||
END create;
|
||||
|
||||
|
||||
PROCEDURE AddShortcut* (key, MenuItem: INTEGER);
|
||||
VAR
|
||||
item: tShortcut;
|
||||
BEGIN
|
||||
NEW(item);
|
||||
item.key := key;
|
||||
item.MenuItem := MenuItem;
|
||||
List.append(shortcuts, item)
|
||||
END AddShortcut;
|
||||
|
||||
|
||||
PROCEDURE init* (_resetTimer: tProc);
|
||||
VAR
|
||||
i: INTEGER;
|
||||
BEGIN
|
||||
SetItem(0);
|
||||
shortcuts := List.create(NIL);
|
||||
resetTimer := _resetTimer;
|
||||
_open := open;
|
||||
FOR i := 0 TO maxLEVEL DO
|
||||
|
@ -206,11 +206,11 @@ BEGIN
|
||||
END delete;
|
||||
|
||||
|
||||
PROCEDURE scroll* (t: tTabs; n: INTEGER);
|
||||
PROCEDURE scroll* (t: tTabs; btn: INTEGER);
|
||||
VAR
|
||||
pos: INTEGER;
|
||||
BEGIN
|
||||
pos := t.first + n;
|
||||
pos := t.first + ORD(btn = btnRight) - ORD(btn = btnLeft);
|
||||
IF pos < 0 THEN
|
||||
pos := 0
|
||||
ELSIF pos >= t.strings.count THEN
|
||||
|
@ -23,38 +23,35 @@ IMPORT G := Graph, K := KolibriOS, U := Utils;
|
||||
|
||||
CONST
|
||||
|
||||
ScrollIPC* = 0;
|
||||
DELAY = 40;
|
||||
|
||||
TYPE
|
||||
|
||||
tProcedure = PROCEDURE;
|
||||
|
||||
tScroll* = RECORD
|
||||
vertical, Inc*, Dec*, mouse: BOOLEAN;
|
||||
vertical, mouse: BOOLEAN;
|
||||
top*, left*,
|
||||
width*, height*: INTEGER; (* read only *)
|
||||
btnSize, sliderSize: INTEGER;
|
||||
pos, Slider, pos0, maxVal*, value*: INTEGER;
|
||||
canvas*: G.tCanvas
|
||||
canvas: G.tCanvas;
|
||||
change: tProcedure;
|
||||
delay: INTEGER;
|
||||
btn*: INTEGER
|
||||
END;
|
||||
|
||||
tProcedure* = PROCEDURE;
|
||||
|
||||
VAR
|
||||
|
||||
ScrollChange: tProcedure;
|
||||
delay: INTEGER;
|
||||
|
||||
|
||||
PROCEDURE MouseUp (VAR scroll: tScroll);
|
||||
BEGIN
|
||||
scroll.Slider := -1;
|
||||
scroll.Inc := FALSE;
|
||||
scroll.Dec := FALSE;
|
||||
scroll.btn := 0;
|
||||
scroll.mouse := FALSE;
|
||||
scroll.delay := DELAY
|
||||
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; change: tProcedure; VAR scroll: tScroll);
|
||||
VAR
|
||||
res: tScroll;
|
||||
BEGIN
|
||||
@ -69,6 +66,7 @@ BEGIN
|
||||
res.pos := 0;
|
||||
res.maxVal := 0;
|
||||
res.canvas := G.CreateCanvas(width, height);
|
||||
res.change := change;
|
||||
scroll := res
|
||||
END create;
|
||||
|
||||
@ -111,9 +109,9 @@ BEGIN
|
||||
G.SetColor(canvas, K.colors.line);
|
||||
G.Rect(canvas, 0, 0, width - 1, height - 1);
|
||||
IF scroll.vertical THEN
|
||||
SetColor(canvas, ~scroll.Dec);
|
||||
SetColor(canvas, scroll.btn # -1);
|
||||
Rect(canvas, 0, 0, width - 1, btn - 1);
|
||||
SetColor(canvas, ~scroll.Inc);
|
||||
SetColor(canvas, scroll.btn # 1);
|
||||
Rect(canvas, 0, height - btn, width - 1, height - 1);
|
||||
G.SetColor(canvas, K.colors.button);
|
||||
Rect(canvas, 0, btn + scroll.pos - 1, width - 1, btn + scroll.pos + scroll.sliderSize - 1);
|
||||
@ -129,17 +127,17 @@ BEGIN
|
||||
x1 := (width - d) DIV 2;
|
||||
x2 := x1 + d;
|
||||
|
||||
SetColor(canvas, scroll.Dec);
|
||||
SetColor(canvas, scroll.btn = -1);
|
||||
y := (btn - d DIV 2) DIV 2 + d DIV 2 - 1;
|
||||
G.Triangle(canvas, x1 - 1, y, x2, y, G.triUp);
|
||||
|
||||
SetColor(canvas, scroll.Inc);
|
||||
SetColor(canvas, scroll.btn = 1);
|
||||
y := y + height - btn - d DIV 2 + 1;
|
||||
G.Triangle(canvas, x1 - 1, y, x2, y, G.triDown);
|
||||
ELSE
|
||||
SetColor(canvas, ~scroll.Dec);
|
||||
SetColor(canvas, scroll.btn # -1);
|
||||
Rect(canvas, 0, 0, btn - 1, height - 1);
|
||||
SetColor(canvas, ~scroll.Inc);
|
||||
SetColor(canvas, scroll.btn # 1);
|
||||
Rect(canvas, width - btn, 0, width - 1, height - 1);
|
||||
G.SetColor(canvas, K.colors.button);
|
||||
Rect(canvas, btn + scroll.pos - 1, 0, btn + scroll.pos + scroll.sliderSize - 1, height - 1);
|
||||
@ -155,11 +153,11 @@ BEGIN
|
||||
y1 := (height - d) DIV 2;
|
||||
y2 := y1 + d;
|
||||
|
||||
SetColor(canvas, scroll.Dec);
|
||||
SetColor(canvas, scroll.btn = -1);
|
||||
x := (btn - d DIV 2) DIV 2 + d DIV 2 - 1;
|
||||
G.Triangle(canvas, x, y1 - 1, x, y2, G.triLeft);
|
||||
|
||||
SetColor(canvas, scroll.Inc);
|
||||
SetColor(canvas, scroll.btn = 1);
|
||||
x := x + width - btn - d DIV 2 + 1;
|
||||
G.Triangle(canvas, x, y1 - 1, x, y2, G.triRight);
|
||||
END;
|
||||
@ -219,17 +217,6 @@ BEGIN
|
||||
END setValue;
|
||||
|
||||
|
||||
PROCEDURE change* (VAR scroll: tScroll);
|
||||
BEGIN
|
||||
IF scroll.Inc THEN
|
||||
setValue(scroll, scroll.value + 1)
|
||||
ELSIF scroll.Dec THEN
|
||||
setValue(scroll, scroll.value - 1)
|
||||
END;
|
||||
draw(scroll)
|
||||
END change;
|
||||
|
||||
|
||||
PROCEDURE ceil (p, q: INTEGER): INTEGER;
|
||||
RETURN p DIV q + ORD(p MOD q # 0)
|
||||
END ceil;
|
||||
@ -306,38 +293,34 @@ BEGIN
|
||||
END MouseMove;
|
||||
|
||||
|
||||
PROCEDURE SendIPC;
|
||||
PROCEDURE button (VAR scroll: tScroll);
|
||||
VAR
|
||||
msg: ARRAY 2 OF INTEGER;
|
||||
btn: INTEGER;
|
||||
BEGIN
|
||||
msg[0] := ScrollIPC;
|
||||
msg[1] := 8;
|
||||
K.SendIPC(K.ThreadID(), msg)
|
||||
END SendIPC;
|
||||
|
||||
|
||||
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)
|
||||
WHILE scroll.btn # 0 DO
|
||||
btn := scroll.btn;
|
||||
setValue(scroll, scroll.value + btn);
|
||||
draw(scroll);
|
||||
IF scroll.change # NIL THEN
|
||||
scroll.change
|
||||
END;
|
||||
IF delay = 0 THEN
|
||||
IPC[0] := 0;
|
||||
IPC[1] := 0;
|
||||
scrollIPC := TRUE;
|
||||
SendIPC;
|
||||
delay := 4
|
||||
scroll.btn := 0;
|
||||
IF 0 IN K.MouseState() THEN
|
||||
WHILE (0 IN K.MouseState()) & (scroll.delay > 0) DO
|
||||
K.Pause(1);
|
||||
DEC(scroll.delay)
|
||||
END;
|
||||
IF scroll.delay = 0 THEN
|
||||
scroll.btn := btn;
|
||||
scroll.delay := 3
|
||||
ELSE
|
||||
scroll.delay := DELAY
|
||||
END
|
||||
ELSE
|
||||
delay := DELAY
|
||||
scroll.delay := DELAY
|
||||
END
|
||||
ELSE
|
||||
delay := DELAY
|
||||
END
|
||||
END receiveIPC;
|
||||
END button;
|
||||
|
||||
|
||||
PROCEDURE MouseDown (VAR scroll: tScroll; x, y: INTEGER);
|
||||
@ -359,11 +342,9 @@ BEGIN
|
||||
scroll.pos0 := scroll.pos;
|
||||
scroll.Slider := c
|
||||
ELSIF U.between(0, c, scroll.btnSize - 1) THEN
|
||||
scroll.Dec := TRUE;
|
||||
SendIPC
|
||||
scroll.btn := -1
|
||||
ELSIF U.between(size - scroll.btnSize, c, size - 1) THEN
|
||||
scroll.Inc := TRUE;
|
||||
SendIPC
|
||||
scroll.btn := 1
|
||||
ELSE
|
||||
setPos(scroll, c - scroll.btnSize - scroll.sliderSize DIV 2);
|
||||
scroll.pos0 := scroll.pos;
|
||||
@ -389,15 +370,9 @@ BEGIN
|
||||
ELSIF scroll.mouse THEN
|
||||
MouseUp(scroll);
|
||||
draw(scroll)
|
||||
END
|
||||
END;
|
||||
button(scroll)
|
||||
END mouse;
|
||||
|
||||
|
||||
PROCEDURE init* (_ScrollChange: tProcedure);
|
||||
BEGIN
|
||||
delay := DELAY;
|
||||
ScrollChange := _ScrollChange
|
||||
END init;
|
||||
|
||||
|
||||
END Scroll.
|
5
programs/develop/oberon07/samples/BUILD_ALL.SH
Normal file
5
programs/develop/oberon07/samples/BUILD_ALL.SH
Normal file
@ -0,0 +1,5 @@
|
||||
#SHS
|
||||
/kolibrios/develop/oberon07/compiler.kex HW.ob07 kosexe -out /tmp0/1/HW.kex -stk 1
|
||||
/kolibrios/develop/oberon07/compiler.kex HW_con.ob07 kosexe -out /tmp0/1/HW_con.kex -stk 1
|
||||
/kolibrios/develop/oberon07/compiler.kex Dialogs.ob07 kosexe -out /tmp0/1/Dialogs.kex -stk 1
|
||||
exit
|
@ -1,110 +1,159 @@
|
||||
MODULE Dialogs;
|
||||
|
||||
IMPORT KOSAPI, sys := SYSTEM, OpenDlg, ColorDlg;
|
||||
IMPORT
|
||||
KOSAPI, SYSTEM, OpenDlg, ColorDlg;
|
||||
|
||||
VAR header: ARRAY 1024 OF CHAR; back_color: INTEGER;
|
||||
|
||||
PROCEDURE WindowRedrawStatus(p: INTEGER);
|
||||
CONST
|
||||
btnNone = 0;
|
||||
btnClose = 1;
|
||||
btnOpen = 17;
|
||||
btnColor = 18;
|
||||
|
||||
|
||||
VAR
|
||||
header: ARRAY 1024 OF CHAR;
|
||||
back_color: INTEGER;
|
||||
|
||||
|
||||
PROCEDURE BeginDraw;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(12, p)
|
||||
END WindowRedrawStatus;
|
||||
KOSAPI.sysfunc2(12, 1)
|
||||
END BeginDraw;
|
||||
|
||||
PROCEDURE DefineAndDrawWindow(x, y, w, h, color, style, hcolor, hstyle, htext: INTEGER);
|
||||
|
||||
PROCEDURE EndDraw;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(0, x * 65536 + w, y * 65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), htext)
|
||||
KOSAPI.sysfunc2(12, 2)
|
||||
END EndDraw;
|
||||
|
||||
|
||||
PROCEDURE DefineAndDrawWindow (left, top, width, height, color, style, hcolor, hstyle: INTEGER; header: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(0, left*65536 + width, top*65536 + height, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(header[0]))
|
||||
END DefineAndDrawWindow;
|
||||
|
||||
PROCEDURE WaitForEvent(): INTEGER;
|
||||
RETURN KOSAPI.sysfunc1(10)
|
||||
|
||||
PROCEDURE WaitForEvent (): INTEGER;
|
||||
RETURN KOSAPI.sysfunc1(10)
|
||||
END WaitForEvent;
|
||||
|
||||
|
||||
PROCEDURE ExitApp;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc1(-1)
|
||||
KOSAPI.sysfunc1(-1)
|
||||
END ExitApp;
|
||||
|
||||
PROCEDURE pause(t: INTEGER);
|
||||
|
||||
PROCEDURE pause (t: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(5, t)
|
||||
KOSAPI.sysfunc2(5, t)
|
||||
END pause;
|
||||
|
||||
|
||||
PROCEDURE Buttons;
|
||||
|
||||
PROCEDURE Button(id, X, Y, W, H: INTEGER; Caption: ARRAY OF CHAR);
|
||||
VAR n, aux: INTEGER;
|
||||
BEGIN
|
||||
n := LENGTH(Caption);
|
||||
aux := KOSAPI.sysfunc5(8, X * 65536 + W, Y * 65536 + H, id, 00C0C0C0H);
|
||||
X := X + (W - 8 * n) DIV 2;
|
||||
Y := Y + (H - 14) DIV 2;
|
||||
aux := KOSAPI.sysfunc6(4, X * 65536 + Y, LSL(48, 24), sys.ADR(Caption[0]), n, 0)
|
||||
END Button;
|
||||
PROCEDURE Button (id, X, Y, W, H: INTEGER; Caption: ARRAY OF CHAR);
|
||||
VAR
|
||||
n: INTEGER;
|
||||
BEGIN
|
||||
n := LENGTH(Caption);
|
||||
KOSAPI.sysfunc5(8, X*65536 + W, Y*65536 + H, id, 00C0C0C0H);
|
||||
X := X + (W - 8*n) DIV 2;
|
||||
Y := Y + (H - 14) DIV 2;
|
||||
KOSAPI.sysfunc6(4, X*65536 + Y, LSL(48, 24), SYSTEM.ADR(Caption[0]), n, 0)
|
||||
END Button;
|
||||
|
||||
BEGIN
|
||||
Button(17, 5, 5, 70, 25, "open");
|
||||
Button(18, 85, 5, 70, 25, "color");
|
||||
Button(btnOpen, 5, 5, 70, 25, "open");
|
||||
Button(btnColor, 85, 5, 70, 25, "color");
|
||||
END Buttons;
|
||||
|
||||
|
||||
PROCEDURE draw_window;
|
||||
BEGIN
|
||||
WindowRedrawStatus(1);
|
||||
DefineAndDrawWindow(200, 200, 500, 100, back_color, 51, 0, 0, sys.ADR(header[0]));
|
||||
Buttons;
|
||||
WindowRedrawStatus(2);
|
||||
BeginDraw;
|
||||
DefineAndDrawWindow(200, 200, 500, 100, back_color, 51, 0, 0, header);
|
||||
Buttons;
|
||||
EndDraw;
|
||||
END draw_window;
|
||||
|
||||
PROCEDURE OpenFile(Open: OpenDlg.Dialog);
|
||||
|
||||
PROCEDURE OpenFile (Open: OpenDlg.Dialog);
|
||||
BEGIN
|
||||
IF Open # NIL THEN
|
||||
OpenDlg.Show(Open, 500, 450);
|
||||
WHILE Open.status = 2 DO
|
||||
pause(30)
|
||||
END;
|
||||
IF Open.status = 1 THEN
|
||||
COPY(Open.FilePath, header)
|
||||
END
|
||||
END
|
||||
IF Open # NIL THEN
|
||||
OpenDlg.Show(Open, 500, 450);
|
||||
WHILE Open.status = 2 DO
|
||||
pause(30)
|
||||
END;
|
||||
IF Open.status = 1 THEN
|
||||
COPY(Open.FilePath, header)
|
||||
END
|
||||
END
|
||||
END OpenFile;
|
||||
|
||||
PROCEDURE SelColor(Color: ColorDlg.Dialog);
|
||||
|
||||
PROCEDURE SelColor (Color: ColorDlg.Dialog);
|
||||
BEGIN
|
||||
IF Color # NIL THEN
|
||||
ColorDlg.Show(Color);
|
||||
WHILE Color.status = 2 DO
|
||||
pause(30)
|
||||
END;
|
||||
IF Color.status = 1 THEN
|
||||
back_color := Color.color
|
||||
END
|
||||
END
|
||||
IF Color # NIL THEN
|
||||
ColorDlg.Show(Color);
|
||||
WHILE Color.status = 2 DO
|
||||
pause(30)
|
||||
END;
|
||||
IF Color.status = 1 THEN
|
||||
back_color := Color.color
|
||||
END
|
||||
END
|
||||
END SelColor;
|
||||
|
||||
PROCEDURE main;
|
||||
VAR Open: OpenDlg.Dialog; Color: ColorDlg.Dialog; res, al: INTEGER;
|
||||
|
||||
PROCEDURE GetButton (): INTEGER;
|
||||
VAR
|
||||
btn: INTEGER;
|
||||
BEGIN
|
||||
back_color := 00FFFFFFH;
|
||||
header := "Dialogs";
|
||||
draw_window;
|
||||
Open := OpenDlg.Create(draw_window, 0, "/sys", "ASM|TXT|INI");
|
||||
Color := ColorDlg.Create(draw_window);
|
||||
WHILE TRUE DO
|
||||
CASE WaitForEvent() OF
|
||||
|1: draw_window
|
||||
|3: res := KOSAPI.sysfunc1(17);
|
||||
al := LSR(LSL(res, 24), 24);
|
||||
res := LSR(res, 8);
|
||||
IF al = 0 THEN
|
||||
CASE res OF
|
||||
| 1: ExitApp
|
||||
|17: OpenFile(Open)
|
||||
|18: SelColor(Color)
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
END
|
||||
END
|
||||
btn := KOSAPI.sysfunc1(17);
|
||||
IF btn MOD 256 = 0 THEN
|
||||
btn := btn DIV 256
|
||||
ELSE
|
||||
btn := btnNone
|
||||
END
|
||||
RETURN btn
|
||||
END GetButton;
|
||||
|
||||
|
||||
PROCEDURE main;
|
||||
CONST
|
||||
EVENT_REDRAW = 1;
|
||||
EVENT_KEY = 2;
|
||||
EVENT_BUTTON = 3;
|
||||
VAR
|
||||
Open: OpenDlg.Dialog;
|
||||
Color: ColorDlg.Dialog;
|
||||
BEGIN
|
||||
back_color := 00FFFFFFH;
|
||||
header := "Dialogs";
|
||||
Open := OpenDlg.Create(draw_window, 0, "/sys", "ASM|TXT|INI");
|
||||
Color := ColorDlg.Create(draw_window);
|
||||
|
||||
WHILE TRUE DO
|
||||
CASE WaitForEvent() OF
|
||||
|EVENT_REDRAW:
|
||||
draw_window
|
||||
|
||||
|EVENT_KEY:
|
||||
|
||||
|EVENT_BUTTON:
|
||||
CASE GetButton() OF
|
||||
|btnNone:
|
||||
|btnClose: ExitApp
|
||||
|btnOpen: OpenFile(Open)
|
||||
|btnColor: SelColor(Color)
|
||||
END
|
||||
END
|
||||
END
|
||||
END main;
|
||||
|
||||
|
||||
BEGIN
|
||||
main
|
||||
main
|
||||
END Dialogs.
|
@ -1,50 +1,78 @@
|
||||
MODULE HW;
|
||||
|
||||
IMPORT sys := SYSTEM, KOSAPI;
|
||||
IMPORT
|
||||
SYSTEM, KOSAPI;
|
||||
|
||||
PROCEDURE WindowRedrawStatus(p: INTEGER);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(12, p)
|
||||
END WindowRedrawStatus;
|
||||
|
||||
PROCEDURE DefineAndDrawWindow(x, y, w, h, color, style, hcolor, hstyle, htext: INTEGER);
|
||||
PROCEDURE BeginDraw;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(0, x * 65536 + w, y * 65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), htext)
|
||||
KOSAPI.sysfunc2(12, 1)
|
||||
END BeginDraw;
|
||||
|
||||
|
||||
PROCEDURE EndDraw;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc2(12, 2)
|
||||
END EndDraw;
|
||||
|
||||
|
||||
PROCEDURE DefineAndDrawWindow (left, top, width, height, color, style, hcolor, hstyle: INTEGER; header: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(0, left*65536 + width, top*65536 + height, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(header[0]))
|
||||
END DefineAndDrawWindow;
|
||||
|
||||
PROCEDURE WriteTextToWindow(x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||
|
||||
PROCEDURE WriteTextToWindow (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(48, 24), sys.ADR(text[0]), LENGTH(text), 0)
|
||||
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(48, 24), SYSTEM.ADR(text[0]), LENGTH(text), 0)
|
||||
END WriteTextToWindow;
|
||||
|
||||
PROCEDURE WaitForEvent(): INTEGER;
|
||||
RETURN KOSAPI.sysfunc1(10)
|
||||
|
||||
PROCEDURE WaitForEvent (): INTEGER;
|
||||
RETURN KOSAPI.sysfunc1(10)
|
||||
END WaitForEvent;
|
||||
|
||||
|
||||
PROCEDURE ExitApp;
|
||||
BEGIN
|
||||
KOSAPI.sysfunc1(-1)
|
||||
KOSAPI.sysfunc1(-1)
|
||||
END ExitApp;
|
||||
|
||||
PROCEDURE draw_window(header, text: ARRAY OF CHAR);
|
||||
|
||||
PROCEDURE draw_window (header, text: ARRAY OF CHAR);
|
||||
CONST
|
||||
WHITE = 0FFFFFFH;
|
||||
RED = 0C00000H;
|
||||
GREEN = 0008000H;
|
||||
BLUE = 00000C0H;
|
||||
GRAY = 0808080H;
|
||||
BEGIN
|
||||
WindowRedrawStatus(1);
|
||||
DefineAndDrawWindow(200, 200, 200, 100, 0FFFFFFH, 51, 0, 0, sys.ADR(header));
|
||||
WriteTextToWindow(10, 10, 0FF0000H, text);
|
||||
WindowRedrawStatus(2);
|
||||
BeginDraw;
|
||||
DefineAndDrawWindow(200, 200, 300, 150, WHITE, 51, 0, 0, header);
|
||||
WriteTextToWindow( 5, 10, RED, text);
|
||||
WriteTextToWindow(35, 30, GREEN, text);
|
||||
WriteTextToWindow(65, 50, BLUE, text);
|
||||
WriteTextToWindow(95, 70, GRAY, text);
|
||||
EndDraw
|
||||
END draw_window;
|
||||
|
||||
PROCEDURE Main(header, text: ARRAY OF CHAR);
|
||||
|
||||
PROCEDURE main (header, text: ARRAY OF CHAR);
|
||||
CONST
|
||||
EVENT_REDRAW = 1;
|
||||
EVENT_KEY = 2;
|
||||
EVENT_BUTTON = 3;
|
||||
BEGIN
|
||||
WHILE TRUE DO
|
||||
CASE WaitForEvent() OF
|
||||
|1: draw_window(header, text)
|
||||
|3: ExitApp
|
||||
ELSE
|
||||
END
|
||||
END
|
||||
END Main;
|
||||
WHILE TRUE DO
|
||||
CASE WaitForEvent() OF
|
||||
|EVENT_REDRAW: draw_window(header, text)
|
||||
|EVENT_KEY: ExitApp
|
||||
|EVENT_BUTTON: ExitApp
|
||||
END
|
||||
END
|
||||
END main;
|
||||
|
||||
|
||||
BEGIN
|
||||
Main("HW", "Hello, world!")
|
||||
main("Hello", "Hello, world!")
|
||||
END HW.
|
@ -1,63 +1,59 @@
|
||||
MODULE HW_con;
|
||||
|
||||
IMPORT Out, In, Console, DateTime;
|
||||
IMPORT
|
||||
Out, In, Console, DateTime;
|
||||
|
||||
|
||||
PROCEDURE OutInt2(n: INTEGER);
|
||||
PROCEDURE OutInt2 (n: INTEGER);
|
||||
BEGIN
|
||||
ASSERT((0 <= n) & (n <= 99));
|
||||
IF n < 10 THEN
|
||||
Out.Char("0")
|
||||
END;
|
||||
Out.Int(n, 0)
|
||||
ASSERT((0 <= n) & (n <= 99));
|
||||
IF n < 10 THEN
|
||||
Out.Char("0")
|
||||
END;
|
||||
Out.Int(n, 0)
|
||||
END OutInt2;
|
||||
|
||||
|
||||
PROCEDURE OutMonth(n: INTEGER);
|
||||
PROCEDURE OutMonth (n: INTEGER);
|
||||
VAR
|
||||
str: ARRAY 4 OF CHAR;
|
||||
|
||||
str: ARRAY 4 OF CHAR;
|
||||
BEGIN
|
||||
|
||||
CASE n OF
|
||||
| 1: str := "jan"
|
||||
| 2: str := "feb"
|
||||
| 3: str := "mar"
|
||||
| 4: str := "apr"
|
||||
| 5: str := "may"
|
||||
| 6: str := "jun"
|
||||
| 7: str := "jul"
|
||||
| 8: str := "aug"
|
||||
| 9: str := "sep"
|
||||
|10: str := "oct"
|
||||
|11: str := "nov"
|
||||
|12: str := "dec"
|
||||
END;
|
||||
|
||||
Out.String(str)
|
||||
CASE n OF
|
||||
| 1: str := "jan"
|
||||
| 2: str := "feb"
|
||||
| 3: str := "mar"
|
||||
| 4: str := "apr"
|
||||
| 5: str := "may"
|
||||
| 6: str := "jun"
|
||||
| 7: str := "jul"
|
||||
| 8: str := "aug"
|
||||
| 9: str := "sep"
|
||||
|10: str := "oct"
|
||||
|11: str := "nov"
|
||||
|12: str := "dec"
|
||||
END;
|
||||
Out.String(str)
|
||||
END OutMonth;
|
||||
|
||||
|
||||
PROCEDURE main;
|
||||
VAR
|
||||
Year, Month, Day, Hour, Min, Sec, Msec: INTEGER;
|
||||
|
||||
Year, Month, Day,
|
||||
Hour, Min, Sec, Msec: INTEGER;
|
||||
BEGIN
|
||||
Out.String("Hello, world!"); Out.Ln;
|
||||
Console.SetColor(Console.White, Console.Red);
|
||||
DateTime.Now(Year, Month, Day, Hour, Min, Sec, Msec);
|
||||
Out.Int(Year, 0); Out.Char("-");
|
||||
OutMonth(Month); Out.Char("-");
|
||||
OutInt2(Day); Out.Char(" ");
|
||||
OutInt2(Hour); Out.Char(":");
|
||||
OutInt2(Min); Out.Char(":");
|
||||
OutInt2(Sec)
|
||||
Out.String("Hello, world!"); Out.Ln;
|
||||
Console.SetColor(Console.White, Console.Red);
|
||||
DateTime.Now(Year, Month, Day, Hour, Min, Sec, Msec);
|
||||
OutInt2(Day); Out.Char("-"); OutMonth(Month); Out.Char("-"); Out.Int(Year, 0); Out.Char(" ");
|
||||
OutInt2(Hour); Out.Char(":"); OutInt2(Min); Out.Char(":"); OutInt2(Sec); Out.Ln;
|
||||
Console.SetColor(Console.Blue, Console.LightGray);
|
||||
Out.Ln; Out.String("press enter...");
|
||||
In.Ln
|
||||
END main;
|
||||
|
||||
|
||||
BEGIN
|
||||
Console.open;
|
||||
main;
|
||||
In.Ln;
|
||||
Console.exit(TRUE)
|
||||
Console.open;
|
||||
main;
|
||||
Console.exit(TRUE)
|
||||
END HW_con.
|
Loading…
Reference in New Issue
Block a user