graemeg/fpGUI — pull request #4 by demerson3 (2013-04-19 04:50:51+00:00)
Title: Grids: HandlePaint, UpdateScrollbars

I've done some work on grids, specifically to the TfpgBaseGrid class: HandlePaint and UpdateScrollbars

My main motivation for doing so was to create a PrepareCells procedure, within HandlePaint. It is called prior to the first call to DrawCell, and it is given the row and column ranges, so that all of the data for DrawCell can be obtained more efficiently at one time and stored for the subsequent DrawCell calls.

HandlePaint changes:

- calculate firstcol, lastcol, firstrow, lastrow in advance
- save column widths so they don't have to be looked up each row
- fix smoothscroll so it doesn't draw all columns from 0 when they're not visible
- the draw loop uses for loops from first to last rather than testing coordinates each iteration

UpdateScrollbar changes:

- calculate scrollbar necessity more accurately, so a 1px adjustment can move from 2 scrollbars to 0
- adjust pagesize for smoothscroll and not
- handle different scrollbar styles (ssNone, ssHorizontal, etc) more efficiently and explicitly

I did my best to follow your code formatting standards :-)