Exemple #1
0
void CodClassInstCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") { 
    browser_node->select_in_browser();
    return;
  }
  else if (s == "Upper")
    upper();
  else if (s == "Lower")
    lower();
  else if (s == "Go up")
    z_up();
  else if (s == "Go down")
    z_down();
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else if (s == "Edit") {
    open();  // call modified then package_modified
    return;
  }
  else 
    return;

  modified();
}
Exemple #2
0
void UcUseCaseCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") {
    browser_node->select_in_browser();
    return;
  }
  else if (s == "Upper")
    upper();
  else if (s == "Lower")
    lower();
  else if (s == "Go up")
    z_up();
  else if (s == "Go down")
    z_down();
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else if (s == "Add related elements") {
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("use case"), TRUE, FALSE);
    return;
  }
  else {
    browser_node->apply_shortcut(s);
    return;
  }

  modified();
  package_modified();
}
Exemple #3
0
void ParameterSetCanvas::apply_shortcut(QString s) {
    if (s == "Select in browser") {
        browser_node->select_in_browser();
        return;
    }
    else if (s == "Upper")
        act->upper();
    else if (s == "Lower")
        act->lower();
    else if (s == "Go up")
        act->z_up();
    else if (s == "Go down")
        act->z_down();
    else if (s == "Edit drawing settings") {
        edit_drawing_settings();
        return;
    }
    else {
        browser_node->apply_shortcut(s);
        return;
    }

    modified();
    package_modified();
}
Exemple #4
0
void ActivityPartitionCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") {
    browser_node->select_in_browser();
    return;
  }
  else if (s == "Upper")
    upper();
  else if (s == "Lower")
    lower();
  else if (s == "Go up")
    z_up();
  else if (s == "Go down")
    z_down();
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else {
    browser_node->apply_shortcut(s);
    return;
  }

  modified();
  package_modified();
}
Exemple #5
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();
}
Exemple #6
0
void TransitionCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") {
    data->get_start()->select_in_browser();
    return;
  }
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else {
    data->get_start()->apply_shortcut(s);
    return;
  }

  modified(); // call package_modified()
}
Exemple #7
0
void SdDurationCanvas::apply_shortcut(QString s) {
  if (s == "Upper")
    upper();
  else if (s == "Lower")
    lower();
  else if (s == "Go up")
    z_up();
  else if (s == "Go down")
    z_down();
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else 
    return;

  modified();
}
Exemple #8
0
void FlowCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") {
    data->get_start()->select_in_browser();
    return;
  }
  else if (s == "Edit drawing settings") {
    ArrowCanvas * aplabel;
    ArrowCanvas * apstereotype;
    
    search_supports(aplabel, apstereotype);
    if ((aplabel != 0) || (apstereotype != 0))
      edit_drawing_settings();
    return;
  }
  else {
    data->get_start()->apply_shortcut(s);
    return;
  }

  modified();
  package_modified();
}
Exemple #9
0
void FragmentCanvas::apply_shortcut(QString s) {
  if (s == "Upper")
    upper();
  else if (s == "Lower")
    lower();
  else if (s == "Go up")
    z_up();
  else if (s == "Go down")
    z_down();
  else if (s == "Edit drawing settings") {
    edit_drawing_settings();
    return;
  }
  else if (s == "Edit") {
    open();  // call modified then package_modified
    return;
  }
  else 
    return;

  modified();
  package_modified();
}
Exemple #10
0
void SdSelfMsgCanvas::apply_shortcut(QString s) {
    if (s == "Upper")
        upper();
    else if (s == "Lower")
        lower();
    else if (s == "Go up")
        z_up();
    else if (s == "Go down")
        z_down();
    else if (s == "Edit drawing settings") {
        edit_drawing_settings();
        return;
    }
    else if (s == "Edit")
        open();
    else
        return;

    // force son reaffichage
    hide();
    show();
    package_modified();
    canvas()->update();
}
Exemple #11
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();
}
Exemple #12
0
void NoteCanvas::menu(const QPoint &)
{
    Q3PopupMenu m(0);
    Q3PopupMenu fontsubm(0);

    MenuFactory::createTitle(m, TR("Note"));
    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.insertSeparator();
    m.insertItem(TR("Color of text"), 6);
    m.insertItem(TR("Font"), &fontsubm);
    init_font_menu(fontsubm, the_canvas(), 10);
    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 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:
        for (;;) {
            ColorSpecVector co(1);

            co[0].set(TR("color"), &fg_c);

            SettingsDialog dialog(0, &co, TRUE, FALSE,
                                  TR("Text color dialog"));

            dialog.raise();

            if (dialog.exec() != QDialog::Accepted)
                return;

            // force son reaffichage
            hide();
            show();
            canvas()->update();

            if (!dialog.redo())
                break;
            else
                package_modified();
        }

        break;

    default:
        if (index >= 10) {
            itsfont = (UmlFont)(index - 10);
            modified();
        }

        return;
    }

    package_modified();
}
Exemple #13
0
void ParameterSetCanvas::menu(const QPoint &) {
    QPopupMenu m(0);
    QPopupMenu toolm(0);
    int index;

    m.insertItem(new MenuTitle(browser_node->get_data()->definition(FALSE, TRUE), m.font()), -1);
    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(TR("Edit drawing settings"), 2);
    m.insertSeparator();
    m.insertItem(TR("Edit parameter set"), 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()) {
        m.insertItem(TR("Delete from model"), 8);
        m.insertSeparator();
    }
    if (Tool::menu_insert(&toolm, UmlParameterSet, 20))
        m.insertItem(TR("Tool"), &toolm);

    switch (index = m.exec(QCursor::pos())) {
    case 0:
        act->upper();
        modified();	// call package_modified()
        return;
    case 1:
        act->lower();
        modified();	// call package_modified()
        return;
    case 13:
        act->z_up();
        modified();	// call package_modified()
        return;
    case 14:
        act->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 8:
        //delete from model
        browser_node->delete_it();	// will delete the canvas
        break;
    default:
        if (index >= 20)
            ToolCom::run(Tool::command(index - 20), browser_node);
        return;
    }

    package_modified();
}
Exemple #14
0
void ActivityActionCanvas::menu(const QPoint&) {
  ActivityActionData * data = (ActivityActionData *) browser_node->get_data();
  QPopupMenu m(0);
  QPopupMenu toolm(0);
  
  m.insertItem(new MenuTitle(data->definition(FALSE, TRUE), m.font()), -1);
  m.insertSeparator();
  if (browser_node->is_writable() && data->may_add_pin()) {
    m.insertItem(TR("Add pin"), 7);
    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(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit activity action"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select in browser"), 4);
  
  const char * what;
  BrowserNode * who = data->get_action()->referenced(what);
  BrowserNode * diag = 0;
  
  if (who != 0)
    m.insertItem(TR("Select %1 in browser", QString(what)), 10);
  
  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 (data->get_action_kind() == UmlCallBehaviorAction) {
      BasicData * d = data->get_action()->depend_on();

      if (d != 0) {
	diag = d->get_browser_node()->get_associated();
	if ((diag != 0) &&
	    (diag != (BrowserNode *) the_canvas()->browser_diagram()))
	  m.insertItem(TR("Set associated diagram from behavior"), 11);
      }
    }
    
    if (browser_node->get_associated())
      m.insertItem(TR("Remove diagram association"),12);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 8);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 9);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlActivityAction, 20))
    m.insertItem(TR("Tool"), &toolm);

  int index;
  
  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:
    ((BrowserActivityAction *) browser_node)
      ->set_associated_diagram(the_canvas()->browser_diagram());
    return;
  case 12:
    ((BrowserActivityAction *) browser_node)
      ->set_associated_diagram(0);
    return;
  case 7:
    if (BrowserPin::add_pin(0, browser_node) != 0)
      modified();	// call package_modified()
    break;
  case 8:
    //remove from diagram
    delete_it();
    break;
  case 9:
    //delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  case 10:
    who->select_in_browser();
    return;
  case 11:
    ((BrowserActivityAction *) browser_node)->set_associated_diagram(diag);
    return;
  default:
    if (index >= 20)
      ToolCom::run(Tool::command(index - 20), browser_node);
    return;
  }
}
Exemple #15
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();
}
Exemple #16
0
void CodClassInstCanvas::menu(const QPoint&) {
  QPopupMenu m(0);
  bool modelized = (browser_node->get_type() == UmlClassInstance);
  
  m.insertItem(new MenuTitle(full_name(), m.font()), -1);
  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(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 3);
  m.insertSeparator();
  if (modelized)
    m.insertItem(TR("Select in browser"), 4);
  m.insertItem(TR("Select class in browser"), 5);
  if (linked())
    m.insertItem(TR("Select linked items"), 6);
  m.insertSeparator();
  if (modelized)
    m.insertItem(TR("Exit from model"), 9);
  else {
    if (container(UmlClass)->is_writable())
      m.insertItem(TR("Insert in model"), 10);
    m.insertItem(TR("Replace it"), 11);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 7);
  if (modelized && browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 8);
  
  switch (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:
    open();	// call package_modified
    return;
  case 4:
    browser_node->select_in_browser();
    return;
  case 5:
    get_type()->select_in_browser();
    return;
  case 6:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 7:
    delete_it();
    break;
  case 8:
    //delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  case 9:
    {
      BasicData * d = browser_node->get_data();
      
      disconnect(d, SIGNAL(changed()), this, SLOT(modified()));
      disconnect(d, SIGNAL(deleted()), this, SLOT(deleted()));
      
      iname = browser_node->get_name();
      browser_node = ((ClassInstanceData *) d)->get_class();
      d = browser_node->get_data();
      connect(d, SIGNAL(changed()), this, SLOT(modified()));
      connect(d, SIGNAL(deleted()), this, SLOT(deleted()));
    }
    break;
  case 10:
    {
      BasicData * d = browser_node->get_data();
      
      disconnect(d, SIGNAL(changed()), this, SLOT(modified()));
      disconnect(d, SIGNAL(deleted()), this, SLOT(deleted()));
      
      browser_node =
	new BrowserClassInstance(iname, (BrowserClass *) browser_node,
				 container(UmlClass));
      d = browser_node->get_data();
      connect(d, SIGNAL(changed()), this, SLOT(modified()));
      connect(d, SIGNAL(deleted()), this, SLOT(deleted()));
    }
    break;
  case 11:
    {
      BrowserNode * bn = 
	BrowserClassInstance::get_classinstance((BrowserClass *) browser_node);
      
      if (bn == 0)
	return;
      
      BasicData * d = browser_node->get_data();
      
      disconnect(d, SIGNAL(changed()), this, SLOT(modified()));
      disconnect(d, SIGNAL(deleted()), this, SLOT(deleted()));
      
      browser_node = bn;
      d = browser_node->get_data();
      connect(d, SIGNAL(changed()), this, SLOT(modified()));
      connect(d, SIGNAL(deleted()), this, SLOT(deleted()));
      modified();	// call package_modified
      return;
    }
    break;
  default:
    return;
  }
  
  package_modified();
}
Exemple #17
0
void OdClassInstCanvas::menu(const QPoint&) {
  QPopupMenu m(0);
  
  m.insertItem(new MenuTitle(full_name(), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 9);
  m.insertItem(TR("Go down"), 10);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select in browser"), 4);
  m.insertItem(TR("Select class in browser"), 5);
  if (linked())
    m.insertItem(TR("Select linked items"), 6);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 7);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 8);
  
  switch (m.exec(QCursor::pos())) {
  case 0:
    upper();
    modified();	// call package_modified
    return;
  case 1:
    lower();
    modified();	// call package_modified
    return;
  case 9:
    z_up();
    modified();	// call package_modified()
    return;
  case 10:
    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:
    ((ClassInstanceData *) browser_node->get_data())
      ->get_class()->select_in_browser();
    return;
  case 6:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 7:
    delete_it();
    package_modified();
    return;
  case 8:
    //delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  default:
    return;
  }
}
Exemple #18
0
void SdDurationCanvas::menu(const QPoint & p) {
  Q3PopupMenu m(0);
  Q3CanvasItemList items = collisions(TRUE);
  Q3PtrList<SdDurationCanvas> l;
  Q3CanvasItemList::ConstIterator it;
  Q3CanvasItemList::ConstIterator end = items.end();
  
  for (it = items.begin(); it != end; ++it) {
    if ((*it)->visible()) {
      DiagramItem * di = QCanvasItemToDiagramItem(*it);
      
      if ((di != 0) &&
	  (di->type() == UmlActivityDuration) &&
	  (((SdDurationCanvas *) di)->support == support))
	l.append((SdDurationCanvas *) di);
    }
  }
  
  m.insertItem(new MenuTitle(TR("Activity bar"), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 9);
  m.insertItem(TR("Go down"), 10);
  m.insertSeparator();
  m.insertItem((coregion) ? TR("Draw as activity bar") :  TR("Draw as a coregion"), 7);
  m.insertItem(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Select linked items"), 3);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 4);
  m.insertSeparator();
  m.insertItem(TR("Cut here"), 5);
  if (!l.isEmpty())
    m.insertItem(TR("Merge juxtaposed activity bars"), 6);
  if (support->isaDuration())
    m.insertItem(TR("Collapse in parent bar"), 8);

  switch (m.exec(QCursor::pos())) {
  case 0:
    upper();
    modified();
    return;
  case 1:
    lower();
    modified();
    return;
  case 9:
    z_up();
    modified();	// call package_modified()
    return;
  case 10:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    edit_drawing_settings();
    return;
  case 3:
    select_associated();
    break;
  case 4:
    delete_it();
    package_modified();
    break;
  case 5:
    cut(p);
    package_modified();
    break;
  case 6:
    merge(l);
    package_modified();
    break;
  case 7:
    coregion = !coregion;
    modified();
    return;
  case 8:
    {
      SdDurationCanvas * d = (SdDurationCanvas *) support;
      
      d->collapse(this);
      d->update_hpos(); // update sub duration and msg hpos
      d->update_self();
    }    
    package_modified();
    break;
  default:
    return;
  }
  
  canvas()->update();
}
Exemple #19
0
void DeploymentNodeCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  
  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(TR("Add related elements"), 10);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select node in browser"), 4);
  if (linked())
    m.insertItem(TR("Select linked items"), 5);
  m.insertSeparator();
  m.insertItem(TR("Set node associated diagram"), 6);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 7);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlDeploymentNode, 20))
    m.insertItem(TR("Tool"), &toolm);

  int rank = m.exec(QCursor::pos());
  
  switch (rank) {
  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:
    open();
    return;
  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:
    ((BrowserDeploymentNode *) browser_node)
      ->set_associated_diagram((BrowserDeploymentDiagram *)
			       the_canvas()->browser_diagram());
    return;
  case 7:
    // remove from diagram
    delete_it();
    break;
  case 10:
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("node"), FALSE, FALSE);
    return;
  default:
    if (rank >= 20)
      ToolCom::run(Tool::command(rank - 20), browser_node);
    return;
  }
  
  package_modified();
}
Exemple #20
0
void UcClassCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  
  m.insertItem(new MenuTitle(browser_node->get_data()->definition(FALSE, TRUE), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 8);
  m.insertItem(TR("Go down"), 9);
  m.insertSeparator();
  m.insertItem(TR("Add related elements"), 10);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 4);
  m.insertSeparator();
  if (browser_node->is_writable()) {
    m.insertItem(TR("Edit"), 7);
    m.insertSeparator();
  }
  m.insertItem(TR("Select in browser"),2);
  if (linked())
    m.insertItem(TR("Select linked items"), 3);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"),5);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 6);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlClass, 20))
    m.insertItem(TR("Tool"), &toolm);

  int rank = m.exec(QCursor::pos());
  
  switch (rank) {
  case 0:
    upper();
    hide();
    show();
    break;
  case 1:
    lower();
    hide();
    show();
    break;
  case 2:
    browser_node->select_in_browser();
    return;
  case 3:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 4:
    edit_drawing_settings();
    return;
  case 5:
    // remove from diagram
    delete_it();
    break;
  case 6:
    // delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  case 7:
    browser_node->open(TRUE);
    break;
  case 8:
    z_up();
    hide();
    show();
    break;
  case 9:
    z_down();
    hide();
    show();
    break;
  case 10:
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("class/actor"), TRUE, FALSE);
    return;
  default:
    if (rank >= 20)
      ToolCom::run(Tool::command(rank - 20), browser_node);
    return;
  }
  
  package_modified();
}
Exemple #21
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();
}
Exemple #22
0
void SdSelfMsgCanvas::menu(const QPoint&) {
    Q3PopupMenu m(0);

    m.insertItem(new MenuTitle(TR("Message"), m.font()), -1);
    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(TR("Edit"), 2);
    m.insertItem(TR("Edit drawing settings"), 3);
    m.insertSeparator();
    if (msg != 0)
        m.insertItem(TR("Select operation in browser"), 8);
    m.insertItem(TR("Select linked items"), 4);
    if (label || stereotype) {
        m.insertSeparator();
        m.insertItem(TR("Select stereotype and label"), 5);
        m.insertItem(TR("Default stereotype and label position"), 6);
    }
    if (((BrowserSeqDiagram *) the_canvas()->browser_diagram())
            ->is_overlapping_bars()) {
        m.insertSeparator();
        m.insertItem(TR("Go to new overlapping bar"), 9);
        if (dest->isOverlappingDuration())
            m.insertItem(TR("Go to parent bar"), 10);
    }
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 7);

    switch (m.exec(QCursor::pos())) {
    case 0:
        upper();
        // force son reaffichage
        hide();
        show();
        break;
    case 1:
        lower();
        // force son reaffichage
        hide();
        show();
        break;
    case 13:
        z_up();
        // force son reaffichage
        hide();
        show();
        break;
    case 14:
        z_down();
        // force son reaffichage
        hide();
        show();
        break;
    case 2:
        open();
        break;
    case 3:
        edit_drawing_settings();
        return;
    case 4:
        select_associated();
        break;
    case 5:
        the_canvas()->unselect_all();
        if (label)
            the_canvas()->select(label);
        if (stereotype)
            the_canvas()->select(stereotype);
        break;
    case 6:
        if (label)
            default_label_position();
        if (stereotype)
            default_stereotype_position();
        break;
    case 7:
        delete_it();
        return;
    case 8:
        msg->get_browser_node()->select_in_browser();
        return;
    case 9:
        ((SdDurationCanvas *) dest)->go_up(this, TRUE);
        break;
    case 10:
        ((SdDurationCanvas *) dest)->go_down(this);
    default:
        return;
    }

    package_modified();
    canvas()->update();
}
Exemple #23
0
void ArtifactCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu gensubm(0);
  Q3PopupMenu toolm(0);
  int index;
  
  m.insertItem(new MenuTitle(browser_node->get_data()->definition(FALSE, TRUE), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 15);
  m.insertItem(TR("Go down"), 16);
  m.insertSeparator();
  m.insertItem(TR("Add related elements"), 17);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 2);
  m.insertSeparator();
  m.insertItem(TR("Edit artifact"), 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"),12);
  }
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"), 7);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 8);
  m.insertSeparator();

  bool cpp = GenerationSettings::cpp_get_default_defs();
  bool java = GenerationSettings::java_get_default_defs();
  bool php = GenerationSettings::php_get_default_defs();
  bool python = GenerationSettings::python_get_default_defs();
  bool idl = GenerationSettings::idl_get_default_defs();

  if (cpp || java || php || python || idl)
    m.insertItem(TR("Generate"), &gensubm);
  
  if (Tool::menu_insert(&toolm, UmlArtifact, 20))
    m.insertItem(TR("Tool"), &toolm);
  
  if (cpp)
    gensubm.insertItem("C++", 9);
  if (java)
    gensubm.insertItem("Java", 10);
  if (php)
    gensubm.insertItem("Php", 13);
  if (python)
    gensubm.insertItem("Python", 14);
  if (idl)
    gensubm.insertItem("Idl", 11);
  
  switch (index = m.exec(QCursor::pos())) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 15:
    z_up();
    modified();	// call package_modified()
    return;
  case 16:
    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:
    ((BrowserArtifact *) browser_node)
      ->set_associated_diagram((BrowserDeploymentDiagram *)
			       the_canvas()->browser_diagram());
    return;
  case 12:
    ((BrowserArtifact *) 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 delete the canvas
    break;
  case 9:
    browser_node->apply_shortcut("Generate C++");
    return;
  case 10:
    browser_node->apply_shortcut("Generate Java");
    return;
  case 11:
    browser_node->apply_shortcut("Generate Idl");
    return;
  case 13:
    browser_node->apply_shortcut("Generate Php");
    return;
  case 14:
    browser_node->apply_shortcut("Generate Python");
    return;
  case 17:
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("artifact"), TRUE, FALSE);
    return;
  default:
    if (index >= 20)
      ToolCom::run(Tool::command(index - 20), browser_node);
    return;
  }
  
  package_modified();
}
Exemple #24
0
void FlowCanvas::menu(const QPoint &) {
  if ((data != 0) && !data->get_start()->in_edition()) {
    FlowCanvas * plabel;
    FlowCanvas * pstereotype;
    
    {
      ArrowCanvas * aplabel;
      ArrowCanvas * apstereotype;
      
      search_supports(aplabel, apstereotype);
      plabel = (FlowCanvas *) aplabel;
      pstereotype = (FlowCanvas *) apstereotype;
    }
    
    Q3PopupMenu m(0);
    Q3PopupMenu geo(0);
    Q3PopupMenu toolm(0);
    
    MenuFactory::createTitle(m, data->definition(FALSE, TRUE));
    m.insertSeparator();
    m.insertItem(TR("Edit"), 0);
    m.insertSeparator();

    m.insertItem(TR("Select in browser"), 2);
    if (plabel || pstereotype) {
      m.insertSeparator();
      m.insertItem(TR("Edit drawing settings"), 1);
      m.insertItem(TR("Select labels"), 3);
      m.insertItem(TR("Labels default position"), 4);
      if (plabel && (label == 0))
	m.insertItem(TR("Attach flow label to this segment"), 5);
      if (pstereotype && (stereotype == 0))
	m.insertItem(TR("Attach stereotype to this segment"), 6);
    }
  
    if (get_start() != get_end()) {
      m.insertSeparator();
      init_geometry_menu(geo, 10);
      m.insertItem(TR("Geometry (Ctrl+l)"), &geo);
    }
    
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"),7);
    if (data->get_start()->is_writable())
      m.insertItem(TR("Delete from model"), 8);
    
    m.insertSeparator();
    if (Tool::menu_insert(&toolm, itstype, 20))
      m.insertItem(TR("Tool"), &toolm);
    
    int rank = m.exec(QCursor::pos());
    
    switch (rank) {
    case 0:
      data->edit();
      return;
    case 1:
      edit_drawing_settings();
      return;
    case 2:
      data->get_start()->select_in_browser();
      return;
    case 3:
      the_canvas()->unselect_all();
      if (plabel)
	the_canvas()->select(plabel->label);
      if (pstereotype)
	the_canvas()->select(pstereotype->stereotype);
      return;
    case 4:
      if (plabel)
	plabel->default_label_position();
      if (pstereotype)
	pstereotype->stereotype_default_position();
      return;
    case 5:
      label = plabel->label;
      plabel->label = 0;
      default_label_position();
      return;
    case 6:
      stereotype = pstereotype->stereotype;
      pstereotype->stereotype = 0;
      if (label != 0)
	default_label_position();
      stereotype_default_position();
      return;
    case 7:
      // not removed from the browser : just hide it
      remove(FALSE);
      break;
    case 8:
      data->delete_it();	// will delete the canvas
      break;
    default:
      if (rank >= 20) {
	ToolCom::run(Tool::command(rank - 20), data->get_start());
	return;
      }
      else 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();
  }
}