Add StripLineBreaksValueTransformer and use it for displaying values in the variable...
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 1 May 2011 18:14:13 +0000 (14:14 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 1 May 2011 18:14:13 +0000 (14:14 -0400)
English.lproj/Debugger.xib
MacGDBp.xcodeproj/project.pbxproj
Source/StripLineBreaksValueTransformer.h [new file with mode: 0644]
Source/StripLineBreaksValueTransformer.m [new file with mode: 0644]

index c0df0350d21bff85c0942655bb6bf61acd1e36cb..36b266d14b2595172207244720265659b617212b 100644 (file)
@@ -12,7 +12,7 @@
                </object>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <integer value="46"/>
+                       <integer value="12"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                                <string key="NSToolbarItemPaletteLabel"/>
                                                                <nil key="NSToolbarItemToolTip"/>
                                                                <object class="NSButton" key="NSToolbarItemView" id="161298121">
-                                                                       <reference key="NSNextResponder"/>
+                                                                       <nil key="NSNextResponder"/>
                                                                        <int key="NSvFlags">268</int>
                                                                        <string key="NSFrame">{{0, 14}, {83, 18}}</string>
-                                                                       <reference key="NSSuperview"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <bool key="NSEnabled">YES</bool>
                                                                        <object class="NSButtonCell" key="NSCell" id="660002690">
                                                                                <int key="NSCellFlags">-2080244224</int>
                                                                                                                                                <reference key="NSTextColor" ref="973438763"/>
                                                                                                                                        </object>
                                                                                                                                        <object class="NSTextFieldCell" key="NSDataCell" id="770178811">
-                                                                                                                                               <int key="NSCellFlags">337772096</int>
-                                                                                                                                               <int key="NSCellFlags2">2048</int>
+                                                                                                                                               <int key="NSCellFlags">337772032</int>
+                                                                                                                                               <int key="NSCellFlags2">512</int>
                                                                                                                                                <string key="NSContents">Text Cell</string>
                                                                                                                                                <reference key="NSSupport" ref="26"/>
                                                                                                                                                <reference key="NSControlView" ref="395283679"/>
                                        </object>
                                        <int key="connectionID">53</int>
                                </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBBindingConnection" key="connection">
-                                               <string key="label">value: arrangedObjects.value</string>
-                                               <reference key="source" ref="893180664"/>
-                                               <reference key="destination" ref="240336030"/>
-                                               <object class="NSNibBindingConnector" key="connector">
-                                                       <reference key="NSSource" ref="893180664"/>
-                                                       <reference key="NSDestination" ref="240336030"/>
-                                                       <string key="NSLabel">value: arrangedObjects.value</string>
-                                                       <string key="NSBinding">value</string>
-                                                       <string key="NSKeyPath">arrangedObjects.value</string>
-                                                       <int key="NSNibBindingConnectorVersion">2</int>
-                                               </object>
-                                       </object>
-                                       <int key="connectionID">70</int>
-                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
                                                <string key="label">delegate</string>
                                        </object>
                                        <int key="connectionID">602</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">value: arrangedObjects.value</string>
+                                               <reference key="source" ref="893180664"/>
+                                               <reference key="destination" ref="240336030"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="893180664"/>
+                                                       <reference key="NSDestination" ref="240336030"/>
+                                                       <string key="NSLabel">value: arrangedObjects.value</string>
+                                                       <string key="NSBinding">value</string>
+                                                       <string key="NSKeyPath">arrangedObjects.value</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSArray" key="dict.sortedKeys">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <string>NSConditionallySetsEditable</string>
+                                                                       <string>NSValueTransformerName</string>
+                                                               </object>
+                                                               <object class="NSMutableArray" key="dict.values">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <boolean value="YES"/>
+                                                                       <string>StripLineBreaksValueTransformer</string>
+                                                               </object>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">603</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">602</int>
+                       <int key="maxID">603</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
index 1574b2be50a9a041745b5ea7d78fdf3352540949..8fcecaa2ec6ed108c7e0c966a9d0627dc28cfecc 100644 (file)
@@ -15,6 +15,7 @@
                1E0AFBB90FC2518700C67031 /* HUDIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E0AFBB80FC2518700C67031 /* HUDIcon.png */; };
                1E108E40136CC8B9002E34E0 /* EvalController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E108E3F136CC8B9002E34E0 /* EvalController.m */; };
                1E108E43136CC9A0002E34E0 /* Eval.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E108E41136CC9A0002E34E0 /* Eval.xib */; };
