made some of the font-properties class members instead of const variables (and even worse, global variables).

This commit is contained in:
Erik Faye-Lund 2009-01-14 15:23:07 +00:00
parent 95b2cfd073
commit 60ee9553d4
2 changed files with 23 additions and 6 deletions

View File

@ -10,15 +10,20 @@ static const TCHAR *trackViewWindowClassName = _T("TrackView");
static const int topMarginHeight = 20; static const int topMarginHeight = 20;
static const int leftMarginWidth = 60; static const int leftMarginWidth = 60;
static int rowHeight = 16;
static int fontWidth = 6;
static const int trackWidth = fontWidth * 16;
static DWORD darken(DWORD col, float amt) static DWORD darken(DWORD col, float amt)
{ {
return RGB(GetRValue(col) * amt, GetGValue(col) * amt, GetBValue(col) * amt); return RGB(GetRValue(col) * amt, GetGValue(col) * amt, GetBValue(col) * amt);
} }
void TrackView::setFont(HFONT font)
{
this->font = font;
rowHeight = 16;
fontWidth = 6;
trackWidth = fontWidth * 16;
}
TrackView::TrackView() TrackView::TrackView()
{ {
IniFile::load("rocket.ini", "GUI"); IniFile::load("rocket.ini", "GUI");
@ -44,6 +49,11 @@ TrackView::TrackView()
this->hwnd = NULL; this->hwnd = NULL;
// setFont((HFONT)GetStockObject(SYSTEM_FONT));
setFont((HFONT)GetStockObject(SYSTEM_FIXED_FONT));
// font = (HFONT)GetStockObject(SYSTEM_FONT);
// font = (HFONT)GetStockObject(SYSTEM_FIXED_FONT);
bgBaseBrush = GetSysColorBrush(COLOR_WINDOW); bgBaseBrush = GetSysColorBrush(COLOR_WINDOW);
bgDarkBrush = CreateSolidBrush(darken(GetSysColor(COLOR_WINDOW), 0.9f)); bgDarkBrush = CreateSolidBrush(darken(GetSysColor(COLOR_WINDOW), 0.9f));
@ -98,8 +108,8 @@ LRESULT TrackView::onPaint()
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps); HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT)); // SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
// SelectObject(hdc, GetStockObject(SYSTEM_FONT)); SelectObject(hdc, font);
paintTracks(hdc, ps.rcPaint); paintTracks(hdc, ps.rcPaint);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);

View File

@ -32,6 +32,8 @@ public:
if (NULL == document) return 0; if (NULL == document) return 0;
return document->getRows(); return document->getRows();
} }
void setFont(HFONT font);
void editEnterValue(); void editEnterValue();
void editDelete(); void editDelete();
@ -149,6 +151,11 @@ private:
int selectStartTrack, selectStopTrack; int selectStartTrack, selectStopTrack;
int selectStartRow, selectStopRow; int selectStartRow, selectStopRow;
HFONT font;
int rowHeight;
int fontWidth;
int trackWidth;
HBRUSH bgBaseBrush, bgDarkBrush; HBRUSH bgBaseBrush, bgDarkBrush;
HBRUSH selectBaseBrush, selectDarkBrush; HBRUSH selectBaseBrush, selectDarkBrush;
HPEN rowPen, rowSelectPen; HPEN rowPen, rowSelectPen;