Layout template

From MusiCAD

A layout template may be seen as a list of layout instructions that will produce a certain layout effect.

layout templates may be bound to a user-button by means of the shortcuts dialog.

Layout templates may be executed from the layout template dialog, a user button or shortcut-key

Layout templates contain plaintext (like all MusiCAD files) so they can be edited in an ordinary text editor (like notepad). You can edit from within MusiCAD using the edit-button edit in the layout templates dialog. A template file may look like:

melodie "MijnSjabloon";
!%TemplateNL: MijnNaam|MijnSjabloon
!%TemplateUK: MyName|MyTemplate
!%TemplateDE: MeineName|MeineSchablone
!# iMinDX=2;iMaxDX=16;iHeaderSize=23;iLineSpacing=0;iNBarsPerLine=4;
!# iStaffDist=0;iHdrDist=0;iResizeOrphanPct=21;iScaleHorizontal=85;
!# iScaleVertical=85;iPageLeft=15;iPageTop=10;iPageRight=15;iTempo=90;
!# bAutoBass=0;bAutoChords=0;fSelection=(Size=5, Y=7);fInfo=(Name=Arial);
!# fInfo3=(Name=Lucida Bright, Size=11, Style=fsBold, Color=clRed, Y=7);
!# fChords=(Size=14, Style=fsNarrow, Y=-12);

All non default style parameters are listed here. Any MusiCAD music or template file starts with a line: melodie "NAME";

Next three lines determine for supported languages (Dutch, English and German) the group to list with, and a description comment.

The rest of the lines list the parameters to be changed.

By the way, every MusiCAD melody lists its layout exactly the same way: parameterName=value;.


no(extra) staff distance (default is 2)

 !# iStaffDist=0;

set infotext3 font-style:

 !# fInfo3=(Name=Lucida Bright, Size=11, Style=fsBold, Color=clRed, Y=7);

In layout templates a few additional constructs may be used that are not allowed in music-fields:

 !# iScaleHorizontal=*+5;iScaleVertical=*+5;

The use of *+5 means add 5% to mentioned parameter.

Parameters that are meaningful for single parts - when used within a template - will set a value for all parts.

There is an alphabetical overview of all parameters for use in a template: template parameters

Template script

Layout templates may perform a few actions like selection, transposition, addition of parts and export of files in other formats (midi, pdf).

ADDPART( autopart );
SETPART( templateparameter, value );
TRANSPOSE( #semitones );
OPENLIST( play list );
SAVEFILE( extension )

A layout template that will split a double voiced part will have the following content:

 SETPART( sVoicename, Upper );  ! rename part to "Upper"'
 ADDPART( COPY1 ); ! Copy current part
 SETPART( sVoicename, Lower ); !rename part to "Lower"
 MODIFYPART( RemoveHighvoice ); ! remove top notes
 SELECTPART( sVoicename, Upper ); ! Select part "Upper" 
 MODIFYPART( RemoveLowvoice); ! remove bottom notes

Templates may be bound to shortcuts and even to a button on the buttonbar