ZealOS/Distro/Misc/Tour/Tour.IN
2020-02-15 14:01:48 -06:00

124 lines
3.1 KiB
Text
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CTask *tour_put,*tour_task;
Bool tour_okay_pressed;
U0 TourPutTask()
{
CDoc *doc;
I64 ch;
DocTermNew;
WinHorz(TEXT_COLS/2,TEXT_COLS-2);
WinVert(TEXT_ROWS/2+5,TEXT_ROWS-7);
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
WinToTop;
Fs->border_src=BDS_CONST;
Fs->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
Fs->text_attr =LTGRAY<<4+BLUE;
Fs->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
doc=DocPut;
doc->flags|=DOCF_FORM;
DocCursor(FALSE,doc);
"$$WW+H,1$$";
while (TRUE) {
Refresh;
if (ScanMsg(&ch,,1<<MSG_KEY_DOWN) && (ch==CH_ESC||ch==CH_SHIFT_ESC)) {
Kill(tour_task->parent_task,FALSE);
break;
}
DocLock(doc);
if (ch==CH_SPACE && doc->cur_entry!=doc) {
if (doc->cur_entry->de_flags & DOCEF_LINK)
'' CH_SPACE;
else if (doc->cur_entry->type_u8==DOCT_BTTN)
tour_okay_pressed=TRUE;
}
DocUnlock(doc);
if (tour_okay_pressed) {
Fs->win_inhibit=WIG_NO_FOCUS_TASK_DFT;
if (sys_focus_task==Fs)
WinRefocus;
} else {
Fs->win_inhibit=0;
WinFocus;
}
}
tour_put=NULL;
}
U0 TourPut(U8 *st,Bool wait_okay=FALSE)
{
CDoc *doc;
CTask *old_focus_task;
if (TaskValidate(tour_put)) {
doc=DocPut(tour_put);
DocClear(doc);
DocPrint(doc,"%s",st);
if (!wait_okay)
tour_okay_pressed=TRUE;
else {
DocPrint(doc,"\n\n$$CM-RE+CX,LE=-2$$$$BT,\"Okay\",LM=\"b\"$$\n\n");
DocFormBwd(doc);
old_focus_task=sys_focus_task;
tour_okay_pressed=FALSE;
do Refresh;
while (!tour_okay_pressed);
WinFocus(old_focus_task);
DocClear(doc);
}
} else
Kill(tour_task,,TRUE);
}
public I64 PopUpTourPart()
{
I64 i;
CDoc *doc=DocNew;
DocPrint(doc,"$$PURPLE$$TempleOS Tours$$FG$$\n\n"
"$$CM+LX,4,4$$$$BT,\"Part1: The help system\",LE=1$$"
"$$CM+LX,4,4$$$$BT,\"Part2: The basics\",LE=2$$"
"$$CM+LX,4,4$$$$BT,\"Part3: Editing and running programs\",LE=3$$"
"$$CM+LX,4,4$$$$BT,\"Part4: Adding macros to PersonalMenu\",LE=4$$"
"$$CM+LX,4,4$$$$BT,\"Part5: Choose filename, choose dir\",LE=5$$"
"$$CM+LX,4,4$$$$BT,\"Part6: AutoComplete\",LE=6$$"
"$$CM+LX,4,4$$$$BT,\"Part7: Search (Find)\",LE=7$$"
"$$CM+LX,4,4$$$$BT,\"Part8: TempleOS file masks\",LE=8$$"
"$$CM+LX,4,4$$$$BT,\"Part9: Editor filter\",LE=9$$"
"$$CM+LX,4,4$$$$BT,\"Part10: Debugging\",LE=10$$"
"$$CM+LX,4,4$$$$BT,\"Part11: Wow!!\",LE=11$$"
"$$CM+LX,4,4$$$$BT,\"Part12: Test Suite\",LE=12$$"
"$$CM+LX,4,4$$$$BT,\"Done\",LE=DOCM_CANCEL$$\n");
doc->flags|=DOCF_FORM;
i=PopUpPrint("WinMax;DocMenu(0x%X,0);",doc);
DocDel(doc);
return i;
}
U0 TourMenu()
{
U8 buf[STR_LEN];
I64 i;
tour_task=Fs;
tour_okay_pressed=TRUE;
tour_put=Spawn(&TourPutTask,NULL,"TourPut",,Fs);
TaskWait(tour_put);
while (TRUE) {
Cd(__DIR__);
AutoComplete;
if (LBtr(&tour_put->display_flags,DISPLAYf_SHOW))
WinZBufUpdate;
i=PopUpTourPart;
if (i>0) {
if (!LBts(&tour_put->display_flags,DISPLAYf_SHOW))
WinZBufUpdate;
StrPrint(buf,"Tour%X.IN",i);
ExeFile(buf);
} else
break;
}
Kill(tour_put);
}
"DocClear;WinMax;\n";
Refresh(2);
TourMenu;
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
"Cd;Dir;\n";