forked from paulhoad/gp2trackeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJamView.cpp
More file actions
executable file
·116 lines (91 loc) · 2.46 KB
/
Copy pathJamView.cpp
File metadata and controls
executable file
·116 lines (91 loc) · 2.46 KB
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
// JamView.cpp : implementation file
//
#include "stdafx.h"
#include "trackeditor.h"
#include "JamView.h"
#include "TrackEditorDoc.h"
#include "JAM.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CJamView
IMPLEMENT_DYNCREATE(CJamView, CScrollView)
CJamView::CJamView() { currentScale = 1.0; }
CJamView::~CJamView() {}
BEGIN_MESSAGE_MAP(CJamView, CScrollView)
//{{AFX_MSG_MAP(CJamView)
ON_WM_CREATE()
ON_COMMAND(ID_ZOOM_HOME, OnZoomHome)
ON_COMMAND(ZOOM_IN, OnIn)
ON_COMMAND(ZOOM_OUT, OnOut)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CJamView drawing
void CJamView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 256;
SetScrollSizes(MM_TEXT, sizeTotal);
CTrackEditorDoc* pDoc = (CTrackEditorDoc*)GetDocument();
myjam = pDoc->getCurrentJam();
}
void CJamView::OnDraw(CDC* pDC)
{
CTrackEditorDoc* pDoc = (CTrackEditorDoc*)GetDocument();
if (myjam) {
myjam->DrawAllJams(pDC, currentScale);
}
}
/////////////////////////////////////////////////////////////////////////////
// CJamView diagnostics
#ifdef _DEBUG
void CJamView::AssertValid() const
{
CScrollView::AssertValid();
}
void CJamView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
#endif//_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CJamView message handlers
int CJamView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CScrollView::OnCreate(lpCreateStruct) == -1) return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CJamView::OnZoomHome()
{
CTrackEditorDoc* pDoc = (CTrackEditorDoc*)GetDocument();
currentScale = 1.0;
pDoc->UpdateAllViews(NULL);
Resize();
}
void CJamView::OnIn()
{
CTrackEditorDoc* pDoc = (CTrackEditorDoc*)GetDocument();
currentScale *= 2;
pDoc->UpdateAllViews(NULL);
Resize();
}
void CJamView::Resize()
{
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = (int)(currentScale * 256);
SetScrollSizes(MM_TEXT, sizeTotal);
}
void CJamView::OnOut()
{
CTrackEditorDoc* pDoc = (CTrackEditorDoc*)GetDocument();
currentScale /= 2;
pDoc->UpdateAllViews(NULL);
Resize();
}