├── .gitignore
├── .gitmodules
├── ECFoundation.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ └── xcschemes
│ ├── ECFoundation Everything.xcscheme
│ ├── ECFoundation Mac.xcscheme
│ ├── ECFoundation Test Mac.xcscheme
│ ├── ECFoundation Test iOS.xcscheme
│ └── ECFoundation iOS.xcscheme
├── ECFoundation.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── xcschemes
│ ├── ECFoundation Everything.xcscheme
│ ├── ECFoundation Mac.xcscheme
│ └── ECFoundation iOS.xcscheme
├── Extras
├── Documentation
│ ├── Table Bindings
│ │ ├── ECT Design.graffle
│ │ └── ECT Design.pages
│ │ │ ├── Contents
│ │ │ └── PkgInfo
│ │ │ ├── QuickLook
│ │ │ ├── Preview.pdf
│ │ │ └── Thumbnail.jpg
│ │ │ ├── buildVersionHistory.plist
│ │ │ └── index.xml.gz
│ └── UI
│ │ ├── ios channel view.png
│ │ ├── ios channels view.png
│ │ ├── ios debug view.png
│ │ └── mac debug menu.png
├── Neu Templates
│ └── ECTests.m
├── Samples
│ ├── Mac
│ │ └── ECLazySample
│ │ │ ├── ECLazySample.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── ECLazySample.xcscheme
│ │ │ ├── ECLazySample.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ │ ├── Resources
│ │ │ ├── ECLoggingSampleMac-Prefix.pch
│ │ │ ├── en.lproj
│ │ │ │ ├── Credits.rtf
│ │ │ │ ├── InfoPlist.strings
│ │ │ │ └── MainMenu.xib
│ │ │ └── info.plist
│ │ │ └── Source
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Prefix
│ │ │ ├── DebugPrefix.pch
│ │ │ ├── ReleasePrefix.pch
│ │ │ └── SharedPrefix.pch
│ │ │ ├── TestClass.h
│ │ │ ├── TestClass.m
│ │ │ └── main.m
│ └── iOS
│ │ ├── ECTStyledLabelSample
│ │ ├── ECTStyledLabelSample.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ └── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ ├── ECTStyledLabelSample.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ ├── Resources
│ │ │ ├── Info.plist
│ │ │ └── en.lproj
│ │ │ │ ├── InfoPlist.strings
│ │ │ │ └── MainViewController.xib
│ │ ├── Scripts
│ │ │ └── test.sh
│ │ └── Source
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── MainViewController.h
│ │ │ ├── MainViewController.m
│ │ │ ├── Prefix
│ │ │ ├── DebugPrefix.pch
│ │ │ ├── ReleasePrefix.pch
│ │ │ └── SharedPrefix.pch
│ │ │ └── main.m
│ │ └── ECTTableBindingsSample
│ │ ├── ECTTableBindingsSample.xcodeproj
│ │ ├── project.pbxproj
│ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ ├── ECTTableBindingsSample.xcworkspace
│ │ └── contents.xcworkspacedata
│ │ ├── Resources
│ │ ├── ArraySection.plist
│ │ ├── Info.plist
│ │ ├── Logo.png
│ │ ├── ObjectSection.plist
│ │ ├── Options.plist
│ │ ├── OptionsSection.plist
│ │ ├── TickableOptionsSection.plist
│ │ └── en.lproj
│ │ │ ├── InfoPlist.strings
│ │ │ ├── MainViewController.xib
│ │ │ └── ObjectViewController.xib
│ │ ├── Scripts
│ │ └── test.sh
│ │ └── Source
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── MainViewController.h
│ │ ├── MainViewController.m
│ │ ├── ModelController.h
│ │ ├── ModelController.m
│ │ ├── ModelObject.h
│ │ ├── ModelObject.m
│ │ ├── ObjectViewController.h
│ │ ├── ObjectViewController.m
│ │ ├── Prefix
│ │ ├── DebugPrefix.pch
│ │ ├── ReleasePrefix.pch
│ │ └── SharedPrefix.pch
│ │ └── main.m
└── Scripts
│ ├── cruisecontrol
│ ├── build-cruisecontrol.sh
│ └── run-tests.sh
│ ├── ios-test.sh
│ ├── mac-test.sh
│ ├── ocunit2junit.rb
│ ├── shared-test.sh
│ ├── test.sh
│ ├── testflight
│ ├── extract-url.py
│ └── upload.sh
│ └── updateversion.sh
├── LICENSE.md
├── Modules
├── ECAnalytics
│ ├── README.md
│ └── iOS
│ │ ├── ECAnalyticsBackEnd.h
│ │ ├── ECAnalyticsBackEnd.m
│ │ ├── ECAnalyticsBackEndCrashlytics.h
│ │ ├── ECAnalyticsBackEndCrashlytics.m
│ │ ├── ECAnalyticsBackEndFlurry.h
│ │ ├── ECAnalyticsBackEndFlurry.m
│ │ ├── ECAnalyticsBackEndLogging.h
│ │ ├── ECAnalyticsBackEndLogging.m
│ │ ├── ECAnalyticsBackEndNull.h
│ │ ├── ECAnalyticsBackEndNull.m
│ │ ├── ECAnalyticsBackEndTestflight.h
│ │ ├── ECAnalyticsBackEndTestflight.m
│ │ ├── ECAnalyticsBackEndWebtrends.h
│ │ ├── ECAnalyticsBackEndWebtrends.m
│ │ ├── ECAnalyticsEngine.h
│ │ ├── ECAnalyticsEngine.m
│ │ ├── ECAnalyticsEvent.h
│ │ ├── ECAnalyticsEvent.m
│ │ ├── ECAnalyticsEventTarget.h
│ │ ├── ECAnalyticsLogging.h
│ │ ├── ECAnalyticsLogging.m
│ │ ├── ECAnalyticsStandardKeys.h
│ │ └── ECAnalyticsStandardKeys.m
├── ECAppKit
│ ├── aboutbox
│ │ ├── ECAboutBoxController.h
│ │ ├── ECAboutBoxController.m
│ │ └── ECAboutBoxInfoProvider.h
│ ├── application
│ │ ├── ECAppDelegate.h
│ │ └── ECAppDelegate.m
│ ├── cells
│ │ ├── ECTextFieldCell.h
│ │ ├── ECTextFieldCell.m
│ │ ├── ECWhiteBorderButtonCell.h
│ │ └── ECWhiteBorderButtonCell.m
│ ├── formatting
│ │ ├── ECIsEmptyTransformer.h
│ │ ├── ECIsEmptyTransformer.m
│ │ ├── ECIsNotEmptyTransformer.h
│ │ ├── ECIsNotEmptyTransformer.m
│ │ ├── ECIsValueTransformer.h
│ │ ├── ECIsValueTransformer.m
│ │ ├── ECLegalFilenameFormatter.h
│ │ └── ECLegalFilenameFormatter.m
│ ├── licensing
│ │ ├── ECAquaticPrime.h
│ │ ├── ECAquaticPrime.m
│ │ ├── ECCompoundLicenseChecker.h
│ │ ├── ECCompoundLicenseChecker.m
│ │ ├── ECLicenseChecker.h
│ │ ├── ECLicenseChecker.m
│ │ ├── ECMacStore.h
│ │ ├── ECMacStore.m
│ │ ├── ECMacStoreDifferentVersion.h
│ │ ├── ECMacStoreDifferentVersion.m
│ │ ├── ECMacStoreExact.h
│ │ ├── ECMacStoreExact.m
│ │ ├── ECMacStoreReceipt.h
│ │ ├── ECMacStoreReceipt.m
│ │ ├── ECMacStoreSaved.h
│ │ ├── ECMacStoreSaved.m
│ │ ├── ECMacStoreTest.h
│ │ └── ECMacStoreTest.m
│ ├── menus
│ │ ├── ECDebugMenu.h
│ │ └── ECDebugMenu.m
│ ├── preferences
│ │ ├── ECPreferencePaneProtocol.h
│ │ ├── ECPreferencePanel.h
│ │ ├── ECPreferencePanel.m
│ │ ├── ECPreferencesController.h
│ │ ├── ECPreferencesController.m
│ │ └── sparkle
│ │ │ ├── ECSparklePreferenceController.h
│ │ │ └── ECSparklePreferenceController.m
│ ├── tables
│ │ ├── ECDraggableArrayController.h
│ │ ├── ECDraggableArrayController.m
│ │ ├── ECDraggableFileArrayController.h
│ │ └── ECDraggableFileArrayController.m
│ ├── views
│ │ ├── ECCompletionTextView.h
│ │ ├── ECCompletionTextView.m
│ │ ├── ECFilledView.h
│ │ ├── ECFilledView.m
│ │ ├── ECGradientTextView.h
│ │ ├── ECGradientTextView.m
│ │ ├── ECRoundedImageCell.h
│ │ ├── ECRoundedImageCell.m
│ │ ├── ECRoundedView.h
│ │ └── ECRoundedView.m
│ └── windows
│ │ ├── ECTransparentWindow.h
│ │ └── ECTransparentWindow.m
├── ECLocation
│ └── Generic
│ │ ├── CLLocation+ECLocation.h
│ │ ├── CLLocation+ECLocation.m
│ │ ├── ECLocationUtilities.h
│ │ └── ECLocationUtilities.m
├── ECNetwork
│ └── Mac
│ │ ├── ECLaunchD.h
│ │ ├── ECLaunchD.m
│ │ ├── ECMachPorts.h
│ │ ├── ECMachPorts.m
│ │ ├── ECUnixPorts.h
│ │ └── ECUnixPorts.m
└── ECUtilities
│ ├── dictionary
│ ├── ECDictionaryBackedObject.h
│ ├── ECDictionaryBackedObject.m
│ ├── ECDictionaryBackedObjectCache.h
│ ├── ECDictionaryBackedObjectCache.m
│ └── tests
│ │ ├── ECDictionaryBackedObjectCacheTests.m
│ │ ├── ECDictionaryBackedObjectTests.m
│ │ ├── TestDictionaryBackedObject.h
│ │ └── TestDictionaryBackedObject.m
│ ├── misc
│ ├── ECCommonKeys.h
│ ├── ECCommonKeys.m
│ ├── ECDataItem.h
│ ├── ECDataItem.m
│ ├── ECDataItemTests.h
│ └── ECDataItemTests.m
│ ├── networking
│ ├── ECReachability.h
│ └── ECReachability.m
│ └── xml
│ ├── ECXMLElement.h
│ ├── ECXMLElement.m
│ ├── ECXMLParser.h
│ └── ECXMLParser.m
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # A template for git ignore
2 |
3 | # Mac OS X Finder and whatnot
4 | .DS_Store
5 |
6 |
7 | # Sparkle distribution Private Key (Don't check me in!)
8 | dsa_priv.pem
9 |
10 |
11 | # XCode (and ancestors) per-user config (very noisy, and not relevant)
12 | *.mode1
13 | *.mode1v3
14 | *.mode2v3
15 | *.perspective
16 | *.perspectivev3
17 | *.pbxuser
18 | *xcuserdata*
19 | *.xcuserdatad
20 | *.xcuserdata
21 | */xcuserdata
22 |
23 | # Generated files
24 | VersionX-revision.h
25 |
26 |
27 | # build products
28 | build/
29 | *.o
30 |
31 | # Other source repository archive directories (protects when importing)
32 | .hg
33 | .svn
34 | CVS
35 |
36 | # automatic backup files
37 | *~.nib
38 | *.swp
39 | *~
40 | *~.rtf
41 | *.orig
42 | *(Autosaved).rtfd/
43 | Backup[ ]of[ ]*.pages/
44 | Backup[ ]of[ ]*.key/
45 | Backup[ ]of[ ]*.numbers/
46 |
47 |
48 | # compiled python
49 | *.pyc
50 |
51 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Modules/ECUnitTests"]
2 | path = Modules/ECUnitTests
3 | url = git://github.com/elegantchaos/ECUnitTests.git
4 | [submodule "Modules/ECCore"]
5 | path = Modules/ECCore
6 | url = git://github.com/elegantchaos/ECCore.git
7 | [submodule "Modules/ECLogging"]
8 | path = Modules/ECLogging
9 | url = git://github.com/elegantchaos/ECLogging.git
10 | [submodule "Modules/ECText"]
11 | path = Modules/ECText
12 | url = git://github.com/elegantchaos/ECText.git
13 | [submodule "Modules/ECTouch"]
14 | path = Modules/ECTouch
15 | url = git://github.com/elegantchaos/ECTouch.git
16 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/xcshareddata/xcschemes/ECFoundation Everything.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
51 |
52 |
54 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/xcshareddata/xcschemes/ECFoundation Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
52 |
53 |
54 |
55 |
61 |
62 |
64 |
65 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/xcshareddata/xcschemes/ECFoundation Test Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
14 |
15 |
17 |
23 |
24 |
25 |
26 |
27 |
36 |
37 |
38 |
39 |
45 |
46 |
48 |
49 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/xcshareddata/xcschemes/ECFoundation Test iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
14 |
15 |
17 |
23 |
24 |
25 |
26 |
27 |
36 |
37 |
38 |
39 |
45 |
46 |
48 |
49 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ECFoundation.xcodeproj/xcshareddata/xcschemes/ECFoundation iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
51 |
52 |
54 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/ECFoundation.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ECFoundation.xcworkspace/xcshareddata/xcschemes/ECFoundation Everything.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
64 |
65 |
66 |
67 |
75 |
76 |
78 |
79 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/ECFoundation.xcworkspace/xcshareddata/xcschemes/ECFoundation Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
54 |
55 |
56 |
57 |
65 |
66 |
68 |
69 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/ECFoundation.xcworkspace/xcshareddata/xcschemes/ECFoundation iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
54 |
55 |
56 |
57 |
65 |
66 |
68 |
69 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Extras/Documentation/Table Bindings/ECT Design.pages/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | ????????
--------------------------------------------------------------------------------
/Extras/Documentation/Table Bindings/ECT Design.pages/QuickLook/Preview.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/Table Bindings/ECT Design.pages/QuickLook/Preview.pdf
--------------------------------------------------------------------------------
/Extras/Documentation/Table Bindings/ECT Design.pages/QuickLook/Thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/Table Bindings/ECT Design.pages/QuickLook/Thumbnail.jpg
--------------------------------------------------------------------------------
/Extras/Documentation/Table Bindings/ECT Design.pages/buildVersionHistory.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | pages-trunk-20080703_5
6 | pages-trunk-20080707_3
7 | pages-trunk-20080904_1
8 | local build-Nov 17 2010
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Extras/Documentation/Table Bindings/ECT Design.pages/index.xml.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/Table Bindings/ECT Design.pages/index.xml.gz
--------------------------------------------------------------------------------
/Extras/Documentation/UI/ios channel view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/UI/ios channel view.png
--------------------------------------------------------------------------------
/Extras/Documentation/UI/ios channels view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/UI/ios channels view.png
--------------------------------------------------------------------------------
/Extras/Documentation/UI/ios debug view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/UI/ios debug view.png
--------------------------------------------------------------------------------
/Extras/Documentation/UI/mac debug menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Documentation/UI/mac debug menu.png
--------------------------------------------------------------------------------
/Extras/Neu Templates/ECTests.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author {{ userFullName }}
3 | //! @date {% now | date_format: "dd/MM/yyyy" %}
4 | //
5 | // Copyright {% now | date_format: "yyyy" %} Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECTestCase.h"
11 |
12 |
13 | @interface {{ fileName }} : ECTestCase
14 |
15 | @end
16 |
17 | @implementation {{ fileName }}
18 |
19 | - (void)test
20 | {
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/ECLazySample.xcodeproj/xcshareddata/xcschemes/ECLazySample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
41 |
49 |
50 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
68 |
74 |
75 |
76 |
77 |
79 |
80 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/ECLazySample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Resources/ECLoggingSampleMac-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'ECLoggingSampleMac' target in the 'ECLoggingSampleMac' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Resources/en.lproj/Credits.rtf:
--------------------------------------------------------------------------------
1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2 | {\colortbl;\red255\green255\blue255;}
3 | \paperw9840\paperh8400
4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5 |
6 | \f0\b\fs24 \cf0 Engineering:
7 | \b0 \
8 | Some people\
9 | \
10 |
11 | \b Human Interface Design:
12 | \b0 \
13 | Some other people\
14 | \
15 |
16 | \b Testing:
17 | \b0 \
18 | Hopefully not nobody\
19 | \
20 |
21 | \b Documentation:
22 | \b0 \
23 | Whoever\
24 | \
25 |
26 | \b With special thanks to:
27 | \b0 \
28 | Mom\
29 | }
30 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Resources/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.elegantchaos.eclazysample
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | ${MACOSX_DEPLOYMENT_TARGET}
27 | NSHumanReadableCopyright
28 | Copyright © 2011 Sam Deane, Elegant Chaos. All rights reserved.
29 | NSMainNibFile
30 | MainMenu
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ECLoggingSampleMac
4 | //
5 | // Created by Sam Deane on 29/09/2011.
6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : NSObject
12 |
13 | @property (assign) IBOutlet NSWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/Prefix/DebugPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECCoreDebugPrefix.pch"
12 | #import "SharedPrefix.pch"
13 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/Prefix/ReleasePrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECCoreReleasePrefix.pch"
12 | #import "SharedPrefix.pch"
13 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/Prefix/SharedPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import
12 |
13 | #ifdef __OBJC__
14 |
15 | #import "ECLogging.h"
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/TestClass.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestClass.h
3 | // ECLazySample
4 | //
5 | // Created by Sam Deane on 15/11/2011.
6 | // Copyright (c) 2011 Elegant Chaos. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "ECLazyProperties.h"
12 |
13 | @interface TestClass : NSObject
14 |
15 | @property (nonatomic, retain) NSString* test;
16 |
17 | @end
18 |
19 |
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/TestClass.m:
--------------------------------------------------------------------------------
1 | //
2 | // TestClass.m
3 | // ECLazySample
4 | //
5 | // Created by Sam Deane on 15/11/2011.
6 | // Copyright (c) 2011 Elegant Chaos. All rights reserved.
7 | //
8 |
9 | #import "TestClass.h"
10 |
11 | @implementation TestClass
12 |
13 | @synthesize test;
14 |
15 | + (void)initialize
16 | {
17 | if (self == [TestClass class])
18 | {
19 | [self initializeLazyProperties];
20 | }
21 | }
22 |
23 | @lazy_synthesize(test, @"test value");
24 |
25 | @end
--------------------------------------------------------------------------------
/Extras/Samples/Mac/ECLazySample/Source/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ECLoggingSampleMac
4 | //
5 | // Created by Sam Deane on 29/09/2011.
6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | return NSApplicationMain(argc, (const char **)argv);
14 | }
15 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/ECTStyledLabelSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/ECTStyledLabelSample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFiles
12 |
13 | CFBundleIdentifier
14 | com.elegantchaos.ecfoundation.${PRODUCT_NAME:rfc1034identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Scripts/test.sh:
--------------------------------------------------------------------------------
1 | echo Testing iOS ECTStyledLabelSample
2 |
3 | base=`dirname $0`
4 | source "$base/../../../../Scripts/shared-test.sh"
5 | targetIOS="ECTStyledLabelSample"
6 |
7 | # build the framework
8 |
9 | xcodebuild -target "$targetIOS" $config -sdk "$sdkIOS" clean build
10 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ECStyledLabelSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "ECTAppDelegate.h"
10 |
11 | @interface AppDelegate : ECTAppDelegate
12 | @end
13 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ECStyledLabelSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "MainViewController.h"
11 |
12 | #import "ECLogging.h"
13 |
14 | @interface AppDelegate()
15 |
16 |
17 | @end
18 |
19 | @implementation AppDelegate
20 |
21 | - (UIViewController*)newRootViewController
22 | {
23 | MainViewController* view = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
24 | UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:view];
25 | [view release];
26 |
27 | return navigation;
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/MainViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainViewController.h
3 | // ECStyledLabelSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ECTTappableStyledLabel.h"
11 |
12 | @class ECTStyledLabel;
13 | @class ECTTappableStyledLabel;
14 |
15 | @interface MainViewController : UIViewController
16 |
17 | @property (strong, nonatomic) IBOutlet UITextView* textViewMarkdown;
18 | @property (strong, nonatomic) IBOutlet ECTStyledLabel* labelScrolling;
19 | @property (strong, nonatomic) IBOutlet ECTStyledLabel* labelStyled;
20 | @property (strong, nonatomic) IBOutlet ECTTappableStyledLabel* labelTappable;
21 | - (IBAction)textViewDidChange:(id)sender;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/MainViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MainViewController.m
3 | // ECStyledLabelSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "MainViewController.h"
10 |
11 | #import "ECDebugViewController.h"
12 | #import "ECDebugViewPopoverController.h"
13 | #import "ECMarkdownParser.h"
14 | #import "ECDocumentStyles+UIKit.h"
15 |
16 | #import "ECTPopoverBarButtonItem.h"
17 | #import "ECTStyledLabel.h"
18 |
19 | @interface MainViewController()
20 |
21 | - (void)updateStyledText;
22 |
23 | @end
24 |
25 | @implementation MainViewController
26 |
27 | #pragma mark - Properties
28 |
29 | @synthesize labelStyled;
30 | @synthesize labelScrolling;
31 | @synthesize labelTappable;
32 | @synthesize textViewMarkdown;
33 |
34 | - (void)dealloc
35 | {
36 | [labelScrolling release];
37 | [labelStyled release];
38 | [labelTappable release];
39 | [textViewMarkdown release];
40 |
41 | [super dealloc];
42 | }
43 |
44 | - (void)didReceiveMemoryWarning
45 | {
46 | [super didReceiveMemoryWarning];
47 | }
48 |
49 | #pragma mark - View lifecycle
50 |
51 | - (void)viewDidLoad
52 | {
53 | [super viewDidLoad];
54 |
55 | UIBarButtonItem* debugButton = [[ECTPopoverBarButtonItem alloc] initWithTitle:@"Debug" style:UIBarButtonItemStylePlain content:@"ECDebugViewPopoverController"];
56 | self.navigationItem.rightBarButtonItem = debugButton;
57 | [debugButton release];
58 |
59 | self.title = @"ECStyledLabel Test Bed";
60 | }
61 |
62 | - (void)viewDidUnload
63 | {
64 | self.labelStyled = nil;
65 | self.labelScrolling = nil;
66 | self.labelTappable = nil;
67 | self.textViewMarkdown = nil;
68 |
69 | [super viewDidUnload];
70 | }
71 |
72 | - (void)viewWillAppear:(BOOL)animated
73 | {
74 | [super viewWillAppear:animated];
75 | [self updateStyledText];
76 | }
77 |
78 | - (void)updateStyledText
79 | {
80 | NSString* markdown = self.textViewMarkdown.text;
81 | ECDocumentStyles* styles = [self.labelStyled defaultStyles];
82 | ECMarkdownParser* parser = [[ECMarkdownParser alloc] initWithStyles:styles];
83 | NSAttributedString* text = [parser attributedStringFromMarkdown:markdown];
84 | self.labelStyled.attributedText = text;
85 | self.labelScrolling.attributedText = text;
86 | self.labelTappable.attributedText = text;
87 | [parser release];
88 | }
89 |
90 | #pragma mark - UITextViewDelegate
91 |
92 | - (IBAction)textViewDidChange:(id)sender
93 | {
94 | [self updateStyledText];
95 | }
96 |
97 | #pragma mark - ECTappableStyledLabelDelegate
98 |
99 | - (void)styledLabel:(ECTTappableStyledLabel *)styledLabel didTapLink:(NSString *)link position:(CGPoint)position
100 | {
101 | NSLog(@"link was %@, at %@", link, NSStringFromCGPoint(position));
102 | }
103 |
104 | @end
105 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/Prefix/DebugPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECCoreDebugPrefix.pch"
12 |
13 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/Prefix/ReleasePrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import
12 |
13 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/Prefix/SharedPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import
12 |
13 | #ifndef __IPHONE_4_0
14 | #warning "This project uses features only available in iOS SDK 4.0 and later."
15 | #endif
16 |
17 | #ifdef __OBJC__
18 | #import
19 | #import
20 | #endif
21 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTStyledLabelSample/Source/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ECStyledLabelSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/ECTTableBindingsSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/ECTTableBindingsSample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/ArraySection.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | section
6 |
7 | header
8 | Array Binding
9 | footer
10 | This section is bound to the model.objects array. The information to set up the section came from ArraySection.plist. Each row in the table corresponds to one item in the model.objects array. Tapping on a row pushes an ObjectViewController onto the navigation stack for that row's object.
11 | canMove
12 |
13 |
14 | everyRow
15 |
16 | mappings
17 |
18 | value
19 | name
20 | detail
21 | label
22 | image
23 | image
24 |
25 | canMove
26 |
27 | disclosure
28 |
29 | class
30 | ObjectViewController
31 |
32 |
33 | add
34 |
35 | label
36 | Add Object
37 | action
38 | tappedAdd:
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFiles
12 |
13 | CFBundleIdentifier
14 | com.elegantchaos.ecfoundation.${PRODUCT_NAME:rfc1034identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elegantchaos/ECFoundation/4dc7d29d2f1c380107f2043564ca80a57169015b/Extras/Samples/iOS/ECTTableBindingsSample/Resources/Logo.png
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/ObjectSection.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | section
6 |
7 | header
8 | Object Binding
9 | footer
10 | This section is bound to an individual model object
11 |
12 | everyRow
13 |
14 | font
15 |
16 | label
17 |
18 | name
19 | Marker Felt
20 | size
21 | 16
22 |
23 | detail
24 |
25 | name
26 | Marker Felt
27 | size
28 | 14
29 |
30 |
31 |
32 | individualRows
33 |
34 |
35 | mappings
36 |
37 | value
38 | name
39 |
40 | label
41 | Name
42 | cellClass
43 | ECTEditableCell
44 |
45 |
46 | mappings
47 |
48 | value
49 | label
50 |
51 | label
52 | Label
53 | cellClass
54 | ECTSubtitleCell
55 |
56 |
57 | mappings
58 |
59 | value
60 | enabled
61 |
62 | label
63 | Enabled
64 | cellClass
65 | ECTSwitchCell
66 |
67 |
68 | mappings
69 |
70 | value
71 | name
72 |
73 | cellClass
74 | ECTButtonCell
75 | action
76 | tappedButton:
77 |
78 |
79 | mappings
80 |
81 | value
82 | option
83 |
84 | label
85 | Option
86 | disclosure
87 |
88 | detail
89 | ECTSectionDrivenTableController
90 | style
91 | grouped
92 | title
93 | Choose An Option
94 | sections
95 | TickableOptionsSection
96 | autoPop
97 |
98 | back
99 | Cancel
100 |
101 |
102 |
103 | mappings
104 |
105 | value
106 | option
107 |
108 | label
109 | Option
110 | disclosure
111 |
112 | detail
113 | ECTSectionDrivenTableController
114 | style
115 | grouped
116 | title
117 | Choose An Option
118 | sections
119 | OptionsSection
120 | back
121 | Cancel
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/Options.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Item 1
6 | Item 2
7 | Item 3
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/OptionsSection.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | section
6 |
7 | header
8 | Some Options
9 | footer
10 | This section is bound to an array of options defined in the file OptionsSection.plist
11 | canSelect
12 |
13 |
14 | everyRow
15 |
16 | individualRows
17 |
18 | content
19 | Options
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/TickableOptionsSection.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | section
6 |
7 | header
8 | Some Options
9 | footer
10 | This section is bound to an array of options defined in the file OptionsSection.plist
11 | canSelect
12 |
13 |
14 | everyRow
15 |
16 | cellClass
17 | ECTTickCell
18 |
19 | individualRows
20 |
21 | content
22 | Options
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Scripts/test.sh:
--------------------------------------------------------------------------------
1 | echo Testing iOS ECTTableBindingsSample
2 |
3 | base=`dirname $0`
4 | source "$base/../../../../Scripts/shared-test.sh"
5 | targetIOS="ECTTableBindingsSample"
6 |
7 | # build the framework
8 |
9 | xcodebuild -target "$targetIOS" $config -sdk "$sdkIOS" clean build
10 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/AppDelegate.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ECTAppDelegate.h"
10 |
11 | @class ECLoggingSampleViewController;
12 |
13 | @interface AppDelegate : ECTAppDelegate
14 |
15 | + (AppDelegate*)sharedInstance;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/AppDelegate.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "AppDelegate.h"
10 | #import "MainViewController.h"
11 | #import "ModelController.h"
12 |
13 | @interface AppDelegate()
14 |
15 |
16 | @end
17 |
18 | @implementation AppDelegate
19 |
20 | #pragma mark - Propertiess
21 |
22 | #pragma mark - App Delegate Methods
23 |
24 | + (AppDelegate*)sharedInstance
25 | {
26 | return (AppDelegate*)[UIApplication sharedApplication].delegate;
27 | }
28 |
29 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
30 | {
31 | BOOL result = [super application:application didFinishLaunchingWithOptions:launchOptions];
32 | if (result)
33 | {
34 | }
35 |
36 | return result;
37 | }
38 |
39 | - (UIViewController*)newRootViewController
40 | {
41 | // Override point for customization after application launch.
42 | MainViewController* view = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
43 | UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:view];
44 | navigation.navigationBar.barStyle = UIBarStyleBlack;
45 | [view release];
46 |
47 | return navigation;
48 | }
49 |
50 | - (ModelController*)newModelController
51 | {
52 | return [[ModelController alloc] init];
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/MainViewController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ECTSingleTableViewController.h"
10 |
11 | @class ECTSectionDrivenTableController;
12 |
13 | @interface MainViewController : ECTSingleTableViewController
14 |
15 | @property (strong, nonatomic) IBOutlet UILabel* labelObjects;
16 |
17 | - (IBAction)tappedDelete:(id)sender;
18 | - (IBAction)tappedAdd:(id)sender;
19 | - (IBAction)tappedRandomise:(id)sender;
20 | - (IBAction)tappedReplace:(id)sender;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ModelController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ECTModelController.h"
10 |
11 | @interface ModelController : ECTModelController
12 |
13 | @property (strong, nonatomic) NSMutableArray* objects;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ModelController.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ModelController.h"
10 | #import "ModelObject.h"
11 |
12 | @implementation ModelController
13 |
14 | @synthesize objects;
15 |
16 | - (void)startup
17 | {
18 | NSMutableArray* objs = [NSMutableArray array];
19 | for (NSUInteger n = 0; n < 10; ++n)
20 | {
21 | ModelObject* object = [[ModelObject alloc] init];
22 | object.name = [NSString stringWithFormat:@"Object %d", n];
23 | object.label = [NSString stringWithFormat:@"label for object %d", n];
24 | object.image = [UIImage imageNamed:@"Logo.png"];
25 | object.option = @"Item 1";
26 | [objs addObject:object];
27 | [object release];
28 | }
29 |
30 | self.objects = objs;
31 | }
32 |
33 | - (void)shutdown
34 | {
35 | self.objects = nil;
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ModelObject.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import
10 |
11 | @interface ModelObject : NSObject
12 |
13 | @property (assign, nonatomic) BOOL enabled;
14 | @property (strong, nonatomic) NSString* label;
15 | @property (strong, nonatomic) NSString* option;
16 | @property (strong, nonatomic) NSString* name;
17 | @property (strong, nonatomic) UIImage* image;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ModelObject.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ModelObject.h"
10 |
11 | @implementation ModelObject
12 |
13 | @synthesize enabled;
14 | @synthesize image;
15 | @synthesize label;
16 | @synthesize name;
17 | @synthesize option;
18 |
19 | - (void)dealloc
20 | {
21 | [image dealloc];
22 | [label release];
23 | [name release];
24 | [option release];
25 |
26 | [super dealloc];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ObjectViewController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ECTSingleTableViewController.h"
10 | #import "ECTSectionDrivenTableController.h"
11 |
12 | @interface ObjectViewController : ECTSingleTableViewController
13 |
14 | - (void)setupForBinding:(ECTBinding*)binding;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/ObjectViewController.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //
4 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
5 | // This source code is distributed under the terms of Elegant Chaos's
6 | // liberal license: http://www.elegantchaos.com/license/liberal
7 | // --------------------------------------------------------------------------
8 |
9 | #import "ObjectViewController.h"
10 |
11 | #import "ECTBinding.h"
12 | #import "ECTSection.h"
13 | #import "ECTButtonCell.h"
14 | #import "ModelObject.h"
15 |
16 | @interface ObjectViewController ()
17 |
18 | @property (strong, nonatomic) ECTBinding* binding;
19 |
20 | @end
21 |
22 | @implementation ObjectViewController
23 |
24 | @synthesize binding;
25 |
26 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
27 | {
28 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
29 | if (self)
30 | {
31 | // Custom initialization
32 | }
33 | return self;
34 | }
35 |
36 | - (void)dealloc
37 | {
38 | [binding release];
39 |
40 | [super dealloc];
41 | }
42 |
43 | - (void)viewDidLoad
44 | {
45 | // make the same section twice, to prove that edits on the object in one section will be reflected in the other one
46 | ECTSection* section1 = [ECTSection sectionWithProperties:@"ObjectSection" boundToObject:self.binding.object];
47 | ECTSection* section2 = [ECTSection sectionWithProperties:@"ObjectSection" boundToObject:self.binding.object];
48 | section2.footer = @"This is another section representing the same object. If you edit the object value in one section, the other one should update.";
49 |
50 | [self.table addSection:section1];
51 | [self.table addSection:section2];
52 | }
53 |
54 | - (void)setupForBinding:(ECTBinding*)bindingIn
55 | {
56 | self.binding = bindingIn;
57 | }
58 |
59 | #pragma mark - Actions
60 |
61 | - (IBAction)tappedButton:(id)sender
62 | {
63 | // when the button it tapped, we modify the label of the model object bound to the cell
64 | ECTButtonCell* cell = sender;
65 | ECTBinding* cellBinding = cell.binding;
66 | ModelObject* object = cellBinding.object;
67 | object.label = [NSString stringWithFormat:@"Button was clicked at %@", [NSDate date]];
68 | }
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/Prefix/DebugPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECCoreDebugPrefix.pch"
12 |
13 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/Prefix/ReleasePrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECCoreReleasePrefix.pch"
12 |
13 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/Prefix/SharedPrefix.pch:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author sam
3 | //! @date 12/04/2011
4 | //
5 | //
6 | // Copyright 2011 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import
12 |
13 | #ifndef __IPHONE_4_0
14 | #warning "This project uses features only available in iOS SDK 4.0 and later."
15 | #endif
16 |
17 | #ifdef __OBJC__
18 | #import
19 | #import
20 | #endif
21 |
--------------------------------------------------------------------------------
/Extras/Samples/iOS/ECTTableBindingsSample/Source/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ECLoggingSample
4 | //
5 | // Created by Sam Deane on 28/07/2011.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Extras/Scripts/cruisecontrol/build-cruisecontrol.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Build the target.
4 | xcodebuild -target "ECFoundation Test Mac" -configuration Debug clean
5 | xcodebuild -target "ECFoundation Test Mac" -configuration Debug build
6 | xcodebuild -target "ECFoundation Test iOS" -configuration Debug clean
7 | xcodebuild -target "ECFoundation Test iOS" -configuration Debug build
8 |
9 |
--------------------------------------------------------------------------------
/Extras/Scripts/cruisecontrol/run-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # If we aren't running from the command line, then exit
4 | if [ "$GHUNIT_CLI" = "" ]; then
5 | exit 0
6 | fi
7 |
8 | export DYLD_ROOT_PATH="$SDKROOT"
9 | export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR"
10 | export IPHONE_SIMULATOR_ROOT="$SDKROOT"
11 |
12 | export MallocScribble=YES
13 | export MallocPreScribble=YES
14 | export MallocGuardEdges=YES
15 | export MallocStackLogging=YES
16 | export MallocStackLoggingNoCompact=YES
17 |
18 | export NSDebugEnabled=YES
19 | export NSZombieEnabled=YES
20 | export NSDeallocateZombies=NO
21 | export NSHangOnUncaughtException=YES
22 | export NSAutoreleaseFreedObjectCheckEnabled=YES
23 |
24 | "$TARGET_BUILD_DIR/$EXECUTABLE_PATH" -RegisterForSystemEvents
25 | RETVAL=$?
26 |
27 | if [ -n "$WRITE_JUNIT_XML" ]; then
28 | MY_TMPDIR=`/usr/bin/getconf DARWIN_USER_TEMP_DIR`
29 | RESULTS_DIR="${MY_TMPDIR}test-results"
30 |
31 | if [ -d "$RESULTS_DIR" ]; then
32 | `$CP -r "$RESULTS_DIR" "$BUILD_DIR" && rm -r "$RESULTS_DIR"`
33 | fi
34 | fi
35 |
36 | exit $RETVAL
37 |
38 |
--------------------------------------------------------------------------------
/Extras/Scripts/ios-test.sh:
--------------------------------------------------------------------------------
1 | echo Testing IOS
2 |
3 | base=`dirname $0`
4 | ecunittests="$base/../../Modules/ECUnitTests/Scripts"
5 | source "$ecunittests/test-common.sh"
6 |
7 | xcodebuild -target "ECFoundation Test iOS" -configuration "$testConfig" -sdk "$testSDKiOS" $testOptions | "$ecunittests/$testConvertOutput"
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Extras/Scripts/mac-test.sh:
--------------------------------------------------------------------------------
1 | echo Testing Mac
2 |
3 | base=`dirname $0`
4 | ecunittests="$base/../../Modules/ECUnitTests/Scripts"
5 | source "$ecunittests/test-common.sh"
6 |
7 | xcodebuild -target "ECFoundation Test Mac" -configuration "$testConfig" -sdk "$testSDKMac" $testOptions | "$ecunittests/$testConvertOutput"
--------------------------------------------------------------------------------
/Extras/Scripts/shared-test.sh:
--------------------------------------------------------------------------------
1 | export config="-configuration Debug"
2 | export sdkIOS="iphonesimulator"
3 |
4 |
--------------------------------------------------------------------------------
/Extras/Scripts/test.sh:
--------------------------------------------------------------------------------
1 | "$base/mac-test.sh"
2 | "$base/ios-test.sh"
3 |
4 |
--------------------------------------------------------------------------------
/Extras/Scripts/testflight/extract-url.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import json
4 | import sys
5 |
6 | result = json.load(sys.stdin)
7 | url = result['config_url']
8 |
9 | print url
10 |
--------------------------------------------------------------------------------
/Extras/Scripts/updateversion.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | PLIST="$1"
4 | if [ "$PLIST" == "" ]; then
5 | PLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
6 | fi
7 |
8 | VERSION=`git log --oneline | wc -l`
9 |
10 | # update the plist in the built app
11 | /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSION" "$PLIST"
12 |
13 | echo "Bumped build number to $VERSION in $PLIST"
14 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This source code is distributed under the terms of Elegant Chaos's [liberal license](http://www.elegantchaos.com/license/liberal).
2 |
3 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/README.md:
--------------------------------------------------------------------------------
1 | What's This?
2 | ============
3 |
4 | This framework implements an abstraction of an Analytics / Crash Reporting framework,
5 | and provides various back-end implementations using different engines.
6 |
7 | Pretty much every engine uses a slightly different model, so we provide a fairly high
8 | level abstraction, and leave the back-end implementations to do their best to map it.
9 |
10 | In our abstraction there are three main areas:
11 |
12 | - event reporting
13 | - error reporting
14 | - exception / crash reporting
15 |
16 |
17 | Events
18 | ------
19 |
20 | Events happen to an object, and are abstracted as having a name and a dictionary of parameters.
21 |
22 | You can either log an untimed event (which just "happens"), or you can
23 | log the start of the event (which gives you back an object to store), and later use
24 | the object to log the end of the event.
25 |
26 |
27 | Errors
28 | ------
29 |
30 | Errors can be reported as an NSError object plus an optional message.
31 |
32 |
33 | Exceptions / Crashes
34 | --------------------
35 |
36 | Exceptions can be reported explicitly (as an NSException object). The abstract engine will
37 | also optionally install a handler to catch uncaught exceptions. This is made optional
38 | because some of the back-end implementations already do this themselves.
39 |
40 |
41 | Event Encoding
42 | --------------
43 |
44 | Events are represented as a name plus a dictionary of parameters. However, some back-end
45 | implementations can only represent events as a single string.
46 |
47 | The event encoding mechanism is provided so that the values some parameters on an event
48 | can automatically get encoded into the event name before the event is reported.
49 |
50 | This allows a uniform interface to be used within the client app, whilst still converting
51 |
52 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEnd.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @class ECAnalyticsEvent;
13 | @class ECAnalyticsEngine;
14 |
15 | // --------------------------------------------------------------------------
16 | //! Abstraction of an analytics back-end. Subclasses should be implemented
17 | //! for a particular system - eg Flurry, Webtrends, TestFlight etc.
18 | // --------------------------------------------------------------------------
19 |
20 | @interface ECAnalyticsBackEnd : NSObject
21 |
22 | #pragma mark - Public Properties
23 |
24 | @property (nonatomic, retain) ECAnalyticsEngine* engine;
25 |
26 | #pragma mark - Public Methods
27 |
28 | - (void)startupWithEngine:(ECAnalyticsEngine*)engine;
29 | - (void)shutdown;
30 | - (void)suspend;
31 | - (void)resume;
32 | - (void)eventUntimed:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters;
33 | - (ECAnalyticsEvent*)eventStart:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters;
34 | - (void)eventEnd:(ECAnalyticsEvent*)event;
35 | - (void)error:(NSError*)error message:(NSString*)message;
36 | - (void)exception:(NSException*)exception;
37 | - (BOOL)hasOwnExceptionHandler;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndCrashlytics.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | // --------------------------------------------------------------------------
13 | //! Analytics back end using the Crashlytics framework for
14 | //! crash reporting.
15 | //! http://beta.crashlytics.com/
16 | // --------------------------------------------------------------------------
17 |
18 | @interface ECAnalyticsBackEndCrashlytics : ECAnalyticsBackEnd
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndCrashlytics.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEndCrashlytics.h"
11 | #import "ECAnalyticsLogging.h"
12 | #import "ECAnalyticsEvent.h"
13 |
14 | #import
15 |
16 | @implementation ECAnalyticsBackEndCrashlytics
17 |
18 | #pragma mark - Object Lifecycle
19 |
20 | // --------------------------------------------------------------------------
21 | //! Perform one-time initialisation of the engine.
22 | // --------------------------------------------------------------------------
23 |
24 | - (void)startupWithEngine:(ECAnalyticsEngine*)engineIn;
25 | {
26 | self.engine = engineIn;
27 |
28 | NSString* token = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CrashlyticsToken"];
29 | if (token)
30 | {
31 | [Crashlytics startWithAPIKey:token];
32 | }
33 |
34 | }
35 |
36 | // --------------------------------------------------------------------------
37 | //! Perform one-time cleanup of the engine.
38 | // --------------------------------------------------------------------------
39 |
40 | - (void)shutdown
41 | {
42 | }
43 |
44 | // --------------------------------------------------------------------------
45 | //! Log an un-timed event.
46 | // --------------------------------------------------------------------------
47 |
48 | - (void)eventUntimed:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters
49 | {
50 | }
51 |
52 | // --------------------------------------------------------------------------
53 | //! Start logging a timed event. Returns the event, which can be ended by calling logTimedEventEnd:
54 | // --------------------------------------------------------------------------
55 |
56 | - (ECAnalyticsEvent*)eventStart:(NSString*)eventName forObject:(id)object parameters:(NSDictionary*)parameters
57 | {
58 | ECAnalyticsEvent* event = [[[ECAnalyticsEvent alloc] initWithName:eventName parameters:parameters] autorelease];
59 |
60 | return event;
61 | }
62 |
63 | // --------------------------------------------------------------------------
64 | //! Finish logging a timed event.
65 | // --------------------------------------------------------------------------
66 |
67 | - (void)eventEnd:(ECAnalyticsEvent*)event
68 | {
69 | }
70 |
71 | // --------------------------------------------------------------------------
72 | //! Log an error.
73 | // --------------------------------------------------------------------------
74 |
75 | - (void)error:(NSError*)error message:(NSString*)message
76 | {
77 | }
78 |
79 | // --------------------------------------------------------------------------
80 | //! Log an exception.
81 | // --------------------------------------------------------------------------
82 |
83 | - (void)exception:(NSException*)exception
84 | {
85 | }
86 |
87 | // --------------------------------------------------------------------------
88 | //! Use the TestFlight exception handling.
89 | // --------------------------------------------------------------------------
90 |
91 | - (BOOL)hasOwnExceptionHandler
92 | {
93 | return YES;
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndFlurry.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 |
13 | @interface ECAnalyticsBackEndFlurry : ECAnalyticsBackEnd
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndLogging.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | // Dummy implementation of ECAnalyticsEngine - simply logs out in response to the various API calls
13 | @interface ECAnalyticsBackEndLogging : ECAnalyticsBackEnd
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndLogging.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 | #import "ECAnalyticsBackEndLogging.h"
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | #import "ECAnalyticsEvent.h"
13 | #import "ECAnalyticsLogging.h"
14 |
15 |
16 | @implementation ECAnalyticsBackEndLogging
17 |
18 | // --------------------------------------------------------------------------
19 | //! Perform one-time initialisation of the engine.
20 | // --------------------------------------------------------------------------
21 |
22 | - (void)startupWithEngine:(ECAnalyticsEngine*)engineIn;
23 | {
24 | self.engine = engineIn;
25 |
26 | ECDebug(AnalyticsChannel, @"startup logging Analytics engine");
27 | }
28 |
29 | // --------------------------------------------------------------------------
30 | //! Perform one-time cleanup of the engine.
31 | // --------------------------------------------------------------------------
32 |
33 | - (void)shutdown
34 | {
35 | ECDebug(AnalyticsChannel, @"shutdown logging Analytics engine");
36 | }
37 |
38 | // --------------------------------------------------------------------------
39 | //! Log an un-timed event.
40 | // --------------------------------------------------------------------------
41 |
42 | - (void)eventUntimed:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters
43 | {
44 | ECDebug(AnalyticsChannel, @"logged untimed event %@ with parameters %@", event, parameters);
45 | }
46 |
47 | // --------------------------------------------------------------------------
48 | //! Start logging a timed event. Returns the event, which can be ended by calling logTimedEventEnd:
49 | // --------------------------------------------------------------------------
50 |
51 | - (ECAnalyticsEvent*)eventStart:(NSString*)eventName forObject:(id)object parameters:(NSDictionary*)parameters
52 | {
53 | ECDebug(AnalyticsChannel, @"started timed event %@ with parameters %@", eventName, parameters);
54 |
55 | ECAnalyticsEvent* event = [[[ECAnalyticsEvent alloc] initWithName:eventName parameters:parameters] autorelease];
56 |
57 | return event;
58 | }
59 |
60 | // --------------------------------------------------------------------------
61 | //! Finish logging a timed event.
62 | // --------------------------------------------------------------------------
63 |
64 | - (void)eventEnd:(ECAnalyticsEvent*)event
65 | {
66 | ECDebug(AnalyticsChannel, @"finished timed event %@ with parameters %@", event.name, event.parameters);
67 | }
68 |
69 | // --------------------------------------------------------------------------
70 | //! Log an error.
71 | // --------------------------------------------------------------------------
72 |
73 | - (void)error:(NSError*)error message:(NSString*)message
74 | {
75 | ECDebug(AnalyticsChannel, @"logged error %@: %@ ", error, message);
76 | }
77 |
78 | // --------------------------------------------------------------------------
79 | //! Log an exception.
80 | // --------------------------------------------------------------------------
81 |
82 | - (void)exception:(NSException*)exception
83 | {
84 | ECDebug(AnalyticsChannel, @"logged exception %@", exception);
85 | }
86 |
87 | @end
88 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndNull.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | // Null implementation of an ECAnalyticsEngine.
13 | // Does nothing with the events - doesn't even produce log output.
14 |
15 | @interface ECAnalyticsBackEndNull : ECAnalyticsBackEnd
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndNull.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 | #import "ECAnalyticsBackEndNull.h"
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | #import "ECAnalyticsEvent.h"
13 |
14 | @implementation ECAnalyticsBackEndNull
15 |
16 | // --------------------------------------------------------------------------
17 | //! Perform one-time initialisation of the engine.
18 | // --------------------------------------------------------------------------
19 |
20 | - (void)startupWithEngine:(ECAnalyticsEngine*)engineIn;
21 | {
22 | self.engine = engineIn;
23 |
24 | }
25 |
26 | // --------------------------------------------------------------------------
27 | //! Perform one-time cleanup of the engine.
28 | // --------------------------------------------------------------------------
29 |
30 | - (void)shutdown
31 | {
32 | }
33 |
34 | // --------------------------------------------------------------------------
35 | //! Log an un-timed event.
36 | // --------------------------------------------------------------------------
37 |
38 | - (void)eventUntimed:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters
39 | {
40 | }
41 |
42 | // --------------------------------------------------------------------------
43 | //! Start logging a timed event. Returns the event, which can be ended by calling logTimedEventEnd:
44 | // --------------------------------------------------------------------------
45 |
46 | - (ECAnalyticsEvent*)eventStart:(NSString*)eventName forObject:(id)object parameters:(NSDictionary*)parameters;
47 | {
48 | ECAnalyticsEvent* event = [[[ECAnalyticsEvent alloc] initWithName:eventName parameters:parameters] autorelease];
49 |
50 | return event;
51 | }
52 |
53 | // --------------------------------------------------------------------------
54 | //! Finish logging a timed event.
55 | // --------------------------------------------------------------------------
56 |
57 | - (void)eventEnd:(ECAnalyticsEvent*)event
58 | {
59 | }
60 |
61 | // --------------------------------------------------------------------------
62 | //! Log an error.
63 | // --------------------------------------------------------------------------
64 |
65 | - (void)error:(NSError*)error message:(NSString*)message
66 | {
67 | }
68 |
69 | // --------------------------------------------------------------------------
70 | //! Log an exception.
71 | // --------------------------------------------------------------------------
72 |
73 | - (void)exception:(NSException*)exception
74 | {
75 | }
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndTestflight.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | @interface ECAnalyticsBackEndTestFlight : ECAnalyticsBackEnd
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndTestflight.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEndTestflight.h"
11 | #import "ECAnalyticsLogging.h"
12 | #import "ECAnalyticsEvent.h"
13 |
14 | #import "TestFlight.h"
15 |
16 | @implementation ECAnalyticsBackEndTestFlight
17 |
18 | #pragma mark - Object Lifecycle
19 |
20 | // --------------------------------------------------------------------------
21 | //! Perform one-time initialisation of the engine.
22 | // --------------------------------------------------------------------------
23 |
24 | - (void)startupWithEngine:(ECAnalyticsEngine*)engineIn;
25 | {
26 | self.engine = engineIn;
27 |
28 | NSString* token = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"TestFlightToken"];
29 | if (token)
30 | {
31 | [TestFlight takeOff:token];
32 | }
33 |
34 | }
35 |
36 | // --------------------------------------------------------------------------
37 | //! Perform one-time cleanup of the engine.
38 | // --------------------------------------------------------------------------
39 |
40 | - (void)shutdown
41 | {
42 | }
43 |
44 | // --------------------------------------------------------------------------
45 | //! Log an un-timed event.
46 | // --------------------------------------------------------------------------
47 |
48 | - (void)eventUntimed:(NSString*)event forObject:(id)object parameters:(NSDictionary*)parameters
49 | {
50 | [TestFlight passCheckpoint:event];
51 | }
52 |
53 | // --------------------------------------------------------------------------
54 | //! Start logging a timed event. Returns the event, which can be ended by calling logTimedEventEnd:
55 | // --------------------------------------------------------------------------
56 |
57 | - (ECAnalyticsEvent*)eventStart:(NSString*)eventName forObject:(id)object parameters:(NSDictionary*)parameters
58 | {
59 | ECAnalyticsEvent* event = [[[ECAnalyticsEvent alloc] initWithName:eventName parameters:parameters] autorelease];
60 |
61 | return event;
62 | }
63 |
64 | // --------------------------------------------------------------------------
65 | //! Finish logging a timed event.
66 | // --------------------------------------------------------------------------
67 |
68 | - (void)eventEnd:(ECAnalyticsEvent*)event
69 | {
70 | [TestFlight passCheckpoint:event.name];
71 | }
72 |
73 | // --------------------------------------------------------------------------
74 | //! Log an error.
75 | // --------------------------------------------------------------------------
76 |
77 | - (void)error:(NSError*)error message:(NSString*)message
78 | {
79 | [TestFlight passCheckpoint:[NSString stringWithFormat:@"Error: %@", message]];
80 | }
81 |
82 | // --------------------------------------------------------------------------
83 | //! Log an exception.
84 | // --------------------------------------------------------------------------
85 |
86 | - (void)exception:(NSException*)exception
87 | {
88 | }
89 |
90 | // --------------------------------------------------------------------------
91 | //! Use the TestFlight exception handling.
92 | // --------------------------------------------------------------------------
93 |
94 | - (BOOL)hasOwnExceptionHandler
95 | {
96 | return YES;
97 | }
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsBackEndWebtrends.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsBackEnd.h"
11 |
12 | // Webtrends implementation of an ECAnalyticsEngine.
13 |
14 | @interface ECAnalyticsBackEndWebtrends : ECAnalyticsBackEnd
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsEngine.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | typedef enum
11 | {
12 | DebugOutputOff,
13 | DebugOutputOn,
14 | DebugOutputVerbose
15 | } DebugOutputLevel;
16 |
17 | @class ECAnalyticsEvent;
18 | @class ECAnalyticsBackEnd;
19 |
20 | // --------------------------------------------------------------------------
21 | //! Public interface to the analytics system.
22 | // --------------------------------------------------------------------------
23 |
24 | @interface ECAnalyticsEngine : NSObject
25 |
26 | #pragma mark - Properties
27 |
28 | @property (assign, nonatomic) DebugOutputLevel debugLevel;
29 |
30 | #pragma mark - Instances
31 |
32 | - (id)initWithBackEnd:(ECAnalyticsBackEnd*)backEnd;
33 | - (id)initWithBackEndClass:(Class)backEndClass;
34 | - (id)initWithBackEndNamed:(NSString*)backEndClassName;
35 |
36 | #pragma mark - Engine management
37 |
38 | - (void)startupUsingExceptionHandler:(BOOL)installingExceptionHandler;
39 | - (void)shutdown;
40 | - (void)suspend;
41 | - (void)resume;
42 |
43 | #pragma mark - Event name encoding
44 |
45 | - (void)setEncodingParameters:(NSArray*)parameters forEventName:(NSString*)eventName;
46 |
47 | #pragma mark - Event parameters
48 |
49 | - (NSMutableDictionary*)parametersForObject:(NSObject*)object forEvent:(NSString*)eventName;
50 |
51 | #pragma mark - Event logging
52 |
53 | - (void)logEvent:(NSString*)event forObject:(id)object;
54 | - (ECAnalyticsEvent*)logEventStart:(NSString*)event forObject:(id)object;
55 | - (void)logEventEnd:(ECAnalyticsEvent*)event;
56 | - (void)logError:(NSError*)errorOrNil message:(NSString*)messageOrNil;
57 | - (void)logException:(NSException*)exception;
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsEvent.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @class ECAnalyticsEvent;
13 |
14 | // --------------------------------------------------------------------------
15 | //! An abstract event the represent something happening in the client application
16 | // --------------------------------------------------------------------------
17 |
18 | @interface ECAnalyticsEvent : NSObject
19 |
20 | #pragma mark - Public Properties
21 |
22 | @property (copy, nonatomic) NSDictionary* parameters; //!< Dictionary of event parameters
23 | @property (copy, nonatomic) NSString* name; //!< Event name
24 | @property (retain, nonatomic) NSDate* start; //!< Time when the event started
25 | @property (assign, nonatomic) id object; //!< Optional user-supplied reference to the object the event is about.
26 |
27 | #pragma mark - Public Methods
28 |
29 | - (id)initWithName:(NSString*)name parameters:(NSDictionary*)parametersOrNil;
30 | - (void)resetParameters;
31 | - (void)updateParameters:(NSDictionary*)updates;
32 | - (NSTimeInterval)elapsedTimeSinceStart;
33 | - (NSString*)elapsedTimeSinceStartQuantised;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsEventTarget.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | // --------------------------------------------------------------------------
11 | //! Protocol allowing an object to describe itself when it's added to an event.
12 | // --------------------------------------------------------------------------
13 |
14 | @protocol ECAnalyticsEventTarget
15 |
16 | - (void)analyticsAddDefaultParametersForEvent:(NSString*)event toDictionary:(NSMutableDictionary*) dictionary;
17 | - (void)analyticsAddDynamicParametersForEvent:(NSString*)event toDictionary:(NSMutableDictionary*) dictionary;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsLogging.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECLogging.h"
11 |
12 | #pragma mark - Shared analytics log channel.
13 |
14 | ECDeclareDebugChannel(AnalyticsChannel);
15 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsLogging.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsLogging.h"
11 |
12 | ECDefineDebugChannel(AnalyticsChannel);
13 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsStandardKeys.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 |
11 | #pragma mark - Standard Event Keys
12 |
13 | extern NSString *const ECAnalyticsMediaEvent;
14 | extern NSString *const ECAnalyticsViewEvent;
15 |
16 | #pragma mark - Standard Property Keys
17 |
18 | extern NSString *const ECAnalyticsDurationParameter;
19 | extern NSString *const ECAnalyticsIDParameter;
20 | extern NSString *const ECAnalyticsMediaEventParameter;
21 | extern NSString *const ECAnalyticsNameParameter;
22 | extern NSString *const ECAnalyticsPathParameter;
23 | extern NSString *const ECAnalyticsSectionParameter;
24 | extern NSString *const ECAnalyticsSubsectionParameter;
25 | extern NSString *const ECAnalyticsTypeParameter;
26 | extern NSString *const ECAnalyticsURLParameter;
27 |
--------------------------------------------------------------------------------
/Modules/ECAnalytics/iOS/ECAnalyticsStandardKeys.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAnalyticsStandardKeys.h"
11 |
12 | NSString *const ECAnalyticsMediaEvent = @"Media";
13 | NSString *const ECAnalyticsViewEvent = @"View";
14 |
15 | NSString *const ECAnalyticsDurationParameter = @"Duration";
16 | NSString *const ECAnalyticsIDParameter = @"ID";
17 | NSString *const ECAnalyticsMediaEventParameter = @"MediaEvent";
18 | NSString *const ECAnalyticsNameParameter = @"Name";
19 | NSString *const ECAnalyticsPathParameter = @"Path";
20 | NSString *const ECAnalyticsSectionParameter = @"Section";
21 | NSString *const ECAnalyticsSubsectionParameter = @"Subsection";
22 | NSString *const ECAnalyticsTypeParameter = @"Type";
23 | NSString *const ECAnalyticsURLParameter = @"URL";
24 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/aboutbox/ECAboutBoxController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 25/02/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | // --------------------------------------------------------------------------
13 | //! Custom About Box controller.
14 | // --------------------------------------------------------------------------
15 |
16 | @interface ECAboutBoxController : NSWindowController
17 | {
18 | // --------------------------------------------------------------------------
19 | // Member Variables
20 | // --------------------------------------------------------------------------
21 |
22 | NSString* mApplicationVersion;
23 | NSString* mApplicationName;
24 | NSString* mApplicationCopyright;
25 | NSString* mApplicationStatus;
26 | NSURL* mApplicationCreditsFile;
27 | NSTimeInterval mAnimationDuration;
28 | BOOL mAnimateFrame;
29 | BOOL mClickToHide;
30 | }
31 |
32 | // --------------------------------------------------------------------------
33 | // Properties
34 | // --------------------------------------------------------------------------
35 |
36 | @property (retain, nonatomic) IBOutlet NSString* applicationName;
37 | @property (retain, nonatomic) IBOutlet NSString* applicationVersion;
38 | @property (retain, nonatomic) IBOutlet NSString* applicationCopyright;
39 | @property (retain, nonatomic) IBOutlet NSString* applicationStatus;
40 | @property (retain, nonatomic) IBOutlet NSURL* applicationCreditsFile;
41 |
42 | // --------------------------------------------------------------------------
43 | // Public Methods
44 | // --------------------------------------------------------------------------
45 |
46 | - (void) showAboutBox;
47 | - (IBAction) alternatePerformClose: (id) sender;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/aboutbox/ECAboutBoxInfoProvider.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 25/02/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @class ECAboutBoxController;
11 |
12 | // --------------------------------------------------------------------------
13 | //! Application Info Provider Protocol
14 | //!
15 | //! The application delegate should implement this to provide
16 | //! extra information to the about box.
17 | // --------------------------------------------------------------------------
18 |
19 | @protocol ECAboutBoxInfoProvider
20 | - (NSString*) aboutBox: (ECAboutBoxController*) aboutBox getValueForKey: (NSString*) key;
21 | @end
22 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/application/ECAppDelegate.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 28/11/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECAboutBoxInfoProvider.h"
11 |
12 | @class ECPreferencesController;
13 | @class ECAboutBoxController;
14 | @class ECLicenseChecker;
15 |
16 | @interface ECAppDelegate : NSObject
17 |
18 | // --------------------------------------------------------------------------
19 | // Public Properties
20 | // --------------------------------------------------------------------------
21 |
22 | @property (nonatomic, retain) ECAboutBoxController* aboutController;
23 | @property (nonatomic, assign) IBOutlet NSMenu* applicationMenu;
24 | @property (nonatomic, assign) IBOutlet NSMenu* dockMenu;
25 | @property (nonatomic, assign) NSFileManager* fileManager;
26 | @property (nonatomic, retain) ECLicenseChecker* licenseChecker;
27 | @property (nonatomic, retain) ECPreferencesController* preferencesController;
28 | @property (nonatomic, assign) IBOutlet NSMenu* statusMenu;
29 |
30 | // --------------------------------------------------------------------------
31 | // Public Methods
32 | // --------------------------------------------------------------------------
33 |
34 | - (ECPreferencesController*) getCachedPreferencesController;
35 | - (NSArray*) getPreferencePanes;
36 | - (void) installLogHandlers;
37 | - (BOOL) setupMacStore;
38 | - (void) stripElegantChaosStoreItemsFromMenu: (NSMenu*) menu;
39 | - (void) stripSparkleItemsFromMenu: (NSMenu*) menu;
40 |
41 | // --------------------------------------------------------------------------
42 | // Actions
43 | // --------------------------------------------------------------------------
44 |
45 | - (IBAction) openSupport: (id) sender;
46 | - (IBAction) openReleaseNotes: (id) sender;
47 | - (IBAction) openWebsite: (id) sender;
48 | - (IBAction) openStore: (id) sender;
49 | - (IBAction) showHelp: (id) sender;
50 | - (IBAction) showAboutBox: (id) sender;
51 | - (IBAction) showPreferences: (id) sender;
52 | - (IBAction) openLicenseFile: (id) sender;
53 | - (IBAction) showUserGuide: (id) sender;
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/cells/ECTextFieldCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ECTextFieldCell.h
3 | //
4 | //! @author Sam Deane
5 | //! @date 25/01/2010
6 | //
7 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
8 | // This source code is distributed under the terms of Elegant Chaos's
9 | // liberal license: http://www.elegantchaos.com/license/liberal
10 | //
11 |
12 | #import
13 |
14 | @interface ECTextFieldCell : NSTextFieldCell
15 | {
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/cells/ECTextFieldCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ECTextFieldCell.m
3 | //
4 | //! @author Sam Deane
5 | //! @date 25/01/2010
6 | //
7 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
8 | // This source code is distributed under the terms of Elegant Chaos's
9 | // liberal license: http://www.elegantchaos.com/license/liberal
10 | //
11 |
12 | #import "ECTextFieldCell.h"
13 | #import "ECLogging.h"
14 |
15 |
16 | @implementation ECTextFieldCell
17 |
18 | ECDefineDebugChannel(ECTextFieldChannel);
19 |
20 | - (id)initTextCell:(NSString *)aString
21 | {
22 | return [super initTextCell:@"blah"];
23 | }
24 |
25 | - (void)setStringValue:(NSString *)aString
26 | {
27 | [super setStringValue:@"blah"];
28 | }
29 |
30 | - (void)setAttributedStringValue:(NSAttributedString *)obj
31 | {
32 | ECDebug(ECTextFieldChannel, @"set att");
33 |
34 | NSMutableAttributedString* modified = [obj mutableCopy];
35 |
36 | [super setAttributedStringValue:modified];
37 |
38 | [modified release];
39 | }
40 |
41 | - (NSRect)titleRectForBounds:(NSRect)theRect
42 | {
43 | NSRect titleFrame = [super titleRectForBounds:theRect];
44 | NSSize titleSize = [[self attributedStringValue] size];
45 | titleFrame.origin.y = theRect.origin.y - 0.5f + (theRect.size.height - titleSize.height) / 2.0f;
46 | return titleFrame;
47 | }
48 |
49 | - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
50 | {
51 | NSRect titleRect = [self titleRectForBounds:cellFrame];
52 | [[self attributedStringValue] drawInRect:titleRect];
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/cells/ECWhiteBorderButtonCell.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 09/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @interface ECWhiteBorderButtonCell : NSButtonCell
11 | {
12 | CGFloat mRadius;
13 | }
14 |
15 | // --------------------------------------------------------------------------
16 | // Public Properties
17 | // --------------------------------------------------------------------------
18 |
19 | // --------------------------------------------------------------------------
20 | // Public Methods
21 | // --------------------------------------------------------------------------
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/cells/ECWhiteBorderButtonCell.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 09/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECWhiteBorderButtonCell.h"
11 |
12 |
13 | // ==============================================
14 | // Private Methods
15 | // ==============================================
16 |
17 | #pragma mark -
18 | #pragma mark Private Methods
19 |
20 | @interface ECWhiteBorderButtonCell()
21 |
22 | @end
23 |
24 |
25 | @implementation ECWhiteBorderButtonCell
26 |
27 | // ==============================================
28 | // Properties
29 | // ==============================================
30 |
31 | #pragma mark -
32 | #pragma mark Properties
33 |
34 | // ==============================================
35 | // Constants
36 | // ==============================================
37 |
38 | #pragma mark -
39 | #pragma mark Constants
40 |
41 | // ==============================================
42 | // Drawing
43 | // ==============================================
44 |
45 | #pragma mark -
46 | #pragma mark Drawing
47 |
48 | // --------------------------------------------------------------------------
49 | //! Set up the object.
50 | // --------------------------------------------------------------------------
51 |
52 | - (void) awakeFromNib
53 | {
54 | mRadius = 16.0f;
55 |
56 | if ([self bezelStyle] == NSRoundRectBezelStyle)
57 | {
58 | if ([self controlSize] == NSRegularControlSize)
59 | {
60 | mRadius = 10.0f;
61 | }
62 | }
63 |
64 | }
65 |
66 | - (NSRect)drawTitle:(NSAttributedString*)title withFrame:(NSRect)frame inView:(NSView*)controlView
67 | {
68 | NSMutableAttributedString* mutable = [title mutableCopy];
69 | NSRange range = NSMakeRange(0, title.length);
70 | NSColor* color = [self isHighlighted] ? [NSColor blackColor] : [NSColor whiteColor];
71 | [mutable addAttribute: NSForegroundColorAttributeName value: color range: range];
72 | [mutable drawInRect: frame];
73 | [mutable release];
74 |
75 | return frame;
76 | }
77 |
78 | - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView
79 | {
80 | frame = NSInsetRect(frame, 1.0f, 1.0f);
81 | NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect: frame xRadius: mRadius yRadius: mRadius];
82 | path.lineWidth = 2.0f;
83 | [[NSColor whiteColor] set];
84 | [path stroke];
85 |
86 | if ([self isHighlighted])
87 | {
88 | [[NSColor whiteColor] setFill];
89 | [path fill];
90 | }
91 | }
92 |
93 | @end
94 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsEmptyTransformer.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 28/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @interface ECIsEmptyTransformer: NSValueTransformer
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsEmptyTransformer.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 28/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECIsEmptyTransformer.h"
11 | #import "ECAssertion.h"
12 |
13 | @implementation ECIsEmptyTransformer
14 |
15 | // --------------------------------------------------------------------------
16 | //! Register transformer.
17 | // --------------------------------------------------------------------------
18 |
19 | + (void)initialize
20 | {
21 | ECIsEmptyTransformer* transformer = [[[ECIsEmptyTransformer alloc] init] autorelease];
22 | [NSValueTransformer setValueTransformer:transformer forName:@"ECIsEmptyTransformer"];
23 | }
24 |
25 | // --------------------------------------------------------------------------
26 | //1 We return a boolean as an NSNumber
27 | // --------------------------------------------------------------------------
28 |
29 | + (Class)transformedValueClass
30 | {
31 | return [NSNumber class];
32 | }
33 |
34 | // --------------------------------------------------------------------------
35 | //! Don't allow reverse transformation.
36 | // --------------------------------------------------------------------------
37 |
38 | + (BOOL)allowsReverseTransformation
39 | {
40 | return NO;
41 | }
42 |
43 | // --------------------------------------------------------------------------
44 | //! Perform the transformation.
45 | // --------------------------------------------------------------------------
46 |
47 | - (id)transformedValue:(id)item
48 | {
49 | ECAssert([item respondsToSelector:@selector(length)]);
50 |
51 | NSString* string = item;
52 | BOOL result = [string length] == 0;
53 | return [NSNumber numberWithBool:result];
54 | }
55 |
56 | @end
57 |
58 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsNotEmptyTransformer.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 28/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @interface ECIsNotEmptyTransformer: NSValueTransformer
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsNotEmptyTransformer.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 28/11/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECIsNotEmptyTransformer.h"
11 | #import "ECAssertion.h"
12 |
13 | @implementation ECIsNotEmptyTransformer
14 |
15 | // --------------------------------------------------------------------------
16 | //! Register transformer.
17 | // --------------------------------------------------------------------------
18 |
19 | + (void)initialize
20 | {
21 | ECIsNotEmptyTransformer* transformer = [[[ECIsNotEmptyTransformer alloc] init] autorelease];
22 | [NSValueTransformer setValueTransformer:transformer forName:@"ECIsNotEmptyTransformer"];
23 | }
24 |
25 | // --------------------------------------------------------------------------
26 | //1 We return a boolean as an NSNumber
27 | // --------------------------------------------------------------------------
28 |
29 | + (Class)transformedValueClass
30 | {
31 | return [NSNumber class];
32 | }
33 |
34 | // --------------------------------------------------------------------------
35 | //! Don't allow reverse transformation.
36 | // --------------------------------------------------------------------------
37 |
38 | + (BOOL)allowsReverseTransformation
39 | {
40 | return NO;
41 | }
42 |
43 | // --------------------------------------------------------------------------
44 | //! Perform the transformation.
45 | // --------------------------------------------------------------------------
46 |
47 | - (id)transformedValue:(id)item
48 | {
49 | id result = item;
50 | if (item)
51 | {
52 | ECAssert([item respondsToSelector:@selector(length)]);
53 |
54 | result = [NSNumber numberWithBool:[(NSString*)item length] != 0];
55 | }
56 |
57 | return result;
58 | }
59 |
60 | @end
61 |
62 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsValueTransformer.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 17/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @interface ECIsValueTransformer: NSValueTransformer
11 | {
12 |
13 | }
14 |
15 | // --------------------------------------------------------------------------
16 | // Public Properties
17 | // --------------------------------------------------------------------------
18 |
19 | // --------------------------------------------------------------------------
20 | // Public Methods
21 | // --------------------------------------------------------------------------
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECIsValueTransformer.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 17/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECIsValueTransformer.h"
11 |
12 |
13 | // ==============================================
14 | // Private Methods
15 | // ==============================================
16 |
17 | #pragma mark -
18 | #pragma mark Private Methods
19 |
20 | @interface ECIsValueTransformer()
21 |
22 | @end
23 |
24 |
25 | @implementation ECIsValueTransformer
26 |
27 | // ==============================================
28 | // Properties
29 | // ==============================================
30 |
31 | #pragma mark -
32 | #pragma mark Properties
33 |
34 | // ==============================================
35 | // Constants
36 | // ==============================================
37 |
38 | #pragma mark -
39 | #pragma mark Constants
40 |
41 | // ==============================================
42 | // Lifecycle
43 | // ==============================================
44 |
45 | #pragma mark -
46 | #pragma mark Methods
47 |
48 | + (void)initialize
49 | {
50 | ECIsValueTransformer *nameTransformer = [[[ECIsValueTransformer alloc] init] autorelease];
51 | [NSValueTransformer setValueTransformer:nameTransformer forName:@"ECIsValueTransformer"];
52 | }
53 |
54 | // --------------------------------------------------------------------------
55 | //! Set up the object.
56 | // --------------------------------------------------------------------------
57 |
58 | - (id) init
59 | {
60 | if ((self = [super init]) != nil)
61 | {
62 |
63 | }
64 |
65 | return self;
66 | }
67 |
68 | // --------------------------------------------------------------------------
69 | //! Clean up and release retained objects.
70 | // --------------------------------------------------------------------------
71 |
72 | - (void) dealloc
73 | {
74 | [super dealloc];
75 | }
76 |
77 | + (Class)transformedValueClass { return [NSString class]; }
78 | + (BOOL)allowsReverseTransformation { return NO; }
79 |
80 | - (id)transformedValue:(id)item
81 | {
82 | BOOL result = [item integerValue] == 3;
83 | return [NSNumber numberWithBool:result];
84 | }
85 |
86 | @end
87 |
88 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECLegalFilenameFormatter.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 11/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 |
13 | @interface ECLegalFilenameFormatter : NSFormatter
14 | {
15 | // --------------------------------------------------------------------------
16 | // Member Variables
17 | // --------------------------------------------------------------------------
18 |
19 | NSCharacterSet* mIllegalCharacters;
20 | }
21 |
22 | // --------------------------------------------------------------------------
23 | // Public Methods
24 | // --------------------------------------------------------------------------
25 |
26 | - (BOOL) illegalCharactersInString: (NSString*) string;
27 |
28 | @end
29 |
30 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/formatting/ECLegalFilenameFormatter.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 11/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECLegalFilenameFormatter.h"
11 |
12 |
13 | @implementation ECLegalFilenameFormatter
14 |
15 | // --------------------------------------------------------------------------
16 | //! Initialise
17 | // --------------------------------------------------------------------------
18 |
19 | - (id) init
20 | {
21 | if ((self = [super init]) != nil)
22 | {
23 | mIllegalCharacters = [NSCharacterSet characterSetWithCharactersInString: @":"];
24 | [mIllegalCharacters retain];
25 | }
26 |
27 | return self;
28 | }
29 |
30 | // --------------------------------------------------------------------------
31 | //! Cleanup.
32 | // --------------------------------------------------------------------------
33 |
34 | - (void) dealloc
35 | {
36 | [mIllegalCharacters release];
37 | [super dealloc];
38 | }
39 |
40 | // --------------------------------------------------------------------------
41 | //! Turn an input object into a string. We only accept strings as valid input.
42 | // --------------------------------------------------------------------------
43 |
44 | - (NSString*) stringForObjectValue:(id) anObject
45 | {
46 | NSString* result = nil;
47 |
48 | if ([anObject isKindOfClass:[NSString class]])
49 | {
50 | result = anObject;
51 | }
52 |
53 | return result;
54 | }
55 |
56 | // --------------------------------------------------------------------------
57 | //! Get an output object for the string. We just return the string.
58 | // --------------------------------------------------------------------------
59 |
60 | - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(NSString **)error
61 | {
62 | *obj = string;
63 | return YES;
64 | }
65 |
66 | // --------------------------------------------------------------------------
67 | //! Get an attributed string. We don't add any extra attributes.
68 | // --------------------------------------------------------------------------
69 |
70 | - (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes
71 | {
72 | NSAttributedString* result = [[NSAttributedString alloc] initWithString: [self stringForObjectValue: anObject]];
73 |
74 | return [result autorelease];
75 | }
76 |
77 | // --------------------------------------------------------------------------
78 | //! Does the string contain illegal characters.
79 | // --------------------------------------------------------------------------
80 |
81 | - (BOOL) illegalCharactersInString: (NSString*) string
82 | {
83 | return ([string rangeOfCharacterFromSet: mIllegalCharacters].length != 0);
84 | }
85 |
86 | // --------------------------------------------------------------------------
87 | //! Validate the string.
88 | //! We dissallow any characters that are illegal in filenames.
89 | //! We also dissallow names that begin with '.'.
90 | // --------------------------------------------------------------------------
91 |
92 | - (BOOL) isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error
93 | {
94 | BOOL startsWithDot = ([partialString length] > 0) && ([partialString characterAtIndex:0] == '.');
95 | BOOL ok = !startsWithDot && ![self illegalCharactersInString: partialString];
96 |
97 | if (!ok)
98 | {
99 | *error = @"Illegal character.";
100 | }
101 |
102 | return ok;
103 | }
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/licensing/ECAquaticPrime.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 02/09/2010
4 | //
5 | //! @file Licensing support for ECAquaticPrime
6 | //!
7 | //! NB this file isn't included directly in the
12 |
13 | @protocol ECPreferencePaneProtocol
14 |
15 |
16 | // preferencePanes is called whenever the calling application wants to instantiate preference panes.
17 | // This method returns an array of preference pane instances. This array is autoreleased,
18 | // so the calling application needs to retain whatever it wants to keep.
19 | // If no instances were generated, this returns nil.
20 |
21 | + (NSArray *)preferencePanes;
22 |
23 |
24 | // paneView returns a preference pane's view. This must not be nil.
25 |
26 | - (NSView *)paneView;
27 |
28 |
29 | // paneName returns the name associated with a preference pane's view.
30 | // This is used as the label of the pane's toolbar item in the Preferences window,
31 | // and as the title of the Preferences window when the pane is selected.
32 | // This must not be nil or an empty string.
33 |
34 | - (NSString *)paneName;
35 |
36 |
37 | // paneIcon returns a preference pane's icon as an NSImage.
38 | // The icon will be scaled to the default size for a toolbar icon (if necessary),
39 | // and shown in the toolbar in the Preferences window.
40 |
41 | - (NSImage *)paneIcon;
42 |
43 |
44 | // paneToolTip returns the ToolTip to be used for a preference pane's icon in the
45 | // Preferences window's toolbar. You can return nil or an empty string to disable
46 | // the ToolTip for this preference pane.
47 |
48 | - (NSString *)paneToolTip;
49 |
50 |
51 | // allowsHorizontalResizing and allowsVerticalResizing determine whether the Preferences window
52 | // will be resizable in the respective directions when the receiver is the visible preference
53 | // pane. The initial size of the receiver's view will be used as the minimum size of the
54 | // Preferences window.
55 |
56 | - (BOOL)allowsHorizontalResizing;
57 | - (BOOL)allowsVerticalResizing;
58 |
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/preferences/ECPreferencePanel.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 07/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECPreferencePaneProtocol.h"
11 |
12 | @interface ECPreferencePanel : NSObject
13 | {
14 | IBOutlet NSView *prefsView;
15 | }
16 |
17 | - (void) paneDidLoad;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/preferences/ECPreferencePanel.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 07/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECPreferencePanel.h"
11 |
12 |
13 | @implementation ECPreferencePanel
14 |
15 | - (NSView *)paneView
16 | {
17 | BOOL loaded = YES;
18 |
19 | if (!prefsView)
20 | {
21 | loaded = [NSBundle loadNibNamed:@"view" owner:self];
22 | }
23 |
24 | if (loaded)
25 | {
26 | [self paneDidLoad];
27 | return prefsView;
28 | }
29 |
30 | return nil;
31 | }
32 |
33 | - (NSImage *)paneIcon
34 | {
35 | return [[[NSImage alloc] initWithContentsOfFile:
36 | [[NSBundle bundleForClass:[self class]] pathForImageResource:@"icon"]
37 | ] autorelease];
38 | }
39 |
40 | - (BOOL)allowsHorizontalResizing
41 | {
42 | return NO;
43 | }
44 |
45 |
46 | - (BOOL)allowsVerticalResizing
47 | {
48 | return NO;
49 | }
50 |
51 | - (void) paneDidLoad
52 | {
53 |
54 | }
55 |
56 | - (NSString*) paneName
57 | {
58 | NSString* name = [[NSBundle bundleForClass:[self class]] objectForInfoDictionaryKey: @"CFBundleName"];
59 |
60 | return name;
61 | }
62 |
63 | // --------------------------------------------------------------------------
64 | // These methods must be overriden by the subclasses
65 | // --------------------------------------------------------------------------
66 |
67 | + (NSArray*) preferencePanes
68 | {
69 | return nil;
70 | }
71 |
72 |
73 | - (NSString*) paneToolTip
74 | {
75 | return @"";
76 | }
77 | @end
78 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/preferences/ECPreferencesController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 07/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // Based on original code by Matt Gemmell.
9 | // --------------------------------------------------------------------------
10 |
11 | #import
12 |
13 | @interface ECPreferencesController : NSObject
14 | {
15 | NSWindow *prefsWindow;
16 | NSMutableDictionary *preferencePanes;
17 | NSMutableArray *panesOrder;
18 |
19 | NSString *bundleExtension;
20 | NSString *searchPath;
21 |
22 | NSToolbar *prefsToolbar;
23 | NSMutableDictionary *prefsToolbarItems;
24 |
25 | NSToolbarDisplayMode toolbarDisplayMode;
26 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
27 | NSToolbarSizeMode toolbarSizeMode;
28 | #endif
29 | BOOL usesTexturedWindow;
30 | BOOL alwaysShowsToolbar;
31 | BOOL alwaysOpensCentered;
32 |
33 | BOOL debug;
34 | }
35 |
36 | // Convenience constructors
37 | + (id)preferencesWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext;
38 | + (id)preferencesWithBundleExtension:(NSString *)ext;
39 | + (id)preferencesWithPanesSearchPath:(NSString*)path;
40 | + (id)preferences;
41 |
42 | // Designated initializer
43 | - (id)initWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext;
44 |
45 | - (id)initWithBundleExtension:(NSString *)ext;
46 | - (id)initWithPanesSearchPath:(NSString*)path;
47 |
48 | - (void)showPreferencesWindow;
49 | - (void)createPreferencesWindowAndDisplay:(BOOL)shouldDisplay;
50 | - (void)createPreferencesWindow;
51 | - (void)destroyPreferencesWindow;
52 | - (BOOL)loadPrefsPaneNamed:(NSString *)name display:(BOOL)disp;
53 | - (BOOL)loadPreferencePaneNamed:(NSString *)name;
54 | - (void)activatePane:(NSString*)path;
55 | - (void)debugLog:(NSString*)msg;
56 |
57 | float ToolbarHeightForWindow(NSWindow *window);
58 | - (void)createPrefsToolbar;
59 | - (void)prefsToolbarItemClicked:(NSToolbarItem*)item;
60 |
61 | // Accessors
62 | - (NSWindow *)preferencesWindow;
63 | - (NSString *)bundleExtension;
64 | - (NSString *)searchPath;
65 |
66 | - (NSArray *)loadedPanes;
67 | - (NSArray *)panesOrder;
68 | - (void)setPanesOrder:(NSArray *)newPanesOrder;
69 | - (BOOL)debug;
70 | - (void)setDebug:(BOOL)newDebug;
71 | - (BOOL)usesTexturedWindow;
72 | - (void)setUsesTexturedWindow:(BOOL)newUsesTexturedWindow;
73 | - (BOOL)alwaysShowsToolbar;
74 | - (void)setAlwaysShowsToolbar:(BOOL)newAlwaysShowsToolbar;
75 | - (BOOL)alwaysOpensCentered;
76 | - (void)setAlwaysOpensCentered:(BOOL)newAlwaysOpensCentered;
77 | - (NSToolbarDisplayMode)toolbarDisplayMode;
78 | - (void)setToolbarDisplayMode:(NSToolbarDisplayMode)displayMode;
79 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
80 | - (NSToolbarSizeMode)toolbarSizeMode;
81 | - (void)setToolbarSizeMode:(NSToolbarSizeMode)sizeMode;
82 | #endif
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/preferences/sparkle/ECSparklePreferenceController.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 16/01/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // --------------------------------------------------------------------------
7 |
8 | #import
9 | #import
10 |
11 | @interface ECSparklePreferenceController : ECPreferencePanel
12 |
13 | @property (strong, nonatomic) NSString* introText;
14 | @property (strong, nonatomic) NSString* anonymousText;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/preferences/sparkle/ECSparklePreferenceController.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 16/01/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // --------------------------------------------------------------------------
7 |
8 | #import "ECSparklePreferenceController.h"
9 |
10 | @implementation ECSparklePreferenceController
11 |
12 | @synthesize introText = _introText;
13 | @synthesize anonymousText = _anonymousText;
14 |
15 | + (NSArray*) preferencePanes
16 | {
17 | return [NSArray arrayWithObjects:[[[ECSparklePreferenceController alloc] init] autorelease], nil];
18 | }
19 |
20 | - (NSString*) paneName
21 | {
22 | return @"Updates";
23 | }
24 |
25 | - (NSString*) paneToolTip
26 | {
27 | return @"Automatic Updates";
28 | }
29 |
30 | - (id) init
31 | {
32 | if ((self = [super init]) != nil)
33 | {
34 | NSString* name = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleName"];
35 | self.introText = [NSString stringWithFormat: @"%@ can automatically check for updates of itself. Checking occurs only when a network connection is active.", name];
36 | self.anonymousText = [NSString stringWithFormat: @"To help us improve support for all platforms, %@ can include anonymous information about your current configuration every time it checks for an update.", name];
37 | }
38 |
39 | return self;
40 | }
41 |
42 | - (void) dealloc
43 | {
44 | [_introText release];
45 | [_anonymousText release];
46 |
47 | [super dealloc];
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/tables/ECDraggableArrayController.h:
--------------------------------------------------------------------------------
1 |
2 | // --------------------------------------------------------------------------
3 | //! @author Sam Deane
4 | //! @date 16/06/11
5 | //
6 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECLogging.h"
12 |
13 | ECDeclareDebugChannel(ECDraggableArrayControllerChannel);
14 |
15 | @interface ECDraggableArrayController : NSArrayController
16 |
17 | @property (nonatomic, assign) BOOL canCopy;
18 | @property (nonatomic, retain) IBOutlet NSCollectionView* collection;
19 | @property (nonatomic, retain) NSArray* supportedTypes;
20 | @property (nonatomic, retain) IBOutlet NSTableView* table;
21 |
22 | // --------------------------------------------------------------------------
23 | // Methods That Subclasses Can Extend (should call super)
24 | // --------------------------------------------------------------------------
25 |
26 | - (NSDragOperation)localSourceMaskToUse;
27 | - (NSDragOperation)remoteSourceMaskToUse;
28 | - (NSArray*)typesToRegister;
29 | - (NSArray*)typesToDragForRows:(NSIndexSet*)rowIndexes;
30 | - (void)writeDataOfType:(NSString*)type toPasteboard:(NSPasteboard*)pasteboard forRows:(NSIndexSet*)rowIndexes;
31 | - (BOOL)performMoveToIndex:(NSUInteger)index withPasteboard:(NSPasteboard*)pasteboard;
32 | - (BOOL)performLocalCopyToIndex:(NSUInteger)index withPasteboard:(NSPasteboard*)pasteboard;
33 | - (BOOL)performRemoteCopyToIndex:(NSUInteger)index withPasteboard:(NSPasteboard*)pasteboard;
34 |
35 | @end
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/tables/ECDraggableFileArrayController.h:
--------------------------------------------------------------------------------
1 |
2 | // --------------------------------------------------------------------------
3 | //! @author Sam Deane
4 | //! @date 16/06/11
5 | //
6 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | // --------------------------------------------------------------------------
10 |
11 | #import "ECDraggableArrayController.h"
12 |
13 | @interface ECDraggableFileArrayController : ECDraggableArrayController
14 |
15 | - (NSString*)typeOfItem:(id)item;
16 | - (NSString*)makeFileFromItem:(id)item atDestination:(NSURL*)url;
17 | - (BOOL)addFiles:(NSArray*)files atIndex:(NSInteger)index;
18 |
19 | @end
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECCompletionTextView.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/08/2011.
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // --------------------------------------------------------------------------
7 |
8 | #import
9 |
10 | @interface ECCompletionTextView : NSTextView
11 |
12 | {
13 | @private
14 | NSCharacterSet* triggers;
15 | NSArray* potentialCompletions;
16 | NSTimer* completionTimer;
17 | NSCharacterSet* whitespace;
18 | NSUInteger nextInsertionIndex;
19 | }
20 |
21 | @property (nonatomic, retain) NSCharacterSet* triggers;
22 | @property (nonatomic, retain) NSArray* potentialCompletions;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECFilledView.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 05/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | // --------------------------------------------------------------------------
13 | //! A semi-transparent round-rectangular view.
14 | // --------------------------------------------------------------------------
15 |
16 | @interface ECFilledView : NSView
17 | {
18 | float mTransparency;
19 | }
20 |
21 | // --------------------------------------------------------------------------
22 | // Properties
23 | // --------------------------------------------------------------------------
24 |
25 | @property (assign) float transparency;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECFilledView.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 05/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECFilledView.h"
11 |
12 | @implementation ECFilledView
13 |
14 | @synthesize transparency = mTransparency;
15 |
16 |
17 | - (void) setupDefaults
18 | {
19 | self.transparency = 0.75f;
20 | }
21 |
22 | // --------------------------------------------------------------------------
23 | //! Initialise default values for properties.
24 | // --------------------------------------------------------------------------
25 |
26 | - (id) initWithFrame:(NSRect)frameRect
27 | {
28 | if ((self = [super initWithFrame: frameRect]) != nil)
29 | {
30 | [self setupDefaults];
31 | }
32 |
33 | return self;
34 | }
35 |
36 | // --------------------------------------------------------------------------
37 | // --------------------------------------------------------------------------
38 |
39 | - (void) awakeFromNib
40 | {
41 | [self setupDefaults];
42 | [super awakeFromNib];
43 | }
44 |
45 |
46 | // --------------------------------------------------------------------------
47 | //! Draw the view.
48 | // --------------------------------------------------------------------------
49 |
50 | - (void) drawRect: (NSRect) dirtyRect
51 | {
52 | NSBezierPath* path = [NSBezierPath bezierPathWithRect: [self frame]];
53 | // NSColor* fillColour = [NSColor colorWithCalibratedWhite:0.0f alpha:mTransparency];
54 | NSColor* fillColour = [NSColor redColor];
55 | [fillColour set];
56 | [path fill];
57 | }
58 |
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECGradientTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ECGradientTextView.h
3 | // ambientweet
4 | //
5 | // Created by Sam Deane on 10/04/2012.
6 | // Copyright (c) 2012 Elegant Chaos. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ECGradientTextView : NSTextView
12 |
13 | @property (nonatomic, retain) NSGradient* gradient;
14 | @property (nonatomic, assign) CGFloat radius;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECGradientTextView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ECGradientTextView.m
3 | // ambientweet
4 | //
5 | // Created by Sam Deane on 10/04/2012.
6 | // Copyright (c) 2012 Elegant Chaos. All rights reserved.
7 | //
8 |
9 | #import "ECGradientTextView.h"
10 |
11 | @interface ECGradientTextView()
12 |
13 | @property (assign, nonatomic) NSRect lastRect;
14 | @property (strong, nonatomic) NSBezierPath* path;
15 |
16 | - (void)setupDefaults;
17 |
18 | @end
19 |
20 | @implementation ECGradientTextView
21 |
22 | static const CGFloat kStartAlpha = 0.8;
23 | static const CGFloat kEndAlpha = 0.65;
24 | static const CGFloat kDefaultRadius = 25.0;
25 |
26 | @synthesize lastRect = _lastRect;
27 | @synthesize path = _path;
28 | @synthesize gradient = _gradient;
29 | @synthesize radius = _radius;
30 |
31 | - (id)initWithFrame:(NSRect)frame
32 | {
33 | self = [super initWithFrame:frame];
34 | if (self)
35 | {
36 | self.drawsBackground = YES;
37 | [self setupDefaults];
38 | }
39 |
40 | return self;
41 | }
42 |
43 | - (void)awakeFromNib
44 | {
45 | [self setupDefaults];
46 | }
47 |
48 | - (void)dealloc
49 | {
50 | [_gradient release];
51 | [_path release];
52 |
53 | [super dealloc];
54 | }
55 |
56 | - (void) setupDefaults
57 | {
58 | self.radius = kDefaultRadius;
59 | NSColor* start = [NSColor colorWithCalibratedWhite:0.0f alpha:kStartAlpha];
60 | NSColor* end = [start colorWithAlphaComponent:kEndAlpha];
61 | self.gradient = [[[NSGradient alloc] initWithStartingColor:start endingColor:end] autorelease];
62 | }
63 |
64 | - (void)drawViewBackgroundInRect:(NSRect)rect
65 | {
66 | if (!NSEqualRects(self.lastRect, rect))
67 | {
68 | self.path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:self.radius yRadius:self.radius];
69 | }
70 |
71 | [self.gradient drawInBezierPath:self.path angle:90.0];
72 | }
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECRoundedImageCell.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 18/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 |
11 |
12 | @interface ECRoundedImageCell : NSImageCell
13 | {
14 | }
15 |
16 | // --------------------------------------------------------------------------
17 | // Public Properties
18 | // --------------------------------------------------------------------------
19 |
20 | @property (assign, nonatomic) CGFloat cornerRadius;
21 |
22 | // --------------------------------------------------------------------------
23 | // Public Methods
24 | // --------------------------------------------------------------------------
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECRoundedImageCell.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 18/12/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECRoundedImageCell.h"
11 |
12 |
13 | // ==============================================
14 | // Private Methods
15 | // ==============================================
16 |
17 | #pragma mark -
18 | #pragma mark Private Methods
19 |
20 | @interface ECRoundedImageCell()
21 |
22 | @end
23 |
24 |
25 | @implementation ECRoundedImageCell
26 |
27 | // ==============================================
28 | // Properties
29 | // ==============================================
30 |
31 | #pragma mark -
32 | #pragma mark Properties
33 |
34 | @synthesize cornerRadius = _cornerRadius;
35 |
36 | // ==============================================
37 | // Constants
38 | // ==============================================
39 |
40 | #pragma mark -
41 | #pragma mark Constants
42 |
43 | // ==============================================
44 | // Lifecycle
45 | // ==============================================
46 |
47 | #pragma mark -
48 | #pragma mark Lifecycle
49 |
50 | - (void) awakeFromNib
51 | {
52 | self.cornerRadius = 5.0f;
53 | }
54 |
55 | - (id)initImageCell:(NSImage *)image
56 | {
57 | if ((self = [super initImageCell: image]) != nil)
58 | {
59 | self.cornerRadius = 5.0f;
60 | }
61 |
62 | return self;
63 | }
64 |
65 | // ==============================================
66 | // Drawing
67 | // ==============================================
68 |
69 | #pragma mark -
70 | #pragma mark Drawing
71 |
72 | - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView
73 | {
74 | [NSGraphicsContext saveGraphicsState];
75 | NSRect imageFrame = NSInsetRect(frame, 1, 1);
76 | CGFloat radius = self.cornerRadius;
77 | NSBezierPath* clipPath = [NSBezierPath bezierPathWithRoundedRect:imageFrame xRadius:radius yRadius: radius];
78 | [clipPath setWindingRule:NSEvenOddWindingRule];
79 | [clipPath addClip];
80 | [super drawInteriorWithFrame: frame inView: controlView];
81 | [NSGraphicsContext restoreGraphicsState];
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECRoundedView.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 05/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | // --------------------------------------------------------------------------
11 | //! A semi-transparent round-rectangular view.
12 | // --------------------------------------------------------------------------
13 |
14 | @interface ECRoundedView : NSView
15 |
16 | // --------------------------------------------------------------------------
17 | // Properties
18 | // --------------------------------------------------------------------------
19 |
20 | @property (nonatomic, retain) NSGradient* gradient;
21 | @property (nonatomic, assign) CGFloat radius;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/views/ECRoundedView.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 05/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECRoundedView.h"
11 |
12 | @interface ECRoundedView()
13 |
14 | @property (nonatomic, retain) NSBezierPath* path;
15 |
16 | - (void)makePathForRect:(CGRect)rect;
17 |
18 | @end
19 |
20 | @implementation ECRoundedView
21 |
22 | @synthesize gradient;
23 | @synthesize path;
24 | @synthesize radius;
25 |
26 | static const CGFloat kStartAlpha = 0.8;
27 | static const CGFloat kEndAlpha = 0.65;
28 | static const CGFloat kDefaultRadius = 25.0;
29 |
30 | - (void) setupDefaults
31 | {
32 | self.radius = kDefaultRadius;
33 | NSColor* start = [NSColor colorWithCalibratedWhite:0.0f alpha:kStartAlpha];
34 | NSColor* end = [start colorWithAlphaComponent:kEndAlpha];
35 | self.gradient = [[[NSGradient alloc] initWithStartingColor:start endingColor:end] autorelease];
36 | }
37 |
38 | // --------------------------------------------------------------------------
39 | //! Initialise default values for properties.
40 | // --------------------------------------------------------------------------
41 |
42 | - (id) initWithFrame:(NSRect)frameRect
43 | {
44 | if ((self = [super initWithFrame: frameRect]) != nil)
45 | {
46 | [self setupDefaults];
47 | [self makePathForRect:frameRect];
48 | }
49 |
50 | return self;
51 | }
52 |
53 | - (void)dealloc
54 | {
55 | [gradient release];
56 | [path release];
57 |
58 | [super dealloc];
59 | }
60 |
61 | // --------------------------------------------------------------------------
62 | // --------------------------------------------------------------------------
63 |
64 | - (void) awakeFromNib
65 | {
66 | [self setupDefaults];
67 | [self makePathForRect:self.frame];
68 | [super awakeFromNib];
69 | }
70 |
71 | - (void)setFrame:(NSRect)frameRect
72 | {
73 | [super setFrame:frameRect];
74 | [self makePathForRect:frameRect];
75 | }
76 |
77 | - (void)setFrameSize:(NSSize)newSize
78 | {
79 | [super setFrameSize:newSize];
80 | [self makePathForRect:self.frame];
81 | }
82 |
83 | - (void)setFrameOrigin:(NSPoint)newOrigin
84 | {
85 | [super setFrameOrigin:newOrigin];
86 | [self makePathForRect:self.frame];
87 | }
88 |
89 | - (void)makePathForRect:(CGRect)rect
90 | {
91 | self.path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:self.radius yRadius:self.radius];
92 | }
93 | // --------------------------------------------------------------------------
94 | //! Draw the view.
95 | // --------------------------------------------------------------------------
96 |
97 | - (void) drawRect: (NSRect) dirtyRect
98 | {
99 | [self.gradient drawInBezierPath:self.path angle:90.0];
100 | }
101 |
102 |
103 | @end
104 |
--------------------------------------------------------------------------------
/Modules/ECAppKit/windows/ECTransparentWindow.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 05/03/2010
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | // --------------------------------------------------------------------------
13 | //! Window which has no frame or titlebar.
14 | // --------------------------------------------------------------------------
15 |
16 | @interface ECTransparentWindow : NSWindow
17 | {
18 | NSPoint mClickLocation;
19 | BOOL mResizable;
20 | CGFloat mResizeRectSize;
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Modules/ECLocation/Generic/CLLocation+ECLocation.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @interface CLLocation(ECLocation)
13 |
14 | // --------------------------------------------------------------------------
15 | // Public Properties
16 | // --------------------------------------------------------------------------
17 |
18 | // --------------------------------------------------------------------------
19 | // Public Methods
20 | // --------------------------------------------------------------------------
21 |
22 | - (NSString*) stringValue;
23 | - (NSURL*) urlForLocationInMap;
24 | - (NSURL*) urlForDirectionsFrom: (CLLocation*) from;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Modules/ECLocation/Generic/CLLocation+ECLocation.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "CLLocation+ECLocation.h"
11 |
12 | @implementation CLLocation(ECLocation)
13 |
14 | // --------------------------------------------------------------------------
15 | // Properties
16 | // --------------------------------------------------------------------------
17 |
18 | // --------------------------------------------------------------------------
19 | // Constants
20 | // --------------------------------------------------------------------------
21 |
22 | // --------------------------------------------------------------------------
23 | // Methods
24 | // --------------------------------------------------------------------------
25 |
26 | - (NSString*) stringValue
27 | {
28 | CLLocationCoordinate2D coordinate = self.coordinate;
29 | NSString* result = [NSString stringWithFormat: @"%lf,%lf", coordinate.latitude, coordinate.longitude];
30 |
31 | return result;
32 | }
33 |
34 | - (NSURL*) urlForLocationInMap
35 | {
36 | CLLocationCoordinate2D coordinate = self.coordinate;
37 | NSString* string = [[NSString alloc] initWithFormat: @"http://maps.google.com/maps?ll=%lf,%lf", coordinate.latitude, coordinate.longitude];
38 | NSURL* result = [NSURL URLWithString: string];
39 | [string release];
40 |
41 | return result;
42 | }
43 |
44 | - (NSURL*) urlForDirectionsFrom: (CLLocation*) from
45 | {
46 | CLLocationCoordinate2D coordinate = self.coordinate;
47 | NSString* string = [[NSString alloc] initWithFormat: @"http://maps.google.com/maps?ll=%lf,%lf", coordinate.latitude, coordinate.longitude];
48 | NSURL* result = [NSURL URLWithString: string];
49 | [string release];
50 |
51 | return result;
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Modules/ECLocation/Generic/ECLocationUtilities.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #include
11 |
12 | BOOL CoordinatesEqual(CLLocationCoordinate2D value1, CLLocationCoordinate2D value2);
13 |
14 | CLLocationCoordinate2D CoordinateClamp(CLLocationCoordinate2D value, CLLocationCoordinate2D min, CLLocationCoordinate2D max);
15 | CLLocationCoordinate2D CoordinateMinimum(CLLocationCoordinate2D c1, CLLocationCoordinate2D c2);
16 | CLLocationCoordinate2D CoordinateMaximum(CLLocationCoordinate2D c1, CLLocationCoordinate2D c2);
17 | CLLocationCoordinate2D CoordinateCentre(CLLocationCoordinate2D c1, CLLocationCoordinate2D c2);
18 | CLLocationCoordinate2D CoordinateDelta(CLLocationCoordinate2D c1, CLLocationCoordinate2D c2);
19 | CLLocationCoordinate2D CoordinateFromArray(NSArray* array);
20 |
21 |
--------------------------------------------------------------------------------
/Modules/ECNetwork/Mac/ECLaunchD.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/12/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @interface ECLaunchD : NSObject
13 |
14 | + (mach_port_t)bootstrapPortWithName:(NSString*)name;
15 | + (int)boostrapSocketWithName:(NSString*)name;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Modules/ECNetwork/Mac/ECLaunchD.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/12/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECLaunchD.h"
11 | #import "ECASLClient.h"
12 |
13 | #import
14 | #import
15 |
16 | // TODO - add proper ECLogging
17 | //#define ECDebug(c, ...) [[ECASLClient sharedInstance] log:__VA_ARGS__]
18 | #define ECDebug(...)
19 |
20 | @implementation ECLaunchD
21 |
22 | + (mach_port_t)bootstrapPortWithName:(NSString *)name
23 | {
24 | mach_port_t mp = 0;
25 | mach_port_t bootstrap_port;
26 | task_get_bootstrap_port(mach_task_self(), &bootstrap_port);
27 | kern_return_t result = bootstrap_check_in(bootstrap_port, [name UTF8String], &mp);
28 | if (result != err_none)
29 | {
30 | ECDebug(LaunchdChannel, @"failed to get bootstrap port with error %d", result);
31 | }
32 |
33 | return mp;
34 | }
35 |
36 | // --------------------------------------------------------------------------
37 | //! Return the bootstrap socket we were passed
38 | // --------------------------------------------------------------------------
39 |
40 | + (int)boostrapSocketWithName:(NSString *)name
41 | {
42 | ECDebug(LaunchdChannel, @"in bootstrap");
43 |
44 | int socket = 0;
45 |
46 | launch_data_t checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN);
47 | if (checkin_request)
48 | {
49 | ECDebug(LaunchdChannel, @"got request");
50 | launch_data_t checkin_response = launch_msg(checkin_request);
51 | if (checkin_response)
52 | {
53 | launch_data_type_t type = launch_data_get_type(checkin_response);
54 | ECDebug(LaunchdChannel, @"got response type %d", type);
55 | if (type != LAUNCH_DATA_ERRNO)
56 | {
57 | ECDebug(LaunchdChannel, @"not error");
58 | launch_data_t the_label = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_LABEL);
59 | if (the_label)
60 | {
61 | const char* label = launch_data_get_string(the_label);
62 | if (!name || (strcmp(label, [name UTF8String]) == 0))
63 | {
64 | ECDebug(LaunchdChannel, @"got matching label %s", label);
65 |
66 | launch_data_t sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
67 | if (sockets_dict)
68 | {
69 | size_t count = launch_data_dict_get_count(sockets_dict);
70 | ECDebug(LaunchdChannel, @"got dict with count %d", count);
71 | if (count > 0)
72 | {
73 | launch_data_t listening_fd_array = launch_data_dict_lookup(sockets_dict, label);
74 | if (listening_fd_array)
75 | {
76 | ECDebug(LaunchdChannel, @"got sockets array");
77 | launch_data_t fd_data = launch_data_array_get_index(listening_fd_array, 0);
78 | socket = launch_data_get_fd(fd_data);
79 | }
80 | }
81 | }
82 | }
83 | }
84 | }
85 | }
86 | launch_data_free(checkin_request);
87 | }
88 |
89 | // TODO are we supposed to free more stuff?
90 |
91 | return socket;
92 | }
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/Modules/ECNetwork/Mac/ECMachPorts.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/12/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @interface NSConnection(ECMachPorts)
13 |
14 | + (id)serviceConnectionWithBootstrapPortName:(NSString*)name rootObject:(id)root;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Modules/ECNetwork/Mac/ECMachPorts.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/12/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECMachPorts.h"
11 | #import "ECLaunchD.h"
12 |
13 | @implementation NSConnection(ECMachPorts)
14 |
15 | + (id)serviceConnectionWithBootstrapPortName:(NSString*)name rootObject:(id)root
16 | {
17 | NSConnection* service = nil;
18 | mach_port_t mp = [ECLaunchD bootstrapPortWithName:name];
19 | if (mp)
20 | {
21 | // set up the connection
22 | NSMachPort *receivePort = [[NSMachPort alloc] initWithMachPort:mp];
23 | service = [NSConnection connectionWithReceivePort:receivePort sendPort:nil];
24 | [service setRootObject:root];
25 | [receivePort release];
26 | }
27 |
28 | return service;
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Modules/ECNetwork/Mac/ECUnixPorts.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 15/12/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import
11 |
12 | @interface NSSocketPort(ECUnixPorts)
13 |
14 | + (NSSocketPort*)clientSocketWithName:(NSString*)name;
15 | + (NSSocketPort*)serviceSocketWithName:(NSString*)name;
16 |
17 | @end
18 |
19 | @class ECASLClient;
20 |
21 | @interface NSConnection(ECUnixPorts)
22 |
23 | + (id)serviceConnectionWithUnixSocketName:(NSString*)name rootObject:(id)root;
24 | + (id)serviceConnectionWithBootstrapUnixSocketName:(NSString*)name rootObject:(id)root;
25 | + (id)connectionWithUnixSocketName:(NSString*)name;
26 |
27 | + (void)removeUnixSocketName:(NSString*)name;
28 | - (void)invalidateWithUnixSocketName:(NSString*)name;
29 | @end
30 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/dictionary/ECDictionaryBackedObject.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | // --------------------------------------------------------------------------
11 | //! Objects inheriting from this can be created / updated from a dictionary.
12 | //! The dictionary is expected to always contain at least one value, which represents
13 | //! a unique ID for the object. The key used to store this value is defined by
14 | //! the class method objectIDKey, which should be overridden in each subclass.
15 | //!
16 | //! Typically you should use the DictionaryBackedObjectCache class to manage
17 | //! collections of objects, rather than dealing with this API directly.
18 | // --------------------------------------------------------------------------
19 |
20 | @interface ECDictionaryBackedObject : NSObject
21 | {
22 | @private
23 | NSMutableDictionary* data;
24 | }
25 |
26 | @property (nonatomic, retain) NSMutableDictionary* data;
27 |
28 | + (NSString*)objectIDFromDictionary:(NSDictionary*)dictionary;
29 | + (ECDictionaryBackedObject*)objectWithDictionary:(NSDictionary*)dictionary;
30 | + (NSString*)objectIDKey;
31 |
32 | - (id)initWithDictionary:(NSDictionary*)dictionary;
33 | - (void)updateFromDictionary:(NSDictionary*)dictionary;
34 | - (NSDictionary*)asDictionary;
35 |
36 | - (NSString*)objectID;
37 | - (NSDate*)objectCreationDate;
38 | - (NSDate*)objectUpdateDate;
39 | - (void)rememberUpdate;
40 |
41 | + (void)loadObjectsFromURL:(NSURL*)url intoDictionary:(NSMutableDictionary*)dictionary;
42 | + (void)saveObjectsToURL:(NSURL*)url fromDictionary:(NSDictionary*)dictionary;
43 | @end
44 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/dictionary/ECDictionaryBackedObjectCache.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | @class ECDictionaryBackedObject;
11 |
12 |
13 | // --------------------------------------------------------------------------
14 | //! This class is used to manage a cache of objects that inherit from
15 | //! ECDictionaryBackedObject.
16 | //!
17 | //! When you create a cache you pass it a class - it uses this to work out
18 | //! which dictionary key to use for the objectID. It also uses the class to
19 | //! create new objects when it needs them.
20 | //!
21 | //! When you want to lookup an object in the cache, you can do so by objectID.
22 | //! Alternatively, you can pass the cache a dictionary describing the object.
23 | //! If the object exists already, it will be updated with the values in the
24 | //! dictionary, then returned to you. If it doesn't exist, it will be created
25 | //! using the dictionary, and added to the cache before being returned.
26 | //!
27 | //! You can save/load the contents of the cache to a file.
28 | // --------------------------------------------------------------------------
29 |
30 | @interface ECDictionaryBackedObjectCache : NSObject
31 | {
32 | @private
33 | Class class;
34 | NSMutableDictionary* data;
35 | }
36 |
37 | - (id)initWithClass:(Class)class;
38 |
39 | - (ECDictionaryBackedObject*)objectWithID:(NSString*)objectID;
40 | - (ECDictionaryBackedObject*)objectWithDictionary:(NSDictionary*)dictionary;
41 | - (NSArray*)objectsWithArray:(NSArray*)array;
42 | - (NSArray*)allObjects;
43 | - (void)loadObjectsFromURL:(NSURL*)path;
44 | - (void)saveObjectsToURL:(NSURL*)path;
45 |
46 | - (void)removeObjectsOlderThanDate:(NSDate*)date;
47 |
48 | @end
49 |
50 | extern NSString* const ECDictionaryBackedObjectCacheUpdatedNotification;
51 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/dictionary/tests/ECDictionaryBackedObjectTests.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | //! @file:
6 | //! Unit tests for the NSDate+ECUtilitiesTests.h category.
7 | //
8 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
9 | // This source code is distributed under the terms of Elegant Chaos's
10 | // liberal license: http://www.elegantchaos.com/license/liberal
11 | // --------------------------------------------------------------------------
12 |
13 | #import "ECTestCase.h"
14 | #import "TestDictionaryBackedObject.h"
15 |
16 | @interface ECDictionaryBackedObjectTests : ECTestCase
17 | {
18 | @private
19 | NSDictionary* testData;
20 | }
21 |
22 | @end
23 |
24 | @interface ECDictionaryBackedObjectTests()
25 |
26 | @property (nonatomic, retain) NSDictionary* testData;
27 |
28 | @end
29 |
30 | @implementation ECDictionaryBackedObjectTests
31 |
32 | @synthesize testData;
33 |
34 | // --------------------------------------------------------------------------
35 | //! Set up before each test.
36 | // --------------------------------------------------------------------------
37 |
38 | - (void) setUp
39 | {
40 | self.testData = [NSDictionary dictionaryWithObjectsAndKeys:
41 | @"1", @"TestID",
42 | @"Sam", @"TestName",
43 | @"Some Text", @"TestText",
44 | nil];
45 | }
46 |
47 | // --------------------------------------------------------------------------
48 | //! Tear down after each test.
49 | // --------------------------------------------------------------------------
50 |
51 | - (void) tearDown
52 | {
53 | self.testData = nil;
54 | }
55 |
56 | // --------------------------------------------------------------------------
57 | //! Test objectWithDictionary
58 | // --------------------------------------------------------------------------
59 |
60 | - (void) testObjectWithDictionary
61 | {
62 | TestDictionaryBackedObject* object = (TestDictionaryBackedObject*) [TestDictionaryBackedObject objectWithDictionary:self.testData];
63 | ECTestAssertNotNil(object);
64 |
65 | ECTestAssertTrue([object.name isEqualToString:@"Sam"]);
66 | ECTestAssertTrue([object.text isEqualToString:@"Some Text"]);
67 | ECTestAssertTrue([object.objectID isEqualToString:@"1"]);
68 | }
69 |
70 | // --------------------------------------------------------------------------
71 | //! Test objectWithDictionary
72 | // --------------------------------------------------------------------------
73 |
74 | - (void) testUpdateWithDictionary
75 | {
76 | TestDictionaryBackedObject* object = (TestDictionaryBackedObject*) [TestDictionaryBackedObject objectWithDictionary:self.testData];
77 | ECTestAssertNotNil(object);
78 |
79 | NSDictionary* update = [NSDictionary dictionaryWithObjectsAndKeys:
80 | @"Tom", @"TestName",
81 | @"Different Text", @"TestText",
82 | @"Random Value", @"RandomKey",
83 | nil];
84 | [object updateFromDictionary:update];
85 |
86 | ECTestAssertTrue([object.name isEqualToString:@"Tom"]);
87 | ECTestAssertTrue([object.text isEqualToString:@"Different Text"]);
88 | ECTestAssertTrue([object.objectID isEqualToString:@"1"]);
89 | }
90 |
91 | @end
92 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/dictionary/tests/TestDictionaryBackedObject.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | //! @file:
6 | //! Unit tests for the NSDate+ECUtilitiesTests.h category.
7 | //
8 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
9 | // This source code is distributed under the terms of Elegant Chaos's
10 | // liberal license: http://www.elegantchaos.com/license/liberal
11 | // --------------------------------------------------------------------------
12 |
13 | #import "ECDictionaryBackedObject.h"
14 |
15 | @interface TestDictionaryBackedObject : ECDictionaryBackedObject
16 |
17 | - (NSString*)name;
18 | - (NSString*)text;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/dictionary/tests/TestDictionaryBackedObject.m:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | //! @file:
6 | //! Unit tests for the NSDate+ECUtilitiesTests.h category.
7 | //
8 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
9 | // This source code is distributed under the terms of Elegant Chaos's
10 | // liberal license: http://www.elegantchaos.com/license/liberal
11 | // --------------------------------------------------------------------------
12 |
13 | #import "TestDictionaryBackedObject.h"
14 | #import "ECDictionaryBackedObject.h"
15 |
16 | @implementation TestDictionaryBackedObject
17 |
18 | // --------------------------------------------------------------------------
19 | //! Return the dictionary key to use when looking up object IDs for this class.
20 | //! Subclasses should override this to return a relevant value.
21 | // --------------------------------------------------------------------------
22 |
23 | + (NSString*)objectIDKey
24 | {
25 | return @"TestID"; // subclasses should override this
26 | }
27 |
28 | - (NSString*)name
29 | {
30 | return [self.data objectForKey:@"TestName"];
31 | }
32 |
33 | - (NSString*)text
34 | {
35 | return [self.data objectForKey:@"TestText"];
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/misc/ECCommonKeys.h:
--------------------------------------------------------------------------------
1 | //
2 | // ECCommonKeys.h
3 | // ECFoundation
4 | //
5 | // Created by Sam Deane on 26/09/2010.
6 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | //
10 |
11 | #import
12 |
13 |
14 | // --------------------------------------------------------------------------
15 | // Common Key Constants
16 | // --------------------------------------------------------------------------
17 |
18 | extern NSString *const kAccessoryKey;
19 | extern NSString *const kCellClassKey;
20 | extern NSString *const kCellPropertiesKey;
21 | extern NSString *const kChildCellClassKey;
22 | extern NSString *const kDefaultsKey;
23 | extern NSString *const kDeletableKey;
24 | extern NSString *const kEditableKey;
25 | extern NSString *const kEditorKey;
26 | extern NSString *const kEditorNibKey;
27 | extern NSString *const kExtensibleKey;
28 | extern NSString *const kFooterKey;
29 | extern NSString *const kItemsKey;
30 | extern NSString *const kLabelKey;
31 | extern NSString *const kMoveableKey;
32 | extern NSString *const kNewValueKey;
33 | extern NSString *const kParentKey;
34 | extern NSString *const kPropertiesKey;
35 | extern NSString *const kSecureKey;
36 | extern NSString *const kSelectableKey;
37 | extern NSString *const kSelectionKey;
38 | extern NSString *const kTitleKey;
39 | extern NSString *const kValueKey;
40 | extern NSString *const kViewerKey;
41 | extern NSString *const kViewerNibKey;
42 |
43 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/misc/ECCommonKeys.m:
--------------------------------------------------------------------------------
1 | //
2 | // ECCommonKeys.m
3 | // ECFoundation
4 | //
5 | // Created by Sam Deane on 26/09/2010.
6 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
7 | // This source code is distributed under the terms of Elegant Chaos's
8 | // liberal license: http://www.elegantchaos.com/license/liberal
9 | //
10 |
11 | #import "ECCommonKeys.h"
12 |
13 | // --------------------------------------------------------------------------
14 | // Data Key Constants
15 | // --------------------------------------------------------------------------
16 |
17 | NSString *const kAccessoryKey = @"Accessory";
18 | NSString *const kCellClassKey = @"CellClass";
19 | NSString *const kCellPropertiesKey = @"CellProperties";
20 | NSString *const kChildCellClassKey = @"ChildCellClass";
21 | NSString *const kDefaultsKey = @"Defaults";
22 | NSString *const kDeletableKey = @"Deletable";
23 | NSString *const kEditableKey = @"Editable";
24 | NSString *const kEditorKey = @"Editor";
25 | NSString *const kEditorNibKey = @"EditorNib";
26 | NSString *const kExtensibleKey = @"Extensible";
27 | NSString *const kFooterKey = @"Footer";
28 | NSString *const kTitleKey = @"Title";
29 | NSString *const kItemsKey = @"Items";
30 | NSString *const kLabelKey = @"Label";
31 | NSString *const kMoveableKey = @"Moveable";
32 | NSString *const kNewValueKey = @"NewValue";
33 | NSString *const kParentKey = @"Parent";
34 | NSString *const kPropertiesKey = @"Properties";
35 | NSString *const kSecureKey = @"Secure";
36 | NSString *const kSelectableKey = @"Selectable";
37 | NSString *const kSelectionKey = @"Selection";
38 | NSString *const kValueKey = @"Value";
39 | NSString *const kViewerKey = @"Viewer";
40 | NSString *const kViewerNibKey = @"ViewerNib";
41 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/misc/ECDataItemTests.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | // --------------------------------------------------------------------------
9 |
10 | #import "ECTestCase.h"
11 |
12 | @interface ECDataItemTests : ECTestCase
13 | {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/networking/ECReachability.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // This source code is distributed under the terms of Elegant Chaos's
7 | // liberal license: http://www.elegantchaos.com/license/liberal
8 | //
9 | // Based on Apple's sample code.
10 | // --------------------------------------------------------------------------
11 |
12 | #import
13 | #import
14 |
15 | typedef enum
16 | {
17 | NotReachable = 0,
18 | ReachableViaWiFi,
19 | ReachableViaWWAN
20 | } NetworkStatus;
21 |
22 | extern NSString *const ReachabilityChangedNotification;
23 |
24 | @interface ECReachability: NSObject
25 | {
26 | BOOL localWiFiRef;
27 | SCNetworkReachabilityRef reachabilityRef;
28 | }
29 |
30 | //reachabilityWithHostName- Use to check the reachability of a particular host name.
31 | + (ECReachability*) reachabilityWithHostName: (NSString*) hostName;
32 |
33 | //reachabilityWithAddress- Use to check the reachability of a particular IP address.
34 | + (ECReachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
35 |
36 | //reachabilityForInternetConnection- checks whether the default route is available.
37 | // Should be used by applications that do not connect to a particular host
38 | + (ECReachability*) reachabilityForInternetConnection;
39 |
40 | //reachabilityForLocalWiFi- checks whether a local wifi connection is available.
41 | + (ECReachability*) reachabilityForLocalWiFi;
42 |
43 | //Start listening for reachability notifications on the current run loop
44 | - (BOOL) startNotifier;
45 | - (void) stopNotifier;
46 |
47 | - (NetworkStatus) currentReachabilityStatus;
48 | //WWAN may be available, but not active until a connection has been established.
49 | //WiFi may require a connection for VPN on Demand.
50 | - (BOOL) connectionRequired;
51 | @end
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/xml/ECXMLElement.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // --------------------------------------------------------------------------
7 |
8 | @class ECXMLParser;
9 |
10 | @interface ECXMLElement : NSObject
11 | {
12 | NSString* mName;
13 | NSDictionary* mAttributes;
14 | NSMutableDictionary* mProperties;
15 | NSMutableArray* mElements;
16 | ECXMLElement* mParent;
17 | NSMutableString* mText;
18 | }
19 |
20 | @property (assign, nonatomic) ECXMLElement* parent;
21 | @property (retain, nonatomic) NSDictionary* attributes;
22 | @property (retain, nonatomic) NSMutableArray* elements;
23 | @property (retain, nonatomic) NSMutableDictionary* properties;
24 | @property (retain, nonatomic) NSString* name;
25 | @property (retain, nonatomic) NSMutableString* text;
26 |
27 | - (id) initWithName: (NSString*) name attributes: (NSDictionary*) attributes;
28 | - (void) addElement: (ECXMLElement*) element;
29 | - (void) addText: (NSString*) text;
30 | - (void) collapseElementsForParser:(ECXMLParser*)parser;
31 | - (NSString*) description;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Modules/ECUtilities/xml/ECXMLParser.h:
--------------------------------------------------------------------------------
1 | // --------------------------------------------------------------------------
2 | //! @author Sam Deane
3 | //! @date 12/04/2011
4 | //
5 | // Copyright 2012 Sam Deane, Elegant Chaos. All rights reserved.
6 | // --------------------------------------------------------------------------
7 |
8 |
9 |
10 | @class ECXMLElement;
11 |
12 |
13 | // --------------------------------------------------------------------------
14 | //! Helper object which manages fetching treasure data from
15 | //! an xml description at a URL.
16 | // --------------------------------------------------------------------------
17 |
18 | @interface ECXMLParser : NSObject
19 | {
20 | ECXMLElement* rootElement;
21 | NSString* indexKey;
22 | NSString* nameKey;
23 | NSString* valueKey;
24 | NSDictionary* arrayElements;
25 |
26 | ECXMLElement* mCurrentElement;
27 |
28 | }
29 |
30 | // --------------------------------------------------------------------------
31 | // Public Properties
32 | // --------------------------------------------------------------------------
33 |
34 | @property (strong, nonatomic) NSString* indexKey;
35 | @property (strong, nonatomic) NSString* nameKey;
36 | @property (strong, nonatomic) NSString* valueKey;
37 | @property (strong, nonatomic) NSDictionary* arrayElements;
38 |
39 | // --------------------------------------------------------------------------
40 | // Public Methods
41 | // --------------------------------------------------------------------------
42 |
43 | - (NSDictionary*)parseData:(NSData*)data;
44 | - (NSDictionary*)parseContentsOfURL:(NSURL*)url;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | What's This?
2 | ============
3 |
4 | This framework contains various Elegant Chaos utility classes for Mac and iOS development.
5 |
6 | These classes were written for my own use, so they aren't necessarily brilliantly
7 | documented at the moment, nor can I guarantee that the interface to them will remain unchanged.
8 |
9 | That said, I'm open sourcing them in case anyone finds them useful.
10 |
11 | Note: Reorganisation In Progress
12 | --------------------------------
13 |
14 | Recently I've decided to merge my Mac and iOS libraries (