[dasher] iPhone: reorganise misc/action preferences
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] iPhone: reorganise misc/action preferences
- Date: Tue, 18 Jan 2011 17:17:56 +0000 (UTC)
commit 9ed029e96d86e62b52d18b722011c7aad01f05bd
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Wed Nov 24 18:31:54 2010 +0000
iPhone: reorganise misc/action preferences
Removed "Control Mode" button at bottom of MiscSettings => just a ParamsCtrlr
ActionConfigurator now separate, three-section table:
*control mode *other (stop actions, new speak-as-go) *actions menu
TODO: combine this with ParametersController (i.e. make latter a table) ???
DasherAppDelegate overrides presentModalViewCon to stopAnimation,
restarts in settingsDone
Also remove SymbolAlphabet.h from project file
Src/iPhone/Classes/ActionConfigurator.h | 17 ++
Src/iPhone/Classes/ActionConfigurator.mm | 282 +++++++++++++++++++++++++++
Src/iPhone/Classes/Actions.h | 16 ++-
Src/iPhone/Classes/Actions.mm | 243 ++----------------------
Src/iPhone/Classes/DasherAppDelegate.mm | 28 +++-
Src/iPhone/Classes/MiscSettings.h | 15 --
Src/iPhone/Classes/MiscSettings.mm | 70 -------
Src/iPhone/Dasher.xcodeproj/project.pbxproj | 14 +-
8 files changed, 356 insertions(+), 329 deletions(-)
---
diff --git a/Src/iPhone/Classes/ActionConfigurator.h b/Src/iPhone/Classes/ActionConfigurator.h
new file mode 100644
index 0000000..855c62c
--- /dev/null
+++ b/Src/iPhone/Classes/ActionConfigurator.h
@@ -0,0 +1,17 @@
+//
+// ActionConfigurator.h
+// Dasher
+//
+// Created by Alan Lawrence on 24/11/2010.
+// Copyright 2010 Cavendish Laboratory. All rights reserved.
+//
+
+#import "Actions.h"
+
+ interface ActionConfigurator : UITableViewController {
+ ActionButton *button;
+ UIView *headers[3];
+}
+-(id)initWithButton:(ActionButton *)_button;
++(ActionConfigurator *)instanceForButton:(ActionButton *)button;
+ end
diff --git a/Src/iPhone/Classes/ActionConfigurator.mm b/Src/iPhone/Classes/ActionConfigurator.mm
new file mode 100644
index 0000000..6bc823b
--- /dev/null
+++ b/Src/iPhone/Classes/ActionConfigurator.mm
@@ -0,0 +1,282 @@
+//
+// ActionConfigurator.mm
+// Dasher
+//
+// Created by Alan Lawrence on 26/05/2010.
+// Copyright 2010 Cavendish Laboratory. All rights reserved.
+//
+
+#import "ActionConfigurator.h"
+#import "Parameters.h"
+#import "DasherAppDelegate.h"
+#import "DasherUtil.h"
+
+int CONTROL_MODE_BPS[] = {BP_CONTROL_MODE_HAS_COPY, BP_CONTROL_MODE_HAS_SPEECH, BP_CONTROL_MODE_HAS_HALT, BP_CONTROL_MODE_HAS_EDIT};
+int OTHER_BPS[] = {BP_COPY_ALL_ON_STOP, BP_SPEAK_ALL_ON_STOP, BP_SPEAK_WORDS};
+
+ implementation ActionConfigurator
+
+- (id)initWithButton:(ActionButton *)_button {
+ if (self = [super initWithStyle:UITableViewStyleGrouped]) {
+ button = _button;
+ self.tabBarItem.title=@"Actions";
+ self.tabBarItem.image=[UIImage imageNamed:@"spanner_lg.png"];
+ self.navigationItem.title=@"Configure Actions";
+ self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:[DasherAppDelegate theApp] action:@selector(settingsDone)] autorelease];
+ }
+ return self;
+}
+
++(ActionConfigurator *)instanceForButton:(ActionButton *)button {
+ return [[[self alloc] initWithButton:button] autorelease];
+}
+
+#pragma mark -
+#pragma mark View lifecycle
+
+/*
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ // Uncomment the following line to preserve selection between presentations.
+ self.clearsSelectionOnViewWillAppear = NO;
+
+ // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
+ // self.navigationItem.rightBarButtonItem = self.editButtonItem;
+}
+*/
+
+/*
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+}
+*/
+/*
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+}
+*/
+/*
+- (void)viewWillDisappear:(BOOL)animated {
+ [super viewWillDisappear:animated];
+}
+*/
+/*
+- (void)viewDidDisappear:(BOOL)animated {
+ [super viewDidDisappear:animated];
+}
+*/
+/*
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+*/
+
+
+#pragma mark -
+#pragma mark Table view data source
+
+-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
+ if (!headers[section]) {
+ UIView *header = headers[section] = [[UIView alloc] init];
+ UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 10.0, 200.0, 20.0)] autorelease];
+ label.font = [UIFont boldSystemFontOfSize:18];
+ label.textColor = [UIColor grayColor];
+ label.backgroundColor = [UIColor clearColor];
+ label.text = [self tableView:tableView titleForHeaderInSection:section];
+ [header addSubview:label];
+ if (section==0) {
+ UISwitch *sw = [[[UISwitch alloc] initWithFrame:CGRectMake(210.0,10.0,100.0,20.0)] autorelease];
+ sw.tag=BP_CONTROL_MODE;
+ sw.on=[DasherAppDelegate theApp].dasherInterface->GetBoolParameter(BP_CONTROL_MODE);
+ [sw addTarget:self action:@selector(paramSlid:) forControlEvents:UIControlEventValueChanged];
+ [header addSubview:sw];
+ }
+ }
+ return headers[section];
+}
+
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ switch (section) {
+ case 0: return @"Control Mode";
+ case 1: return @"Triggers";
+ case 2: return @"Actions Menu";
+ }
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger) section {
+ return 40.0f;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ // Return the number of sections.
+ return 3;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ switch (section) {
+ case 0:
+ return sizeof(CONTROL_MODE_BPS)/sizeof(CONTROL_MODE_BPS[0]);
+ case 1:
+ return sizeof(OTHER_BPS)/sizeof(OTHER_BPS[0]);
+ case 2:
+ return numActions;
+ }
+}
+
+
+// Customize the appearance of table view cells.
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+
+ static NSString *CellIdentifier = @"Cell";
+
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ UISwitch *sw;
+
+ if (cell == nil) {
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
+ sw = [[[UISwitch alloc] initWithFrame:CGRectMake(200.0,5.0,80.0,18.0)] autorelease];
+ [cell.contentView addSubview:sw];
+ } else {
+ sw = (UISwitch *)[cell.contentView viewWithTag:cell.tag];
+ DASHER_ASSERT([sw isKindOfClass:[UISwitch class]]);
+ }
+ sw.enabled=YES;
+ // Configure the cell...
+ if ([indexPath section]==2) {
+ SAction *act = &actions[ [indexPath row] ];
+ [sw addTarget:self action:@selector(actionSlid:) forControlEvents:UIControlEventValueChanged];
+ cell.textLabel.text = act->dispName;
+ sw.tag = cell.tag = [indexPath row];
+ sw.on = [[NSUserDefaults standardUserDefaults] boolForKey:act->settingName];
+ } else {
+ CDasherInterfaceBase *intf=[DasherAppDelegate theApp].dasherInterface;
+ int *params;
+ if ([indexPath section]==0) {
+ params=CONTROL_MODE_BPS;
+ sw.enabled = intf->GetBoolParameter(BP_CONTROL_MODE);
+ } else {
+ DASHER_ASSERT([indexPath section]==1);
+ params=OTHER_BPS;
+ }
+ int iParameter = params[[indexPath row]];
+ [sw addTarget:self action:@selector(paramSlid:) forControlEvents:UIControlEventValueChanged];
+ cell.textLabel.text = NSStringFromStdString(intf->GetSettingsStore()->GetParameterName(iParameter));
+ sw.tag = cell.tag = iParameter;
+ sw.on = intf->GetBoolParameter(iParameter);
+ }
+ return cell;
+}
+
+- (void)actionSlid:(id)sender {
+ DASHER_ASSERT([sender isKindOfClass:[UISwitch class]]);
+ UISwitch *sw = (UISwitch *)sender;
+ SAction *act = &actions[ sw.tag ];
+ [[NSUserDefaults standardUserDefaults] setBool:sw.on forKey:act->settingName];
+ [button refresh];
+}
+
+-(void)paramSlid:(id)sender {
+ DASHER_ASSERT([sender isKindOfClass:[UISwitch class]]);
+ UISwitch *sw = (UISwitch *)sender;
+ int iParameter = sw.tag;
+ [DasherAppDelegate theApp].dasherInterface->SetBoolParameter(iParameter,sw.on);
+ if (iParameter==BP_CONTROL_MODE) {
+ //find the table view...
+ UITableView *tv;
+ for (UIView *v = sw; ;v=[v superview]) {
+ if ([v isKindOfClass:[UITableView class]]) {
+ tv = (UITableView *)v;
+ break;
+ }
+ }
+ for (int i=0; i<sizeof(CONTROL_MODE_BPS)/sizeof(CONTROL_MODE_BPS[0]); i++) {
+ UITableViewCell *cell=[tv cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
+ UISwitch *sw2=(UISwitch *)[cell.contentView viewWithTag:cell.tag];
+ DASHER_ASSERT([sw2 isKindOfClass:[UISwitch class]]);
+ sw2.enabled=sw.on;
+ }
+ }
+}
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
+ }
+ else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+*/
+
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
+}
+*/
+
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+
+#pragma mark -
+#pragma mark Table view delegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView deselectRowAtIndexPath:indexPath animated:NO];
+ // Navigation logic may go here. Create and push another view controller.
+ /*
+ <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
+ // ...
+ // Pass the selected object to the new view controller.
+ [self.navigationController pushViewController:detailViewController animated:YES];
+ [detailViewController release];
+ */
+}
+
+
+#pragma mark -
+#pragma mark Memory management
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Relinquish ownership any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
+ // For example: self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+ end
+
diff --git a/Src/iPhone/Classes/Actions.h b/Src/iPhone/Classes/Actions.h
index b48a96d..47ff3e7 100644
--- a/Src/iPhone/Classes/Actions.h
+++ b/Src/iPhone/Classes/Actions.h
@@ -1,5 +1,5 @@
//
-// U.h
+// Actions.h
// Dasher
//
// Created by Alan Lawrence on 26/05/2010.
@@ -8,11 +8,21 @@
#import <UIKit/UIKit.h>
+typedef struct {
+ NSString *dispName;
+ NSString *settingName;
+ NSString *toolbarIconFile;
+} SAction;
+
+#ifndef __ACTIONS_MM__
+extern SAction actions[];
+extern int numActions;
+#endif
+
@interface ActionButton : UIBarButtonItem <UIActionSheetDelegate> {
UIToolbar *toolbar;
int numActionsOn, *actionsOn;
}
-- (UIViewController *)tabConfigurator;
- (id)initForToolbar:(UIToolbar *)toolbar;
-
+- (void)refresh;
@end
diff --git a/Src/iPhone/Classes/Actions.mm b/Src/iPhone/Classes/Actions.mm
index 1f9c61d..c8b46f8 100644
--- a/Src/iPhone/Classes/Actions.mm
+++ b/Src/iPhone/Classes/Actions.mm
@@ -1,33 +1,17 @@
//
-// U.m
+// Actions.mm
// Dasher
//
// Created by Alan Lawrence on 26/05/2010.
// Copyright 2010 Cavendish Laboratory. All rights reserved.
//
+#define __ACTIONS_MM__
#import "Actions.h"
#import "DasherAppDelegate.h"
+#import "ActionConfigurator.h"
- interface ActionButton ()
-- (void)performAction:(int)which checkClear:(BOOL)bCheck;
-- (void)scan;
-- (UIViewController *)navConfigurator;
- end;
-
- interface ActionConfigurator : UITableViewController {
- ActionButton *button;
-}
--(id)initWithButton:(ActionButton *)_button;
- end
-
-typedef struct {
- NSString *dispName;
- NSString *settingName;
- NSString *toolbarIconFile;
-} SAction;
-
-static SAction actions[] = {
+SAction actions[] = {
{@"Email",@"iphone_act_email", @"mail.png"},
{@"Speak",@"iphone_act_speak", @"bubble.png"},
{@"Speak and Clear",@"iphone_act_speak_clear", @"bubbletrash.png"},
@@ -36,7 +20,12 @@ static SAction actions[] = {
{@"Paste from Clipboard", @"iphone_act_paste", @"paste.png"},
};
-static const int numActions = sizeof(actions) / sizeof(actions[0]);
+int numActions = sizeof(actions) / sizeof(actions[0]);
+
+ interface ActionButton ()
+- (void)performAction:(int)which checkClear:(BOOL)bCheck;
+ end;
+
static NSString *actionIconFile = @"spanner.png";
@@ -46,33 +35,17 @@ static NSString *actionIconFile = @"spanner.png";
if (self = [super initWithImage:[UIImage imageNamed:actionIconFile] style:UIBarButtonItemStylePlain target:self action:@selector(clicked)]) {
toolbar = _toolbar;
actionsOn = new int[numActions];
- [self scan];
+ [self refresh];
}
return self;
}
--(UIViewController *)tabConfigurator {
- ActionConfigurator *conf=[[[ActionConfigurator alloc] initWithButton:self] autorelease];
- //for a tab in the settings tabcontroller...
- conf.tabBarItem.title=@"Actions";
- conf.tabBarItem.image=[UIImage imageNamed:@"spanner_lg.png"];
- return conf;
-}
-
--(UIViewController *)navConfigurator {
- ActionConfigurator *conf = [[[ActionConfigurator alloc] initWithButton:self] autorelease];
- //for root of a navigationcontroller...
- conf.navigationItem.title=@"Configure Actions";
- conf.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(settingsDone)] autorelease];
- return conf;
-}
-
-(void)dealloc {
delete[] actionsOn;
[super dealloc];
}
--(void)scan {
+-(void)refresh {
numActionsOn=0;
NSUserDefaults *settings=[NSUserDefaults standardUserDefaults];
NSString *iconFile=nil;
@@ -93,7 +66,7 @@ static NSString *actionIconFile = @"spanner.png";
- (void)clicked {
if (numActionsOn==0) {
//no actions enabled! display configurator...
- [[DasherAppDelegate theApp] presentModalViewController:[[[UINavigationController alloc] initWithRootViewController:[self navConfigurator]] autorelease] animated:YES];
+ [[DasherAppDelegate theApp] presentModalViewController:[[[UINavigationController alloc] initWithRootViewController:[ActionConfigurator instanceForButton:self]] autorelease] animated:YES];
} else if (numActionsOn==1) {
//a single action is enabled...
[self performAction:actionsOn[0] checkClear:YES];
@@ -136,10 +109,6 @@ static NSString *actionIconFile = @"spanner.png";
}
}
--(void)settingsDone {
- [[DasherAppDelegate theApp] dismissModalViewControllerAnimated:YES];
-}
-
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == [actionSheet cancelButtonIndex]) return;
@@ -183,188 +152,4 @@ static NSString *actionIconFile = @"spanner.png";
if (bCheck) [deleg clearBtn]; else [deleg clearText];
}
- end
-
- implementation ActionConfigurator
-
-- (id)initWithButton:(ActionButton *)_button {
- if (self = [super initWithStyle:UITableViewStylePlain]) {
- button = _button;
- }
- return self;
-}
-
-#pragma mark -
-#pragma mark View lifecycle
-
-/*
-- (void)viewDidLoad {
- [super viewDidLoad];
-
- // Uncomment the following line to preserve selection between presentations.
- self.clearsSelectionOnViewWillAppear = NO;
-
- // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
- // self.navigationItem.rightBarButtonItem = self.editButtonItem;
-}
-*/
-
-/*
-- (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
-}
-*/
-/*
-- (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
-}
-*/
-/*
-- (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
-}
-*/
-/*
-- (void)viewDidDisappear:(BOOL)animated {
- [super viewDidDisappear:animated];
-}
-*/
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
-
-
-#pragma mark -
-#pragma mark Table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- // Return the number of sections.
- return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- // Return the number of rows in the section.
- return numActions;
-}
-
-
-// Customize the appearance of table view cells.
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- static NSString *CellIdentifier = @"Cell";
-
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- UISwitch *sw;
-
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- sw = [[[UISwitch alloc] initWithFrame:CGRectMake(210.0,5.0,100.0,20.0)] autorelease];
- [sw addTarget:self action:@selector(slid:) forControlEvents:UIControlEventValueChanged];
- sw.tag=1;
- [cell addSubview:sw];
- } else {
- DASHER_ASSERT([[cell viewWithTag:1] isKindOfClass:[UISwitch class]]);
- sw = (UISwitch *)[cell viewWithTag:1];
- }
-
-
- // Configure the cell...
- SAction *act = &actions[ [indexPath row] ];
- cell.text = act->dispName;
- cell.tag = [indexPath row];
- sw.on = [[NSUserDefaults standardUserDefaults] boolForKey:act->settingName];
- return cell;
-}
-
-- (void)slid:(id)sender {
- DASHER_ASSERT([sender isKindOfClass:[UISwitch class]]);
- UISwitch *sw = (UISwitch *)sender;
- DASHER_ASSERT([[sw superview] isKindOfClass:[UITableViewCell class]]);
- SAction *act = &actions[ [sw superview].tag ];
- [[NSUserDefaults standardUserDefaults] setBool:sw.on forKey:act->settingName];
- [button scan];
-}
-
-/*
-// Override to support conditional editing of the table view.
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- // Return NO if you do not want the specified item to be editable.
- return YES;
-}
-*/
-
-
-/*
-// Override to support editing the table view.
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
-
- if (editingStyle == UITableViewCellEditingStyleDelete) {
- // Delete the row from the data source
- [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
- }
- else if (editingStyle == UITableViewCellEditingStyleInsert) {
- // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
- }
-}
-*/
-
-
-/*
-// Override to support rearranging the table view.
-- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
-}
-*/
-
-
-/*
-// Override to support conditional rearranging of the table view.
-- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
- // Return NO if you do not want the item to be re-orderable.
- return YES;
-}
-*/
-
-
-#pragma mark -
-#pragma mark Table view delegate
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:NO];
- // Navigation logic may go here. Create and push another view controller.
- /*
- <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
- // ...
- // Pass the selected object to the new view controller.
- [self.navigationController pushViewController:detailViewController animated:YES];
- [detailViewController release];
- */
-}
-
-
-#pragma mark -
-#pragma mark Memory management
-
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Relinquish ownership any cached data, images, etc that aren't in use.
-}
-
-- (void)viewDidUnload {
- // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
- // For example: self.myOutlet = nil;
-}
-
-
-- (void)dealloc {
- [super dealloc];
-}
-
-
- end
-
+ end
\ No newline at end of file
diff --git a/Src/iPhone/Classes/DasherAppDelegate.mm b/Src/iPhone/Classes/DasherAppDelegate.mm
index fd77a80..d8bdf9c 100644
--- a/Src/iPhone/Classes/DasherAppDelegate.mm
+++ b/Src/iPhone/Classes/DasherAppDelegate.mm
@@ -11,11 +11,12 @@
#import "LanguagesController.h"
#import "InputMethodSelector.h"
#import "CalibrationController.h"
+#import "ParametersController.h"
#import "DasherUtil.h"
#import "Common.h"
#import "TextView.h"
-#import "MiscSettings.h"
#import "FliteTTS.h"
+#import "ActionConfigurator.h"
//declare some private methods!
@interface DasherAppDelegate ()
@@ -37,6 +38,18 @@
- (void)hide;
@end
+static SModuleSettings _miscSettings[] = { //note iStep and string description are ignored
+ {LP_NODE_BUDGET, T_LONG, 400, 10000, 1, 0, ""}, //hopefully appropriate for an iPhone 3GS?
+ {LP_MARGIN_WIDTH, T_LONG, 100, 900, 1, 0, ""},
+ {LP_DASHER_FONTSIZE, T_LONG, 1, 3, 1, 1, ""},
+ {LP_SHAPE_TYPE, T_LONG, 0, 5, 1, -1, ""},
+ {LP_OUTLINE_WIDTH, T_LONG, -5, 5, 1, -1, ""},
+ {BP_AUTO_SPEEDCONTROL, T_BOOL, -1, -1, -1, -1, ""},
+ {LP_NONLINEAR_X, T_LONG, 0, 10, 1, -1, ""},
+ {BP_DOUBLE_X, T_BOOL, -1, -1, -1, -1, ""},
+};
+
+
@implementation DasherAppDelegate
@synthesize screenLockLabel;
@@ -286,23 +299,30 @@
- (void)settings {
//avoid awful muddle if we change out of tap-to-start mode whilst running....
_dasherInterface->Stop();
- [glView stopAnimation];
UITabBarController *tabs = [[[UITabBarController alloc] init] autorelease];
tabs.title = @"Settings";
tabs.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(settingsDone)] autorelease];
UINavigationController *settings = [[[UINavigationController alloc] initWithRootViewController:tabs] autorelease];
+ ParametersController *misc = [[[ParametersController alloc] initWithTitle:@"Misc" Settings:_miscSettings Count:sizeof(_miscSettings)/sizeof(_miscSettings[0])] autorelease];
+ misc.tabBarItem.image = [UIImage imageNamed:@"misc.png"];
+
tabs.viewControllers = [NSArray arrayWithObjects:
[[[InputMethodSelector alloc] init] autorelease],
[[[LanguagesController alloc] init] autorelease],
[[[StringParamController alloc] initWithTitle:@"Colour" image:[UIImage imageNamed:@"palette.png"] settingParam:SP_COLOUR_ID] autorelease],
- [[[MiscSettings alloc] init] autorelease],
- [actions tabConfigurator],
+ misc,
+ [ActionConfigurator instanceForButton:actions],
nil];
[self presentModalViewController:settings animated:YES];
}
+-(void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated {
+ [glView stopAnimation];
+ [super presentModalViewController:modalViewController animated:animated];
+}
+
- (void)settingsDone {
[self dismissModalViewControllerAnimated:YES];
[glView startAnimation];
diff --git a/Src/iPhone/Dasher.xcodeproj/project.pbxproj b/Src/iPhone/Dasher.xcodeproj/project.pbxproj
index fca3b5c..17675fd 100755
--- a/Src/iPhone/Dasher.xcodeproj/project.pbxproj
+++ b/Src/iPhone/Dasher.xcodeproj/project.pbxproj
@@ -44,6 +44,7 @@
331F29CA0F7A9C270044EB9C /* alphabet.xsl in Resources */ = {isa = PBXBuildFile; fileRef = 331F293E0F7A9C270044EB9C /* alphabet.xsl */; };
331F29CB0F7A9C270044EB9C /* alphabet.xsl.good in Resources */ = {isa = PBXBuildFile; fileRef = 331F293F0F7A9C270044EB9C /* alphabet.xsl.good */; };
3324F491129C119C00EE6A22 /* IPhoneFilters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 332F32CC103C8D6E008448D7 /* IPhoneFilters.mm */; };
+ 3324F7BF129D744D00EE6A22 /* ActionConfigurator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3324F7BE129D744D00EE6A22 /* ActionConfigurator.mm */; };
332BCAB40F71621400585DBD /* expat.dsp in Resources */ = {isa = PBXBuildFile; fileRef = 332BCA9A0F71621400585DBD /* expat.dsp */; };
332BCAB50F71621400585DBD /* expat_static.dsp in Resources */ = {isa = PBXBuildFile; fileRef = 332BCA9D0F71621400585DBD /* expat_static.dsp */; };
332BCAB60F71621400585DBD /* expatw.dsp in Resources */ = {isa = PBXBuildFile; fileRef = 332BCA9E0F71621400585DBD /* expatw.dsp */; };
@@ -83,7 +84,6 @@
3334D4A3101385060077948A /* tilt.png in Resources */ = {isa = PBXBuildFile; fileRef = 3334D4A2101385060077948A /* tilt.png */; };
3334D4BC1014713B0077948A /* globe.png in Resources */ = {isa = PBXBuildFile; fileRef = 3334D4BB1014713B0077948A /* globe.png */; };
3334D4D31014740B0077948A /* misc.png in Resources */ = {isa = PBXBuildFile; fileRef = 3334D4D21014740B0077948A /* misc.png */; };
- 3334D4DF1014745F0077948A /* MiscSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3334D4DE1014745F0077948A /* MiscSettings.mm */; };
3334D996101627140077948A /* alphabet.bengali.xml in Resources */ = {isa = PBXBuildFile; fileRef = 3334D995101627130077948A /* alphabet.bengali.xml */; };
3334D99A101627A00077948A /* alphabet.hungarian.xml in Resources */ = {isa = PBXBuildFile; fileRef = 3334D999101627A00077948A /* alphabet.hungarian.xml */; };
3334D99C101627DE0077948A /* alphabet.mongolian.xml in Resources */ = {isa = PBXBuildFile; fileRef = 3334D99B101627DE0077948A /* alphabet.mongolian.xml */; };
@@ -333,6 +333,8 @@
332387300F78388200DD75C5 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
332387310F78388200DD75C5 /* myassert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = myassert.h; sourceTree = "<group>"; };
332387350F7838AC00DD75C5 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
+ 3324F7BD129D744D00EE6A22 /* ActionConfigurator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionConfigurator.h; sourceTree = "<group>"; };
+ 3324F7BE129D744D00EE6A22 /* ActionConfigurator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActionConfigurator.mm; sourceTree = "<group>"; };
332BCA980F71621400585DBD /* ascii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ascii.h; sourceTree = "<group>"; };
332BCA990F71621400585DBD /* asciitab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asciitab.h; sourceTree = "<group>"; };
332BCA9A0F71621400585DBD /* expat.dsp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = expat.dsp; sourceTree = "<group>"; };
@@ -394,8 +396,6 @@
3334D4A2101385060077948A /* tilt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tilt.png; sourceTree = "<group>"; };
3334D4BB1014713B0077948A /* globe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = globe.png; sourceTree = "<group>"; };
3334D4D21014740B0077948A /* misc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = misc.png; sourceTree = "<group>"; };
- 3334D4DD1014745F0077948A /* MiscSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MiscSettings.h; sourceTree = "<group>"; };
- 3334D4DE1014745F0077948A /* MiscSettings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MiscSettings.mm; sourceTree = "<group>"; };
3334D995101627130077948A /* alphabet.bengali.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = alphabet.bengali.xml; sourceTree = "<group>"; };
3334D999101627A00077948A /* alphabet.hungarian.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = alphabet.hungarian.xml; sourceTree = "<group>"; };
3334D99B101627DE0077948A /* alphabet.mongolian.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = alphabet.mongolian.xml; sourceTree = "<group>"; };
@@ -612,7 +612,6 @@
3344FDD70F71717C00506EAA /* MixtureLanguageModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MixtureLanguageModel.h; sourceTree = "<group>"; };
3344FDD80F71717C00506EAA /* PPMLanguageModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PPMLanguageModel.cpp; sourceTree = "<group>"; };
3344FDD90F71717C00506EAA /* PPMLanguageModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPMLanguageModel.h; sourceTree = "<group>"; };
- 3344FDDA0F71717C00506EAA /* SymbolAlphabet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolAlphabet.h; sourceTree = "<group>"; };
3344FDDB0F71717C00506EAA /* WordLanguageModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WordLanguageModel.cpp; sourceTree = "<group>"; };
3344FDDC0F71717C00506EAA /* WordLanguageModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WordLanguageModel.h; sourceTree = "<group>"; };
3344FDDE0F71717C00506EAA /* MemoryLeak.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryLeak.cpp; sourceTree = "<group>"; };
@@ -771,8 +770,6 @@
334B1BF011232A8E007A6DFF /* ParametersController.mm */,
332F34B7103D91E5008448D7 /* LanguagesController.h */,
332F34B8103D91E5008448D7 /* LanguagesController.mm */,
- 3334D4DD1014745F0077948A /* MiscSettings.h */,
- 3334D4DE1014745F0077948A /* MiscSettings.mm */,
333B5D4D100F5A93002041C8 /* TextView.h */,
333B5D4E100F5A93002041C8 /* TextView.mm */,
3330BD420FA885FD0035E952 /* IPhoneInputs.h */,
@@ -801,6 +798,8 @@
1D3623250D0F684500981E51 /* DasherAppDelegate.mm */,
3354AF4611ADBAFD006CF570 /* Actions.h */,
3354AF4711ADBAFD006CF570 /* Actions.mm */,
+ 3324F7BD129D744D00EE6A22 /* ActionConfigurator.h */,
+ 3324F7BE129D744D00EE6A22 /* ActionConfigurator.mm */,
33EB48400F72A5680048E7C2 /* DasherScreenCallbacks.h */,
339F8A310FF5088000282847 /* CalibrationController.h */,
339F8A320FF5088000282847 /* CalibrationController.mm */,
@@ -1336,7 +1335,6 @@
3344FDD70F71717C00506EAA /* MixtureLanguageModel.h */,
3344FDD80F71717C00506EAA /* PPMLanguageModel.cpp */,
3344FDD90F71717C00506EAA /* PPMLanguageModel.h */,
- 3344FDDA0F71717C00506EAA /* SymbolAlphabet.h */,
3344FDDB0F71717C00506EAA /* WordLanguageModel.cpp */,
3344FDDC0F71717C00506EAA /* WordLanguageModel.h */,
);
@@ -1643,7 +1641,6 @@
332F32B6103C8A1E008448D7 /* Trainer.cpp in Sources */,
339F8A330FF5088000282847 /* CalibrationController.mm in Sources */,
333B5D4F100F5A93002041C8 /* TextView.mm in Sources */,
- 3334D4DF1014745F0077948A /* MiscSettings.mm in Sources */,
332F34B9103D91E5008448D7 /* LanguagesController.mm in Sources */,
337ECC1B10DD5E0700D0C6A5 /* ExpansionPolicy.cpp in Sources */,
334B1BF111232A8E007A6DFF /* ParametersController.mm in Sources */,
@@ -1722,6 +1719,7 @@
3354AF4811ADBAFD006CF570 /* Actions.mm in Sources */,
337472D3121A976B001A858C /* AlphInfo.cpp in Sources */,
3324F491129C119C00EE6A22 /* IPhoneFilters.mm in Sources */,
+ 3324F7BF129D744D00EE6A22 /* ActionConfigurator.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]