made some of the font-properties class members instead of const variables (and even worse, global variables).
This commit is contained in:
parent
95b2cfd073
commit
60ee9553d4
@ -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);
|
||||
|
||||
@ -32,6 +32,8 @@ public:
|
||||
if (NULL == document) return 0;
|
||||
return document->getRows();
|
||||
}
|
||||
|
||||
void setFont(HFONT font);
|
||||
|
||||
void editEnterValue();
|
||||
void editDelete();
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user