1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
//******************************************************************************
// MIDIシーケンサーソフト『世界樹』
// トラックリストスケールビュークラス
// (C)2002-2013 おーぷんMIDIぷろじぇくと/くず
//******************************************************************************
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation; either */
/* version 2.1 of the License, or (at your option) any later version. */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* Lesser General Public License for more details. */
/* You should have received a copy of the GNU Lesser General Public */
/* License along with this library; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "winver.h"
#include <afxwin.h>
#include <afxext.h>
#include <afxmt.h>
#include "../../MIDIIO/MIDIIO.h"
#include "../../MIDIData/MIDIData.h"
#include "../../MIDIClock/MIDIClock.h"
#include "../../MIDIStatus/MIDIStatus.h"
#include "../../MIDIInstrument/MIDIInstrument.h"
#include "mousewheel.h"
#include "HistoryRecord.h"
#include "HistoryUnit.h"
#include "SekaijuApp.h"
#include "SekaijuDoc.h"
#include "SekaijuView.h"
#include "SekaijuToolbar.h"
#include "SekaijuStatusBar.h"
#include "MainFrame.h"
#include "ChildFrame.h"
#include "TrackListFrame.h"
#include "TrackListScaleView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE (CTrackListScaleView, CSekaijuView)
// メッセージマップ
BEGIN_MESSAGE_MAP (CTrackListScaleView, CSekaijuView)
ON_WM_MOUSEWHEEL40 ()
END_MESSAGE_MAP ()
//------------------------------------------------------------------------------
// 構築と破壊
//------------------------------------------------------------------------------
// コンストラクタ
CTrackListScaleView::CTrackListScaleView () {
}
// デストラクタ
CTrackListScaleView::~CTrackListScaleView () {
}
//------------------------------------------------------------------------------
// オーバーライド
//------------------------------------------------------------------------------
// 描画
void CTrackListScaleView::OnDraw (CDC* pDC) {
CSekaijuDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rcClient;
GetClientRect (&rcClient);
long lColorBtnFace = ::GetSysColor (COLOR_BTNFACE);
pDC->FillSolidRect (&rcClient, lColorBtnFace);
}
// ビューの更新
void CTrackListScaleView::OnUpdate (CView* pSender, LPARAM lHint, CObject* pHint) {
// クリティカルセクションはロックされているものとする。
CTrackListFrame* pTrackListFrame = (CTrackListFrame*)GetParent ();
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd ();
CSekaijuApp* pSekaijuApp = (CSekaijuApp*)AfxGetApp ();
CSekaijuDoc* pSekaijuDoc = GetDocument ();
// 演奏開始した場合、リアルタイム入力開始した場合、位置移動した場合
if ((lHint & SEKAIJUDOC_PLAYSTARTED) ||
(lHint & SEKAIJUDOC_RECORDSTARTED) ||
(lHint & SEKAIJUDOC_POSITIONCHANGED)) {
if (pSekaijuApp->m_theGeneralOption.m_bEnableAutoPageUpdate) { // 20091224追加
pTrackListFrame->m_bAutoPageUpdate = TRUE;
}
}
// MIDIデータ又はMIDIトラック又はMIDIイベントが変更された場合
if ((lHint & SEKAIJUDOC_MIDIDATACHANGED) ||
(lHint & SEKAIJUDOC_MIDITRACKCHANGED) ||
(lHint & SEKAIJUDOC_MIDIEVENTCHANGED)) {
MIDIData* pMIDIData = pSekaijuDoc->m_pMIDIData;
long lEndTime = MIDIData_GetEndTime (pMIDIData);
pMainFrame->SetPositionScrollRange (0, lEndTime, TRUE);
pTrackListFrame->RecalcRowScrollInfo ();
pTrackListFrame->RecalcColumnScrollInfo ();
pTrackListFrame->RecalcTimeScrollInfo ();
}
CSekaijuView::OnUpdate (pSender, lHint, pHint);
}
//------------------------------------------------------------------------------
// メッセージマップ
//------------------------------------------------------------------------------
// キー押し下げ時
void CTrackListScaleView::OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags) {
CTrackListFrame* pTrackListFrame = (CTrackListFrame*)GetParent ();
pTrackListFrame->PostMessage (WM_KEYDOWN, nChar, (nFlags << 16) | nRepCnt);
}
// マウスホイールが回された時
void CTrackListScaleView::OnMouseWheel40 (UINT nFlags, CPoint point) {
CTrackListFrame* pTrackListFrame = (CTrackListFrame*)GetParent ();
CSekaijuApp* pSekaijuApp = (CSekaijuApp*)AfxGetApp ();
CSekaijuDoc* pSekaijuDoc = GetDocument ();
long lDelta = (short)HIWORD (nFlags);
long lFlags = LOWORD (nFlags);
if (lFlags & MK_CONTROL) {
if (lDelta > 0 && pSekaijuApp->m_theGeneralOption.m_bInvertCtrlMouseWheel == 0 ||
lDelta < 0 && pSekaijuApp->m_theGeneralOption.m_bInvertCtrlMouseWheel != 0) {
pTrackListFrame->PostMessage (WM_COMMAND, ID_CONTROL_PREVMEASURE);
}
else {
pTrackListFrame->PostMessage (WM_COMMAND, ID_CONTROL_NEXTMEASURE);
}
}
else {
long lRowScrollPos = pTrackListFrame->GetRowScrollPos ();
long lRowZoom = pTrackListFrame->GetRowZoom ();
lRowScrollPos -= lRowZoom * lDelta / WHEELDELTA;
pTrackListFrame->SetRowScrollPos (lRowScrollPos);
}
}
|