Revision: 26185 http://sourceforge.net/p/bibdesk/svn/26185 Author: hofman Date: 2021-06-09 15:55:02 +0000 (Wed, 09 Jun 2021) Log Message: ----------- Get row and column from edited row and column of table view rather than saving them
Modified Paths: -------------- trunk/bibdesk/BDSKComplexStringEditor.h trunk/bibdesk/BDSKComplexStringEditor.m Modified: trunk/bibdesk/BDSKComplexStringEditor.h =================================================================== --- trunk/bibdesk/BDSKComplexStringEditor.h 2021-06-09 15:49:14 UTC (rev 26184) +++ trunk/bibdesk/BDSKComplexStringEditor.h 2021-06-09 15:55:02 UTC (rev 26185) @@ -46,8 +46,6 @@ BDSKBackgroundView *backgroundView; NSFormatter *formatter; NSView *control; - NSInteger row; - NSInteger column; } - (void)attachToCell:(NSCell *)cell; Modified: trunk/bibdesk/BDSKComplexStringEditor.m =================================================================== --- trunk/bibdesk/BDSKComplexStringEditor.m 2021-06-09 15:49:14 UTC (rev 26184) +++ trunk/bibdesk/BDSKComplexStringEditor.m 2021-06-09 15:55:02 UTC (rev 26185) @@ -62,8 +62,6 @@ if (self) { control = nil; formatter = nil; - row = -1; - column = -1; } return self; } @@ -78,20 +76,11 @@ [self remove]; control = [[cell controlView] retain]; - row = -1; - column = -1; - formatter = [[cell formatter] retain]; // make sure we loaded the nib [self window]; - if ([control isKindOfClass:[NSTableView class]]) { - row = [(NSTableView *)control editedRow]; - column = [(NSTableView *)control editedColumn]; - [(NSTableView *)control scrollRowToVisible:row]; - } - BOOL isEnabled = [cell isEditable]; [self displayValue:[cell objectValue] isError:NO]; @@ -172,9 +161,6 @@ // release the temporary objects BDSKDESTROY(control); // we should set this to nil, as we use this as a flag that we are editing - row = -1; - column = -1; - BDSKDESTROY(formatter); // close window after removing control to avoid a loop, see windowWillClose: @@ -213,8 +199,14 @@ CGFloat margin = 4.0; // for the shadow and focus ring CGFloat minWidth = 16.0; // minimal width of the window without margins, so subviews won't get shifted - if ([control isKindOfClass:[NSTableView class]]) - lowerEdgeRect = [(NSTableView *)control frameOfCellAtColumn:column row:row]; + if ([control isKindOfClass:[NSTableView class]]) { + // sanity check, should never happen + if ([(NSTableView *)control editedRow] == -1) { + [self remove]; + return; + } + lowerEdgeRect = [(NSTableView *)control frameOfCellAtColumn:[(NSTableView *)control editedColumn] row:[(NSTableView *)control editedRow]]; + } lowerEdgeRect = BDSKSliceRect(lowerEdgeRect, 1.0, lowerEdge); lowerEdgeRect = NSIntersectionRect(lowerEdgeRect, [control visibleRect]); // see if the cell's lower edge is scrolled out of sight This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit