Layout template: Difference between revisions

From MusiCAD
No edit summary
No edit summary
Line 1: Line 1:
A '''layout template''' may be seen as a list of layout instructions that will produce a certain layout effect.
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_definable_button|user-button]] by means of the [[shortcuts_dialog|shortcuts dialog]].
layout templates may be bound to a [[user_definable_button|user-button]] by means of the [[shortcuts dialog]].


Layout templates may be executed from the [[layout_templates_dialog|layout template dialog]], a [[user_definable_button|user button]] or [[shortcut|shortcut-key]]
Layout templates may be executed from the [[layout_templates_dialog|layout template dialog]], a [[user_definable_button|user button]] or [[shortcut|shortcut-key]]


Layout templates contain plaintext (like all MusiCAD files) so they can be edited in an ordinary texteditor (like notepad). You can edit from within MusiCAD using the edit-button {{btn|edit}} in the [[layout templates dialog]]. A template file may look like:
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 {{btn|edit}} in the [[layout templates dialog]]. A template file may look like:


  melodie "MijnSjabloon";
  melodie "MijnSjabloon";
Line 41: Line 41:


==== Template script ====
==== Template script ====
Layout templates may perform a few actions like selection, transposition, addition of parts and export of files in other formats ([[midi_file|midi]], [[portable_document_format|pdf]]).
Layout templates may perform a few actions like selection, transposition, addition of parts and export of files in other formats ([[midi file|midi]], [[portable document format|pdf]]).
  [[SELECTPART]]( MAIN|PREV|NEXT|FULL|LAST|naam );
  [[SELECTPART]]( MAIN|PREV|NEXT|FULL|LAST|naam );
  [[MODIFYPART]]( [[]] );
  [[MODIFYPART]]( [[]] );
Line 59: Line 59:
   MODIFYPART( RemoveLowvoice); ! ''remove bottom notes''
   MODIFYPART( RemoveLowvoice); ! ''remove bottom notes''


Templates may be bound to [[shortcuts]] and even to a button on the [[buttonbar|button-bar]]
Templates may be bound to [[shortcuts]] and even to a button on the [[buttonbar]]


[[nl:Opmaaksjablonen]]
[[nl:Opmaaksjablonen]]

Revision as of 21:53, 1 March 2023

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;.

Examples

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).

SELECTPART( MAIN|PREV|NEXT|FULL|LAST|naam );
MODIFYPART( [[]] );
ADDPART( autopart);
SETPART( templateparameter, value );
TRANSPOSE( #semitones );
OPENLIST( play list );
OPENFILE( PREV|NEXT|FIRST|LAST|name );
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