From c5d84d1a3ab85b1f314ff62717a7af3c6b75c7af Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Feb 2019 22:45:55 +0000 Subject: metauml (3feb19) git-svn-id: svn://tug.org/texlive/trunk@49923 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/metauml/metauml.mp | 19 +- .../metapost/metauml/metauml_activity.mp | 22 +- Master/texmf-dist/metapost/metauml/metauml_base.mp | 18 +- .../metapost/metauml/metauml_behavioral_common.mp | 22 +- .../texmf-dist/metapost/metauml/metauml_class.mp | 412 +++++++++++++-------- .../metapost/metauml/metauml_class_assoc.mp | 18 +- .../metapost/metauml/metauml_class_clipart.mp | 163 -------- .../metapost/metauml/metauml_class_relations.mp | 18 +- .../metapost/metauml/metauml_component.mp | 22 +- .../metauml/metauml_component_relations.mp | 18 +- .../metapost/metauml/metauml_defaults.mp | 18 +- .../metapost/metauml/metauml_instance.mp | 22 +- .../texmf-dist/metapost/metauml/metauml_links.mp | 18 +- Master/texmf-dist/metapost/metauml/metauml_note.mp | 22 +- .../texmf-dist/metapost/metauml/metauml_package.mp | 22 +- .../metapost/metauml/metauml_package_relations.mp | 18 +- .../texmf-dist/metapost/metauml/metauml_paths.mp | 18 +- .../metapost/metauml/metauml_skin_simple.mp | 18 +- .../texmf-dist/metapost/metauml/metauml_state.mp | 22 +- .../metapost/metauml/metauml_stereotype.mp | 18 +- .../metapost/metauml/metauml_templates.mp | 22 +- .../texmf-dist/metapost/metauml/metauml_usecase.mp | 26 +- .../metapost/metauml/metauml_usecase_clipart.mp | 22 +- Master/texmf-dist/metapost/metauml/util_commons.mp | 22 +- Master/texmf-dist/metapost/metauml/util_group.mp | 82 ++-- .../metapost/metauml/util_infrastructure.mp | 18 +- Master/texmf-dist/metapost/metauml/util_log.mp | 20 +- Master/texmf-dist/metapost/metauml/util_margins.mp | 18 +- Master/texmf-dist/metapost/metauml/util_object.mp | 62 ++-- Master/texmf-dist/metapost/metauml/util_picture.mp | 53 +-- .../metapost/metauml/util_picture_stack.mp | 62 ++-- .../metapost/metauml/util_positioning.mp | 20 +- Master/texmf-dist/metapost/metauml/util_shade.mp | 18 +- 33 files changed, 469 insertions(+), 904 deletions(-) delete mode 100644 Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp (limited to 'Master/texmf-dist/metapost') diff --git a/Master/texmf-dist/metapost/metauml/metauml.mp b/Master/texmf-dist/metapost/metauml/metauml.mp index 997728450b2..95748cf7678 100644 --- a/Master/texmf-dist/metapost/metauml/metauml.mp +++ b/Master/texmf-dist/metapost/metauml/metauml.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_mp: expandafter endinput @@ -51,7 +37,6 @@ inputonce metauml_note; inputonce metauml_stereotype; -inputonce metauml_class_clipart; inputonce metauml_class; inputonce metauml_instance; inputonce metauml_class_relations; diff --git a/Master/texmf-dist/metapost/metauml/metauml_activity.mp b/Master/texmf-dist/metapost/metauml/metauml_activity.mp index 7843b1da91c..79ac5042e29 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_activity.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_activity.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_activity_mp: expandafter endinput @@ -95,10 +81,10 @@ vardef EActivity@#(text _info)(text contents)= enddef; vardef Activity_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Activity " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; PictureStack_layout.@#stack; diff --git a/Master/texmf-dist/metapost/metauml/metauml_base.mp b/Master/texmf-dist/metapost/metauml/metauml_base.mp index e269fb34ec9..22f73d3906b 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_base.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_base.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2006 Ovidiu Gheorghies, Radu-George Radulescu -% -% 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. +% Copyright 2006 2015 Ovidiu Gheorghies, Radu-George Radulescu +% Licensed under the Apache License, Version 2.0. if known _metauml_base_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp b/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp index 271597027b3..190980eb690 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_behavioral_common_mp: expandafter endinput @@ -71,10 +57,10 @@ vardef Begin@#= enddef; vardef Begin_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Begin " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; @#width = @#info.diameter; @#height = @#info.diameter; diff --git a/Master/texmf-dist/metapost/metauml/metauml_class.mp b/Master/texmf-dist/metapost/metauml/metauml_class.mp index f99b134c0d4..c3ac333b214 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_class.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_class.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_class_mp: expandafter endinput @@ -24,12 +10,12 @@ _metauml_class_mp:=1; % The guard values (such as _metauml_mp) do ensure that the file isn't loaded multiple times, % but this macro makes sure that MetaPost won't try to load the file and display a message for that. def inputonce text libraryFile= - if not known scantokens ("_" & str libraryFile & "_mp"): - %includeonce% show "Loading " & str libraryFile; - scantokens ("input " & str libraryFile); - else: - %includeonce% show str libraryFile & " already loaded."; - fi; + if not known scantokens ("_" & str libraryFile & "_mp"): + %includeonce% show "Loading " & str libraryFile; + scantokens ("input " & str libraryFile); + else: + %includeonce% show str libraryFile & " already loaded."; + fi; enddef; inputonce metauml_defaults; @@ -39,86 +25,106 @@ inputonce util_picture; inputonce util_picture_stack; inputonce util_shade; -string accessPublic, accessProtected, accessPrivate; -accessPublic:="+"; -accessProtected:="#"; -accessPrivate:="-"; +string visibilityPublic, visibilityProtected, visibilityPrivate, visibilityPackage; +visibilityPublic:="+"; +visibilityProtected:="#"; +visibilityPrivate:="-"; +visibilityPackage:="~"; + +string metauml_private_abstractMarker, metauml_private_staticMarker; +metauml_private_abstractMarker := "@abstract"; +metauml_private_staticMarker := "@static"; + +def abstract expr methodName= metauml_private_abstractMarker&methodName enddef; +def static expr featureName= metauml_private_staticMarker&featureName enddef; + +def metauml_private_isAbstract(expr name) = (substring (0, 9) of name = metauml_private_abstractMarker) enddef; +def metauml_private_isStatic(expr name) = (substring (0, 7) of name = metauml_private_staticMarker) enddef; +def metauml_private_stripStatic(expr name) = substring (7,infinity) of name enddef; +def metauml_private_stripAbstract(expr name) = substring (9,infinity) of name enddef; vardef ClassInfo@#= attributes(@#); - var(numeric) featureAccessSpacing, accessWidth, accessHeight; var(color) foreColor, borderColor; + var(string) featureVisibilityMode; FontInfo.@#nameFont(metauml_defaultFont, defaultscale); - - FontInfo.@#attributeFont (metauml_defaultFont, defaultscale); - FontInfo.@#methodFont (metauml_defaultFont, defaultscale); + FontInfo.@#featureFont (metauml_defaultFont, defaultscale); FontInfo.@#stereotypeFont(metauml_defaultFont, .7); ShadeInfo.@#iShade; - @#featureAccessSpacing := 2; - @#accessWidth := 7; - @#accessHeight := 6.75; + @#featureVisibilityMode := "individual"; % "none", "grouped" @#foreColor := .9white; @#borderColor := black; PictureInfo.@#iName (2, 2, 1, 3)(@#nameFont); + @#iName.ignoreNegativeBase := 1; - PictureInfo.@#iStereotype(2, -5, 2, 2)(@#stereotypeFont); - PictureInfo.@#iAttribute (2, 2, 1.25, 0)(@#attributeFont); - PictureInfo.@#iMethod (2, 2, 1.25, 0)(@#methodFont); + PictureInfoCopy.@#iNameAbstract(@#iName); + @#iNameAbstract.iFont.name := metauml_defaultFontOblique; + + PictureInfo.@#iStereotype(2, 2, 2, 2)(@#stereotypeFont); + @#iStereotypeStack.iPict.ignoreNegativeBase := 1; PictureStackInfo.@#iStereotypeStack(2, 2, 1, 1)(5.5)(@#iStereotype); - PictureStackInfo.@#iAttributeStack (2, 2, 2.5, 2)(10.5)(@#iAttribute); % 8.5 - PictureStackInfo.@#iMethodStack (2, 2, 2.5, 2)(10.5)(@#iMethod); - @#iAttributeStack.iPict.bottom := 2; - %@#iAttributeStack.iPict.boxed := 1; - @#iMethodStack.iPict.bottom := 2; - %@#iMethodStack.iPict.boxed := 1; - LockInfo.@#iLock(@#accessWidth, @#accessHeight, .6, .15, .55, .4white, .6white, .7white, .3white); + PictureInfo.@#iFeature (2, 2, 1.25, 0)(@#featureFont); - @#iName.ignoreNegativeBase := 1; - @#iAttributeStack.iPict.ignoreNegativeBase := 1; - @#iMethodStack.iPict.ignoreNegativeBase := 1; - @#iStereotypeStack.iPict.ignoreNegativeBase := 1; + PictureInfoCopy.@#iFeatureAbstract (@#iFeature); + @#iFeatureAbstract.iFont.name := metauml_defaultFontOblique; + + PictureInfoCopy.@#iFeatureStatic (@#iFeature); + @#iFeatureStatic.textDecoration := "underline"; + + PictureStackInfo.@#iFeatureStack (2, 2, 2.5, 2)(10.5)(@#iFeature); + PictureStackInfoCopy.@#iAttributeStack(@#iFeatureStack); + PictureStackInfoCopy.@#iMethodStack(@#iFeatureStack); + + @#iFeatureStack.iPict.bottom := 2; + @#iFeatureStack.iPict.ignoreNegativeBase := 1; + + PictureStackInfoCopy.@#iAttributeVisibilityStack (@#iFeatureStack); + PictureStackInfoCopy.@#iMethodVisibilityStack (@#iFeatureStack); + + @#iAttributeVisibilityStack.right := 0; + @#iMethodVisibilityStack.right := 0; enddef; vardef ClassInfoCopy@#(text src)= log "ClassInfoCopy: Copying class"; attributes(@#); - var(numeric) featureAccessSpacing, accessWidth, accessHeight; + var(numeric) featureVisibilitySpacing, visibilityWidth, visibilityHeight; var(color) foreColor, borderColor; + var(string) featureVisibilityMode; FontInfoCopy.@#nameFont(src.nameFont); - - FontInfoCopy.@#attributeFont(src.attributeFont); - FontInfoCopy.@#methodFont(src.methodFont); + FontInfoCopy.@#featureFont(src.featureFont); FontInfoCopy.@#stereotypeFont(src.stereotypeFont); ShadeInfoCopy.@#iShade(src.iShade); - @#featureAccessSpacing := src.featureAccessSpacing; - @#accessWidth := src.accessWidth; - @#accessHeight := src.accessHeight; - @#foreColor := src.foreColor; @#borderColor := src.borderColor; - PictureInfoCopy.@#iName (src.iName); + PictureInfoCopy.@#iName (src.iName); + PictureInfoCopy.@#iNameAbstract (src.iNameAbstract); PictureInfoCopy.@#iStereotype(src.iStereotype); - PictureInfoCopy.@#iAttribute (src.iAttribute); - PictureInfoCopy.@#iMethod (src.iMethod); + PictureInfoCopy.@#iFeature (src.iFeature); + PictureInfoCopy.@#iFeatureAbstract (src.iFeatureAbstract); + PictureInfoCopy.@#iFeatureStatic (src.iFeatureStatic); PictureStackInfoCopy.@#iStereotypeStack(src.iStereotypeStack); + PictureStackInfoCopy.@#iFeatureStack (src.iFeatureStack); PictureStackInfoCopy.@#iAttributeStack (src.iAttributeStack); PictureStackInfoCopy.@#iMethodStack (src.iMethodStack); + PictureStackInfoCopy.@#iAttributeVisibilityStack (src.iAttributeVisibilityStack); + PictureStackInfoCopy.@#iMethodVisibilityStack (src.iMethodVisibilityStack); - LockInfoCopy.@#iLock(src.iLock); + @#featureVisibilityMode := src.featureVisibilityMode; enddef; ClassInfo.iClass; @@ -136,7 +142,8 @@ iInterface.iAttributeStack.top := 0; iInterface.iAttributeStack.bottom := 0; iInterface.iName.iFont.name := metauml_defaultFontOblique; -ClassInfoCopy.iAbstractClass(iInterface); +ClassInfoCopy.iAbstractClass(iClass); +iAbstractClass.iName.iFont.name := metauml_defaultFontOblique; % % CLASS @@ -146,19 +153,30 @@ vardef defClass@#(expr pname) = @#className := "Class"; string @#name; - @#name = pname; + boolean @#isAbstract; + + @#isAbstract := metauml_private_isAbstract(pname); + if @#isAbstract: + @#name = metauml_private_stripAbstract(pname); + else: + @#name = pname; + fi numeric @#nStereotypes; string @#stereotypes[]; string @#attributes[]; - string @#attributesAccess[]; + string @#attributesVisibility[]; + boolean @#attributesIsStatic[]; string @#methods[]; - string @#methodsAccess[]; + string @#methodsVisibility[]; + boolean @#methodsIsStatic[]; + boolean @#methodsIsAbstract[]; numeric @#nAttrs; numeric @#nMethods; + numeric @#nStereotypes; @#nStereotypes := 0; @#nAttrs := 0; @@ -166,56 +184,86 @@ vardef defClass@#(expr pname) = enddef; vardef addAttribute@#(expr pcontent) = - string access; - access := substring(0,1) of pcontent; - if (not (access = accessPublic)) and - (not (access = accessPrivate)) and - (not (access = accessProtected)): - - @#.attributes[@#.nAttrs] := pcontent; - @#.attributesAccess[@#.nAttrs] := accessProtected; + string visibility; + string attribute; + + attribute := pcontent; + + @#attributesIsStatic[@#nAttrs] := metauml_private_isStatic(attribute); + if @#attributesIsStatic[@#nAttrs]: + attribute := metauml_private_stripStatic(attribute); + fi + + visibility := substring(0,1) of attribute; + if (not (visibility = visibilityPublic)) and + (not (visibility = visibilityPrivate)) and + (not (visibility = visibilityProtected)) and + (not (visibility = visibilityPackage)): + + @#.attributes[@#.nAttrs] := attribute; + @#.attributesVisibility[@#.nAttrs] := visibilityPackage; else: save from; from := 1; - if (substring(1,2) of pcontent) = " ": from := 2; fi; + if (substring(1,2) of attribute) = " ": from := 2; fi; - @#.attributes[@#.nAttrs] := substring(from, infinity) of pcontent; - @#.attributesAccess[@#.nAttrs] := access; + @#.attributes[@#.nAttrs] := substring(from, infinity) of attribute; + @#.attributesVisibility[@#.nAttrs] := visibility; fi; @#.nAttrs := @#.nAttrs + 1; enddef; vardef addMethod@#(expr pcontent) = - string access; - access := substring(0,1) of pcontent; - if (not (access = accessPublic)) and - (not (access = accessPrivate)) and - (not (access = accessProtected)): - - @#.methods[@#.nMethods] := pcontent; - @#.methodsAccess[@#.nMethods] := accessProtected; + string visibility; + string method; + + method := pcontent; + + @#methodsIsStatic[@#nMethods] := metauml_private_isStatic(method); + if @#methodsIsStatic[@#nMethods]: + method := metauml_private_stripStatic(method); + fi + + @#methodsIsAbstract[@#nMethods] := metauml_private_isAbstract(method); + if @#methodsIsAbstract[@#nMethods]: + method := metauml_private_stripAbstract(method); + @#isAbstract := true; + fi + + visibility := substring(0,1) of method; + if (not (visibility = visibilityPublic)) and + (not (visibility = visibilityPrivate)) and + (not (visibility = visibilityProtected)) and + (not (visibility = visibilityPackage)): + + @#.methods[@#.nMethods] := method; + @#.methodsVisibility[@#.nMethods] := visibilityPackage; else: - @#.methods[@#.nMethods] := substring(1, 999) of pcontent; - @#.methodsAccess[@#.nMethods] := access; + save from; + from := 1; + if (substring(1,2) of method) = " ": from := 2; fi; + + @#.methods[@#.nMethods] := substring(from, infinity) of method; + @#.methodsVisibility[@#.nMethods] := visibility; fi; @#.nMethods := @#.nMethods + 1; enddef; vardef classStereotype@#(expr pcontent) = - @#stereotypes[@#nStereotypes] := pcontent; - @#nStereotypes := @#nStereotypes + 1; + show "Macro classStereotype is deprecated, use Class_stereotypes instead."; + Class_stereotypes.@#(pcontent); enddef; vardef classStereotypes@#(text stereotypes)= - for stereotype = stereotypes: - classStereotype@#(stereotype); - endfor; + show "Macro classStereotypes is deprecated, use Class_stereotypes instead."; + Class_stereotypes.@#(stereotypes); enddef; vardef EClass@#(text _info)(expr name)(text attributes)(text methods)= log "EClass begin: " & str @#; + defClass@#(name); log "Copying class info"; @@ -263,87 +311,126 @@ vardef Class_border@#= objectBox(@#) enddef; +vardef Class_noVisibilityMarkers@#= + @#info.featureVisibilityMode := "none"; +enddef; + vardef Class_layout@# = - if @#layedout = 1: + if @#laidout = 1: log "Class " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Class layout: " & (str @#); - @#maxFeatureWidth := 0; - EPictureStack.@#stereotypeStack(@#info.iStereotypeStack) (scantokens listArray(@#stereotypes)(@#nStereotypes))("vcenterbase"); - EPicture.@#namePict(@#info.iName)(@#name); + if (@#isAbstract): + EPicture.@#namePict(@#info.iNameAbstract)(@#name); + else: + EPicture.@#namePict(@#info.iName)(@#name); + fi; + + layoutObjects(@#stereotypeStack, @#namePict); + + % Define attributes + + def metauml_private_attributeStyleSupplier(expr i)= + if @#attributesIsStatic[i]: @#info.iFeatureStatic + else: @#info.iFeature + fi + enddef; + + @#info.iAttributeStack.childStyleSupplier := "metauml_private_attributeStyleSupplier"; + EPictureStack.@#attributeStack(@#info.iAttributeStack) (scantokens listArray(@#attributes)(@#nAttrs))("vleftbase"); + + if @#info.featureVisibilityMode = "individual": + vardef joinCallbackAttributesVisibility@#= + setObjectJoin(pb.bottom = @#.attributeStack.pict[index].bottom; pb.midx = pa.midx); + setObjectJoinFirst(pa.bottom = @#.attributeStack.pict[index].bottom); + enddef; + + EPictureStack.@#attributeVisibilityStack(@#info.iAttributeVisibilityStack) + (scantokens listArray(@#attributesVisibility)(@#nAttrs)) + ("joinCallbackAttributesVisibility." & (str @#)); + elseif @#info.featureVisibilityMode = "none": + EPicture.@#attributeVisibilityStack(iPictNoMargins)(""); + else: + show "Unknown feature visibility mode", @#featureVisibilityMode; + 1=2; + fi; + + % Define methods + + def metauml_private_methodStyleSupplier(expr i)= + if @#methodsIsStatic[i]: @#info.iFeatureStatic + elseif @#methodsIsAbstract[i]: @#info.iFeatureAbstract + else: @#info.iFeature + fi + enddef; + + @#info.iMethodStack.childStyleSupplier := "metauml_private_methodStyleSupplier"; + EPictureStack.@#methodStack(@#info.iMethodStack) (scantokens listArray(@#methods)(@#nMethods))("vleftbase"); - layoutObjects(@#stereotypeStack, @#namePict, @#attributeStack, @#methodStack); + if @#info.featureVisibilityMode = "individual": + vardef joinCallbackMethodsVisibility@#= + setObjectJoin(pb.bottom = @#.methodStack.pict[index].bottom; pb.midx = pa.midx); + setObjectJoinFirst(pa.bottom = @#.methodStack.pict[index].bottom); + enddef; + + EPictureStack.@#methodVisibilityStack(@#info.iMethodVisibilityStack) + (scantokens listArray(@#methodsVisibility)(@#nMethods)) + ("joinCallbackMethodsVisibility." & (str @#)); + elseif @#info.featureVisibilityMode = "none": + EPicture.@#methodVisibilityStack(iPictNoMargins)(""); + else: + show "Unknown feature visibility mode", @#featureVisibilityMode; + 1=2; + fi; + + % Integrate components + show layoutObjects(@#attributeStack, @#methodStack); + layoutObjects(@#attributeStack, @#methodStack); + + @#attributeStack.left = @#methodStack.left; + @#methodStack.top = @#attributeStack.bottom; - log "Computing maxFeatureWidth"; - log @#stereotypeStack.width; - log @#namePict.width; - log @#attributeStack.width; - log @#methodStack.width; - log "..."; - @#maxFeatureWidth := lmax(@#stereotypeStack.width, @#namePict.width, - @#attributeStack.width, @#methodStack.width); - log "Done computing maxFeatureWidth"; + layoutObjects(@#attributeVisibilityStack, @#methodVisibilityStack); - log "max feature width: " & decimal @#maxFeatureWidth; + @#attributeVisibilityStack.midx = @#methodVisibilityStack.midx; - @#namePict.midx = @#midx; - @#stereotypeStack.midx = @#namePict.midx; + if (@#.nMethods = 0) or (@#info.featureVisibilityMode="none"): + @#methodVisibilityStack.top = @#methodStack.top; + fi; + if (@#.nAttrs = 0) or (@#info.featureVisibilityMode="none"): + @#attributeVisibilityStack.top = @#attributeStack.top; + fi; - @#stereotypeStack.top = @#top; - @#namePict.top = @#stereotypeStack.bottom; - @#attributeStack.top = @#namePict.bottom; - @#methodStack.top = @#attributeStack.bottom; + EGroup.@#visibilityStacks(iGroupNoMargins)(@#attributeVisibilityStack, @#methodVisibilityStack); + + EGroup.@#featureStacks(iGroupNoMargins)(@#attributeStack, @#methodStack); - @#attributeStack.left = @#methodStack.left = - @#left + @#info.accessWidth + @#info.featureAccessSpacing; + layoutObjects(@#visibilityStacks, @#featureStacks); - @#width = @#maxFeatureWidth + @#info.accessWidth + @#info.featureAccessSpacing; - @#bottom = @#methodStack.bottom; + @#visibilityStacks.right = @#featureStacks.left; - log "Class layout done..."; - fi; -enddef; - -vardef Class_paintAccess@#(expr _access, _se) = - save lock; - ELock.lock(@#info.iLock)(_access); - lock.se = _se; - drawObject(lock); -enddef; + EGroup.@#featureGroup(iGroupNoMargins)(@#visibilityStacks, @#featureStacks); -vardef Class_drawFeatures@#= - log "Drawing stereotypes"; - drawObject(@#stereotypeStack); + topToBottom(0)(@#stereotypeStack, @#namePict, @#featureGroup); - log "Drawing name"; - drawObject(@#namePict); - log "Drawing attribute stack"; - drawObject(@#attributeStack); + EGroup.@#all(iGroupNoMargins)(@#stereotypeStack, @#namePict, @#featureGroup); - log "Drawing method stack"; - drawObject(@#methodStack); + layoutObjects(@#all); - log "********************************** Drawing access locks"; - for i = 0 upto @#nAttrs-1: - log @#attributesAccess[i]; - Class_paintAccess@#(@#attributesAccess[i], - @#attributeStack.pict[i].sw + (-@#info.featureAccessSpacing, @#info.iAttributeStack.iPict.bottom)); - endfor; + @#.nw = @#all.nw; + @#.se = @#all.se; - for i = 0 upto @#nMethods-1: - log @#methodsAccess[i]; - Class_paintAccess@#(@#methodsAccess[i], - @#methodStack.pict[i].sw + (-@#info.featureAccessSpacing, @#info.iMethodStack.iPict.bottom)); - endfor; + log "Class layout for " & (str @#) & " done..."; + fi; enddef; vardef Class_paintSkin@# = @@ -351,31 +438,48 @@ vardef Class_paintSkin@# = nameAttributeY := @#attributeStack.top; attributeMethodY := @#methodStack.top; - %fill Class_border.@# shifted (@#info.shade,-@#info.shade) - % withcolor .7white withpen currentpen scaled 1; - drawObjectShade(@#); + drawObjectShade(@#); - fill Class_border.@# withcolor @#info.foreColor; - draw Class_border.@# withcolor @#info.borderColor; + fill Class_border.@# withcolor @#info.foreColor; + draw Class_border.@# withcolor @#info.borderColor; - draw (xpart @#nw, nameAttributeY)--(xpart @#se, nameAttributeY) withcolor @#info.borderColor; - draw (xpart @#nw, attributeMethodY)--(xpart @#se, attributeMethodY) withcolor @#info.borderColor; + draw (xpart @#nw, nameAttributeY)--(xpart @#se, nameAttributeY) withcolor @#info.borderColor; + draw (xpart @#nw, attributeMethodY)--(xpart @#se, attributeMethodY) withcolor @#info.borderColor; enddef; vardef Class_draw@#= - log "draw class begin..."; + log "Class_draw begin " & @#; Class_layout.@#; objectEnsurePositioning.@#; Class_paintSkin.@#; - Class_drawFeatures.@#; + + drawObjects(@#all); + log "Class_draw end " & @#; enddef; vardef Class_setDebugMode@#= @#.info.iName.boxed := 1; + + @#.info.iFeature.boxed := 1; + @#.info.iFeatureStatic.boxed := 1; + @#.info.iFeatureAbstract.boxed := 1; + @#.info.iStereotypeStack.boxed := 1; @#.info.iStereotypeStack.iPict.boxed := 1; @#.info.iAttributeStack.boxed := 1; @#.info.iAttributeStack.iPict.boxed := 1; @#.info.iMethodStack.boxed := 1; @#.info.iMethodStack.iPict.boxed := 1; + + @#.info.iAttributeVisibilityStack.boxed := 1; + @#.info.iAttributeVisibilityStack.iPict.boxed := 1; + @#.info.iMethodVisibilityStack.boxed := 1; + @#.info.iMethodVisibilityStack.iPict.boxed := 1; +enddef; + +vardef Class_stereotypes@#(text _stereotypes)= + for stereotype = _stereotypes: + @#stereotypes[@#nStereotypes] := stereotype; + @#nStereotypes := @#nStereotypes + 1; + endfor; enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp b/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp index fb7786b8794..720117fc90b 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_class_assoc_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp b/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp deleted file mode 100644 index faa175494e8..00000000000 --- a/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp +++ /dev/null @@ -1,163 +0,0 @@ -% 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_class_clipart_mp: - expandafter endinput -fi; -_metauml_class_clipart_mp:=1; - -% Sadly, this copy of the macro is needed to prevent multiple file loads being shown by MetaPost. -% The guard values (such as _metauml_mp) do ensure that the file isn't loaded multiple times, -% but this macro makes sure that MetaPost won't try to load the file and display a message for that. -def inputonce text libraryFile= - if not known scantokens ("_" & str libraryFile & "_mp"): - %includeonce% show "Loading " & str libraryFile; - scantokens ("input " & str libraryFile); - else: - %includeonce% show str libraryFile & " already loaded."; - fi; -enddef; - -inputonce util_log; - -%% -%% This file contains various drawing which can be used in -%% UML class diagrams -%% - -vardef LockInfo@#(expr _width, _height, _y, _d, _span, _faceColor, _topColor, _rightColor, _lockColor)= - numeric @#y, @#d, @#span, @#width, @#height; - color @#faceColor, @#topColor, @#rightColor, @#lockColor; - - @#width := _width; - @#height := _height; - - @#heightRatio := _y; - @#depthRatio := _d; - @#span := _span; - - @#faceColor := _faceColor; - @#topColor := _topColor; - @#rightColor := _rightColor; - @#lockColor := _lockColor; -enddef; - -vardef LockInfoCopy@#(text src)= - LockInfo@#(src.width, src.height, src.heightRatio, src.depthRatio, src.span, - src.faceColor, src.topColor, src.rightColor, src.lockColor); -enddef; - -LockInfo.iLock(8, 8, .55, .15, .55, .4white, .6white, .7white, .3white); - -def lockLockPen=pencircle scaled .8pt enddef; -def lockLockTension=tension(1) enddef; - -vardef ELock@#(text lockInfo)(expr how)= - ObjectEquations(@#); - @#className := "Lock"; - - generic_declare(path) _n.pFace, _n.pRight, _n.pTop; - generic_declare(path) _n.pLock; - generic_declare(string) _n.mode; - - LockInfoCopy.@#info(lockInfo); - - @#height = @#info.height; - @#width = @#info.width; - - @#mode := how; - - log "ELock completed"; -enddef; - -vardef Lock@#(expr how)= - ELock@#(iLock)(how); -enddef; - -vardef Lock_draw@#= - log "Drawing lock"; - log @#nw; - log @#se; - generic_declare(numeric) _n.depth,_n.ya, _n.xa; - - @#depth = @#info.width * @#info.depthRatio; - @#ya = ypart @#nw - @#height * @#info.heightRatio; - @#xa = xpart @#se - @#depth; - - @#pFace = (xpart @#nw, @#ya) -- (@#xa, @#ya) -- (@#xa, ypart @#se) -- (xpart @#nw, ypart @#se) -- cycle; - @#pRight = (@#xa, ypart @#se) -- (xpart @#se, ypart @#se + @#depth) -- - (xpart @#se, @#ya + @#depth) -- (@#xa, @#ya) -- cycle; - @#pTop = (@#xa, @#ya) -- (xpart @#se, @#ya + @#depth) -- - (xpart @#nw + @#depth, @#ya + @#depth) -- (xpart @#nw, @#ya) -- cycle; - - save myMode; string myMode; - myMode = "base"; - if ((@#mode="private") or (@#mode="-")): - myMode := "closed"; - elseif ((@#mode="protected") or (@#mode="#")): - myMode := "opened"; - fi; - - if myMode="closed": - log "Closed!"; - generic_declare(pair) _n.A, _n.B, _n.C, _n.M; - generic_declare(numeric) _n.span; - @#span = @#info.span * @#width; - - @#M = ((xpart @#se + xpart @#nw) / 2, @#ya + @#depth/2); - log @#M; - @#A = (xpart @#M - (@#span / 2), ypart @#M); - log @#A; - @#B = (xpart @#M + (@#span / 2), ypart @#M); - log @#B; - @#C = (xpart @#M, ypart @#nw); - log @#C; - linecap:=butt; - - @#pLock = @#A {curl 0}..lockLockTension .. @#C .. lockLockTension .. {curl 0} @#B; - %withcolor @#info.lockColor withpen lockLockPen; - elseif myMode="opened": - log "Opened!"; - - generic_declare(pair) _n.A, _n.B, _n.C, _n.M; - generic_declare(numeric) _n.span; - @#span = @#info.span * @#width; - - @#M = ((xpart @#se + xpart @#nw) / 2, @#ya + @#depth/2); - @#A = (xpart @#M - (@#span / 2), ypart @#M) + (0, @#height/3); - @#B = (xpart @#M + (@#span / 2), ypart @#M); - @#C = (xpart @#M, ypart @#nw); - log @#M, @#A, @#B, @#C; - - linecap:=butt; - - @#pLock = @#A {curl 0}..lockLockTension .. @#C .. lockLockTension .. {curl 0} @#B; - %withcolor @#info.lockColor withpen lockLockPen; - fi; - - fill @#pFace withcolor @#info.faceColor; - fill @#pRight withcolor @#info.rightColor; - fill @#pTop withcolor @#info.topColor; - - if not ((myMode = "opened") or (myMode="closed")): - log "No lock to draw..."; - else: - draw @#pLock withcolor @#info.lockColor withpen lockLockPen; - fi; -enddef; - - diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp b/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp index 00306bd3882..0379aceecac 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_class_relations_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_component.mp b/Master/texmf-dist/metapost/metauml/metauml_component.mp index d0d531d872c..c124f771108 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_component.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_component.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2006 Radu-George Radulescu, 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. +% Copyright 2006 2015 Radu-George Radulescu, Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_component_mp: expandafter endinput @@ -108,10 +94,10 @@ vardef EComponent@#(text _info)(text contents)(text _subItems)= enddef; vardef Component_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Component '" & (str @#) & "' has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Component layout: '" & (str @#) & "'"; log "Component name layout '" & (str @#) & "'..."; diff --git a/Master/texmf-dist/metapost/metauml/metauml_component_relations.mp b/Master/texmf-dist/metapost/metauml/metauml_component_relations.mp index 3c8f68c225e..e6800a2acb5 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_component_relations.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_component_relations.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2006 Radu-George Radulescu, 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. +% Copyright 2006 2015 Radu-George Radulescu, Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_component_relations_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_defaults.mp b/Master/texmf-dist/metapost/metauml/metauml_defaults.mp index db1183a52bf..228df4c48c0 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_defaults.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_defaults.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_defaults_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_instance.mp b/Master/texmf-dist/metapost/metauml/metauml_instance.mp index cbe3b64f611..543920eb49b 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_instance.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_instance.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2005 Radu-George Radulescu -% -% 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. +% Copyright 2005 2015 Radu-George Radulescu +% Licensed under the Apache License, Version 2.0. if known _metauml_instance_mp: expandafter endinput @@ -131,10 +117,10 @@ vardef Instance_border@#= enddef; vardef Instance_layout@# = - if @#layedout = 1: + if @#laidout = 1: log "Instance " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Instance layout: " & (str @#); @#maxFeatureWidth := 0; diff --git a/Master/texmf-dist/metapost/metauml/metauml_links.mp b/Master/texmf-dist/metapost/metauml/metauml_links.mp index 3b54368012b..06a9dbabba5 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_links.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_links.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. % A LinkStructure is used to compute the relevant elements % of a link, such as what is the main path of the link and diff --git a/Master/texmf-dist/metapost/metauml/metauml_note.mp b/Master/texmf-dist/metapost/metauml/metauml_note.mp index c0f1252cbf2..083b686f65e 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_note.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_note.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_note_mp: expandafter endinput @@ -109,10 +95,10 @@ vardef ENote@#(text _info)(text contents)= enddef; vardef Note_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Note " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Note layout: " & (str @#); PictureStack_layout.@#stack; diff --git a/Master/texmf-dist/metapost/metauml/metauml_package.mp b/Master/texmf-dist/metapost/metauml/metauml_package.mp index 8394efcaf2a..2e76c41fd12 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_package.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_package.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2006 Radu-George Radulescu, 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. +% Copyright 2006 2015 Radu-George Radulescu, Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_package_mp: expandafter endinput @@ -115,10 +101,10 @@ vardef EPackage@#(text _info)(text contents)(text _subItems)= enddef; vardef Package_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Package '" & (str @#) & "' has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Package layout: '" & (str @#) & "'"; log "Package name layout '" & (str @#) & "'..."; diff --git a/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp b/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp index 5b740c0557f..87f1cc4dd11 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp @@ -1,19 +1,5 @@ -% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2006 Radu-George Radulescu -% -% 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. +% Copyright 2006 2015 Radu-George Radulescu +% Licensed under the Apache License, Version 2.0. if known _metauml_package_relations_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_paths.mp b/Master/texmf-dist/metapost/metauml/metauml_paths.mp index d0fc27bb332..d93832fd0f1 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_paths.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_paths.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_paths_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp b/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp index afafe88fab8..3225eb8fc3b 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. %% Usage of skins %% diff --git a/Master/texmf-dist/metapost/metauml/metauml_state.mp b/Master/texmf-dist/metapost/metauml/metauml_state.mp index fb9875e262a..08b5d3be244 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_state.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_state.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_state_mp: expandafter endinput @@ -119,10 +105,10 @@ vardef State_internalTransitions@#(text transitions)= enddef; vardef State_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "State '" & (str @#) & "' has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "State layout: '" & (str @#) & "'"; EPictureStack.@#internalTransitionsStack(@#info.iStack) diff --git a/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp b/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp index 64beff494d8..9251c308339 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_stereotype_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/metauml_templates.mp b/Master/texmf-dist/metapost/metauml/metauml_templates.mp index 4ce5fc44e78..940377bc202 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_templates.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_templates.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_templates_mp: expandafter endinput @@ -96,10 +82,10 @@ vardef ClassTemplate@#(text templates)(text theClass)= enddef; vardef Template_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Template " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Template layout: " & (str @#); PictureStack_layout.@#elementsStack; fi; diff --git a/Master/texmf-dist/metapost/metauml/metauml_usecase.mp b/Master/texmf-dist/metapost/metauml/metauml_usecase.mp index e9edf9471b2..f9c666abf3f 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_usecase.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_usecase.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _metauml_usecase_mp: expandafter endinput @@ -82,10 +68,10 @@ vardef Actor_setDebugMode@#= enddef; vardef Actor_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Actor " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Actor layout: " & (str @#); Human_layout.@#human; PictureStack_layout.@#nameStack; @@ -172,10 +158,10 @@ vardef EUsecase@#(text _info)(text contents)= enddef; vardef Usecase_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Usecase " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; EPictureStack.@#nameStack(@#info.iNameStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); PictureStack_layout.@#nameStack; diff --git a/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp b/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp index a4750b5f52f..3344454bc43 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp @@ -1,19 +1,5 @@ -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. %% %% This file contains various drawings which can be used in @@ -92,10 +78,10 @@ vardef Human@#= enddef; vardef Human_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "Human " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; log "Human layout: " & (str @#); attributes(@#); diff --git a/Master/texmf-dist/metapost/metauml/util_commons.mp b/Master/texmf-dist/metapost/metauml/util_commons.mp index 1229da6b025..3ff7f06e833 100644 --- a/Master/texmf-dist/metapost/metauml/util_commons.mp +++ b/Master/texmf-dist/metapost/metauml/util_commons.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_commons_mp: expandafter endinput @@ -74,13 +60,13 @@ vardef lmin(text items)= current enddef; -def max(text a)(text b)= +def _max(text a)(text b)= if (a > b): a% else:b% fi; enddef; -def min(text a)(text b)= +def _min(text a)(text b)= if (a < b): a% else:b% fi; diff --git a/Master/texmf-dist/metapost/metauml/util_group.mp b/Master/texmf-dist/metapost/metauml/util_group.mp index 1a3380c9f5c..7dad82ba023 100644 --- a/Master/texmf-dist/metapost/metauml/util_group.mp +++ b/Master/texmf-dist/metapost/metauml/util_group.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_group_mp: expandafter endinput @@ -57,6 +43,7 @@ vardef GroupInfoCopy@#(text src)= enddef; GroupInfo.iGroup(2, 2, 2, 2); +GroupInfo.iGroupNoMargins(0, 0, 0, 0); GroupInfoCopy.iGroupBoxed(iGroup); iGroupBoxed.boxed := 1; @@ -88,19 +75,22 @@ vardef Group@#(text objects)= enddef; vardef Group_layout@#= - if @#layedout = 0: + if @#laidout = 0: log "Needing layout for group " & (str @#); - @#layedout := 1; + @#laidout := 1; + + log "Calling layout for objects in group '" & (str @#) & "' ."; + log " Objects are: '" & @#objectsAsString & "'."; if (@#objectsAsString = ""): + log "Empty layout begin"; @#width = @#info.left + @#info.right; @#height = @#info.top + @#info.bottom; + log "Empty layout end"; else: - log "Calling layout for objects group '" & (str @#) & "' ..."; - log " object are: '" & @#objectsAsString & "'."; - + log "Layout with content"; layoutObjects(scantokens @#objectsAsString); - log "All objects in group '" & (str @#) & "' are now layed out."; + log "All objects in group '" & (str @#) & "' are now laid out."; % As already tested, @#objectsAsString must be <> "". % See page 53, User's manual for MetaPost @@ -108,51 +98,57 @@ vardef Group_layout@#= % executed, with the loop index parameter set to % the empty suffix" (!) - log "Proceeding to finding min/max x/y of objects:"; - log " " & @#objectsAsString; + log "Group_layout: finding min/max x/y of objects:" & @#objectsAsString; __objectIndex := 0; forsuffixes obj__ = scantokens @#objectsAsString: if __objectIndex = 0: - log "First object " & str obj__; + log "Group_layout: first object " & str obj__ & ", initial minx, maxx, miny, maxy follow."; @#minx := obj__.left; - log @#maxx; - log obj__.right; @#maxx := obj__.right; - log @#maxx; @#miny := obj__.bottom; @#maxy := obj__.top; + log @#minx; + log @#maxx; + log @#miny; + log @#maxy; __objectIndex := __objectIndex + 1; else: - log "Current object " & str obj__; + log "Group_layout: current object " & str obj__; - log "comparing(min)"; + log "comparing minx"; log @#minx; - log @#obj__.left; - @#minx := min(@#minx)(obj__.left); + log obj__.left; + @#minx := min(@#minx, obj__.left); - log "comparing(max)"; + log "comparing maxx"; log @#maxx; - log @#obj__.right; - @#maxx := max(@#maxx)(obj__.right); + log obj__.right; + @#maxx := max(@#maxx, obj__.right); - log "comparing(min)"; + log "comparing miny"; log @#miny; - log @#obj__.bottom; - @#miny := min(@#miny)(obj__.bottom); + log obj__.bottom; + @#miny := min(@#miny, obj__.bottom); - log "comparing(max)"; + log "comparing maxy"; log @#maxy; - log @#obj__.top; - @#maxy := max(@#maxy)(obj__.top); + log obj__.top; + @#maxy := max(@#maxy, obj__.top); __objectIndex := __objectIndex + 1; fi; endfor; - log "... done iterating"; - log "maxx = "; + log "Group_layout: finding min/max x/y: done."; + log @#minx; log @#maxx; + log @#miny; + log @#maxy; + + log "Group_layout: about to set nw, se"; + log @#nw; + log @#se; @#nw = (@#minx - @#info.left, @#maxy + @#info.top); @#se = (@#maxx + @#info.right, @#miny - @#info.bottom); diff --git a/Master/texmf-dist/metapost/metauml/util_infrastructure.mp b/Master/texmf-dist/metapost/metauml/util_infrastructure.mp index 457f6bf89ca..8e6c2ed05d7 100644 --- a/Master/texmf-dist/metapost/metauml/util_infrastructure.mp +++ b/Master/texmf-dist/metapost/metauml/util_infrastructure.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_infrastructure_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/util_log.mp b/Master/texmf-dist/metapost/metauml/util_log.mp index d7adb3c8589..61c86ec8d6c 100644 --- a/Master/texmf-dist/metapost/metauml/util_log.mp +++ b/Master/texmf-dist/metapost/metauml/util_log.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. %%% if known _util_log_mp: %%% expandafter endinput @@ -38,7 +24,7 @@ enddef; def log text txt= if (util_log_defaultlevel <= util_log_thresholdlevel): - %includeonce% show txt + show txt else: % do nothing fi; diff --git a/Master/texmf-dist/metapost/metauml/util_margins.mp b/Master/texmf-dist/metapost/metauml/util_margins.mp index 508a0e6bb44..7b014ee9e7d 100644 --- a/Master/texmf-dist/metapost/metauml/util_margins.mp +++ b/Master/texmf-dist/metapost/metauml/util_margins.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_margins_mp: expandafter endinput diff --git a/Master/texmf-dist/metapost/metauml/util_object.mp b/Master/texmf-dist/metapost/metauml/util_object.mp index 52f932ddc34..fbc569dd6fe 100644 --- a/Master/texmf-dist/metapost/metauml/util_object.mp +++ b/Master/texmf-dist/metapost/metauml/util_object.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_object_mp: expandafter endinput @@ -48,9 +34,9 @@ def ObjectEquations(suffix $)= var(picture) pict; var(string) className; - var(numeric) layedout, drawn; + var(numeric) laidout, drawn; - $.layedout := 0; + $.laidout := 0; $.drawn := 0; $.left = xpart $.nw = xpart $.sw; @@ -86,7 +72,7 @@ vardef objectBorder(suffix @#)= save methodName; string methodName; methodName := @#className & "_border"; - log "invoking " & methodName & " arg=" & str @#; + log "objectBorder: invoking " & methodName & " arg=" & str @#; scantokens (methodName).@# enddef; @@ -105,7 +91,7 @@ vardef layoutObject(suffix @#)= save methodName; string methodName; methodName := @#className & "_layout"; - log "invoking " & methodName & " arg=" & str @#; + log "layoutObject: invoking " & methodName & " arg=" & str @#; scantokens (methodName).@#; enddef; @@ -114,7 +100,7 @@ vardef drawObject(suffix @#)= save methodName; string methodName; methodName := @#className & "_draw"; - log "invoking " & methodName & " arg=" & str @#; + log "drawObject: invoking " & methodName & " arg=" & str @#; scantokens (methodName).@#; enddef; @@ -141,12 +127,13 @@ vardef drawObjectAt(suffix @#)(text eq)= enddef; vardef layoutObjects(text objects)= - log "Layout objects..."; + log "layoutObjects: begin"; forsuffixes o = objects: if (str o) <> "": layoutObject(o); fi; endfor; + log "layoutObjects: end"; enddef; vardef drawObjects(text objects)= @@ -176,17 +163,29 @@ enddef; %% joinObjects (p, q, r); %% def joinObjects(text pictures)= - save skipFirstPicture; - skipFirstPicture := 1; + log "joinObjects: call started."; + + save _index; + _index := 0; forsuffixes p=pictures: - if skipFirstPicture=0: - objectDoJoin(previousPic, p); + exitif (str p) = ""; + if _index=0: + log " joinObjects: calling join for first object."; + log _index; + log p; + objectDoJoinFirst(p)(_index); else: - % first picture is skipped - skipFirstPicture := 0; + log " joinObjects: calling join for next object."; + log _index; + log p; + objectDoJoin(previousPic, p)(_index); fi; + + _index := _index + 1; def previousPic=p enddef; endfor; + + log "joinObjects: call ended." enddef; %% @@ -207,7 +206,12 @@ enddef; %% setPictureJoin(pa.ne = pb.nw); %% def setObjectJoin(text eq)= - def objectDoJoin(suffix pa, pb)=eq enddef; + def objectDoJoin(suffix pa, pb)(expr index)=eq; enddef; + def objectDoJoinFirst(suffix pa)(expr index)= log " objectDoJoinFirst: NOP"; enddef; +enddef; + +def setObjectJoinFirst(text eq)= + def objectDoJoinFirst(suffix pa)(expr index)=eq; enddef; enddef; %% diff --git a/Master/texmf-dist/metapost/metauml/util_picture.mp b/Master/texmf-dist/metapost/metauml/util_picture.mp index b148f04857e..85ce68f7d41 100644 --- a/Master/texmf-dist/metapost/metauml/util_picture.mp +++ b/Master/texmf-dist/metapost/metauml/util_picture.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_picture_mp: expandafter endinput @@ -91,13 +77,15 @@ vardef PictureInfo@#(expr pleft, pright, ptop, pbottom)(text pfont)= %% var(numeric) fixedWidth, fixedHeight; - %% Controls how the contents of the picture is to be alligned relatively - %% to the picture margins. Can be one of "left", "centered", defaults to + %% Controls how the contents of the picture is to be aligned relatively + %% to the picture margins. Can be one of "left", "centered", and defaults to %% "left". The "centered" setting is useful for Picture-s whose fixedWidth %% is set to a given value. %% var(string) halign, valign; - + + var(string) textDecoration; + @#boxed := 0; @#borderColor := blue; @@ -108,7 +96,9 @@ vardef PictureInfo@#(expr pleft, pright, ptop, pbottom)(text pfont)= @#halign := "left"; @#valign := "bottom"; - + + @#textDecoration := "none"; + Margins.@#(pleft, pright, ptop, pbottom); FontInfoCopy.@#iFont(pfont); @@ -120,7 +110,8 @@ vardef PictureInfoCopy@#(text src)= @#boxed := src.boxed; @#borderColor := src.borderColor; @#ignoreNegativeBase := src.ignoreNegativeBase; - + @#textDecoration := src.textDecoration; + @#fixedWidth := src.fixedWidth; @#fixedHeight := src.fixedHeight; @@ -136,6 +127,7 @@ vardef PictureInfo_toString@#= enddef; PictureInfo.iPict(2, 2, 2, 2)(iFont); +PictureInfo.iPictNoMargins(0, 0, 0, 0)(iFont); PictureInfoCopy.iPictBoxed(iPict); iPictBoxed.boxed := 1; @@ -182,12 +174,12 @@ enddef; %% Lays out the Picture. %% vardef Picture_layout@# = - if @#layedout = 1: - log "Picture " & str @# & " already layed out."; + if @#laidout = 1: + log "Picture " & str @# & " already laid out."; else: log "Laying out " & (str @#); - @#layedout := 1; + @#laidout := 1; if known @#contentAsPicture: log "Content is known to be a picture"; @@ -225,7 +217,7 @@ vardef Picture_layout@# = elseif @#info.halign = "center": xdelta__ := (@#width-pictWidth(@#pict))/2; else: - 2 = 3; % throw exception illegal value for @#info.hallign + 2 = 3; % throw exception illegal value for @#info.halign fi; if @#info.valign = "bottom": @@ -233,7 +225,7 @@ vardef Picture_layout@# = elseif @#info.valign = "center": ydelta__ := (@#height-pictHeight(@#pict))/2 - @#negativeBase + negativeBaseAdjustement__; else: - 2 = 3; % throw exception illegal value for @#info.vallign + 2 = 3; % throw exception illegal value for @#info.valign fi; @#contentShift = @#sw + (xdelta__, ydelta__); @@ -249,6 +241,15 @@ vardef Picture_draw@# = draw @#pict shifted @#contentShift; + if (@#info.textDecoration = "underline"): + save ydelta, height; + height := pictHeight(@#pict) - @#negativeBase; + + ydelta := @#info.bottom - @#negativeBase - 0.8; + + draw @#sw + (@#info.left, ydelta) -- @#se + (-@#info.right, ydelta) withcolor black withpen pencircle scaled 0.2bp; + fi; + if (@#info.boxed = 1): draw objectBox(@#) withcolor @#info.borderColor; fi; diff --git a/Master/texmf-dist/metapost/metauml/util_picture_stack.mp b/Master/texmf-dist/metapost/metauml/util_picture_stack.mp index e1a1a51bfba..edade327ef8 100644 --- a/Master/texmf-dist/metapost/metauml/util_picture_stack.mp +++ b/Master/texmf-dist/metapost/metauml/util_picture_stack.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_picture_stack_mp: expandafter endinput @@ -44,32 +30,36 @@ inputonce util_log; % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -vardef PictureStackInfo@#(expr pleft, pright, ptop, pbottom)(text pspacing)(text ppictInfo)= +%% Style for a stack of child pictures with the given margins, spacing between children, and a common child style. +%% If child style supplier @#childStyleSupplier is set, it takes precedence over the common child style. +%% The child style supplier must be the name of a macro taking a child index as an argument and returning a child style. +vardef PictureStackInfo@#(expr marginLeft, marginRight, marginTop, marginBottom)(text _spacing)(text _childStyle)= attributes(@#); var(numeric) boxed; var(color) borderColor; - - var(numeric) left, right, top, bottom; var(numeric) spacing; + var(string) childStyleSupplier; - Margins@#(pleft, pright, ptop, pbottom); + Margins@#(marginLeft, marginRight, marginTop, marginBottom); - @#spacing := pspacing; + @#spacing := _spacing; @#boxed := 0; @#borderColor := green; - PictureInfoCopy.@#iPict(ppictInfo); + @#childStyleSupplier := ""; + + PictureInfoCopy.@#iPict(_childStyle); enddef; vardef PictureStackInfoCopy@#(text src)= PictureStackInfo@#(src.left, src.right, src.top, src.bottom)(src.spacing)(src.iPict); + @#childStyleSupplier := src.childStyleSupplier; @#boxed := src.boxed; @#borderColor := src.borderColor; enddef; -log "*** Creating iStack..."; PictureStackInfo.iStack(2, 2, 2, 2)(2)(iPict); vardef EPictureStack@#(text pictStackInfo)(text thePictures)(text how)= @@ -81,14 +71,23 @@ vardef EPictureStack@#(text pictStackInfo)(text thePictures)(text how)= attributes(@#); var(numeric) nItems; var(numeric) minx, miny, maxx, maxy; - var(string) picturesAsString; - var(string) joinMethod; - - @#joinMethod := how; + var(string) picturesAsString; + %var(text) joinMethod; + + string @#joinMethod; + + %@#joinMethod := str how; + for l=how: + @#joinMethod := l; + endfor; @#nItems := 0; for p=thePictures: - EPicture.@#pict[@#nItems](@#info.iPict)(p); + if (@#info.childStyleSupplier <> ""): + EPicture.@#pict[@#nItems](scantokens (@#info.childStyleSupplier)(@#nItems))(p); + else: + EPicture.@#pict[@#nItems](@#info.iPict)(p); + fi; @#nItems := @#nItems + 1; endfor; @@ -105,10 +104,10 @@ vardef PictureStack@#(text thePictures)(text how)= enddef; vardef PictureStack_layout@#= - if @#layedout = 1: + if @#laidout = 1: log "PictureStack " & (str @#) & " has already been layed out"; else: - @#layedout := 1; + @#laidout := 1; layoutObjects(scantokens @#picturesAsString); @@ -124,6 +123,9 @@ vardef PictureStack_layout@#= setObjectJoin(pa.midx=pb.midx; pa.bottom = pb.bottom + @#info.spacing); elseif @#joinMethod = "vrightbase": setObjectJoin(pa.right=pb.right; pa.bottom = pb.bottom + @#info.spacing); + else: + setObjectJoin(pa.c = pb.c); % By default, stack objects on top of each other. + scantokens @#joinMethod; fi; joinObjects(scantokens @#picturesAsString); diff --git a/Master/texmf-dist/metapost/metauml/util_positioning.mp b/Master/texmf-dist/metapost/metauml/util_positioning.mp index 758ab63afda..9f32a0a54e5 100644 --- a/Master/texmf-dist/metapost/metauml/util_positioning.mp +++ b/Master/texmf-dist/metapost/metauml/util_positioning.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_positioning_mp: expandafter endinput @@ -97,7 +83,7 @@ vardef align(suffix theString, extremityNew, extremityOld) string objectsAsString__; objectsAsString__ := enumToString(objects)(""); - log "Alligning '" & objectsAsString__ & "' at " & str theString; + log "Aligning '" & objectsAsString__ & "' at " & str theString; log sign; if (objectsAsString__ = ""): diff --git a/Master/texmf-dist/metapost/metauml/util_shade.mp b/Master/texmf-dist/metapost/metauml/util_shade.mp index f8c7b1bdcdb..b5231164b91 100644 --- a/Master/texmf-dist/metapost/metauml/util_shade.mp +++ b/Master/texmf-dist/metapost/metauml/util_shade.mp @@ -1,19 +1,5 @@ -% MetaUtil, an easier MetaPost life -% 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. +% Copyright 2005 2015 Ovidiu Gheorghies +% Licensed under the Apache License, Version 2.0. if known _util_shade_mp: expandafter endinput -- cgit v1.2.3