refactoring

This commit is contained in:
Erik Faye-Lund 2007-12-19 21:30:09 +00:00
parent c14fa89e2f
commit ead6a8959d
4 changed files with 18 additions and 9 deletions

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <string> #include <string>
#include <list>
#include <map> #include <map>
#include <exception> #include <exception>
#include <cmath> #include <cmath>
@ -69,7 +69,7 @@ public:
size_t getTrackCount() { return tracks.size(); } size_t getTrackCount() { return tracks.size(); }
private: // private:
typedef std::map<const std::string, SyncTrack> TrackContainer; typedef std::map<const std::string, SyncTrack> TrackContainer;
TrackContainer tracks; TrackContainer tracks;
}; };

View File

@ -66,6 +66,12 @@ int _tmain(int argc, _TCHAR* argv[])
SyncData syncData; SyncData syncData;
SyncTrack &testTrack = syncData.getTrack("test"); SyncTrack &testTrack = syncData.getTrack("test");
SyncTrack &test2Track = syncData.getTrack("test2"); SyncTrack &test2Track = syncData.getTrack("test2");
for (int i = 0; i < 1 << 16; ++i)
{
char temp[256];
sprintf(temp, "gen %02d", i);
SyncTrack &temp2 = syncData.getTrack(temp);
}
// testTrack.setKeyFrame(0, SyncTrack::KeyFrame(1.0f)); // testTrack.setKeyFrame(0, SyncTrack::KeyFrame(1.0f));
testTrack.setKeyFrame(1, SyncTrack::KeyFrame(2.0f)); testTrack.setKeyFrame(1, SyncTrack::KeyFrame(2.0f));

View File

@ -115,7 +115,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"

View File

@ -77,8 +77,15 @@ void TrackView::paintTopMargin(HDC hdc, RECT rcTracks)
int firstTrack = min(max(scrollPosX / trackWidth, 0), getTrackCount() - 1); int firstTrack = min(max(scrollPosX / trackWidth, 0), getTrackCount() - 1);
int lastTrack = min(max(firstTrack + windowTracks + 1, 0), getTrackCount() - 1); int lastTrack = min(max(firstTrack + windowTracks + 1, 0), getTrackCount() - 1);
for (int track = firstTrack; track <= lastTrack; ++track) SyncData *syncData = getSyncData();
if (NULL == syncData) return;
SyncData::TrackContainer::iterator trackIter = syncData->tracks.begin();
for (int track = 0; track <= lastTrack; ++track, ++trackIter)
{ {
ASSERT(trackIter != syncData->tracks.end());
if (track < firstTrack) continue;
RECT topMargin; RECT topMargin;
topMargin.top = 0; topMargin.top = 0;
@ -97,11 +104,7 @@ void TrackView::paintTopMargin(HDC hdc, RECT rcTracks)
DrawEdge(hdc, &fillRect, BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_ADJUST | BF_LEFT | BF_RIGHT | BF_BOTTOM); DrawEdge(hdc, &fillRect, BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_ADJUST | BF_LEFT | BF_RIGHT | BF_BOTTOM);
FillRect(hdc, &fillRect, bgBrush); FillRect(hdc, &fillRect, bgBrush);
/* format the text */ std::string trackName = trackIter->first;
TCHAR temp[256];
_sntprintf_s(temp, 256, _T("track %d"), track);
std::string trackName(temp);
TextOut(hdc, TextOut(hdc,
fillRect.left, 0, fillRect.left, 0,
trackName.c_str(), int(trackName.length()) trackName.c_str(), int(trackName.length())