From e8f1727b4c4329a10fb89a387c6f513a7bce7cb1 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 14 Jan 2009 22:58:53 +0000 Subject: [PATCH] Formatting and removed ini-file from the vs08 project. --- editor/editor_vs2008.vcproj | 4 ---- editor/synctracker2.cpp | 16 +++++++-------- editor/trackview.cpp | 47 ++++++++++++++++++++++----------------------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/editor/editor_vs2008.vcproj b/editor/editor_vs2008.vcproj index 7f282e7..0093124 100644 --- a/editor/editor_vs2008.vcproj +++ b/editor/editor_vs2008.vcproj @@ -183,10 +183,6 @@ > - - diff --git a/editor/synctracker2.cpp b/editor/synctracker2.cpp index 22d5abc..3f6f0e9 100644 --- a/editor/synctracker2.cpp +++ b/editor/synctracker2.cpp @@ -13,11 +13,11 @@ // Windows XP look and feel. Seems to enable Vista look as well. #pragma comment(linker, \ - "\"/manifestdependency:type='Win32' "\ - "name='Microsoft.Windows.Common-Controls' "\ - "version='6.0.0.0' "\ - "processorArchitecture='*' "\ - "publicKeyToken='6595b64144ccf1df' "\ + "\"/manifestdependency:type='Win32' " \ + "name='Microsoft.Windows.Common-Controls' " \ + "version='6.0.0.0' " \ + "processorArchitecture='*' " \ + "publicKeyToken='6595b64144ccf1df' " \ "language='*'\"") #include "trackview.h" @@ -167,7 +167,7 @@ std::string fileName; void fileNew() { -/* document.purgeUnusedTracks(); */ + // document.purgeUnusedTracks(); for (size_t i = 0; i < document.getTrackCount(); ++i) { document.getTrack(i).truncate(); @@ -428,7 +428,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp); } break; - + case WM_TRACKCHANGED: { TCHAR temp[256]; @@ -436,7 +436,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp); } break; - + case WM_CURRVALDIRTY: { TCHAR temp[256]; diff --git a/editor/trackview.cpp b/editor/trackview.cpp index c83690c..a18e693 100644 --- a/editor/trackview.cpp +++ b/editor/trackview.cpp @@ -29,26 +29,6 @@ static int getMaxCharacterWidthFromString(HDC hdc, TCHAR *chars) return getMaxCharacterWidth(hdc, chars, _tcslen(chars)); } - -void TrackView::setFont(HFONT font) -{ - this->font = font; - - assert(NULL != hwnd); - HDC hdc = GetDC(hwnd); - SelectObject(hdc, font); - - TEXTMETRIC tm; - GetTextMetrics(hdc, &tm); - - rowHeight = tm.tmHeight + tm.tmExternalLeading; - fontWidth = tm.tmAveCharWidth; - trackWidth = getMaxCharacterWidthFromString(hdc, _T("0123456789.")) * 16; - - topMarginHeight = rowHeight + 4; - leftMarginWidth = getMaxCharacterWidthFromString(hdc, _T("0123456789abcdefh")) * 8; -} - TrackView::TrackView() { scrollPosX = 0; @@ -72,7 +52,7 @@ TrackView::TrackView() rowPen = CreatePen(PS_SOLID, 1, darken(GetSysColor(COLOR_WINDOW), 0.7f)); rowSelectPen = CreatePen(PS_SOLID, 1, darken(GetSysColor(COLOR_HIGHLIGHT), 0.7f)); - + lerpPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0)); cosinePen = CreatePen(PS_SOLID, 2, RGB(0, 255, 0)); rampPen = CreatePen(PS_SOLID, 2, RGB(0, 0, 255)); @@ -97,6 +77,25 @@ TrackView::~TrackView() DeleteObject(rowSelectPen); } +void TrackView::setFont(HFONT font) +{ + this->font = font; + + assert(NULL != hwnd); + HDC hdc = GetDC(hwnd); + SelectObject(hdc, font); + + TEXTMETRIC tm; + GetTextMetrics(hdc, &tm); + + rowHeight = tm.tmHeight + tm.tmExternalLeading; + fontWidth = tm.tmAveCharWidth; + trackWidth = getMaxCharacterWidthFromString(hdc, _T("0123456789.")) * 16; + + topMarginHeight = rowHeight + 4; + leftMarginWidth = getMaxCharacterWidthFromString(hdc, _T("0123456789abcdefh")) * 8; +} + int TrackView::getScreenY(int row) const { return topMarginHeight + (row * rowHeight) - scrollPosY; @@ -200,7 +199,7 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks) { const SyncDocument *doc = getDocument(); if (NULL == doc) return; - + TCHAR temp[256]; int firstRow = editRow - windowRows / 2 - 1; @@ -841,7 +840,7 @@ void TrackView::editDelete() { SyncDocument *doc = getDocument(); if (NULL == doc) return; - + int selectLeft = min(selectStartTrack, selectStopTrack); int selectRight = max(selectStartTrack, selectStopTrack); int selectTop = min(selectStartRow, selectStopRow); @@ -889,7 +888,7 @@ void TrackView::editBiasValue(float amount) int selectRight = max(selectStartTrack, selectStopTrack); int selectTop = min(selectStartRow, selectStopRow); int selectBottom = max(selectStartRow, selectStopRow); - + if (0 == getTrackCount()) { MessageBeep(-1);