mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Add code to generate .gorm file names needed for each binding as well as generate the title for the popup
This commit is contained in:
parent
48f13bd49b
commit
ce36666d79
10 changed files with 88 additions and 10 deletions
|
@ -4,6 +4,8 @@
|
|||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
"_containerView",
|
||||
"_bindingsPopUp"
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -39,8 +39,9 @@ srcdir = .
|
|||
include ../Version
|
||||
|
||||
GormCore_HEADER_FILES = \
|
||||
GormCore.h \
|
||||
GormBindingsInspector.h \
|
||||
GormBoxEditor.h \
|
||||
GormCore.h \
|
||||
GormClassEditor.h \
|
||||
GormClassInspector.h \
|
||||
GormClassManager.h \
|
||||
|
@ -101,11 +102,12 @@ GormCore_HEADER_FILES = \
|
|||
GormWrapperLoader.h \
|
||||
NSCell+GormAdditions.h \
|
||||
NSColorWell+GormExtensions.h \
|
||||
NSString+methods.h \
|
||||
NSFontManager+GormExtensions.h \
|
||||
NSView+GormExtensions.h \
|
||||
GormBindingsInspector.h
|
||||
|
||||
GormCore_OBJC_FILES = \
|
||||
GormBindingsInspector.m \
|
||||
GormBoxEditor.m \
|
||||
GormClassEditor.m \
|
||||
GormClassInspector.m \
|
||||
|
@ -165,9 +167,9 @@ GormCore_OBJC_FILES = \
|
|||
NSCell+GormAdditions.m \
|
||||
NSColorWell+GormExtensions.m \
|
||||
NSFontManager+GormExtensions.m \
|
||||
NSString+methods.m \
|
||||
NSView+GormExtensions.m \
|
||||
GormPrivate.m \
|
||||
GormBindingsInspector.m
|
||||
GormPrivate.m
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
-include GNUmakefile.local
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
@interface GormBindingsInspector : IBInspector
|
||||
{
|
||||
// outlets
|
||||
IBOutlet NSPopUpButton *_bindingsPopup;
|
||||
IBOutlet NSPopUpButton *_bindingsPopUp;
|
||||
IBOutlet NSBox *_containerView;
|
||||
|
||||
NSMutableArray *_bindingsArray;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#import "GormFunctions.h"
|
||||
#import "GormPrivate.h"
|
||||
#import "GormProtocol.h"
|
||||
#import "NSString+methods.h"
|
||||
|
||||
@implementation GormBindingsInspector
|
||||
+ (void) initialize
|
||||
|
@ -52,14 +53,74 @@
|
|||
NSLog(@"Could not open gorm file");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialize the array that holds the inspector names...
|
||||
_bindingsArray = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_bindingsArray);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *) _mapStringToInspectorName: (NSString *)string
|
||||
{
|
||||
NSString *capString = [string capitalizedString];
|
||||
NSString *name = [NSString stringWithFormat: @"GormBindings%@Inspector", capString];
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
- (NSString *) _mapStringToTitle: (NSString *)string
|
||||
{
|
||||
NSString *splitString = [string splitCamelCaseString];
|
||||
NSString *title = [splitString capitalizedString];
|
||||
return title;
|
||||
}
|
||||
|
||||
- (void) _populatePopUp: (NSArray *)array
|
||||
{
|
||||
[_bindingsPopUp removeAllItems];
|
||||
[_bindingsArray removeAllObjects];
|
||||
|
||||
if ([array count] == 0 || array == nil)
|
||||
{
|
||||
[_bindingsPopUp addItemWithTitle: @"No Bindings"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSEnumerator *en = [array objectEnumerator];
|
||||
NSString *string = nil;
|
||||
|
||||
while ((string = [en nextObject]) != nil)
|
||||
{
|
||||
NSString *title = [self _mapStringToTitle: string];
|
||||
NSString *inspector = [self _mapStringToInspectorName: string];
|
||||
|
||||
[_bindingsPopUp addItemWithTitle: title];
|
||||
[_bindingsArray addObject: inspector];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setObject: (id)obj
|
||||
{
|
||||
NSArray *array = nil;
|
||||
|
||||
[super setObject: obj];
|
||||
array = [[self object] exposedBindings];
|
||||
[self _populatePopUp: array];
|
||||
|
||||
NSLog(@"Bindings = %@, inspectors = %@", array, _bindingsArray);
|
||||
}
|
||||
|
||||
- (void) ok: (id)sender
|
||||
{
|
||||
[super ok: sender];
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
forObject: selectedObject
|
||||
localizedLabel: _(@"Bindings")
|
||||
inspectorClassName: [selectedObject bindingsInspectorClassName]
|
||||
ordering: 4.0];
|
||||
ordering: 5.0];
|
||||
}
|
||||
|
||||
- (void) _refreshPopUp
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
{
|
||||
if((self = [self init]))
|
||||
{
|
||||
ASSIGN(path, nil);
|
||||
ASSIGN(path, (id)nil);
|
||||
ASSIGN(fileName, aFileName);
|
||||
ASSIGN(name, [fileName stringByDeletingPathExtension]);
|
||||
ASSIGN(fileType, [fileName pathExtension]);
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
#ifndef INCLUDED_NSString_methods_H
|
||||
#define INCLUDED_NSString_methods_H
|
||||
|
||||
@import <Foundation/NSString.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@interface NSString (Methods)
|
||||
|
||||
@interface NSString (methods}
|
||||
- (NSString *) splitCamelCaseString;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#import "NSString+methods.h"
|
||||
|
||||
#import <Foundation/NSScanner.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
|
||||
// NSString category methods to add functionality to NSString
|
||||
|
||||
@implementation NSString (methods)
|
||||
@implementation NSString (Methods)
|
||||
|
||||
// Split a camel case string into a string with spaces
|
||||
// e.g. "camelCaseString" becomes "camel Case String"
|
||||
|
|
|
@ -82,6 +82,11 @@
|
|||
*/
|
||||
- (NSString*) classInspectorClassName;
|
||||
|
||||
/**
|
||||
* Name of bindings inspector.
|
||||
*/
|
||||
- (NSString*) bindingsInspectorClassName;
|
||||
|
||||
/**
|
||||
* Name of the editor for the receiver.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue