diff --git a/ChangeLog b/ChangeLog index cdd0b919..2dfe364c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2006-10-01 22:23-EDT Gregory John Casamento + + * English.lproj/GormDocument.gorm: Added section in file section + to show fileType. + * GormCore/GormFilePrefsManager.m: Changed version number from + 1,1,0 to 1,1,2. + * GormCore/GormInspectorsManager.m: Removed kludge from + setCurrentInspector:. + * GormCore/GormScrollViewEditor.m: Remove code which returns + the table view editor in editorClassName. In mouseDown: + remove check in mouseDown: for NSScroller and subclasses. + * GormCore/GormViewEditor.h: Declare frameDidChange: + * Palettes/3Containers/GormTableViewEditor.m: Remove redundant + implementation of performDragOperation:. Call draggingUpdated + instead. + * Palettes/4Data/DataPalette.m: Change minimum size. + * Palettes/4Data/GormTextViewEditor.m: Add handleNotification: + and add initWithObject:inDocument:. + 2006-09-30 23:09-EDT Gregory John Casamento * GormCore/GormGModelWrapperLoader.m: Cleanup NSLog() diff --git a/English.lproj/GormDocument.gorm/data.classes b/English.lproj/GormDocument.gorm/data.classes index 45a24a53..86cb62af 100644 --- a/English.lproj/GormDocument.gorm/data.classes +++ b/English.lproj/GormDocument.gorm/data.classes @@ -30,7 +30,8 @@ selectionBox, filePrefsView, filePrefsManager, - filePrefsWindow + filePrefsWindow, + fileType ); Super = NSDocument; }; @@ -50,4 +51,46 @@ ); Super = NSObject; }; + NewClass = { + Actions = ( + ); + Outlets = ( + ); + Super = NSButton; + }; + NewClass1 = { + Actions = ( + ); + Outlets = ( + ); + Super = NewClass; + }; + NewClass2 = { + Actions = ( + ); + Outlets = ( + ); + Super = NSButton; + }; + NewClass3 = { + Actions = ( + ); + Outlets = ( + ); + Super = NewClass2; + }; + NewClass4 = { + Actions = ( + ); + Outlets = ( + ); + Super = NewClass3; + }; + NewClass5 = { + Actions = ( + ); + Outlets = ( + ); + Super = NSOpenGLView; + }; } \ No newline at end of file diff --git a/English.lproj/GormDocument.gorm/objects.gorm b/English.lproj/GormDocument.gorm/objects.gorm index 593a8666..ce7148bb 100644 Binary files a/English.lproj/GormDocument.gorm/objects.gorm and b/English.lproj/GormDocument.gorm/objects.gorm differ diff --git a/GormCore/GormFilePrefsManager.m b/GormCore/GormFilePrefsManager.m index 135e0f70..624a6f69 100644 --- a/GormCore/GormFilePrefsManager.m +++ b/GormCore/GormFilePrefsManager.m @@ -85,7 +85,7 @@ NSString *formatVersion(int version) + (int) currentVersion { - return appVersion(1,1,0); + return appVersion(1,1,2); } - (void) awakeFromNib diff --git a/GormCore/GormInspectorsManager.m b/GormCore/GormInspectorsManager.m index adb13883..17721f30 100644 --- a/GormCore/GormInspectorsManager.m +++ b/GormCore/GormInspectorsManager.m @@ -292,24 +292,6 @@ NSDebugLog(@"current %i",current); - // Operate on the document view if the selected object is a NSScrollView - if ([obj isKindOfClass: [NSScrollView class]] && - [(NSScrollView *)obj documentView]) - { - id docView = [(NSScrollView *)obj documentView]; - - // FIXME: Really need to find a more generalized way to do this. - if ([docView isKindOfClass: [NSTableView class]]) - { - obj = docView; - if ([obj selectedColumn] != -1) - { - obj = [[obj tableColumns] objectAtIndex: - [obj selectedColumn]]; - } - } - } - // refresh object. selectedObject = obj; diff --git a/GormCore/GormScrollViewEditor.m b/GormCore/GormScrollViewEditor.m index e8b312c1..a5b22872 100644 --- a/GormCore/GormScrollViewEditor.m +++ b/GormCore/GormScrollViewEditor.m @@ -37,11 +37,6 @@ - (NSString*) editorClassName { - if ([[self documentView] isKindOfClass: [NSTableView class]]) - { - return [[self documentView] editorClassName]; - } - return @"GormScrollViewEditor"; } @end @@ -99,22 +94,28 @@ if ([parent respondsToSelector: @selector(selection)] && [[parent selection] containsObject: _EO]) { - IBKnobPosition knob = IBNoneKnobPosition; + IBKnobPosition knob = IBNoneKnobPosition; NSPoint mouseDownPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil]; knob = GormKnobHitInRect([self bounds], mouseDownPoint); if (knob != IBNoneKnobPosition) - onKnob = YES; + { + onKnob = YES; + } } if (onKnob == YES) { if (parent) - return [parent mouseDown: theEvent]; + { + return [parent mouseDown: theEvent]; + } else - return [self noResponderFor: @selector(mouseDown:)]; + { + return [self noResponderFor: @selector(mouseDown:)]; + } } if (opened == NO) @@ -127,15 +128,30 @@ isDescendantOf: documentViewEditor]) { if (([self isOpened] == YES) && ([documentViewEditor isOpened] == NO)) - [documentViewEditor setOpened: YES]; + { + [documentViewEditor setOpened: YES]; + } if ([documentViewEditor isOpened]) - [documentViewEditor mouseDown: theEvent]; + { + [documentViewEditor mouseDown: theEvent]; + } } else { NSView *v = [_EO hitTest: [theEvent locationInWindow]]; - if (v && [v isKindOfClass: [NSScroller class]]) - [v mouseDown: theEvent]; + id r = [v nextResponder]; + + if([v respondsToSelector: @selector(setNextResponder:)]) + { + // this is done to prevent a responder loop. + [v setNextResponder: nil]; + [v mouseDown: theEvent]; + [v setNextResponder: r]; + } + else + { + [v mouseDown: theEvent]; + } } } @@ -158,8 +174,10 @@ } selection = [[NSMutableArray alloc] initWithCapacity: 5]; - [self registerForDraggedTypes: [NSArray arrayWithObjects: - IBViewPboardType, GormLinkPboardType, IBFormatterPboardType, nil]]; + [self registerForDraggedTypes: [NSArray arrayWithObjects: IBViewPboardType, + GormLinkPboardType, + IBFormatterPboardType, + nil]]; return self; } @@ -182,6 +200,7 @@ { id v; NSRect frame; + v = [subview editedObject]; frame = [v frame]; frame = [parent convertRect: frame fromView: _EO]; @@ -194,7 +213,7 @@ { NSRect frame = [documentView frame]; - // in this case the view editor is the documentView and + // In this case the view editor is the documentView and // we need to add the internal view back into the superview frame = [parent convertRect: frame fromView: _EO]; [documentView setFrame: frame]; @@ -209,5 +228,4 @@ return newSelection; } - @end diff --git a/GormCore/GormViewEditor.h b/GormCore/GormViewEditor.h index 4aef1a03..d39630f4 100644 --- a/GormCore/GormViewEditor.h +++ b/GormCore/GormViewEditor.h @@ -55,6 +55,7 @@ - (BOOL) isOpened; - (BOOL) canBeOpened; - (void) setOpened: (BOOL) value; +- (void) frameDidChange: (id) sender; @end @interface GormViewEditor (EditingAdditions) diff --git a/Palettes/3Containers/GormTableViewEditor.m b/Palettes/3Containers/GormTableViewEditor.m index 314764ae..deaebb3c 100644 --- a/Palettes/3Containers/GormTableViewEditor.m +++ b/Palettes/3Containers/GormTableViewEditor.m @@ -374,7 +374,6 @@ static NSText *_textObject; } - (unsigned) draggingUpdated: (id)sender - { NSPasteboard *dragPb; NSArray *types; @@ -384,6 +383,8 @@ static NSText *_textObject; if ([types containsObject: GormLinkPboardType] == YES) { id destination = nil; + + /* NSView *hitView = [[tableView enclosingScrollView] hitTest: @@ -405,9 +406,17 @@ static NSText *_textObject; if (hitView == tableView) destination = tableView; + */ if (destination == nil) - destination = _editedObject; + { + int col = 0; + destination = _editedObject; + if((col = [_editedObject selectedColumn]) != -1) + { + destination = [[_editedObject tableColumns] objectAtIndex: col]; + } + } [NSApp displayConnectionBetween: [NSApp connectSource] and: destination]; @@ -421,45 +430,7 @@ static NSText *_textObject; - (BOOL) performDragOperation: (id)sender { - NSPasteboard *dragPb; - NSArray *types; - - dragPb = [sender draggingPasteboard]; - types = [dragPb types]; - if ([types containsObject: GormLinkPboardType] == YES) - { - id destination = nil; - NSView *hitView = - [[tableView enclosingScrollView] - hitTest: - [[[tableView enclosingScrollView] superview] - convertPoint: [sender draggingLocation] - fromView: nil]]; - - if (hitView == [tableView headerView]) - { - NSPoint p = [hitView convertPoint: [sender draggingLocation] - fromView: nil]; - int columnNumber = - [(NSTableHeaderView*) hitView columnAtPoint: p]; - - if (columnNumber != -1) - destination = [[tableView tableColumns] - objectAtIndex: columnNumber]; - } - - if (hitView == tableView) - destination = tableView; - - if (destination == nil) - destination = _editedObject; - - [NSApp displayConnectionBetween: [NSApp connectSource] - and: destination]; - [NSApp startConnecting]; - return YES; - } - return YES; + return ([self draggingUpdated: sender] == NSDragOperationLink); } - (NSWindow *)windowAndRect: (NSRect *)prect diff --git a/Palettes/4Data/DataPalette.m b/Palettes/4Data/DataPalette.m index dc3c273a..4c561bfd 100644 --- a/Palettes/4Data/DataPalette.m +++ b/Palettes/4Data/DataPalette.m @@ -260,7 +260,7 @@ int defaultDateFormatIndex = 3; rect = [[(NSScrollView *)v contentView] frame]; tv = [[NSTextView alloc] initWithFrame: rect]; - [tv setMinSize: NSMakeSize(0.0, 0.0)]; + [tv setMinSize: NSMakeSize(108.0, 143.0)]; [tv setMaxSize: NSMakeSize(1.0E7,1.0E7)]; [tv setHorizontallyResizable: YES]; [tv setVerticallyResizable: YES]; diff --git a/Palettes/4Data/GormTextViewEditor.m b/Palettes/4Data/GormTextViewEditor.m index 19de7511..cc2bd09c 100644 --- a/Palettes/4Data/GormTextViewEditor.m +++ b/Palettes/4Data/GormTextViewEditor.m @@ -37,21 +37,65 @@ @implementation GormTextViewEditor +- (id) initWithObject: (id)anObject + inDocument: (id)aDocument +{ + if((self = [super initWithObject: anObject inDocument: aDocument]) != nil) + { + id sv = [anObject enclosingScrollView]; + [self registerForDraggedTypes: [NSArray arrayWithObjects: IBViewPboardType, + GormLinkPboardType, + IBFormatterPboardType, + nil]]; + + // subscribe to frame changes of the superview... + [[NSNotificationCenter defaultCenter] addObserver: self + selector: @selector(handleNotification:) + name: NSViewFrameDidChangeNotification + object: sv]; + } + return self; +} + +- (void) dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [super dealloc]; +} + - (BOOL) activate { if ([super activate]) { if ([_editedObject isKindOfClass: [NSScrollView class]]) - textView = [(NSScrollView *)_editedObject documentView]; + { + textView = [(NSScrollView *)_editedObject documentView]; + } else - textView = (NSTextView *)_editedObject; + { + textView = (NSTextView *)_editedObject; + } + + // make the view post frame changes... + [[textView enclosingScrollView] setPostsFrameChangedNotifications: YES]; + return YES; } return NO; } -- (unsigned) draggingUpdated: (id)sender +- (void) deactivate +{ + [super deactivate]; + [[textView enclosingScrollView] setPostsFrameChangedNotifications: NO]; +} +- (unsigned) draggingEntered: (id)sender +{ + return [self draggingUpdated: sender]; +} + +- (unsigned) draggingUpdated: (id)sender { NSPasteboard *dragPb; NSArray *types; @@ -85,35 +129,34 @@ } - (BOOL) performDragOperation: (id)sender { - NSPasteboard *dragPb; - NSArray *types; - - dragPb = [sender draggingPasteboard]; - types = [dragPb types]; - if ([types containsObject: GormLinkPboardType] == YES) - { - id destination = nil; - NSView *hitView = - [[textView enclosingScrollView] - hitTest: - [[[textView enclosingScrollView] superview] - convertPoint: [sender draggingLocation] - fromView: nil]]; - - if ((hitView == textView) || (hitView == [textView superview])) - destination = textView; - - if (destination == nil) - destination = _editedObject; - - [NSApp displayConnectionBetween: [NSApp connectSource] - and: destination]; - [NSApp startConnecting]; - return YES; - } - return YES; + return ([self draggingUpdated: sender] == NSDragOperationLink); } +- (void) handleNotification: (id) notification +{ + id view = [notification object]; + NSRect frame = [view frame]; + NSSize size; + + if([view hasVerticalScroller]) + { + NSSize s = [[view verticalScroller] frame].size; + frame.size.width -= (s.width + 5); + } + + if([view hasHorizontalScroller]) + { + NSSize s = [[view horizontalScroller] frame].size; + frame.size.height -= (s.height + 5); + } + + size = frame.size; + + [textView setMinSize: size]; + [textView setFrame: frame]; +} + +/* - (NSWindow *)windowAndRect: (NSRect *)prect forObject: (id) object { @@ -128,4 +171,5 @@ return [super windowAndRect: prect forObject: object]; } } +*/ @end