Menu

Important question for palmResize users from the developer

I am thinking of extending the flexibility of the resize specification. Comments from users are welcome.

There was a
good reason why I had each object entry terminated by a 0: so I can add more
object attributes. So, I could add a bunch of "follow" attributes. A
"follow" attribute would be something like this:

secondGadget DIA_H_PLUS_1_2_DH DIA_X_FOLLOW_RIGHT fldMyField
DIA_W_FOLLOW_W weirdGadget

This would specify that secondGadget's topLeft.x coordinate is always kept
at a fixed delta from fltMyField's topLeft.x+extent.x, and that
secondGadget's extent.x is always kept at a fixed delta from the width
weirdGadget. On the other hand, secondGadget's extent.y is rescaled
independently of anything else.

This would require a bunch of combinations:
DIA_X_FOLLOW_X
DIA_X_FOLLOW_RIGHT
DIA_X_FOLLOW_WIDTH
DIA_RIGHT_FOLLOW_X
DIA_RIGHT_FOLLOW_RIGHT
DIA_RIGHT_FOLLOW_WIDTH

Do you know if an object could have ID 0? If not, it makes things easier.

Do you think such a thing would be useful enough that the added complexity
in the code would be worth it? I fear that once one did this, one would
want to have more and more complexity, culminating in my having to put in a
formula parser.

Actually, the idea of a formula parser isn't completely absurd. Think of a
stack machine with four stacks (the bounds: X, Y, H, W). Each stack starts
with the current value of the parameter. Each instruction includes a target
specifier. There are legacy instructions, such as
DIA_H_PLUS_1_2_DH
etc. These replace the top value in the stack by ORIGINAL_H + DH/2, etc.
And then there are non-legacy instructions such as:
GET_X_TO_H objectID
This puts the X value of objectID (assuming objectID was already resized;
the other option is when objectID == currentObjectID, in which case the top
value on the X stack is used, without popping) into the H stack. And there
are obvious instructions like ADD_H, DIVIDE_H, MULTIPLY_Y, NEGATE_X.

This could be parsed really quickly. And if one wanted to, one could have a
little pre-processor that takes C-like formulae and turns them into
expressions for this stack machine.

But I'm not sure we really need such generality. A set of "follow"
attributes should be enough. What do you think? Do we need the stack machine? Do we even need the FOLLOW attributes?

Posted by Alexander R. Pruss 2004-06-17

Log in to post a comment.

MongoDB Logo MongoDB