Logo Search packages:      
Sourcecode: kdesdk version File versions

void UMLView::slotMenuSelection ( int  sel  )  [slot]

When a menu selection has been made on the menu that this view created, this method gets called.

Definition at line 2492 of file umlview.cpp.

References clearDiagram(), UMLDoc::createUMLObject(), deleteSelection(), UMLApp::editCutCopy(), exportImage(), FloatingText::isTextValid(), UMLDoc::loadRedoData(), UMLDoc::loadUndoData(), m_PastePoint, m_pDoc, UMLWidget::setActivated(), UMLWidget::setID(), UMLDoc::setModified(), setName(), setupNewWidget(), UMLWidget::setX(), UMLWidget::setY(), showPropDialog(), toggleShowGrid(), and toggleSnapToGrid().

Referenced by setMenu(), and slotRemovePopupMenu().

                                       {
      FloatingText * ft = 0;
      StateWidget * state = 0;
      ActivityWidget * activity = 0;
      bool ok = false;
      QString name = "";

      switch( (ListPopupMenu::Menu_Type)sel ) {
            case ListPopupMenu::mt_Undo:
                  m_pDoc->loadUndoData();
                  break;

            case ListPopupMenu::mt_Redo:
                  m_pDoc->loadRedoData();
                  break;

            case ListPopupMenu::mt_Clear:
                  clearDiagram();
                  break;

            case ListPopupMenu::mt_Export_Image:
                  exportImage();
                  break;

            case ListPopupMenu::mt_FloatText:
                  ft = new FloatingText(this);
                  ft -> changeTextDlg();
                  //if no text entered delete
                  if(!FloatingText::isTextValid(ft -> getText()))

                        delete ft;
                  else {
                        ft->setX( m_Pos.x() );
                        ft->setY( m_Pos.y() );
                        ft->setVisible( true );
                        ft->setID(m_pDoc -> getUniqueID());
                        ft->setActivated();
                        setupNewWidget(ft);
                  }
                  break;

            case ListPopupMenu::mt_UseCase:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject( ot_UseCase );
                  break;

            case ListPopupMenu::mt_Actor:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject( ot_Actor );
                  break;

            case ListPopupMenu::mt_Class:
            case ListPopupMenu::mt_Object:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject( ot_Class);
                  break;

            case ListPopupMenu::mt_Package:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Package);
                  break;

            case ListPopupMenu::mt_Component:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Component);
                  break;

            case ListPopupMenu::mt_Node:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Node);
                  break;

            case ListPopupMenu::mt_Artifact:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Artifact);
                  break;

            case ListPopupMenu::mt_Interface:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Interface);
                  break;

            case ListPopupMenu::mt_Enum:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Enum);
                  break;

            case ListPopupMenu::mt_Datatype:
                  m_bCreateObject = true;
                  m_pDoc->createUMLObject(ot_Datatype);
                  break;

            case ListPopupMenu::mt_Cut:
                  if ( m_SelectedList.count() &&
                       UMLApp::app()->editCutCopy(true) ) {
                        deleteSelection();
                        m_pDoc->setModified(true);
                  }
                  break;

            case ListPopupMenu::mt_Copy:
                  break;

            case ListPopupMenu::mt_Paste:
                  m_PastePoint = m_Pos;
                  m_Pos.setX( 2000 );
                  m_Pos.setY( 2000 );
                  UMLApp::app() -> slotEditPaste();

                  m_PastePoint.setX( 0 );
                  m_PastePoint.setY( 0 );
                  break;

            case ListPopupMenu::mt_Initial_State:
                  state = new StateWidget( this, StateWidget::Initial );
                  state -> setX( m_Pos.x() );
                  state -> setY ( m_Pos.y() );
                  state -> setVisible( true );
                  state -> setActivated();
                  setupNewWidget( state );
                  break;

            case ListPopupMenu::mt_End_State:
                  state = new StateWidget( this, StateWidget::End );
                  state -> setX( m_Pos.x() );
                  state -> setY ( m_Pos.y() );
                  state -> setVisible( true );
                  state -> setActivated();
                  setupNewWidget( state );
                  break;

            case ListPopupMenu::mt_State:
                  name = KInputDialog::getText( i18n("Enter State Name"), i18n("Enter the name of the new state:"), i18n("new state"), &ok, UMLApp::app() );
                  if( ok ) {
                        state = new StateWidget( this );
                        state -> setName( name );
                        state -> setX( m_Pos.x() );
                        state -> setY ( m_Pos.y() );
                        state -> setVisible( true );
                        state -> setActivated();
                        setupNewWidget( state );
                  }
                  break;

            case ListPopupMenu::mt_Initial_Activity:
                  activity = new ActivityWidget( this, ActivityWidget::Initial );
                  activity -> setX( m_Pos.x() );
                  activity -> setY ( m_Pos.y() );
                  activity -> setVisible( true );
                  activity -> setActivated();
                  setupNewWidget(activity);
                  break;


            case ListPopupMenu::mt_End_Activity:
                  activity = new ActivityWidget( this, ActivityWidget::End );
                  activity -> setX( m_Pos.x() );
                  activity -> setY ( m_Pos.y() );
                  activity -> setVisible( true );
                  activity -> setActivated();
                  setupNewWidget(activity);
                  break;

            case ListPopupMenu::mt_Branch:
                  activity = new ActivityWidget( this, ActivityWidget::Branch );
                  activity -> setX( m_Pos.x() );
                  activity -> setY ( m_Pos.y() );
                  activity -> setVisible( true );
                  activity -> setActivated();
                  setupNewWidget(activity);
                  break;

            case ListPopupMenu::mt_Activity:
                  name = KInputDialog::getText( i18n("Enter Activity Name"), i18n("Enter the name of the new activity:"),
                                          i18n("new activity"), &ok, UMLApp::app() );
                  if( ok ) {
                        activity = new ActivityWidget( this, ActivityWidget::Normal );
                        activity -> setName( name );
                        activity -> setX( m_Pos.x() );
                        activity -> setY ( m_Pos.y() );
                        activity -> setVisible( true );
                        activity -> setActivated();
                        setupNewWidget(activity);
                  }
                  break;

            case ListPopupMenu::mt_SnapToGrid:
                  toggleSnapToGrid();
                  m_pDoc->setModified();
                  break;

            case ListPopupMenu::mt_ShowSnapGrid:
                  toggleShowGrid();
                  m_pDoc->setModified();
                  break;

            case ListPopupMenu::mt_Properties:
                  if (showPropDialog() == true)
                        m_pDoc->setModified();
                  break;

            default:
                  break;
      }
}


Generated by  Doxygen 1.6.0   Back to index