Exemplo n.º 1
0
void ColMsgTable::button_pressed(int row, int col, int, const QPoint &) {
  if ((((unsigned) row) >= flat_msg_list.count()) || (col > CMD_COL))
    // wrong signal
    return;
  
  if (col == MSG_COL)
    edit_msg(row);
  else if (col <= HI_RANK_COL)
    change_ranks(row, col);
  else {
    Q3PopupMenu m;

    m.insertItem(new MenuTitle(QString(TR("rank ")) + text(row, ABS_RANK_COL)
			       + " : " + text(row, HI_RANK_COL),
			       m.font()),
		 -1);
    m.insertSeparator();
    m.insertItem(TR("Edit message"), 1);
    m.insertItem(TR("Change ranks"), 2);
    m.insertSeparator();
    m.insertItem(TR("Delete it"), 3);
    if (!flat_msg_list[row]->msgs.isEmpty())
      m.insertItem(TR("Delete recursively"), 4);
    
    switch (m.exec(QCursor::pos())) {
    case 1:
      edit_msg(row);
      // no break;
    default:
      return;
    case 2:
      change_ranks(row, col);
      return;
    case 3:
      flat_msg_list[row]->delete_it(FALSE, view->get_msgs());
      break;
    case 4:
      flat_msg_list[row]->delete_it(TRUE, view->get_msgs());
      break;
    }
    
    view->update_msgs();
    refresh();
  }
}
Exemplo n.º 2
0
void ArrowJunctionCanvas::menu(const QPoint&) {
#if 0
  if (lines.at(0)->may_join()) {
    Q3PopupMenu m;
    
    m.insertItem(new MenuTitle(TR("Line break"), m.font()), -1);
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 0);
    
    switch (m.exec(QCursor::pos())) {
    case 0:
      // removes the point replacing the lines around it by a single line
      lines.at(0)->join(lines.at(1), this);
      break;
    default:
      return;
    }
    
    package_modified();
  }
#endif
}
Exemplo n.º 3
0
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);
  }
}