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 leftMarginWidth = 60;
static int rowHeight = 16;
static int fontWidth = 6;
static const int trackWidth = fontWidth * 16;
static DWORD darken(DWORD col, float 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()
{
IniFile::load("rocket.ini", "GUI");
@ -44,6 +49,11 @@ TrackView::TrackView()
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);
bgDarkBrush = CreateSolidBrush(darken(GetSysColor(COLOR_WINDOW), 0.9f));
@ -98,8 +108,8 @@ LRESULT TrackView::onPaint()
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
// SelectObject(hdc, GetStockObject(SYSTEM_FONT));
// SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
SelectObject(hdc, font);
paintTracks(hdc, ps.rcPaint);
EndPaint(hwnd, &ps);

View File

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