[PD] 'relocate' message

Hans-Christoph Steiner hans at at.or.at
Tue Jan 5 07:42:32 CET 2010


On Jan 4, 2010, at 7:16 PM, Jonathan Wilkes wrote:

>
>
> --- On Tue, 1/5/10, Hans-Christoph Steiner <hans at at.or.at> wrote:
>
>> From: Hans-Christoph Steiner <hans at at.or.at>
>> Subject: Re: [PD] 'relocate' message
>> To: "Jonathan Wilkes" <jancsika at yahoo.com>, "PD List" <pd- 
>> list at iem.at>
>> Date: Tuesday, January 5, 2010, 12:26 AM
>>
>> On Jan 4, 2010, at 1:50 AM, Hans-Christoph Steiner wrote:
>>
>>>
>>> On Jan 3, 2010, at 1:14 AM, Hans-Christoph Steiner
>> wrote:
>>>
>>>>
>>>> On Jan 2, 2010, at 8:22 PM, Jonathan Wilkes
>> wrote:
>>>>
>>>>>
>>>>>
>>>>> --- On Sun, 1/3/10, Hans-Christoph Steiner
>> <hans at at.or.at>
>> wrote:
>>>>>
>>>>>> From: Hans-Christoph Steiner <hans at at.or.at>
>>>>>> Subject: [PD] 'relocate' message
>>>>>> To: "Pd List" <pd-list at iem.at>
>>>>>> Date: Sunday, January 3, 2010, 12:00 AM
>>>>>>
>>>>>> Is anyone using the 'relocate' message to
>> move/resize
>>>>>> windows in Pd?  I ask because I want
>> to simplify that
>>>>>> code and the message itself in
>> pd-gui-rewrite 0.43.
>>>>>> Its currently a very strange format, and
>> it no longer needs
>>>>>> to be.
>>>>>>
>>>>>> Here's the only working example that I
>> know of:
>>>>>> http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/doc/additional/pd-msg/1..msg_and_patch/6.relocate_windows..pd?view=log
>>>>>>
>>>>>> The idea is to make the message like
>> this:
>>>>>>
>>>>>>
>> "relocate   WIDTHxHEIGHT+XLoc+YLoc"
>>>>>>
>>>>>> Currently its like this:
>>>>>>
>>>>>>
>> "relocate   WIDTHxHEIGHT+0+0
>>>>>> 0x0+XLoc+YLoc"
>>>>>>
>>>>>> .hc
>>>>>
>>>>> Hi Hans,
>>>>>   Is there a reason the message can't
>> simply be "relocate WIDTH HEIGHT
>>>>> XLoc Yloc"?  Whether using pd-ext or
>> vanilla, I've always thought it seems
>>>>> really awkward to cram the coordinates into
>> one big symbol..
>>>>>
>>>>> -Jonathan
>>>>
>>>>
>>>> Hmm, that makes sense. I wonder if this should
>> just have the same syntax as 'canvas', so:
>>>>
>>>> relocate x1 y1 x2 y2
>>>>
>>>> Where x is the upper left corner, and y is the
>> lower right corner.
>>>
>>>
>>> So I restored the old relocate message, and added a
>> new message which the GUI now uses a new message
>> 'whxy'.  'whxy' stands for Width/Height/X/Y.
>> Width/Height is the size of the window, and (x,y) is where
>> the upper-left corner is located:
>>>
>>> whxy width height xPosition yPosition
>>> whxy 450 300 0 22
>>>
>>> I am now thinking that perhaps I should make it called
>> 'setbounds' after the old internal function, and make it
>> mirror that:
>>>
>>>     canvas_setbounds(x, xpos, ypos, xpos +
>> width, ypos + height);
>>>
>>> i.e. "setbounds Xleft Ytop Xright Ybottom"
>>
>> After a little discussion with Miller, this one seems to
>> make the most sense, so this is what the pd-gui-rewrite uses
>> now.
>>
>> http://pure-data.svn.sourceforge.net/viewvc/pure-data?view=rev&revision=12883
>
> That's great.  I think "setbounds" is a much better name than  
> "relocate";
> it has a straightforward connection to the arguments (unlike  
> "relocate").
>
> Is there any way to have the iemgui messages "pos" and "delta" for
> canvases?  For example, if I have a canvas with a bunch of subpatches
> that all have different sizes, but I want to move them all up to the
> top left-hand corner or the screen, "pos 0 0" would be really handy.


The first two values of 'setbounds' are the same as 'pos', they are  
the upper left corner.  But you have to also set the   lower right  
too.  This message is not really meant to be used a lot externally.   
Its really a direct mapping of the data that Tk gives to the format  
that Pd saves in the .pd file.  Plus 'setbounds' doesn't even take  
effect until you close and open the patch again.

.hc

----------------------------------------------------------------------------

Access to computers should be unlimited and total.  - the hacker ethic






More information about the Pd-list mailing list