const and sign-correctness.

This commit is contained in:
Erik Faye-Lund 2008-10-14 23:27:11 +00:00
parent 3fa3ed5c4d
commit ee62a21d3e
2 changed files with 12 additions and 12 deletions

View File

@ -78,12 +78,12 @@ TrackView::~TrackView()
DeleteObject(rowSelectPen);
}
int TrackView::getScreenY(int row)
int TrackView::getScreenY(int row) const
{
return topMarginHeight + (row * fontHeight) - scrollPosY;
}
int TrackView::getScreenX(size_t track)
int TrackView::getScreenX(size_t track) const
{
return int(leftMarginWidth + (track * trackWidth)) - scrollPosX;
}
@ -184,8 +184,8 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
int firstRow = editRow - windowRows / 2 - 1;
int lastRow = editRow + windowRows / 2 + 1;
/* clamp first & last row */
firstRow = min(max(firstRow, 0), rows - 1);
lastRow = min(max(lastRow, 0), rows - 1);
firstRow = min(max(firstRow, 0), int(rows) - 1);
lastRow = min(max(lastRow, 0), int(rows) - 1);
SetBkMode(hdc, TRANSPARENT);
paintTopMargin(hdc, rcTracks);
@ -571,7 +571,7 @@ void TrackView::setEditRow(int newEditRow)
editRow = newEditRow;
// clamp to document
editRow = min(max(editRow, 0), rows - 1);
editRow = min(max(editRow, 0), int(rows) - 1);
if (oldEditRow != editRow)
{
@ -647,11 +647,11 @@ static int getScrollPos(HWND hwnd, int bar)
return int(si.nTrackPos);
}
void TrackView::setRows(int rows)
void TrackView::setRows(size_t rows)
{
this->rows = rows;
InvalidateRect(getWin(), NULL, FALSE);
setEditRow(min(editRow, rows - 1));
setEditRow(min(editRow, int(rows) - 1));
}

View File

@ -26,7 +26,7 @@ public:
const SyncDocument *getDocument() const { return document; }
SyncDocument *getDocument() { return document; }
void setRows(int rows);
void setRows(size_t rows);
int getRows() const { return rows; }
void editEnterValue();
@ -48,7 +48,7 @@ public:
selectStartTrack = 0;
selectStopTrack = int(this->getTrackCount()) - 1;
selectStartRow = 0;
selectStopRow = this->getRows() - 1;
selectStopRow = int(this->getRows()) - 1;
editTrack = 0;
editRow = 0;
@ -132,8 +132,8 @@ private:
InvalidateRect(hwnd, &rect, FALSE);
}
int getScreenY(int row);
int getScreenX(size_t track);
int getScreenY(int row) const;
int getScreenX(size_t track) const;
size_t getTrackCount() const
{
@ -165,7 +165,7 @@ private:
HWND hwnd;
UINT clipboardFormat;
int rows;
size_t rows;
};
ATOM registerTrackViewWindowClass(HINSTANCE hInstance);