From 7e09c045e44020954e278a51acc51cdca70a5af2 Mon Sep 17 00:00:00 2001 From: fourthline Date: Thu, 1 May 2014 20:31:00 +0900 Subject: [PATCH] =?UTF-8?q?Alt+=E3=83=9E=E3=82=A6=E3=82=B9=E7=A7=BB?= =?UTF-8?q?=E5=8B=95=E3=81=A7=E3=82=AB=E3=83=BC=E3=82=BD=E3=83=AB=E4=B8=8B?= =?UTF-8?q?=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=88=E3=81=8C=E3=81=82=E3=82=8B?= =?UTF-8?q?=E3=83=91=E3=83=BC=E3=83=88=E3=81=AB=E5=88=87=E3=82=8A=E6=9B=BF?= =?UTF-8?q?=E3=81=88=E3=82=89=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.xml | 5 ++++ src/fourthline/mabiicco/ui/IMMLManager.java | 1 + src/fourthline/mabiicco/ui/MMLSeqView.java | 23 +++++++++++++++++++ .../mabiicco/ui/editor/EditMode.java | 7 +++--- .../mabiicco/ui/editor/IEditContext.java | 2 +- .../mabiicco/ui/editor/MMLEditor.java | 7 +++++- 6 files changed, 40 insertions(+), 5 deletions(-) diff --git a/build.xml b/build.xml index 74d65a1b..f9c16796 100644 --- a/build.xml +++ b/build.xml @@ -51,6 +51,11 @@ + + + + + diff --git a/src/fourthline/mabiicco/ui/IMMLManager.java b/src/fourthline/mabiicco/ui/IMMLManager.java index 1ad24b78..9f39462b 100644 --- a/src/fourthline/mabiicco/ui/IMMLManager.java +++ b/src/fourthline/mabiicco/ui/IMMLManager.java @@ -17,4 +17,5 @@ public interface IMMLManager { public void updateActivePart(); public void updateActiveTrackProgram(int program, int songProgram); public int getActivePartProgram(); + public boolean selectTrackOnExistNote(int note, int tickOffset); } diff --git a/src/fourthline/mabiicco/ui/MMLSeqView.java b/src/fourthline/mabiicco/ui/MMLSeqView.java index 8522d9c1..321a21c0 100644 --- a/src/fourthline/mabiicco/ui/MMLSeqView.java +++ b/src/fourthline/mabiicco/ui/MMLSeqView.java @@ -22,6 +22,7 @@ import fourthline.mabiicco.ui.editor.MMLEditor; import fourthline.mabiicco.ui.editor.MMLScoreUndoEdit; import fourthline.mmlTools.MMLEventList; +import fourthline.mmlTools.MMLNoteEvent; import fourthline.mmlTools.MMLScore; import fourthline.mmlTools.MMLTempoEvent; import fourthline.mmlTools.MMLTrack; @@ -541,6 +542,28 @@ public void updateActiveTrackProgram(int program, int songProgram) { undoEdit.saveState(); } + @Override + public boolean selectTrackOnExistNote(int note, int tickOffset) { + int trackIndex = 0; + for (MMLTrack track : mmlScore.getTrackList()) { + int partIndex = 0; + for (MMLEventList eventList : track.getMMLEventList()) { + MMLNoteEvent noteEvent = eventList.searchOnTickOffset(tickOffset); + if ( (noteEvent != null) && (note == noteEvent.getNote()) ) { + tabbedPane.setSelectedIndex(trackIndex); + MMLTrackView view = (MMLTrackView) tabbedPane.getSelectedComponent(); + view.setSelectMMLPartOfIndex(partIndex); + updateSelectedTrackAndMMLPart(); + return true; + } + partIndex++; + } + trackIndex++; + } + + return false; + } + public void setTimeView(JLabel timeView) { this.timeView = timeView; } diff --git a/src/fourthline/mabiicco/ui/editor/EditMode.java b/src/fourthline/mabiicco/ui/editor/EditMode.java index d96d8868..09586dc2 100644 --- a/src/fourthline/mabiicco/ui/editor/EditMode.java +++ b/src/fourthline/mabiicco/ui/editor/EditMode.java @@ -20,13 +20,13 @@ enum EditMode { public void pressEvent(IEditContext context, MouseEvent e) { startPoint = e.getPoint(); if (SwingUtilities.isRightMouseButton(e)) { - if (context.onExistNote(startPoint)) { + if (context.onExistNote(startPoint, false)) { context.showPopupMenu(startPoint); } else { context.changeState(AREA).executeEvent(context, e); } } else if (SwingUtilities.isLeftMouseButton(e)) { - if (context.onExistNote(startPoint)) { + if (context.onExistNote(startPoint, true)) { // ノート上であれば、ノートを選択状態にする. 複数選択判定も. context.selectNoteByPoint(startPoint, e.getModifiers()); if (context.isEditLengthPosition(startPoint)) { @@ -43,7 +43,8 @@ public void pressEvent(IEditContext context, MouseEvent e) { public void executeEvent(IEditContext context, MouseEvent e) { int cursorType = Cursor.DEFAULT_CURSOR; Point p = e.getPoint(); - if (context.onExistNote(p)) { + boolean onAlt = (e.getModifiers() & ActionEvent.ALT_MASK) != 0; + if (context.onExistNote(p, onAlt)) { if (context.isEditLengthPosition(p)) { cursorType = Cursor.E_RESIZE_CURSOR; } else { diff --git a/src/fourthline/mabiicco/ui/editor/IEditContext.java b/src/fourthline/mabiicco/ui/editor/IEditContext.java index 016d9156..e64f8d4c 100644 --- a/src/fourthline/mabiicco/ui/editor/IEditContext.java +++ b/src/fourthline/mabiicco/ui/editor/IEditContext.java @@ -11,7 +11,7 @@ * EditModeから使用するContext. */ interface IEditContext { - public boolean onExistNote(Point p); + public boolean onExistNote(Point p, boolean autoSelect); public boolean isEditLengthPosition(Point point); public EditMode changeState(EditMode nextMode); public void newMMLNoteAndSelected(Point p); diff --git a/src/fourthline/mabiicco/ui/editor/MMLEditor.java b/src/fourthline/mabiicco/ui/editor/MMLEditor.java index 7c4dceab..d5e34078 100644 --- a/src/fourthline/mabiicco/ui/editor/MMLEditor.java +++ b/src/fourthline/mabiicco/ui/editor/MMLEditor.java @@ -321,7 +321,7 @@ public void applyAreaSelect() { * @return ノート上の場合はtrue. */ @Override - public boolean onExistNote(Point point) { + public boolean onExistNote(Point point, boolean autoSelect) { int note = pianoRollView.convertY2Note( point.y ); int tickOffset = (int)pianoRollView.convertXtoTick( point.x ); MMLNoteEvent noteEvent = editEventList.searchOnTickOffset(tickOffset); @@ -329,6 +329,11 @@ public boolean onExistNote(Point point) { if ( (noteEvent != null) && (note == noteEvent.getNote()) ) { return true; } + + if (autoSelect) { + return mmlManager.selectTrackOnExistNote(note, tickOffset); + } + return false; }