mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Corrected bug#14004
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21655 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7eea631946
commit
47ddce6e20
4 changed files with 69 additions and 23 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-08-17 23:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormDocument.m: attachObject:toParent: code to handle
|
||||
addition of tab view and items.
|
||||
* Palettes/3Containers/GormTabViewAttributesInspector.m: in ok:
|
||||
code to handle attaching and detaching from the document, when items
|
||||
are added and deleted.
|
||||
* Palettes/3Containers/GormTabViewEditor.m: Streamlined code in
|
||||
delegate.
|
||||
|
||||
2005-08-12 01:23 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormClassEditor.m: Correction for crash when loading
|
||||
|
|
|
@ -625,6 +625,27 @@ static NSImage *fileImage = nil;
|
|||
[self attachObject: [anObject documentView] toParent: anObject];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If it's a tab view, then we want the tab items.
|
||||
*/
|
||||
else if ([anObject isKindOfClass: [NSTabView class]] == YES)
|
||||
{
|
||||
NSEnumerator *tie = [[anObject tabViewItems] objectEnumerator];
|
||||
NSTabViewItem *ti = nil;
|
||||
while((ti = [tie nextObject]) != nil)
|
||||
{
|
||||
[self attachObject: ti toParent: anObject];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If it's a tab view item, then we attach the view.
|
||||
*/
|
||||
else if ([anObject isKindOfClass: [NSTabViewItem class]] == YES)
|
||||
{
|
||||
NSTabViewItem *ti = (NSTabViewItem *)anObject;
|
||||
id v = [ti view];
|
||||
[self attachObject: v toParent: ti];
|
||||
}
|
||||
|
||||
// Detect and add any connection the object might have.
|
||||
// This is done so that any palette items which have predefined connections will be
|
||||
|
@ -764,6 +785,9 @@ static NSImage *fileImage = nil;
|
|||
NSMapInsert(objToName, (void*)[filesOwner className], (void*)@"NSOwner");
|
||||
[nameTable setObject: [filesOwner className] forKey: @"NSOwner"];
|
||||
|
||||
/* Deactivate remaining editors */
|
||||
[openEditors makeObjectsPerformSelector: @selector(deactivate)];
|
||||
|
||||
/*
|
||||
* Set the appropriate profile so that we save the right versions of
|
||||
* the classes for older GNUstep releases.
|
||||
|
@ -1557,6 +1581,7 @@ static NSImage *fileImage = nil;
|
|||
[[con destination] activate];
|
||||
}
|
||||
[savedEditors removeAllObjects];
|
||||
// [openEditors makeObjectsPerformSelector: @selector(activate)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "GormTabViewAttributesInspector.h"
|
||||
|
||||
#include <Foundation/NSNotification.h>
|
||||
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSForm.h>
|
||||
#include <AppKit/NSMatrix.h>
|
||||
|
@ -43,7 +42,7 @@
|
|||
#include <AppKit/NSTabViewItem.h>
|
||||
#include <AppKit/NSTextField.h>
|
||||
|
||||
static NSString *ITEM=@"item";
|
||||
#include <InterfaceBuilder/InterfaceBuilder.h>
|
||||
|
||||
@implementation GormTabViewAttributesInspector
|
||||
|
||||
|
@ -81,13 +80,10 @@ static NSString *ITEM=@"item";
|
|||
[itemIdentifier setStringValue:[[object tabViewItemAtIndex:number] identifier]];
|
||||
[object selectTabViewItemAtIndex:number];
|
||||
}
|
||||
|
||||
|
||||
else if (sender == numberOfItemsField)
|
||||
{
|
||||
int newNumber = [[numberOfItemsField stringValue] intValue];
|
||||
|
||||
//Can we allow stupid numbers like 66666666 ????????
|
||||
if (newNumber <= 0)
|
||||
{
|
||||
[numberOfItemsField setStringValue:[NSString stringWithFormat:@"%i",[object numberOfTabViewItems]]];
|
||||
|
@ -97,13 +93,16 @@ static NSString *ITEM=@"item";
|
|||
{
|
||||
int i;
|
||||
NSTabViewItem *newTabItem;
|
||||
id document = [(id<IB>)NSApp documentForObject: object];
|
||||
|
||||
for (i=([object numberOfTabViewItems]+1);i<=newNumber;i++)
|
||||
{
|
||||
NSString *identif = [NSString stringWithFormat:@"%i",i];
|
||||
newTabItem = [(NSTabViewItem *)[NSTabViewItem alloc] initWithIdentifier: (id)identif];
|
||||
[newTabItem setLabel:[ITEM stringByAppendingString:identif]];
|
||||
NSString *ident = [NSString stringWithFormat: @"item %i",i];
|
||||
newTabItem = [(NSTabViewItem *)[NSTabViewItem alloc] initWithIdentifier: (id)ident];
|
||||
[newTabItem setLabel: [NSString stringWithFormat: @"Item %i",i]];
|
||||
[newTabItem setView:[[NSView alloc] init]];
|
||||
[object addTabViewItem:newTabItem];
|
||||
[document attachObject: newTabItem toParent: object];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -111,24 +110,35 @@ static NSString *ITEM=@"item";
|
|||
int i;
|
||||
for (i=([object numberOfTabViewItems]-1);i>=newNumber;i--)
|
||||
{
|
||||
[object removeTabViewItem:[object tabViewItemAtIndex:i]];
|
||||
id item = [object tabViewItemAtIndex:i];
|
||||
id document = [(id<IB>)NSApp documentForObject: item];
|
||||
|
||||
[object selectFirstTabViewItem: self];
|
||||
[object removeTabViewItem: item];
|
||||
if(document != nil)
|
||||
{
|
||||
[document detachObject: item];
|
||||
}
|
||||
}
|
||||
}
|
||||
[itemStepper setMaxValue:(newNumber - 1)];
|
||||
[itemStepper setMaxValue: (newNumber - 1)];
|
||||
}
|
||||
else if ( sender == itemLabel )
|
||||
{
|
||||
if ( ! [[itemLabel stringValue] isEqualToString:@""] )
|
||||
[[object selectedTabViewItem] setLabel:[itemLabel stringValue]];
|
||||
if ([[itemLabel stringValue] isEqualToString:@""] == NO)
|
||||
{
|
||||
[[object selectedTabViewItem] setLabel:[itemLabel stringValue]];
|
||||
}
|
||||
}
|
||||
else if ( sender == itemIdentifier )
|
||||
{
|
||||
if ( ! [[itemIdentifier stringValue] isEqualToString:@""] )
|
||||
[[object selectedTabViewItem] setIdentifier:[itemIdentifier stringValue]];
|
||||
if ([[itemIdentifier stringValue] isEqualToString:@""] == NO)
|
||||
{
|
||||
[[object selectedTabViewItem] setIdentifier:[itemIdentifier stringValue]];
|
||||
}
|
||||
}
|
||||
|
||||
#warning needed ?
|
||||
[object display];
|
||||
[object setNeedsDisplay: YES];
|
||||
|
||||
[super ok: sender];
|
||||
}
|
||||
|
|
|
@ -156,19 +156,20 @@
|
|||
shouldSelectTabViewItem: (NSTabViewItem *)tabViewItem
|
||||
{
|
||||
NSDebugLog(@"shouldSelectTabViewItem called");
|
||||
|
||||
if ([[[tabView selectedTabViewItem] view]
|
||||
isKindOfClass:
|
||||
[GormInternalViewEditor class]])
|
||||
id view = [[tabView selectedTabViewItem] view];
|
||||
if ([view isKindOfClass: [GormInternalViewEditor class]])
|
||||
{
|
||||
|
||||
NSDebugLog(@"closing tabviewitem");
|
||||
[(GormInternalViewEditor *)[[tabView selectedTabViewItem] view]
|
||||
deactivate];
|
||||
[view deactivate];
|
||||
currentView = nil;
|
||||
openedSubeditor = nil;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView
|
||||
{
|
||||
// [tabView selectFirstTabViewItem: self];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue