diff options
author | rowanbeentje <rowan@beent.je> | 2010-08-12 01:15:44 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-08-12 01:15:44 +0000 |
commit | e5aa4302f8655a08d7fa7542893db009a6920689 (patch) | |
tree | 72a12fcf45eaa76e72a2350576a65a0ace6af08e /Source/CMCopyTable.h | |
parent | 8b1962153814426bfb7e4ab38056ffa955d7c3f0 (diff) | |
download | sequelpro-e5aa4302f8655a08d7fa7542893db009a6920689.tar.gz sequelpro-e5aa4302f8655a08d7fa7542893db009a6920689.tar.bz2 sequelpro-e5aa4302f8655a08d7fa7542893db009a6920689.zip |
Implement column autosizing for the Content View:
- Add automatic column sizing (for columns without saved widths) as part of the value loading process
- Rework table updates to be timer based, for time-based and more regular updates. This improves speed and allows tables to update more consistently.
This results in overall smoother table loads, faster table loads, and autosizing columns. This partially implements Issues #271 and #272.
Column autosizing will likely be tweaked, and this will all also be extended to Custom Query views in a future patch.
Diffstat (limited to 'Source/CMCopyTable.h')
-rw-r--r-- | Source/CMCopyTable.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/CMCopyTable.h b/Source/CMCopyTable.h index 6baa2527..948607bc 100644 --- a/Source/CMCopyTable.h +++ b/Source/CMCopyTable.h @@ -25,6 +25,8 @@ #import <AppKit/AppKit.h> #import "SPTableView.h" +#define SP_MAX_CELL_WIDTH 200 + @class SPDataStorage; /*! @@ -112,6 +114,40 @@ */ - (void)setTableData:(SPDataStorage *)theTableStorage; +/*! + @method autodetectColumnWidthsForFont: + @abstract Autodetect and return column widths based on contents + @discussion Support autocalculating column widths for the represented data. + This uses the underlying table storage, calculates string widths, + and eventually returns an array of table column widths. + Suitable for calling on background threads, but ensure that the + data storage range in use (currently rows 1-200) won't be altered + while this accesses it. + @param The font to use when calculating widths + @result A dictionary - mapped by column identifier - of the column widths to use +*/ +- (NSDictionary *) autodetectColumnWidthsForFont:(NSFont *)theFont; + +/*! + @method autodetectWidthForColumnDefinition:usingFont:maxRows: + @abstract Autodetect and return column width based on contents + @discussion Support autocalculating column width for the represented data. + This uses the underlying table storage, and the supplied column definition, + iterating through the data and returning a reasonable column width to + display that data. + Suitable for calling on background threads, but ensure that the data + storage range in use won't be altered while being accessed. + @param A column definition for a represented column; the column to use is derived + @param The font to use when calculating widths + @param The maximum number of rows to process when looking at string lengths + @result A reasonable column width to use when displaying data +*/ +/** + * Autodetect the column width for a specified column - derived from the supplied + * column definition, using the stored data and the specified font. + */ +- (NSUInteger)autodetectWidthForColumnDefinition:(NSDictionary *)columnDefinition usingFont:(NSFont *)theFont maxRows:(NSUInteger)rowsToCheck; + @end extern NSInteger MENU_EDIT_COPY; |