Beispiel #1
0
SubjectCanvas * SubjectCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
  if (!strcmp(k, "subject_ref"))
    return (SubjectCanvas *) dict_get(read_id(st), "subject", canvas);
  else if (!strcmp(k, "subject")) {
    int id = read_id(st);
    SubjectCanvas * result = new SubjectCanvas(canvas, 0, 0, id);
    
    result->name = toUnicode(read_string(st));
    
    k = read_keyword(st);
    read_color(st, "color", result->itscolor, k);
    
    if (strcmp(k, "xyzwh"))
      wrong_keyword(k, "xyzwh");
    
    read_xyzwh(st, result);
    result->check_size();
    result->width_scale100 = result->width();
    result->height_scale100 = result->height();
    result->set_center100();
    result->show();
    return result;
  }
  else
    return 0;
}
Beispiel #2
0
void UseCaseDiagramView::contentsMousePressEvent(QMouseEvent * e) {
  if (!window()->frozen()) {
    UmlCode action = window()->buttonOn();
    
    switch (action) {
    case UmlClass:
      {
	history_protected = TRUE;
	unselect_all();
	window()->selectOn();
	history_save();
	
	BrowserNode * b = 
	  BrowserClass::get_class(((BrowserNode *) window()->browser_diagram()->parent()),
				  "actor");
	
	if (b != 0) {
	  UcClassCanvas * uc = 
	    new UcClassCanvas(b, the_canvas(), e->x(), e->y(), 0);
	  
	  uc->show();
	  uc->upper();
	  window()->package_modified();
	}
      }
      break;
    case UmlUseCase:
      {
	history_protected = TRUE;
	unselect_all();
	window()->selectOn();
	history_save();
	
	BrowserNode * b = 
	  BrowserUseCase::get_use_case(((BrowserNode *) window()->browser_diagram()->parent()));
	
	if (b != 0) {
	  UcUseCaseCanvas * uc = 
	    new UcUseCaseCanvas(b, the_canvas(), e->x(), e->y(), 0);
	  uc->show();
	  uc->upper();
	  window()->package_modified();
	}
      }
      break;
      case UmlSubject:
	{
	  unselect_all();
	  window()->selectOn();
	  history_save();
	  
	  SubjectCanvas * f = 
	    new SubjectCanvas(the_canvas(), e->x(), e->y(), 0);
	  
	  f->show();
	  f->upper();
	  window()->package_modified();
	}
	break;
    default:
      DiagramView::contentsMousePressEvent(e);
      return;
    }
    
    canvas()->update();
    history_protected = FALSE;
  }
  else
    DiagramView::contentsMousePressEvent(e);
}