Add language view controller for accessory view to source

This commit is contained in:
Gregory John Casamento 2023-07-14 16:33:03 -04:00
parent 8ce232da73
commit 947b350444
7 changed files with 65 additions and 29 deletions

View file

@ -65,6 +65,7 @@ GormCore_HEADER_FILES = \
GormImageInspector.h \
GormInspectorsManager.h \
GormInternalViewEditor.h \
GormLanguageViewController.h \
GormMatrixEditor.h \
GormNSPanel.h \
GormNSSplitViewInspector.h \
@ -139,6 +140,7 @@ GormCore_OBJC_FILES = \
GormImageInspector.m \
GormInspectorsManager.m \
GormInternalViewEditor.m \
GormLanguageViewController.m \
GormMatrixEditor.m \
GormNSPanel.m \
GormNSSplitViewInspector.m \

View file

@ -0,0 +1,17 @@
/* All rights reserved */
#ifndef GormLanguageController_H_INCLUDE
#define GormLanguageController_H_INCLUDE
#import <AppKit/NSViewController.h>
#import <AppKit/NSPopUpButton.h>
@interface GormLanguageViewController : NSViewController
{
IBOutlet NSPopUpButton *sourceLanguage;
IBOutlet NSPopUpButton *targetLanguage;
}
@end
#endif // GormLanguageController_H_INCLUDE

View file

@ -0,0 +1,7 @@
/* All rights reserved */
#import "GormLanguageViewController.h"
@implementation GormLanguageViewController
@end

View file

@ -734,6 +734,7 @@ static BOOL done_editing;
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
@ -742,8 +743,8 @@ static BOOL done_editing;
NSPoint loc = [sender draggingLocation];
NSPoint mouseDownPoint = [_EO convertPoint: loc fromView: nil];
[NSApp displayConnectionBetween: [NSApp connectSource]
and: [self connectTargetAtPoint: mouseDownPoint]];
[delegate displayConnectionBetween: [delegate connectSource]
and: [self connectTargetAtPoint: mouseDownPoint]];
return NSDragOperationLink;
}
return [super draggingEntered: sender];
@ -755,15 +756,16 @@ static BOOL done_editing;
NSArray *types;
NSPoint dropPoint = [sender draggedImageLocation];
NSPoint mouseDownPoint = [_EO convertPoint: dropPoint fromView: nil];
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType])
{
[NSApp displayConnectionBetween: [NSApp connectSource]
and: [self connectTargetAtPoint: mouseDownPoint]];
[NSApp startConnecting];
[delegate displayConnectionBetween: [delegate connectSource]
and: [self connectTargetAtPoint: mouseDownPoint]];
[delegate startConnecting];
}
else if ([types containsObject: GormImagePboardType] == YES ||
[types containsObject: GormSoundPboardType] == YES)

View file

@ -126,12 +126,13 @@
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType] == YES)
{
[NSApp displayConnectionBetween: [NSApp connectSource]
[delegate displayConnectionBetween: [delegate connectSource]
and: _EO];
return NSDragOperationLink;
}
@ -170,12 +171,13 @@
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType] == YES)
{
[NSApp displayConnectionBetween: [NSApp connectSource]
[delegate displayConnectionBetween: [delegate connectSource]
and: _EO];
return NSDragOperationLink;
}
@ -193,15 +195,16 @@
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType])
{
[NSApp displayConnectionBetween: [NSApp connectSource]
[delegate displayConnectionBetween: [delegate connectSource]
and: _EO];
[NSApp startConnecting];
[delegate startConnecting];
}
else if ([types containsObject: IBViewPboardType] == YES)
{

View file

@ -1205,6 +1205,7 @@ static BOOL currently_displaying = NO;
NSPasteboard *pb;
NSString *name = [document nameForObject: anObject];
NSPoint dragPoint = [theEvent locationInWindow];
id delegate = [NSApp delegate];
if(name != nil)
{
@ -1212,10 +1213,10 @@ static BOOL currently_displaying = NO;
[pb declareTypes: [NSArray arrayWithObject: GormLinkPboardType]
owner: self];
[pb setString: name forType: GormLinkPboardType];
[NSApp displayConnectionBetween: anObject and: nil];
[NSApp startConnecting];
[delegate displayConnectionBetween: anObject and: nil];
[delegate startConnecting];
[self dragImage: [NSApp linkImage]
[self dragImage: [delegate linkImage]
at: dragPoint
offset: NSZeroSize
event: theEvent
@ -1229,13 +1230,14 @@ static BOOL currently_displaying = NO;
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType] == YES)
{
[NSApp displayConnectionBetween: [NSApp connectSource]
and: _editedObject];
[delegate displayConnectionBetween: [delegate connectSource]
and: _editedObject];
return NSDragOperationLink;
}
else if ([types firstObjectCommonWithArray: [NSView acceptedViewResourcePasteboardTypes]] != nil)
@ -1258,13 +1260,14 @@ static BOOL currently_displaying = NO;
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = [NSApp delegate];
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType] == YES)
{
[NSApp displayConnectionBetween: [NSApp connectSource]
and: nil];
[delegate displayConnectionBetween: [delegate connectSource]
and: nil];
}
}
@ -1359,32 +1362,34 @@ static BOOL currently_displaying = NO;
{
NSPasteboard *dragPb;
NSArray *types;
id delegate = nil;
NSPoint point = [sender draggingLocation];
id delegate = [NSApp delegate];
id viewDelegate = nil;
dragPb = [sender draggingPasteboard];
types = [dragPb types];
if ([types containsObject: GormLinkPboardType])
{
[NSApp displayConnectionBetween: [NSApp connectSource]
and: _editedObject];
[NSApp startConnecting];
[delegate displayConnectionBetween: [delegate connectSource]
and: _editedObject];
[delegate startConnecting];
}
else if ((delegate = [self _selectDelegate: sender]) != nil)
else if ((viewDelegate = [self _selectDelegate: sender]) != nil)
{
if([delegate respondsToSelector: @selector(shouldDrawConnectionFrame)])
if([viewDelegate respondsToSelector: @selector(shouldDrawConnectionFrame)])
{
if([delegate shouldDrawConnectionFrame])
if([viewDelegate shouldDrawConnectionFrame])
{
[NSApp displayConnectionBetween: [NSApp connectSource]
and: _editedObject];
[delegate displayConnectionBetween: [delegate connectSource]
and: _editedObject];
}
}
if([delegate respondsToSelector: @selector(depositViewResourceFromPasteboard:onObject:atPoint:)])
if([viewDelegate respondsToSelector:
@selector(depositViewResourceFromPasteboard:onObject:atPoint:)])
{
[delegate depositViewResourceFromPasteboard: dragPb
[viewDelegate depositViewResourceFromPasteboard: dragPb
onObject: _editedObject
atPoint: point];