Esempio n. 1
0
void BrowserComponent::menu()
{
    QMenu m(name,0);
    QMenu rqsubm(0);
    QMenu prsubm(0);
    QMenu rzsubm(0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_edited) {
            MenuFactory::addItem(m, QObject::tr("New nested component"), 4,
                           QObject::tr("to add an <i>nested component</i> to the <i>component</i>"));
            m.addSeparator();
            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                           QObject::tr("to edit the <i>component</i>, \
a double click with the left mouse button does the same thing"));

            if (!is_read_only && (edition_number == 0)) {
                m.addSeparator();
                MenuFactory::addItem(m, QObject::tr("Delete"), 1,
                               QObject::tr("to delete the <i>component</i>. \
Note that you can undelete it after"));
            }
        }
Esempio n. 2
0
void BrowserArtifact::menu()
{
    QMenu m(name,0);
    QMenu clsubm(0);
    QMenu gensubm(0);
    QMenu editsubm(0);
    QMenu roundtripbodysubm(0);
    QMenu roundtripsubm(0);
    QMenu toolm(0);
    QString cpp_h_path;
    QString cpp_src_path;
    QString java_path;
    QString php_path;
    QString python_path;
    QString idl_path;

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_edited) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>artifact</i>, \
                                             a double click with the left mouse button does the same thing"));

                                             if (!is_read_only && (edition_number == 0)) {
                                                 m.addSeparator();
                                                 MenuFactory::addItem(m, QObject::tr("Delete"), 1,
                                                 QObject::tr("to delete the <i>artifact</i>. \
                                                 Note that you can undelete it after"));
                                             }
        }
