aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
commit1e5288e9840e201a00bcb5ca3035d7aa807f1f8d (patch)
tree0c1a47953f57b71c41cc7a63e156629c6c9d645b /Frameworks
parent915a3831525bf3a9350648d82f86dd54ae366292 (diff)
downloadsequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.gz
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.bz2
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.zip
Bring outline view branch up to date with trunk (r3203:r3224).
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h16
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m104
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h6
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m38
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m6
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPResult.m54
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m14
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m16
-rw-r--r--Frameworks/MCPKit/Support files/NSNotificationAdditions.m39
-rwxr-xr-xFrameworks/PSMTabBar/NSBezierPath_AMShading.m4
-rw-r--r--Frameworks/PSMTabBar/PSMOverflowPopUpButton.h8
-rw-r--r--Frameworks/PSMTabBar/PSMOverflowPopUpButton.m4
-rw-r--r--Frameworks/PSMTabBar/PSMProgressIndicator.h2
-rw-r--r--Frameworks/PSMTabBar/PSMRolloverButton.h3
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarCell.m24
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.h13
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.m62
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarController.h16
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarController.m50
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragAssistant.h5
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragAssistant.m47
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragView.m2
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragWindowController.h5
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m205
26 files changed, 405 insertions, 342 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index 61ce1261..6364add8 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -66,9 +66,9 @@ typedef struct {
NSString *connectionLogin;
NSString *connectionPassword;
NSString *connectionHost;
- NSInteger connectionPort;
+ NSUInteger connectionPort;
NSString *connectionSocket;
- NSInteger maxAllowedPacketSize;
+ NSUInteger maxAllowedPacketSize;
unsigned long connectionThreadId;
BOOL useSSL;
@@ -136,7 +136,7 @@ typedef struct {
@property (readwrite, assign) CGFloat keepAliveInterval;
// Initialisation
-- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSInteger)port;
+- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSUInteger)port;
- (id)initToSocket:(NSString *)socket withLogin:(NSString *)login;
// Delegate
@@ -145,7 +145,7 @@ typedef struct {
- (MCPConnectionCheck)delegateDecisionForLostConnection;
// Connection details
-- (BOOL)setPort:(NSInteger)thePort;
+- (BOOL)setPort:(NSUInteger)thePort;
- (BOOL)setPassword:(NSString *)thePassword;
- (void) setSSL:(BOOL)shouldUseSSL usingKeyFilePath:(NSString *)keyFilePath certificatePath:(NSString *)certificatePath certificateAuthorityCertificatePath:(NSString *)caCertificatePath;
@@ -169,7 +169,7 @@ typedef struct {
- (BOOL)pingConnectionUsingLoopDelay:(NSUInteger)loopDelay;
void backgroundPingTask(void *ptr);
void forceThreadExit(int signalNumber);
-void pingThreadCleanup();
+void pingThreadCleanup(void *pingDetails);
- (void)keepAlive:(NSTimer *)theTimer;
- (void)threadedKeepAlive;
@@ -189,7 +189,7 @@ void pingThreadCleanup();
+ (void)setTruncateLongFieldInLogs:(BOOL)iTruncFlag;
+ (BOOL)truncateLongField;
- (BOOL)setConnectionOption:(NSInteger)option toValue:(BOOL)value;
-- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSInteger)port socket:(NSString *)socket;
+- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSUInteger)port socket:(NSString *)socket;
- (BOOL)selectDB:(NSString *)dbName;
@@ -266,9 +266,9 @@ void pingThreadCleanup();
// Packet size
- (BOOL)fetchMaxAllowedPacket;
-- (NSInteger)getMaxAllowedPacket;
+- (NSUInteger)getMaxAllowedPacket;
- (BOOL)isMaxAllowedPacketEditable;
-- (NSInteger)setMaxAllowedPacketTo:(NSInteger)newSize resetSize:(BOOL)reset;
+- (NSUInteger)setMaxAllowedPacketTo:(NSUInteger)newSize resetSize:(BOOL)reset;
// Data conversion
- (const char *)cStringFromString:(NSString *)theString;
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 3556e9d7..7efe4499 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -32,6 +32,7 @@
#import "MCPNull.h"
#import "MCPStreamingResult.h"
#import "MCPConnectionProxy.h"
+#import "MCPConnectionDelegate.h"
#import "MCPStringAdditions.h"
#import "SPStringAdditions.h"
#import "RegexKitLite.h"
@@ -133,7 +134,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
lastKeepAliveTime = 0;
pingThread = NULL;
connectionProxy = nil;
- connectionStartTime = -1;
+ connectionStartTime = 0;
lastQueryExecutedAtTime = CGFLOAT_MAX;
lastDelegateDecisionForLostConnection = NSNotFound;
queryCancelled = NO;
@@ -195,7 +196,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
/**
* Inialize connection using the supplied host details.
*/
-- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSInteger)port
+- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSUInteger)port
{
if ((self = [self init])) {
if (!host) host = @"";
@@ -213,19 +214,19 @@ static BOOL sTruncateLongFieldInLogs = YES;
/**
* Inialize connection using the supplied socket details.
*/
-- (id)initToSocket:(NSString *)socket withLogin:(NSString *)login
+- (id)initToSocket:(NSString *)aSocket withLogin:(NSString *)login
{
if ((self = [self init])) {
- if (!socket || ![socket length]) {
- socket = [self findSocketPath];
- if (!socket) socket = @"";
+ if (!aSocket || ![aSocket length]) {
+ aSocket = [self findSocketPath];
+ if (!aSocket) aSocket = @"";
}
if (!login) login = @"";
connectionHost = nil;
connectionLogin = [[NSString alloc] initWithString:login];
- connectionSocket = [[NSString alloc] initWithString:socket];
+ connectionSocket = [[NSString alloc] initWithString:aSocket];
connectionPort = 0;
}
@@ -298,7 +299,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
/**
* Sets or updates the connection port - for use with tunnels.
*/
-- (BOOL)setPort:(NSInteger)thePort
+- (BOOL)setPort:(NSUInteger)thePort
{
connectionPort = thePort;
@@ -456,7 +457,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
}
// Connect
- theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags);
+ theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags);
thePass = NULL;
if (theRet != mConnection) {
@@ -558,12 +559,12 @@ static BOOL sTruncateLongFieldInLogs = YES;
// Check whether a reconnection attempt is already being made - if so, wait and return the status of that reconnection attempt.
if (isReconnecting) {
- NSDate *reconnectLoopStartdate = [NSDate date], *eventLoopStartDate;
+ NSDate *eventLoopStartDate;
while (isReconnecting) {
eventLoopStartDate = [NSDate date];
[[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
if ([[NSDate date] timeIntervalSinceDate:eventLoopStartDate] < 0.1) {
- usleep(100000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate]));
+ usleep((useconds_t)(100000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate])));
}
}
[reconnectionPool drain];
@@ -624,7 +625,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
eventLoopStartDate = [NSDate date];
[[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]];
if ([[NSDate date] timeIntervalSinceDate:eventLoopStartDate] < 0.25) {
- usleep(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate]));
+ usleep((useconds_t)(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate])));
}
}
@@ -653,7 +654,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
[[NSRunLoop mainRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]];
//[[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]];
if ([[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer] < 0.25) {
- usleep(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer]));
+ usleep((useconds_t)(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer])));
}
if ([connectionProxy state] == PROXY_STATE_WAITING_FOR_AUTH) {
proxyStartDate = [proxyStartDate addTimeInterval:[[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer]];
@@ -844,7 +845,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
*/
- (double)timeConnected
{
- if (connectionStartTime == -1) return -1;
+ if (connectionStartTime == 0) return -1;
uint64_t currentTime_t = mach_absolute_time() - connectionStartTime;
Nanoseconds elapsedTime = AbsoluteToNanoseconds(*(AbsoluteTime *)&(currentTime_t));
@@ -901,7 +902,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
// Loop until the ping completes
do {
- usleep(loopDelay);
+ usleep((useconds_t)loopDelay);
// If the ping timeout has been exceeded, force a timeout; double-check that the
// thread is still active.
@@ -959,9 +960,10 @@ void forceThreadExit(int signalNumber)
pthread_exit(NULL);
}
-void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
+void pingThreadCleanup(void *pingDetails)
{
- *(pingDetails->pingActivePointer) = NO;
+ MCPConnectionPingDetails *pingDetailsStruct = pingDetails;
+ *(pingDetailsStruct->pingActivePointer) = NO;
}
/**
@@ -1348,12 +1350,12 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
* The socket is used if the host is set to !{@"localhost"}, to an empty or a !{nil} string
* For the moment the implementation might not be safe if you have a nil pointer to one of the NSString* variables (underestand: I don't know what the result will be).
*/
-- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSInteger)port socket:(NSString *)socket
+- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSUInteger)port socket:(NSString *)aSocket
{
const char *theLogin = [self cStringFromString:login];
const char *theHost = [self cStringFromString:host];
const char *thePass = [self cStringFromString:pass];
- const char *theSocket = [self cStringFromString:socket];
+ const char *theSocket = [self cStringFromString:aSocket];
void *theRet;
// Disconnect if it was already connected
@@ -1394,7 +1396,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
kMCPSSLCipherList);
}
- theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, port, theSocket, mConnectionFlags);
+ theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, (unsigned int)port, theSocket, mConnectionFlags);
if (theRet != mConnection) {
return mConnected = NO;
}
@@ -1758,7 +1760,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
}
else {
- NSString *errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The query length of %ld bytes is larger than max_allowed_packet size (%ld).",
+ NSString *errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The query length of %lu bytes is larger than max_allowed_packet size (%lu).",
@"error message if max_allowed_packet < query size"),
(unsigned long)theCQueryLength, maxAllowedPacketSize];
@@ -1836,7 +1838,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
queryErrorMessage = [[NSString alloc] initWithString:@""];
queryErrorId = 0;
- if (streamResultType == MCPStreamingNone && queryAffectedRows == -1) {
+ if (streamResultType == MCPStreamingNone && queryAffectedRows == (my_ulonglong)~0) {
queryAffectedRows = mysql_affected_rows(mConnection);
}
@@ -1983,7 +1985,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
}
// Connect
- connectionSetupStatus = mysql_real_connect(killerConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags);
+ connectionSetupStatus = mysql_real_connect(killerConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags);
thePass = NULL;
if (connectionSetupStatus) {
@@ -2153,7 +2155,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
[self lockConnection];
if ((dbsName == nil) || ([dbsName isEqualToString:@""])) {
- if (theResPtr = mysql_list_dbs(mConnection, NULL)) {
+ if ((theResPtr = mysql_list_dbs(mConnection, NULL))) {
theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone];
}
else {
@@ -2163,7 +2165,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
else {
const char *theCDBsName = (const char *)[self cStringFromString:dbsName];
- if (theResPtr = mysql_list_dbs(mConnection, theCDBsName)) {
+ if ((theResPtr = mysql_list_dbs(mConnection, theCDBsName))) {
theResult = [[MCPResult alloc] initWithResPtr:theResPtr encoding:stringEncoding timeZone:mTimeZone];
}
else {
@@ -2210,7 +2212,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
[self lockConnection];
if ((tablesName == nil) || ([tablesName isEqualToString:@""])) {
- if (theResPtr = mysql_list_tables(mConnection, NULL)) {
+ if ((theResPtr = mysql_list_tables(mConnection, NULL))) {
theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone];
}
else {
@@ -2219,7 +2221,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
}
else {
const char *theCTablesName = (const char *)[self cStringFromString:tablesName];
- if (theResPtr = mysql_list_tables(mConnection, theCTablesName)) {
+ if ((theResPtr = mysql_list_tables(mConnection, theCTablesName))) {
theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone];
}
else {
@@ -2263,7 +2265,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
// NSLog(@"num of fields: %@; num of rows: %@", [theResult numOfFields], [theResult numOfRows]);
if ([theResult numOfRows] > 0) {
- int i;
+ my_ulonglong i;
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
theTableName = [[theResult fetchRowAsArray] objectAtIndex:0];
[theDBTables addObject:theTableName];
@@ -2440,7 +2442,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
// Do not parse more than 2000 tables/views per db
if([tablesAndViews count] > 2000) {
- NSLog(@"%ld items in database %@. Only 2000 items can be parsed. Stopped parsing.", [tablesAndViews count], currentDatabase);
+ NSLog(@"%lu items in database %@. Only 2000 items can be parsed. Stopped parsing.", (unsigned long)[tablesAndViews count], currentDatabase);
[queryPool release];
return;
}
@@ -2507,7 +2509,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
}
// Connect
- connectionSetupStatus = mysql_real_connect(structConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags);
+ connectionSetupStatus = mysql_real_connect(structConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags);
thePass = NULL;
if (connectionSetupStatus) {
MYSQL_RES *theResult;
@@ -2558,12 +2560,12 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
if(![aTableName isKindOfClass:[NSString class]]) continue;
if(![aTableName length]) continue;
// Retrieve the column details
- NSString *query = [NSString stringWithFormat:@"SHOW FULL COLUMNS FROM `%@` FROM `%@`",
+ query = [NSString stringWithFormat:@"SHOW FULL COLUMNS FROM `%@` FROM `%@`",
[aTableName stringByReplacingOccurrencesOfString:@"`" withString:@"``"],
currentDatabaseEscaped];
- NSData *encodedQueryData = NSStringDataUsingLossyEncoding(query, theConnectionEncoding, 1);
- const char *queryCString = [encodedQueryData bytes];
- unsigned long queryCStringLength = [encodedQueryData length];
+ encodedQueryData = NSStringDataUsingLossyEncoding(query, theConnectionEncoding, 1);
+ queryCString = [encodedQueryData bytes];
+ queryCStringLength = [encodedQueryData length];
if (mysql_real_query(structConnection, queryCString, queryCStringLength) != 0) {
// NSLog(@"error %@", aTableName);
continue;
@@ -2579,7 +2581,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
NSMutableDictionary *tableStructure = [databaseStructure objectForKey:table_id];
// Loop through the fields, extracting details for each
- while (row = mysql_fetch_row(theResult)) {
+ while ((row = mysql_fetch_row(theResult))) {
NSString *field = [self stringWithCString:row[0] usingEncoding:theConnectionEncoding] ;
NSString *type = [self stringWithCString:row[1] usingEncoding:theConnectionEncoding] ;
NSString *type_display = [type stringByReplacingOccurrencesOfRegex:@"\\(.*?,.*?\\)" withString:@"(…)"];
@@ -2627,10 +2629,9 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
queryCStringLength = [encodedQueryData length];
if (mysql_real_query(structConnection, queryCString, queryCStringLength) == 0) {
theResult = mysql_use_result(structConnection);
- NSUInteger numberOfFields = mysql_num_fields(theResult);
// Loop through the rows and extract the function details
- while(row = mysql_fetch_row(theResult)) {
+ while ((row = mysql_fetch_row(theResult))) {
// If cancelled, abort without saving the new structure
if(cancelQueryingDbStructure) {
@@ -2643,7 +2644,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
NSString *type = ([[self stringWithUTF8CString:row[4]] isEqualToString:@"FUNCTION"]) ? @"3" : @"2";
NSString *dtd = [self stringWithUTF8CString:row[5]];
NSString *det = [self stringWithUTF8CString:row[11]];
- NSString *access = [self stringWithUTF8CString:row[12]];
+ NSString *dataaccess = [self stringWithUTF8CString:row[12]];
NSString *security_type = [self stringWithUTF8CString:row[14]];
NSString *definer = [self stringWithUTF8CString:row[19]];
@@ -2659,7 +2660,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
// Add the "field" details
[[[queriedStructure valueForKey:db_id] valueForKey:table_id] setObject:
- [NSArray arrayWithObjects:dtd, access, det, security_type, definer, [NSNumber numberWithUnsignedLongLong:uniqueCounter], nil] forKey:field_id];
+ [NSArray arrayWithObjects:dtd, dataaccess, det, security_type, definer, [NSNumber numberWithUnsignedLongLong:uniqueCounter], nil] forKey:field_id];
[[[queriedStructure valueForKey:db_id] valueForKey:table_id] setObject:type forKey:@" struct_type "];
uniqueCounter++;
}
@@ -2802,7 +2803,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
[self lockConnection];
if (mConnected && (mConnection != NULL)) {
- if (theResPtr = mysql_list_processes(mConnection)) {
+ if ((theResPtr = mysql_list_processes(mConnection))) {
result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:stringEncoding timeZone:mTimeZone];
}
else {
@@ -2850,7 +2851,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
@"/opt/local/lib/mysql/mysql.sock", // Alternate fedora
nil];
- for (NSInteger i = 0; i < [possibleSocketLocations count]; i++)
+ for (NSUInteger i = 0; i < [possibleSocketLocations count]; i++)
{
if ([fileManager fileExistsAtPath:[possibleSocketLocations objectAtIndex:i]])
return [possibleSocketLocations objectAtIndex:i];
@@ -3091,9 +3092,9 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
/**
* Retrieves max_allowed_packet size set as global variable.
- * It returns -1 if it fails.
+ * It returns NSNotFound if it fails.
*/
-- (NSInteger)getMaxAllowedPacket
+- (NSUInteger)getMaxAllowedPacket
{
MCPResult *r;
r = [self queryString:@"SELECT @@global.max_allowed_packet" usingEncoding:stringEncoding streamingResult:NO];
@@ -3105,13 +3106,13 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
else
NSRunAlertPanel(@"Error", errorMessage, @"OK", nil, nil);
}
- return -1;
+ return NSNotFound;
}
NSArray *a = [r fetchRowAsArray];
if([a count])
return [[a objectAtIndex:0] integerValue];
- return -1;
+ return NSNotFound;
}
/*
@@ -3120,21 +3121,22 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails)
* if the maximal size was reached (e.g. set it to 4GB it'll return 1GB up to now).
* If something failed it return -1;
*/
-- (NSInteger)setMaxAllowedPacketTo:(NSInteger)newSize resetSize:(BOOL)reset
+- (NSUInteger)setMaxAllowedPacketTo:(NSUInteger)newSize resetSize:(BOOL)reset
{
if(![self isMaxAllowedPacketEditable] || newSize < 1024) return maxAllowedPacketSize;
[self lockConnection];
- mysql_query(mConnection, [[NSString stringWithFormat:@"SET GLOBAL max_allowed_packet = %ld", newSize] UTF8String]);
+ mysql_query(mConnection, [[NSString stringWithFormat:@"SET GLOBAL max_allowed_packet = %lu", newSize] UTF8String]);
[self unlockConnection];
// Inform the user via a log entry about that change according to reset value
- if(delegate && [delegate respondsToSelector:@selector(queryGaveError:connection:)])
+ if(delegate && [delegate respondsToSelector:@selector(queryGaveError:connection:)]) {
if(reset)
- [delegate queryGaveError:[NSString stringWithFormat:@"max_allowed_packet was reset to %ld for new session", newSize] connection:self];
+ [delegate queryGaveError:[NSString stringWithFormat:@"max_allowed_packet was reset to %lu for new session", newSize] connection:self];
else
- [delegate queryGaveError:[NSString stringWithFormat:@"Query too large; max_allowed_packet temporarily set to %ld for the current session to allow query to succeed", newSize] connection:self];
-
+ [delegate queryGaveError:[NSString stringWithFormat:@"Query too large; max_allowed_packet temporarily set to %lu for the current session to allow query to succeed", newSize] connection:self];
+ }
+
return maxAllowedPacketSize;
}
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h
index 3cbba325..0e162875 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h
@@ -26,7 +26,7 @@
// More info at <http://mysql-cocoa.sourceforge.net/>
// More info at <http://code.google.com/p/sequel-pro/>
-@protocol MCPConnectionDelegate
+@protocol MCPConnectionDelegate <NSObject>
/**
*
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h
index 6d03137c..f4edbfd8 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h
@@ -60,7 +60,7 @@ enum PROXY_TUNNEL_STATES
/**
* Get the local port being used by the proxy.
*/
-- (NSInteger)localPort;
+- (NSUInteger)localPort;
/**
* Sets the method the proxy should call whenever the state of the connection changes.
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h
index cca59b30..9af3fcfe 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h
@@ -42,7 +42,7 @@ typedef struct st_point_2d_
double y;
} st_point_2d;
-@interface MCPGeometryData : NSObject <NSCoding, NSCopying>
+@interface MCPGeometryData : NSObject
{
// Holds the WKB bytes coming from SQL server
Byte *geoBuffer;
@@ -52,8 +52,8 @@ typedef struct st_point_2d_
}
-- (id)initWithBytes:(Byte*)geoData length:(NSUInteger)length;
-+ (id)dataWithBytes:(Byte*)geoData length:(NSUInteger)length;
+- (id)initWithBytes:(const void *)geoData length:(NSUInteger)length;
++ (id)dataWithBytes:(const void *)geoData length:(NSUInteger)length;
- (NSString*)description;
- (NSUInteger)length;
- (NSData*)data;
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m
index 00d7d44f..b7a3fd09 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m
@@ -47,7 +47,7 @@
/**
* Initialize the MCPGeometryData object with the WKB data
*/
-- (id)initWithBytes:(Byte*)geoData length:(NSUInteger)length
+- (id)initWithBytes:(const void *)geoData length:(NSUInteger)length
{
if ((self = [self init])) {
bufferLength = length;
@@ -60,7 +60,7 @@
/**
* Return an autorelease MCPGeometryData object
*/
-+ (id)dataWithBytes:(Byte*)geoData length:(NSUInteger)length
++ (id)dataWithBytes:(const void *)geoData length:(NSUInteger)length
{
return [[[MCPGeometryData alloc] initWithBytes:geoData length:length] autorelease];
}
@@ -370,10 +370,10 @@
uint32_t i, j, k, n; // Loop counter for numberOf...Items
uint32_t ptr = BUFFER_START; // pointer to geoBuffer while parsing
- double x_min = 1e998;
- double x_max = -1e998;
- double y_min = 1e998;
- double y_max = -1e998;
+ double x_min = DBL_MAX;
+ double x_max = -DBL_MAX;
+ double y_min = DBL_MAX;
+ double y_max = -DBL_MAX;
NSMutableArray *coordinates = [NSMutableArray array];
NSMutableArray *subcoordinates = [NSMutableArray array];
@@ -406,7 +406,7 @@
x_max = aPoint.x;
y_min = aPoint.y;
y_max = aPoint.y;
- [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObjects:
[NSNumber numberWithDouble:x_min],
@@ -429,7 +429,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
return [NSDictionary dictionaryWithObjectsAndKeys:
@@ -456,7 +456,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[coordinates addObject:[[subcoordinates copy] autorelease]];
@@ -484,7 +484,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE+WKB_HEADER_SIZE;
}
return [NSDictionary dictionaryWithObjectsAndKeys:
@@ -512,7 +512,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
ptr += WKB_HEADER_SIZE;
@@ -547,7 +547,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[coordinates addObject:[[subcoordinates copy] autorelease]];
@@ -591,7 +591,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [pointcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [pointcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
break;
@@ -604,7 +604,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[linecoordinates addObject:[[linesubcoordinates copy] autorelease]];
@@ -623,7 +623,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[polygoncoordinates addObject:[[polygonsubcoordinates copy] autorelease]];
@@ -640,7 +640,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [pointcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [pointcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE+WKB_HEADER_SIZE;
}
ptr -= WKB_HEADER_SIZE;
@@ -658,7 +658,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[linecoordinates addObject:[[linesubcoordinates copy] autorelease]];
@@ -683,7 +683,7 @@
x_max = (aPoint.x > x_max) ? aPoint.x : x_max;
y_min = (aPoint.y < y_min) ? aPoint.y : y_min;
y_max = (aPoint.y > y_max) ? aPoint.y : y_max;
- [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))];
+ [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))];
ptr += POINT_DATA_SIZE;
}
[polygoncoordinates addObject:[[polygonsubcoordinates copy] autorelease]];
@@ -728,7 +728,7 @@
NSUInteger ptr = BUFFER_START; // pointer to geoBuffer while parsing
if (bufferLength < WKB_HEADER_SIZE)
- return @"-1";
+ return -1;
byteOrder = geoBuffer[ptr];
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m b/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m
index 3dab0e07..de035ee8 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m
@@ -246,12 +246,12 @@
- (int)intValue
{
- return [number integerValue];
+ return [number intValue];
}
- (unsigned int)unsignedIntValue
{
- return [number unsignedIntegerValue];
+ return [number unsignedIntValue];
}
- (long)longValue
@@ -276,7 +276,7 @@
- (float)floatValue
{
- return [number doubleValue];
+ return [number floatValue];
}
- (double)doubleValue
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
index 24d14193..53066c14 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
@@ -227,7 +227,7 @@ const OUR_CHARSET our_charsets60[] =
*/
+ (void)initialize
{
- if (self = [MCPResult class]) {
+ if ((self = [MCPResult class])) {
[self setVersion:030001]; // Ma.Mi.Re -> MaMiRe
MCPYear0000 = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0];
[MCPYear0000 setCalendarFormat:@"%Y"];
@@ -367,7 +367,7 @@ const OUR_CHARSET our_charsets60[] =
*/
- (void)dataSeek:(my_ulonglong)row
{
- my_ulonglong theRow = (row < 0)? 0 : row;
+ my_ulonglong theRow = (row < 1)? 0 : row;
theRow = (theRow < [self numOfRows]) ? theRow : ([self numOfRows] - 1);
mysql_data_seek(mResult,theRow);
}
@@ -380,7 +380,7 @@ const OUR_CHARSET our_charsets60[] =
MYSQL_ROW theRow;
unsigned long *theLengths;
MYSQL_FIELD *theField;
- NSInteger i;
+ NSUInteger i;
id theReturn;
if (mResult == NULL) {
@@ -405,7 +405,7 @@ const OUR_CHARSET our_charsets60[] =
theReturn = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields];
break;
default :
- NSLog (@"Unknown type : %d, will return an Array!\n", aType);
+ NSLog (@"Unknown type : %d, will return an Array!\n", (int)aType);
theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields];
break;
}
@@ -474,7 +474,7 @@ const OUR_CHARSET our_charsets60[] =
break;
default:
- NSLog (@"in fetchRowAsType : Unknown type : %ld for column %ld, send back a NSData object", (NSInteger)theField[i].type, (NSInteger)i);
+ NSLog (@"in fetchRowAsType : Unknown type : %d for column %lu, send back a NSData object", (int)theField[i].type, (unsigned long)i);
theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]];
break;
}
@@ -542,7 +542,7 @@ const OUR_CHARSET our_charsets60[] =
*/
- (NSArray *)fetchFieldNames
{
- NSInteger i;
+ NSUInteger i;
NSUInteger theNumFields;
NSMutableArray *theNamesArray;
MYSQL_FIELD *theField;
@@ -581,7 +581,7 @@ const OUR_CHARSET our_charsets60[] =
*/
- (id)fetchTypesAsType:(MCPReturnType)aType
{
- NSInteger i;
+ NSUInteger i;
id theTypes;
MYSQL_FIELD *theField;
@@ -601,7 +601,7 @@ const OUR_CHARSET our_charsets60[] =
theTypes = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields];
break;
default :
- NSLog (@"Unknown type : %d, will return an Array!\n", aType);
+ NSLog (@"Unknown type : %d, will return an Array!\n", (int)aType);
theTypes = [NSMutableArray arrayWithCapacity:mNumOfFields];
break;
}
@@ -686,7 +686,7 @@ const OUR_CHARSET our_charsets60[] =
break;
default:
theType = @"unknown";
- NSLog (@"in fetchTypesAsArray : Unknown type for column %ld of the MCPResult, type = %ld", (NSInteger)i, (NSInteger)theField[i].type);
+ NSLog (@"in fetchTypesAsArray : Unknown type for column %lu of the MCPResult, type = %d", (unsigned long)i, (int)theField[i].type);
break;
}
@@ -843,7 +843,7 @@ const OUR_CHARSET our_charsets60[] =
/**
* Return the MySQL flags of the column at the given index... Can be used to check if a number is signed or not...
*/
-- (NSUInteger)fetchFlagsAtIndex:(NSUInteger)index
+- (NSUInteger)fetchFlagsAtIndex:(NSUInteger)anIndex
{
NSUInteger theRet;
NSUInteger theNumFields;
@@ -857,12 +857,12 @@ const OUR_CHARSET our_charsets60[] =
theNumFields = [self numOfFields];
theField = mysql_fetch_fields(mResult);
- if (index >= theNumFields) {
+ if (anIndex >= theNumFields) {
// Out of range... should raise an exception
theRet = 0;
}
else {
- theRet = theField[index].flags;
+ theRet = theField[anIndex].flags;
}
return theRet;
@@ -874,7 +874,7 @@ const OUR_CHARSET our_charsets60[] =
- (NSUInteger)fetchFlagsForKey:(NSString *)key
{
NSUInteger theRet;
- NSUInteger index;
+ NSUInteger anIndex;
MYSQL_FIELD *theField;
if (mResult == NULL) {
@@ -893,9 +893,9 @@ const OUR_CHARSET our_charsets60[] =
theRet = 0;
}
else {
- index = [mNames indexOfObject:key];
+ anIndex = [mNames indexOfObject:key];
- theRet = theField[index].flags;
+ theRet = theField[anIndex].flags;
}
return theRet;
@@ -911,7 +911,7 @@ const OUR_CHARSET our_charsets60[] =
* #{NOTE} That the current version handles properly TEXT, and returns those as NSString (and not NSData as
* it used to be).
*/
-- (BOOL)isBlobAtIndex:(NSUInteger)index
+- (BOOL)isBlobAtIndex:(NSUInteger)anIndex
{
BOOL theRet;
NSUInteger theNumFields;
@@ -925,17 +925,17 @@ const OUR_CHARSET our_charsets60[] =
theNumFields = [self numOfFields];
theField = mysql_fetch_fields(mResult);
- if (index >= theNumFields) {
+ if (anIndex >= theNumFields) {
// Out of range... should raise an exception
theRet = NO;
}
else {
- switch(theField[index].type) {
+ switch(theField[anIndex].type) {
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_LONG_BLOB:
- theRet = (theField[index].flags & BINARY_FLAG);
+ theRet = (theField[anIndex].flags & BINARY_FLAG);
break;
default:
theRet = NO;
@@ -959,7 +959,7 @@ const OUR_CHARSET our_charsets60[] =
- (BOOL)isBlobForKey:(NSString *)key
{
BOOL theRet;
- NSUInteger index;
+ NSUInteger anIndex;
MYSQL_FIELD *theField;
if (mResult == NULL) {
@@ -978,14 +978,14 @@ const OUR_CHARSET our_charsets60[] =
theRet = NO;
}
else {
- index = [mNames indexOfObject:key];
+ anIndex = [mNames indexOfObject:key];
- switch(theField[index].type) {
+ switch(theField[anIndex].type) {
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
case FIELD_TYPE_LONG_BLOB:
- theRet = (theField[index].flags & BINARY_FLAG);
+ theRet = (theField[anIndex].flags & BINARY_FLAG);
break;
default:
theRet = NO;
@@ -1043,10 +1043,10 @@ const OUR_CHARSET our_charsets60[] =
}
else {
NSMutableString *theString = [NSMutableString stringWithCapacity:0];
- NSInteger i;
+ NSUInteger i;
NSArray *theRow;
MYSQL_ROW_OFFSET thePosition;
- BOOL trunc = [MCPConnection truncateLongField];
+ BOOL shouldTruncateFields = [MCPConnection truncateLongField];
// First line, saying we are displaying a MCPResult
[theString appendFormat:@"MCPResult: (encoding : %ld, dim %ld x %ld)\n", (long)mEncoding, (long)mNumOfFields, (long)[self numOfRows]];
@@ -1063,11 +1063,11 @@ const OUR_CHARSET our_charsets60[] =
thePosition = mysql_row_tell(mResult);
[self dataSeek:0];
- while (theRow = [self fetchRowAsArray])
+ while ((theRow = [self fetchRowAsArray]))
{
id theField = [theRow objectAtIndex:i];
- if (trunc) {
+ if (shouldTruncateFields) {
if (([theField isKindOfClass:[NSString class]]) && (kLengthOfTruncationForLog < [(NSString *)theField length])) {
theField = [theField substringToIndex:kLengthOfTruncationForLog];
}
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m
index c171dc7f..dbf9d070 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m
@@ -42,7 +42,7 @@
*/
- (NSArray *)fetchColAtIndex:(NSUInteger)col
{
- NSMutableArray *theCol = [NSMutableArray arrayWithCapacity:[self numOfRows]];
+ NSMutableArray *theCol = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]];
MYSQL_ROW_OFFSET thePosition;
NSArray *theRow;
@@ -61,7 +61,7 @@
[self dataSeek:0];
// One might want to have optimized code here. Maybe in later versions
- while (theRow = [self fetchRowAsType:MCPTypeArray])
+ while ((theRow = [self fetchRowAsType:MCPTypeArray]))
{
[theCol addObject:[theRow objectAtIndex:col]];
}
@@ -131,9 +131,9 @@
switch (type)
{
case MCPTypeArray :
- theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]];
+ theTable = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]];
- while (theVect = [self fetchRowAsArray])
+ while ((theVect = [self fetchRowAsArray]))
{
[theTable addObject:theVect];
}
@@ -141,9 +141,9 @@
theTable = [NSArray arrayWithArray:theTable];
break;
case MCPTypeDictionary :
- theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]];
+ theTable = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]];
- while (theVect = [self fetchRowAsDictionary])
+ while ((theVect = [self fetchRowAsDictionary]))
{
[theTable addObject:theVect];
}
@@ -175,7 +175,7 @@
theTable = [NSDictionary dictionaryWithDictionary:theTable];
break;
default :
- NSLog (@"Unknown MCPReturnType : %ld; return nil\n", (NSInteger)type);
+ NSLog (@"Unknown MCPReturnType : %d; return nil\n", (int)type);
theTable = nil;
break;
}
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
index c15db6c6..465221fe 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
@@ -164,7 +164,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf);
MYSQL_ROW theRow;
char *theRowData, *buf;
unsigned long *fieldLengths;
- NSInteger i, copiedDataLength;
+ NSUInteger i, copiedDataLength;
NSMutableArray *returnArray;
// Retrieve the next row according to the mode this result set is in.
@@ -290,7 +290,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf);
// Get a binary representation of the data
buf = malloc(fieldDefinitions[i].length + 1);
- _bytes2bin(theData, fieldLengths[i], fieldDefinitions[i].length, buf);
+ _bytes2bin((Byte *)theData, fieldLengths[i], fieldDefinitions[i].length, buf);
cellData = (theData != NULL) ? [NSString stringWithUTF8String:buf] : @"";
@@ -323,7 +323,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf);
break;
default:
- NSLog(@"in fetchNextRowAsArray : Unknown type : %ld for column %ld, sending back a NSData object", (NSInteger)fieldDefinitions[i].type, (NSInteger)i);
+ NSLog(@"in fetchNextRowAsArray : Unknown type : %d for column %lu, sending back a NSData object", (int)fieldDefinitions[i].type, (unsigned long)i);
cellData = [NSData dataWithBytes:theData length:fieldLengths[i]];
break;
}
@@ -435,10 +435,10 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf);
void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf)
{
- int i = 0;
+ NSUInteger i = 0;
nbytes--;
- while (i < len)
- buf[len - ++i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0';
+ while (++i <= len)
+ buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0';
buf[len] = '\0';
}
@@ -451,14 +451,14 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf)
NSAutoreleasePool *downloadPool = [[NSAutoreleasePool alloc] init];
MYSQL_ROW theRow;
unsigned long *fieldLengths;
- NSInteger i, dataCopiedLength, rowDataLength;
+ NSUInteger i, dataCopiedLength, rowDataLength;
LOCAL_ROW_DATA *newRowStore;
size_t sizeOfLocalRowData = sizeof(LOCAL_ROW_DATA);
size_t sizeOfDataLengths = (size_t)(sizeof(unsigned long) * mNumOfFields);
// Loop through the rows until the end of the data is reached - indicated via a NULL
- while ( (BOOL)(*isConnectedPtr)(parentConnection, isConnectedSEL) && (theRow = mysql_fetch_row(mResult))) {
+ while ((*isConnectedPtr)(parentConnection, isConnectedSEL) && (theRow = mysql_fetch_row(mResult))) {
// Retrieve the lengths of the returned data
fieldLengths = mysql_fetch_lengths(mResult);
diff --git a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
index d615231e..9991c999 100644
--- a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
+++ b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
@@ -26,6 +26,12 @@
#import "NSNotificationAdditions.h"
#import "pthread.h"
+@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
++ (void)_postNotification:(NSNotification *)notification;
++ (void)_postNotificationName:(NSDictionary *)info;
++ (void)_postNotificationForwarder:(NSDictionary *)info;
+@end
+
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
- (void)postNotificationOnMainThread:(NSNotification *)notification
@@ -35,16 +41,11 @@
[self postNotificationOnMainThread:notification waitUntilDone:NO];
}
-- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait
+- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
{
if (pthread_main_np()) return [self postNotification:notification];
- [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait];
-}
-
-+ (void)_postNotification:(NSNotification *)notification
-{
- [[self defaultCenter] postNotification:notification];
+ [self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
}
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object
@@ -61,7 +62,7 @@
[self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
}
-- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
@@ -71,11 +72,20 @@
if (object) [info setObject:object forKey:@"object"];
if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
- [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait];
+ [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
[info release];
}
+@end
+
+@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+
++ (void)_postNotification:(NSNotification *)notification
+{
+ [[self defaultCenter] postNotification:notification];
+}
+
+ (void)_postNotificationName:(NSDictionary *)info
{
NSString *name = [info objectForKey:@"name"];
@@ -87,4 +97,15 @@
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
++ (void)_postNotificationForwarder:(NSDictionary *)info
+{
+ NSString *name = [info objectForKey:@"name"];
+
+ id object = [info objectForKey:@"object"];
+
+ NSDictionary *userInfo = [info objectForKey:@"userInfo"];
+
+ [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
+}
+
@end
diff --git a/Frameworks/PSMTabBar/NSBezierPath_AMShading.m b/Frameworks/PSMTabBar/NSBezierPath_AMShading.m
index 73213f3b..b878688d 100755
--- a/Frameworks/PSMTabBar/NSBezierPath_AMShading.m
+++ b/Frameworks/PSMTabBar/NSBezierPath_AMShading.m
@@ -23,7 +23,7 @@ static void linearShadedColor(void *info, const CGFloat *in, CGFloat *out)
static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out)
{
CGFloat *colors = (CGFloat *)info;
- CGFloat factor = (*in)*2.0;
+ CGFloat factor = (*in)*2.0f;
if (*in > 0.5) {
factor = 2-factor;
}
@@ -87,7 +87,7 @@ static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out)
// draw gradient
colorspace = CGColorSpaceCreateDeviceRGB();
size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace);
- static const CGFloat domain[2] = {0.0, 1.0};
+ static const CGFloat domain[2] = {0.0f, 1.0f};
static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
//static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL};
diff --git a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.h b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.h
index 19ce95f1..b513865e 100644
--- a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.h
+++ b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.h
@@ -22,6 +22,14 @@
- (BOOL)animatingAlternateImage;
- (void)setAnimatingAlternateImage:(BOOL)flag;
+// Notifications
+- (void)notificationReceived:(NSNotification *)notification;
+
+// Animations
+- (void)setAnimatingAlternateImage:(BOOL)flag;
+- (BOOL)animatingAlternateImage;
+- (void)animateStep:(NSTimer *)timer;
+
// archiving
- (void)encodeWithCoder:(NSCoder *)aCoder;
- (id)initWithCoder:(NSCoder *)aDecoder;
diff --git a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m
index cc96b910..8ce50464 100644
--- a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m
+++ b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m
@@ -16,7 +16,7 @@
- (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag
{
- if (self = [super initWithFrame:frameRect pullsDown:YES]) {
+ if ((self = [super initWithFrame:frameRect pullsDown:YES])) {
[self setBezelStyle:NSRegularSquareBezelStyle];
[self setBordered:NO];
[self setTitle:@""];
@@ -63,7 +63,7 @@
drawPoint.y += altImageSize.height;
}
- [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sin(_animationValue * M_PI)];
+ [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sinf(_animationValue * (float)M_PI)];
}
}
diff --git a/Frameworks/PSMTabBar/PSMProgressIndicator.h b/Frameworks/PSMTabBar/PSMProgressIndicator.h
index 8f56bd73..8c34e444 100644
--- a/Frameworks/PSMTabBar/PSMProgressIndicator.h
+++ b/Frameworks/PSMTabBar/PSMProgressIndicator.h
@@ -20,4 +20,4 @@
- (void)update;
-@end \ No newline at end of file
+@end
diff --git a/Frameworks/PSMTabBar/PSMRolloverButton.h b/Frameworks/PSMTabBar/PSMRolloverButton.h
index d78b47c2..3c175119 100644
--- a/Frameworks/PSMTabBar/PSMRolloverButton.h
+++ b/Frameworks/PSMTabBar/PSMRolloverButton.h
@@ -24,6 +24,7 @@
- (NSImage *)rolloverImage;
// tracking rect for mouse events
+- (void)rolloverFrameDidChange:(NSNotification *)inNotification;
- (void)addTrackingRect;
- (void)removeTrackingRect;
-@end \ No newline at end of file
+@end
diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.m b/Frameworks/PSMTabBar/PSMTabBarCell.m
index 7ecaa183..809d9061 100644
--- a/Frameworks/PSMTabBar/PSMTabBarCell.m
+++ b/Frameworks/PSMTabBar/PSMTabBarCell.m
@@ -28,7 +28,7 @@
_cellTrackingTag = 0;
_closeButtonOver = NO;
_closeButtonPressed = NO;
- _indicator = [[PSMProgressIndicator alloc] initWithFrame:NSMakeRect(0.0,0.0,kPSMTabBarIndicatorWidth,kPSMTabBarIndicatorWidth)];
+ _indicator = [[PSMProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f,0.0f,kPSMTabBarIndicatorWidth,kPSMTabBarIndicatorWidth)];
[_indicator setStyle:NSProgressIndicatorSpinningStyle];
[_indicator setAutoresizingMask:NSViewMinYMargin];
_hasCloseButton = YES;
@@ -48,9 +48,9 @@
_isPlaceholder = YES;
if (!value) {
if ([controlView orientation] == PSMTabBarHorizontalOrientation) {
- frame.size.width = 0.0;
+ frame.size.width = 0.0f;
} else {
- frame.size.height = 0.0;
+ frame.size.height = 0.0f;
}
}
[self setFrame:frame];
@@ -348,7 +348,7 @@
{
if (_isPlaceholder) {
if (![_controlView usesSafariStyleDragging]) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set];
+ [[NSColor colorWithCalibratedWhite:0.0f alpha:0.2f] set];
NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop);
}
return;
@@ -373,7 +373,7 @@
// scrubtastic
if ([_controlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask))
- [_controlView performSelector:@selector(tabClick:) withObject:self];
+ [_controlView tabClick:self];
// tell the control we only need to redraw the affected tab
[_controlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
@@ -410,7 +410,13 @@
// Draw the tab into a new image
NSImage *image = [[[NSImage alloc] initWithSize:cellFrame.size] autorelease];
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ [image setFlipped:YES];
+ [image lockFocus];
+#else
[image lockFocusFlipped:YES];
+#endif
[self setFrame:tabDrawFrame];
[(id <PSMTabStyle>)[(PSMTabBarControl *)_controlView style] drawTabCell:self];
[self setFrame:oldFrame];
@@ -418,12 +424,12 @@
// Add the indicator if appropriate
if (![[self indicator] isHidden]) {
- NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
+ NSImage *pieImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
[image lockFocus];
NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y);
- [pi compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:1.0];
+ [pieImage compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:1.0f];
[image unlockFocus];
- [pi release];
+ [pieImage release];
}
return image;
@@ -528,7 +534,7 @@
- (void)accessibilityPerformAction:(NSString *)action {
if ([action isEqualToString:NSAccessibilityPressAction]) {
// this tab was selected
- [_controlView performSelector:@selector(tabClick:) withObject:self];
+ [_controlView tabClick:self];
}
}
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h
index 2ac8474a..cd2b5025 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.h
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.h
@@ -23,9 +23,9 @@
#define kPSMTabBarCellPadding 4
// fixed size objects
#define kPSMMinimumTitleWidth 30
-#define kPSMTabBarIndicatorWidth 16.0
-#define kPSMTabBarIconWidth 16.0
-#define kPSMHideAnimationSteps 3.0
+#define kPSMTabBarIndicatorWidth 16.0f
+#define kPSMTabBarIconWidth 16.0f
+#define kPSMHideAnimationSteps 3.0f
// Value used in _currentStep to indicate that resizing operation is not in progress
#define kPSMIsNotBeingResized -1
@@ -185,9 +185,13 @@ enum {
- (PSMRolloverButton *)addTabButton;
- (PSMOverflowPopUpButton *)overflowPopUpButton;
+// actions
+- (void)tabClick:(id)sender;
+- (void)overflowMenuAction:(id)sender;
+
// tab information
- (NSMutableArray *)representedTabViewItems;
-- (NSInteger)numberOfVisibleTabs;
+- (NSUInteger)numberOfVisibleTabs;
- (PSMTabBarCell *)lastVisibleTab;
// special effects
@@ -221,6 +225,7 @@ enum {
- (BOOL)tabView:(NSTabView *)aTabView shouldAllowTabViewItem:(NSTabViewItem *)tabViewItem toLeaveTabBar:(PSMTabBarControl *)tabBarControl;
- (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl;
- (void)draggingEvent:(id <NSDraggingInfo>)dragEvent enteredTabBar:(PSMTabBarControl *)tabBarControl tabView:(NSTabViewItem *)tabViewItem;
+- (void)tabViewDragWindowCreated:(NSWindow *)dragWindow;
//Tear-off tabs methods
- (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(NSUInteger *)styleMask;
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m
index 8debd774..231f3e3c 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.m
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.m
@@ -44,15 +44,14 @@
- (void)_checkWindowFrame;
// actions
-- (void)overflowMenuAction:(id)sender;
- (void)closeTabClick:(id)sender;
-- (void)tabClick:(id)sender;
- (void)tabNothing:(id)sender;
// notification handlers
- (void)frameDidChange:(NSNotification *)notification;
- (void)windowDidMove:(NSNotification *)aNotification;
- (void)windowDidUpdate:(NSNotification *)notification;
+- (void)windowStatusDidChange:(NSNotification *)notification;
// NSTabView delegate
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
@@ -68,6 +67,8 @@
- (void)_bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
+- (void)fireSpring:(NSTimer *)timer;
+- (void)animateShowHide:(NSTimer *)timer;
- (void)_animateCells:(NSTimer *)timer;
@end
@@ -105,7 +106,7 @@
{
NSRect aRect=[self frame];
aRect.origin.x = [style leftMarginForTabBarControl];
- aRect.origin.y = 0.0;
+ aRect.origin.y = 0.0f;
aRect.size.width = [self availableCellWidth];
aRect.size.height = [style tabCellHeight];
return aRect;
@@ -153,7 +154,7 @@
[self _positionOverflowMenu];
// new tab button
- NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 3.0, 16.0, 16.0);
+ NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 3.0f, 16.0f, 16.0f);
_addTabButton = [[PSMRolloverButton alloc] initWithFrame:addTabButtonRect];
if (_addTabButton) {
NSImage *newButtonImage = [style addTabButtonImage];
@@ -682,7 +683,7 @@
// add to collection
[_cells addObject:cell];
[cell release];
- if ([_cells count] == [tabView numberOfTabViewItems]) {
+ if ((NSInteger)[_cells count] == [tabView numberOfTabViewItems]) {
[self update]; // don't update unless all are accounted for!
}
}
@@ -714,7 +715,7 @@
}
if ([item identifier] != nil) {
- if ([[item identifier] respondsToSelector:@selector(objectCount)]) {
+ if ([[item identifier] respondsToSelector:@selector(count)]) {
[[item identifier] removeObserver:cell forKeyPath:@"objectCount"];
}
}
@@ -947,10 +948,10 @@
// moves the frame of the tab bar and window (or partner view) linearly to hide or show the tab bar
NSRect myFrame = [self frame];
NSDictionary *userInfo = [timer userInfo];
- CGFloat myCurrentOrigin = ([[userInfo objectForKey:@"myOriginalOrigin"] doubleValue] + (([[userInfo objectForKey:@"myTargetOrigin"] doubleValue] - [[userInfo objectForKey:@"myOriginalOrigin"] doubleValue]) * (_currentStep/kPSMHideAnimationSteps)));
- CGFloat myCurrentSize = ([[userInfo objectForKey:@"myOriginalSize"] doubleValue] + (([[userInfo objectForKey:@"myTargetSize"] doubleValue] - [[userInfo objectForKey:@"myOriginalSize"] doubleValue]) * (_currentStep/kPSMHideAnimationSteps)));
- CGFloat partnerCurrentOrigin = ([[userInfo objectForKey:@"partnerOriginalOrigin"] doubleValue] + (([[userInfo objectForKey:@"partnerTargetOrigin"] doubleValue] - [[userInfo objectForKey:@"partnerOriginalOrigin"] doubleValue]) * (_currentStep/kPSMHideAnimationSteps)));
- CGFloat partnerCurrentSize = ([[userInfo objectForKey:@"partnerOriginalSize"] doubleValue] + (([[userInfo objectForKey:@"partnerTargetSize"] doubleValue] - [[userInfo objectForKey:@"partnerOriginalSize"] doubleValue]) * (_currentStep/kPSMHideAnimationSteps)));
+ CGFloat myCurrentOrigin = ([[userInfo objectForKey:@"myOriginalOrigin"] floatValue] + (([[userInfo objectForKey:@"myTargetOrigin"] floatValue] - [[userInfo objectForKey:@"myOriginalOrigin"] floatValue]) * (_currentStep/kPSMHideAnimationSteps)));
+ CGFloat myCurrentSize = ([[userInfo objectForKey:@"myOriginalSize"] floatValue] + (([[userInfo objectForKey:@"myTargetSize"] floatValue] - [[userInfo objectForKey:@"myOriginalSize"] floatValue]) * (_currentStep/kPSMHideAnimationSteps)));
+ CGFloat partnerCurrentOrigin = ([[userInfo objectForKey:@"partnerOriginalOrigin"] floatValue] + (([[userInfo objectForKey:@"partnerTargetOrigin"] floatValue] - [[userInfo objectForKey:@"partnerOriginalOrigin"] floatValue]) * (_currentStep/kPSMHideAnimationSteps)));
+ CGFloat partnerCurrentSize = ([[userInfo objectForKey:@"partnerOriginalSize"] floatValue] + (([[userInfo objectForKey:@"partnerTargetSize"] floatValue] - [[userInfo objectForKey:@"partnerOriginalSize"] floatValue]) * (_currentStep/kPSMHideAnimationSteps)));
NSRect myNewFrame;
if ([self orientation] == PSMTabBarHorizontalOrientation) {
@@ -1053,7 +1054,7 @@
{
// make sure all of our tabs are accounted for before updating,
// or only proceed if a drag is in progress (where counts may mismatch)
- if ([[self tabView] numberOfTabViewItems] != [_cells count] && ![[PSMTabDragAssistant sharedDragAssistant] isDragging]) {
+ if ([[self tabView] numberOfTabViewItems] != (NSInteger)[_cells count] && ![[PSMTabDragAssistant sharedDragAssistant] isDragging]) {
return;
}
@@ -1082,7 +1083,7 @@
if (animate) {
NSMutableArray *targetFrames = [NSMutableArray arrayWithCapacity:[_cells count]];
- for (NSInteger i = 0; i < [_cells count]; i++) {
+ for (NSUInteger i = 0; i < [_cells count]; i++) {
currentCell = [_cells objectAtIndex:i];
//we're going from NSRect -> NSValue -> NSRect -> NSValue here - oh well
@@ -1104,7 +1105,7 @@
[self _animateCells:_animationTimer];
} else {
- for (NSInteger i = 0; i < [_cells count]; i++) {
+ for (NSUInteger i = 0; i < [_cells count]; i++) {
currentCell = [_cells objectAtIndex:i];
[currentCell setFrame:[_controller cellFrameAtIndex:i]];
@@ -1124,11 +1125,11 @@
NSAnimation *animation = [[timer userInfo] objectAtIndex:1];
NSArray *targetFrames = [[timer userInfo] objectAtIndex:0];
PSMTabBarCell *currentCell;
- NSInteger cellCount = [_cells count];
+ NSUInteger cellCount = (NSUInteger)[_cells count];
if ((cellCount > 0) && [animation isAnimating]) {
//compare our target position with the current position and move towards the target
- for (NSInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
+ for (NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
currentCell = [_cells objectAtIndex:i];
NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
CGFloat sizeChange;
@@ -1164,8 +1165,8 @@
} else {
//put all the cells where they should be in their final position
if (cellCount > 0) {
- for (NSInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
- PSMTabBarCell *currentCell = [_cells objectAtIndex:i];
+ for (NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
+ currentCell = [_cells objectAtIndex:i];
NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
if ([self orientation] == PSMTabBarHorizontalOrientation) {
@@ -1196,7 +1197,7 @@
[_animationTimer invalidate];
[_animationTimer release]; _animationTimer = nil;
- for (NSInteger i = 0; i < cellCount; i++) {
+ for (NSUInteger i = 0; i < cellCount; i++) {
currentCell = [_cells objectAtIndex:i];
//we've hit the cells that are in overflow, stop setting up tracking rects
@@ -1217,8 +1218,9 @@
// Skip tracking rects for placeholders - not required.
if ([cell isPlaceholder]) return;
- NSInteger tag, index = [_cells indexOfObject:cell];
- NSRect cellTrackingRect = [_controller cellTrackingRectAtIndex:index];
+ NSInteger tag;
+ NSUInteger anIndex = [_cells indexOfObject:cell];
+ NSRect cellTrackingRect = [_controller cellTrackingRectAtIndex:anIndex];
NSPoint mousePoint = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil];
BOOL mouseInCell = NSMouseInRect(mousePoint, cellTrackingRect, [self isFlipped]);
@@ -1232,7 +1234,7 @@
[cell setHighlighted:mouseInCell];
if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- NSRect closeRect = [_controller closeButtonTrackingRectAtIndex:index];
+ NSRect closeRect = [_controller closeButtonTrackingRectAtIndex:anIndex];
BOOL mouseInCloseRect = NSMouseInRect(mousePoint, closeRect, [self isFlipped]);
//set the close button tracking rect
@@ -1390,9 +1392,9 @@
return;
}
- CGFloat dx = fabs(currentPoint.x - trackingStartPoint.x);
- CGFloat dy = fabs(currentPoint.y - trackingStartPoint.y);
- CGFloat distance = sqrt(dx * dx + dy * dy);
+ CGFloat dx = fabsf(currentPoint.x - trackingStartPoint.x);
+ CGFloat dy = fabsf(currentPoint.y - trackingStartPoint.y);
+ CGFloat distance = sqrtf(dx * dx + dy * dy);
if (distance >= 10 && !_didDrag && ![[PSMTabDragAssistant sharedDragAssistant] isDragging] &&
[self delegate] && [[self delegate] respondsToSelector:@selector(tabView:shouldDragTabViewItem:fromTabBar:)] &&
@@ -1815,7 +1817,7 @@
// message, thus I can end up updating when there are no cells, if no tabs were (yet) present
NSInteger tabIndex = [aTabView indexOfTabViewItem:tabViewItem];
- if ([_cells count] > 0 && tabIndex < [_cells count]) {
+ if ([_cells count] > 0 && tabIndex < (NSInteger)[_cells count]) {
PSMTabBarCell *thisCell = [_cells objectAtIndex:tabIndex];
if (_alwaysShowActiveTab && [thisCell isInOverflowMenu]) {
@@ -2002,12 +2004,12 @@
- (NSSize)minimumFrameSizeFromKnobPosition:(NSInteger)position
{
- return NSMakeSize(100.0, 22.0);
+ return NSMakeSize(100.0f, 22.0f);
}
- (NSSize)maximumFrameSizeFromKnobPosition:(NSInteger)knobPosition
{
- return NSMakeSize(10000.0, 22.0);
+ return NSMakeSize(10000.0f, 22.0f);
}
- (void)placeView:(NSRect)newFrame
@@ -2056,7 +2058,7 @@
// bind for the existence of a counter
[cell setCount:0];
if ([item identifier] != nil) {
- if ([[[cell representedObject] identifier] respondsToSelector:@selector(objectCount)]) {
+ if ([[[cell representedObject] identifier] respondsToSelector:@selector(count)]) {
[cell bind:@"count" toObject:[item identifier] withKeyPath:@"objectCount" options:nil];
[[item identifier] addObserver:cell forKeyPath:@"objectCount" options:0 context:nil];
}
@@ -2138,9 +2140,9 @@
return [_cells objectAtIndex:(cellCount - 1)];
}
-- (NSInteger)numberOfVisibleTabs
+- (NSUInteger)numberOfVisibleTabs
{
- NSInteger i, cellCount = 0;
+ NSUInteger i, cellCount = 0;
PSMTabBarCell *nextCell;
for (i = 0; i < [_cells count]; i++) {
diff --git a/Frameworks/PSMTabBar/PSMTabBarController.h b/Frameworks/PSMTabBar/PSMTabBarController.h
index c675b981..3f8b4787 100644
--- a/Frameworks/PSMTabBar/PSMTabBarController.h
+++ b/Frameworks/PSMTabBar/PSMTabBarController.h
@@ -22,12 +22,22 @@
- (NSRect)addButtonRect;
- (NSMenu *)overflowMenu;
-- (NSRect)cellTrackingRectAtIndex:(NSInteger)index;
-- (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index;
-- (NSRect)cellFrameAtIndex:(NSInteger)index;
+- (NSRect)cellTrackingRectAtIndex:(NSUInteger)anIndex;
+- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)anIndex;
+- (NSRect)cellFrameAtIndex:(NSUInteger)anIndex;
- (void)setSelectedCell:(PSMTabBarCell *)cell;
- (void)layoutCells;
@end
+
+@interface NSObject (TabRepresentedObjectIdentifierMethods)
+
+// Method for generating a tooltip for a tab
+- (NSString *)tabTitleForTooltip;
+
+// Retrieving whether a tab is working
+- (BOOL)isProcessing;
+
+@end
diff --git a/Frameworks/PSMTabBar/PSMTabBarController.m b/Frameworks/PSMTabBar/PSMTabBarController.m
index 04e1ec69..4ab2c1ef 100644
--- a/Frameworks/PSMTabBar/PSMTabBarController.m
+++ b/Frameworks/PSMTabBar/PSMTabBarController.m
@@ -83,13 +83,13 @@
@returns The tracking rect of the cell at the requested index.
*/
-- (NSRect)cellTrackingRectAtIndex:(NSInteger)index
+- (NSRect)cellTrackingRectAtIndex:(NSUInteger)anIndex
{
NSRect rect;
- if (index > -1 && index < [_cellTrackingRects count]) {
- rect = [[_cellTrackingRects objectAtIndex:index] rectValue];
+ if (anIndex < [_cellTrackingRects count]) {
+ rect = [[_cellTrackingRects objectAtIndex:anIndex] rectValue];
} else {
- NSLog(@"cellTrackingRectAtIndex: Invalid index (%ld)", (long)index);
+ NSLog(@"cellTrackingRectAtIndex: Invalid index (%lu)", (unsigned long)anIndex);
rect = NSZeroRect;
}
return rect;
@@ -103,13 +103,13 @@
@returns The close button tracking rect of the cell at the requested index.
*/
-- (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index
+- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)anIndex
{
NSRect rect;
- if (index > -1 && index < [_closeButtonTrackingRects count]) {
- rect = [[_closeButtonTrackingRects objectAtIndex:index] rectValue];
+ if (anIndex < [_closeButtonTrackingRects count]) {
+ rect = [[_closeButtonTrackingRects objectAtIndex:anIndex] rectValue];
} else {
- NSLog(@"closeButtonTrackingRectAtIndex: Invalid index (%ld)", (long)index);
+ NSLog(@"closeButtonTrackingRectAtIndex: Invalid index (%lu)", (unsigned long)anIndex);
rect = NSZeroRect;
}
return rect;
@@ -123,14 +123,14 @@
@returns The frame of the cell at the requested index.
*/
-- (NSRect)cellFrameAtIndex:(NSInteger)index
+- (NSRect)cellFrameAtIndex:(NSUInteger)anIndex
{
NSRect rect;
- if (index > -1 && index < [_cellFrames count]) {
- rect = [[_cellFrames objectAtIndex:index] rectValue];
+ if (anIndex < [_cellFrames count]) {
+ rect = [[_cellFrames objectAtIndex:anIndex] rectValue];
} else {
- NSLog(@"cellFrameAtIndex: Invalid index (%ld)", (long)index);
+ NSLog(@"cellFrameAtIndex: Invalid index (%lu)", (unsigned long)anIndex);
rect = NSZeroRect;
}
return rect;
@@ -169,7 +169,7 @@
[cell setTabState:PSMTab_SelectedMask];
if (![cell isInOverflowMenu]) {
- NSInteger cellIndex = [cells indexOfObject:cell];
+ NSUInteger cellIndex = [cells indexOfObject:cell];
if (cellIndex > 0) {
nextCell = [cells objectAtIndex:cellIndex - 1];
@@ -214,10 +214,10 @@
_addButtonRect.size = [[_control addTabButton] frame].size;
if ([_control orientation] == PSMTabBarHorizontalOrientation) {
_addButtonRect.origin.y = MARGIN_Y;
- _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] doubleValue] + MARGIN_X;
+ _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] floatValue] + MARGIN_X;
} else {
_addButtonRect.origin.x = 0;
- _addButtonRect.origin.y = [[cellWidths lastObject] doubleValue];
+ _addButtonRect.origin.y = [[cellWidths lastObject] floatValue];
}
}
@@ -241,7 +241,7 @@
NSInteger q = 0;
for (q = (count - 1); q >= 0; q--) {
- CGFloat cellWidth = [[newWidths objectAtIndex:q] doubleValue];
+ CGFloat cellWidth = [[newWidths objectAtIndex:q] floatValue];
if (cellWidth - 1 >= minimum) {
cellWidth--;
totalWidths--;
@@ -296,7 +296,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
NSInteger cellCount = [cells count], i, numberOfVisibleCells = ([_control orientation] == PSMTabBarHorizontalOrientation) ? 1 : 0;
NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount];
id <PSMTabStyle> style = [_control style];
- CGFloat availableWidth = [_control availableCellWidth], currentOrigin = 0, totalOccupiedWidth = 0.0, width;
+ CGFloat availableWidth = [_control availableCellWidth], currentOrigin = 0, totalOccupiedWidth = 0.0f, width;
NSRect cellRect = [_control genericCellRect], controlRect = [_control frame];
PSMTabBarCell *currentCell;
@@ -329,7 +329,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
width = [_control cellOptimumWidth];
}
- width = ceil(width);
+ width = ceilf(width);
//check to see if there is not enough space to place all tabs as preferred
if (totalOccupiedWidth + width >= availableWidth) {
@@ -498,11 +498,11 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
cellWidth = [NSNumber numberWithDouble:[cell1 desiredWidthOfCell] < availableWidth * 0.5f ? [cell1 desiredWidthOfCell] : availableWidth * 0.5f];
[newWidths addObject:cellWidth];
- totalOccupiedWidth += [cellWidth doubleValue];
+ totalOccupiedWidth += [cellWidth floatValue];
cellWidth = [NSNumber numberWithDouble:[cell2 desiredWidthOfCell] < (availableWidth - totalOccupiedWidth) ? [cell2 desiredWidthOfCell] : (availableWidth - totalOccupiedWidth)];
[newWidths addObject:cellWidth];
- totalOccupiedWidth += [cellWidth doubleValue];
+ totalOccupiedWidth += [cellWidth floatValue];
if (totalOccupiedWidth < availableWidth) {
[newWidths replaceObjectAtIndex:0 withObject:[NSNumber numberWithDouble:availableWidth - [cellWidth doubleValue]]];
@@ -523,7 +523,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
- (void)_setupCells:(NSArray *)cells withWidths:(NSArray *)widths
{
- NSInteger i, tabState, cellCount = [cells count];
+ NSUInteger i, tabState, cellCount = [cells count];
NSRect cellRect = [_control genericCellRect];
PSMTabBarCell *cell;
NSTabViewItem *selectedTabViewItem = [[_control tabView] selectedTabViewItem];
@@ -539,10 +539,10 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
// set cell frame
if ([_control orientation] == PSMTabBarHorizontalOrientation) {
- cellRect.size.width = [[widths objectAtIndex:i] doubleValue];
+ cellRect.size.width = [[widths objectAtIndex:i] floatValue];
} else {
cellRect.size.width = [_control frame].size.width;
- cellRect.origin.y = [[widths objectAtIndex:i] doubleValue];
+ cellRect.origin.y = [[widths objectAtIndex:i] floatValue];
cellRect.origin.x = 0;
}
@@ -589,7 +589,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
}
// next...
- cellRect.origin.x += [[widths objectAtIndex:i] doubleValue];
+ cellRect.origin.x += [[widths objectAtIndex:i] floatValue];
} else {
[cell setState:NSOffState];
[cell setIsInOverflowMenu:YES];
@@ -625,7 +625,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
}
}
-- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)menuItem atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
+- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)menuItem atIndex:(NSInteger)anIndex shouldCancel:(BOOL)shouldCancel
{
if (menu == _overflowMenu) {
if ([[[menuItem representedObject] identifier] respondsToSelector:@selector(icon)]) {
diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.h b/Frameworks/PSMTabBar/PSMTabDragAssistant.h
index 2f42c573..92a8d4d8 100644
--- a/Frameworks/PSMTabBar/PSMTabDragAssistant.h
+++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.h
@@ -70,6 +70,9 @@
- (void)draggingBeganAt:(NSPoint)aPoint;
- (void)draggingMovedTo:(NSPoint)aPoint;
+- (void)fadeInDragWindow:(NSTimer *)timer;
+- (void)fadeOutDragWindow:(NSTimer *)timer;
+
// Animation
- (void)animateDrag:(NSTimer *)timer;
- (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control;
@@ -88,7 +91,7 @@
- (void)setControlView:(id)view;
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
- (PSMTabBarCell *)lastVisibleTab;
-- (NSInteger)numberOfVisibleTabs;
+- (NSUInteger)numberOfVisibleTabs;
@end
diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.m b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
index 2b670b67..5d5b7fcc 100644
--- a/Frameworks/PSMTabBar/PSMTabDragAssistant.m
+++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
@@ -21,6 +21,7 @@
- (NSImage *)_imageForViewOfCell:(PSMTabBarCell *)cell styleMask:(NSUInteger *)outMask;
- (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window;
- (void)_expandWindow:(NSWindow *)window atPoint:(NSPoint)point;
+- (void)_expandWindowTimerFired:(NSTimer *)timer;
@end
@implementation PSMTabDragAssistant
@@ -284,7 +285,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
[self setDestinationTabBar:nil];
- [self setCurrentMouseLoc:NSMakePoint(-1.0, -1.0)];
+ [self setCurrentMouseLoc:NSMakePoint(-1.0f, -1.0f)];
if (_fadeTimer) {
[_fadeTimer invalidate];
@@ -297,7 +298,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
NSImage *viewImage = [self _imageForViewOfCell:[self draggedCell] styleMask:&styleMask];
_draggedView = [[PSMTabDragWindowController alloc] initWithImage:viewImage styleMask:styleMask tearOffStyle:PSMTabBarTearOffAlphaWindow initialAlpha:[control usesSafariStyleDragging]?1:kPSMTabDragWindowAlpha];
- [[_draggedView window] setAlphaValue:0.0];
+ [[_draggedView window] setAlphaValue:0.0f];
// Inform the delegate a new drag window was created to allow any changes
if ([control delegate] && [[control delegate] respondsToSelector:@selector(tabViewDragWindowCreated:)]) {
@@ -335,12 +336,13 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
//don't fade out the old window if the delegate doesn't respond to the new tab bar method, just to be safe
if ([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1 && [self sourceTabBar] == control &&
[[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:newTabBarForDraggedTabViewItem:atPoint:)]) {
- [[[self sourceTabBar] window] setAlphaValue:0.0];
+ [[[self sourceTabBar] window] setAlphaValue:0.0f];
if ([_sourceTabBar tearOffStyle] == PSMTabBarTearOffAlphaWindow) {
[[_draggedView window] setAlphaValue:kPSMTabDragWindowAlpha];
} else {
- #warning fix me - what should we do when the last tab is dragged as a miniwindow?
+ [_draggedTab switchImages];
+ _centersDragWindows = YES;
}
} else {
if ([_sourceTabBar tearOffStyle] == PSMTabBarTearOffAlphaWindow) {
@@ -356,7 +358,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
- (void)performDragOperation
{
// move cell
- NSInteger destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]];
+ NSUInteger destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]];
//there is the slight possibility of the targetCell now being set properly, so avoid errors
if (destinationIndex >= [[[self destinationTabBar] cells] count]) {
@@ -374,7 +376,8 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
[[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]];
[[self sourceTabBar] removeTabForCell:[self draggedCell]];
- NSInteger i, insertIndex;
+ NSUInteger i;
+ NSInteger insertIndex;
NSArray *cells = [[self destinationTabBar] cells];
//find the index of where the dragged cell was just dropped
@@ -409,25 +412,25 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
NSTabView *tabView = [[self sourceTabBar] tabView];
NSTabViewItem *item = [[self draggedCell] representedObject];
BOOL reselect = ([tabView selectedTabViewItem] == item);
- NSInteger index;
+ NSUInteger anIndex;
NSArray *cells = [[self sourceTabBar] cells];
//find the index of where the dragged cell was just dropped
- for (index = 0; index < [cells count] && [cells objectAtIndex:index] != [self draggedCell]; index++);
+ for (anIndex = 0; anIndex < [cells count] && [cells objectAtIndex:anIndex] != [self draggedCell]; anIndex++);
//temporarily disable the delegate in order to move the tab to a different index
id tempDelegate = [tabView delegate];
[tabView setDelegate:nil];
[item retain];
[tabView removeTabViewItem:item];
- [tabView insertTabViewItem:item atIndex:index];
+ [tabView insertTabViewItem:item atIndex:anIndex];
if (reselect) {
[tabView selectTabViewItem:item];
}
[tabView setDelegate:tempDelegate];
}
- if (([self sourceTabBar] != [self destinationTabBar] || [[[self sourceTabBar] cells] indexOfObject:[self draggedCell]] != _draggedCellIndex) && [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) {
+ if (([self sourceTabBar] != [self destinationTabBar] || (NSInteger)[[[self sourceTabBar] cells] indexOfObject:[self draggedCell]] != _draggedCellIndex) && [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) {
[[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] didDropTabViewItem:[[self draggedCell] representedObject] inTabBar:[self destinationTabBar]];
}
@@ -504,7 +507,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
// Restore the window alpha if appropriate
if ([[[self sourceTabBar] tabView] numberOfTabViewItems]) {
- [[[self sourceTabBar] window] setAlphaValue:1.0];
+ [[[self sourceTabBar] window] setAlphaValue:1.0f];
}
}
@@ -562,7 +565,9 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
if ([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1) {
[self draggingExitedTabBar:[self sourceTabBar]];
- [[_draggedTab window] setAlphaValue:0.0];
+ if ([_sourceTabBar tearOffStyle] == PSMTabBarTearOffAlphaWindow) {
+ [[_draggedTab window] setAlphaValue:0.0f];
+ }
}
}
}
@@ -633,7 +638,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
float tabWindowAlphaValue = [[self destinationTabBar] usesSafariStyleDragging]?1:kPSMTabDragWindowAlpha;
if (value <= 0.0) {
- [viewWindow setAlphaValue:0.0];
+ [viewWindow setAlphaValue:0.0f];
[tabWindow setAlphaValue:tabWindowAlphaValue];
[timer invalidate];
@@ -711,12 +716,12 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
{
NSRect frame = [window frame];
[window setFrameTopLeftPoint:NSMakePoint(point.x - frame.size.width / 2, point.y + frame.size.height / 2)];
- [window setAlphaValue:0.0];
+ [window setAlphaValue:0.0f];
[window makeKeyAndOrderFront:nil];
NSAnimation *animation = [[NSAnimation alloc] initWithDuration:0.25 animationCurve:NSAnimationEaseInOut];
[animation setAnimationBlockingMode:NSAnimationNonblocking];
- [animation setCurrentProgress:0.1];
+ [animation setCurrentProgress:0.1f];
[animation startAnimation];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(_expandWindowTimerFired:) userInfo:[NSDictionary dictionaryWithObjectsAndKeys:window, @"Window", animation, @"Animation", nil] repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
@@ -730,10 +735,10 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
NSPoint translation;
NSRect winFrame = [window frame];
- translation.x = (winFrame.size.width / 2.0);
- translation.y = (winFrame.size.height / 2.0);
+ translation.x = (winFrame.size.width / 2.0f);
+ translation.y = (winFrame.size.height / 2.0f);
transform = CGAffineTransformMakeTranslation(translation.x, translation.y);
- transform = CGAffineTransformScale(transform, 1.0 / [animation currentValue], 1.0 / [animation currentValue]);
+ transform = CGAffineTransformScale(transform, 1.0f / [animation currentValue], 1.0f / [animation currentValue]);
transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y);
translation.x = -winFrame.origin.x;
@@ -781,8 +786,8 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
NSRect controlWindowFrame = [[control window] contentRectForFrameRect:[[control window] frame]];
NSPoint tabTopLeftInWindowCoords = NSMakePoint(draggedTabWindowFrame.origin.x - controlWindowFrame.origin.x, controlWindowFrame.origin.y + (2*controlWindowFrame.size.height) - draggedTabWindowFrame.origin.y);
targetPoint = [control convertPoint:tabTopLeftInWindowCoords fromView:nil];
- targetPoint.x += (draggedTabWindowFrame.size.width / 2.0);
- targetPoint.y = 0 - (draggedTabWindowFrame.size.height / 2.0) - targetPoint.y;
+ targetPoint.x += (draggedTabWindowFrame.size.width / 2.0f);
+ targetPoint.y = 0 - (draggedTabWindowFrame.size.height / 2.0f) - targetPoint.y;
} else {
targetPoint = [self currentMouseLoc];
}
@@ -926,7 +931,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control
{
- NSInteger i, numVisibleTabs = [control numberOfVisibleTabs];
+ NSUInteger i, numVisibleTabs = [control numberOfVisibleTabs];
for (i = 0; i < numVisibleTabs; i++) {
PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
[[control cells] insertObject:pc atIndex:(2 * i)];
diff --git a/Frameworks/PSMTabBar/PSMTabDragView.m b/Frameworks/PSMTabBar/PSMTabDragView.m
index 259116ae..5be56b10 100644
--- a/Frameworks/PSMTabBar/PSMTabDragView.m
+++ b/Frameworks/PSMTabBar/PSMTabDragView.m
@@ -13,7 +13,7 @@
- (id)initWithFrame:(NSRect)frame {
if ( (self = [super initWithFrame:frame]) ) {
- _alpha = 1.0;
+ _alpha = 1.0f;
}
return self;
}
diff --git a/Frameworks/PSMTabBar/PSMTabDragWindowController.h b/Frameworks/PSMTabBar/PSMTabDragWindowController.h
index babfb1a7..380a2bab 100644
--- a/Frameworks/PSMTabBar/PSMTabDragWindowController.h
+++ b/Frameworks/PSMTabBar/PSMTabDragWindowController.h
@@ -9,8 +9,8 @@
#import <Cocoa/Cocoa.h>
#import "PSMTabBarControl.h"
-#define kPSMTabDragWindowAlpha 0.75
-#define kPSMTabDragAlphaInterval 0.15
+#define kPSMTabDragWindowAlpha 0.75f
+#define kPSMTabDragAlphaInterval 0.15f
@class PSMTabDragView;
@@ -30,4 +30,5 @@
- (void)setAlternateImage:(NSImage *)image;
- (BOOL)isAnimating;
- (void)switchImages;
+- (void)animateTimer:(NSTimer *)timer;
@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
index 48db93c3..ece10a76 100644
--- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
@@ -28,9 +28,9 @@
#import "NSBezierPath_AMShading.h"
#import "PSMTabDragAssistant.h"
-#define kPSMSequelProObjectCounterRadius 7.0
+#define kPSMSequelProObjectCounterRadius 7.0f
#define kPSMSequelProCounterMinWidth 20
-#define kPSMSequelProTabCornerRadius 4.5
+#define kPSMSequelProTabCornerRadius 4.5f
#define MARGIN_X 6
@implementation PSMSequelProTabStyle
@@ -58,8 +58,8 @@
_addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AddTabButtonPushed"]];
_addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AddTabButtonRollover"]];
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
+ _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0f] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
+ [[NSColor whiteColor] colorWithAlphaComponent:0.85f], NSForegroundColorAttributeName,
nil, nil];
}
return self;
@@ -134,13 +134,13 @@
if ([cell tabState] & PSMTab_SelectedMask) {
if (tabOrientation == PSMTabBarHorizontalOrientation) {
- dragRect.origin.x -= 5.0;
- dragRect.size.width += 10.0;
+ dragRect.origin.x -= 5.0f;
+ dragRect.size.width += 10.0f;
} else {
- dragRect.size.height += 1.0;
- dragRect.origin.y -= 1.0;
- dragRect.origin.x += 2.0;
- dragRect.size.width -= 3.0;
+ dragRect.size.height += 1.0f;
+ dragRect.origin.y -= 1.0f;
+ dragRect.origin.x += 2.0f;
+ dragRect.size.width -= 3.0f;
}
} else if (tabOrientation == PSMTabBarVerticalOrientation) {
dragRect.origin.x--;
@@ -158,7 +158,7 @@
NSRect result;
result.size = [sequelProCloseButton size];
result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0;
+ result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0f;
return result;
}
@@ -208,7 +208,7 @@
}
CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
- countWidth += (2 * kPSMSequelProObjectCounterRadius - 6.0);
+ countWidth += (2 * kPSMSequelProObjectCounterRadius - 6.0f);
if (countWidth < kPSMSequelProCounterMinWidth) {
countWidth = kPSMSequelProCounterMinWidth;
}
@@ -216,7 +216,7 @@
NSRect result;
result.size = NSMakeSize(countWidth, 2 * kPSMSequelProObjectCounterRadius); // temp
result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
+ result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0f;
if (![[cell indicator] isHidden]) {
result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding;
@@ -228,7 +228,7 @@
- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
{
- CGFloat resultWidth = 0.0;
+ CGFloat resultWidth = 0.0f;
// left margin
resultWidth = MARGIN_X;
@@ -258,12 +258,12 @@
// right margin
resultWidth += MARGIN_X;
- return ceil(resultWidth);
+ return ceilf(resultWidth);
}
- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
{
- CGFloat resultWidth = 0.0;
+ CGFloat resultWidth = 0.0f;
// left margin
resultWidth = MARGIN_X;
@@ -292,7 +292,7 @@
// right margin
resultWidth += MARGIN_X;
- return ceil(resultWidth);
+ return ceilf(resultWidth);
}
- (CGFloat)tabCellHeight
@@ -317,22 +317,22 @@
NSRange range = NSMakeRange(0, [contents length]);
// Add font attribute
- [attrStr addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:11.0] range:range];
- [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor textColor] colorWithAlphaComponent:0.75] range:range];
+ [attrStr addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:11.0f] range:range];
+ [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor textColor] colorWithAlphaComponent:0.75f] range:range];
// Add shadow attribute
- NSShadow* shadow;
- shadow = [[[NSShadow alloc] init] autorelease];
+ NSShadow* textShadow;
+ textShadow = [[[NSShadow alloc] init] autorelease];
CGFloat shadowAlpha;
if (([cell state] == NSOnState) || [cell isHighlighted]) {
- shadowAlpha = 0.8;
+ shadowAlpha = 0.8f;
} else {
- shadowAlpha = 0.5;
+ shadowAlpha = 0.5f;
}
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:shadowAlpha]];
- [shadow setShadowOffset:NSMakeSize(0, -1)];
- [shadow setShadowBlurRadius:1.0];
- [attrStr addAttribute:NSShadowAttributeName value:shadow range:range];
+ [textShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:shadowAlpha]];
+ [textShadow setShadowOffset:NSMakeSize(0, -1)];
+ [textShadow setShadowBlurRadius:1.0f];
+ [attrStr addAttribute:NSShadowAttributeName value:textShadow range:range];
// Paragraph Style for Truncating Long Text
static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
@@ -365,13 +365,13 @@
// no tab view == not connected
if (![bar tabView]) {
NSRect labelRect = rect;
- labelRect.size.height -= 4.0;
- labelRect.origin.y += 4.0;
+ labelRect.size.height -= 4.0f;
+ labelRect.origin.y += 4.0f;
NSMutableAttributedString *attrStr;
NSString *contents = @"PSMTabBarControl";
attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
NSRange range = NSMakeRange(0, [contents length]);
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
+ [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0f] range:range];
NSMutableParagraphStyle *centeredParagraphStyle = nil;
if (!centeredParagraphStyle) {
@@ -404,42 +404,42 @@
[NSGraphicsContext saveGraphicsState];
[[NSGraphicsContext currentContext] setShouldAntialias:NO];
- float backgroundCalibratedWhite = 0.495;
+ float backgroundCalibratedWhite = 0.495f;
float lineCalibratedWhite = [[NSColor darkGrayColor] whiteComponent];
- float shadowAlpha = 0.4;
+ float shadowAlpha = 0.4f;
// When the window is in the background, tone down the colours
if (![[tabBar window] isMainWindow] || ![NSApp isActive]) {
- backgroundCalibratedWhite = 0.73;
- lineCalibratedWhite = 0.49;
- shadowAlpha = 0.3;
+ backgroundCalibratedWhite = 0.73f;
+ lineCalibratedWhite = 0.49f;
+ shadowAlpha = 0.3f;
}
// fill in background of tab bar
- [[NSColor colorWithCalibratedWhite:backgroundCalibratedWhite alpha:1.0] set];
+ [[NSColor colorWithCalibratedWhite:backgroundCalibratedWhite alpha:1.0f] set];
NSRectFillUsingOperation(rect, NSCompositeSourceAtop);
// Draw horizontal line across bottom edge, with a slight bottom glow
- [[NSColor colorWithCalibratedWhite:lineCalibratedWhite alpha:1.0] set];
+ [[NSColor colorWithCalibratedWhite:lineCalibratedWhite alpha:1.0f] set];
[NSGraphicsContext saveGraphicsState];
- NSShadow *shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:1];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.2]];
- [shadow setShadowOffset:NSMakeSize(0,1)];
- [shadow set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height - 0.5) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - 0.5)];
- [shadow release];
+ NSShadow *lineGlow = [[NSShadow alloc] init];
+ [lineGlow setShadowBlurRadius:1];
+ [lineGlow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:0.2f]];
+ [lineGlow setShadowOffset:NSMakeSize(0,1)];
+ [lineGlow set];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height - 0.5f) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - 0.5f)];
+ [lineGlow release];
[NSGraphicsContext restoreGraphicsState];
// Add a shadow before drawing the top edge
[NSGraphicsContext saveGraphicsState];
- shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:4];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:shadowAlpha]];
- [shadow setShadowOffset:NSMakeSize(0,0)];
- [shadow set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + 0.5) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + 0.5)];
- [shadow release];
+ NSShadow *edgeShadow = [[NSShadow alloc] init];
+ [edgeShadow setShadowBlurRadius:4];
+ [edgeShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0f alpha:shadowAlpha]];
+ [edgeShadow setShadowOffset:NSMakeSize(0,0)];
+ [edgeShadow set];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + 0.5f) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + 0.5f)];
+ [edgeShadow release];
[NSGraphicsContext restoreGraphicsState];
[NSGraphicsContext restoreGraphicsState];
@@ -456,7 +456,6 @@
NSColor *shadowColor = nil;
NSBezierPath *outlineBezier = [NSBezierPath bezierPath];
NSBezierPath *fillBezier = [NSBezierPath bezierPath];
- NSPoint center = NSZeroPoint;
NSPoint topLeftArcCenter, bottomLeftArcCenter, topRightArcCenter, bottomRightArcCenter;
BOOL drawRightEdge = YES;
BOOL drawLeftEdge = YES;
@@ -503,20 +502,20 @@
if ([[tabBar window] isMainWindow] && [NSApp isActive]) {
lineColor = [NSColor darkGrayColor];
if ([cell state] == NSOnState) {
- fillColor = [NSColor colorWithCalibratedWhite:0.59 alpha:1.0];
- shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.7];
+ fillColor = [NSColor colorWithCalibratedWhite:0.59f alpha:1.0f];
+ shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.7f];
} else {
- fillColor = [NSColor colorWithCalibratedWhite:0.495 alpha:1.0];
- shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:1.0];
+ fillColor = [NSColor colorWithCalibratedWhite:0.495f alpha:1.0f];
+ shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:1.0f];
}
} else {
- lineColor = [NSColor colorWithCalibratedWhite:0.49 alpha:1.0];
+ lineColor = [NSColor colorWithCalibratedWhite:0.49f alpha:1.0f];
if ([cell state] == NSOnState) {
- fillColor = [NSColor colorWithCalibratedWhite:0.81 alpha:1.0];
- shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.4];
+ fillColor = [NSColor colorWithCalibratedWhite:0.81f alpha:1.0f];
+ shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.4f];
} else {
- fillColor = [NSColor colorWithCalibratedWhite:0.73 alpha:1.0];
- shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.7];
+ fillColor = [NSColor colorWithCalibratedWhite:0.73f alpha:1.0f];
+ shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.7f];
}
}
@@ -531,10 +530,10 @@
}
// Set up the corner bezier paths arc centers
- topLeftArcCenter = NSMakePoint(aRect.origin.x - kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + kPSMSequelProTabCornerRadius);
- topRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + kPSMSequelProTabCornerRadius);
- bottomLeftArcCenter = NSMakePoint(aRect.origin.x + kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius);
- bottomRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius);
+ topLeftArcCenter = NSMakePoint(aRect.origin.x - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + kPSMSequelProTabCornerRadius);
+ topRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + kPSMSequelProTabCornerRadius);
+ bottomLeftArcCenter = NSMakePoint(aRect.origin.x + kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius);
+ bottomRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius);
// Construct the outline path
if (drawLeftEdge) {
@@ -551,21 +550,21 @@
// If one edge is missing, apply a local fill to the other edge
if (drawRightEdge && !drawLeftEdge) {
- [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y)];
- [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + aRect.size.height)];
+ [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y)];
+ [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height)];
} else if (!drawRightEdge && drawLeftEdge) {
- [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5 + kPSMSequelProTabCornerRadius, aRect.origin.y)];
+ [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5f + kPSMSequelProTabCornerRadius, aRect.origin.y)];
}
// Set the tab outer shadow and draw the shadow
[NSGraphicsContext saveGraphicsState];
- NSShadow *shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:4];
- [shadow setShadowColor:shadowColor];
- [shadow setShadowOffset:NSMakeSize(0, 0)];
- [shadow set];
+ NSShadow *cellShadow = [[NSShadow alloc] init];
+ [cellShadow setShadowBlurRadius:4];
+ [cellShadow setShadowColor:shadowColor];
+ [cellShadow setShadowOffset:NSMakeSize(0, 0)];
+ [cellShadow set];
[outlineBezier stroke];
- [shadow release];
+ [cellShadow release];
[NSGraphicsContext restoreGraphicsState];
// Fill the tab with a solid colour
@@ -582,20 +581,20 @@
if (drawLeftEdge) {
[outlineBezier appendBezierPathWithArcWithCenter:bottomLeftArcCenter radius:kPSMSequelProTabCornerRadius startAngle:145 endAngle:90 clockwise:YES];
} else {
- [outlineBezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + aRect.size.height - 0.5)];
+ [outlineBezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + aRect.size.height - 0.5f)];
}
if (drawRightEdge) {
[outlineBezier appendBezierPathWithArcWithCenter:bottomRightArcCenter radius:kPSMSequelProTabCornerRadius startAngle:90 endAngle:35 clockwise:YES];
} else {
- [outlineBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height - 0.5)];
+ [outlineBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height - 0.5f)];
}
- shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:1];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]];
- [shadow setShadowOffset:NSMakeSize(0, 1)];
- [shadow set];
+ cellShadow = [[NSShadow alloc] init];
+ [cellShadow setShadowBlurRadius:1];
+ [cellShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:0.4f]];
+ [cellShadow setShadowOffset:NSMakeSize(0, 1)];
+ [cellShadow set];
[outlineBezier stroke];
- [shadow release];
+ [cellShadow release];
// Add the shadow over the tops of background tabs
} else if (drawLeftEdge || drawRightEdge) {
@@ -604,37 +603,37 @@
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(context);
NSPoint topLeft, topRight;
- CGFloat drawAlpha = ([[tabBar window] isMainWindow] && [NSApp isActive])? 1.0 : 0.7;
+ CGFloat drawAlpha = ([[tabBar window] isMainWindow] && [NSApp isActive])? 1.0f : 0.7f;
outlineBezier = [NSBezierPath bezierPath];
// Calculate the endpoints of the line
if (drawLeftEdge) {
- topLeft = NSMakePoint(aRect.origin.x + 0.5 - kPSMSequelProTabCornerRadius + 2, aRect.origin.y + 0.5);
+ topLeft = NSMakePoint(aRect.origin.x + 0.5f - kPSMSequelProTabCornerRadius + 2, aRect.origin.y + 0.5f);
} else {
- topLeft = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5, aRect.origin.y + 0.5);
+ topLeft = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + 0.5f);
}
if (drawRightEdge) {
- topRight = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5 - 2, aRect.origin.y + 0.5);
+ topRight = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5f - 2, aRect.origin.y + 0.5f);
} else {
- topRight = NSMakePoint(aRect.origin.x + 0.5 + kPSMSequelProTabCornerRadius, aRect.origin.y + 0.5);
+ topRight = NSMakePoint(aRect.origin.x + 0.5f + kPSMSequelProTabCornerRadius, aRect.origin.y + 0.5f);
}
// Set up the line and clipping point
CGContextClipToRect(context, CGRectMake(topLeft.x, topLeft.y, topRight.x-topLeft.x, aRect.size.height));
- [[NSColor colorWithCalibratedWhite:0.2 alpha:drawAlpha] set];
+ [[NSColor colorWithCalibratedWhite:0.2f alpha:drawAlpha] set];
[outlineBezier moveToPoint:topLeft];
[outlineBezier lineToPoint:topRight];
// Set up the shadow
- shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:4];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.2 alpha:drawAlpha]];
- [shadow setShadowOffset:NSMakeSize(0,0)];
- [shadow set];
+ cellShadow = [[NSShadow alloc] init];
+ [cellShadow setShadowBlurRadius:4];
+ [cellShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.2f alpha:drawAlpha]];
+ [cellShadow setShadowOffset:NSMakeSize(0,0)];
+ [cellShadow set];
// Draw, and then restore the previous graphics state
[outlineBezier stroke];
- [shadow release];
+ [cellShadow release];
CGContextRestoreGState(context);
}
@@ -679,7 +678,7 @@
closeButtonRect.origin.y += closeButtonRect.size.height;
}
- [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
+ [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0f];
}
// icon
@@ -693,13 +692,13 @@
// center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
if ([icon size].width < kPSMTabBarIconWidth) {
- iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width)/2.0;
+ iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width)/2.0f;
}
if ([icon size].height < kPSMTabBarIconWidth) {
- iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0;
+ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0f;
}
- [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0];
+ [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0f];
// scoot label over
insetLabelWidth += iconRect.size.width + kPSMTabBarCellPadding;
@@ -720,7 +719,7 @@
// object counter
if ([cell count] > 0) {
- [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
+ [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3f alpha:0.6f] set];
NSBezierPath *path = [NSBezierPath bezierPath];
NSRect myRect = [self objectCounterRectForTabCell:cell];
if ([cell state] == NSOnState) {
@@ -728,17 +727,17 @@
}
[path moveToPoint:NSMakePoint(myRect.origin.x + kPSMSequelProObjectCounterRadius, myRect.origin.y)];
[path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMSequelProObjectCounterRadius, myRect.origin.y)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMSequelProObjectCounterRadius, myRect.origin.y + kPSMSequelProObjectCounterRadius) radius:kPSMSequelProObjectCounterRadius startAngle:270.0 endAngle:90.0];
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMSequelProObjectCounterRadius, myRect.origin.y + kPSMSequelProObjectCounterRadius) radius:kPSMSequelProObjectCounterRadius startAngle:270.0f endAngle:90.0f];
[path lineToPoint:NSMakePoint(myRect.origin.x + kPSMSequelProObjectCounterRadius, myRect.origin.y + myRect.size.height)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMSequelProObjectCounterRadius, myRect.origin.y + kPSMSequelProObjectCounterRadius) radius:kPSMSequelProObjectCounterRadius startAngle:90.0 endAngle:270.0];
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMSequelProObjectCounterRadius, myRect.origin.y + kPSMSequelProObjectCounterRadius) radius:kPSMSequelProObjectCounterRadius startAngle:90.0f endAngle:270.0f];
[path fill];
// draw attributed string centered in area
NSRect counterStringRect;
NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell];
counterStringRect.size = [counterString size];
- counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25;
- counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
+ counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0f) + 0.25f;
+ counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0f) + 0.5f;
[counterString drawInRect:counterStringRect];
// shrink label width to make room for object counter