Patch tmAlign3

A couple of small patches to allow for easier use of lc's new header and navbar widgets. Neither one auto-sizes or auto-positions. With this patch, if you select an object, choose "Relative to card" in ta3, and either equalize or justify, ta3 will help.
TO DO: Equalize (I think it's equalize and not justify) is not smart. It enlarges the object but it does not anchor it in place, first. The next time that makes me grind my teeth, I'll fix it.

Note that my changes are marked with "mikey". Where I changed a block, it's marked ..
So in the card script (card id 1002, because Scott didn't care enough to give it a name), select the entire block of command equalizeObjects to end justifyObjects and replace the block with

command equalizeObjects pDimension, pExtent, pMatchFirst
put the selObj into theSelectedList
#
#if number of lines of theSelectedList < 2 then exit equalizeObjects
put the uHilite of control "use_card" into useCard
if number of lines of theSelectedList < 2 and not useCard then exit equalizeObjects
#
storeObjectRects
--
-- MATCH SPECIFIED DIMENSION OF SELECTED OBJECTS
lock screen
put pDimension into prop
if pExtent is "max" then put theMaxDimension(prop,theSelectedList) into theExtent
if pExtent is "min" then put theMinDimension(prop,theSelectedList) into theExtent
if pMatchFirst then
put line 1 of theSelectedList into theFirstObj
put the prop of theFirstObj into theExtent
#
#end if
else if useCard then
put the prop of the owner of line 1 of theSelectedList into theExtent
end if #useCard
#

repeat for each line theObj in theSelectedList
set the prop of theObj to theExtent
end repeat
unlock screen
end equalizeObjects


command justifyObjects pEdge, pExtent, pUseCard, pMatchFirst
put the selObj into theSelectedList
#
#if number of lines of theSelectedList < 2 then exit equalizeObjects
put the uHilite of control "use_card" into useCard
if number of lines of theSelectedList < 2 and not useCard then exit justifyObjects
#
storeObjectRects
--
lock screen
if pUseCard then
if pEdge is in "left,top" then put 0 into theExtentValue
if pEdge is "right" then put width of theCardOwner(line 1 of theSelectedList) into theExtentValue
if pEdge is "bottom" then put height of theCardOwner(line 1 of theSelectedList) into theExtentValue
get empty -- DO NOTHING
else
if pMatchFirst then
put line 1 of theSelectedList into theObj
put the pEdge of theObj into theExtentValue
#
else if useCard then
put the prop of the owner of line 1 of theSelectedList into theExtent
#
else
if pExtent is "min" then put 1000000 into theExtentValue
if pExtent is "max" then put -1000000 into theExtentValue
repeat for each line theObj in theSelectedList
put the pEdge of theObj into theEdgeValue
put value(pExtent & "(theExtentValue,theEdgeValue)") into theExtentValue
end repeat
end if
end if
put itemOffset(pEdge,"left,top,right,bottom") into N
repeat for each line theObj in theSelectedList
put rect of theObj into theRect
put theExtentValue into item N of theRect
set rect of theObj to theRect
end repeat
unlock screen
end justifyObjects


Comments

  • Memo to me: Patch mouseLeave so that we remove the hilight if we stay in a category. If you click and hold on center align, and then drag left or right, center will remain lit, for instance. The code is pretty straightforward, but it will take some fiddling.
Sign In or Register to comment.