Trouble when moving parent handles



[I previously posted this message without any subject and a quite unreadable scheme because of tabulations. 
I'm totally sorry ... blame me.]

Hi,

I am writing a new set of objects for Dia in order to use the AADL
graphical notation [ http://www.aadl.info/ ].

Basically, I need to have parented box, and to be able to add ports to
them. Ports are represented by a triangular shape on the borders of
the box and can be moved alongside the borders.

I implemented ports as handles around which i draw a triangle. You can
add handles to the box via the menu.

The problem i encounter is: when moving a handle of a parent box, it
is always interpreted as resizing the box, whatever the handle type
is. In my precise case, moving a port handle of a parent box is
interpreted as resizing down the box (though i am not). Therefore some
positions are forbidden.

For example, in this picture, i can not move the port to the left.
 ____________________ 
|parent              |
|      _______       |
|     | child |      |
|     |       |      |
|     |_______|      |
|                    |
|             ____   |
|_____________\  /___|
               \/

               ^
              port


The code responsible for this behaviour is:
    [ app/modify_tool.c:438 ]

    /* make sure resizing is restricted to its parent */


    /* if resize was blocked by parent, that means the resizing was
      outward, thus it won't bother the children so we don't have to
      check the children */
    
    if (!parent_handle_move_out_check(tool->object, &to))
        parent_handle_move_in_check(tool->object, &to, &tool->start_at);


I quick-fixed this adding a line:
                       (the port handle type currently is HANDLE_MINOR_CONTROL)

    if (!parent_handle_move_out_check(tool->object, &to))
      if ( (tool->handle->type != HANDLE_MINOR_CONTROL) )     /* QUICK HACK */
          parent_handle_move_in_check(tool->object, &to, &tool->start_at);


I am not comfortable with this situation since it requires patching
Dia sources. I wonder if all handles should follow this behaviour or
if there should be 2 types of handles: some that can not be moved
freely (like the current ones) because they determine the limit of the
element and others that don't have any position restriction.

Maybe i'm just totally mistaken about what handles are designed for
and should try to implement ports differently.

What do you think ?

-- Pierre DUQUESNE




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]