Commits

p2 committed 1f1c8b2

Can choose between 12 and 24 hour clock

  • Participants
  • Parent commits 3a73531

Comments (0)

Files changed (6)

File Classes/MatrixCodeAppDelegate.m

 		[d setBool:YES forKey:settingKeyGravityRot];
 		[d setBool:DEF_ROTATE forKey:settingKeyAutoRot];
 		[d setBool:DEF_FOG forKey:settingKeyFog];
-		[d setBool:DEF_CLOCK forKey:settingKeyClock];
 	}
 	
 	// load prefs
 		setBoolProperty("do_fog", (int)fog);
 	}
 	
-	BOOL clock = [d boolForKey:settingKeyClock];
-	if (clock != DEF_CLOCK) {
-		setBoolProperty("do_clock", (int)clock);
-	}
+	NSString *clock = [d objectForKey:settingKeyClock];
+	setCharProperty("timeformat", clock ? (char *)[clock UTF8String] : NULL);
 	
 	NSString *mode = [d objectForKey:settingKeyMode];
 	setCharProperty("mode", (char *)[mode UTF8String]);

File Classes/PrefViewController.h

 #define settingKeyAutoRot		@"autorotateSetting"
 #define settingKeyGravityRot	@"gravityRotateSetting"
 #define settingKeyFog			@"fogSetting"
-#define settingKeyClock			@"clockSetting"
+#define settingKeyClock			@"clockModeSetting"
 #define settingKeyMode			@"modeSetting"
 
 
 	
 	IBOutlet MCBoolInputField *rotateSwitch;
 	IBOutlet MCBoolInputField *gravitySwitch;
-	IBOutlet MCBoolInputField *clockSwitch;
 	IBOutlet MCBoolInputField *fogSwitch;
 	//IBOutlet MCBoolInputField *waveSwitch;
 	//IBOutlet MCBoolInputField *textureSwitch;
 	
+	IBOutlet MCSegmentedInputField *clockSelector;
 	IBOutlet MCSegmentedInputField *modeSelector;
 }
 
 
 @property (nonatomic, retain) IBOutlet MCBoolInputField *rotateSwitch;
 @property (nonatomic, retain) IBOutlet MCBoolInputField *gravitySwitch;
-@property (nonatomic, retain) IBOutlet MCBoolInputField *clockSwitch;
 @property (nonatomic, retain) IBOutlet MCBoolInputField *fogSwitch;
 //@property (nonatomic, retain) IBOutlet MCBoolInputField *waveSwitch;
 //@property (nonatomic, retain) IBOutlet MCBoolInputField *textureSwitch;
 
+@property (nonatomic, retain) IBOutlet MCSegmentedInputField *clockSelector;
 @property (nonatomic, retain) IBOutlet MCSegmentedInputField *modeSelector;
 
 - (void) showPrefsIn:(UIView *)superView animated:(BOOL)animated;

File Classes/PrefViewController.m

 @implementation PrefViewController
 
 @synthesize container;
-@synthesize fpsLabel;
-@synthesize fpsTimer;
-@synthesize speedSlider;
-@synthesize speedIndicator;
-@synthesize densitySlider;
-@synthesize densityIndicator;
-@synthesize rotateSwitch;
-@synthesize gravitySwitch;
-@synthesize clockSwitch;
-@synthesize fogSwitch;
+@synthesize fpsLabel, fpsTimer;
+@synthesize speedSlider, speedIndicator;
+@synthesize densitySlider, densityIndicator;
+@synthesize rotateSwitch, gravitySwitch, fogSwitch;
 //@synthesize waveSwitch;
 //@synthesize textureSwitch;
