From 2584c8d818155c14761472331ccc5e9f6471abdd Mon Sep 17 00:00:00 2001 From: Brad Larson Date: Sat, 7 Jul 2018 15:13:35 -0500 Subject: [PATCH] Updated for 64-bit, started updating UI to modern conventions. --- English.lproj/Info.plist | 4 ++- GLProgram.m | 4 +-- LaunchScreen.storyboard | 31 ++++++++++++++++++++++ Molecules.xcodeproj/project.pbxproj | 31 +++++++++------------- NSData+Gzip.m | 12 ++++----- SLSAtomColorKeyController.m | 2 +- SLSMolecule+SDF.m | 6 ++--- SLSMolecule.m | 32 +++++++++++------------ SLSMoleculeCustomDownloadViewController.m | 2 +- SLSMoleculeDataSourceViewController.m | 2 +- SLSMoleculeDetailViewController.m | 8 +++--- SLSMoleculeGLViewController.m | 10 +++---- SLSMoleculeRootViewController.m | 10 ++++--- SLSMoleculeSearchViewController.m | 16 ++++++------ SLSMoleculeTableViewController.m | 4 +-- SLSMoleculeiPadRootViewController.m | 4 +-- SLSOpenGLES20Renderer.m | 2 +- SLSOpenGLESRenderer.h | 2 +- SLSOpenGLESRenderer.m | 10 +++---- 19 files changed, 109 insertions(+), 83 deletions(-) create mode 100644 LaunchScreen.storyboard diff --git a/English.lproj/Info.plist b/English.lproj/Info.plist index 4f04f0b..6e568f6 100644 --- a/English.lproj/Info.plist +++ b/English.lproj/Info.plist @@ -75,11 +75,13 @@ CFBundleVersion - 2.10 + 2.20 LSRequiresIPhoneOS UIFileSharingEnabled + UILaunchStoryboardName + LaunchScreen UIPrerenderedIcon UIStatusBarStyle diff --git a/GLProgram.m b/GLProgram.m index 65150a5..8b95364 100644 --- a/GLProgram.m +++ b/GLProgram.m @@ -114,7 +114,7 @@ - (void)addAttribute:(NSString *)attributeName { [attributes addObject:attributeName]; glBindAttribLocation(program, - [attributes indexOfObject:attributeName], + (GLuint)[attributes indexOfObject:attributeName], [attributeName UTF8String]); } } @@ -122,7 +122,7 @@ - (void)addAttribute:(NSString *)attributeName // START:indexmethods - (GLuint)attributeIndex:(NSString *)attributeName { - return [attributes indexOfObject:attributeName]; + return (GLuint)[attributes indexOfObject:attributeName]; } - (GLuint)uniformIndex:(NSString *)uniformName { diff --git a/LaunchScreen.storyboard b/LaunchScreen.storyboard new file mode 100644 index 0000000..5afec28 --- /dev/null +++ b/LaunchScreen.storyboard @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Molecules.xcodeproj/project.pbxproj b/Molecules.xcodeproj/project.pbxproj index 13f031d..eae166c 100755 --- a/Molecules.xcodeproj/project.pbxproj +++ b/Molecules.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; }; 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; }; + BC1175B220F1514C00CCEAC9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BC1175B120F1514C00CCEAC9 /* LaunchScreen.storyboard */; }; BC146A9B0EC9173000CE5E72 /* SLSMoleculeCustomDownloadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC146A9A0EC9173000CE5E72 /* SLSMoleculeCustomDownloadViewController.m */; }; BC157287136CBE9200EEFBEC /* 3QE5.pdb.gz in Resources */ = {isa = PBXBuildFile; fileRef = BC157286136CBE9200EEFBEC /* 3QE5.pdb.gz */; }; BC15728A136CC58A00EEFBEC /* SLSMoleculeLibraryTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC157289136CC58A00EEFBEC /* SLSMoleculeLibraryTableCell.m */; }; @@ -104,6 +105,7 @@ 28FD15070DC6FC5B0079059D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/Info.plist; sourceTree = ""; }; + BC1175B120F1514C00CCEAC9 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; BC146A990EC9173000CE5E72 /* SLSMoleculeCustomDownloadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SLSMoleculeCustomDownloadViewController.h; sourceTree = ""; }; BC146A9A0EC9173000CE5E72 /* SLSMoleculeCustomDownloadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SLSMoleculeCustomDownloadViewController.m; sourceTree = ""; }; BC157286136CBE9200EEFBEC /* 3QE5.pdb.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = 3QE5.pdb.gz; sourceTree = ""; }; @@ -308,6 +310,7 @@ BCDFF57211546FB2005C984C /* RotationIconiPadCancel.png */, BCDFF57F115473AD005C984C /* VisualizationIcon.png */, BC54D56D151A3951003F4A41 /* VisualizationIcon@2x.png */, + BC1175B120F1514C00CCEAC9 /* LaunchScreen.storyboard */, ); name = Resources; sourceTree = ""; @@ -556,6 +559,7 @@ BC54D577151A4C91003F4A41 /* Default-Landscape@2x.png in Resources */, BC54D578151A4C91003F4A41 /* Default-Portrait@2x.png in Resources */, BCD4072F151D702600E622EA /* 98-palette.png in Resources */, + BC1175B220F1514C00CCEAC9 /* LaunchScreen.storyboard in Resources */, BCD40730151D702600E622EA /* 98-palette@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -633,14 +637,14 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Molecules_Prefix.pch; INFOPLIST_FILE = English.lproj/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 4.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = Molecules; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -648,6 +652,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -655,21 +660,16 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Molecules_Prefix.pch; INFOPLIST_FILE = English.lproj/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 4.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = Molecules; PROVISIONING_PROFILE = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; BC78D1AC0E1FDC0600BD9B0B /* Distribution */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - armv7, - armv6, - ); CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; GCC_C_LANGUAGE_STANDARD = c99; @@ -692,6 +692,7 @@ "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ""; }; name = Distribution; @@ -700,6 +701,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; @@ -707,21 +709,16 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Molecules_Prefix.pch; INFOPLIST_FILE = English.lproj/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 4.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = Molecules; PROVISIONING_PROFILE = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Distribution; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - armv7, - armv6, - ); CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; @@ -745,6 +742,7 @@ "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ""; }; name = Debug; @@ -752,10 +750,6 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - armv7, - armv6, - ); CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; @@ -778,6 +772,7 @@ "PROVISIONING_PROFILE[sdk=*]" = ""; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ""; }; name = Release; diff --git a/NSData+Gzip.m b/NSData+Gzip.m index 5c50182..2598353 100644 --- a/NSData+Gzip.m +++ b/NSData+Gzip.m @@ -17,8 +17,8 @@ - (id)initWithGzippedData: (NSData *)gzippedData; { if ([gzippedData length] == 0) return nil; - unsigned full_length = [gzippedData length]; - unsigned half_length = [gzippedData length] / 2; + unsigned long full_length = [gzippedData length]; + unsigned long half_length = [gzippedData length] / 2; NSMutableData *decompressed = [[NSMutableData alloc] initWithLength:(full_length + half_length)]; BOOL done = NO; @@ -26,7 +26,7 @@ - (id)initWithGzippedData: (NSData *)gzippedData; z_stream strm; strm.next_in = (Bytef *)[gzippedData bytes]; - strm.avail_in = [gzippedData length]; + strm.avail_in = (unsigned int)[gzippedData length]; strm.total_out = 0; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; @@ -41,7 +41,7 @@ - (id)initWithGzippedData: (NSData *)gzippedData; if (strm.total_out >= [decompressed length]) [decompressed increaseLengthBy: half_length]; strm.next_out = [decompressed mutableBytes] + strm.total_out; - strm.avail_out = [decompressed length] - strm.total_out; + strm.avail_out = (unsigned int)[decompressed length] - (unsigned int)strm.total_out; // Inflate another chunk. status = inflate (&strm, Z_SYNC_FLUSH); @@ -70,7 +70,7 @@ - (NSData *)gzipDeflate strm.opaque = Z_NULL; strm.total_out = 0; strm.next_in=(Bytef *)[self bytes]; - strm.avail_in = [self length]; + strm.avail_in = (unsigned int)[self length]; // Compresssion Levels: // Z_NO_COMPRESSION @@ -88,7 +88,7 @@ - (NSData *)gzipDeflate [compressed increaseLengthBy: 16384]; strm.next_out = [compressed mutableBytes] + strm.total_out; - strm.avail_out = [compressed length] - strm.total_out; + strm.avail_out = (unsigned int)[compressed length] - (unsigned int)strm.total_out; deflate(&strm, Z_FINISH); diff --git a/SLSAtomColorKeyController.m b/SLSAtomColorKeyController.m index 0a23b7b..570a1e3 100644 --- a/SLSAtomColorKeyController.m +++ b/SLSAtomColorKeyController.m @@ -35,7 +35,7 @@ - (void)viewDidLoad if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - self.contentSizeForViewInPopover = CGSizeMake(250.0f, 864.0f); + self.preferredContentSize = CGSizeMake(250.0f, 864.0f); // self.contentSizeForViewInPopover = CGSizeMake(200.0f, 864.0f); } diff --git a/SLSMolecule+SDF.m b/SLSMolecule+SDF.m index 307f00e..fc70dff 100644 --- a/SLSMolecule+SDF.m +++ b/SLSMolecule+SDF.m @@ -114,7 +114,7 @@ - (BOOL)readFromSDFFileToDatabase:(NSError **)error; NSString *atomElement = [[currentLine substringWithRange:NSMakeRange(31, 3)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - [atomCoordinates setObject:[NSValue valueWithBytes:&atomCoordinate objCType:@encode(SLS3DPoint)] forKey:[NSNumber numberWithInt:atomSerialNumber]]; + [atomCoordinates setObject:[NSValue valueWithBytes:&atomCoordinate objCType:@encode(SLS3DPoint)] forKey:[NSNumber numberWithInteger:atomSerialNumber]]; atomSerialNumber++; SLSAtomType processedAtomType; @@ -202,8 +202,8 @@ - (BOOL)readFromSDFFileToDatabase:(NSError **)error; NSUInteger indexForFirstAtom = [[currentLine substringWithRange:NSMakeRange(0, 3)] intValue]; NSUInteger indexForSecondAtom = [[currentLine substringWithRange:NSMakeRange(3, 3)] intValue]; - NSValue *startValue = [atomCoordinates objectForKey:[NSNumber numberWithInt:indexForFirstAtom]]; - NSValue *endValue = [atomCoordinates objectForKey:[NSNumber numberWithInt:indexForSecondAtom]]; + NSValue *startValue = [atomCoordinates objectForKey:[NSNumber numberWithInteger:indexForFirstAtom]]; + NSValue *endValue = [atomCoordinates objectForKey:[NSNumber numberWithInteger:indexForSecondAtom]]; [self addBondToDatabaseWithStartPoint:startValue endPoint:endValue bondType:SINGLEBOND structureNumber:1 residueKey:UNKNOWNRESIDUE]; } diff --git a/SLSMolecule.m b/SLSMolecule.m index c57c65c..030c512 100644 --- a/SLSMolecule.m +++ b/SLSMolecule.m @@ -508,7 +508,7 @@ - (void)writeMoleculeDataToDatabase; sqlite3_bind_double(updateMoleculeSQLStatement, 13, maximumXPosition); sqlite3_bind_double(updateMoleculeSQLStatement, 14, maximumYPosition); sqlite3_bind_double(updateMoleculeSQLStatement, 15, maximumZPosition); - sqlite3_bind_int(updateMoleculeSQLStatement, 16, databaseKey); + sqlite3_bind_int64(updateMoleculeSQLStatement, 16, databaseKey); // Execute the query. int success = sqlite3_step(updateMoleculeSQLStatement); @@ -530,7 +530,7 @@ - (void)addMetadataToDatabase:(NSString *)metadata type:(SLSMetadataType)metadat } } // Bind the query variables. - sqlite3_bind_int(insertMetadataSQLStatement, 1, databaseKey); + sqlite3_bind_int64(insertMetadataSQLStatement, 1, databaseKey); sqlite3_bind_int(insertMetadataSQLStatement, 2, metadataType); sqlite3_bind_text(insertMetadataSQLStatement, 3, [[metadata stringByReplacingOccurrencesOfString:@"'" withString:@"''"] UTF8String], -1, SQLITE_TRANSIENT); int success = sqlite3_step(insertMetadataSQLStatement); @@ -552,9 +552,9 @@ - (NSInteger)addAtomToDatabase:(SLSAtomType)atomType atPoint:(SLS3DPoint)newPoin } // Bind the query variables. sqlite3_clear_bindings(insertAtomSQLStatement); - sqlite3_bind_int(insertAtomSQLStatement, 1, databaseKey); + sqlite3_bind_int64(insertAtomSQLStatement, 1, databaseKey); sqlite3_bind_int(insertAtomSQLStatement, 2, residueKey); - sqlite3_bind_int(insertAtomSQLStatement, 3, structureNumber); + sqlite3_bind_int64(insertAtomSQLStatement, 3, structureNumber); sqlite3_bind_int(insertAtomSQLStatement, 4, atomType); sqlite3_bind_double(insertAtomSQLStatement, 5, (double)newPoint.x); sqlite3_bind_double(insertAtomSQLStatement, 6, (double)newPoint.y); @@ -602,9 +602,9 @@ - (void)addBondToDatabaseWithStartPoint:(NSValue *)startValue endPoint:(NSValue } // Bind the query variables. sqlite3_clear_bindings(insertBondSQLStatement); - sqlite3_bind_int(insertBondSQLStatement, 1, databaseKey); - sqlite3_bind_int(insertBondSQLStatement, 2, residueKey); - sqlite3_bind_int(insertBondSQLStatement, 3, structureNumber); + sqlite3_bind_int64(insertBondSQLStatement, 1, databaseKey); + sqlite3_bind_int64(insertBondSQLStatement, 2, residueKey); + sqlite3_bind_int64(insertBondSQLStatement, 3, structureNumber); sqlite3_bind_int(insertBondSQLStatement, 4, bondType); sqlite3_bind_double(insertBondSQLStatement, 5, (double)startPoint.x); sqlite3_bind_double(insertBondSQLStatement, 6, (double)startPoint.y); @@ -638,7 +638,7 @@ - (void)readMetadataFromDatabaseIfNecessary; } // Bind the query variables. - sqlite3_bind_int(retrieveMetadataSQLStatement, 1, databaseKey); + sqlite3_bind_int64(retrieveMetadataSQLStatement, 1, databaseKey); while (sqlite3_step(retrieveMetadataSQLStatement) == SQLITE_ROW) { @@ -690,7 +690,7 @@ - (void)deleteMoleculeDataFromDatabase; if (sqlite3_prepare_v2(database, sql, -1, &deleteMoleculeSQLStatement, NULL) != SQLITE_OK) NSAssert1(0, NSLocalizedStringFromTable(@"Error: failed to prepare statement with message '%s'.", @"Localized", nil), sqlite3_errmsg(database)); } - sqlite3_bind_int(deleteMoleculeSQLStatement, 1, databaseKey); + sqlite3_bind_int64(deleteMoleculeSQLStatement, 1, databaseKey); int success = sqlite3_step(deleteMoleculeSQLStatement); sqlite3_reset(deleteMoleculeSQLStatement); if (success != SQLITE_DONE) @@ -703,7 +703,7 @@ - (void)deleteMoleculeDataFromDatabase; if (sqlite3_prepare_v2(database, sql, -1, &deleteMetadataSQLStatement, NULL) != SQLITE_OK) NSAssert1(0, NSLocalizedStringFromTable(@"Error: failed to prepare statement with message '%s'.", @"Localized", nil), sqlite3_errmsg(database)); } - sqlite3_bind_int(deleteMetadataSQLStatement, 1, databaseKey); + sqlite3_bind_int64(deleteMetadataSQLStatement, 1, databaseKey); success = sqlite3_step(deleteMetadataSQLStatement); sqlite3_reset(deleteMetadataSQLStatement); if (success != SQLITE_DONE) @@ -716,7 +716,7 @@ - (void)deleteMoleculeDataFromDatabase; if (sqlite3_prepare_v2(database, sql, -1, &deleteAtomSQLStatement, NULL) != SQLITE_OK) NSAssert1(0, NSLocalizedStringFromTable(@"Error: failed to prepare statement with message '%s'.", @"Localized", nil), sqlite3_errmsg(database)); } - sqlite3_bind_int(deleteAtomSQLStatement, 1, databaseKey); + sqlite3_bind_int64(deleteAtomSQLStatement, 1, databaseKey); success = sqlite3_step(deleteAtomSQLStatement); sqlite3_reset(deleteAtomSQLStatement); if (success != SQLITE_DONE) @@ -729,7 +729,7 @@ - (void)deleteMoleculeDataFromDatabase; if (sqlite3_prepare_v2(database, sql, -1, &deleteBondSQLStatement, NULL) != SQLITE_OK) NSAssert1(0, NSLocalizedStringFromTable(@"Error: failed to prepare statement with message '%s'.", @"Localized", nil), sqlite3_errmsg(database)); } - sqlite3_bind_int(deleteBondSQLStatement, 1, databaseKey); + sqlite3_bind_int64(deleteBondSQLStatement, 1, databaseKey); success = sqlite3_step(deleteBondSQLStatement); sqlite3_reset(deleteBondSQLStatement); if (success != SQLITE_DONE) @@ -746,7 +746,7 @@ - (NSInteger)countAtomsForFirstStructure; if (sqlite3_prepare_v2(database, sql, -1, &atomCountingStatement, NULL) == SQLITE_OK) { - sqlite3_bind_int(atomCountingStatement, 1, databaseKey); + sqlite3_bind_int64(atomCountingStatement, 1, databaseKey); sqlite3_bind_int(atomCountingStatement, 2, numberOfStructureBeingDisplayed); if (sqlite3_step(atomCountingStatement) == SQLITE_ROW) @@ -771,7 +771,7 @@ - (NSInteger)countBondsForFirstStructure; if (sqlite3_prepare_v2(database, sql, -1, &bondCountingStatement, NULL) == SQLITE_OK) { - sqlite3_bind_int(bondCountingStatement, 1, databaseKey); + sqlite3_bind_int64(bondCountingStatement, 1, databaseKey); sqlite3_bind_int(bondCountingStatement, 2, numberOfStructureBeingDisplayed); if (sqlite3_step(bondCountingStatement) == SQLITE_ROW) @@ -915,7 +915,7 @@ - (void)readAndRenderAtoms:(SLSOpenGLESRenderer *)openGLESRenderer; } // Bind the query variables. - sqlite3_bind_int(retrieveAtomSQLStatement, 1, databaseKey); + sqlite3_bind_int64(retrieveAtomSQLStatement, 1, databaseKey); sqlite3_bind_int(retrieveAtomSQLStatement, 2, numberOfStructureBeingDisplayed); while ((sqlite3_step(retrieveAtomSQLStatement) == SQLITE_ROW) && !isRenderingCancelled) @@ -969,7 +969,7 @@ - (void)readAndRenderBonds:(SLSOpenGLESRenderer *)openGLESRenderer; } // Bind the query variables. - sqlite3_bind_int(retrieveBondSQLStatement, 1, databaseKey); + sqlite3_bind_int64(retrieveBondSQLStatement, 1, databaseKey); sqlite3_bind_int(retrieveBondSQLStatement, 2, numberOfStructureBeingDisplayed); while ((sqlite3_step(retrieveBondSQLStatement) == SQLITE_ROW) && !isRenderingCancelled) diff --git a/SLSMoleculeCustomDownloadViewController.m b/SLSMoleculeCustomDownloadViewController.m index bb9fa8b..14e82c2 100644 --- a/SLSMoleculeCustomDownloadViewController.m +++ b/SLSMoleculeCustomDownloadViewController.m @@ -39,7 +39,7 @@ - (void)loadView if ([SLSMoleculeAppDelegate isRunningOniPad]) { mainView.backgroundColor = [UIColor whiteColor]; - self.contentSizeForViewInPopover = CGSizeMake(320.0f, 100.0f); + self.preferredContentSize = CGSizeMake(320.0f, 100.0f); } else { diff --git a/SLSMoleculeDataSourceViewController.m b/SLSMoleculeDataSourceViewController.m index 3c68a8f..45c1822 100644 --- a/SLSMoleculeDataSourceViewController.m +++ b/SLSMoleculeDataSourceViewController.m @@ -23,7 +23,7 @@ - (id)initWithStyle:(UITableViewStyle)style { if ([SLSMoleculeAppDelegate isRunningOniPad]) { - self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); + self.preferredContentSize = CGSizeMake(320.0, 600.0); } self.navigationItem.title = NSLocalizedStringFromTable(@"Online Data Source", @"Localized", nil); diff --git a/SLSMoleculeDetailViewController.m b/SLSMoleculeDetailViewController.m index 54efa52..112a5b0 100644 --- a/SLSMoleculeDetailViewController.m +++ b/SLSMoleculeDetailViewController.m @@ -27,7 +27,7 @@ - (id)initWithStyle:(UITableViewStyle)style andMolecule:(SLSMolecule *)newMolecu { if ((self = [super initWithStyle:style])) { - self.view.frame = [[UIScreen mainScreen] applicationFrame]; + self.view.frame = [[UIScreen mainScreen] bounds]; self.view.autoresizesSubviews = YES; self.molecule = newMolecule; [newMolecule readMetadataFromDatabaseIfNecessary]; @@ -40,15 +40,15 @@ - (id)initWithStyle:(UITableViewStyle)style andMolecule:(SLSMolecule *)newMolecu label.backgroundColor = [UIColor groupTableViewBackgroundColor]; label.text = molecule.compound; label.numberOfLines = 3; - label.lineBreakMode = UILineBreakModeWordWrap; - label.textAlignment = UITextAlignmentCenter; + label.lineBreakMode = NSLineBreakByWordWrapping; + label.textAlignment = NSTextAlignmentCenter; // label.text = @"Text"; self.tableView.tableHeaderView = label; if ([SLSMoleculeAppDelegate isRunningOniPad]) { - self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); + self.preferredContentSize = CGSizeMake(320.0, 600.0); } } return self; diff --git a/SLSMoleculeGLViewController.m b/SLSMoleculeGLViewController.m index 11f671e..dfe483a 100644 --- a/SLSMoleculeGLViewController.m +++ b/SLSMoleculeGLViewController.m @@ -67,7 +67,7 @@ - (void)dealloc - (void)loadView { - CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame]; + CGRect applicationFrame = [[UIScreen mainScreen] bounds]; SLSMoleculeGLView *glView = [[SLSMoleculeGLView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, applicationFrame.size.width, applicationFrame.size.height)]; @@ -101,7 +101,7 @@ - (void)showScanningIndicator:(NSNotification *)note; renderingActivityLabel = [[UILabel alloc] initWithFrame:CGRectMake(round(self.view.frame.size.width / 2.0f - 219.0f / 2.0f), round(self.view.frame.size.height / 2.0f - 15.0f - 21.0f), 219.0f, 21.0f)]; renderingActivityLabel.font = [UIFont systemFontOfSize:17.0f]; renderingActivityLabel.text = [note object]; - renderingActivityLabel.textAlignment = UITextAlignmentCenter; + renderingActivityLabel.textAlignment = NSTextAlignmentCenter; renderingActivityLabel.backgroundColor = [UIColor clearColor]; renderingActivityLabel.textColor = [UIColor whiteColor]; @@ -145,7 +145,7 @@ - (void)showRenderingIndicator:(NSNotification *)note; renderingActivityLabel = [[UILabel alloc] initWithFrame:CGRectMake(round(self.view.frame.size.width / 2.0f - 219.0f / 2.0f), round(self.view.frame.size.height / 2.0f - 15.0f - 21.0f), 219.0f, 21.0f)]; renderingActivityLabel.font = [UIFont systemFontOfSize:17.0f]; renderingActivityLabel.text = NSLocalizedStringFromTable(@"Rendering...", @"Localized", nil); - renderingActivityLabel.textAlignment = UITextAlignmentCenter; + renderingActivityLabel.textAlignment = NSTextAlignmentCenter; renderingActivityLabel.backgroundColor = [UIColor clearColor]; renderingActivityLabel.textColor = [UIColor whiteColor]; @@ -604,7 +604,7 @@ - (IBAction)switchToTableView; - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { - SLSVisualizationType newVisualizationType = [[NSUserDefaults standardUserDefaults] integerForKey:@"currentVisualizationMode"]; + SLSVisualizationType newVisualizationType = (SLSVisualizationType)[[NSUserDefaults standardUserDefaults] integerForKey:@"currentVisualizationMode"]; switch (newVisualizationType) { @@ -710,7 +710,7 @@ - (void)setMoleculeToDisplay:(SLSMolecule *)newMolecule; } else { - moleculeToDisplay.currentVisualizationType = [[NSUserDefaults standardUserDefaults] integerForKey:@"currentVisualizationMode"]; + moleculeToDisplay.currentVisualizationType = (SLSVisualizationType)[[NSUserDefaults standardUserDefaults] integerForKey:@"currentVisualizationMode"]; } moleculeToDisplay.isBeingDisplayed = YES; diff --git a/SLSMoleculeRootViewController.m b/SLSMoleculeRootViewController.m index 84112ea..731ccb8 100644 --- a/SLSMoleculeRootViewController.m +++ b/SLSMoleculeRootViewController.m @@ -35,8 +35,10 @@ - (id)init; - (void)loadView { - CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame]; + CGRect mainScreenFrame = [[UIScreen mainScreen] bounds]; + NSLog(@"Application frame: %f, %f", mainScreenFrame.size.width, mainScreenFrame.size.height); + UIView *backgroundView = [[UIView alloc] initWithFrame:mainScreenFrame]; backgroundView.backgroundColor = [UIColor blackColor]; @@ -49,7 +51,7 @@ - (void)loadView [self.view addSubview:glViewController.view]; UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; - infoButton.frame = CGRectMake(320.0f - 70.0f, 460.0f - 70.0f, 70.0f, 70.0f); + infoButton.frame = CGRectMake(glViewController.view.bounds.size.width - 70.0f, glViewController.view.bounds.size.height - 70.0f, 70.0f, 70.0f); [infoButton addTarget:glViewController action:@selector(switchToTableView) forControlEvents:(UIControlEventTouchUpInside | UIControlEventTouchUpOutside)]; [glViewController.view addSubview:infoButton]; @@ -71,7 +73,7 @@ - (void)loadView rotationButton.showsTouchWhenHighlighted = YES; [rotationButton addTarget:glViewController action:@selector(startOrStopAutorotation:) forControlEvents:UIControlEventTouchUpInside]; - rotationButton.frame = CGRectMake(0.0f, 460.0f - 70.0f, 70.0f, 70.0f); + rotationButton.frame = CGRectMake(0.0f, glViewController.view.bounds.size.height - 70.0f, 70.0f, 70.0f); rotationButton.clipsToBounds = NO; [glViewController.view addSubview:rotationButton]; } @@ -115,7 +117,7 @@ - (void)toggleView:(NSNotification *)note; } else previousMolecule.isBeingDisplayed = YES; - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque]; + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; } [UIView commitAnimations]; } diff --git a/SLSMoleculeSearchViewController.m b/SLSMoleculeSearchViewController.m index 19888bc..b686f3f 100644 --- a/SLSMoleculeSearchViewController.m +++ b/SLSMoleculeSearchViewController.m @@ -28,7 +28,7 @@ - (id)initWithStyle:(UITableViewStyle)style { // Initialize the search bar and title - self.view.frame = [[UIScreen mainScreen] applicationFrame]; + self.view.frame = [[UIScreen mainScreen] bounds]; self.view.autoresizesSubviews = YES; keywordSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)]; @@ -62,7 +62,7 @@ - (id)initWithStyle:(UITableViewStyle)style if ([SLSMoleculeAppDelegate isRunningOniPad]) { - self.contentSizeForViewInPopover = CGSizeMake(320.0, 700.0); + self.preferredContentSize = CGSizeMake(320.0, 700.0); } } @@ -329,7 +329,7 @@ - (void)processPubChemCompoundTitles; - (BOOL)grabNextSetOfSearchResults; { currentPageOfResults++; - NSString *nextResultsURL = [[NSString alloc] initWithFormat:@"http://www.rcsb.org/pdb/results/results.do?outformat=text&gotopage=%d", currentPageOfResults]; + NSString *nextResultsURL = [[NSString alloc] initWithFormat:@"http://www.rcsb.org/pdb/results/results.do?outformat=text&gotopage=%ld", currentPageOfResults]; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; @@ -421,7 +421,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell.contentView addSubview:spinningIndicator]; cell.accessoryType = UITableViewCellAccessoryNone; cell.textLabel.font = [UIFont systemFontOfSize:16.0]; - cell.textLabel.textAlignment = UITextAlignmentCenter; + cell.textLabel.textAlignment = NSTextAlignmentCenter; } cell.textLabel.text = NSLocalizedStringFromTable(@"Searching...", @"Localized", nil); } @@ -450,7 +450,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.textLabel.font = [UIFont systemFontOfSize:16.0]; cell.textLabel.text = NSLocalizedStringFromTable(@"No results", @"Localized", nil); - cell.textLabel.textAlignment = UITextAlignmentCenter; + cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.accessoryType = UITableViewCellAccessoryNone; } } @@ -484,7 +484,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell.contentView addSubview:spinningIndicator]; cell.accessoryType = UITableViewCellAccessoryNone; cell.textLabel.font = [UIFont systemFontOfSize:16.0]; - cell.textLabel.textAlignment = UITextAlignmentCenter; + cell.textLabel.textAlignment = NSTextAlignmentCenter; } cell.textLabel.text = NSLocalizedStringFromTable(@"Downloading...", @"Localized", nil); } @@ -509,7 +509,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // } cell.textLabel.font = [UIFont systemFontOfSize:16.0]; - cell.textLabel.textAlignment = UITextAlignmentCenter; + cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.textLabel.text = NSLocalizedStringFromTable(@"Load next 10 results", @"Localized", nil); cell.accessoryType = UITableViewCellAccessoryNone; cell.detailTextLabel.text = @""; @@ -697,7 +697,7 @@ - (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NS }; break; } - currentSearchType = selectedScope; + currentSearchType = (SLSSearchType)selectedScope; [self.tableView reloadData]; } diff --git a/SLSMoleculeTableViewController.m b/SLSMoleculeTableViewController.m index f8e4278..06097c2 100644 --- a/SLSMoleculeTableViewController.m +++ b/SLSMoleculeTableViewController.m @@ -35,14 +35,14 @@ - (id)initWithStyle:(UITableViewStyle)style initialSelectedMoleculeIndex:(NSInte if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); + self.preferredContentSize = CGSizeMake(320.0, 600.0); } if ([SLSMoleculeAppDelegate isRunningOniPad]) { // self.tableView.backgroundColor = [UIColor blackColor]; // tableTextColor = [[UIColor whiteColor] retain]; - self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); + self.preferredContentSize = CGSizeMake(320.0, 600.0); UIBarButtonItem *downloadButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(displayMoleculeDownloadView)]; self.navigationItem.leftBarButtonItem = downloadButtonItem; diff --git a/SLSMoleculeiPadRootViewController.m b/SLSMoleculeiPadRootViewController.m index 1d7de2d..08dd087 100644 --- a/SLSMoleculeiPadRootViewController.m +++ b/SLSMoleculeiPadRootViewController.m @@ -21,7 +21,7 @@ @implementation SLSMoleculeiPadRootViewController // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { - CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame]; + CGRect mainScreenFrame = [[UIScreen mainScreen] bounds]; UIView *backgroundView = [[UIView alloc] initWithFrame:mainScreenFrame]; backgroundView.opaque = YES; @@ -236,7 +236,7 @@ - (void)displayOnExternalOrLocalScreen:(id)sender; { // External window exists, need to move back locally [self.view addSubview:glViewController.view]; - CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame]; + CGRect mainScreenFrame = [[UIScreen mainScreen] bounds]; glViewController.view.frame = CGRectMake(mainScreenFrame.origin.x, mainToolbar.bounds.size.height, mainScreenFrame.size.width, mainScreenFrame.size.height - mainToolbar.bounds.size.height); // Move view back to local window diff --git a/SLSOpenGLES20Renderer.m b/SLSOpenGLES20Renderer.m index 5b4095e..bee4b43 100644 --- a/SLSOpenGLES20Renderer.m +++ b/SLSOpenGLES20Renderer.m @@ -971,7 +971,7 @@ - (void)renderFrameForMolecule:(SLSMolecule *)molecule; #pragma mark - #pragma mark Molecule 3-D geometry generation -- (void)configureBasedOnNumberOfAtoms:(unsigned int)numberOfAtoms numberOfBonds:(unsigned int)numberOfBonds; +- (void)configureBasedOnNumberOfAtoms:(NSUInteger)numberOfAtoms numberOfBonds:(NSUInteger)numberOfBonds; { widthOfAtomAOTexturePatch = (GLfloat)ambientOcclusionTextureWidth / (ceil(sqrt((GLfloat)numberOfAtoms + (GLfloat)numberOfBonds))); normalizedAOTexturePatchWidth = (GLfloat)widthOfAtomAOTexturePatch / (GLfloat)ambientOcclusionTextureWidth; diff --git a/SLSOpenGLESRenderer.h b/SLSOpenGLESRenderer.h index 0019cad..c0e532f 100644 --- a/SLSOpenGLESRenderer.h +++ b/SLSOpenGLESRenderer.h @@ -129,7 +129,7 @@ static const SLSAtomProperties atomProperties[NUM_ATOMTYPES] = { - (void)renderFrameForMolecule:(SLSMolecule *)molecule; // Molecule 3-D geometry generation -- (void)configureBasedOnNumberOfAtoms:(unsigned int)numberOfAtoms numberOfBonds:(unsigned int)numberOfBonds; +- (void)configureBasedOnNumberOfAtoms:(NSUInteger)numberOfAtoms numberOfBonds:(NSUInteger)numberOfBonds; - (void)addVertex:(GLfloat *)newVertex forAtomType:(SLSAtomType)atomType; - (void)addIndex:(GLushort *)newIndex forAtomType:(SLSAtomType)atomType; - (void)addIndices:(GLushort *)newIndices size:(unsigned int)numIndices forAtomType:(SLSAtomType)atomType; diff --git a/SLSOpenGLESRenderer.m b/SLSOpenGLESRenderer.m index 64c5cb8..36ee917 100644 --- a/SLSOpenGLESRenderer.m +++ b/SLSOpenGLESRenderer.m @@ -63,10 +63,6 @@ - (void)dealloc { [EAGLContext setCurrentContext:nil]; } - - - dispatch_release(openGLESContextQueue); - dispatch_release(frameRenderingSemaphore); } #pragma mark - @@ -298,7 +294,7 @@ - (void)renderFrameForMolecule:(SLSMolecule *)molecule; #pragma mark - #pragma mark Molecule 3-D geometry generation -- (void)configureBasedOnNumberOfAtoms:(unsigned int)numberOfAtoms numberOfBonds:(unsigned int)numberOfBonds; +- (void)configureBasedOnNumberOfAtoms:(NSUInteger)numberOfAtoms numberOfBonds:(NSUInteger)numberOfBonds; { } @@ -390,7 +386,7 @@ - (void)bindVertexBuffersForMolecule; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, atomIndexBufferHandle[currentAtomIndexBufferIndex]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, [atomIndexBuffers[currentAtomIndexBufferIndex] length], (GLushort *)[atomIndexBuffers[currentAtomIndexBufferIndex] bytes], GL_STATIC_DRAW); - numberOfIndicesInBuffer[currentAtomIndexBufferIndex] = ([atomIndexBuffers[currentAtomIndexBufferIndex] length] / sizeof(GLushort)); + numberOfIndicesInBuffer[currentAtomIndexBufferIndex] = ((GLuint)[atomIndexBuffers[currentAtomIndexBufferIndex] length] / (GLuint)sizeof(GLushort)); // Now that the data are in the OpenGL buffer, can release the NSData atomIndexBuffers[currentAtomIndexBufferIndex] = nil; @@ -425,7 +421,7 @@ - (void)bindVertexBuffersForMolecule; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bondIndexBufferHandle[currentBondVBOIndex]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, [bondIndexBuffers[currentBondVBOIndex] length], (GLushort *)[bondIndexBuffers[currentBondVBOIndex] bytes], GL_STATIC_DRAW); - numberOfBondIndicesInBuffer[currentBondVBOIndex] = ([bondIndexBuffers[currentBondVBOIndex] length] / sizeof(GLushort)); + numberOfBondIndicesInBuffer[currentBondVBOIndex] = ((GLuint)[bondIndexBuffers[currentBondVBOIndex] length] / (GLuint)sizeof(GLushort)); bondIndexBuffers[currentBondVBOIndex] = nil;