// Created by Newton Book Maker 1.1
//  Note: This file may contain needed resources !! 
// Document
book := {
	version: 2,
	isbn: "Layout:DTS",
	title: "The Layout Story",
	shortTitle: "Layouts",
	data: {},   // Authors own data
	contents: Array(4, NIL),
	styles: [], hints: Array(4, NIL),
	browsers: [], templates: [], rendering: []};
output.book := book;

// Shared Map Functions
func MakePage(aTemplate)
	{template: aTemplate, blocks: []};
func MakeBlock(aBounds, anItem)
	{bounds: aBounds, item: anItem};

// Shared Scripts
gotoDestScript := func() begin
	if (curRendering = 0) then :TurnToPage(destPage);
	else :TurnToPage(:FindPageByContent(kioskDest, 0, NIL));
end;

// Hints
book.hints[0] := StuffHex("000430201041800000101001520812227010220A0041220A100050608000000020021050601020021010A01E0082000020003A104A1028020802000020301900009000074048006400B00001200000000010008060100100720A1406200200042000000000000000002000000000000000000000200000000000000000000000",'data);
book.hints[1] := TRUE;
book.hints[2] := StuffHex("00043020205081A000101081422812227018200A00E9921A000000408000000020000140201000001018301C0090000020002A1240600002080A000000B00100009000040082206400A0000920200001001200001010010060020402800120002000000000000000002000000000000000000000000000000000000000000000",'data);
book.hints[3] := StuffHex("100430200049008000309004700012827002020200450328500010288000000820001010201002020200E21F0002182020002A10620020180802000000101808009000047012006400C0000920080012001420004010000462821016000022000000000000000000002000004000000000008000200000000000000000000000",'data);

// Text Styles
s0 := {
	family: 'Geneva,
	face: 0,
	size: 9};
AddArraySlot(book.styles, s0);

s1 := {
	family: 'Espy,
	face: 0,
	size: 10};
AddArraySlot(book.styles, s1);

s2 := {
	family: 'Espy,
	face: 1,
	size: 10};
AddArraySlot(book.styles, s2);

s3 := {
	family: 'Geneva,
	face: 0,
	size: 9};
AddArraySlot(book.styles, s3);

s4 := {
	family: 'NewYork,
	face: 0,
	size: 10};
AddArraySlot(book.styles, s4);

s5 := {
	family: 'Geneva,
	face: 0,
	size: 12};
AddArraySlot(book.styles, s5);

s6 := {
	family: 'Espy,
	face: 1,
	size: 10};
AddArraySlot(book.styles, s6);


// Contents
c1 := {
	data: "This paragraph provides an example of the default layout. When no layout is defined, text fills a single main column that extends the entire width of the page.

Book Maker divdes the page into twelve vertical strips, called grid units, that are used to specify the width of columns defined by layout commands.

Because you can have only one layout command per page, you need to turn to the next page to see the next layout example in this book.
",
	styles: [224, s1, 10, s2, 211, s1, 1, s4]
};
book.contents[0] := c1;

c2 := {
	data: " .layout threeCol 4 4 4
",
	viewFont: s5,
	layout: 2
};
book.contents[1] := c2;

c3 := {
	data: "This paragraph uses the layout defined above. The threeCol layout divides the page into three equal columns of four grid units each. Text flows from the top of the leftmost column to the bottom of the rightmost.

Because you can have only one layout command per page, you need to turn to the next page to see the next layout example in this book.

This paragraph is repeated to fill all three columns.

This paragraph is repeated to fill all three columns.

This paragraph is repeated to fill all three columns"&".

This paragraph is repeated to fill all three columns.

This paragraph is repeated to fill all three columns.

This paragraph is repeated to fill all three columns.
",
	styles: [50, s1, 8, s6, 289, s1, 1, s3, 330, s1]
};
book.contents[2] := c3;

c4 := {
	data: " .layout simple 12

This paragraph uses the layout defined above. The simple layout is the same as the default layout: it defines a single main column that extends the entire width of the page (12 grid units.) By default, layout commands always define the main column unless they use the sidebar keyword to define a sidebar column. 
 
Its useful to define a layout like simple so that you can easily return to the default format after applying your own custom layout on a preceding page. 
",
	styles: [20, s5, 50, s1, 6, s6, 212, s1, 7, s6, 76, s1, 6, s6, 114, s1]
};
book.contents[3] := c4;


// Kiosk (menu page) references

// Page Templates
NBMDefault := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}]
};
AddArraySlot(book.templates, NBMDefault);
threeCol := {
	nColumns: 3,
	column: [{
	width: 4,
	type: 0}, {
	width: 4,
	type: 0}, {
	width: 4,
	type: 0}]
};
AddArraySlot(book.templates, threeCol);
simple := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}]
};
AddArraySlot(book.templates, simple);

// Bounds List
bnd1 := [0,16,240,318];
bnd2 := [0,16,240,48];
bnd3 := [0,48,78,318];
bnd4 := [82,48,160,318];
bnd5 := [163,48,240,318];
bnd6 := [0,16,240,230];

// Pages
pageList := {pageSize: {left: 0, top: 0, right: 240, bottom: 318},
	contents: [], pages: []};

// Page 1
page := MakePage(NBMDefault);
AddArraySlot(page.blocks, MakeBlock(bnd1, c1));
AddArraySlot(pageList.pages, page);

// Page 2
page := MakePage(threeCol);
AddArraySlot(page.blocks, MakeBlock(bnd2, c2));
AddArraySlot(page.blocks,
	{bounds: bnd3,
	item: c3,
	dataLen: 250});
AddArraySlot(page.blocks,
	{bounds: bnd4,
	item: c3,
	dataOffset: 250,
	dataLen: 223});
AddArraySlot(page.blocks,
	{bounds: bnd5,
	item: c3,
	dataOffset: 473,
	dataLen: 203});
AddArraySlot(pageList.pages, page);

// Page 3
page := MakePage(simple);
AddArraySlot(page.blocks, MakeBlock(bnd6, c4));
AddArraySlot(pageList.pages, page);

AddArraySlot(book.rendering, pageList);

// Browsers & Page Hints
b1 := {
	name: "Contents",  list: []
};
bp1 := [];		// Page Hints for list browser

AddArraySlot(book.browsers, b1);
AddArraySlot(pageList.contents, bp1);


// Indices and Sub-Indices
