summaryrefslogtreecommitdiffstats
path: root/src/TrackListBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/TrackListBox.cpp')
-rw-r--r--src/TrackListBox.cpp131
1 files changed, 131 insertions, 0 deletions
diff --git a/src/TrackListBox.cpp b/src/TrackListBox.cpp
new file mode 100644
index 0000000..3814b2f
--- /dev/null
+++ b/src/TrackListBox.cpp
@@ -0,0 +1,131 @@
+//******************************************************************************
+// 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 "ColorfulCheckListBox.h"
+#include "TrackListBox.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 (CTrackListBox, CColorfulCheckListBox)
+
+BEGIN_MESSAGE_MAP (CTrackListBox, CColorfulCheckListBox)
+ ON_WM_RBUTTONDOWN ()
+END_MESSAGE_MAP ()
+
+
+
+//------------------------------------------------------------------------------
+// 構築と破壊
+//------------------------------------------------------------------------------
+
+// コンストラクタ
+CTrackListBox::CTrackListBox () {
+ m_pDocument = NULL;
+ m_lMenuID = 0;
+ CColorfulCheckListBox::CColorfulCheckListBox ();
+}
+
+// コンストラクタ
+CTrackListBox::CTrackListBox (CDocument* pDocument, long lMenuID) {
+ m_pDocument = pDocument;
+ m_lMenuID = lMenuID;
+ CColorfulCheckListBox::CColorfulCheckListBox ();
+}
+
+// デストラクタ
+CTrackListBox::~CTrackListBox () {
+ CColorfulCheckListBox::~CColorfulCheckListBox ();
+}
+
+//------------------------------------------------------------------------------
+// オーバーライド
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// オペレーション
+//------------------------------------------------------------------------------
+
+CSekaijuDoc* CTrackListBox::GetDocument () {
+ return (CSekaijuDoc*)m_pDocument;
+}
+
+//------------------------------------------------------------------------------
+// メッセージマップ
+//------------------------------------------------------------------------------
+
+// マウス右ボタン押された時
+void CTrackListBox::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;
+ }
+ CSekaijuDoc* pSekaijuDoc = GetDocument ();
+ pSekaijuDoc->m_pTempTrack = pSekaijuDoc->GetTrack (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 ());
+}
+
+