Beispiel #1
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) {
	ui.setupUi(this);

	statusLebelL = new QLabel();
	statusLabelR = new QLabel();

	// setup UI
	ui.statusBar->addWidget(statusLebelL, 1);
	ui.statusBar->addWidget(statusLabelR, 0);

	// setup the docking widgets
	controlWidget = new ControlWidget(this);

	// register the menu's "AboutToShow" handlers
	connect(ui.menuEdit, SIGNAL(aboutToShow()), this, SLOT(onMenuEdit()));

	// register the menu's action handlers
	connect(ui.actionNew, SIGNAL(triggered()), this, SLOT(onNew()));
	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen()));
	connect(ui.actionSave, SIGNAL(triggered()), this, SLOT(onSave()));
	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionSelectAll, SIGNAL(triggered()), this, SLOT(onSelectAll()));
	connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(onUndo()));
	connect(ui.actionCut, SIGNAL(triggered()), this, SLOT(onCut()));
	connect(ui.actionDeleteEdge, SIGNAL(triggered()), this, SLOT(onDeleteEdge()));
	connect(ui.actionControlWidget, SIGNAL(triggered()), this, SLOT(onShowControlWidget()));

	// setup the GL widget
	glWidget = new GLWidget(this);
	setCentralWidget(glWidget);

	// setup the event filter
	glWidget->installEventFilter(this);
	controlWidget->installEventFilter(this);
}
Beispiel #2
0
WITViewController::WITViewController(WITViewWidget *view)
{
	this->view = view;
	this->activeGestureController = 0;

	// Add controllers for each WITFrame
	WITFrame **frames = view->getFrames();

	for(int i = 0; i < view->getFrameCount(); i++)
	{
		this->frameToFrameController[frames[i]] = new WITFrameController(frames[i]);
		this->frameToGestureController[frames[i]] = new WITGestureController(frames[i]->getRenderer());
	}

	// Create our interactor style
	this->istyle = vtkInteractorStyleWIT::New();
	this->istyle->Init(this->view);

	// Hook up to istyle events
	connect(this->istyle, SIGNAL(beginGesture(int,int)), this, SLOT(onBeginGesture(int,int)));
	connect(this->istyle, SIGNAL(endGesture(int,int,bool)), this, SLOT(onEndGesture(int,int,bool)));
	connect(this->istyle, SIGNAL(addGesturePoint(int,int)), this, SLOT(onAddGesturePoint(int,int)));
	connect(this->istyle, SIGNAL(doMoveActiveVolumeSlice(int)), &WITApplication::getInstance().getSubjectDataController()->getVolumeViz(), SLOT(MoveActiveImage(int)));

	connect(WITApplication::getInstance().getPathwayController(), SIGNAL(pathwayVizLoaded(WITPathwayViz*)), this, SLOT(onPathwayVizLoaded(WITPathwayViz*)));

	// Make sure when an undo event occurs, we re-render
	connect(WITApplication::getInstance().getUndoSystem(),SIGNAL(onUndo()), this, SLOT(onRender()));
	connect(WITApplication::getInstance().getUndoSystem(),SIGNAL(onRedo()), this, SLOT(onRender()));

	//
	connect(this, SIGNAL(filterByGesture(PCollModel)), WITApplication::getInstance().getPathwayController(), SLOT(onFilterByGesture(PCollModel)));
}
Beispiel #3
0
void Cmd::undo()
{
  ASSERT(m_state == State::Executed || m_state == State::Redone);

  onUndo();
  onFireNotifications();

#if _DEBUG
  m_state = State::Undone;
#endif
}
Beispiel #4
0
void Cmd::undo()
{
  DLOG("Cmd: Undo cmd '%s'\n", typeid(*this).name());
  ASSERT(m_state == State::Executed || m_state == State::Redone);

  onUndo();
  onFireNotifications();

#if _DEBUG
  m_state = State::Undone;
#endif
}
Beispiel #5
0
void CSMWorld::ImportLandTexturesCommand::undo()
{
    // Restore to previous
    int textureColumn = mLands.findColumnIndex(Columns::ColumnId_LandTexturesIndex);
    QVariant variant;
    variant.setValue(mOld);
    mLands.setData(mLands.getModelIndex(getDestinationId(), textureColumn), variant);

    int stateColumn = mLands.findColumnIndex(Columns::ColumnId_Modification);
    mLands.setData(mLands.getModelIndex(getDestinationId(), stateColumn), mOldState);

    // Undo copy/touch/etc...
    onUndo();

    for (const std::string& id : mCreatedTextures)
    {
        int row = mLtexs.getModelIndex(id, 0).row();
        mLtexs.removeRows(row, 1);
    }
    mCreatedTextures.clear();
}
undoRedoRegistrationToolBox::undoRedoRegistrationToolBox(QWidget *parent) : medRegistrationAbstractToolBox(parent), d(new undoRedoRegistrationToolBoxPrivate)
{
    // Undo/redo Buttons
    d->undoButton = new QPushButton(QIcon(":undoRedoRegistration/icons/ArrowDown.png"),tr("Undo"),this);
    d->redoButton = new QPushButton(QIcon(":undoRedoRegistration/icons/ArrowUp.png"),tr("Redo"),this);
    d->undoButton->setEnabled(false);
    d->redoButton->setEnabled(false);
    d->resetButton = new QPushButton(tr("Reset"),this);
    d->resetButton->setEnabled(false);

    connect(d->undoButton,SIGNAL(clicked()),this,SLOT(onUndo()));
    connect(d->redoButton,SIGNAL(clicked()),this,SLOT(onRedo()));
    connect(d->resetButton,SIGNAL(clicked()),registrationFactory::instance(),SLOT(reset()));

    d->arrowCurrentStep = QIcon(":undoRedoRegistration/icons/BlueArrowRight.png");
    d->currentStep = -1;

    d->m_UndoRedo = new undoRedoRegistration();
    // Transformation Stack
    d->transformationStack = new QListWidget(this);

    QVBoxLayout *layoutButtonUndoRedo = new QVBoxLayout;
    layoutButtonUndoRedo->addWidget(d->redoButton);
    layoutButtonUndoRedo->addWidget(d->undoButton);
    layoutButtonUndoRedo->addWidget(d->resetButton);
    QHBoxLayout *layoutButtonsStack = new QHBoxLayout;
    layoutButtonsStack->addLayout(layoutButtonUndoRedo);
    layoutButtonsStack->addWidget(d->transformationStack);
    d->transformationStack->setFixedSize(180,160);

    QWidget * layoutSection = new QWidget(this);
    layoutSection->setLayout(layoutButtonsStack);

    addWidget(layoutSection);

    this->setTitle(tr("Stack of transformations"));
    connect(registrationFactory::instance(),SIGNAL(transformationAdded(int,QString)),this,SLOT(addTransformationIntoList(int, QString)));
    connect(registrationFactory::instance(),SIGNAL(transformationStackReset()),this,SLOT(onTransformationStackReset()));

}
Beispiel #7
0
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
 QmitkCommonWorkbenchWindowAdvisor::PostWindowCreate();
 // very bad hack...
 berry::IWorkbenchWindow::Pointer window =
  this->GetWindowConfigurer()->GetWindow();
 QMainWindow* mainWindow =
  static_cast<QMainWindow*> (window->GetShell()->GetControl());

 if (!windowIcon.empty())
 {
  mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
 }
 mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);

 /*mainWindow->setStyleSheet("color: white;"
 "background-color: #808080;"
 "selection-color: #659EC7;"
 "selection-background-color: #808080;"
 " QMenuBar {"
 "background-color: #808080; }");*/

 // ==== Application menu ============================
 QMenuBar* menuBar = mainWindow->menuBar();
 menuBar->setContextMenuPolicy(Qt::PreventContextMenu);

 QMenu* fileMenu = menuBar->addMenu("&File");
 fileMenu->setObjectName("FileMenu");

 QAction* fileOpenAction = new QmitkExtFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
 fileMenu->addAction(fileOpenAction);
 fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
 fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
 fileMenu->addAction(fileSaveProjectAction);
 closeProjectAction = new QmitkCloseProjectAction(window);
 closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
 fileMenu->addAction(closeProjectAction);
 fileMenu->addSeparator();
 QAction* fileExitAction = new QmitkFileExitAction(window);
 fileExitAction->setObjectName("QmitkFileExitAction");
 fileMenu->addAction(fileExitAction);

 berry::IViewRegistry* viewRegistry =
  berry::PlatformUI::GetWorkbench()->GetViewRegistry();
 const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors =
  viewRegistry->GetViews();

 // another bad hack to get an edit/undo menu...
 QMenu* editMenu = menuBar->addMenu("&Edit");
 undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
  "&Undo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
  QKeySequence("CTRL+Z"));
 undoAction->setToolTip("Undo the last action (not supported by all modules)");
 redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
  , "&Redo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
  QKeySequence("CTRL+Y"));
 redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");

 imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
 bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
 if (imageNavigatorViewFound)
 {
   QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
   imageNavigatorAction->setCheckable(true);

   // add part listener for image navigator
   imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
   window->GetPartService()->AddPartListener(imageNavigatorPartListener);
   berry::IViewPart::Pointer imageNavigatorView =
       window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
   imageNavigatorAction->setChecked(false);
   if (imageNavigatorView)
   {
     bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
     if (isImageNavigatorVisible)
       imageNavigatorAction->setChecked(true);
   }
   imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
 }

 // toolbar for showing file open, undo, redo and other main actions
 QToolBar* mainActionsToolBar = new QToolBar;
 mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif

 mainActionsToolBar->addAction(fileOpenAction);
 mainActionsToolBar->addAction(fileSaveProjectAction);
 mainActionsToolBar->addAction(closeProjectAction);
 mainActionsToolBar->addAction(undoAction);
 mainActionsToolBar->addAction(redoAction);
 if (imageNavigatorViewFound)
 {
   mainActionsToolBar->addAction(imageNavigatorAction);
 }
 mainWindow->addToolBar(mainActionsToolBar);

