Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed mix-up between 09_Undo/RaiseMan_A and 09_Undo/RaiseMan_B.

  • Loading branch information...
commit bdbfd5bcadb09b65615037693fd1ef34cf3adbfe 1 parent 6c225a8
@jsyedidia jsyedidia authored
View
8 09_Undo/RaiseMan_A/RaiseMan.xcodeproj/project.pbxproj
@@ -14,7 +14,7 @@
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
AB0670A50DED05BE00E0ABDA /* Nu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0670A40DED05BE00E0ABDA /* Nu.framework */; };
- AB0670A70DED05E400E0ABDA /* main.nu in Resources */ = {isa = PBXBuildFile; fileRef = AB0670A60DED05E400E0ABDA /* main.nu */; };
+ AB9402F70DF385F400D31812 /* main.nu in Resources */ = {isa = PBXBuildFile; fileRef = AB9402F60DF385F400D31812 /* main.nu */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -31,7 +31,7 @@
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D15AC370486D014006FF6A4 /* RaiseMan.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RaiseMan.app; sourceTree = BUILT_PRODUCTS_DIR; };
AB0670A40DED05BE00E0ABDA /* Nu.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nu.framework; path = /Library/Frameworks/Nu.framework; sourceTree = "<absolute>"; };
- AB0670A60DED05E400E0ABDA /* main.nu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.nu; path = nu/main.nu; sourceTree = "<group>"; };
+ AB9402F60DF385F400D31812 /* main.nu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.nu; path = nu/main.nu; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -119,7 +119,7 @@
AB0670A30DED05A900E0ABDA /* Nu */ = {
isa = PBXGroup;
children = (
- AB0670A60DED05E400E0ABDA /* main.nu */,
+ AB9402F60DF385F400D31812 /* main.nu */,
);
name = Nu;
sourceTree = "<group>";
@@ -171,7 +171,7 @@
8D15AC2D0486D014006FF6A4 /* MainMenu.nib in Resources */,
8D15AC2E0486D014006FF6A4 /* MyDocument.nib in Resources */,
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
- AB0670A70DED05E400E0ABDA /* main.nu in Resources */,
+ AB9402F70DF385F400D31812 /* main.nu in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
29 09_Undo/RaiseMan_A/nu/main.nu
@@ -17,39 +17,12 @@
(else (super setNilValueForKey:key)))))
(class MyDocument is NSDocument
- (ivar (id) employees (id) employeeController (id) tableView)
+ (ivar (id) employees)
(- (id) init is
(super init)
(self setEmployees:(array))
self)
-
- (- (BOOL) endEditing is
- (set w (@tableView window))
- (set editingEnded (w makeFirstResponder:w))
- (unless (editingEnded) NO)
- (set undo (self undoManager))
- (if (undo groupingLevel)
- (undo endUndoGrouping)
- (undo beginUndoGrouping))
- YES)
-
- (- (void) createEmployee: (id) sender is
- ; If a field is being edited, end editing
- (unless (eq NO (self endEditing))
-
- (set p (@employeeController newObject))
- (@employeeController addObject:p)
-
- ; In case the user has sorted the content array
- (@employeeController rearrangeObjects)
-
- ; Find the row of the new object
- (set a (@employeeController arrangedObjects))
- (set row (a indexOfObjectIdenticalTo:p))
-
- ; Start editing in the first column
- (@tableView editColumn:0 row:row withEvent:nil select:YES)))
(- (void) startObservingPerson: (id) person is
(person addObserver:self
View
8 09_Undo/RaiseMan_B/RaiseMan.xcodeproj/project.pbxproj
@@ -14,7 +14,7 @@
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
AB1DE74D0DF37472008275EC /* Nu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1DE74C0DF37472008275EC /* Nu.framework */; };
- AB1DE7510DF37490008275EC /* main.nu in Resources */ = {isa = PBXBuildFile; fileRef = AB1DE7500DF37490008275EC /* main.nu */; };
+ AB9403130DF3861600D31812 /* main.nu in Resources */ = {isa = PBXBuildFile; fileRef = AB9403120DF3861600D31812 /* main.nu */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -31,7 +31,7 @@
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D15AC370486D014006FF6A4 /* RaiseMan.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RaiseMan.app; sourceTree = BUILT_PRODUCTS_DIR; };
AB1DE74C0DF37472008275EC /* Nu.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nu.framework; path = /Library/Frameworks/Nu.framework; sourceTree = "<absolute>"; };
- AB1DE7500DF37490008275EC /* main.nu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.nu; path = ../RaiseMan_A/nu/main.nu; sourceTree = SOURCE_ROOT; };
+ AB9403120DF3861600D31812 /* main.nu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.nu; path = nu/main.nu; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -119,7 +119,7 @@
AB1DE7480DF37461008275EC /* Nu */ = {
isa = PBXGroup;
children = (
- AB1DE7500DF37490008275EC /* main.nu */,
+ AB9403120DF3861600D31812 /* main.nu */,
);
name = Nu;
sourceTree = "<group>";
@@ -171,7 +171,7 @@
8D15AC2D0486D014006FF6A4 /* MainMenu.nib in Resources */,
8D15AC2E0486D014006FF6A4 /* MyDocument.nib in Resources */,
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
- AB1DE7510DF37490008275EC /* main.nu in Resources */,
+ AB9403130DF3861600D31812 /* main.nu in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
29 09_Undo/RaiseMan_B/nu/main.nu
@@ -17,12 +17,39 @@
(else (super setNilValueForKey:key)))))
(class MyDocument is NSDocument
- (ivar (id) employees)
+ (ivar (id) employees (id) employeeController (id) tableView)
(- (id) init is
(super init)
(self setEmployees:(array))
self)
+
+ (- (BOOL) endEditing is
+ (set w (@tableView window))
+ (set editingEnded (w makeFirstResponder:w))
+ (unless (editingEnded) NO)
+ (set undo (self undoManager))
+ (if (undo groupingLevel)
+ (undo endUndoGrouping)
+ (undo beginUndoGrouping))
+ YES)
+
+ (- (void) createEmployee: (id) sender is
+ ; If a field is being edited, end editing
+ (unless (eq NO (self endEditing))
+
+ (set p (@employeeController newObject))
+ (@employeeController addObject:p)
+
+ ; In case the user has sorted the content array
+ (@employeeController rearrangeObjects)
+
+ ; Find the row of the new object
+ (set a (@employeeController arrangedObjects))
+ (set row (a indexOfObjectIdenticalTo:p))
+
+ ; Start editing in the first column
+ (@tableView editColumn:0 row:row withEvent:nil select:YES)))
(- (void) startObservingPerson: (id) person is
(person addObserver:self
Please sign in to comment.
Something went wrong with that request. Please try again.