Update bindings and add content inspector

This commit is contained in:
Gregory John Casamento 2023-07-25 01:37:55 -04:00
parent c979d65aaa
commit f4bc0d54a1
15 changed files with 178 additions and 42 deletions

View file

@ -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;
};
}

View file

@ -1,6 +1,6 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GormBindingsContentInspector = {
GormBindingsAbstractInspector = {
Actions = (
);
Outlets = (

View file

@ -39,12 +39,12 @@ srcdir = .
SUBPROJECTS = Plugins
GormCore_HEADER_FILES = \
GormBindingsInspector.h \
GormBindingsContentInspector.h \
GormCore.h \
GormBindingsInspector.h \
GormBindingsAbstractInspector.h \
GormBindingsContentInspector.h \
GormAbstractDelegate.h \
GormBindingsInspector.h \
GormBindingsContentInspector.h \
GormBoxEditor.h \
GormCore.h \
GormClassEditor.h \
@ -114,10 +114,10 @@ GormCore_HEADER_FILES = \
GormCore_OBJC_FILES = \
GormBindingsInspector.m \
GormBindingsAbstractInspector.m \
GormBindingsContentInspector.m \
GormAbstractDelegate.m \
GormBindingsInspector.m \
GormBindingsContentInspector.m \
GormBoxEditor.m \
GormClassEditor.m \
GormClassInspector.m \
@ -262,6 +262,7 @@ GormCore_LANGUAGES = English
GormCore_LOCALIZED_RESOURCE_FILES = \
GormBindingsInspector.gorm \
GormBindingsAbstractInspector.gorm \
GormClassEditor.gorm \
GormClassInspector.gorm \
GormClassPanel.gorm \

View 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

View 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

View file

@ -1,20 +1,12 @@
/* All rights reserved */
/* All Rights Reserved */
#ifndef INCLUDED_GormBindingsContentInspector_H
#define INCLUDED_GormBindingsContentInspector_H
#ifndef GormBindingsContentInspector_H_INCLUDE
#define GormBindingsContentInspector_H_INCLUDE
#import <InterfaceBuilder/IBInspector.h>
#import "GormBindingsAbstractInspector.h"
@interface GormBindingsContentInspector : IBInspector
{
IBOutlet id _bindTo;
IBOutlet id _controllerKey;
IBOutlet id _modelKeyPath;
IBOutlet id _raisesForNotApplicable;
IBOutlet id _valueTransformer;
IBOutlet id _controllerPopUp;
}
@interface GormBindingsContentInspector : GormBindingsAbstractInspector
@end
#endif // INCLUDED_GormBindingsContentInspector_H
#endif

View file

@ -1,17 +1,21 @@
/* All rights reserved */
/* All Rights Reserved */
#import "GormBindingsContentInspector.h"
@implementation GormBindingsContentInspector
@implementation GormBindingsContentInspector : GormBindingsAbstractInspector
- (IBAction) ok: (id)sender
- (void) awakeFromNib
{
[super ok: sender];
}
[super awakeFromNib];
- (IBAction) revert: (id)sender
{
[super revert: sender];
}
[_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

View file

@ -88,24 +88,32 @@
- (void) _loadInspector
{
NSString *inspectorName = [_bindingsArray objectAtIndex: _selectedInspectorIndex];
Class cls = NSClassFromString(inspectorName);
_inspectorObject = [[cls alloc] init];
if (_inspectorObject != nil)
if ([_bindingsArray count] > 0)
{
if (![NSBundle loadNibNamed: inspectorName owner: _inspectorObject])
{
NSLog(@"Could not load inspector for binding %@", inspectorName);
return;
}
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
{
_inspectorObject = nil; // make certain this is nil, if load failed...
NSLog(@"Could not instantiate class for %@", inspectorName);
NSLog(@"No bindings exposed");
}
}

View file

@ -514,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;
}
}