#ifdef __APPLE__
 mainWindow->setUnifiedTitleAndToolBarOnMac(true);
#endif

 // ==== Window Menu ==========================
 QMenu* windowMenu = menuBar->addMenu("Window");
 if (showNewWindowMenuItem)
 {
   windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
   windowMenu->addSeparator();
 }

 QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");

 QMenu* viewMenu;
 if (showViewMenuItem)
 {
   viewMenu = windowMenu->addMenu("Show &View");
   viewMenu->setObjectName("Show View");
 }
 windowMenu->addSeparator();
 resetPerspAction = windowMenu->addAction("&Reset Perspective",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));

 if(showClosePerspectiveMenuItem)
  closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));

 windowMenu->addSeparator();
 windowMenu->addAction("&Preferences...",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
  QKeySequence("CTRL+P"));

 // fill perspective menu
 berry::IPerspectiveRegistry* perspRegistry =
  window->GetWorkbench()->GetPerspectiveRegistry();
 QActionGroup* perspGroup = new QActionGroup(menuBar);

 std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(
  perspRegistry->GetPerspectives());

    bool skip = false;
    for (std::vector<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
      perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
    {

      // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
      // should not appear as an menu-entry in the perspective menu
      if (perspectiveExcludeList.size() > 0)
      {
        for (unsigned int i=0; i<perspectiveExcludeList.size(); i++)
        {
          if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
          {
            skip = true;
            break;
          }
        }
        if (skip)
        {
          skip = false;
          continue;
        }
      }

      QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
        *perspIt, perspGroup);
      mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction));
    }
 perspMenu->addActions(perspGroup->actions());

 // sort elements (converting vector to map...)
 std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
 std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;

 skip = false;
 for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
 {

   // if viewExcludeList is set, it contains the id-strings of view, which
   // should not appear as an menu-entry in the menu
   if (viewExcludeList.size() > 0)
   {
     for (unsigned int i=0; i<viewExcludeList.size(); i++)
     {
       if (viewExcludeList.at(i) == (*iter)->GetId())
       {
         skip = true;
         break;
       }
     }
     if (skip)
     {
       skip = false;
       continue;
     }
   }

  if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
   continue;
  if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
   continue;

  std::pair<std::string, berry::IViewDescriptor::Pointer> p(
   (*iter)->GetLabel(), (*iter));
  VDMap.insert(p);
 }
 // ==================================================

  // ==== Perspective Toolbar ==================================
 QToolBar* qPerspectiveToolbar = new QToolBar;

 if (showPerspectiveToolbar)
 {
  qPerspectiveToolbar->addActions(perspGroup->actions());
  mainWindow->addToolBar(qPerspectiveToolbar);
 }
 else
  delete qPerspectiveToolbar;

 // ==== View Toolbar ==================================
 QToolBar* qToolbar = new QToolBar;

 std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator
  MapIter;
 for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
 {
  berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
   (*MapIter).second);
  viewActions.push_back(viewAction);
  if(showViewMenuItem)
    viewMenu->addAction(viewAction);
  if (showViewToolbar)
  {
   qToolbar->addAction(viewAction);
  }
 }

 if (showViewToolbar)
 {
  mainWindow->addToolBar(qToolbar);
 }
 else
  delete qToolbar;

 QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
 mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());


 // ====================================================

 // ===== Help menu ====================================
 QMenu* helpMenu = menuBar->addMenu("Help");
 helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
  helpMenu->addAction("&Help Contents",this, SLOT(onHelp()),  QKeySequence("F1"));
 helpMenu->addAction("&About",this, SLOT(onAbout()));
 // =====================================================


 QStatusBar* qStatusBar = new QStatusBar();

 //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
 QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
 //disabling the SizeGrip in the lower right corner
 statusBar->SetSizeGripEnabled(false);



 QmitkProgressBar *progBar = new QmitkProgressBar();

 qStatusBar->addPermanentWidget(progBar, 0);
 progBar->hide();
