コード例 #1
0
ファイル: ComponentDiagramView.cpp プロジェクト: kralf/bouml
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);
}
コード例 #2
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);
}