void CanvasMode_EditArc::activate(bool fromGesture)
{
	VectorDialog = new ArcVectorDialog(m_ScMW);
	m_canvas->m_viewMode.m_MouseButtonPressed = false;
	m_canvas->resetRenderMode();
	m_doc->DragP = false;
	m_doc->leaveDrag = false;
	m_canvas->m_viewMode.operItemMoving = false;
	m_canvas->m_viewMode.operItemResizing = false;
	m_view->MidButt = false;
	Mxp = Myp = -1;
	PageItem *currItem = m_doc->m_Selection->itemAt(0);
	PageItem_Arc* item = currItem->asArc();
	centerPoint = currItem->PoLine.pointQF(0);
	startPoint = currItem->PoLine.pointQF(3);
	endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 4);
	widthPoint = QPointF(centerPoint.x() - item->arcWidth / 2.0, centerPoint.y());
	heightPoint = QPointF(centerPoint.x(), centerPoint.y() - item->arcHeight / 2.0);
	startAngle = item->arcStartAngle;
	endAngle = startAngle + item->arcSweepAngle;
	QLineF res = QLineF(centerPoint, startPoint);
	QLineF swe = QLineF(centerPoint, endPoint);
	VectorDialog->setValues(res.angle(), swe.angle(), item->arcHeight, item->arcWidth);
	VectorDialog->show();
	setModeCursor();
	if (fromGesture)
	{
		m_view->update();
	}
	connect(VectorDialog, SIGNAL(NewVectors(double, double, double, double)), this, SLOT(applyValues(double, double, double, double)));
	connect(VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
	connect(VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
	connect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
}
void CanvasMode_EditWeldPoint::activate(bool fromGesture)
{
	m_canvas->m_viewMode.m_MouseButtonPressed = false;
	m_canvas->resetRenderMode();
	m_doc->DragP = false;
	m_doc->leaveDrag = false;
	m_canvas->m_viewMode.operItemMoving = false;
	m_canvas->m_viewMode.operItemResizing = false;
	m_view->MidButt = false;
	m_keyRepeat = false;
	m_currItem = m_doc->m_Selection->itemAt(0);
	m_weldToList = m_currItem->itemsWeldedTo();
	m_weldToList.append(m_currItem);
	m_Mxp = m_Myp = -1;
	m_selectedPoint = -1;
	setModeCursor();
	if (fromGesture)
	{
		m_view->update();
	}
	m_ModeDialog = new WeldEditDialog(m_ScMW);
	m_ModeDialog->show();
	connect(m_ModeDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
	connect(m_ModeDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
	connect(m_ModeDialog, SIGNAL(modeMoveWeld()), this, SLOT(setWeldMode()));
	connect(m_ModeDialog, SIGNAL(modeMoveObject()), this, SLOT(setObjectMode()));
}
void CanvasMode_EditSpiral::activate(bool fromGesture)
{
	m_VectorDialog = new SpiralVectorDialog(m_ScMW);
	m_canvas->m_viewMode.m_MouseButtonPressed = false;
	m_canvas->resetRenderMode();
	m_doc->DragP = false;
	m_doc->leaveDrag = false;
	m_canvas->m_viewMode.operItemMoving = false;
	m_canvas->m_viewMode.operItemResizing = false;
	m_view->MidButt = false;
	m_Mxp = m_Myp = -1;
	PageItem *currItem = m_doc->m_Selection->itemAt(0);
	PageItem_Spiral* item = currItem->asSpiral();
	m_startPoint = currItem->PoLine.pointQF(0);
	m_endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 2);
	m_startAngle = item->spiralStartAngle;
	m_endAngle = item->spiralEndAngle;
	m_VectorDialog->setValues(computeRealAngle(m_startAngle, false), computeRealAngle(m_endAngle, false), item->spiralFactor);
	m_VectorDialog->show();
	setModeCursor();
	if (fromGesture)
	{
		m_view->update();
	}
	connect(m_VectorDialog, SIGNAL(NewVectors(double, double, double)), this, SLOT(applyValues(double, double, double)));
	connect(m_VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
	connect(m_VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
	connect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
}
Beispiel #4
0
void TextBox::mouseReleased(ofMouseEventArgs& args){
    ofPoint mouse = ofPoint(args.x,args.y);
    if(inside(mouse)) {
        if(!isEditing && mouseDownInRect){
	        beginEditing();
        }
    } else if(isEditing){
		endEditing();
	}
}
void ofxTextInputField::mouseReleased(ofMouseEventArgs& args){

    if(bounds.inside(args.x, args.y)) {
        if(!isEditing && mouseDownInRect){
	        beginEditing();
        }
    }
    else if(isEditing){
		endEditing();
	}
}
void MainWindow::cancel()
{
    //TODO read old file
    ui->mapWidget->clearSinglePlaces();
    try {
        controller.load();
    } catch (NullPointerException e) {
        QMessageBox::warning(this, "Ошибка считывания файла", "Вероятно, файл испорчен");
    }
    endEditing();
}
Beispiel #7
0
void TextBox::keyPressed(ofKeyEventArgs& args) {
	//ew: add charachter (non unicode sorry!)
	//jg: made a step closer to this with swappable renderers and ofxFTGL -- but need unicode text input...
	
	int key = args.key;
	if (key == OF_KEY_RETURN) {
        endEditing();
        return;
	}
	
	if (key >=32 && key <=126) {
		text.insert(text.begin()+cursorPosition, key);
		cursorPosition++;
	}
	
	
	if (key==OF_KEY_BACKSPACE) {
		if (cursorPosition>0) {
			text.erase(text.begin()+cursorPosition-1);
			--cursorPosition;
		}
	}
	
	if (key==OF_KEY_DEL) {
		if (text.size() > cursorPosition) {
			text.erase(text.begin()+cursorPosition);
		}
	}
	
	if (key==OF_KEY_LEFT){
		if (cursorPosition>0){
			--cursorPosition;
		}
	}
	
	if (key==OF_KEY_RIGHT){
		if (cursorPosition<text.size()){
			++cursorPosition;
		}
	}
	
	//for multiline:
	cursorx = cursory = 0;
	if(text.size() > 0){
		for (int i=0; i<cursorPosition; ++i) {
			if (*(text.begin()+i) == '\n') {
				++cursory;
				cursorx = 0;
			} else {
				cursorx++;
			}
		}
	}
}
void ofxTextInputField::disable(){
	if(isEditing){
		endEditing();
	}
	if(isEnabled){
        ofRemoveListener(ofEvents().mousePressed, this, &ofxTextInputField::mousePressed);
		ofRemoveListener(ofEvents().mouseDragged, this, &ofxTextInputField::mouseDragged);
		ofRemoveListener(ofEvents().mouseReleased, this, &ofxTextInputField::mouseReleased);
		isEnabled = false;
    }
	
}
Beispiel #9
0
TextBox::~TextBox(){
	if(isEditing){
		endEditing();
	}
    
	if(isEnabled){
        ofRemoveListener(ofEvents().mousePressed, this, &TextBox::mousePressed);
        ofRemoveListener(ofEvents().mouseDragged, this, &TextBox::mouseDragged);
		ofRemoveListener(ofEvents().mouseReleased, this, &TextBox::mouseReleased);
		isEnabled = false;
    }
}
void CanvasMode_EditPolygon::activate(bool fromGesture)
{
	m_polygonPoint = noPointDefined;
	m_canvas->m_viewMode.m_MouseButtonPressed = false;
	m_canvas->resetRenderMode();
	m_doc->DragP = false;
	m_doc->leaveDrag = false;
	m_canvas->m_viewMode.operItemMoving = false;
	m_canvas->m_viewMode.operItemResizing = false;
	m_view->MidButt = false;
	Mxp = Myp = -1;
	PageItem *currItem = m_doc->m_Selection->itemAt(0);
	PageItem_RegularPolygon* item = currItem->asRegularPolygon();
	centerPoint = QPointF(currItem->width() / 2.0, currItem->height() / 2.0);
	startPoint = currItem->PoLine.pointQF(0);
	endPoint = currItem->PoLine.pointQF(2);
	polyCorners = item->polyCorners;
	polyUseFactor = item->polyUseFactor;
	polyFactor = item->polyFactor;
	polyRotation = item->polyRotation;
	polyCurvature = item->polyCurvature;
	polyInnerRot = item->polyInnerRot;
	polyOuterCurvature = item->polyOuterCurvature;
	VectorDialog = new PolyVectorDialog(m_ScMW, polyCorners, polyFactor, polyUseFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
	VectorDialog->show();
	uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
	double seg = 360.0 / cx;
	double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (item->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (item->height() / 2.0) + (item->height()/2.0) - item->height(), 2));
	QLineF innerLine = QLineF(endPoint, centerPoint);
	innerLine.setAngle(innerLine.angle() + 90);
	innerLine.setLength(trueLength * polyCurvature);
	innerCPoint = innerLine.p2();
	QLineF outerLine = QLineF(startPoint, currItem->PoLine.pointQF(6));
	outerLine.setLength(outerLine.length() * polyOuterCurvature);
	outerCPoint = outerLine.p2();
	setModeCursor();
	if (fromGesture)
		m_view->update();
	connect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
	
	connect(VectorDialog, SIGNAL(NewVectors(int, double, bool, double, double, double, double)), this, SLOT(applyValues(int, double, bool, double, double, double, double)));
	connect(VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
	connect(VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
}
EditCustumerDialog::EditCustumerDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EditCustumerDialog)
{
    ui->setupUi(this);
    //Removes "What's it?" button
    this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
    //Make Connections
    QObject::connect(this->ui->edit_pushButton,SIGNAL(clicked()),this,SLOT(beginEditing()));
    QObject::connect(this->ui->save_pushButton_3,SIGNAL(clicked()),this,SLOT(endEditing()));
    QObject::connect(this->ui->cancel_pushButton_2,SIGNAL(clicked()),this,SLOT(endEditing()));
    //Sets Items for State Combobox
    this->ui->state_comboBox->addItems(global_config.usa_states);
    //Disables Edit, Cancel and Save Buttons
    this->ui->edit_pushButton->setEnabled(false);
    this->ui->cancel_pushButton_2->setEnabled(false);
    this->ui->save_pushButton_3->setEnabled(false);
    //Disables all LineEdits
    this->ui->personal_info_groupBox->setEnabled(false);
    this->ui->address_info_groupBox_2->setEnabled(false);
    //Defines Model Headers
    this->customer_model = new QSqlTableModel();
    customer_model->setTable("customer");
    //Define Headers
    customer_model->setHeaderData(customer_model->fieldIndex("id"), Qt::Horizontal, tr("#"));
    customer_model->setHeaderData(customer_model->fieldIndex("name"), Qt::Horizontal, tr("Name"));
    customer_model->setHeaderData(customer_model->fieldIndex("email"), Qt::Horizontal, tr("Email"));
    customer_model->setHeaderData(customer_model->fieldIndex("phone1"), Qt::Horizontal, tr("Phone 1"));
    customer_model->setHeaderData(customer_model->fieldIndex("phone2"), Qt::Horizontal, tr("Phone 2"));
    customer_model->setHeaderData(customer_model->fieldIndex("birthday"), Qt::Horizontal, tr("Birthday Date"));
    customer_model->setHeaderData(customer_model->fieldIndex("zip_code"), Qt::Horizontal, tr("Zip-Code"));
    customer_model->setHeaderData(customer_model->fieldIndex("address"), Qt::Horizontal, tr("Address"));
    customer_model->setHeaderData(customer_model->fieldIndex("state"), Qt::Horizontal, tr("State"));
    customer_model->setHeaderData(customer_model->fieldIndex("city"), Qt::Horizontal, tr("City"));
    //customer_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    customer_model->select();
    //Sets Model on the Table View
    this->ui->customer_tableView->setModel(this->customer_model);
    //Disables Edit on Table
    this->ui->customer_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    //Hides some columns on Table View
    this->ui->customer_tableView->hideColumn(customer_model->fieldIndex("points"));
    //Resizes the column according to its content
    this->ui->customer_tableView->resizeColumnsToContents();
    //Defines params for selection
    this->ui->customer_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    this->ui->customer_tableView->setSelectionMode(QAbstractItemView::SingleSelection);
    //Hides Vertical Header
    this->ui->customer_tableView->verticalHeader()->setVisible(false);
    //Fills the search ComboBox
    QStringList list = QString("#,Name,Email,Phone,Birthday,Address,Zip-Code,State,City").split(",");
    this->ui->comboBox->addItems(list);
    //Connect Selection Changed Signal
    connect(this->ui->customer_tableView->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this,SLOT(selectionChanged(QItemSelection,QItemSelection)));
    connect(this->ui->search_lineEdit_2,SIGNAL(textEdited(QString)),this,SLOT(searchTextChanged(QString)));
    connect(this->ui->comboBox,SIGNAL(currentTextChanged(QString)),this,SLOT(combobox_text_changed(QString)));
    //Creates Data Mapper
    customer_mapper = new QDataWidgetMapper;
    customer_mapper->setModel(this->customer_model);
    customer_mapper->addMapping(this->ui->id_lineEdit, this->customer_model->fieldIndex("id"));
    customer_mapper->addMapping(this->ui->name_lineEdit_2, this->customer_model->fieldIndex("name"));
    customer_mapper->addMapping(this->ui->email_lineEdit_4, this->customer_model->fieldIndex("email"));
    customer_mapper->addMapping(this->ui->phone1_lineEdit_2, this->customer_model->fieldIndex("phone1"));
    customer_mapper->addMapping(this->ui->phone2_lineEdit_3, this->customer_model->fieldIndex("phone2"));
    customer_mapper->addMapping(this->ui->birthday_dateEdit, this->customer_model->fieldIndex("birthday"));
    customer_mapper->addMapping(this->ui->address_lineEdit_5, this->customer_model->fieldIndex("address"));
    customer_mapper->addMapping(this->ui->zip_code_lineEdit_6, this->customer_model->fieldIndex("zip_code"));
    customer_mapper->addMapping(this->ui->state_comboBox, this->customer_model->fieldIndex("state"));
    customer_mapper->addMapping(this->ui->city_lineEdit_7, this->customer_model->fieldIndex("city"));
    customer_mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
    //customer_mapper->toFirst();
    //Creates connection for selection of Row on Table
    connect(this->ui->customer_tableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            customer_mapper, SLOT(setCurrentModelIndex(QModelIndex)));
    //Update ComboBox Text
    this->combobox_text_changed(this->ui->comboBox->currentText());
    connect(this->ui->search_dateEdit,SIGNAL(dateChanged(QDate)),this,SLOT(searchDateChanged(QDate)));
}
Beispiel #12
0
bool Editor_keyDown(int key, int keyCode, int modifiers)
{
	enum Selection selection = modifiers & EMGUI_KEY_SHIFT ? DO_SELECTION : NO_SELECTION;
	int highlightRowStep = getTrackData()->highlightRowStep; 

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

	// Update editing of values

	if (doEditing(key))
		return true;

	switch (key)
	{
		case EMGUI_KEY_ARROW_UP :
		case EMGUI_KEY_ARROW_DOWN :
		case EMGUI_KEY_ARROW_LEFT : 
		case EMGUI_KEY_ARROW_RIGHT : 
		case EMGUI_KEY_TAB : 
		case EMGUI_KEY_ENTER : 
		{
            if (is_editing)
            {
                endEditing();
                
                if (key == EMGUI_KEY_ENTER)
                    return true;
            }
            
			break;
		}

		case EMGUI_KEY_ESC :
		{
			cancelEditing();
			break;
		}
	}

	switch (key)
	{
		// this is a bit hacky but we don't want to have lots of combos in the menus
		// of arrow keys so this makes it a bit easier
	
		case EMGUI_KEY_ARROW_UP : 
		{
			if (modifiers & EMGUI_KEY_CTRL)
				onPrevNextKey(true, selection);
			else if (modifiers & EMGUI_KEY_COMMAND)
				onBookmarkDir(ARROW_UP, selection);
			else if (modifiers & EMGUI_KEY_ALT)
				onRowStep(-highlightRowStep , selection); 
			else
				onRowStep(-1, selection); 

			break;
		}

		case EMGUI_KEY_ARROW_DOWN : 
		{
			if (modifiers & EMGUI_KEY_CTRL)
				onPrevNextKey(false, selection);
			else if (modifiers & EMGUI_KEY_COMMAND)
				onBookmarkDir(ARROW_DOWN, selection);
			else if (modifiers & EMGUI_KEY_ALT)
				onRowStep(highlightRowStep, selection); 
			else
				onRowStep(1, selection); 
			break;
		}

		case EMGUI_KEY_ARROW_LEFT : onTrackSide(ARROW_LEFT, false, selection); break;
		case EMGUI_KEY_ARROW_RIGHT : onTrackSide(ARROW_RIGHT, false, selection); break;
		case EMGUI_KEY_TAB : onTab(); break;
		default : return false;
	}

	return true;
}
void MainWindow::save()
{
    endEditing();
    // Todo serialize
    controller.save();
}
void CanvasMode_EditArc::endEditing(bool active)
{
	if (!active)
		endEditing();
}
void CanvasMode_EditWeldPoint::endEditing(bool active)
{
	if (!active)
		endEditing();
}
void CanvasMode_EditPolygon::endEditing(bool active)
{
	if (!active)
		endEditing();
}
void CanvasMode_EditSpiral::endEditing(bool active)
{
	if (!active)
		endEditing();
}
void ofxTextInputField::keyPressed(ofKeyEventArgs& args) {
	//ew: add charachter (non unicode sorry!)
	//jg: made a step closer to this with swappable renderers and ofxFTGL -- but need unicode text input...
	lastTimeCursorMoved = ofGetElapsedTimef();
	int key = args.key;
	
	
    if(key == OF_KEY_SHIFT) {
        isShifted = true;
    }
    
    if(key == 4352) {
        isCommand = true;
    }
	
    #ifdef USE_GLFW_CLIPBOARD
    if(key == 'c' && isCommand ) {
        setClipboard(text.substr(selectionBegin, selectionEnd - selectionBegin));
        return;
    }
	
    if(key == 'v' && isCommand ) {
        text.insert(cursorPosition, getClipboard());
        return;
    }
	#endif
    
	if ((key >=32 && key <=126) || key=='\t' || key==OF_KEY_RETURN) {
		if(selecting) {
			text.erase(text.begin() + selectionBegin,
					   text.begin() + selectionEnd
					   );
			cursorPosition = selectionBegin;
			selecting = false;
		}
	}
			
			
	if (key == OF_KEY_RETURN) {
		if(!multiline) {
			endEditing();
			return;
		}
		text.insert(text.begin()+cursorPosition, '\n');
		cursorPosition++;
		

		if(autoTab) {
			// how much whitespace is there on the previous line?
			int xx, yy;
			getCursorCoords(cursorPosition, xx, yy);
			vector<string> lines = ofSplitString(text, "\n");
			if(yy>0) {
				
				// collect all the whitespace on the previous line.
				string previousWhitespace = "";
				string previousLine = lines[yy-1];
				int pos = 0;
				for(int i = 0; i < previousLine.size(); i++) {
					if(previousLine[i]==' ' || previousLine[i]=='\t') {
						previousWhitespace += previousLine[i];
					} else {
						break;
					}
				}
				// if we have a curly brace as the last char on the previous line
				// increase the indentation
				if(previousLine[previousLine.size()-1]=='{') {
					if(previousWhitespace=="") {
						previousWhitespace = "\t";
					} else {
						previousWhitespace += previousWhitespace[previousWhitespace.size()-1];
					}
				}
				text = text.insert(cursorPosition, previousWhitespace);
				cursorPosition += previousWhitespace.size();
			}
		}

        return;
	}
	
	if ((key >=32 && key <=126) || key=='\t') {
        
        if(isShifted) {
            
            char toInsert;
            if( !(key > 96 && key < 123) && !(key > 65 && key < 90) && shiftMap.find(key) != shiftMap.end() ) {
                toInsert = shiftMap[key];//toInsert = key - 32;
            } else {
                toInsert = key;
            }
            
            text.insert(text.begin()+cursorPosition, toInsert);
        } else {
            text.insert(text.begin()+cursorPosition, key);
        }
		cursorPosition++;
	}
	
	
	if (key==OF_KEY_BACKSPACE) {
		if(selecting) {
			text.erase(text.begin() + selectionBegin,
					   text.begin() + selectionEnd
			);
			cursorPosition = selectionBegin;
			selecting = false;
		} else {
			if (cursorPosition>0) {
				text.erase(text.begin()+cursorPosition-1);
				--cursorPosition;
			}
		}
	}
	
	if (key==OF_KEY_DEL) {
		if(selecting) {
			text.erase(text.begin() + selectionBegin,
					   text.begin() + selectionEnd
					   );
			cursorPosition = selectionBegin;
			selecting = false;
		} else {
			if (text.size() > cursorPosition) {
				text.erase(text.begin()+cursorPosition);
			}
		}
	}
	
	if (key==OF_KEY_LEFT){
		if(selecting) {
			cursorPosition = selectionBegin;
			selecting = false;
			
		} else {
			if (cursorPosition>0){
				--cursorPosition;
			}
		}
	}
	
	
	
	if (key==OF_KEY_RIGHT){
		if(selecting) {
			cursorPosition = selectionEnd;
			selecting = false;
		} else {
			if (cursorPosition<text.size()){
				++cursorPosition;
			}
		}
	}
	
	
	if (key==OF_KEY_UP){
		if(selecting) {
			cursorPosition = selectionBegin;
			selecting = false;
			
		} else {
			if (cursorPosition>0) {
				int xx, yy;
				getCursorCoords(cursorPosition, xx, yy);
				if(yy>0) {
					yy--;
					vector<string> lines = ofSplitString(text, "\n");
					xx = MIN(lines[yy].size()-1, xx);
					cursorPosition = xx;
					for(int i = 0; i < yy; i++) cursorPosition += lines[i].size()+1;
					printf("Cursor position: %d\n", cursorPosition);
				} else {
					cursorPosition = 0;
				}
			}
		}
	}
	
	
	
	if (key==OF_KEY_DOWN){
		if(selecting) {
			cursorPosition = selectionEnd;
			selecting = false;
		} else {
			int xx, yy;
			getCursorCoords(cursorPosition, xx, yy);
			vector<string> lines = ofSplitString(text, "\n");
			yy++;
			if(yy<lines.size()-1) {
				
				xx = MIN(lines[yy].size()-1, xx);
				cursorPosition = xx;
				for(int i = 0; i < yy; i++) cursorPosition += lines[i].size()+1;
				printf("Cursor position: %d\n", cursorPosition);
			} else {
				cursorPosition = text.size()-1;
			}
		}
	}
	
	
	
	
}
Beispiel #19
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();
}