Example #1
0
void AssocContainCanvas::remove(bool from_model) {
  if (!from_model) {
    if (the_canvas()->must_draw_all_relations()) {
      const AssocContainCanvas * a = this;
  
      while (a->begin->type() == UmlArrowPoint) {
	a = (AssocContainCanvas *) ((ArrowPointCanvas *) a->begin)->get_other(a);
	if (a == 0)
	  break;
      }

      if (a && !a->begin->isSelected() && !a->begin->get_bn()->deletedp()) {
	a = this;
  
	while (a->end->type() == UmlArrowPoint) {
	  a = (AssocContainCanvas *) ((ArrowPointCanvas *) a->end)->get_other(a);
	  if (a == 0)
	    break;
	}
  
	if (a && !a->end->isSelected() && !a->end->get_bn()->deletedp()) {
	  msg_warning("Bouml", TR("<i>Draw all relations</i> forced to <i>no</i>"));
	  the_canvas()->dont_draw_all_relations();
	}
      }
    }
    delete_it();
  }
  else
    get_start()->unassociate(get_end());	// line will be deleted
}
Example #2
0
void TextCanvas::open()
{
    static QSize sz;

    // warning : 'note' is already unicode
    QString s = fromUnicode(text);
    bool created = s.isEmpty();

    MLEDialog::get(s, QCursor::pos(), sz);

    if (s.isEmpty())
        delete_it();
    else {
        text = s;

        if (created) {
            QFontMetrics fm(the_canvas()->get_font(UmlNormalFont));
            QSize sz = fm.size(0, text);

            DiagramCanvas::resize(sz.width(), sz.height());
        }

        // force son reaffichage
        hide();
        show();
    }

    canvas()->update();

    package_modified();
}
Example #3
0
void UcUseCaseCanvas::remove(bool from_model)
{
    if (! from_model)
        delete_it();
    else
        browser_node->delete_it();	// will remove canvas
}
Example #4
0
void OdClassInstCanvas::remove(bool from_model)
{
    if (! from_model)
        delete_it();
    else
        browser_node->delete_it();	// will remove canvas
}
Example #5
0
void ArrowJunctionCanvas::remove_line(ArrowCanvas * l, bool onbrkjoin)
{
    DiagramItem::remove_line(l, onbrkjoin);

    if (!onbrkjoin && lines.isEmpty())
        delete_it();
}
void SimpleRelationCanvas::remove(bool from_model)
{
    if (! from_model) {
        if (the_canvas()->must_draw_all_relations()) {
            const SimpleRelationCanvas * a = this;

            while (a->begin->type() == UmlArrowPoint) {
                a = (SimpleRelationCanvas *)((ArrowPointCanvas *) a->begin)->get_other(a);

                if (a == 0)
                    break;
            }

            if (a && !a->begin->isSelected() && !a->begin->get_bn()->deletedp()) {
                a = this;

                while (a->end->type() == UmlArrowPoint) {
                    a = (SimpleRelationCanvas *)((ArrowPointCanvas *) a->end)->get_other(a);

                    if (a == 0)
                        break;
                }

                if (a && !a->end->isSelected() && !a->end->get_bn()->deletedp()) {
                    msg_warning("Douml", "<i>Draw all relations</i> forced to <i>no</i>");
                    the_canvas()->dont_draw_all_relations();
                }
            }
        }

        delete_it();
    }
    else
        data->delete_it();	// will remove canvas
}
Example #7
0
void SdDurationCanvas::remove(SdDurationCanvas * d) {
  durations.remove(d);
  
  if (msgs.isEmpty() && durations.isEmpty())
    // now useless, remove it
    delete_it();
}
Example #8
0
void SdDurationCanvas::remove(SdMsgBaseCanvas * m) {
  msgs.removeRef(m);
  
  if (msgs.isEmpty() && durations.isEmpty())
    // now useless, remove it
    delete_it();
}
Example #9
0
void SubjectCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Subject"));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 6);
  m.insertItem(TR("Go down"), 7);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 3);
  if (linked()) {
    m.insertSeparator();
    m.insertItem(TR("Select linked items"), 4);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"),5);

  int index = m.exec(QCursor::pos());
  
  switch (index) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 6:
    z_up();
    modified();	// call package_modified()
    return;
  case 7:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    open();
    // modified then package_modified already called
    return;
  case 3:
    edit_drawing_settings();
    return;
  case 4:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 5:
    delete_it();
    break;
  default:
    return;
  }
  
  package_modified();
}
void qm_plistview::keyPressEvent(QKeyEvent *event)
{
    switch (event->key())
    {
        case Qt::Key_Return:
        {
            on_item_dclicked(currentItem());
            break;
        }

        case Qt::Key_Delete:
        {
            delete_it();
            break;
        }

        case Qt::Key_Space:
        {
            if (current_songPos != -1 && current_songPos < topLevelItemCount() )
                scrollToItem(topLevelItem(current_songPos));
            break;
        }

        case Qt::Key_Home:
        {
            if (topLevelItemCount() > 0)
                scrollToItem(topLevelItem(0));
            break;
        }

        case Qt::Key_End:
        {
            if (topLevelItemCount() > 0)
                scrollToItem(topLevelItem(topLevelItemCount() - 1));
            break;
        }

        case Qt::Key_Down:
        {
            if (currentItem()->get_pos < topLevelItemCount())
                setCurrentItem(itemBelow ( currentItem() ));
            break;
        }

        case Qt::Key_Up:
        {
            if (currentItem()->get_pos > 1)
                setCurrentItem(itemAbove ( currentItem() ));
            break;
        }

        default:
            QTreeWidget::keyPressEvent(event);
    }
}
Example #11
0
void FragmentSeparatorCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Separator"));
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 1);
  
  if (m.exec(QCursor::pos()) == 1) {
    delete_it();
    package_modified();
  }
}
Example #12
0
void ImageCanvas::menu(const QPoint&) {
    Q3PopupMenu m(0);
    Q3PopupMenu fontsubm(0);

    MenuFactory::createTitle(m, TR("Image"));
    m.insertSeparator();
    m.insertItem(TR("Upper"), 0);
    m.insertItem(TR("Lower"), 1);
    m.insertItem(TR("Go up"), 2);
    m.insertItem(TR("Go down"), 3);
    m.insertSeparator();
    m.insertItem(TR("Edit"), 4);
    if (linked()) {
        m.insertSeparator();
        m.insertItem(TR("Select linked items"), 5);
    }
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 6);

    int index = m.exec(QCursor::pos());

    switch (index) {
    case 0:
        upper();
        modified();	// call package_modified()
        return;
    case 1:
        lower();
        modified();	// call package_modified()
        return;
    case 2:
        z_up();
        modified();	// call package_modified()
        return;
    case 3:
        z_down();
        modified();	// call package_modified()
        return;
    case 4:
        open();
        // all done by open
        return;
    case 5:
        the_canvas()->unselect_all();
        select_associated();
        return;
    case 6:
        delete_it();
        break;
    }

    package_modified();
}
Example #13
0
void HubCanvas::menu(const QPoint &)
{
    Q3PopupMenu m;

    MenuFactory::createTitle(m, TR("Network connexion"));
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 0);

    switch (m.exec(QCursor::pos())) {
    case 0:
        delete_it();
        break;

    default:
        return;
    }

    package_modified();
}
Example #14
0
void IconCanvas::deleted() {
  disconnect(browser_node->get_data(), SIGNAL(deleted()), this, SLOT(deleted()));
  delete_it();
  canvas()->update();
}
Example #15
0
void IconCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  
  m.insertItem(new MenuTitle(browser_node->get_name() + TR("\nshort cut"), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 6);
  m.insertItem(TR("Go down"), 7);
  m.insertSeparator();
  if (! browser_node->deletedp()) {
    m.insertItem(TR("Open"), 2);
    m.insertSeparator();
  }
  m.insertItem(TR("Select diagram in browser"), 3);
  m.insertItem(TR("Select linked items"), 4);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"),5);

  switch (m.exec(QCursor::pos())) {
  case 0:
    upper();
    // force son reaffichage
    hide();
    show();
    canvas()->update();
    break;
  case 1:
    lower();
    // force son reaffichage
    hide();
    show();
    canvas()->update();
    break;
  case 6:
    z_up();
    // force son reaffichage
    hide();
    show();
    canvas()->update();
    break;
  case 7:
    z_down();
    // force son reaffichage
    hide();
    show();
    canvas()->update();
    break;
  case 2:
    browser_node->open(FALSE);
    return;
  case 3:
    browser_node->select_in_browser();
    return;
  case 4:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 5:
    // delete
    delete_it();
    break;
  default:
    return;
  }
  
  package_modified();
}
Example #16
0
void UcUseCaseCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  
  MenuFactory::createTitle(m, browser_node->get_data()->definition(FALSE, TRUE));
  m.insertSeparator();
  m.insertItem("Upper", 0);
  m.insertItem("Lower", 1);
  m.insertItem("Go up", 13);
  m.insertItem("Go down", 14);
  m.insertSeparator();
  m.insertItem("Add related elements", 10);
  m.insertSeparator();
  m.insertItem("Edit", 2);
  m.insertSeparator();
  m.insertItem("Edit drawing settings", 3);
  m.insertSeparator();
  m.insertItem("Select in browser",4);
  if (linked())
    m.insertItem("Select linked items", 5);
  m.insertSeparator();
  if (browser_node->is_writable()) {
    if (browser_node->get_associated() !=
	(BrowserNode *) the_canvas()->browser_diagram())
      m.insertItem("Set associated diagram",6);
    
    if (browser_node->get_associated())
      m.insertItem("Remove diagram association",9);
  }
  m.insertSeparator();
  m.insertItem("Remove from diagram",7);
  if (browser_node->is_writable())
    m.insertItem("Delete from model", 8);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlUseCase, 20))
    m.insertItem("Tool", &toolm);

  int rank = m.exec(QCursor::pos());
  
  switch (rank) {
  case 0:
    upper();
    modified();
    return;
  case 1:
    lower();
    modified();
    return;
  case 13:
    z_up();
    modified();
    return;
  case 14:
    z_down();
    modified();
    return;
  case 2:
    browser_node->open(TRUE);
    break;
  case 3:
    edit_drawing_settings();
    return;
  case 4:
    browser_node->select_in_browser();
    return;
  case 5:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 6:
    ((BrowserUseCase *) browser_node)->set_associated_diagram((BrowserUseCaseDiagram *)
							      the_canvas()->browser_diagram());
    break;
  case 12:
    ((BrowserUseCase *) browser_node)
      ->set_associated_diagram(0);
    return;
  case 7:
    // remove from diagram
    delete_it();
    break;
  case 8:
    // delete from model
    browser_node->delete_it();	// will remove canvas
    break;
  case 10:
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("use case"), TRUE, FALSE);
    return;
  default:
    if (rank >= 20)
      ToolCom::run(Tool::command(rank - 20), browser_node);
    return;
  }
  
  package_modified();
}
Example #17
0
void CodClassInstCanvas::remove(bool from_model) {
  if (!from_model || (browser_node->get_type() == UmlClass))
    delete_it();
  else
    browser_node->delete_it();	// will remove canvas
}
Example #18
0
void RelationData::end_deleted()
{
    // the unidirectionnal relation end class is removed
    start->package_modified();
    delete_it();
}
Example #19
0
void SimpleRelationCanvas::deleted()
{
    delete_it();
    canvas()->update();
    package_modified();
}
Example #20
0
void UcUseCaseCanvas::deleted() {
  delete_it();
}
Example #21
0
void FragmentCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Fragment"));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 7);
  m.insertItem(TR("Go down"), 8);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 2);
  m.insertItem(TR("Add separator"), 6);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 3);
  if (linked()) {
    m.insertSeparator();
    m.insertItem(TR("Select linked items"), 4);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"),5);
  if ((refer != 0) && !refer->deletedp()) {
    m.insertSeparator();
    m.insertItem(TR("Show referenced diagram"),9);
  }

  int index = m.exec(QCursor::pos());
  
  switch (index) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 7:
    z_up();
    modified();	// call package_modified()
    return;
  case 8:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    open();
    // modified then package_modified already called
    return;
  case 3:
    edit_drawing_settings();
    return;
  case 4:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 5:
    delete_it();
    break;
  case 6:
    {
      FragmentSeparatorCanvas * sp =
	new FragmentSeparatorCanvas(the_canvas(), this);
      
      separators.append(sp);
      the_canvas()->unselect_all();
      the_canvas()->select(sp);
    }
    break;
  case 9:
    refer->open(FALSE);
    return;
  default:
    return;
  }
  
  package_modified();
}
Example #22
0
void ActivityPartitionCanvas::deleted() {
  delete_it();
  canvas()->update();
}
Example #23
0
void ParameterSetCanvas::deleted() {
    delete_it();
    act->deleted(this);
    canvas()->update();
}
Example #24
0
void ActivityPartitionCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  int index;
  
  MenuFactory::createTitle(m, browser_node->get_data()->definition(FALSE, TRUE));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 13);
  m.insertItem(TR("Go down"), 14);
  m.insertSeparator();
  m.insertItem((horiz) ? TR("draw vertically") : TR("draw horizontally"), 10);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit activity partition"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select in browser"), 4);
  if (linked())
    m.insertItem(TR("Select linked items"), 5);
  m.insertSeparator();
  if (browser_node->is_writable()) {
    if (browser_node->get_associated() !=
	(BrowserNode *) the_canvas()->browser_diagram())
      m.insertItem(TR("Set associated diagram"),6);
    
    if (browser_node->get_associated())
      m.insertItem(TR("Remove diagram association"),9);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 7);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 8);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlActivityPartition, 20))
    m.insertItem(TR("Tool"), &toolm);
  
  switch (index = m.exec(QCursor::pos())) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 13:
    z_up();
    modified();	// call package_modified()
    return;
  case 14:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    edit_drawing_settings();
    return;
  case 3:
    browser_node->open(TRUE);
    return;
  case 4:
    browser_node->select_in_browser();
    return;
  case 5:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 6:
    ((BrowserActivityPartition *) browser_node)
      ->set_associated_diagram((BrowserActivityDiagram *)
			       the_canvas()->browser_diagram());
    return;
  case 7:
    //remove from diagram
    delete_it();
    break;
  case 8:
    //delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  case 9:
    ((BrowserActivityPartition *) browser_node)
      ->set_associated_diagram(0);
    return;
  case 10:
    turn(-1000, -1000);
    break;
  default:
    if (index >= 20)
      ToolCom::run(Tool::command(index - 20), browser_node);
    return;
  }
  
  package_modified();
}
Example #25
0
void ActivityPartitionCanvas::remove(bool from_model) {
  if (! from_model)
    delete_it();
  else
    browser_node->delete_it();	// will remove canvas
}
Example #26
0
void ParameterSetCanvas::remove(bool from_model) {
    if (! from_model)
        delete_it();
    else
        browser_node->delete_it();	// will remove canvas
}
Example #27
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);
  }
}
Example #28
0
void InterruptibleActivityRegionCanvas::deleted() {
  delete_it();
  canvas()->update();
}
Example #29
0
void ArrowJunctionCanvas::deleted()
{
    delete_it();
    canvas()->update();
}
Example #30
0
void InterruptibleActivityRegionCanvas::remove(bool from_model) {
  if (! from_model)
    delete_it();
  else
    browser_node->delete_it();	// will remove canvas
}