mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
Merge 970d93e735
into 1f88190408
This commit is contained in:
commit
8c559d88b1
25 changed files with 556 additions and 23 deletions
Binary file not shown.
|
@ -24,9 +24,10 @@
|
|||
#ifndef INCLUDED_GormTabViewEditor_h
|
||||
#define INCLUDED_GormTabViewEditor_h
|
||||
|
||||
#import <AppKit/NSTabView.h>
|
||||
#include <GormCore/GormCore.h>
|
||||
|
||||
@interface GormTabViewEditor : GormViewWithSubviewsEditor
|
||||
@interface GormTabViewEditor : GormViewWithSubviewsEditor <NSTabViewDelegate>
|
||||
{
|
||||
int selectedSubview;
|
||||
GormInternalViewEditor *currentView;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include <InterfaceBuilder/InterfaceBuilder.h>
|
||||
#include <GormCore/GormCore.h>
|
||||
|
||||
|
@ -85,8 +84,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void) mouseDown: (NSEvent *) theEvent
|
||||
{
|
||||
BOOL onKnob = NO;
|
||||
|
@ -136,7 +133,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -162,8 +158,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (BOOL) tabView: (NSTabView *)tabView
|
||||
shouldSelectTabViewItem: (NSTabViewItem *)tabViewItem
|
||||
{
|
||||
|
@ -184,4 +178,5 @@
|
|||
{
|
||||
// [tabView selectFirstTabViewItem: self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
GormBindingsAbstractInspector = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
"_bindTo",
|
||||
"_controllerKey",
|
||||
"_modelKeyPath",
|
||||
"_raisesForNotApplicable",
|
||||
"_valueTransformer",
|
||||
"_controllerPopUp",
|
||||
"_alwaysPresentAppModalAlerts",
|
||||
"_raisesForNotApplicableKeys",
|
||||
"_validatesImmediately",
|
||||
"_multipleValuesPlaceholder",
|
||||
"_noSelectionPlaceholder",
|
||||
"_notApplicablePlaceholder",
|
||||
"_nullPlaceholder",
|
||||
"_multipleValuesTitle",
|
||||
"_noSelectionTitle",
|
||||
"_notApplicableTitle",
|
||||
"_nullTitle"
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
GormBindingsAbstractInspector = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
"_bindTo",
|
||||
"_controllerKey",
|
||||
"_modelKeyPath",
|
||||
"_raisesForNotApplicable",
|
||||
"_valueTransformer",
|
||||
"_controllerPopUp"
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"selectInspector:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
GormBindingsInspector = {
|
||||
Actions = (
|
||||
"selectInspector:"
|
||||
);
|
||||
Outlets = (
|
||||
"_containerView",
|
||||
"_bindingsPopUp"
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
}
|
BIN
GormCore/English.lproj/GormBindingsInspector.gorm/data.info
Normal file
BIN
GormCore/English.lproj/GormBindingsInspector.gorm/data.info
Normal file
Binary file not shown.
BIN
GormCore/English.lproj/GormBindingsInspector.gorm/objects.gorm
Normal file
BIN
GormCore/English.lproj/GormBindingsInspector.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -38,8 +38,13 @@ SUBPROJECTS =
|
|||
|
||||
GormCore_HEADER_FILES = \
|
||||
GormCore.h \
|
||||
GormBindingsInspector.h \
|
||||
GormBindingsAbstractInspector.h \
|
||||
GormBindingsContentInspector.h \
|
||||
GormAbstractDelegate.h \
|
||||
GormBindingsInspector.h \
|
||||
GormBoxEditor.h \
|
||||
GormCore.h \
|
||||
GormClassEditor.h \
|
||||
GormClassInspector.h \
|
||||
GormClassManager.h \
|
||||
|
@ -101,24 +106,16 @@ GormCore_HEADER_FILES = \
|
|||
GormWrapperLoader.h \
|
||||
NSCell+GormAdditions.h \
|
||||
NSColorWell+GormExtensions.h \
|
||||
NSString+methods.h \
|
||||
NSFontManager+GormExtensions.h \
|
||||
NSView+GormExtensions.h \
|
||||
GormGeneralPref.h \
|
||||
GormGuidelinePref.h \
|
||||
GormHeadersPref.h \
|
||||
GormPalettesPref.h \
|
||||
GormPluginsPref.h \
|
||||
GormPrefController.h \
|
||||
GormPrefs.h \
|
||||
GormShelfPref.h \
|
||||
GormXLIFFDocument.h \
|
||||
GormXLIFFDocument.h \
|
||||
GormXLIFFDocument.h \
|
||||
GormXLIFFDocument.h \
|
||||
GormXLIFFDocument.h \
|
||||
|
||||
GormCore_OBJC_FILES = \
|
||||
GormBindingsInspector.m \
|
||||
GormBindingsAbstractInspector.m \
|
||||
GormBindingsContentInspector.m \
|
||||
GormAbstractDelegate.m \
|
||||
GormBindingsInspector.m \
|
||||
GormBoxEditor.m \
|
||||
GormClassEditor.m \
|
||||
GormClassInspector.m \
|
||||
|
@ -178,6 +175,7 @@ GormCore_OBJC_FILES = \
|
|||
NSCell+GormAdditions.m \
|
||||
NSColorWell+GormExtensions.m \
|
||||
NSFontManager+GormExtensions.m \
|
||||
NSString+methods.m \
|
||||
NSView+GormExtensions.m \
|
||||
GormPrivate.m \
|
||||
GormGeneralPref.m \
|
||||
|
@ -187,7 +185,7 @@ GormCore_OBJC_FILES = \
|
|||
GormPluginsPref.m \
|
||||
GormPrefController.m \
|
||||
GormShelfPref.m \
|
||||
GormXLIFFDocument.m \
|
||||
GormXLIFFDocument.m
|
||||
|
||||
GormCore_RESOURCE_FILES = \
|
||||
Images/GormActionSelected.tiff \
|
||||
|
@ -223,6 +221,8 @@ GormCore_RESOURCE_FILES = \
|
|||
GormCore_LANGUAGES = English
|
||||
|
||||
GormCore_LOCALIZED_RESOURCE_FILES = \
|
||||
GormBindingsInspector.gorm \
|
||||
GormBindingsAbstractInspector.gorm \
|
||||
GormClassEditor.gorm \
|
||||
GormClassInspector.gorm \
|
||||
GormClassPanel.gorm \
|
||||
|
|
34
GormCore/GormBindingsAbstractInspector.h
Normal file
34
GormCore/GormBindingsAbstractInspector.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* All rights reserved */
|
||||
|
||||
#ifndef INCLUDED_GormBindingsAbstractInspector_H
|
||||
#define INCLUDED_GormBindingsAbstractInspector_H
|
||||
|
||||
#import <InterfaceBuilder/IBInspector.h>
|
||||
|
||||
@interface GormBindingsAbstractInspector : IBInspector
|
||||
{
|
||||
IBOutlet id _bindTo;
|
||||
IBOutlet id _controllerPopUp;
|
||||
IBOutlet id _controllerKey;
|
||||
IBOutlet id _modelKeyPath;
|
||||
IBOutlet id _raisesForNotApplicable;
|
||||
IBOutlet id _valueTransformer;
|
||||
|
||||
IBOutlet id _alwaysPresentsAppModalAlerts;
|
||||
IBOutlet id _raisesForNotApplicableKeys;
|
||||
IBOutlet id _validatesImmediately;
|
||||
|
||||
IBOutlet id _multipleValuesPlaceholder;
|
||||
IBOutlet id _noSelectionPlaceholder;
|
||||
IBOutlet id _notApplicablePlaceholder;
|
||||
IBOutlet id _nullPlaceholder;
|
||||
|
||||
IBOutlet id _multipleValuesTitle;
|
||||
IBOutlet id _noSelectionTitle;
|
||||
IBOutlet id _notApplicableTitle;
|
||||
IBOutlet id _nullTitle;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // INCLUDED_GormBindingsAbstractInspector_H
|
68
GormCore/GormBindingsAbstractInspector.m
Normal file
68
GormCore/GormBindingsAbstractInspector.m
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* All rights reserved */
|
||||
|
||||
#import <Foundation/NSSet.h>
|
||||
|
||||
#import "GormAbstractDelegate.h"
|
||||
#import "GormBindingsAbstractInspector.h"
|
||||
#import "GormDocument.h"
|
||||
|
||||
@implementation GormBindingsAbstractInspector
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
GormDocument *doc = (GormDocument *)[(id<IB>)[NSApp delegate] activeDocument];
|
||||
NSSet *tlo = [doc topLevelObjects];
|
||||
NSEnumerator *en = [tlo objectEnumerator];
|
||||
id o = nil;
|
||||
|
||||
NSDebugLog(@"+++++ controllerPopUp = %@", _controllerPopUp);
|
||||
// Update the pop up...
|
||||
[_controllerPopUp removeAllItems];
|
||||
while ((o = [en nextObject]) != nil)
|
||||
{
|
||||
NSString *name = [doc nameForObject: o];
|
||||
if ([name isEqualToString: @"NSMenu"] == NO && name != nil)
|
||||
{
|
||||
[_controllerPopUp addItemWithTitle: name];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add ones we know will be present...
|
||||
[_controllerPopUp addItemWithTitle: @"NSOwner"];
|
||||
|
||||
// Add ones we know will be present...
|
||||
[_controllerPopUp addItemWithTitle: @"NSApp"];
|
||||
|
||||
// Make sure all fields show...
|
||||
[_multipleValuesPlaceholder setHidden: NO];
|
||||
[_noSelectionPlaceholder setHidden: NO];
|
||||
[_notApplicablePlaceholder setHidden: NO];
|
||||
[_nullPlaceholder setHidden: NO];
|
||||
|
||||
[_multipleValuesTitle setHidden: NO];
|
||||
[_noSelectionTitle setHidden: NO];
|
||||
[_notApplicableTitle setHidden: NO];
|
||||
[_nullTitle setHidden: NO];
|
||||
}
|
||||
|
||||
- (IBAction) ok: (id)sender
|
||||
{
|
||||
[super ok: sender];
|
||||
}
|
||||
|
||||
- (IBAction) revert: (id)sender
|
||||
{
|
||||
[super revert: sender];
|
||||
}
|
||||
|
||||
@end
|
12
GormCore/GormBindingsContentInspector.h
Normal file
12
GormCore/GormBindingsContentInspector.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* All Rights Reserved */
|
||||
|
||||
#ifndef GormBindingsContentInspector_H_INCLUDE
|
||||
#define GormBindingsContentInspector_H_INCLUDE
|
||||
|
||||
#import "GormBindingsAbstractInspector.h"
|
||||
|
||||
@interface GormBindingsContentInspector : GormBindingsAbstractInspector
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
21
GormCore/GormBindingsContentInspector.m
Normal file
21
GormCore/GormBindingsContentInspector.m
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* All Rights Reserved */
|
||||
|
||||
#import "GormBindingsContentInspector.h"
|
||||
|
||||
@implementation GormBindingsContentInspector : GormBindingsAbstractInspector
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
[_multipleValuesPlaceholder setHidden: YES];
|
||||
[_noSelectionPlaceholder setHidden: YES];
|
||||
[_notApplicablePlaceholder setHidden: YES];
|
||||
[_nullPlaceholder setHidden: YES];
|
||||
|
||||
[_multipleValuesTitle setHidden: YES];
|
||||
[_noSelectionTitle setHidden: YES];
|
||||
[_notApplicableTitle setHidden: YES];
|
||||
[_nullTitle setHidden: YES];
|
||||
}
|
||||
@end
|
51
GormCore/GormBindingsInspector.h
Normal file
51
GormCore/GormBindingsInspector.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/** <title>GormBindingsInspector</title>
|
||||
|
||||
<abstract>allow user to select custom classes</abstract>
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: September 2002
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* All Rights reserved */
|
||||
|
||||
#ifndef INCLUDED_GormBindingsInspector_h
|
||||
#define INCLUDED_GormBindingsInspector_h
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <InterfaceBuilder/InterfaceBuilder.h>
|
||||
|
||||
@interface GormBindingsInspector : IBInspector
|
||||
{
|
||||
// outlets
|
||||
IBOutlet NSPopUpButton *_bindingsPopUp;
|
||||
IBOutlet NSBox *_containerView;
|
||||
|
||||
IBInspector *_inspectorObject;
|
||||
NSMutableArray *_bindingsArray;
|
||||
|
||||
NSUInteger _selectedInspectorIndex;
|
||||
}
|
||||
|
||||
- (IBAction) selectInspector: (id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif // INCLUDED_GormBindingsInspector_h
|
180
GormCore/GormBindingsInspector.m
Normal file
180
GormCore/GormBindingsInspector.m
Normal file
|
@ -0,0 +1,180 @@
|
|||
/** <title>GormClassInspector</title>
|
||||
|
||||
<abstract>allow user to select custom classes</abstract>
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: March 2003
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* All rights reserved */
|
||||
|
||||
#import "GormBindingsInspector.h"
|
||||
#import "GormDocument.h"
|
||||
#import "GormFunctions.h"
|
||||
#import "GormPrivate.h"
|
||||
#import "GormProtocol.h"
|
||||
#import "NSString+methods.h"
|
||||
|
||||
@implementation GormBindingsInspector
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [GormBindingsInspector class])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
// load the gui...
|
||||
if (![NSBundle loadNibNamed: @"GormBindingsInspector"
|
||||
owner: self])
|
||||
{
|
||||
NSLog(@"Could not open gorm file");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialize the array that holds the inspector names...
|
||||
_bindingsArray = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
_selectedInspectorIndex = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_bindingsArray);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *) _mapStringToInspectorName: (NSString *)string
|
||||
{
|
||||
NSString *capString = [string capitalizedFirstCharacterString];
|
||||
NSString *name = [NSString stringWithFormat: @"GormBindings%@Inspector", capString];
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
- (NSString *) _mapStringToTitle: (NSString *)string
|
||||
{
|
||||
NSString *title = [string splitCamelCaseString];
|
||||
title = [title capitalizedFirstCharacterString];
|
||||
return title;
|
||||
}
|
||||
|
||||
- (void) _loadInspector
|
||||
{
|
||||
if ([_bindingsArray count] > 0)
|
||||
{
|
||||
NSString *inspectorName = [_bindingsArray objectAtIndex: _selectedInspectorIndex];
|
||||
Class cls = NSClassFromString(inspectorName);
|
||||
NSString *nibName = @"GormBindingsAbstractInspector";
|
||||
|
||||
_inspectorObject = [[cls alloc] init];
|
||||
if (_inspectorObject != nil)
|
||||
{
|
||||
if (![NSBundle loadNibNamed: nibName owner: _inspectorObject])
|
||||
{
|
||||
NSLog(@"Could not load inspector for binding %@", inspectorName);
|
||||
return;
|
||||
}
|
||||
|
||||
[_containerView setContentView: [[_inspectorObject window] contentView]];
|
||||
}
|
||||
else
|
||||
{
|
||||
_inspectorObject = nil; // make certain this is nil, if load failed...
|
||||
NSLog(@"Could not instantiate class for %@", inspectorName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"No bindings exposed");
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _populate: (NSArray *)array
|
||||
{
|
||||
[_bindingsPopUp removeAllItems];
|
||||
[_bindingsArray removeAllObjects];
|
||||
|
||||
_selectedInspectorIndex = 0;
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
[_bindingsPopUp selectItemAtIndex: _selectedInspectorIndex];
|
||||
[self _loadInspector];
|
||||
}
|
||||
|
||||
- (void) setObject: (id)obj
|
||||
{
|
||||
NSArray *array = nil;
|
||||
|
||||
[super setObject: obj];
|
||||
array = [[self object] exposedBindings];
|
||||
[self _populate: array];
|
||||
[_inspectorObject setObject: obj];
|
||||
|
||||
NSLog(@"Bindings = %@, inspectors = %@", array, _bindingsArray);
|
||||
}
|
||||
|
||||
- (void) ok: (id)sender
|
||||
{
|
||||
[super ok: sender];
|
||||
[_inspectorObject ok: sender];
|
||||
}
|
||||
|
||||
- (void) revert: (id)sender
|
||||
{
|
||||
[super revert: sender];
|
||||
[_inspectorObject revert: sender];
|
||||
}
|
||||
|
||||
- (IBAction) selectInspector: (id)sender
|
||||
{
|
||||
_selectedInspectorIndex = [sender indexOfSelectedItem];
|
||||
[self _loadInspector];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1805,6 +1805,10 @@
|
|||
|
||||
// header file comments...
|
||||
[headerFile appendString: @"/* All rights reserved */\n\n"];
|
||||
|
||||
[headerFile appendString: [NSString stringWithFormat: @"#ifndef INCLUDED_%@_H", className]];
|
||||
[headerFile appendString: [NSString stringWithFormat: @"#define INCLUDED_%@_H", className]];
|
||||
|
||||
[sourceFile appendString: @"/* All rights reserved */\n\n"];
|
||||
[headerFile appendString: [NSString stringWithFormat: @"#ifndef %@_H_INCLUDE\n", className]];
|
||||
[headerFile appendString: [NSString stringWithFormat: @"#define %@_H_INCLUDE\n\n", className]];
|
||||
|
@ -1847,6 +1851,8 @@
|
|||
[headerFile appendString: [NSString stringWithFormat: @"#endif // %@_H_INCLUDE\n", className]];
|
||||
[sourceFile appendFormat: @"@end\n"];
|
||||
|
||||
[headerFile appendString: [NSString stringWithFormat: @"#endif // INCLUDED_%@_H", className]];
|
||||
|
||||
headerData = [headerFile dataUsingEncoding:
|
||||
[NSString defaultCStringEncoding]];
|
||||
sourceData = [sourceFile dataUsingEncoding:
|
||||
|
|
|
@ -244,6 +244,13 @@
|
|||
localizedLabel: _(@"Custom Class")
|
||||
inspectorClassName: [selectedObject classInspectorClassName]
|
||||
ordering: 4.0];
|
||||
|
||||
// Bindings inspector...
|
||||
[self addInspectorModeWithIdentifier: @"BindingsInspector"
|
||||
forObject: selectedObject
|
||||
localizedLabel: _(@"Bindings")
|
||||
inspectorClassName: [selectedObject bindingsInspectorClassName]
|
||||
ordering: 5.0];
|
||||
}
|
||||
|
||||
- (void) _refreshPopUp
|
||||
|
|
|
@ -86,6 +86,11 @@
|
|||
{
|
||||
return @"GormObjectEditor";
|
||||
}
|
||||
|
||||
- (NSString*) bindingsInspectorClassName
|
||||
{
|
||||
return @"GormBindingsInspector";
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSView (GormObjectAdditions)
|
||||
|
@ -509,8 +514,10 @@ static NSMapTable *docMap = 0;
|
|||
}
|
||||
else
|
||||
{
|
||||
[[NSApp delegate] displayConnectionBetween: [NSApp connectSource] and: obj];
|
||||
[[NSApp delegate] startConnecting];
|
||||
id delegate = [NSApp delegate];
|
||||
[delegate displayConnectionBetween: [delegate connectSource]
|
||||
and: obj];
|
||||
[delegate startConnecting];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
|
16
GormCore/NSString+methods.h
Normal file
16
GormCore/NSString+methods.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// This file is under the terms of the GPLv3, See COPYING for details
|
||||
|
||||
#ifndef INCLUDED_NSString_methods_H
|
||||
#define INCLUDED_NSString_methods_H
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@interface NSString (Methods)
|
||||
|
||||
- (NSString *) capitalizedFirstCharacterString;
|
||||
- (NSString *) splitCamelCaseString;
|
||||
- (NSString *) splitCamelCaseStringStartingFromIndex: (NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
68
GormCore/NSString+methods.m
Normal file
68
GormCore/NSString+methods.m
Normal file
|
@ -0,0 +1,68 @@
|
|||
#import "NSString+methods.h"
|
||||
|
||||
#import <Foundation/NSScanner.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
|
||||
// NSString category methods to add functionality to NSString
|
||||
|
||||
@implementation NSString (Methods)
|
||||
|
||||
// Return a string with the first character capitalized
|
||||
- (NSString *) capitalizedFirstCharacterString
|
||||
{
|
||||
if ([self length] == 0)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat: @"%@%@",
|
||||
[[self substringToIndex: 1] uppercaseString],
|
||||
[self substringFromIndex: 1]];
|
||||
}
|
||||
|
||||
- (NSString *) splitCamelCaseStringStartingFromIndex: (NSUInteger)index
|
||||
{
|
||||
NSString *newString = [self substringFromIndex: index];
|
||||
NSString *firstPartOfString = [newString substringToIndex: index];
|
||||
|
||||
NSString *result = [newString splitCamelCaseString];
|
||||
return [NSString stringWithFormat: @"%@%@", firstPartOfString, result];
|
||||
}
|
||||
|
||||
// Split a camel case string into a string with spaces
|
||||
// e.g. "camelCaseString" becomes "camel Case String"
|
||||
- (NSString *) splitCamelCaseString
|
||||
{
|
||||
NSMutableString *result = [NSMutableString string];
|
||||
NSScanner *scanner = [NSScanner scannerWithString: self];
|
||||
NSCharacterSet *uppercase = [NSCharacterSet uppercaseLetterCharacterSet];
|
||||
NSCharacterSet *lowercase = [NSCharacterSet lowercaseLetterCharacterSet];
|
||||
NSCharacterSet *letters = [NSCharacterSet letterCharacterSet];
|
||||
NSString *buffer;
|
||||
|
||||
while (![scanner isAtEnd])
|
||||
{
|
||||
if ([scanner scanCharactersFromSet: uppercase intoString: &buffer])
|
||||
{
|
||||
[result appendString: buffer];
|
||||
}
|
||||
|
||||
if ([scanner scanCharactersFromSet: lowercase intoString: &buffer])
|
||||
{
|
||||
if ([result length] > 0)
|
||||
{
|
||||
[result appendString: @" "];
|
||||
}
|
||||
|
||||
[result appendString: [buffer capitalizedString]];
|
||||
}
|
||||
if ([scanner scanCharactersFromSet: letters intoString: &buffer])
|
||||
{
|
||||
[result appendString: buffer];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
|
@ -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