+               1E109019136DD92D002E34E0 /* StripLineBreaksValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E109018136DD92D002E34E0 /* StripLineBreaksValueTransformer.m */; };
                1E11814A1319805E003BFEF1 /* BSSourceViewTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E1181491319805E003BFEF1 /* BSSourceViewTextView.m */; };
                1E1E53030DF9B89800D334F9 /* Breakpoints.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E1E53010DF9B89800D334F9 /* Breakpoints.xib */; };
                1E2F0A6912D5371C00EBF675 /* Stop.png in Resources */ = {isa = PBXBuildFile; fileRef = 1E2F0A6812D5371B00EBF675 /* Stop.png */; };
@@ -83,6 +84,8 @@
                1E108E3E136CC8B9002E34E0 /* EvalController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EvalController.h; path = Source/EvalController.h; sourceTree = "<group>"; };
                1E108E3F136CC8B9002E34E0 /* EvalController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EvalController.m; path = Source/EvalController.m; sourceTree = "<group>"; };
                1E108E42136CC9A0002E34E0 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Eval.xib; sourceTree = "<group>"; };
+               1E109017136DD92D002E34E0 /* StripLineBreaksValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StripLineBreaksValueTransformer.h; path = Source/StripLineBreaksValueTransformer.h; sourceTree = "<group>"; };
+               1E109018136DD92D002E34E0 /* StripLineBreaksValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StripLineBreaksValueTransformer.m; path = Source/StripLineBreaksValueTransformer.m; sourceTree = "<group>"; };
                1E1181481319805E003BFEF1 /* BSSourceViewTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSSourceViewTextView.h; path = Source/BSSourceViewTextView.h; sourceTree = "<group>"; };
                1E1181491319805E003BFEF1 /* BSSourceViewTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSSourceViewTextView.m; path = Source/BSSourceViewTextView.m; sourceTree = "<group>"; };
                1E1E53020DF9B89800D334F9 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Breakpoints.xib; sourceTree = "<group>"; };
                                1EBF4D5C0EE35F0700B62769 /* StackController.m */,
                                1EC1337C127DBB00007946FC /* VariableNode.h */,
                                1EC1337D127DBB00007946FC /* VariableNode.m */,
+                               1E109017136DD92D002E34E0 /* StripLineBreaksValueTransformer.h */,
+                               1E109018136DD92D002E34E0 /* StripLineBreaksValueTransformer.m */,
                        );
                        name = Debugger;
                        sourceTree = "<group>";
                                1EDA9CF812DD13B300596211 /* BSLineNumberRulerView.mm in Sources */,
                                1E11814A1319805E003BFEF1 /* BSSourceViewTextView.m in Sources */,
                                1E108E40136CC8B9002E34E0 /* EvalController.m in Sources */,
+                               1E109019136DD92D002E34E0 /* StripLineBreaksValueTransformer.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/Source/StripLineBreaksValueTransformer.h b/Source/StripLineBreaksValueTransformer.h
new file mode 100644 (file)
index 0000000..27cbb3a
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * MacGDBp
+ * Copyright (c) 2011, Blue Static <http://www.bluestatic.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
+ * General Public License as published by the Free Software Foundation; either version 2 of the 
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with this program; if not, 
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#import <Cocoa/Cocoa.h>
+
+// This class will transform a string value into another string by stipping '\n',
+// '\t', and '\r' characters. This is useful for displaying multiline values in
+// the variable list.
+@interface StripLineBreaksValueTransformer : NSValueTransformer
+@end
diff --git a/Source/StripLineBreaksValueTransformer.m b/Source/StripLineBreaksValueTransformer.m
new file mode 100644 (file)
index 0000000..c02a9c0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * MacGDBp
+ * Copyright (c) 2011, Blue Static <http://www.bluestatic.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
+ * General Public License as published by the Free Software Foundation; either version 2 of the 
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with this program; if not, 
+ * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#import "StripLineBreaksValueTransformer.h"
+
+
+@implementation StripLineBreaksValueTransformer
+
++ (Class)transformedValueClass
+{
+  return [NSString class];
+}
+
+- (id)transformedValue:(id)value
+{
+  if (![value isKindOfClass:[[self class] transformedValueClass]])
+    return nil;
+
+  NSString* string = value;
+  string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
+  string = [string stringByReplacingOccurrencesOfString:@"\r" withString:@" "];
+  string = [string stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+  return string;
+}
+
+@end