// progBar->AddStepsToDo(2);
// progBar->Progress(1);

 mainWindow->setStatusBar(qStatusBar);

 QmitkMemoryUsageIndicatorView* memoryIndicator =
  new QmitkMemoryUsageIndicatorView();
 qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
{
   if ( !isActive() || !isAwake() )
      return false;

   S32 stringLen = mTextBuffer.length();
   setUpdate();

   // Ugly, but now I'm cool like MarkF.
   if(event.keyCode == KEY_BACKSPACE)
      goto dealWithBackspace;
   
   if ( event.modifier & SI_SHIFT )
   {

      // Added support for word jump selection.

      if ( event.modifier & SI_CTRL )
      {
         switch ( event.keyCode )
         {
            case KEY_LEFT:
            {
               S32 newpos = findPrevWord();               

               if ( mBlockStart == mBlockEnd )
               {
                  // There was not already a selection so start a new one.
                  mBlockStart = newpos;
                  mBlockEnd = mCursorPos;
               }
               else
               {
                  // There was a selection already...
                  // In this case the cursor MUST be at either the
                  // start or end of that selection.

                  if ( mCursorPos == mBlockStart )
                  {
                     // We are at the start block and traveling left so
                     // just extend the start block farther left.                     
                     mBlockStart = newpos;
                  }
                  else
                  {
                     // We are at the end block BUT traveling left
                     // back towards the start block...

                     if ( newpos > mBlockStart )
                     {
                        // We haven't overpassed the existing start block
                        // so just trim back the end block.
                        mBlockEnd = newpos;
                     }
                     else if ( newpos == mBlockStart )
                     {
                        // We are back at the start, so no more selection.
                        mBlockEnd = mBlockStart = 0;
                     }
                     else
                     {
                        // Only other option, we just backtracked PAST
                        // our original start block.
                        // So the new position becomes the start block
                        // and the old start block becomes the end block.
                        mBlockEnd = mBlockStart;
                        mBlockStart = newpos;
                     }
                  }
               }
                              
               mCursorPos = newpos;

               return true;
            }

            case KEY_RIGHT:
            {
               S32 newpos = findNextWord();               

               if ( mBlockStart == mBlockEnd )
               {
                  // There was not already a selection so start a new one.
                  mBlockStart = mCursorPos;
                  mBlockEnd = newpos;
               }
               else
               {
                  // There was a selection already...
                  // In this case the cursor MUST be at either the
                  // start or end of that selection.

                  if ( mCursorPos == mBlockEnd )
                  {
                     // We are at the end block and traveling right so
                     // just extend the end block farther right.                     
                     mBlockEnd = newpos;
                  }
                  else
                  {
                     // We are at the start block BUT traveling right
                     // back towards the end block...

                     if ( newpos < mBlockEnd )
                     {
                        // We haven't overpassed the existing end block
                        // so just trim back the start block.
                        mBlockStart = newpos;
                     }
                     else if ( newpos == mBlockEnd )
                     {
                        // We are back at the end, so no more selection.
                        mBlockEnd = mBlockStart = 0;
                     }
                     else
                     {
                        // Only other option, we just backtracked PAST
                        // our original end block.
                        // So the new position becomes the end block
                        // and the old end block becomes the start block.
                        mBlockStart = mBlockEnd;
                        mBlockEnd = newpos;
                     }
                  }
               }

               mCursorPos = newpos;

               return true;
            }
            
            default:
               break;
         }
      }

      // End support for word jump selection.


        switch ( event.keyCode )
        {
            case KEY_TAB:
               if ( mTabComplete )
               {
				  onTabComplete_callback("1");
                  return true;
               }
			   break; // We don't want to fall through if we don't handle the TAB here.

            case KEY_HOME:
               mBlockStart = 0;
               mBlockEnd = mCursorPos;
               mCursorPos = 0;
               return true;

            case KEY_END:
                mBlockStart = mCursorPos;
                mBlockEnd = stringLen;
                mCursorPos = stringLen;
                return true;

            case KEY_LEFT:
                if ((mCursorPos > 0) & (stringLen > 0))
                {
                    //if we already have a selected block
                    if (mCursorPos == mBlockEnd)
                    {
                        mCursorPos--;
                        mBlockEnd--;
                        if (mBlockEnd == mBlockStart)
                        {
                            mBlockStart = 0;
                            mBlockEnd = 0;
                        }
                    }
                    else {
                        mCursorPos--;
                        mBlockStart = mCursorPos;

                        if (mBlockEnd == 0)
                        {
                            mBlockEnd = mCursorPos + 1;
                        }
                    }
                }
                return true;

            case KEY_RIGHT:
                if (mCursorPos < stringLen)
                {
                    if ((mCursorPos == mBlockStart) && (mBlockEnd > 0))
                    {
                        mCursorPos++;
                        mBlockStart++;
                        if (mBlockStart == mBlockEnd)
                        {
                            mBlockStart = 0;
                            mBlockEnd = 0;
                        }
                    }
                    else
                    {
                        if (mBlockEnd == 0)
                        {
                            mBlockStart = mCursorPos;
                            mBlockEnd = mCursorPos;
                        }
                        mCursorPos++;
                        mBlockEnd++;
                    }
                }
                return true;

				case KEY_RETURN:
				case KEY_NUMPADENTER:
           
					return dealWithEnter(false);

            default:
               break;
        }
    }
   else if (event.modifier & SI_CTRL)
   {
      switch(event.keyCode)
      {
#if defined(TORQUE_OS_MAC)
         // Added UNIX emacs key bindings - just a little hack here...

         // Ctrl-B - move one character back
         case KEY_B:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_LEFT;
            return(onKeyDown(new_event));
         }

         // Ctrl-F - move one character forward
         case KEY_F:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_RIGHT;
            return(onKeyDown(new_event));
         }

         // Ctrl-A - move to the beginning of the line
         case KEY_A:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_HOME;
            return(onKeyDown(new_event));
         }

         // Ctrl-E - move to the end of the line
         case KEY_E:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_END;
            return(onKeyDown(new_event));
         }

         // Ctrl-P - move backward in history
         case KEY_P:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_UP;
            return(onKeyDown(new_event));
         }

         // Ctrl-N - move forward in history
         case KEY_N:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_DOWN;
            return(onKeyDown(new_event));
         }

         // Ctrl-D - delete under cursor
         case KEY_D:
         { 
            GuiEvent new_event;
            new_event.modifier = 0;
            new_event.keyCode = KEY_DELETE;
            return(onKeyDown(new_event));
         }

         case KEY_U:
         { 
            GuiEvent new_event;
            new_event.modifier = SI_CTRL;
            new_event.keyCode = KEY_DELETE;
            return(onKeyDown(new_event));
         }

         // End added UNIX emacs key bindings
