示例#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();
}
示例#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();
}
示例#3
0
void IconCanvas::apply_shortcut(QString s) {
  if (s == "Select in browser") {
    browser_node->select_in_browser();
    return;
  }
  else if (s == "Edit") {
    browser_node->open(FALSE);
    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
    return;
  
  // force son reaffichage
  hide();
  show();
  canvas()->update();
}
示例#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();
}
示例#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();
}
示例#6
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();
}
示例#7
0
void InfoCanvas::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
    return;

  modified();
  package_modified();
}
示例#8
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();
}
示例#9
0
void ImageCanvas::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") {
        open();  // call modified then package_modified
        return;
    }
    else
        return;

    modified();
}
示例#10
0
void SdLifeLineCanvas::exec_menu(int rank)
{
    double old_z = z();

    switch (rank) {
    case 0:
        SdDurationCanvas::propag_visible(durations, FALSE);
        upper();
        SdDurationCanvas::propag_visible(durations, TRUE);
        break;

    case 1:
        lower();
        break;

    case 2:
        SdDurationCanvas::propag_visible(durations, FALSE);
        z_up();
        SdDurationCanvas::propag_visible(durations, TRUE);
        break;

    case 3:
        z_down();
        break;

    default:
        return;
    }

    double dz = z() - old_z;

    if (dz != 0) {
        SdDurationCanvas::propag_dz(durations, dz);

        // force son reaffichage
        hide();
        show();
        canvas()->update();
        package_modified();
    }
}
示例#11
0
void PseudoStateCanvas::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 {
    browser_node->apply_shortcut(s);
    return;
  }

  modified();
  package_modified();
}
示例#12
0
void TextCanvas::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") {
        open();  // call package_modified
        return;
    }
    else
        return;

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

    package_modified();
}
示例#13
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();
}
示例#14
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();
}
示例#15
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();
}
示例#16
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();
}
示例#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;
  }
}
示例#18
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();
}
示例#19
0
void TextCanvas::menu(const QPoint &)
{
    QMenu m(0);
    QMenu fontsubm(0);

    MenuFactory::createTitle(m,  QObject::tr("Text"));
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Upper"), 0);
    MenuFactory::addItem(m,  QObject::tr("Lower"), 1);
    MenuFactory::addItem(m,  QObject::tr("Go up"), 6);
    MenuFactory::addItem(m,  QObject::tr("Go down"), 7);
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Edit"), 2);
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Color"), 5);
    MenuFactory::insertItem(m,  QObject::tr("Font"), &fontsubm);
    init_font_menu(fontsubm, the_canvas(), 10);

    if (linked()) {
        m.addSeparator();
        MenuFactory::addItem(m,  QObject::tr("Select linked items"), 3);
    }

    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Remove from diagram"), 4);

    QAction* retAction = m.exec(QCursor::pos());
    if(retAction)
    {
        int index = retAction->data().toInt();

        switch (index) {
        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:
            open();
            return;	// call package_modified

        case 3:
            the_canvas()->unselect_all();
            select_associated();
            return;

        case 4:
            // delete
            the_canvas()->del(this);
            break;

        case 5:
            for (;;) {
                ColorSpecVector co(2);

                co[0].set( QObject::tr("foreground"), &fg_c);
                co[1].set( QObject::tr("background"), &bg_c);

                SettingsDialog dialog(0, &co, TRUE, FALSE,
                                      QObject::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);
                // force son reaffichage
                hide();
                show();
                canvas()->update();
                break;
            }
            else
                return;
        }
    }

    package_modified();
}
示例#20
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();
}
示例#21
0
void StateActionCanvas::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 state action"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select in browser"), 4);
  if (linked())
    m.insertItem(TR("Select linked items"), 5);
  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, UmlStateAction, 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 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();
}
示例#22
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();
}
示例#23
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();
}
示例#24
0
void InfoCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu fontsubm(0);
  
  MenuFactory::createTitle(m, TR("Information"));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 5);
  m.insertItem(TR("Go down"), 6);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 2);
  m.insertSeparator();
  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();

  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 5:
    z_up();
    modified();	// call package_modified()
    return;
  case 6:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    who->open();
    return;
  case 3:
    for (;;) {
      ColorSpecVector co(1);
      
      co[0].set(TR("note color"), &itscolor);

      SettingsDialog dialog(0, &co, FALSE);
      
      dialog.raise();
      if (dialog.exec() == QDialog::Accepted)
	modified();
      if (!dialog.redo())
	return;
    }
    break;
  case 4:
    the_canvas()->unselect_all();
    select_associated();
    return;
  default:
    if (index >= 10) {
      itsfont = (UmlFont) (index - 10);
      modified();
    }
    return;
  }
  
  package_modified();
}
示例#25
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;
  }
}
示例#26
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();
}
示例#27
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();
}
示例#28
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();
}
示例#29
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();
}
示例#30
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();
}