From fc12745708ba9b3ecbdd68ef20558a40f2f73723 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 23 Oct 2006 05:16:42 +0000 Subject: [PATCH] Implemented simple help inspector to set tool tips on objects in Gorm. * English.lproj/GormHelpInspector.gorm: Help inspector .gorm file. * GNUmakefile: Add .gorm file. * GormCore/GNUmakefile: Add new class. * GormCore/GormConnectionInspector.m: Call [super ok:] from ok: method. * GormCore/GormHelpInspector.[hm]: Implemented the beginnings of the help inspector. * GormCore/GormObjectEditor.m: Add helpInspectorClassName implementation to NSView category. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23947 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 11 +++ .../GormHelpInspector.gorm/data.classes | 11 +++ .../GormHelpInspector.gorm/data.info | Bin 0 -> 184 bytes .../GormHelpInspector.gorm/objects.gorm | Bin 0 -> 2078 bytes GNUmakefile | 1 + GormCore/GNUmakefile | 2 + GormCore/GormConnectionInspector.m | 4 +- GormCore/GormHelpInspector.h | 10 +++ GormCore/GormHelpInspector.m | 83 ++++++++++++++++++ GormCore/GormObjectEditor.m | 7 ++ 10 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 English.lproj/GormHelpInspector.gorm/data.classes create mode 100644 English.lproj/GormHelpInspector.gorm/data.info create mode 100644 English.lproj/GormHelpInspector.gorm/objects.gorm create mode 100644 GormCore/GormHelpInspector.h create mode 100644 GormCore/GormHelpInspector.m diff --git a/ChangeLog b/ChangeLog index da24fbe5..86edab2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-10-23 01:14-EDT Gregory John Casamento + + * English.lproj/GormHelpInspector.gorm: Help inspector .gorm file. + * GNUmakefile: Add .gorm file. + * GormCore/GNUmakefile: Add new class. + * GormCore/GormConnectionInspector.m: Call [super ok:] from ok: method. + * GormCore/GormHelpInspector.[hm]: Implemented the beginnings of + the help inspector. + * GormCore/GormObjectEditor.m: Add helpInspectorClassName + implementation to NSView category. + 2006-10-21 23:51-EDT Gregory John Casamento * Palettes/3Containers/GormNSTableViewInspector.gorm: Added diff --git a/English.lproj/GormHelpInspector.gorm/data.classes b/English.lproj/GormHelpInspector.gorm/data.classes new file mode 100644 index 00000000..c7947b5a --- /dev/null +++ b/English.lproj/GormHelpInspector.gorm/data.classes @@ -0,0 +1,11 @@ +{ + "## Comment" = "Do NOT change this file, Gorm maintains it"; + GormHelpInspector = { + Actions = ( + ); + Outlets = ( + toolTip + ); + Super = IBInspector; + }; +} \ No newline at end of file diff --git a/English.lproj/GormHelpInspector.gorm/data.info b/English.lproj/GormHelpInspector.gorm/data.info new file mode 100644 index 0000000000000000000000000000000000000000..152bdecf1368d3ccf77b4dfc8ce7496bfad47564 GIT binary patch literal 184 zcmZ?w3oR~5El@}-O3uhEOEmxjqht#UD-Z(+j4>DnRtAiQj0_^~`9-;InK`KeMX71U zzKMB>>8V8wKw!wkz~L9{pOlrFTms@Vs4_4zG8r%#GK0i}ONuh{(t)Ck3~E4;)GnUqlcX?P<nij}q|raCmrl zLrr;HiBI%934{|w3gpG>*QlLkj7hG?8V`;|dK)L7B9zIEgjMgL*~Eu#`s z%baD-@XPTWA+ixgP!y|dEd#F?1ojg;Ce|pSbgT2`lro2sSf^|*ZM`wcT)j4fr)$Hp+Watgt|+hQIcy~BBvpNQ{6|)( zlb@+jSh&SPWo(7etcj>l&4og3CJkt5-_^`_m0$S2+qrPYlcNaQ$)=JRy<^7WR)%ObZ5$)2#>onel(T!sOf7Uox3g~RS#w8G3O?am zT`c(NUufs_7i{b|XBCFGQsQmVX3cDHoI2|M*@2!Ocj!tk^3-)Hz^=}qmSs@m*(BMA zZd`)ffCpMMe}4vkaQ(S-#~BQ;x9lMkB1CZ>_LntY#2~uy26UHWps7m% z7T_HXL7B#38Qv9JG(h#!<*7;#(k$MCgJmoDno%YZyq9dn-FPp8_mS9*yAgbV#6A%q z?y^>Dkp?Qx)p^6a@c{_2O~WvK2h#^??&VPPCC~lGNAOVWuuWy~{3di|_!4`Ml5MJg wIV($m2%nv5rzwoir*o9A)6Atm#)NSApp activeDocument] touch]; /* mark as edited. */ + + // mark as edited. + [super ok: sender]; [self updateButtons]; } diff --git a/GormCore/GormHelpInspector.h b/GormCore/GormHelpInspector.h new file mode 100644 index 00000000..4f53b05e --- /dev/null +++ b/GormCore/GormHelpInspector.h @@ -0,0 +1,10 @@ +/* All Rights reserved */ + +#include +#include + +@interface GormHelpInspector : IBInspector +{ + id toolTip; +} +@end diff --git a/GormCore/GormHelpInspector.m b/GormCore/GormHelpInspector.m new file mode 100644 index 00000000..7c8c611d --- /dev/null +++ b/GormCore/GormHelpInspector.m @@ -0,0 +1,83 @@ +/* All Rights reserved */ + +#include +#include "GormHelpInspector.h" +#include + +@implementation GormHelpInspector +- (id) init +{ + if ([super init] == nil) + { + return nil; + } + + if ([NSBundle loadNibNamed: @"GormHelpInspector" owner: self] == NO) + { + NSLog(@"Could not gorm GormHelpInspector"); + return nil; + } + + return self; +} + +- (void) ok: (id)sender +{ + id document = [(id)NSApp activeDocument]; + NSArray *cons = [document connectorsForDestination: object + ofClass: [NSIBHelpConnector class]]; + NSIBHelpConnector *con = nil; + + if([cons count] > 0) + { + NSEnumerator *en = [cons objectEnumerator]; + NSString *val = [sender stringValue]; + + if([val isEqualToString: @""] == NO) + { + while((con = [en nextObject]) != nil) + { + [con setMarker: [sender stringValue]]; + } + } + else + { + while((con = [en nextObject]) != nil) + { + [document removeConnector: con]; + } + } + } + else + { + con = [[NSIBHelpConnector alloc] init]; + + [con setFile: @"NSToolTipHelpKey"]; + [con setMarker: [sender stringValue]]; + [con setDestination: object]; + + [document addConnector: con]; + } + [super ok: sender]; +} + +- (void) revert: (id)sender +{ + id document = [(id)NSApp activeDocument]; + NSArray *cons = [document connectorsForDestination: object + ofClass: [NSIBHelpConnector class]]; + + if([cons count] > 0) + { + NSIBHelpConnector *con = [cons objectAtIndex: 0]; + NSString *val = [con marker]; + [toolTip setStringValue: val]; + } + [super revert: sender]; +} + +-(void) controlTextDidChange:(NSNotification *)aNotification +{ + [self ok: [aNotification object]]; +} +@end diff --git a/GormCore/GormObjectEditor.m b/GormCore/GormObjectEditor.m index 6eaecb31..6177e794 100644 --- a/GormCore/GormObjectEditor.m +++ b/GormCore/GormObjectEditor.m @@ -83,6 +83,13 @@ } @end +@implementation NSView (GormObjectAdditions) +- (NSString*) helpInspectorClassName +{ + return @"GormHelpInspector"; +} +@end + @implementation GormObjectEditor static NSMapTable *docMap = 0;