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
|
//******************************************************************************
// 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 "resource.h"
#include "winver.h"
#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.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 "HistoryRecord.h"
#include "HistoryUnit.h"
#include "SekaijuDoc.h"
#include "EventKindListBox.h"
// TSIZEOFマクロ //20120211追加
#ifndef TSIZEOF
#define TSIZEOF(STR) (sizeof(STR)/sizeof(TCHAR))
#endif
#ifndef TCSLEN
#ifdef UNICODE
#define TCSLEN(STRING) wcslen(STRING)
#else
#define TCSLEN(STRING) strlen(STRING)
#endif
#endif
#ifndef TCSNCPY
#ifdef UNICODE
#define TCSNCPY(STRING1,STRING2,N) wcsncpy(STRING1,STRING2,N)
#else
#define TCSNCPY(STRING1,STRING2,N) strncpy(STRING1,STRING2,N)
#endif
#endif
// メッセージマップ
IMPLEMENT_DYNCREATE (CEventKindListBox, CCheckListBox)
BEGIN_MESSAGE_MAP (CEventKindListBox, CCheckListBox)
ON_WM_RBUTTONDOWN ()
END_MESSAGE_MAP ()
//------------------------------------------------------------------------------
// 構築と破壊
//------------------------------------------------------------------------------
// コンストラクタ
CEventKindListBox::CEventKindListBox () {
m_pDocument = NULL;
m_lMenuID = 0;
m_lLastRButtonDownIndex = 0;
CCheckListBox::CCheckListBox ();
}
// コンストラクタ
CEventKindListBox::CEventKindListBox (CDocument* pDocument, long lMenuID) {
m_pDocument = pDocument;
m_lMenuID = lMenuID;
m_lLastRButtonDownIndex = 0;
CCheckListBox::CCheckListBox ();
}
// デストラクタ
CEventKindListBox::~CEventKindListBox () {
CCheckListBox::~CCheckListBox ();
}
//------------------------------------------------------------------------------
// オーバーライド
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// オペレーション
//------------------------------------------------------------------------------
CSekaijuDoc* CEventKindListBox::GetDocument () {
return (CSekaijuDoc*)m_pDocument;
}
long CEventKindListBox::GetLastRButtonDownIndex () {
return m_lLastRButtonDownIndex;
}
//------------------------------------------------------------------------------
// メッセージマップ
//------------------------------------------------------------------------------
// マウス右ボタン押された時
void CEventKindListBox::OnRButtonDown (UINT nFlags, CPoint point) {
this->SetFocus ();
if (m_lMenuID == 0) {
return;
}
BOOL bOutside;
long lIndex = this->ItemFromPoint (point, bOutside);
if (bOutside) {
return;
}
if (lIndex < 0 || lIndex >= GetCount ()) {
return;
}
m_lLastRButtonDownIndex = lIndex;
// ポップアップメニューの表示
CPoint ptMenu (point);
ClientToScreen (&ptMenu);
CMenu theMenu;
VERIFY (theMenu.LoadMenu (m_lMenuID));
CMenu* pContextMenu = theMenu.GetSubMenu (0);
pContextMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
ptMenu.x, ptMenu.y, GetParentFrame ());
}
|