-@synthesize modeSelector;
+@synthesize clockSelector, modeSelector;
 
 - (void) dealloc
 {
 	self.densityIndicator = nil;
 	self.rotateSwitch = nil;
 	self.gravitySwitch = nil;
-	self.clockSwitch = nil;
 	self.fogSwitch = nil;
 	//self.waveSwitch = nil;
 	//self.textureSwitch = nil;
+	self.clockSelector = nil;
 	self.modeSelector = nil;
 	
     [super dealloc];
 	self.densityIndicator = nil;
 	self.rotateSwitch = nil;
 	self.gravitySwitch = nil;
-	self.clockSwitch = nil;
 	self.fogSwitch = nil;
 	//self.waveSwitch = nil;
 	//self.textureSwitch = nil;
+	self.clockSelector = nil;
 	self.modeSelector = nil;
 	
     [super viewDidUnload];
 	
 	// get property values
 	float sp, dens;
-	int rot, autorot, fg, wave, tex, clock;
-	char *md;
-	getProperties(&sp, &dens, &rot, &autorot, &fg, &wave, &tex, &clock, &md);
-	//NSLog(@"Speed %f, density %f, rot %i, fg %i, wave %i, tex %i, clock %i, mode %s", sp, dens, rot, fg, wave, tex, clock, md);
+	int rot, autorot, fg, wave, tex;
+	char *timefmt, *md;
+	getProperties(&sp, &dens, &rot, &autorot, &fg, &wave, &tex, &timefmt, &md);
+	//NSLog(@"Speed %f, density %f, rot %i, fg %i, wave %i, tex %i, clock %s, mode %s", sp, dens, rot, fg, wave, tex, timefmt, md);
 	
 	// set values
 	[speedSlider setValue:sqrtf(sp) animated:NO];
 	fogSwitch.on = fg;
 	//waveSwitch.on = wave;
 	//textureSwitch.on = tex;
-	clockSwitch.on = clock;
 	
 	gravitySwitch.on = ((MatrixCodeAppDelegate *)[[UIApplication sharedApplication] delegate]).glView.useGravity;
 	
+	// setup clock segments
+	[clockSelector insertSegmentWithTitle:@"None" atIndex:0 animated:NO];
+	[clockSelector insertSegmentWithTitle:@"12h" atIndex:1 animated:NO];
+	[clockSelector insertSegmentWithTitle:@"24h" atIndex:2 animated:NO];
+	NSUInteger selectedIdx = 0;
+	if (timefmt) {
+		if (!strcasecmp(timefmt, "%l:%M %p")) {
+			selectedIdx = 1;
+		}
+		else if (!strcasecmp(timefmt, "%H:%M")) {
+			selectedIdx = 2;
+		}
+	}
+	clockSelector.selectedSegmentIndex = selectedIdx;
+	
 	// setup mode segments
 	[modeSelector insertSegmentWithTitle:@"Matrix" atIndex:0 animated:NO];
 	[modeSelector insertSegmentWithTitle:@"DNA" atIndex:1 animated:NO];
 	[modeSelector insertSegmentWithTitle:@"Bin" atIndex:2 animated:NO];
 	[modeSelector insertSegmentWithTitle:@"Dec" atIndex:3 animated:NO];
 	[modeSelector insertSegmentWithTitle:@"Hex" atIndex:4 animated:NO];
-	NSUInteger selectedIdx = 0;
+	selectedIdx = 0;
 	if (!strcasecmp(md, "dna")) {
 		selectedIdx = 1;
 	}
 	fogSwitch.delegate = self;
 	//waveSwitch.delegate = self;
 	//textureSwitch.delegate = self;
-	clockSwitch.delegate = self;
 	gravitySwitch.delegate = self;
+	clockSelector.delegate = self;
 	modeSelector.delegate = self;
 }
 
 	//else if (textureSwitch == inputField) {
 	//	setBoolProperty("do_texture", textureSwitch.on);
 	//}