#endif

         // Adding word jump navigation.

         case KEY_LEFT:
         {

            mCursorPos = findPrevWord();
            mBlockStart = 0;
            mBlockEnd = 0;
            return true;
         }

         case KEY_RIGHT:
         {
            mCursorPos = findNextWord();
            mBlockStart = 0;
            mBlockEnd = 0;
            return true;
         }         
         
#if !defined(TORQUE_OS_MAC)
         // Select all
         case KEY_A:
         {
            selectAllText();
            return true;
         }

         // windows style cut / copy / paste / undo keybinds
         case KEY_C:
         case KEY_X:
         {
            // copy, and cut the text if we hit ctrl-x
            onCopy( event.keyCode==KEY_X );
            return true;
         }
         case KEY_V:
         {
            onPaste();

            // Execute the console command!
            execConsoleCallback();
            return true;
         }

         case KEY_Z:
            if (! mDragHit)
            {
               onUndo();
               return true;
            }
#endif

         case KEY_DELETE:
         case KEY_BACKSPACE:
            //save the current state
            saveUndoState();

            //delete everything in the field
            mTextBuffer.set("");
            mCursorPos  = 0;
            mBlockStart = 0;
            mBlockEnd   = 0;

            execConsoleCallback();
            onChangeCursorPos(); //.logicking
            return true;
         default:
            break;
      }
   }
