Revert "Attempted to fix broken coordinate calculations for out-of-cell clicks..."
That didn't do it; will need to use a debugger.
This reverts commit 25e5100360
.
This commit is contained in:
parent
25e5100360
commit
152f446ce8
|
@ -38,7 +38,6 @@ static struct rowcol clientCoordToRowColumn(struct table *t, POINT pt)
|
||||||
RECT r;
|
RECT r;
|
||||||
struct rowcol rc;
|
struct rowcol rc;
|
||||||
intptr_t i;
|
intptr_t i;
|
||||||
intptr_t row, column;
|
|
||||||
|
|
||||||
// initial values for the PtInRect() check
|
// initial values for the PtInRect() check
|
||||||
rc.row = -1;
|
rc.row = -1;
|
||||||
|
@ -52,15 +51,12 @@ static struct rowcol clientCoordToRowColumn(struct table *t, POINT pt)
|
||||||
|
|
||||||
// the row is easy
|
// the row is easy
|
||||||
pt.y -= t->headerHeight;
|
pt.y -= t->headerHeight;
|
||||||
row = (pt.y / rowht(t)) + t->vscrollpos;
|
rc.row = (pt.y / rowht(t)) + t->vscrollpos;
|
||||||
if (row > t->count - 1)
|
|
||||||
// after the last row; don't select anything
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
// the column... not so much
|
// the column... not so much
|
||||||
// we scroll p.x, then subtract column widths until we cross the left edge of the control
|
// we scroll p.x, then subtract column widths until we cross the left edge of the control
|
||||||
pt.x += t->hscrollpos;
|
pt.x += t->hscrollpos;
|
||||||
column = 0;
|
rc.column = 0;
|
||||||
for (i = 0; i < t->nColumns; i++) {
|
for (i = 0; i < t->nColumns; i++) {
|
||||||
pt.x -= columnWidth(t, i);
|
pt.x -= columnWidth(t, i);
|
||||||
// use <, not <=, here:
|
// use <, not <=, here:
|
||||||
|
@ -71,14 +67,10 @@ static struct rowcol clientCoordToRowColumn(struct table *t, POINT pt)
|
||||||
// pt.x == 100 (first pixel of col 1) -> p.x - 100 == 0 >= 0 -> next column
|
// pt.x == 100 (first pixel of col 1) -> p.x - 100 == 0 >= 0 -> next column
|
||||||
if (pt.x < r.left)
|
if (pt.x < r.left)
|
||||||
break;
|
break;
|
||||||
column++;
|
rc.column++;
|
||||||
}
|
}
|
||||||
if (column > t->nColumns - 1)
|
// TODO what happens if the break was never taken?
|
||||||
// to the right of all columns; select nothing
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
rc.row = row;
|
|
||||||
rc.column = column;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue