diff options
Diffstat (limited to 'Master/texmf-dist/metapost/metauml/util_group.mp')
-rw-r--r-- | Master/texmf-dist/metapost/metauml/util_group.mp | 82 |
1 files changed, 39 insertions, 43 deletions
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); |