diff options
author | stuconnolly <stuart02@gmail.com> | 2011-05-14 17:26:18 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-05-14 17:26:18 +0000 |
commit | 2dbae24c7735ead0524bd9847af6ea99d8654ec6 (patch) | |
tree | 87dbed4317214da2aa9e2aed493fd7b798b3e2bc /Frameworks | |
parent | 160728cd29519794b47b3a09b139ce9d604883f0 (diff) | |
download | sequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.tar.gz sequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.tar.bz2 sequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.zip |
Bring outline view branch up to date with trunk (r3279:r3306).
Diffstat (limited to 'Frameworks')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPResult.m | 9 | ||||
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 27 | ||||
-rw-r--r-- | Frameworks/PSMTabBar/PSMTabBarControl.h | 67 | ||||
-rw-r--r-- | Frameworks/PSMTabBar/PSMTabBarControl.m | 25 |
4 files changed, 78 insertions, 50 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m index 53066c14..84793e44 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m @@ -419,10 +419,7 @@ const OUR_CHARSET our_charsets60[] = if (theRow[i] == NULL) { theCurrentObj = [NSNull null]; } else { - char *theData = calloc(sizeof(char),theLengths[i]+1); - //char *theUselLess; - memcpy(theData, theRow[i],theLengths[i]); - theData[theLengths[i]] = '\0'; + char *theData = theRow[i]; switch (theField[i].type) { case FIELD_TYPE_TINY: @@ -444,7 +441,7 @@ const OUR_CHARSET our_charsets60[] = case FIELD_TYPE_SET: case FIELD_TYPE_ENUM: case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is... - theCurrentObj = [NSString stringWithCString:theData encoding:mEncoding]; + theCurrentObj = [[[NSString alloc] initWithBytes:theData length:theLengths[i] encoding:mEncoding] autorelease]; break; case FIELD_TYPE_BIT: @@ -479,8 +476,6 @@ const OUR_CHARSET our_charsets60[] = break; } - free(theData); - // Some of the creators return nil object... if (theCurrentObj == nil) { theCurrentObj = [NSNull null]; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index 465221fe..bdb271fe 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -226,14 +226,12 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); id cellData = nil; char *theData = NULL; - // In fully streaming mode, copy across the data for the MYSQL_ROW + // In fully streaming mode, get a reference to the data for the MYSQL_ROW if (fullyStreaming) { if (theRow[i] == NULL) { cellData = [NSNull null]; } else { - theData = calloc(sizeof(char), fieldLengths[i]+1); - memcpy(theData, theRow[i], fieldLengths[i]); - theData[fieldLengths[i]] = '\0'; + theData = theRow[i]; } // In cached-streaming mode, use a reference to the downloaded data @@ -281,7 +279,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); } // For string data, convert to text else { - cellData = [NSString stringWithCString:theData encoding:mEncoding]; + cellData = [[[NSString alloc] initWithBytes:theData length:fieldLengths[i] encoding:mEncoding] autorelease]; } break; @@ -328,9 +326,6 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); break; } - // Free the data if it was originally allocated - if (fullyStreaming) free(theData); - // If a creator returned a nil object, replace with NSNull if (cellData == nil) cellData = [NSNull null]; } @@ -435,12 +430,22 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf) { + // NSUInteger i = 0; + // nbytes--; + // while (++i <= len) + // buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + // + // buf[len] = '\0'; + // ↑ why does this code not working anymore? + NSUInteger i = 0; nbytes--; - while (++i <= len) - buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + len--; + while (i <= len) + buf[len - i++] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + + buf[len+1] = '\0'; - buf[len] = '\0'; } /** diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h index 663bb74e..481bb3b8 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.h +++ b/Frameworks/PSMTabBar/PSMTabBarControl.h @@ -66,53 +66,55 @@ enum { // Spring-loading. NSTimer *_springTimer; - NSTabViewItem *_tabViewItemWithSpring; + NSTabViewItem *_tabViewItemWithSpring; // drawing style id<PSMTabStyle> style; - BOOL _canCloseOnlyTab; - BOOL _disableTabClose; - BOOL _hideForSingleTab; - BOOL _showAddTabButton; - BOOL _sizeCellsToFit; - BOOL _useOverflowMenu; - BOOL _alwaysShowActiveTab; - BOOL _allowsScrubbing; - BOOL _useSafariStyleDragging; - NSInteger _resizeAreaCompensation; - PSMTabBarOrientation _orientation; - BOOL _automaticallyAnimates; + BOOL _canCloseOnlyTab; + BOOL _disableTabClose; + BOOL _hideForSingleTab; + BOOL _showAddTabButton; + BOOL _sizeCellsToFit; + BOOL _useOverflowMenu; + BOOL _alwaysShowActiveTab; + BOOL _allowsScrubbing; + BOOL _useSafariStyleDragging; + NSInteger _resizeAreaCompensation; + PSMTabBarOrientation _orientation; + BOOL _automaticallyAnimates; NSTimer *_animationTimer; PSMTabBarTearOffStyle _tearOffStyle; // behavior - BOOL _allowsBackgroundTabClosing; - BOOL _selectsTabsOnMouseDown; - BOOL _createsTabOnDoubleClick; - id _createNewTabTarget; - SEL _createNewTabAction; + BOOL _allowsBackgroundTabClosing; + BOOL _selectsTabsOnMouseDown; + BOOL _createsTabOnDoubleClick; + id _createNewTabTarget; + SEL _createNewTabAction; + id _doubleClickTarget; + SEL _doubleClickAction; // vertical tab resizing - BOOL _allowsResizing; - BOOL _resizing; + BOOL _allowsResizing; + BOOL _resizing; // cell width - NSInteger _cellMinWidth; - NSInteger _cellMaxWidth; - NSInteger _cellOptimumWidth; + NSInteger _cellMinWidth; + NSInteger _cellMaxWidth; + NSInteger _cellOptimumWidth; // animation for hide/show - NSInteger _currentStep; - BOOL _isHidden; + NSInteger _currentStep; + BOOL _isHidden; IBOutlet id partnerView; // gets resized when hide/show - BOOL _awakenedFromNib; - NSInteger _tabBarWidth; + BOOL _awakenedFromNib; + NSInteger _tabBarWidth; NSTimer *_showHideAnimationTimer; // drag and drop - NSEvent *_lastMouseDownEvent; // keep this for dragging reference - BOOL _didDrag; - BOOL _closeClicked; + NSEvent *_lastMouseDownEvent; // keep this for dragging reference + BOOL _didDrag; + BOOL _closeClicked; // MVC help IBOutlet id delegate; @@ -144,6 +146,11 @@ enum { - (SEL)createNewTabAction; - (void)setCreateNewTabAction:(SEL)selector; +- (id)doubleClickTarget; +- (void)setDoubleClickTarget:(id)object; +- (SEL)doubleClickAction; +- (void)setDoubleClickAction:(SEL)selector; + - (NSInteger)cellMinWidth; - (void)setCellMinWidth:(NSInteger)value; - (NSInteger)cellMaxWidth; diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 028dc84b..a38c50b0 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -471,8 +471,6 @@ [self update]; } - - - (id)createNewTabTarget { return _createNewTabTarget; @@ -495,7 +493,25 @@ [[self addTabButton] setAction:selector]; } +- (id)doubleClickTarget +{ + return _doubleClickTarget; +} + +- (void)setDoubleClickTarget:(id)object +{ + _doubleClickTarget = object; +} + +- (SEL)doubleClickAction +{ + return _doubleClickAction; +} +- (void)setDoubleClickAction:(SEL)selector +{ + _doubleClickAction = selector; +} - (NSInteger)cellMinWidth { @@ -1327,6 +1343,11 @@ [cell setCloseButtonOver:NO]; [cell setCloseButtonPressed:YES]; _closeClicked = YES; + } + else if ([theEvent clickCount] == 2) { + [cell setCloseButtonOver:NO]; + + [_doubleClickTarget performSelector:_doubleClickAction withObject:cell]; } else { [cell setCloseButtonPressed:NO]; if (_selectsTabsOnMouseDown) { |