#if defined(TORQUE_OS_MAC)
   // mac style cut / copy / paste / undo keybinds
   else if (event.modifier & SI_ALT)
   {
      // Mac command key maps to alt in torque.

      // Added Mac cut/copy/paste/undo keys
      switch(event.keyCode)
      {
         // Select all
         case KEY_A:
         {
            selectAllText();
            return true;
         }
         case KEY_C:
         case KEY_X:
         {
            // copy, and cut the text if we hit cmd-x
            onCopy( event.keyCode==KEY_X );
            return true;
         }
         case KEY_V:
         {
            onPaste();

            // Execute the console command!
            execConsoleCallback();

            return true;
         }
            
         case KEY_Z:
            if (! mDragHit)
            {
               onUndo();
               return true;
            }
            
         default:
            break;
      }
   }
#endif
   else
   {
      switch(event.keyCode)
      {
         case KEY_ESCAPE:
            if( mEscapeCommand.isNotEmpty() )
            {
               evaluate( mEscapeCommand );
               return( true );
            }
            return( Parent::onKeyDown( event ) );

         case KEY_RETURN:
         case KEY_NUMPADENTER:
           
				return dealWithEnter(true);

         case KEY_UP:
         {
            if( mHistorySize > 0 )
            {
               if(mHistoryDirty)
               {
                  updateHistory(&mTextBuffer, false);
                  mHistoryDirty = false;
               }

               mHistoryIndex--;
               
               if(mHistoryIndex >= 0 && mHistoryIndex <= mHistoryLast)
                  setText(mHistoryBuf[mHistoryIndex]);
               else if(mHistoryIndex < 0)
                  mHistoryIndex = 0;
            }
               
            return true;
         }

         case KEY_DOWN:
         {
            if( mHistorySize > 0 )
            {
               if(mHistoryDirty)
               {
                  updateHistory(&mTextBuffer, false);
                  mHistoryDirty = false;
               }
               mHistoryIndex++;
               if(mHistoryIndex > mHistoryLast)
               {
                  mHistoryIndex = mHistoryLast + 1;
                  setText("");
               }
               else
                  setText(mHistoryBuf[mHistoryIndex]);
            }
            return true;
         }

         case KEY_LEFT:
            
            // If we have a selection put the cursor to the left side of it.
            if ( mBlockStart != mBlockEnd )
            {
               mCursorPos = mBlockStart;
               mBlockStart = mBlockEnd = 0;
            }
            else
            {
               mBlockStart = mBlockEnd = 0;
               mCursorPos = getMax( mCursorPos - 1, 0 );               
            }

            return true;

         case KEY_RIGHT:

            // If we have a selection put the cursor to the right side of it.            
            if ( mBlockStart != mBlockEnd )
            {
               mCursorPos = mBlockEnd;
               mBlockStart = mBlockEnd = 0;
            }
            else
            {
               mBlockStart = mBlockEnd = 0;
               mCursorPos = getMin( mCursorPos + 1, stringLen );               
            }

            return true;

         case KEY_BACKSPACE:
dealWithBackspace:
            //save the current state
            saveUndoState();

            if (mBlockEnd > 0)
            {
               mTextBuffer.cut(mBlockStart, mBlockEnd-mBlockStart);
               mCursorPos  = mBlockStart;
               mBlockStart = 0;
               mBlockEnd   = 0;
               mHistoryDirty = true;

               // Execute the console command!
               execConsoleCallback();

            }
            else if (mCursorPos > 0)
            {
               mTextBuffer.cut(mCursorPos-1, 1);
               mCursorPos--;
               mHistoryDirty = true;

               // Execute the console command!
               execConsoleCallback();
            }
            return true;

         case KEY_DELETE:
            //save the current state
            saveUndoState();

            if (mBlockEnd > 0)
            {
               mHistoryDirty = true;
               mTextBuffer.cut(mBlockStart, mBlockEnd-mBlockStart);

               mCursorPos = mBlockStart;
               mBlockStart = 0;
               mBlockEnd = 0;

               // Execute the console command!
               execConsoleCallback();
            }
            else if (mCursorPos < stringLen)
            {
               mHistoryDirty = true;
               mTextBuffer.cut(mCursorPos, 1);

               // Execute the console command!
               execConsoleCallback();
            }
            return true;

         case KEY_INSERT:
            mInsertOn = !mInsertOn;
            return true;

         case KEY_HOME:
            mBlockStart = 0;
            mBlockEnd   = 0;
            mCursorPos  = 0;
            return true;

         case KEY_END:
            mBlockStart = 0;
            mBlockEnd   = 0;
            mCursorPos  = stringLen;
            return true;
      
         default:
            break;

         }
   }

   switch ( event.keyCode )
   {
      case KEY_TAB:
         if ( mTabComplete )
         {
			onTabComplete_callback("0");
            return( true );
         }
      case KEY_UP:
      case KEY_DOWN:
      case KEY_ESCAPE:
         return Parent::onKeyDown( event );
      default:
         break;
   }
         
   // Handle character input events.

   if( mProfile->mFont->isValidChar( event.ascii ) )
   {
      handleCharInput( event.ascii );
      return true;
   }

   // Or eat it if that's appropriate.
   if( mSinkAllKeyEvents )
      return true;

   // Not handled - pass the event to it's parent.
   return Parent::onKeyDown( event );
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
  // very bad hack...
  berry::IWorkbenchWindow::Pointer window =
    this->GetWindowConfigurer()->GetWindow();
  QMainWindow* mainWindow =
    qobject_cast<QMainWindow*> (window->GetShell()->GetControl());

  if (!windowIcon.isEmpty())
  {
    mainWindow->setWindowIcon(QIcon(windowIcon));
  }
  mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);

  /*mainWindow->setStyleSheet("color: white;"
  "background-color: #808080;"
  "selection-color: #659EC7;"
  "selection-background-color: #808080;"
  " QMenuBar {"
  "background-color: #808080; }");*/

  // Load selected icon theme

  QStringList searchPaths = QIcon::themeSearchPaths();
  searchPaths.push_front( QString(":/org_mitk_icons/icons/") );
  QIcon::setThemeSearchPaths( searchPaths );

  berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
  berry::IPreferences::Pointer stylePref = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE);
  QString iconTheme = stylePref->Get(berry::QtPreferences::QT_ICON_THEME, "<<default>>");
  if( iconTheme == QString( "<<default>>" ) )
  {
    iconTheme = QString( "tango" );
  }
  QIcon::setThemeName( iconTheme );

  // ==== Application menu ============================

  QMenuBar* menuBar = mainWindow->menuBar();
  menuBar->setContextMenuPolicy(Qt::PreventContextMenu);

#ifdef __APPLE__
  menuBar->setNativeMenuBar(true);
#else
  menuBar->setNativeMenuBar(false);
#endif

  QAction* fileOpenAction = new QmitkFileOpenAction(QIcon::fromTheme("document-open",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-open.svg")), window);
  fileOpenAction->setShortcut(QKeySequence::Open);
  QAction* fileSaveAction = new QmitkFileSaveAction(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"), window);
  fileSaveAction->setShortcut(QKeySequence::Save);
  fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
  fileSaveProjectAction->setIcon(QIcon::fromTheme("document-save",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-save.svg")));
  closeProjectAction = new QmitkCloseProjectAction(window);
  closeProjectAction->setIcon(QIcon::fromTheme("edit-delete",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-delete.svg")));

  auto   perspGroup = new QActionGroup(menuBar);
  std::map<QString, berry::IViewDescriptor::Pointer> VDMap;

  // sort elements (converting vector to map...)
  QList<berry::IViewDescriptor::Pointer>::const_iterator iter;

  berry::IViewRegistry* viewRegistry =
    berry::PlatformUI::GetWorkbench()->GetViewRegistry();
  const QList<berry::IViewDescriptor::Pointer> viewDescriptors = viewRegistry->GetViews();

  bool skip = false;
  for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
  {
    // if viewExcludeList is set, it contains the id-strings of view, which
    // should not appear as an menu-entry in the menu
    if (viewExcludeList.size() > 0)
    {
      for (int i=0; i<viewExcludeList.size(); i++)
      {
        if (viewExcludeList.at(i) == (*iter)->GetId())
        {
          skip = true;
          break;
        }
      }
      if (skip)
      {
        skip = false;
        continue;
      }
    }

    if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
      continue;
    if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
      continue;
    if ((*iter)->GetId() == "org.mitk.views.viewnavigatorview")
      continue;

    std::pair<QString, berry::IViewDescriptor::Pointer> p(
      (*iter)->GetLabel(), (*iter));
    VDMap.insert(p);
  }

  std::map<QString, berry::IViewDescriptor::Pointer>::const_iterator
    MapIter;
  for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
  {
    berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
      (*MapIter).second);
    viewActions.push_back(viewAction);
  }

  if (!USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS)
  {
    QMenu* fileMenu = menuBar->addMenu("&File");
    fileMenu->setObjectName("FileMenu");
    fileMenu->addAction(fileOpenAction);
    fileMenu->addAction(fileSaveAction);
    fileMenu->addAction(fileSaveProjectAction);
    fileMenu->addAction(closeProjectAction);
    fileMenu->addSeparator();

    QAction* fileExitAction = new QmitkFileExitAction(window);
    fileExitAction->setIcon(QIcon::fromTheme("system-log-out",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/system-log-out.svg")));
    fileExitAction->setShortcut(QKeySequence::Quit);
    fileExitAction->setObjectName("QmitkFileExitAction");
    fileMenu->addAction(fileExitAction);

    // another bad hack to get an edit/undo menu...
    QMenu* editMenu = menuBar->addMenu("&Edit");
    undoAction = editMenu->addAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
      "&Undo",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
      QKeySequence("CTRL+Z"));
    undoAction->setToolTip("Undo the last action (not supported by all modules)");
    redoAction = editMenu->addAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg"))
      , "&Redo",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
      QKeySequence("CTRL+Y"));
    redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");

    // ==== Window Menu ==========================
    QMenu* windowMenu = menuBar->addMenu("Window");
    if (showNewWindowMenuItem)
    {
      windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
      windowMenu->addSeparator();
    }

    QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");

    QMenu* viewMenu;
    if (showViewMenuItem)
    {
      viewMenu = windowMenu->addMenu("Show &View");
      viewMenu->setObjectName("Show View");
    }
    windowMenu->addSeparator();
    resetPerspAction = windowMenu->addAction("&Reset Perspective",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));

    if(showClosePerspectiveMenuItem)
      closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));

    windowMenu->addSeparator();
    windowMenu->addAction("&Preferences...",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
      QKeySequence("CTRL+P"));

    // fill perspective menu
    berry::IPerspectiveRegistry* perspRegistry =
      window->GetWorkbench()->GetPerspectiveRegistry();

    QList<berry::IPerspectiveDescriptor::Pointer> perspectives(
      perspRegistry->GetPerspectives());

    skip = false;
    for (QList<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
      perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
    {
      // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
      // should not appear as an menu-entry in the perspective menu
      if (perspectiveExcludeList.size() > 0)
      {
        for (int i=0; i<perspectiveExcludeList.size(); i++)
        {
          if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
          {
            skip = true;
            break;
          }
        }
        if (skip)
        {
          skip = false;
          continue;
        }
      }

      QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
        *perspIt, perspGroup);
      mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction);
    }
    perspMenu->addActions(perspGroup->actions());

    if (showViewMenuItem)
    {
      for (auto viewAction : viewActions)
      {
        viewMenu->addAction(viewAction);
      }
    }

    // ===== Help menu ====================================
    QMenu* helpMenu = menuBar->addMenu("&Help");
    helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
    helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective()));
    helpMenu->addAction("&Context Help",this, SLOT(onHelp()),  QKeySequence("F1"));
    helpMenu->addAction("&About",this, SLOT(onAbout()));
    // =====================================================
  }
  else
  {
    //undoAction = new QAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
    //  "&Undo", nullptr);
    undoAction = new QmitkUndoAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")), nullptr);
    undoAction->setShortcut(QKeySequence::Undo);
    redoAction = new QmitkRedoAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg")), nullptr);
    redoAction->setShortcut(QKeySequence::Redo);
  }

  // toolbar for showing file open, undo, redo and other main actions
  auto   mainActionsToolBar = new QToolBar;
  mainActionsToolBar->setObjectName("mainActionsToolBar");
  mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif

  imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", nullptr);
  bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");

  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
  {
    openDicomEditorAction = new QmitkOpenDicomEditorAction(QIcon(":/org.mitk.gui.qt.ext/dcm-icon.png"),window);
  }

  if (imageNavigatorViewFound)
  {
    QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
    imageNavigatorAction->setCheckable(true);

    // add part listener for image navigator
    imageNavigatorPartListener.reset(new PartListenerForImageNavigator(imageNavigatorAction));
    window->GetPartService()->AddPartListener(imageNavigatorPartListener.data());
    berry::IViewPart::Pointer imageNavigatorView =
      window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
    imageNavigatorAction->setChecked(false);
    if (imageNavigatorView)
    {
      bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
      if (isImageNavigatorVisible)
        imageNavigatorAction->setChecked(true);
    }
    imageNavigatorAction->setToolTip("Toggle image navigator for navigating through image");
  }

  viewNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/view-manager_48.png"),"&View Navigator", nullptr);
  viewNavigatorFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.viewnavigatorview");
  if (viewNavigatorFound)
  {
    QObject::connect(viewNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onViewNavigator()));
    viewNavigatorAction->setCheckable(true);

    // add part listener for view navigator
    viewNavigatorPartListener.reset(new PartListenerForViewNavigator(viewNavigatorAction));
    window->GetPartService()->AddPartListener(viewNavigatorPartListener.data());
    berry::IViewPart::Pointer viewnavigatorview =
      window->GetActivePage()->FindView("org.mitk.views.viewnavigatorview");
    viewNavigatorAction->setChecked(false);
    if (viewnavigatorview)
    {
      bool isViewNavigatorVisible = window->GetActivePage()->IsPartVisible(viewnavigatorview);
      if (isViewNavigatorVisible)
        viewNavigatorAction->setChecked(true);
    }
    viewNavigatorAction->setToolTip("Toggle View Navigator");
  }

  mainActionsToolBar->addAction(fileOpenAction);
  mainActionsToolBar->addAction(fileSaveProjectAction);
  mainActionsToolBar->addAction(closeProjectAction);
  mainActionsToolBar->addAction(undoAction);
  mainActionsToolBar->addAction(redoAction);
  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
  {
    mainActionsToolBar->addAction(openDicomEditorAction);
  }
  if (imageNavigatorViewFound)
  {
    mainActionsToolBar->addAction(imageNavigatorAction);
  }
  if (viewNavigatorFound)
  {
    mainActionsToolBar->addAction(viewNavigatorAction);
  }
  mainWindow->addToolBar(mainActionsToolBar);

  // ==== Perspective Toolbar ==================================
  auto   qPerspectiveToolbar = new QToolBar;
  qPerspectiveToolbar->setObjectName("perspectiveToolBar");

  if (showPerspectiveToolbar)
  {
    qPerspectiveToolbar->addActions(perspGroup->actions());
    mainWindow->addToolBar(qPerspectiveToolbar);
  }
  else
    delete qPerspectiveToolbar;

  // ==== View Toolbar ==================================
  auto   qToolbar = new QToolBar;
  qToolbar->setObjectName("viewToolBar");

  if (showViewToolbar)
  {
    mainWindow->addToolBar(qToolbar);

    for (auto viewAction : viewActions)
    {
      qToolbar->addAction(viewAction);
    }
  }
  else
    delete qToolbar;

  QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
  mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());

  auto   qStatusBar = new QStatusBar();

  //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
  auto  statusBar = new QmitkStatusBar(qStatusBar);
  //disabling the SizeGrip in the lower right corner
  statusBar->SetSizeGripEnabled(false);

  auto  progBar = new QmitkProgressBar();

  qStatusBar->addPermanentWidget(progBar, 0);
  progBar->hide();
  // progBar->AddStepsToDo(2);
  // progBar->Progress(1);

  mainWindow->setStatusBar(qStatusBar);

  if (showMemoryIndicator)
  {
    auto   memoryIndicator = new QmitkMemoryUsageIndicatorView();
    qStatusBar->addPermanentWidget(memoryIndicator, 0);
  }
}
Beispiel #10
0
void Editor_menuEvent(int menuItem)
{
	int highlightRowStep = getTrackData()->highlightRowStep; 

	switch (menuItem)
	{
		case EDITOR_MENU_ENTER_CURRENT_V : 
		case EDITOR_MENU_ROWS_UP :
		case EDITOR_MENU_ROWS_DOWN :
		case EDITOR_MENU_PREV_BOOKMARK :
		case EDITOR_MENU_NEXT_BOOKMARK :
		case EDITOR_MENU_PREV_KEY :
		case EDITOR_MENU_NEXT_KEY :
		case EDITOR_MENU_PLAY : 
		{
			endEditing();
		}
	}

	cancelEditing();

	// If some internal control has focus we let it do its thing

	if (Emgui_hasKeyboardFocus())
	{
		Editor_update();
		return;
	}

	switch (menuItem)
	{
		// File

		case EDITOR_MENU_OPEN: onOpen(); break;
		case EDITOR_MENU_SAVE: onSave(); break;
		case EDITOR_MENU_SAVE_AS: onSaveAs(); break;
		case EDITOR_MENU_REMOTE_EXPORT : RemoteConnection_sendSaveCommand(); break;

		case EDITOR_MENU_RECENT_FILE_0:
		case EDITOR_MENU_RECENT_FILE_1:
		case EDITOR_MENU_RECENT_FILE_2:
		case EDITOR_MENU_RECENT_FILE_3:
		{

			Editor_loadRecentFile(menuItem - EDITOR_MENU_RECENT_FILE_0);
			break;
		}

		// Edit
		
		case EDITOR_MENU_UNDO : onUndo(); break;
		case EDITOR_MENU_REDO : onRedo(); break;

		case EDITOR_MENU_CANCEL_EDIT :  onCancelEdit(); break;
		case EDITOR_MENU_DELETE_KEY  :  onDeleteKey(); break;
		case EDITOR_MENU_CUT :          onCutAndCopy(true); break;
		case EDITOR_MENU_COPY :         onCutAndCopy(false); break;
		case EDITOR_MENU_PASTE :        onPaste(); break;
		case EDITOR_MENU_SELECT_TRACK : onSelectTrack(); break;

		case EDITOR_MENU_BIAS_P_001 : biasSelection(0.01f); break;
		case EDITOR_MENU_BIAS_P_01 :  biasSelection(0.1f); break;
		case EDITOR_MENU_BIAS_P_1:    biasSelection(1.0f); break;
		case EDITOR_MENU_BIAS_P_10:   biasSelection(10.0f); break;
		case EDITOR_MENU_BIAS_P_100:  biasSelection(100.0f); break;
		case EDITOR_MENU_BIAS_P_1000: biasSelection(1000.0f); break;
		case EDITOR_MENU_BIAS_N_001:  biasSelection(-0.01f); break;
		case EDITOR_MENU_BIAS_N_01:   biasSelection(-0.1f); break;
		case EDITOR_MENU_BIAS_N_1:    biasSelection(-1.0f); break;
		case EDITOR_MENU_BIAS_N_10:   biasSelection(-10.0f); break;
		case EDITOR_MENU_BIAS_N_100 : biasSelection(-100.0f); break;
		case EDITOR_MENU_BIAS_N_1000: biasSelection(-1000.0f); break;
		
		case EDITOR_MENU_INTERPOLATION : onInterpolation(); break;
		case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break;

		// View

		case EDITOR_MENU_PLAY : onPlay(); break;
		case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_2X_UP : onRowStep(-highlightRowStep * 2 , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_2X_DOWN : onRowStep(highlightRowStep * 2 , NO_SELECTION); break;
		case EDITOR_MENU_PREV_BOOKMARK : onBookmarkDir(ARROW_UP, NO_SELECTION); break;
		case EDITOR_MENU_NEXT_BOOKMARK : onBookmarkDir(ARROW_DOWN, NO_SELECTION); break;
		case EDITOR_MENU_FIRST_TRACK : onTrackSide(ARROW_LEFT, true, NO_SELECTION); break;
		case EDITOR_MENU_LAST_TRACK : onTrackSide(ARROW_RIGHT, true, NO_SELECTION); break;
		case EDITOR_MENU_PREV_KEY : onPrevNextKey(true, NO_SELECTION); break;
		case EDITOR_MENU_NEXT_KEY : onPrevNextKey(false, NO_SELECTION); break;
		case EDITOR_MENU_FOLD_TRACK : onFoldTrack(true); break;
		case EDITOR_MENU_UNFOLD_TRACK : onFoldTrack(false); break;
		case EDITOR_MENU_FOLD_GROUP : onFoldGroup(true); break;
		case EDITOR_MENU_UNFOLD_GROUP : onFoldGroup(false); break;
		case EDITOR_MENU_TOGGLE_BOOKMARK : onToggleBookmark(); break;
		case EDITOR_MENU_CLEAR_BOOKMARKS : onClearBookmarks(); break;
		case EDITOR_MENU_TAB : onTab(); break;
	}

	Editor_update();
}