Exemplo n.º 1
0
void PackageCanvas::check_size() {
  used_color = (itscolor == UmlDefaultColor)
    ? the_canvas()->browser_diagram()->get_color(UmlPackage)
    : itscolor;

  const QPixmap * px = 
    ProfiledStereotypes::diagramPixmap(browser_node->get_data()->get_stereotype(),
				       the_canvas()->zoom());
  
  if (px != 0) {
    QFontMetrics fm(the_canvas()->get_font(UmlNormalBoldFont));
    int wi = fm.width(browser_node->get_name());
    
    if (wi < px->width())
      wi = px->width();

    // force odd width and height for line alignment
    DiagramCanvas::resize(wi | 1, (px->height() + fm.height()) | 1);
    
  }
  else {
    int wi = min_width();
    int he = min_height();
    
    // warning : do NOT check if ((width() < wi) || (height() < he))
    // because te resize must be done to set data on scale change
    // Force odd width and height for line alignment
    DiagramCanvas::resize((width() > wi) ? width() : wi | 1,
			  (height() > he) ? height() : he | 1);
  }
}
Exemplo n.º 2
0
void DeploymentNodeCanvas::check_size() {
  DeploymentDiagramSettings dflt;
  
  dflt.write_horizontally = write_horizontally;
  the_canvas()->browser_diagram()->get_deploymentdiagramsettings(dflt);
  horiz = (dflt.write_horizontally == UmlYes);
  show_properties = (dflt.componentdrawingsettings.show_stereotype_properties == UmlYes);
    
  const QPixmap * px = 
    ProfiledStereotypes::diagramPixmap(browser_node->get_data()->get_stereotype(),
				       the_canvas()->zoom());
  
  if (px != 0) {
    QFontMetrics fm(the_canvas()->get_font(UmlNormalBoldFont));
    int w;
    int h = px->height() + fm.height();
    
    if (horiz)
      w = fm.width(iname + ":" + browser_node->get_name());
    else {
      w = fm.width(browser_node->get_name());
      
      int iw = fm.width(iname + ":");
      
      if (iw > w)
	w = iw;
      
      h += fm.height() + (int) (3 * the_canvas()->zoom());
    }
    
    if (w < px->width())
      w = px->width();
    
    // force odd width and height for line alignment
    DiagramCanvas::resize(w | 1, h | 1);
  }
  else {
    int wi = min_width();
    int he = min_height();
    
    // warning : do NOT check if ((width() < wi) || (height() < he))
    // because te resize must be done to set data on scale change
    DiagramCanvas::resize((width() < wi) ? wi : width(),
			  (height() < he) ? he : height());
  }
}
Exemplo n.º 3
0
void DeploymentNodeCanvas::resize(const QSize & sz, bool w, bool h) {
  DiagramCanvas::resize(sz, w, h, min_width(), min_height(), TRUE);
}
Exemplo n.º 4
0
void DeploymentNodeCanvas::resize(aCorner c, int dx, int dy, QPoint & o) {
  DiagramCanvas::resize(c, dx, dy, o, min_width(), min_height(), TRUE);
}
Exemplo n.º 5
0
void PackageCanvas::resize(const QSize & sz, bool w, bool h) {
  DiagramCanvas::resize(sz, w, h, min_width(), min_height(), TRUE);
}
Exemplo n.º 6
0
void PackageCanvas::resize(aCorner c, int dx, int dy, QPoint & o) {
  DiagramCanvas::resize(c, dx, dy, o, min_width(), min_height(), TRUE);
}