Beispiel #1
0
void ComponentDiagramView::menu(const QPoint& p) {
  Q3PopupMenu m(0);
  
  m.insertItem(new MenuTitle(TR("Component diagram menu"), m.font()), -1);
 
  if ((((UmlCanvas *) canvas())->browser_diagram())->is_writable()) {
    DiagramItemList items(canvas()->allItems());
    Q3PtrDict<DiagramItem> drawn;
    
    get_drawn(items, drawn);
    
    if (marked_not_yet_drawn(drawn))
      m.insertItem(TR("Add marked elements"), 28);
    
    switch (default_menu(m, 30)) {
    case EDIT_DRAWING_SETTING_CMD:
      ((BrowserComponentDiagram *) the_canvas()->browser_diagram())->edit_settings();
      break;
    case RELOAD_CMD:
      // pure drawing modifications are lost
      // mark the diagram modified because the undid modifications
      // may be saved in the file are not saved in memory
      load("Component");
      window()->package_modified();
      break;
    case 28:
      add_marked_elements(p, drawn);
      break;
    }
  }
  else
    (void) default_menu(m, 30);
}
Beispiel #2
0
void ColDiagramView::menu(const QPoint &)
{
    Q3PopupMenu m(0);

    MenuFactory::createTitle(m, TR("Communication diagram menu"));

    if ((((UmlCanvas *) canvas())->browser_diagram())->is_writable()) {
        m.insertSeparator();
        m.insertItem(TR("Edit all the messages"), 29);
    }

    switch (default_menu(m, 30)) {
    case EDIT_DRAWING_SETTING_CMD:
        ((BrowserColDiagram *) the_canvas()->browser_diagram())->edit_settings();
        break;

    case RELOAD_CMD:
        // pure drawing modifications are lost
        // mark the diagram modified because the undid modifications
        // may be saved in the file are not saved in memory
        load("Communication");
        update_msgs();
        window()->package_modified();
        break;

    case 29:
        CodEditMsgDialog::exec(this, msgs);
        break;
    }
}
Beispiel #3
0
void ClassDiagramView::menu(const QPoint& p) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Class diagram menu"));

  if ((((UmlCanvas *) canvas())->browser_diagram())->is_writable()) {
    BrowserNode * bn = BrowserView::selected_item();
    DiagramItemList items(canvas()->allItems());
    Q3PtrDict<DiagramItem> drawn;
    
    get_drawn(items, drawn);
    
    if ((bn != 0) && (bn->get_type() == UmlClassView)) {      
      if (not_yet_drawn(bn, drawn)) {
	m.insertItem(TR("Add classes of the selected class view"), 29);
	if (marked_not_yet_drawn(drawn))
	  m.insertItem(TR("Add marked elements"), 28);
	m.insertSeparator();
      }
    }
    else if (marked_not_yet_drawn(drawn)) {
      m.insertItem(TR("Add marked elements"), 28);
      m.insertSeparator();
    }
    
    switch (default_menu(m, 30)) {
    case EDIT_DRAWING_SETTING_CMD:
      ((BrowserClassDiagram *) ((UmlCanvas *) canvas())->browser_diagram())->edit_settings();
      break;
    case RELOAD_CMD:
      // pure drawing modifications are lost
      // mark the diagram modified because the undid modifications
      // may be saved in the file are not saved in memory
      load("Class");
      window()->package_modified();
      break;
    case 28:
      add_marked_elements(p, drawn);
      break;
    case 29:
      add_classview_classes(bn, p, drawn);
      break;
    }
  }
  else
    (void) default_menu(m, 30);
}
void SeqDiagramView::menu(const QPoint &)
{
    QMenu m(0);

    MenuFactory::createTitle(m, tr("Sequence diagram menu"));

    if ((((UmlCanvas *) canvas())->browser_diagram())->is_writable()) {
        BrowserSeqDiagram * sd = (BrowserSeqDiagram *) window()->browser_diagram();
        bool overlapping = sd->is_overlapping_bars();

        MenuFactory::addItem(m, (overlapping) ? tr("Transform to flat activity bars")
                                              : tr("Transform to overlapping activity bars"),
                             29);
        m.addSeparator();

        switch (default_menu(m, 30)) {
        case EDIT_DRAWING_SETTING_CMD:
            ((BrowserSeqDiagram *) the_canvas()->browser_diagram())->edit_settings();
            return;

        case RELOAD_CMD:
            // pure drawing modifications are lost
            // mark the diagram modified because the undid modifications
            // may be saved in the file are not saved in memory
            load("Sequence");
            window()->package_modified();
            break;

        case 29:
            unselect_all();
            sd->set_overlapping_bars(!overlapping);

            if (overlapping)
                toFlat();
            else
                toOverlapping();

            canvas()->update();
            window()->package_modified();
            break;
        }
    }
    else
        (void) default_menu(m, 30);
}
Beispiel #5
0
static void _book_menu_fn(int cmd, int which, vptr cookie, variant *res)
{
    switch (cmd)
    {
    case MENU_TEXT:
        var_set_string(res, _books[which].name);
        break;
    default:
        default_menu(cmd, which, cookie, res);
    }
}
static void _tval_menu_fn(int cmd, int which, vptr cookie, variant *res)
{
    switch (cmd)
    {
    case MENU_KEY:
        var_set_int(res, _tval_choices[which].name[0]);
        break;
    case MENU_TEXT:
        var_set_string(res, format("%s", _tval_choices[which].name));
        break;
    default:
        default_menu(cmd, which, cookie, res);
    }
}
static void _group_menu_fn(int cmd, int which, vptr cookie, variant *res)
{
    _group_t *groups = (_group_t*)cookie;
    switch (cmd)
    {
    case MENU_KEY:
        var_set_int(res, groups[which].name[0]);
        break;
    case MENU_TEXT:
        var_set_string(res, format("%s", groups[which].name));
        break;
    default:
        default_menu(cmd, which, cookie, res);
    }
}
Beispiel #8
0
static void _spell_menu_fn(int cmd, int which, vptr cookie, variant *res)
{
    switch (cmd)
    {
    case MENU_TEXT:
        var_set_string(res, _groups[which].name);
        break;
    case MENU_HELP:
        var_set_string(res, _groups[which].help);
        break;
    case MENU_COLOR:
        var_set_int(res, _groups[which].color);
        break;
    default:
        default_menu(cmd, which, cookie, res);
    }
}
Beispiel #9
0
void ObjectDiagramView::menu(const QPoint&) {
  Q3PopupMenu m(0);
  
  MenuFactory::createTitle(m, TR("Object diagram menu"));
 
  switch (default_menu(m, 30)) {
  case EDIT_DRAWING_SETTING_CMD:
    ((BrowserObjectDiagram *) the_canvas()->browser_diagram())->edit_settings();
    break;
  case RELOAD_CMD:
    // pure drawing modifications are lost
    // mark the diagram modified because the undid modifications
    // may be saved in the file are not saved in memory
    load("Object");
    window()->package_modified();
    break;
  }
}
static void _spell_menu_fn(int cmd, int which, vptr cookie, variant *res)
{
    _spell_menu_t *ss = (_spell_menu_t*)cookie;
    _spell_menu_t *s = ss + which;

    switch (cmd)
    {
    case MENU_TEXT:
        if (s->total_charges)
        {
            char    buf[1024];
            _kind_t k = s->spell->kind;
            cptr    info = _do_device(s->spell->kind.tval, s->spell->kind.sval, SPELL_INFO);

            sprintf(buf, "%-22.22s %3d %3d %3d%% ", _kind_name(&k), s->charges, s->total_charges, s->fail);
            if (info)
                strcat(buf, info);
            var_set_string(res, buf);
        }
        else
            var_clear(res);
        break;            
    case MENU_HELP:
        var_set_string(res, _kind_desc(&s->spell->kind));
        break;
    case MENU_COLOR:
        if (!s->total_charges)
            var_set_int(res, TERM_DARK);
        else if (!s->charges)
            var_set_int(res, TERM_RED);
        else
            var_set_int(res, TERM_WHITE);
        break;
    default:
        default_menu(cmd, which, cookie, res);
    }
}