From 933156c0d046844a24b2de79f15f79e787672d07 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 1 May 2011 14:14:13 -0400 Subject: [PATCH] Add StripLineBreaksValueTransformer and use it for displaying values in the variable list. --- English.lproj/Debugger.xib | 57 ++++++++++++++---------- MacGDBp.xcodeproj/project.pbxproj | 6 +++ Source/StripLineBreaksValueTransformer.h | 23 ++++++++++ Source/StripLineBreaksValueTransformer.m | 39 ++++++++++++++++ 4 files changed, 102 insertions(+), 23 deletions(-) create mode 100644 Source/StripLineBreaksValueTransformer.h create mode 100644 Source/StripLineBreaksValueTransformer.m diff --git a/English.lproj/Debugger.xib b/English.lproj/Debugger.xib index c0df035..36b266d 100644 --- a/English.lproj/Debugger.xib +++ b/English.lproj/Debugger.xib @@ -12,7 +12,7 @@ YES - + YES @@ -100,11 +100,9 @@ - + 268 {{0, 14}, {83, 18}} - - YES -2080244224 @@ -611,8 +609,8 @@ - 337772096 - 2048 + 337772032 + 512 Text Cell @@ -1334,22 +1332,6 @@ 53 - - - value: arrangedObjects.value - - - - - - value: arrangedObjects.value - value - arrangedObjects.value - 2 - - - 70 - delegate @@ -1722,6 +1704,35 @@ 602 + + + value: arrangedObjects.value + + + + + + value: arrangedObjects.value + value + arrangedObjects.value + + YES + + YES + NSConditionallySetsEditable + NSValueTransformerName + + + YES + + StripLineBreaksValueTransformer + + + 2 + + + 603 + @@ -2393,7 +2404,7 @@ - 602 + 603 diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 1574b2b..8fcecaa 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -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 = ""; }; 1E108E3F136CC8B9002E34E0 /* EvalController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EvalController.m; path = Source/EvalController.m; sourceTree = ""; }; 1E108E42136CC9A0002E34E0 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Eval.xib; sourceTree = ""; }; + 1E109017136DD92D002E34E0 /* StripLineBreaksValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StripLineBreaksValueTransformer.h; path = Source/StripLineBreaksValueTransformer.h; sourceTree = ""; }; + 1E109018136DD92D002E34E0 /* StripLineBreaksValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StripLineBreaksValueTransformer.m; path = Source/StripLineBreaksValueTransformer.m; sourceTree = ""; }; 1E1181481319805E003BFEF1 /* BSSourceViewTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSSourceViewTextView.h; path = Source/BSSourceViewTextView.h; sourceTree = ""; }; 1E1181491319805E003BFEF1 /* BSSourceViewTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BSSourceViewTextView.m; path = Source/BSSourceViewTextView.m; sourceTree = ""; }; 1E1E53020DF9B89800D334F9 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Breakpoints.xib; sourceTree = ""; }; @@ -291,6 +294,8 @@ 1EBF4D5C0EE35F0700B62769 /* StackController.m */, 1EC1337C127DBB00007946FC /* VariableNode.h */, 1EC1337D127DBB00007946FC /* VariableNode.m */, + 1E109017136DD92D002E34E0 /* StripLineBreaksValueTransformer.h */, + 1E109018136DD92D002E34E0 /* StripLineBreaksValueTransformer.m */, ); name = Debugger; sourceTree = ""; @@ -472,6 +477,7 @@ 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 index 0000000..27cbb3a --- /dev/null +++ b/Source/StripLineBreaksValueTransformer.h @@ -0,0 +1,23 @@ +/* + * MacGDBp + * Copyright (c) 2011, Blue Static + * + * 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 + +// 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 index 0000000..c02a9c0 --- /dev/null +++ b/Source/StripLineBreaksValueTransformer.m @@ -0,0 +1,39 @@ +/* + * MacGDBp + * Copyright (c) 2011, Blue Static + * + * 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 -- 2.22.5