/usr/share/texmf-texlive/metapost/metauml/metauml_templates.mp is in texlive-metapost 2009-15.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 127 128 129 130 131 132 133 134 | % MetaUML, a MetaPost library for typesetting exquisite UML diagrams.
% Copyright (C) 2005 Ovidiu Gheorghies
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if known _metauml_templates_mp:
expandafter endinput
fi;
_metauml_templates_mp:=1;
input metauml_defaults;
input util_log;
vardef TemplateInfo@#=
color @#background;
color @#borderColor;
numeric @#borderScale;
@#background := .9white;
@#borderColor := black;
@#borderScale := 1;
FontInfo.@#iFont(metauml_defaultFont, .9);
PictureInfo.@#iPict(2, 2, 2, 2)(@#iFont);
PictureStackInfo.@#iStack(2, 2, 1, 1)(7)(@#iPict);
@#iStack.iPict.ignoreNegativeBase := 1;
enddef;
vardef TemplateInfoCopy@#(text src)=
color @#background;
color @#borderColor;
numeric @#borderScale;
@#background := src.background;
@#borderColor := src.borderColor;
@#borderScale := src.borderScale;
FontInfoCopy.@#iFont(src.iFont);
PictureInfoCopy.@#iPict(src.iPict);
PictureStackInfoCopy.@#iStack(src.iStack);
enddef;
TemplateInfo.iTemplate;
%
% Template
%
vardef ETemplate@#(text _info)(text templates) =
ObjectEquations(@#);
@#className := "Template";
TemplateInfoCopy.@#info(_info);
EPictureStack.@#elementsStack(@#info.iStack)(templates)("vleftbase");
@#nw = @#elementsStack.nw;
@#se = @#elementsStack.se;
enddef;
vardef Template@#(text templates) =
ETemplate@#(iTemplate)(templates);
enddef;
vardef EClassTemplate@#(text _info)(text templates)(text theClass)=
ETemplate.@#(_info)(templates);
Template_attachToClass.@#(theClass);
enddef;
vardef ClassTemplate@#(text templates)(text theClass)=
EClassTemplate.@#(iTemplate)(templates)(theClass);
enddef;
vardef Template_layout@#=
if @#layedout = 1:
log "Template " & (str @#) & " has already been layed out";
else:
@#layedout := 1;
log "Template layout: " & (str @#);
PictureStack_layout.@#elementsStack;
fi;
enddef;
vardef Template_paintSkin@# =
log "Painting template skin...";
fill objectBox(@#) withcolor @#info.background;
draw objectBox(@#) dashed evenly scaled .8
withpen pencircle scaled @#info.borderScale withcolor @#info.borderColor;
enddef;
vardef Template_draw@# =
Template_layout.@#;
Template_paintSkin.@#;
drawObject(@#elementsStack);
enddef;
vardef Template_attachToClass@#(text theClass)=
Template_layout.@#;
Class_layout.theClass;
log "--- Attaching template " & (str @#) & " to class " & (str theClass);
save __nItems, __nameToRight;
__nItems := @#elementsStack.nItems;
__nameToRight := theClass.right - theClass.namePict.right;
@#elementsStack.pict[__nItems-1].midy = theClass.top;
if __nameToRight > @#width/2:
@#midx = theClass.right;
log "X";
else:
@#midx = theClass.right + (@#width/2 - __nameToRight) + 2;
log "Y";
fi;
%@#elementsStack.pict[__nItems-1].info.boxed:=1;
enddef;
|