104 lines
4.9 KiB
Plaintext
104 lines
4.9 KiB
Plaintext
//$FG,2$Press $FG,4$CTRL-T$FG,2$, now. The "$FG,4$$$PI...$FG,2$" code is a picture.
|
||
$FG$//$FG,2$Pictures are known as binary data. Binary
|
||
$FG$//$FG,2$data items are associated with a number that
|
||
$FG$//$FG,2$the editor assigns for items in a document.
|
||
$FG$//$FG,2$When you transfer with the clipboard, numbers
|
||
$FG$//$FG,2$are assigned automatically.
|
||
|
||
$FG$//$FG,2$In source code, you tell the compiler to insert
|
||
$FG$//$FG,2$a pointer to the binary data with a "$FG,4$$$IB...$FG,2$" entry.
|
||
$FG$//$FG,2$You insert the size of a binary data item with
|
||
$FG$//$FG,2$"$FG,4$$$IS...$FG,2$".$FG$
|
||
|
||
$FG$//$FG,2$You create a new picture with $FG,4$CTRL-R$FG,2$.
|
||
|
||
$FG$//$FG,2$You edit a picture by selecting it and
|
||
$FG$//$FG,2$pressing $FG,4$CTRL-R$FG,2$.$FG$
|
||
|
||
|
||
|
||
|
||
$PI,"<PI1>",1$
|
||
|
||
|
||
|
||
|
||
$PI,"<PI4>",4$
|
||
|
||
|
||
|
||
|
||
$PI,"<PI5>",5$
|
||
|
||
|
||
|
||
|
||
//$FG,2$We're going to create some toolbar/menu entries.
|
||
$FG$//$FG,2$The $FG,4$Fs->$FG,2$ is a pointer to the operating system's
|
||
$FG$//$FG,2$record for the current task. $FG,4$Fs->cur_ltf$FG,2$ holds
|
||
$FG$//$FG,2$the client area document framework while
|
||
$FG$//$FG,4$Fs->aux_ltf$FG,2$ is the document frame work for controls
|
||
$FG$//$FG,2$and stuff. Controls for the border items have
|
||
$FG$//$FG,2$been added in $LK,"UseConsoleLtf","MN:UseConsoleLtf"$$FG,2$() and include a $FG,4$+H$FG,2$ flag
|
||
$FG$//$FG,2$which tells it hold-onto them during a $FG,4$$$CL$$$FG,2$, clear
|
||
$FG$//$FG,2$or if the buffer gets full.
|
||
|
||
|
||
$FG$//$FG,2$These two clear-out old entries without a $FG,4$+H$FG,2$ hold flag.$FG$
|
||
LtfBottom(Fs->aux_ltf);
|
||
LtfPutSExt(Fs->aux_ltf,"$$CL$$");
|
||
|
||
|
||
//$FG,2$Now, we'll add a couple top-left-menu macro's. The $FG,4$+IV$FG,2$
|
||
$FG$//$FG,2$flag inverts the color. The $FG,4$+TML$FG,2$ flag is for
|
||
$FG$//$FG,2$top-left-menu items.
|
||
$FG$
|
||
LtfPutSExt(Fs->aux_ltf,"$$MA+A+TML+IV,\"Dir \",\"Dir;\r\"$$");
|
||
LtfPutSExt(Fs->aux_ltf,"$$MA+A+TML+IV,\"Home \",\"Cd(\\\"HOME\\\");Dir;\r\"$$\r\n");
|
||
|
||
//$FG,2$Now, we'll insert a top-right-menu item.$FG$
|
||
LtfPutSExt(Fs->aux_ltf,"$$MA+A+TMR+IV,\"Edit \",\"Edit(\\\"HOME/Temp.TXZ\\\");\r\"$$\r\n");
|
||
|
||
//$FG,2$Now, we'll insert a top-left-menu/toolbar item
|
||
$FG$//$FG,2$that is a picture. "$FG,4$$$OL...$FG,2$" stands for left toolbar.
|
||
$FG$//$FG,2$The $FG,4$+LM$FG,2$ means it has a left-macro. The $FG,4$+X$FG,2$ tells it
|
||
$FG$//$FG,2$to place the cursor at the bottom before executing the macro.
|
||
$FG$//$FG,2$The $FG,4$%d$FG$ $FG,2$helps the routine format the picture number. You don't actually
|
||
$FG$//$FG,2$deal with that number. The last two numbers are width and height of the
|
||
$FG$//$FG,2$new toolbar entry.
|
||
|
||
$FG$LtfPutGrElem(Fs->aux_ltf,$IB,"<IB1>",1$,$IS,"<IS1>",1$,"$$OL+X+LM,\"Dir;\r\",%d,80,32$$");
|
||
|
||
//$FG,2$(The code for top-right-toolbar entry is "$FG,4$$$OR...$FG,2$".)
|
||
$FG$
|
||
|
||
I8 Test(Ltf *l,LtfEntry *ll)
|
||
{
|
||
U8 i;
|
||
nounusedwarn l;
|
||
for (i=ll->user_data;i>100;i-=5) {
|
||
Sound(i);
|
||
Sleep(5);
|
||
}
|
||
Sound(0);
|
||
return 0;
|
||
}
|
||
|
||
|
||
//$FG,2$Now, we'll add a toolbar entry with a left-callback.
|
||
$FG$LtfEntry *ll;
|
||
ll=LtfPutGrElem(Fs->aux_ltf,$IB,"<IB4>",4$,$IS,"<IS4>",4$,"$$OL+LC,%d,64,32$$");
|
||
ll->user_data=1000;
|
||
ll->left_cb=&Test;
|
||
ll=LtfPutGrElem(Fs->aux_ltf,$IB,"<IB4>",6$,$IS,"<IS4>",7$,"$$OL+LC,%d,64,32$$");
|
||
ll->user_data=2000;
|
||
ll->left_cb=&Test;
|
||
|
||
$FG$//$FG,2$We'll make a macro that runs in a pop-up window
|
||
$FG$//$FG,2$using the $FG,4$+PU$FG,2$ flag. It does a directory and calls
|
||
$FG$//$FG,2$the $LK,"View","MN:View"$() command which waits for $FG,4$CTRLQ$FG,2$ or $FG,4$ESC$FG,2$.
|
||
$FG$LtfPutGrElem(Fs->aux_ltf,$IB,"<IB5>",5$,$IS,"<IS5>",5$,"$$OR+PU+LM,\"Dir;View;\",%d,80,32$$");
|
||
|
||
|
||
|
||
|