void SubjectCanvas::send(ToolCom * com, Q3CanvasItemList & all) { Q3PtrList<SubjectCanvas> subjects; Q3CanvasItemList::Iterator cit; for (cit = all.begin(); cit != all.end(); ++cit) { DiagramItem *di = QCanvasItemToDiagramItem(*cit); if ((di != 0) && (*cit)->visible() && (di->type() == UmlSubject)) subjects.append((SubjectCanvas *) di); } com->write_unsigned(subjects.count()); SubjectCanvas * sc; for (sc = subjects.first(); sc != 0; sc = subjects.next()) { Q3CString s = fromUnicode(sc->name); com->write_string((const char *) s); com->write(sc->rect()); } }
void SubjectCanvas::same_drawing_settings(Q3PtrList<DiagramItem> & l) { Q3PtrListIterator<DiagramItem> it(l); SubjectCanvas * x = (SubjectCanvas *) it.current(); while (++it, it.current() != 0) { SubjectCanvas * o = (SubjectCanvas *) it.current(); o->itscolor = x->itscolor; o->modified(); // call package_modified() } }
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; }
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); }