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

View File

@ -66,6 +66,12 @@ int _tmain(int argc, _TCHAR* argv[])
SyncData syncData;
SyncTrack &testTrack = syncData.getTrack("test");
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(1, SyncTrack::KeyFrame(2.0f));

View File

@ -115,7 +115,7 @@
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
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 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;
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);
FillRect(hdc, &fillRect, bgBrush);
/* format the text */
TCHAR temp[256];
_sntprintf_s(temp, 256, _T("track %d"), track);
std::string trackName(temp);
std::string trackName = trackIter->first;
TextOut(hdc,
fillRect.left, 0,
trackName.c_str(), int(trackName.length())