public BTSTextSelectionEvent(TypedEvent event, BTSObject parentObject) { this.setOriginalEvent(event); this.display = event.display; this.widget = event.widget; this.time = event.time; if (event instanceof CaretEvent) { this.x = ((CaretEvent)event).caretOffset; this.y = ((CaretEvent)event).caretOffset; } else if (event instanceof SelectionEvent) { this.x = ((SelectionEvent)event).x; this.y = ((SelectionEvent)event).y; this.text = ((SelectionEvent)event).text; } this.setParentObject(parentObject); }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getPlayer().isRunning()){ TuxGuitar.instance().getTransport().gotoNext(); } else{ Caret caret = getEditor().getTablature().getCaret(); if(!caret.moveRight()){ int number = (getSongManager().getSong().countMeasureHeaders() + 1); //comienza el undoable UndoableAddMeasure undoable = UndoableAddMeasure.startUndo(number); getSongManager().addNewMeasure(number); fireUpdate(number); caret.moveRight(); TuxGuitar.instance().getFileHistory().setUnsavedFile(); //termia el undoable addUndoableEdit(undoable.endUndo()); } } return 0; }
void run(TypedEvent event) { // Validate TreeItem aSel[] = getGrpNewSelection(); if (aSel == null) return; // Create a new group ID int nGroup = -1; for (int nC = 0; nC < m_aDci.length; nC++) if (m_aDci[nC].nGroup > nGroup) nGroup = m_aDci[nC].nGroup; nGroup++; // Group the selection String sDisplayType = ((DataCompInfo)aSel[0].getData()).sDisplayType; for (int i = 0; i < aSel.length; i++) { ((DataCompInfo)aSel[i].getData()).nGroup = nGroup; ((DataCompInfo)aSel[i].getData()).sDisplayType = sDisplayType; } // Update tree and editor fillTree(); fireOutlineChangedEvent(); }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); //si es el ultimo compas, agrego uno nuevo if(getSongManager().getTrackManager().isLastMeasure(caret.getMeasure())){ int number = (getSongManager().getSong().countMeasureHeaders() + 1); //comienza el undoable UndoableAddMeasure undoable = UndoableAddMeasure.startUndo(number); this.getSongManager().addNewMeasure(number); this.fireUpdate(number); this.moveToNext(); //termia el undoable this.addUndoableEdit(undoable.endUndo()); } else{ this.moveToNext(); } return 0; }
protected int execute(TypedEvent e){ TGNote note = getEditor().getTablature().getCaret().getSelectedNote(); if(note != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); int nextString = getSongManager().getMeasureManager().shiftNoteDown(getEditor().getTablature().getCaret().getMeasure(),note.getVoice().getBeat().getStart(),note.getString()); if(nextString > 0){ getEditor().getTablature().getCaret().setStringNumber(nextString); //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } updateTablature(); } return 0; }
protected int execute(TypedEvent e){ TGBeat beat = getEditor().getTablature().getCaret().getSelectedBeat(); if( beat != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); TuxGuitar.instance().getFileHistory().setUnsavedFile(); //getSongManager().getMeasureManager().removeAllComponentsAt(caret.getMeasure(),caret.getSelectedComponent().getStart()); getSongManager().getMeasureManager().cleanBeat(beat); //termia el undoable addUndoableEdit(undoable.endUndo()); updateTablature(); } return 0; }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); TGBeat beat = caret.getSelectedBeat(); TGMeasure measure = caret.getMeasure(); TGTrack track = caret.getTrack(); TGDuration duration = (beat != null ? beat.getVoice( caret.getVoice() ).getDuration() : null ); if(beat != null && measure != null && track != null && duration != null){ //comienza el undoable UndoableTrackGeneric undoable = UndoableTrackGeneric.startUndo(track); getSongManager().getTrackManager().moveTrackBeats(track, measure.getStart(), beat.getStart(), -duration.getTime() ); //termia el undoable addUndoableEdit(undoable.endUndo(track)); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); TuxGuitar.instance().getFileHistory().setUnsavedFile(); Caret caret = getEditor().getTablature().getCaret(); TGBeat beat = caret.getSelectedBeat(); TGVoice voice = beat.getVoice( caret.getVoice() ); if( beat.isTextBeat() && beat.isRestBeat() ){ getSongManager().getMeasureManager().removeText(beat); }else if(voice.isRestVoice()){ getSongManager().getMeasureManager().removeVoice(voice ,true); }else{ int string = caret.getSelectedString().getNumber(); getSongManager().getMeasureManager().removeNote(caret.getMeasure(),beat.getStart(), caret.getVoice(), string); } //termia el undoable addUndoableEdit(undoable.endUndo()); updateTablature(); return 0; }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); TGBeat beat = caret.getSelectedBeat(); if(beat != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); TuxGuitar.instance().getFileHistory().setUnsavedFile(); if(beat.getVoice(caret.getVoice()).isEmpty()){ getSongManager().getMeasureManager().addSilence(beat, caret.getDuration().clone(getSongManager().getFactory()), caret.getVoice()); } else{ long start = beat.getStart(); long length = beat.getVoice(caret.getVoice()).getDuration().getTime(); getSongManager().getMeasureManager().moveVoices(caret.getMeasure(),start,length,caret.getVoice(),beat.getVoice(caret.getVoice()).getDuration()); } //termia el undoable addUndoableEdit(undoable.endUndo()); updateTablature(); } return 0; }
protected int execute(TypedEvent e){ TGNote note = getEditor().getTablature().getCaret().getSelectedNote(); if(note != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); int nextString = getSongManager().getMeasureManager().shiftNoteUp(getEditor().getTablature().getCaret().getMeasure(),note.getVoice().getBeat().getStart(),note.getString()); if(nextString > 0){ getEditor().getTablature().getCaret().setStringNumber(nextString); //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } updateTablature(); } return 0; }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); TGBeatImpl beat = caret.getSelectedBeat(); if( beat != null ){ TGVoiceImpl voice = beat.getVoiceImpl( caret.getVoice() ); TGBeatGroup group = voice.getBeatGroup(); if(!voice.isEmpty() && !voice.isRestVoice() && group != null ){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Iterator it = group.getVoices().iterator(); while( it.hasNext() ){ TGVoice current = (TGVoice)it.next(); getSongManager().getMeasureManager().changeVoiceDirection(current, TGVoice.DIRECTION_DOWN); } //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); } } return 0; }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); TGBeatImpl beat = caret.getSelectedBeat(); if( beat != null ){ TGVoiceImpl voice = beat.getVoiceImpl( caret.getVoice() ); TGBeatGroup group = voice.getBeatGroup(); if(!voice.isEmpty() && !voice.isRestVoice() && group != null ){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Iterator it = group.getVoices().iterator(); while( it.hasNext() ){ TGVoice current = (TGVoice)it.next(); getSongManager().getMeasureManager().changeVoiceDirection(current, TGVoice.DIRECTION_NONE); } //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); } } return 0; }
protected int execute(TypedEvent e){ Caret caret = getEditor().getTablature().getCaret(); TGBeat beat = caret.getSelectedBeat(); TGMeasure measure = caret.getMeasure(); TGTrack track = caret.getTrack(); TGDuration duration = (beat != null ? beat.getVoice( caret.getVoice() ).getDuration() : null ); if(beat != null && measure != null && track != null && duration != null){ //comienza el undoable UndoableTrackGeneric undoable = UndoableTrackGeneric.startUndo(track); getSongManager().getTrackManager().moveTrackBeats(track, measure.getStart(), beat.getStart(), duration.getTime() ); //termia el undoable addUndoableEdit(undoable.endUndo(track)); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Caret caret = getEditor().getTablature().getCaret(); TGNote note = caret.getSelectedNote(); if(note == null){ note = getSongManager().getFactory().newNote(); note.setValue(0); note.setVelocity(caret.getVelocity()); note.setString(caret.getSelectedString().getNumber()); TGDuration duration = getSongManager().getFactory().newDuration(); caret.getDuration().copy(duration); getSongManager().getMeasureManager().addNote(caret.getMeasure(),caret.getPosition(),note,duration,caret.getVoice()); } getSongManager().getMeasureManager().changeDeadNote(note); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); //termia el undoable addUndoableEdit(undoable.endUndo()); return 0; }
protected int execute(TypedEvent e){ TGDuration duration = getEditor().getTablature().getCaret().getDuration(); if(duration.getValue() < TGDuration.SIXTY_FOURTH){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); this.changeDuration(duration.getValue() * 2); TuxGuitar.instance().getFileHistory().setUnsavedFile(); this.updateTablature(); //termia el undoable addUndoableEdit(undoable.endUndo()); } return 0; }
void run(TypedEvent event) { // Validate TreeItem aSel[] = getGrpBrkSelection(); if (aSel == null) return; // Break group aSel = aSel[0].getItems(); for (int i = 0; i < aSel.length; i++) { DataCompInfo iDci = (DataCompInfo)aSel[i].getData(); iDci.nGroup = -1; } // Update tree and editor fillTree(); autoVisibility(AV_LIMIT,DdUtils.VOP_DEF_VISIBLE_DISPLAYS,false); fireOutlineChangedEvent(); }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMoveTrackDown undoable = UndoableMoveTrackDown.startUndo(); Caret caret = getEditor().getTablature().getCaret(); TGTrack track = caret.getTrack(); if(getSongManager().moveTrackDown(track)){ updateTablature(); TuxGuitar.instance().getMixer().update(); //termia el undoable addUndoableEdit(undoable.endUndo(track)); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMoveTrackUp undoable = UndoableMoveTrackUp.startUndo(); Caret caret = getEditor().getTablature().getCaret(); TGTrack track = caret.getTrack(); if(getSongManager().moveTrackUp(track)){ updateTablature(); TuxGuitar.instance().getMixer().update(); //termia el undoable addUndoableEdit(undoable.endUndo(track)); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableCloneTrack undoable = UndoableCloneTrack.startUndo(); TuxGuitar.instance().getFileHistory().setUnsavedFile(); Caret caret = getEditor().getTablature().getCaret(); getSongManager().cloneTrack(caret.getTrack()); updateTablature(); TuxGuitar.instance().getMixer().update(); //termia el undoable addUndoableEdit(undoable.endUndo()); return 0; }
protected int execute(TypedEvent e){ try{ final PrintStyles data = PrintStylesDialog.open(TuxGuitar.instance().getShell()); if(data != null){ PrintDialog dialog = new PrintDialog(TuxGuitar.instance().getShell(), SWT.NULL); PrinterData printerData = dialog.open(); if (printerData != null) { TuxGuitar.instance().loadCursor(SWT.CURSOR_WAIT); this.print(printerData, data); } } }catch(Throwable throwable ){ MessageDialog.errorMessage(throwable); } return 0; }
@SuppressWarnings("unchecked") public Map<String, Object> createWidgetAttributes(TypedEvent e){ Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put(PROPERTY_TYPED_EVENT, e); Object widgetData = (e.widget != null ? e.widget.getData() : null); if( widgetData instanceof Map ){ attributes.putAll((Map<String, Object>)widgetData); } return attributes; }
protected void processTextSelection(TypedEvent event) { BTSTextSelectionEvent btsEvent = new BTSTextSelectionEvent(event, selectedLemmaEntry); // System.out.println("Textselection x y : " + btsEvent.x + " " + btsEvent.y); btsEvent.data = selectedLemmaEntry; List<BTSModelAnnotation> annotations = getModelAnnotationAtSelection(btsEvent.x, btsEvent.y, btsEvent); btsEvent.getTextAnnotations().addAll(annotations); processSelection(annotations, false, btsEvent); selectionService.setSelection(btsEvent); }
protected void processEditorSelection(Object item) { TypedEvent event = new TypedEvent(item); BTSTextSelectionEvent btsEvent = new BTSTextSelectionEvent(event, selectedLemmaEntry); // System.out.println("Textselection x y : " + btsEvent.x + " " + btsEvent.y); btsEvent.data = selectedLemmaEntry; List<BTSModelAnnotation> annotations = getModelAnnotationAtSelection(btsEvent.x, btsEvent.y, btsEvent); btsEvent.getTextAnnotations().addAll(annotations); processSelection(annotations, false, btsEvent); selectionService.setSelection(btsEvent); }
void notifyListeners(final TypedEvent event) { if (isDisposed()) { return; } getDisplay().asyncExec(new Runnable() { public void run() { callListeners(event); } }); }
private void handleCancelPortfolioModifications(TypedEvent evt) { PortfolioMgr.getInstance().cancelModifications(); modelControler.updateMoniAndPSCachedModels(); tabResetAllTabs(); refreshPortfolioTotalsInfos(portfolioCTabFolder.getSelectionIndex()); }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Caret caret = getEditor().getTablature().getCaret(); getSongManager().getMeasureManager().changeTapping(caret.getMeasure(),caret.getPosition(),caret.getSelectedString().getNumber()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); //termia el undoable addUndoableEdit(undoable.endUndo()); return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getPlayer().isRunning()){ TuxGuitar.instance().getTransport().gotoPrevious(); } else{ getEditor().getTablature().getCaret().moveLeft(); } return 0; }
protected int execute(TypedEvent e){ try { if(TuxGuitar.instance().getUndoableManager().canUndo()){ TuxGuitar.instance().getUndoableManager().undo(); } } catch (CannotUndoException e1) { e1.printStackTrace(); } return 0; }
protected int execute(TypedEvent e){ TuxGuitar.instance().loadCursor(SWT.CURSOR_WAIT); if(TuxGuitar.instance().getFretBoardEditor().isVisible()){ TuxGuitar.instance().getFretBoardEditor().hideFretBoard(); }else{ TuxGuitar.instance().getFretBoardEditor().showFretBoard(); } TuxGuitar.instance().loadCursor(SWT.CURSOR_ARROW); return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getTransport().isDisposed()){ TuxGuitar.instance().getTransport().show(); }else{ TuxGuitar.instance().getTransport().dispose(); } return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getMatrixEditor().isDisposed()){ TuxGuitar.instance().getMatrixEditor().show(); }else{ TuxGuitar.instance().getMatrixEditor().dispose(); } return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getMixer().isDisposed()){ TuxGuitar.instance().getMixer().show(); }else{ TuxGuitar.instance().getMixer().dispose(); } return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getPlayer().isRunning()){ TuxGuitar.instance().getTransport().gotoLast(); } else{ Caret caret = getEditor().getTablature().getCaret(); TGTrackImpl track = caret.getTrack(); TGMeasureImpl measure = (TGMeasureImpl)getSongManager().getTrackManager().getLastMeasure(track); if(track != null && measure != null){ caret.update(track.getNumber(),measure.getStart(),caret.getSelectedString().getNumber()); } } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Caret caret = getEditor().getTablature().getCaret(); getSongManager().getMeasureManager().changeSlapping(caret.getMeasure(),caret.getPosition(),caret.getSelectedString().getNumber()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); //termia el undoable addUndoableEdit(undoable.endUndo()); return 0; }
protected int execute(TypedEvent e){ if(TuxGuitar.instance().getPlayer().isRunning()){ TuxGuitar.instance().getTransport().gotoPrevious(); } else{ Caret caret = getEditor().getTablature().getCaret(); TGTrackImpl track = caret.getTrack(); TGMeasureImpl measure = (TGMeasureImpl)getSongManager().getTrackManager().getPrevMeasure(caret.getMeasure()); if(track != null && measure != null){ caret.update(track.getNumber(),measure.getStart(),caret.getSelectedString().getNumber()); } } return 0; }
protected int execute(TypedEvent e){ TGNote note = getEditor().getTablature().getCaret().getSelectedNote(); if(note != null){ changeTrill(new TrillEditor().show(note)); } return 0; }
protected int execute(TypedEvent e){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); Caret caret = getEditor().getTablature().getCaret(); getSongManager().getMeasureManager().changeAccentuatedNote(caret.getMeasure(),caret.getPosition(),caret.getSelectedString().getNumber()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); updateTablature(); //termia el undoable addUndoableEdit(undoable.endUndo()); return 0; }
protected int execute(final TypedEvent event){ TuxGuitar.instance().getPlayer().reset(); if(TuxGuitar.instance().getFileHistory().isUnsavedFile()){ ConfirmDialog confirm = new ConfirmDialog(TuxGuitar.getProperty("file.save-changes-question")); confirm.setDefaultStatus( ConfirmDialog.STATUS_CANCEL ); int status = confirm.confirm(ConfirmDialog.BUTTON_YES | ConfirmDialog.BUTTON_NO | ConfirmDialog.BUTTON_CANCEL, ConfirmDialog.BUTTON_YES); if(status == ConfirmDialog.STATUS_CANCEL){ return AUTO_UNLOCK; } if(status == ConfirmDialog.STATUS_YES){ final String fileName = FileActionUtils.getFileName(); if(fileName == null){ return AUTO_UNLOCK; } TuxGuitar.instance().loadCursor(SWT.CURSOR_WAIT); new Thread(new Runnable() { public void run() { if(!TuxGuitar.isDisposed()){ FileActionUtils.save(fileName); new SyncThread(new Runnable() { public void run() { if(!TuxGuitar.isDisposed()){ TuxGuitar.instance().loadCursor(SWT.CURSOR_ARROW); processImporter(event.widget.getData()); } } }).start(); } } }).start(); return 0; } } processImporter(event.widget.getData()); return 0; }
protected int execute(TypedEvent e){ TGNote note = getEditor().getTablature().getCaret().getSelectedNote(); if(note != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); if(getSongManager().getMeasureManager().moveSemitoneUp(getEditor().getTablature().getCaret().getMeasure(),note.getVoice().getBeat().getStart(),note.getString())){ //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } updateTablature(); } return 0; }
protected int execute(TypedEvent e){ TGNote note = getEditor().getTablature().getCaret().getSelectedNote(); if(note != null){ //comienza el undoable UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo(); if(getSongManager().getMeasureManager().moveSemitoneDown(getEditor().getTablature().getCaret().getMeasure(),note.getVoice().getBeat().getStart(),note.getString())){ //termia el undoable addUndoableEdit(undoable.endUndo()); TuxGuitar.instance().getFileHistory().setUnsavedFile(); } updateTablature(); } return 0; }