Esempio n. 3
0
void BrowserRelation::menu()
{
    Q3PopupMenu m(0, name);
    Q3PopupMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.insertSeparator();

    if (!deletedp()) {
        if (!in_edition()) {
            m.setWhatsThis(m.insertItem(TR("Edit"), 0),
                           TR("to edit the <i>relation</i>, \
a double click with the left mouse button does the same thing"));

            if (!is_read_only && (edition_number == 0)) {
                if (RelationData::isa_association(def->get_type())) {
                    m.setWhatsThis(m.insertItem(TR("Duplicate"), 1),
                                   TR("to copy the <i>relation</i> in a new one"));

                    if (get_oper == 0)
                        m.setWhatsThis(m.insertItem(TR("New get operation"), 4),
                                       TR("to auto define the <i>get operation</i>"));

                    if (set_oper == 0)
                        m.setWhatsThis(m.insertItem(TR("New set operation"), 5),
                                       TR("to auto define the <i>set operation</i>"));

                    if ((get_oper == 0) && (set_oper == 0))
                        m.setWhatsThis(m.insertItem(TR("New get and set operation"), 6),
                                       TR("to auto define the <i>get</i> and <i>set operation</i>s"));

                    m.insertSeparator();
                }
            }

            m.setWhatsThis(m.insertItem(TR("Referenced by"), 8),
                           TR("to know who reference the <i>relation</i>"));
            m.insertSeparator();

            if (!is_read_only && (edition_number == 0)) {
                m.setWhatsThis(m.insertItem(TR("Delete"), 2),
                               TR("to delete the <i>relation</i>. \
Note that you can undelete it after"));
            }

            m.insertSeparator();
        }
Esempio n. 4
0
void BrowserRelation::menu()
{
    QMenu m(name,0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!in_edition()) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>relation</i>, \
                                             a double click with the left mouse button does the same thing"));

                                             if (!is_read_only && (edition_number == 0)) {
                                                 if (RelationData::isa_association(def->get_type())) {
                                                     MenuFactory::addItem(m, QObject::tr("Duplicate"), 1,
                                                     QObject::tr("to copy the <i>relation</i> in a new one"));

                                                     if (get_oper == 0)
                                                     MenuFactory::addItem(m, QObject::tr("New get operation"), 4,
                                                     QObject::tr("to auto define the <i>get operation</i>"));

                                                     if (set_oper == 0)
                                                     MenuFactory::addItem(m, QObject::tr("New set operation"), 5,
                                                     QObject::tr("to auto define the <i>set operation</i>"));

                                                     if ((get_oper == 0) && (set_oper == 0))
                                                     MenuFactory::addItem(m, QObject::tr("New get and set operation"), 6,
                                                     QObject::tr("to auto define the <i>get</i> and <i>set operation</i>s"));

                                                     m.addSeparator();
                                                 }
                                             }

                                             MenuFactory::addItem(m, QObject::tr("Referenced by"), 8,
                                                                  QObject::tr("to know who reference the <i>relation</i>"));
                                 m.addSeparator();

                    if (!is_read_only && (edition_number == 0)) {
                MenuFactory::addItem(m, QObject::tr("Delete"), 2,
                                     QObject::tr("to delete the <i>relation</i>. \
                                                 Note that you can undelete it after"));
            }

            m.addSeparator();
        }
Esempio n. 5
0
void BrowserSimpleRelation::menu() {
  Q3PopupMenu m(0, name);
  Q3PopupMenu toolm(0);
  
  MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
  m.insertSeparator();
  if (!deletedp()) {
    if (!in_edition()) {
      m.setWhatsThis(m.insertItem(TR("Edit"), 0),
		     TR("to edit the <i>relation</i>, \
a double click with the left mouse button does the same thing"));
      if (!is_read_only && (edition_number == 0)) {
	m.setWhatsThis(m.insertItem(TR("Delete"), 2),
		       TR("to delete the <i>relation</i>. \
Note that you can undelete it after"));
      }
      m.insertSeparator();
    }
Esempio n. 6
0
void BrowserTransition::menu()
{
    QMenu m("transition",0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();
    if (!deletedp()) {
        if (!in_edition()) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>transition</i>, \
a double click with the left mouse button does the same thing"));

            if (!is_read_only && (edition_number == 0)) {
                MenuFactory::addItem(m, QObject::tr("Delete"), 2,
                                     QObject::tr("to delete the <i>transition</i>. \
Note that you can undelete it after"));
            }

            m.addSeparator();
        }
Esempio n. 7
0
void BrowserDeploymentView::menu()
{
    QMenu m(0);
    QMenu subm(0);
    QMenu roundtripm(0);
    QMenu roundtripbodym(0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_read_only && (edition_number == 0)) {
            MenuFactory::addItem(m, QObject::tr("New deployment diagram"), 0,
                           QObject::tr("to add a <i>deployment diagram</i>"));
            MenuFactory::addItem(m, QObject::tr("New node"), 1,
                           QObject::tr("to add a <i>node</i>"));
            MenuFactory::addItem(m, QObject::tr("New artifact"), 2,
                           QObject::tr("to add an <i>artifact</i>"));
            m.addSeparator();
        }

        if (!is_edited) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 3,
                           QObject::tr("to edit the <i>deployment view</i>"));

            if (!is_read_only) {
                m.addSeparator();
                //MenuFactory::addItem(m, "Edit node settings", 4),
                //		   "to set the sub node's settings");
                MenuFactory::addItem(m, QObject::tr("Edit drawing settings"), 5,
                               QObject::tr("to set how the sub <i>deployment diagrams</i>'s items must be drawn"));

                if (edition_number == 0) {
                    m.addSeparator();
                    MenuFactory::addItem(m, QObject::tr("Delete"), 6,
                                   QObject::tr("to delete the <i>deployment view</i> and its sub items. \
Note that you can undelete them after"));
                }
            }
Esempio n. 8
0
void BrowserClassInstance::menu()
{
    QMenu m("class instance",0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_edited) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>class instance</i>, \
                                             a double click with the left mouse button does the same thing"));
                                             MenuFactory::addItem(m, QObject::tr("Duplicate"), 4,
                                                                  QObject::tr("to duplicate the <i>class instance</i>"));

                                 if (!is_read_only && (edition_number == 0)) {
                                     m.addSeparator();
                                     MenuFactory::addItem(m, QObject::tr("Delete"), 1,
                                     QObject::tr("to delete the <i>class instance</i>. \
                                     Note that you can undelete it after"));
                                 }
        }
Esempio n. 9
0
void BrowserRegion::menu()
{
    QMenu m(name, 0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_read_only) {
            MenuFactory::addItem(m, QObject::tr("New state"), 1,
                           QObject::tr("to add a <i>state</i> to the <i>region</i>"));
        }

        m.addSeparator();
        MenuFactory::addItem(m, QObject::tr("Edit"), 3,
                       QObject::tr("to edit the <i>region</i>, \
a double click with the left mouse button does the same thing"));

        if (!is_read_only && (edition_number == 0)) {
            m.addSeparator();
            MenuFactory::addItem(m, QObject::tr("Delete"), 7,
                           QObject::tr("to delete the <i>region</i>. \
Note that you can undelete it after"));
        }

        mark_menu(m, QObject::tr("the region").toLatin1().constData(), 90);
        ProfiledStereotypes::menu(m, this, 99990);

        if ((edition_number == 0) &&
            Tool::menu_insert(&toolm, get_type(), 100)) {
            m.addSeparator();
            toolm.setTitle(QObject::tr(("Tool")));
            m.addMenu(&toolm);
        }
    }
void BrowserComponentView::menu()
{
    QMenu m(0);
    QMenu subm(0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_read_only && (edition_number == 0)) {
            MenuFactory::addItem(m, QObject::tr("New component diagram"), 0,
                           QObject::tr("to add a <i>component diagram</i>"));
            MenuFactory::addItem(m, QObject::tr("New component"), 1,
                           QObject::tr("to add a <i>component</i>"));
            m.addSeparator();
        }

        if (!is_edited) {
            MenuFactory::addItem(m, QObject::tr("Edit"), 3,
                           QObject::tr("to edit the <i>component view</i>"));
            m.addSeparator();

            if (!is_read_only) {
                /*MenuFactory::addItem(m, "Edit component settings", 4),
                	       "to set the sub components's settings");*/
                MenuFactory::addItem(m, QObject::tr("Edit drawing settings"), 5,
                               QObject::tr("to set how the sub <i>component diagrams</i>'s items must be drawn"));

                if (edition_number == 0) {
                    m.addSeparator();
                    MenuFactory::addItem(m, QObject::tr("Delete"), 6,
                                   QObject::tr("to delete the <i>component view</i> and its sub items. \
Note that you can undelete them after"));
                }
            }
Esempio n. 11
0
void SimpleRelationCanvas::menu(const QPoint &)
{
    if ((data != 0) && !data->get_start()->in_edition()) {
        SimpleRelationCanvas * pstereotype;

        {
            ArrowCanvas * aplabel;	// cannot exist
            ArrowCanvas * apstereotype;

            search_supports(aplabel, apstereotype);
            pstereotype = (SimpleRelationCanvas *) apstereotype;
        }

        Q3PopupMenu m(0);
        Q3PopupMenu geo(0);
        Q3PopupMenu toolm(0);

        MenuFactory::createTitle(m, data->definition(FALSE, TRUE));
        m.insertSeparator();
        m.insertItem("Edit", 0);
        m.insertSeparator();

        m.insertItem("Select in browser", 2);

        if (pstereotype) {
            m.insertSeparator();
            m.insertItem("Select stereotype", 3);
            m.insertItem("Stereotype default position", 4);

            if (stereotype == 0)
                m.insertItem("Attach stereotype to this segment", 6);
        }

        if (get_start() != get_end()) {
            m.insertSeparator();
            init_geometry_menu(geo, 10);
            m.insertItem("Geometry (Ctrl+l)", &geo);
        }

        m.insertSeparator();
        m.insertItem("Remove from diagram", 7);

        if (data->get_start()->is_writable())
            m.insertItem("Delete from model", 8);

        m.insertSeparator();

        if (Tool::menu_insert(&toolm, itstype, 20))
            m.insertItem("Tool", &toolm);

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

        switch (rank) {
        case 0:
            data->edit();
            return;

        case 2:
            data->get_start()->select_in_browser();
            return;

        case 3:
            the_canvas()->unselect_all();
            the_canvas()->select(pstereotype->stereotype);
            return;

        case 4:
            pstereotype->stereotype_default_position();
            return;

        case 6:
            stereotype = pstereotype->stereotype;
            pstereotype->stereotype = 0;
            stereotype_default_position();
            break;

        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();
    }
}
Esempio n. 12
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;
  }
}
Esempio n. 13
0
void BrowserOperation::menu()
{
    QMenu m(name,0);
    QMenu implbym(0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_edited) {
            if (get_container(UmlClass) != 0)
                MenuFactory::addItem(m, QObject::tr("Up"), go_up,
                                     QObject::tr("to return to parent node"));

            QString nameOfNode = ((BrowserNode *) parent())->get_name();
            if(name == nameOfNode)
                MenuFactory::addItem(m, QObject::tr("Add constructor initializer"),
                                     add_constructor_initializer,
                                     QObject::tr("to edit the <i>operation</i>,"
                                                 "a double click with the left mouse button does the same thing"));



            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>operation</i>,"
                                             "a double click with the left mouse button does the same thing"));

            if (GenerationSettings::cpp_get_default_defs() &&
                    (strstr(def->get_cppdef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit C++ body"), 4,
                                     QObject::tr("to edit the <i>operation</i> and its C++ body"));

            if (GenerationSettings::java_get_default_defs() &&
                    (strstr(def->get_javadef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Java body"), 5,
                                     QObject::tr("to edit the <i>operation</i> and its Java body"));

            if (GenerationSettings::php_get_default_defs() &&
                    (strstr(def->get_phpdef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Php body"), 6,
                                     QObject::tr("to edit the <i>operation</i> and its Php body"));

            if (GenerationSettings::python_get_default_defs() &&
                    (strstr(def->get_pythondef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Python body"), 7,
                                     QObject::tr("to edit the <i>operation</i> and its Python body"));

            if (((BrowserClass *) parent())->is_writable()) {
                if ((get_of == 0) && (set_of == 0))
                    MenuFactory::addItem(m, QObject::tr("Duplicate"), 1,
                                         QObject::tr("to copy the <i>operation</i> in a new one"));

                MenuFactory::addItem(m, QObject::tr("Add implementing activity"), 9,
                                     QObject::tr("to add a new <i>activity</i> implementing the <i>operation</i>"));
                MenuFactory::addItem(m, QObject::tr("Add implementing state"), 10,
                                     QObject::tr("to add a new <i>state</i> implementing the <i>operation</i>"));
            }

            m.addSeparator();
            MenuFactory::addItem(m, QObject::tr("Referenced by"), 8,
                                 QObject::tr("to know who reference the <i>operation</i>"));

            ImplBy.clear();
            BrowserActivity::compute_referenced_by(ImplBy, this);
            BrowserState::compute_referenced_by(ImplBy, this);

            if (! ImplBy.isEmpty()) {
                MenuFactory::insertItem(m, QObject::tr("Select implementing behavior"), &implbym,
                                        QObject::tr("to select a <i>state</i> or <i>activity</i> implementing the <i>operation</i>"));

                MenuFactory::createTitle(implbym, QObject::tr("Choose behavior"));
                implbym.addSeparator();

                int rank = 10000;

                foreach (BrowserNode * beh, ImplBy)
                    MenuFactory::addItem(implbym, beh->full_name(TRUE), rank);
            }

            if (!is_read_only && (edition_number == 0)) {
                m.addSeparator();
                MenuFactory::addItem(m, QObject::tr("Delete"), 2,
                                     QObject::tr("to delete the <i>operation</i>. \
                                                 Note that you can undelete it after"));
            }
        }

        mark_menu(m, QObject::tr("the operation"), 90);
        ProfiledStereotypes::menu(m, this, 99990);

        if ((edition_number == 0) &&
                Tool::menu_insert(&toolm, get_type(), 100)) {
            m.addSeparator();
            toolm.setTitle( QObject::tr("Tool"));
            m.addMenu(&toolm);
        }
    }
Esempio n. 14
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();
}
Esempio n. 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();
}
Esempio n. 16
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();
}
Esempio n. 17
0
void PseudoStateCanvas::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();
  switch (browser_node->get_type()) {
  case ForkPS:
  case JoinPS:
    m.insertItem((horiz) ? TR("draw vertically") : TR("draw horizontally"), 2);
    m.insertSeparator();
    break;
  default:
    break;
  }
  /*m.insertItem("Edit drawing settings", 2);
  m.insertSeparator();*/
  m.insertItem(TR("Edit pseudo state"), 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);
  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, browser_node->get_type(), 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:
    horiz ^= TRUE;
    if (!manual_size)
      set_xpm();
    else {
      setSize(height(), width());
      DiagramCanvas::resize(width(), height());
    }
    modified();	// call package_modified()
    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 7:
    //remove from diagram
    delete_it();
    break;
  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();
}
Esempio n. 18
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();
}
Esempio n. 19
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();
  }
}
Esempio n. 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();
}
Esempio n. 21
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();
}