-	
-	// clock
-	else if (clockSwitch == inputField) {
-		setBoolProperty("do_clock", clockSwitch.on);
-		[d setObject:[NSNumber numberWithBool:clockSwitch.on] forKey:settingKeyClock];
-	}
 }
 
 - (void) segmentedFieldDidChangeSelection:(MCSegmentedInputField *)inputField;
 {
+	// select clock mode
+	if (clockSelector == inputField) {
+		char *newmode;
+		switch (clockSelector.selectedSegmentIndex) {
+			case 1:
+				newmode = "%l:%M %p";		break;
+			case 2:
+				newmode = "%H:%M";			break;
+			case 0:
+			default:
+				newmode = NULL;				break;
+		}
+		
+		setCharProperty("timeformat", newmode);
+		if (newmode) {
+			[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:newmode encoding:NSUTF8StringEncoding]
+													  forKey:settingKeyClock];
+		}
+		else {
+			[[NSUserDefaults standardUserDefaults] removeObjectForKey:settingKeyClock];
+		}
+	}
+	
+	// select char mode
 	if (modeSelector == inputField) {
 		char *newmode;
 		switch (modeSelector.selectedSegmentIndex) {

File Classes/PrefViewController.xib

 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
 	<data>
 		<int key="IBDocument.SystemTarget">1024</int>
-		<string key="IBDocument.SystemVersion">10F569</string>
-		<string key="IBDocument.InterfaceBuilderVersion">788</string>
-		<string key="IBDocument.AppKitVersion">1038.29</string>
+		<string key="IBDocument.SystemVersion">10J869</string>
+		<string key="IBDocument.InterfaceBuilderVersion">1306</string>
+		<string key="IBDocument.AppKitVersion">1038.35</string>
 		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-			<string key="NS.object.0">117</string>
+			<string key="NS.object.0">301</string>
 		</object>
-		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+		<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="48"/>
+			<string>IBUISlider</string>
+			<string>IBUIView</string>
+			<string>IBUILabel</string>
+			<string>IBProxyObject</string>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<object class="NSArray" key="dict.sortedKeys" id="0">
 				<bool key="EncodedWithXMLCoder">YES</bool>
 			</object>
-			<object class="NSMutableArray" key="dict.values">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-			</object>
+			<reference key="dict.values" ref="0"/>
 		</object>
 		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 								<int key="NSvFlags">292</int>
 								<string key="NSFrame">{{20, 20}, {66, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="803405169"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{94, 20}, {146, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="115667180"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{18, 49}, {224, 23}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="633062279"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 								<int key="IBUIContentHorizontalAlignment">0</int>
 								<int key="NSvFlags">292</int>
 								<string key="NSFrame">{{20, 79}, {66, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="306183274"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{94, 79}, {146, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="297485092"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{18, 109}, {224, 23}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="930617356"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 								<int key="IBUIContentHorizontalAlignment">0</int>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{20, 143}, {154, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="946914145"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">289</int>
 								<string key="NSFrame">{{182, 139}, {58, 30}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="97320414"/>
 								<object class="NSColor" key="IBUIBackgroundColor">
 									<int key="NSColorSpace">1</int>
 									<bytes key="NSRGB">MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA</bytes>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{20, 181}, {154, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="821111572"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">289</int>
 								<string key="NSFrame">{{182, 177}, {58, 30}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="956298656"/>
 								<object class="NSColor" key="IBUIBackgroundColor">
 									<int key="NSColorSpace">1</int>
 									<bytes key="NSRGB">MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA</bytes>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{20, 219}, {154, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="173480064"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">289</int>
 								<string key="NSFrame">{{182, 215}, {58, 30}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="785809423"/>
 								<object class="NSColor" key="IBUIBackgroundColor">
 									<int key="NSColorSpace">1</int>
 									<bytes key="NSRGB">MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA</bytes>
 							</object>
 							<object class="IBUILabel" id="785809423">
 								<reference key="NSNextResponder" ref="52579621"/>
-								<int key="NSvFlags">290</int>
-								<string key="NSFrame">{{20, 257}, {154, 21}}</string>
+								<int key="NSvFlags">292</int>
+								<string key="NSFrame">{{20, 257}, {82, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="1073271941"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="IBUIBaselineAdjustment">1</int>
 								<float key="IBUIMinimumFontSize">10</float>
 							</object>
-							<object class="IBUIView" id="827904156">
+							<object class="IBUIView" id="1073271941">
 								<reference key="NSNextResponder" ref="52579621"/>
-								<int key="NSvFlags">289</int>
-								<string key="NSFrame">{{182, 253}, {58, 30}}</string>
+								<int key="NSvFlags">290</int>
+								<string key="NSFrame">{{108, 253}, {132, 30}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="841802387"/>
 								<object class="NSColor" key="IBUIBackgroundColor">
 									<int key="NSColorSpace">1</int>
-									<bytes key="NSRGB">MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA</bytes>
+									<bytes key="NSRGB">MCAxIDAuNTAxOTYwODE0AA</bytes>
 								</object>
 								<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 							</object>
-							<object class="IBUIView" id="1073271941">
+							<object class="IBUIView" id="841802387">
 								<reference key="NSNextResponder" ref="52579621"/>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{20, 291}, {220, 30}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="827447070"/>
 								<object class="NSColor" key="IBUIBackgroundColor">
 									<int key="NSColorSpace">1</int>
 									<bytes key="NSRGB">MCAxIDAuNTAxOTYwODE0AA</bytes>
 								<int key="NSvFlags">290</int>
 								<string key="NSFrame">{{20, 323}, {154, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView" ref="156103734"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 								<int key="NSvFlags">289</int>
 								<string key="NSFrame">{{182, 323}, {58, 21}}</string>
 								<reference key="NSSuperview" ref="52579621"/>
+								<reference key="NSWindow"/>
+								<reference key="NSNextKeyView"/>
 								<bool key="IBUIOpaque">NO</bool>
 								<bool key="IBUIClipsSubviews">YES</bool>
 								<int key="IBUIContentMode">7</int>
 						</object>
 						<string key="NSFrameSize">{260, 350}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
+						<reference key="NSNextKeyView" ref="238647515"/>
 						<object class="NSColor" key="IBUIBackgroundColor">
 							<int key="NSColorSpace">1</int>
 							<bytes key="NSRGB">MCAwIDAgMC43AA</bytes>
 				</object>
 				<string key="NSFrameSize">{260, 350}</string>
 				<reference key="NSSuperview"/>
+				<reference key="NSWindow"/>
+				<reference key="NSNextKeyView" ref="52579621"/>
 				<object class="NSColor" key="IBUIBackgroundColor">
 					<int key="NSColorSpace">3</int>
 					<bytes key="NSWhite">MCAwAA</bytes>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">modeSelector</string>
-						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="1073271941"/>
-					</object>
-					<int key="connectionID">44</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">fogSwitch</string>
 						<reference key="source" ref="372490531"/>
 						<reference key="destination" ref="173480064"/>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">clockSwitch</string>
+						<string key="label">clockSelector</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="827904156"/>
+						<reference key="destination" ref="1073271941"/>
 					</object>
-					<int key="connectionID">73</int>
+					<int key="connectionID">75</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">modeSelector</string>
+						<reference key="source" ref="372490531"/>
+						<reference key="destination" ref="841802387"/>
+					</object>
+					<int key="connectionID">76</int>
 				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 							<reference ref="821111572"/>
 							<reference ref="956298656"/>
 							<reference ref="173480064"/>
-							<reference ref="1073271941"/>
 							<reference ref="115667180"/>
 							<reference ref="633062279"/>
 							<reference ref="803405169"/>
 							<reference ref="827447070"/>
 							<reference ref="156103734"/>
 							<reference ref="785809423"/>
-							<reference ref="827904156"/>
+							<reference ref="1073271941"/>
+							<reference ref="841802387"/>
 						</object>
 						<reference key="parent" ref="191373211"/>
 					</object>
 						<reference key="parent" ref="52579621"/>
 					</object>
 					<object class="IBObjectRecord">
-						<int key="objectID">72</int>
-						<reference key="object" ref="827904156"/>
+						<int key="objectID">74</int>
+						<reference key="object" ref="841802387"/>
 						<reference key="parent" ref="52579621"/>
 					</object>
 				</object>
 					<string>7.IBPluginDependency</string>
 					<string>70.IBPluginDependency</string>
 					<string>71.IBPluginDependency</string>
-					<string>72.CustomClassName</string>
-					<string>72.IBPluginDependency</string>
+					<string>74.CustomClassName</string>
+					<string>74.IBPluginDependency</string>
 					<string>8.IBPluginDependency</string>
 					<string>9.CustomClassName</string>
 					<string>9.IBPluginDependency</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-					<string>MCBoolInputField</string>
+					<string>MCSegmentedInputField</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>MCBoolInputField</string>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
 				<bool key="EncodedWithXMLCoder">YES</bool>
 				<reference key="dict.sortedKeys" ref="0"/>
-				<object class="NSMutableArray" key="dict.values">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-				</object>
+				<reference key="dict.values" ref="0"/>
 			</object>
 			<nil key="activeLocalization"/>
 			<object class="NSMutableDictionary" key="localizations">
 				<bool key="EncodedWithXMLCoder">YES</bool>
 				<reference key="dict.sortedKeys" ref="0"/>
-				<object class="NSMutableArray" key="dict.values">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-				</object>
+				<reference key="dict.values" ref="0"/>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">73</int>
+			<int key="maxID">76</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 				<object class="IBPartialClassDescription">
 					<string key="className">MCBoolInputField</string>
 					<string key="superclassName">MCGlossyButton</string>
-					<object class="NSMutableDictionary" key="outlets">
-						<string key="NS.key.0">delegate</string>
-						<string key="NS.object.0">id</string>
-					</object>
-					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
-						<string key="NS.key.0">delegate</string>
-						<object class="IBToOneOutletInfo" key="NS.object.0">
-							<string key="name">delegate</string>
-							<string key="candidateClassName">id</string>
-						</object>
-					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">Classes/MCBoolInputField.h</string>
+						<string key="minorKey">./Classes/MCBoolInputField.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="superclassName">UIControl</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">Classes/MCGlossyButton.h</string>
+						<string key="minorKey">./Classes/MCGlossyButton.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">MCSegmentedInputField</string>
 					<string key="superclassName">UIControl</string>
-					<object class="NSMutableDictionary" key="outlets">
-						<string key="NS.key.0">delegate</string>
-						<string key="NS.object.0">id</string>
-					</object>
-					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
-						<string key="NS.key.0">delegate</string>
-						<object class="IBToOneOutletInfo" key="NS.object.0">
-							<string key="name">delegate</string>
-							<string key="candidateClassName">id</string>
-						</object>
-					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">Classes/MCSegmentedInputField.h</string>
+						<string key="minorKey">./Classes/MCSegmentedInputField.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">PrefViewController</string>
 					<string key="superclassName">UIViewController</string>
-					<object class="NSMutableDictionary" key="actions">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>closePrefs:</string>
-							<string>sliderChangedValue:</string>
-						</object>
-						<object class="NSMutableArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>id</string>
-							<string>id</string>
-						</object>
-					</object>
-					<object class="NSMutableDictionary" key="actionInfosByName">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>closePrefs:</string>
-							<string>sliderChangedValue:</string>
-						</object>
-						<object class="NSMutableArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<object class="IBActionInfo">
-								<string key="name">closePrefs:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">sliderChangedValue:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-						</object>
-					</object>
 					<object class="NSMutableDictionary" key="outlets">
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>clockSwitch</string>
+							<string>clockSelector</string>
 							<string>container</string>
 							<string>densityIndicator</string>
 							<string>densitySlider</string>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
 							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>MCBoolInputField</string>
+							<string>MCSegmentedInputField</string>
 							<string>UIView</string>
 							<string>UILabel</string>
 							<string>UISlider</string>
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>clockSwitch</string>
+							<string>clockSelector</string>
 							<string>container</string>
 							<string>densityIndicator</string>
 							<string>densitySlider</string>
 						<object class="NSMutableArray" key="dict.values">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<object class="IBToOneOutletInfo">
-								<string key="name">clockSwitch</string>
-								<string key="candidateClassName">MCBoolInputField</string>
+								<string key="name">clockSelector</string>
+								<string key="candidateClassName">MCSegmentedInputField</string>
 							</object>
 							<object class="IBToOneOutletInfo">
 								<string key="name">container</string>
 					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">Classes/PrefViewController.h</string>
-					</object>
-				</object>
-			</object>
-			<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="693992525">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIControl</string>
-					<string key="superclassName">UIView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UILabel</string>
-					<string key="superclassName">UIView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIResponder</string>
-					<string key="superclassName">NSObject</string>
-					<reference key="sourceIdentifier" ref="693992525"/>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UISearchBar</string>
-					<string key="superclassName">UIView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UISearchDisplayController</string>
-					<string key="superclassName">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UISlider</string>
-					<string key="superclassName">UIControl</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UISlider.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIView</string>
-					<string key="superclassName">UIResponder</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIViewController</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIViewController</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIViewController</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIViewController</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">UIViewController</string>
-					<string key="superclassName">UIResponder</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+						<string key="minorKey">./Classes/PrefViewController.h</string>
 					</object>
 				</object>
 			</object>
 			<integer value="3000" key="NS.object.0"/>
 		</object>
 		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<string key="IBDocument.LastKnownRelativeProjectPath">../MatrixCode.xcodeproj</string>
 		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-		<string key="IBCocoaTouchPluginVersion">117</string>
+		<string key="IBCocoaTouchPluginVersion">301</string>
 	</data>
 </archive>

File Classes/glmatrix.h

 
 #define DEF_SPEED       1.f
 #define DEF_DENSITY     20.f
-#define DEF_CLOCK       NO
 #define DEF_FOG         NO
 #define DEF_WAVES       YES
 #define DEF_ROTATE      YES
 #define DEF_TEXTURE     YES
 #define DEF_MODE        "Matrix"
-#define DEF_TIMEFMT     "%l:%M %p"
 
 
 void init_settings();
 int setCharProperty(char *property, char *newstr);
 
 void getPerformance(int *fps, int *polys);
-void getProperties(float *its_speed, float *its_density, int *allows_rotate, int *does_autorotate, int *does_fog, int *does_waves, int *does_texture, int *does_clock, char **its_mode);
+void getProperties(float *its_speed, float *its_density, int *allows_rotate, int *does_autorotate, int *does_fog, int *does_waves, int *does_texture, char **clock_fmt, char **its_mode);

File Classes/glmatrix.m

 
 static GLfloat speed = DEF_SPEED;
 static GLfloat density = DEF_DENSITY;
-static GLboolean do_clock = DEF_CLOCK;
-static char *timefmt = DEF_TIMEFMT;
+static char *timefmt = NULL;
 static GLboolean do_fog = DEF_FOG;
 static GLboolean do_waves = DEF_WAVES;
 static GLboolean allow_rotate = 1;				// whether rotating is allowed at all
 	s->wave_tick  = 0;
 	
 	for (i = 0; i < GRID_SIZE; i++) {
-		if (do_clock &&
+		if (NULL != timefmt &&
 			!time_displayed_p &&
 			(i < GRID_SIZE - 5) &&			/* display approx. once per 5 strips */
 			!(random() % (GRID_SIZE - 5) * 5))
 	strftime(text, sizeof(text)-1, format, tm);
 	
 	// Calculate x and y
-	GLfloat scale = 2.25f;
+	GLfloat scale = GRID_SIZE / 3.9f / strlen(text);
 	GLfloat x = -scale * ((GLfloat)strlen(text) / 2);
 	GLfloat y = 0.5f;
 	//printf("Time: %s  (%lu chars)\n", text, strlen(text));
     }
 	
 	polygon_count = 0;
-	int did_draw_clock = !do_clock;
+	int did_draw_clock = (NULL == timefmt);
 	GLfloat clock_z = 2.f;				// TODO: Move closer or farther depending on timefmt?
 	
 	/* Render (and tick) each strip, starting at the back
 
 int setBoolProperty(char *property, int flag)
 {
-	if (!strcasecmp(property, "do_clock")) {
-		do_clock = flag;
-		return 1;
-	}
 	if (!strcasecmp(property, "do_fog")) {
 		do_fog = flag;
 		return 1;
 		return 1;
 	}
 	if (!strcasecmp(property, "timeformat")) {
-		timefmt = newstr;
+		if (newstr) {
+			if (timefmt) {
+				free(timefmt);
+			}
+			timefmt = (char *)malloc(sizeof(newstr) * sizeof(char));
+			if (timefmt) {
+				memcpy(timefmt, newstr, sizeof(newstr) * sizeof(newstr));
+			}
+		}
+		else if (timefmt) {
+			free(timefmt);
+			timefmt = NULL;
+		}
 		return 1;
 	}
 	return 0;
 	*polys = polygon_count;
 }
 
-void getProperties(float *its_speed, float *its_density, int *allows_rotate, int *does_autorotate, int *does_fog, int *does_waves, int *does_texture, int *does_clock, char **its_mode)
+void getProperties(float *its_speed, float *its_density, int *allows_rotate, int *does_autorotate, int *does_fog, int *does_waves, int *does_texture, char **clock_fmt, char **its_mode)
 {
 	if (its_speed) {
 		*its_speed = speed;
 	if (does_texture) {
 		*does_texture = do_texture;
 	}
-	if (does_clock) {
-		*does_clock = do_clock;
+	if (clock_fmt) {
+		*clock_fmt = timefmt;
 	}
 	if (its_mode) {
 		*its_mode = mode;