Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
3 AppSrc/GlkFileSelectViewController.h
@@ -15,13 +15,16 @@
BOOL isload;
GlkFileRefPrompt *prompt;
+ NSString *usekey;
+ int defaultcounter;
NSMutableArray *filelist; // array of GlkFileThumb
NSDateFormatter *dateformatter;
}
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) IBOutlet UITextField *textfield;
@property (nonatomic, retain) GlkFileRefPrompt *prompt;
+@property (nonatomic, retain) NSString *usekey;
@property (nonatomic, retain) NSMutableArray *filelist;
@property (nonatomic, retain) NSDateFormatter *dateformatter;
View
65 AppSrc/GlkFileSelectViewController.m
@@ -19,6 +19,7 @@ @implementation GlkFileSelectViewController
@synthesize tableView;
@synthesize textfield;
@synthesize prompt;
+@synthesize usekey;
@synthesize filelist;
@synthesize dateformatter;
@@ -30,6 +31,21 @@ - (id) initWithNibName:(NSString *)nibName prompt:(GlkFileRefPrompt *)promptref
self.dateformatter = [[[RelDateFormatter alloc] init] autorelease];
[dateformatter setDateStyle:NSDateFormatterMediumStyle];
[dateformatter setTimeStyle:NSDateFormatterShortStyle];
+
+ switch (prompt.usage & fileusage_TypeMask) {
+ case fileusage_SavedGame:
+ self.usekey = @"use.save";
+ break;
+ case fileusage_Transcript:
+ self.usekey = @"use.transcript";
+ break;
+ case fileusage_InputRecord:
+ self.usekey = @"use.input";
+ break;
+ case fileusage_Data:
+ default:
+ self.usekey = @"use.data";
+ }
}
return self;
}
@@ -46,21 +62,35 @@ - (void) viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
-
- //### localize and customize
+
if (isload) {
if (textfield)
[NSException raise:@"GlkException" format:@"textfield in read-mode file selection"];
- self.navigationItem.title = @"Load";
+ self.navigationItem.title = NSLocalizedString([usekey stringByAppendingString:@".readtitle"], nil);
}
else {
if (!textfield)
[NSException raise:@"GlkException" format:@"no textfield in write-mode file selection"];
- self.navigationItem.title = @"Save";
- //### Add default-entry-thing "Saved game". Include the number, come to think of it.
+
+ NSString *placeholder = NSLocalizedString([usekey stringByAppendingString:@".placeholder"], nil);
+ for (int ix=1; YES; ix++) {
+ NSString *label = placeholder;
+ if (ix >= 2)
+ label = [NSString stringWithFormat:@"%@ %d", label, ix];
+ NSString *filename = StringToDumbEncoding(label);
+ NSString *pathname = [prompt.dirname stringByAppendingPathComponent:filename];
+ if (![[NSFileManager defaultManager] fileExistsAtPath:pathname]) {
+ placeholder = label;
+ defaultcounter = ix;
+ break;
+ }
+ }
+
+ self.navigationItem.title = NSLocalizedString([usekey stringByAppendingString:@".writetitle"], nil);
+ textfield.placeholder = placeholder;
CGRect rect = CGRectMake(0, 0, tableView.frame.size.width, 32);
UILabel *label = [[[UILabel alloc] initWithFrame:rect] autorelease];
- label.text = @"Previously saved games:";
+ label.text = NSLocalizedString([usekey stringByAppendingString:@".listlabel"], nil);
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor lightGrayColor];
tableView.tableHeaderView = label;
@@ -111,6 +141,7 @@ - (void) viewDidAppear:(BOOL)animated {
- (void) dealloc {
self.prompt = nil;
+ self.usekey = nil;
self.filelist = nil;
self.dateformatter = nil;
[super dealloc];
@@ -120,7 +151,7 @@ - (void) addBlankThumb {
GlkFileThumb *thumb = [[[GlkFileThumb alloc] init] autorelease];
thumb.isfake = YES;
thumb.modtime = [NSDate date];
- thumb.label = @"No saved games"; //### localize and customize
+ thumb.label = NSLocalizedString([usekey stringByAppendingString:@".nofiles"], nil);
[filelist insertObject:thumb atIndex:0];
}
@@ -297,25 +328,17 @@ - (void) textFieldContinueReturn:(UITextField *)textField {
if (label.length == 0) {
/* Textfield is empty. Pick a "Saved game" filename which is not already in use. */
- //### localize this string
- for (int ix=0; YES; ix++) {
- if (!ix)
- label = @"Saved game";
- else
- label = [NSString stringWithFormat:@"Saved game %d", ix];
- NSString *filename = StringToDumbEncoding(label);
- NSString *pathname = [prompt.dirname stringByAppendingPathComponent:filename];
- if (![[NSFileManager defaultManager] fileExistsAtPath:pathname])
- break;
- }
+ label = NSLocalizedString([usekey stringByAppendingString:@".placeholder"], nil);
+ if (defaultcounter >= 2)
+ label = [NSString stringWithFormat:@"%@ %d", label, defaultcounter];
}
prompt.filename = StringToDumbEncoding(label);
prompt.pathname = [prompt.dirname stringByAppendingPathComponent:prompt.filename];
- if ([[NSFileManager defaultManager] fileExistsAtPath:prompt.pathname]) {
- NSString *str = [NSString stringWithFormat:@"Replace the saved game \"%@\"?", label];
- UIActionSheet *sheet = [[[UIActionSheet alloc] initWithTitle:str delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Replace" otherButtonTitles:nil] autorelease];
+ if (prompt.fmode != filemode_WriteAppend && [[NSFileManager defaultManager] fileExistsAtPath:prompt.pathname]) {
+ NSString *str = [NSString stringWithFormat:NSLocalizedString([usekey stringByAppendingString:@".replacequery"], nil), label];
+ UIActionSheet *sheet = [[[UIActionSheet alloc] initWithTitle:str delegate:self cancelButtonTitle:NSLocalizedString(@"button.cancel", nil) destructiveButtonTitle:NSLocalizedString(@"button.replace", nil) otherButtonTitles:nil] autorelease];
[sheet showInView:textfield];
return;
}
View
4 LibSrc/Geometry.m
@@ -52,8 +52,8 @@ - (id) initWithCoder:(NSCoder *)decoder {
// self.keystyleset will have to be filled in later, once all the windows are loaded
size = [decoder decodeInt32ForKey:@"size"];
- child1tag = [decoder decodeObjectForKey:@"child1tag"];
- child2tag = [decoder decodeObjectForKey:@"child2tag"];
+ self.child1tag = [decoder decodeObjectForKey:@"child1tag"];
+ self.child2tag = [decoder decodeObjectForKey:@"child2tag"];
return self;
}
View
6 LibSrc/GlkWindow.m
@@ -89,8 +89,8 @@ - (id) initWithType:(glui32)wintype rock:(glui32)winrock {
type = wintype;
rock = winrock;
- parent = nil;
- parenttag = nil;
+ self.parent = nil;
+ self.parenttag = nil;
input_request_id = 0;
line_request_initial = nil;
line_buffer = nil;
@@ -108,7 +108,7 @@ - (id) initWithType:(glui32)wintype rock:(glui32)winrock {
self.echostream = nil;
self.echostreamtag = nil;
- styleset = nil;
+ self.styleset = nil;
[library.windows addObject:self];
if (library.dispatch_register_obj)
View
16 Resources/GlkFileSelectStore.xib
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
+ <int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11D50</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
+ <string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUITableView</string>
@@ -42,13 +42,14 @@
<string key="NSFrame">{{20, 20}, {280, 31}}</string>
<reference key="NSSuperview" ref="307763933"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="767612791"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
- <string key="IBUIPlaceholder">Saved game</string>
+ <string key="IBUIPlaceholder">Use placeholder</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
@@ -81,6 +82,7 @@
<string key="NSFrame">{{0, 69}, {320, 391}}</string>
<reference key="NSSuperview" ref="307763933"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor" id="116255567">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
@@ -104,6 +106,7 @@
<string key="NSFrame">{{0, 67}, {320, 2}}</string>
<reference key="NSSuperview" ref="307763933"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="873029372"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC44NTgxMzk1MzQ5AA</bytes>
@@ -114,6 +117,7 @@
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="187839478"/>
<reference key="IBUIBackgroundColor" ref="116255567"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
@@ -273,10 +277,10 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1280" key="NS.object.0"/>
+ <real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">933</string>
+ <string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>
View
30 Resources/en.lproj/Localizable.strings
@@ -4,7 +4,37 @@
http://eblong.com/zarf/glk/
*/
+"button.cancel" = "Cancel";
+"button.replace" = "Replace";
+
"label.missing-line" = "Missing line";
"label.blank-line" = "Blank line";
"label.no-history" = "(You haven’t done much yet)";
+"use.save.readtitle" = "Load Game";
+"use.save.writetitle" = "Save Game";
+"use.save.replacequery" = "Replace the saved game “%@”?";
+"use.save.placeholder" = "Saved game";
+"use.save.listlabel" = "Previously saved games:";
+"use.save.nofiles" = "No saved games";
+
+"use.transcript.readtitle" = "Find Transcript";
+"use.transcript.writetitle" = "Write Transcript";
+"use.transcript.replacequery" = "Replace the transcript “%@”?";
+"use.transcript.placeholder" = "Transcript";
+"use.transcript.listlabel" = "Existing transcripts:";
+"use.transcript.nofiles" = "No transcripts";
+
+"use.input.readtitle" = "Find Record";
+"use.input.writetitle" = "Write Record";
+"use.input.replacequery" = "Replace the command record “%@”?";
+"use.input.placeholder" = "Command Record";
+"use.input.listlabel" = "Existing records:";
+"use.input.nofiles" = "No command records";
+
+"use.data.readtitle" = "Read Data";
+"use.data.writetitle" = "Write Data";
+"use.data.replacequery" = "Replace the data file “%@”?";
+"use.data.placeholder" = "Data file";
+"use.data.listlabel" = "Existing data files:";
+"use.data.nofiles" = "No data files";

No commit comments for this range

Something went wrong with that request. Please try again.