void CodLinkCanvas::save(QTextStream & st, bool ref, QString & warning) const { if (ref) st << "linkcanvas_ref " << get_ident(); else if (begin->typeUmlCode() != UmlArrowPoint) { nl_indent(st); st << "linkcanvas " << get_ident(); if (decenter_begin >= 0) // float output/input bugged st << " decenter_begin " << ((int)(decenter_begin * 1000)); if (decenter_end >= 0) // float output/input bugged st << " decenter_end " << ((int)(decenter_end * 1000)); indent(+1); save_lines(st, TRUE, TRUE, warning); indent(-1); CodDirsCanvas * d = find_dirs(); if (d != 0) d->save(st, FALSE, warning); } }
void CodLinkCanvas::menu(const QPoint&) { bool new_dirs; CodDirsCanvas * d = find_dirs(); CodObjCanvas * from; CodObjCanvas * to; get_start_end(from, to); if (d == 0) { new_dirs = TRUE; (d = dirs = new CodDirsCanvas(the_canvas(), this, 0))->show(); } else new_dirs = FALSE; Q3PopupMenu m; Q3PopupMenu geo; m.insertItem(new MenuTitle(TR("Link"), m.font()), -1); m.insertSeparator(); m.insertItem(TR("add messages to ") + from->get_full_name(), 1); m.insertItem(TR("add messages to ") + to->get_full_name(), 2); m.insertSeparator(); m.insertItem(TR("Edit its messages"), 3); m.insertItem(TR("Edit all the messages"), 4); m.insertSeparator(); m.insertItem(TR("Select linked items"), 7); m.insertSeparator(); if (!new_dirs) { m.insertItem(TR("Edit drawing settings"), 5); m.insertSeparator(); } if (get_start() != get_end()) { init_geometry_menu(geo, 10); m.insertItem(TR("Geometry (Ctrl+l)"), &geo); m.insertSeparator(); } m.insertItem(TR("Remove from diagram"), 6); int rank = m.exec(QCursor::pos()); switch (rank) { case 1: { CodAddMsgDialog dialog(to, from, d, (ColDiagramView *) the_canvas()->get_view(), FALSE); dialog.raise(); if (dialog.exec() != QDialog::Accepted) return; } break; case 2: { CodAddMsgDialog dialog(from, to, d, (ColDiagramView *) the_canvas()->get_view(), TRUE); dialog.raise(); if (dialog.exec() != QDialog::Accepted) return; } break; case 3: CodEditMsgDialog::exec((ColDiagramView *) the_canvas()->get_view(), d->get_msgs()); return; case 4: CodEditMsgDialog::exec((ColDiagramView *) the_canvas()->get_view(), ((ColDiagramView *) the_canvas()->get_view())->get_msgs()); return; case 5: if (d->edit_drawing_settings()) modified(); return; case 6: delete_it(); ((ColDiagramView *) the_canvas()->get_view())->update_msgs(); break; case 7: select_associated(); return; default: if (rank >= 10) { rank -= 10; if (rank == RecenterBegin) set_decenter(-1.0, decenter_end); else if (rank == RecenterEnd) set_decenter(decenter_begin, -1.0); else if (rank != (int) geometry) set_geometry((LineGeometry) rank, TRUE); else return; } else return; } package_modified(); if (new_dirs && (dirs != 0)) { if (dirs->get_msgs().count() == 0) { dirs->delete_it(); dirs = 0; } else dirs->update_pos(beginp, endp); } }
/* * create a list of directories to traverse from the current directory */ List *Find_Directories (char *repository, int which, List *entries, const char *virtual_repository) { List *dirlist; const char *regex = NULL; if(!current_parsed_root->isremote && virtual_repository) regex = lookup_regex(virtual_repository); /* make a list for the directories */ dirlist = getlist (); /* find the local ones */ if (which & W_LOCAL) { List *tmpentries; struct stickydirtag *sdtp; /* Look through the Entries file. */ if (entries != NULL) tmpentries = entries; else if (isfile (CVSADM_ENT)) tmpentries = Entries_Open (0, NULL); else tmpentries = NULL; if (tmpentries != NULL) sdtp = (struct stickydirtag *) tmpentries->list->data; /* If we do have an entries list, then if sdtp is NULL, or if sdtp->subdirs is nonzero, all subdirectory information is recorded in the entries list. */ if (tmpentries != NULL && (sdtp == NULL || sdtp->subdirs)) walklist (tmpentries, add_subdir_proc, (void *) dirlist); else // FIXME: Should this not look for subdirectories anyway???? { /* This is an old working directory, in which subdirectory information is not recorded in the Entries file. Find the subdirectories the hard way, and, if possible, add it to the Entries file for next time. */ /* FIXME-maybe: find_dirs is bogus for this usage because it skips CVSATTIC and CVSLCK directories--those names should be special only in the repository. However, in the interests of not perturbing this code, we probably should leave well enough alone unless we want to write a sanity.sh test case (which would operate by manually hacking on the CVS/Entries file). */ if (find_dirs (".", dirlist, 1, tmpentries, regex) != 0) error (1, errno, "cannot open current directory"); if (tmpentries != NULL) { if (! list_isempty (dirlist)) walklist (dirlist, register_subdir_proc, (void *) tmpentries); else Subdirs_Known (tmpentries); } } if (entries == NULL && tmpentries != NULL) Entries_Close (tmpentries); } /* look for sub-dirs in the repository */ if ((which & W_REPOS) && repository) { /* search the repository */ if (find_dirs (repository, dirlist, 0, entries, regex) != 0) { error (1, errno, "cannot open directory %s", fn_root(repository)); } /* look for virtual directories */ if (find_virtual_dirs (virtual_repository, dirlist) != 0) { error (1, errno, "cannot open virtual directory %s", repository); } if(find_rename_dirs(virtual_repository, dirlist) != 0) { error(1,errno, "find_renames failed"); } } xfree(regex); /* sort the list into alphabetical order and return it */ sortlist (dirlist, fsortcmp); return (dirlist); }