File size: 3,253 Bytes
806d4b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
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,\"Part 1: The help system\",LE=1$"
"$CM+LX,4,4$$BT,\"Part 2: The basics\",LE=2$"
"$CM+LX,4,4$$BT,\"Part 3: Editing and running programs\",LE=3$"
"$CM+LX,4,4$$BT,\"Part 4: Adding macros to PersonalMenu\",LE=4$"
"$CM+LX,4,4$$BT,\"Part 5: Choose filename, choose dir\",LE=5$"
"$CM+LX,4,4$$BT,\"Part 6: AutoComplete\",LE=6$"
"$CM+LX,4,4$$BT,\"Part 7: Search (Find)\",LE=7$"
"$CM+LX,4,4$$BT,\"Part 8: TempleOS file masks\",LE=8$"
"$CM+LX,4,4$$BT,\"Part 9: Editor filter\",LE=9$"
"$CM+LX,4,4$$BT,\"Part 10: Debugging\",LE=10$"
"$CM+LX,4,4$$BT,\"Part 11: Wow!!\",LE=11$"
"$CM+LX,4,4$$BT,\"Part 12: 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";
|