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

text boxes with snap grid broken?



It looks like snapGrid is broken for most of the box-like
objects that derive their extent from the text. These 
objects snap to the upper left corner leaving most of
the connections off the grid.

Snap to grid is so important, because with an active grid 
of about halve to fourth of the visible grid drawing is
ways easier than without.

I looked at it especially for UML-Object. I see three ways
out:
1) align the grid to the center
2) force the object size to a multiple of twice the grid size
3) allow manual resizing of the object

No 1) is a small change. It isn't perfect but e.g. for
uml/object it would remove the biggest pain.

No 2) produces uggly boxes with large grid sizes and the result
depends on the grid settings, which is a user preference.

No 3) gives the user maximum freedom at the price that she 
probably always needs to resize the object.

Maybe a combination of 1) and 3) would be optimal, but as I
said it's a design decision. So I would be interested what
others think about it. In case some like to test the modfied
behaviour, a patch for solution 1) is appended (it's based 
on dia-0.90).


*** objects/UML-backup/object.c	Wed Feb  5 22:37:01 2003
--- objects/UML/object.c	Sun Feb  9 09:23:57 2003
***************
*** 227,233 ****
  static void
  objet_move(Objet *ob, Point *to)
  {
!   ob->element.corner = *to;
    objet_update_data(ob);
  }
  
--- 227,233 ----
  static void
  objet_move(Objet *ob, Point *to)
  {
!   ob->element.object.position = *to;
    objet_update_data(ob);
  }
  
***************
*** 345,351 ****
    }
  
    font = ob->text->font;
!   h = elem->corner.y + OBJET_MARGIN_Y;
  
    if (ob->is_multiple) {
      h += OBJET_MARGIN_M;
--- 345,351 ----
    }
  
    font = ob->text->font;
!   h = OBJET_MARGIN_Y;
  
    if (ob->is_multiple) {
      h += OBJET_MARGIN_M;
***************
*** 373,392 ****
  
    if (ob->show_attributes) {
        h += OBJET_MARGIN_Y + ob->attributes->ascent;
!       p2.x = elem->corner.x + OBJET_MARGIN_X;
!       p2.y = h;      
!       text_set_position(ob->attributes, &p2);
! 
        h += ob->attributes->height*ob->attributes->numlines; 
- 
        w = MAX(w, ob->attributes->max_width);
    }
  
    w += 2*OBJET_MARGIN_X; 
  
-   p1.x = elem->corner.x + w/2.0;
-   text_set_position(ob->text, &p1);
-   
    ob->ex_pos.x = ob->st_pos.x = p1.x;
  
    
--- 373,385 ----
  
    if (ob->show_attributes) {
        h += OBJET_MARGIN_Y + ob->attributes->ascent;
!       p2.y = h;
        h += ob->attributes->height*ob->attributes->numlines; 
        w = MAX(w, ob->attributes->max_width);
    }
  
    w += 2*OBJET_MARGIN_X; 
  
    ob->ex_pos.x = ob->st_pos.x = p1.x;
  
    
***************
*** 394,401 ****
      w += OBJET_MARGIN_M;
    }
      
    elem->width = w;
!   elem->height = h - elem->corner.y;
  
    /* Update connections: */
    ob->connections[0].pos = elem->corner;
--- 387,406 ----
      w += OBJET_MARGIN_M;
    }
      
+   elem->corner.x = obj->position.x - w / 2.0;
+   elem->corner.y = obj->position.y - h / 2.0;
    elem->width = w;
!   elem->height = h;
! 
!   p1.x = obj->position.x;
!   p1.y += elem->corner.y;
!   text_set_position(ob->text, &p1);
! 
!   if (ob->show_attributes) {
!     p2.x = elem->corner.x + OBJET_MARGIN_X;
!     p2.y += elem->corner.y;
!     text_set_position(ob->attributes, &p2);
!   }  
  
    /* Update connections: */
    ob->connections[0].pos = elem->corner;
***************
*** 415,421 ****
    ob->connections[7].pos.y = elem->corner.y + elem->height;
    
    element_update_boundingbox(elem);
-   obj->position = elem->corner;
    element_update_handles(elem);
  }
  
--- 420,425 ----
***************
*** 440,446 ****
  
    obj->ops = &objet_ops;
  
!   elem->corner = *startpoint;
  
    /* choose default font name for your locale. see also font_data
structure
       in lib/font.c. */
--- 444,450 ----
  
    obj->ops = &objet_ops;
  
!   elem->object.position = *startpoint;
  
    /* choose default font name for your locale. see also font_data
structure
       in lib/font.c. */



-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK