diff --git a/Applications/Gorm/Palettes/GNUmakefile b/Applications/Gorm/Palettes/GNUmakefile index 010ae50d..6565bde2 100644 --- a/Applications/Gorm/Palettes/GNUmakefile +++ b/Applications/Gorm/Palettes/GNUmakefile @@ -32,7 +32,9 @@ SUBPROJECTS = \ 1Windows \ 2Controls \ 3Containers \ - 4Data + 4Data \ + 5Formatters \ + 6GridStack -include GNUmakefile.preamble diff --git a/GormCore/Resources/ClassInformation.plist b/GormCore/Resources/ClassInformation.plist index 8c670922..36935c19 100644 --- a/GormCore/Resources/ClassInformation.plist +++ b/GormCore/Resources/ClassInformation.plist @@ -260,7 +260,6 @@ NSMutableArray = {Super = NSArray; }; NSMutableDictionary = {Super = NSDictionary; }; NSNumberFormatter = {Super = NSFormatter; }; - NSObject = {}; NSOpenGLView = {Super = NSView; }; NSOutlineView = {Super = NSTableView; }; NSPanel = {Super = NSWindow; }; @@ -420,4 +419,20 @@ Outlets = (); Super = NSArrayController; }; + Object = {}; + }; + NSDatePicker = { + Super = NSControl; + }; + NSPathControl = { + Super = NSControl; + }; + NSGridView = { + Super = NSView; + }; + NSSwitch = { + Super = NSControl; + }; + NSObject = {}; + Object = {}; } diff --git a/Palettes/5Formatters/FormattersPalette.h b/Palettes/5Formatters/FormattersPalette.h new file mode 100644 index 00000000..a3f68515 --- /dev/null +++ b/Palettes/5Formatters/FormattersPalette.h @@ -0,0 +1,66 @@ +/* DataPalette - Formatter Additions... + + Copyright (C) 2021 Free Software Foundation, Inc. + + Author: Gregory Casamento + Date: June 1 2021 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. +*/ + +#ifndef INCLUDED_FormattersPalette_h +#define INCLUDED_FormattersPalette_h + +#include +#include + +/* + * NSDateFormatter and NSNumberFormatter extensions + * for Gorm Formatters used in the Data Palette + */ + +@interface NSDateFormatter (GormAdditions) + ++ (int) formatCount; ++ (NSString *) formatAtIndex: (int)index; ++ (NSInteger) indexOfFormat: (NSString *) format; ++ (NSString *) defaultFormat; ++ (id) defaultFormatValue; + +@end + +@interface NSNumberFormatter (GormAdditions) + ++ (int) formatCount; ++ (NSString *) formatAtIndex: (int)index; ++ (NSString *) positiveFormatAtIndex: (int)index; ++ (NSString *) zeroFormatAtIndex: (int)index; ++ (NSString *) negativeFormatAtIndex: (int)index; ++ (NSDecimalNumber *) positiveValueAtIndex: (int)index; ++ (NSDecimalNumber *) negativeValueAtIndex: (int)index; ++ (NSInteger) indexOfFormat: (NSString *)format; ++ (NSString *) defaultFormat; ++ (id) defaultFormatValue; +- (NSString *) zeroFormat; + +@end + +@interface FormattersPalette: IBPalette +@end + +#endif + diff --git a/Palettes/5Formatters/FormattersPalette.m b/Palettes/5Formatters/FormattersPalette.m new file mode 100644 index 00000000..64aaccff --- /dev/null +++ b/Palettes/5Formatters/FormattersPalette.m @@ -0,0 +1,234 @@ +/* FormattersPalette.m + + Copyright (C) 2021 Free Software Foundation, Inc. + + Author: Gregory Casamento + Date: Jun 4 2021 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. +*/ + +#import +#import +#import + +#import +#import "FormattersPalette.h" + +/* ----------------------------------------------------------- + * Some additions to the Formatters Classes specific to Gorm + * -----------------------------------------------------------*/ +NSArray *predefinedNumberFormats; +int defaultNumberFormatIndex = 0; + +@implementation FormattersPalette + +- (id) init +{ + if((self = [super init]) != nil) + { + // Make ourselves a delegate, so that when the formatter is dragged in, + // this code is called... + [NSView registerViewResourceDraggingDelegate: self]; + + // subscribe to the notification... + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(willInspectObject:) + name: IBWillInspectObjectNotification + object: nil]; + } + + return self; +} + +- (void) dealloc +{ + [NSView unregisterViewResourceDraggingDelegate: self]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [super dealloc]; +} + +- (void) placeFormatter: (NSFormatter *)fm + withImageNamed: (NSString *)imageName + atRect: (NSRect)frame + inView: (NSView *)contents + toolTip: (NSString *)tooltip +{ + id v; + NSImage *img; + NSString *path = [[NSBundle bundleForClass: [self class]] + pathForImageResource: imageName]; + + img = [[NSImage alloc] initWithContentsOfFile: path]; + v = [[NSImageView alloc] initWithFrame: frame]; + [v setImageFrameStyle: NSImageFramePhoto]; + [v setImageScaling: NSScaleProportionally]; + [v setImageAlignment: NSImageAlignCenter]; + [v setImage: img]; + [v setToolTip: tooltip]; + [contents addSubview: v]; + [self associateObject: fm type: IBFormatterPboardType with: v]; + RELEASE(v); + RELEASE(img); +} + +- (void) finishInstantiate +{ + NSView *contents; + + originalWindow = [[NSWindow alloc] initWithContentRect: + NSMakeRect(0, 0, 272, 192) + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreRetained + defer: NO]; + [originalWindow setTitle: @"Formatters"]; + contents = [originalWindow contentView]; + + /* Formatters. */ + [self placeFormatter: [[NSByteCountFormatter alloc] init] + withImageNamed: @"bytecount_formatter" + atRect: NSMakeRect(192, 48, 43, 43) + inView: contents + toolTip: @"Byte Count"]; + + [self placeFormatter: [[NSDateComponentsFormatter alloc] init] + withImageNamed: @"date_comp_formatter" + atRect: NSMakeRect(144, 48, 43, 43) + inView: contents + toolTip: @"Date Components"]; + + [self placeFormatter: [[NSDateIntervalFormatter alloc] init] + withImageNamed: @"date_interval_formatter" + atRect: NSMakeRect(96, 48, 43, 43) + inView: contents + toolTip: @"Date Interval"]; + + [self placeFormatter: [[NSPersonNameComponentsFormatter alloc] init] + withImageNamed: @"energy_formatter" + atRect: NSMakeRect(48, 48, 43, 43) + inView: contents + toolTip: @"Energy"]; + + [self placeFormatter: [[NSMeasurementFormatter alloc] init] + withImageNamed: @"measurement_formatter" + atRect: NSMakeRect(0, 48, 43, 43) + inView: contents + toolTip: @"Measurement"]; + + [self placeFormatter: [[NSLengthFormatter alloc] init] + withImageNamed: @"length_formatter" + atRect: NSMakeRect(0, 96, 43, 43) + inView: contents + toolTip: @"Length"]; +} + +- (void) willInspectObject: (NSNotification *)notification +{ + id o = [notification object]; + if([o respondsToSelector: @selector(cell)]) + { + id cell = [o cell]; + if([cell respondsToSelector: @selector(formatter)]) + { + id formatter = [o formatter]; + if([formatter isKindOfClass: [NSFormatter class]]) + { + NSString *ident = NSStringFromClass([formatter class]); + [[IBInspectorManager sharedInspectorManager] + addInspectorModeWithIdentifier: ident + forObject: o + localizedLabel: _(@"Formatter") + inspectorClassName: [formatter inspectorClassName] + ordering: -1.0]; + } + } + } +} + +// view resource dragging delegate... + +/** + * Ask if the view accepts the object. + */ +- (BOOL) acceptsViewResourceFromPasteboard: (NSPasteboard *)pb + forObject: (id)obj + atPoint: (NSPoint)p +{ + return ([obj respondsToSelector: @selector(setFormatter:)] && + [[pb types] containsObject: IBFormatterPboardType]); +} + +/** + * Perform the action of depositing the object. + */ +- (void) depositViewResourceFromPasteboard: (NSPasteboard *)pb + onObject: (id)obj + atPoint: (NSPoint)p +{ + NSData *data = [pb dataForType: IBFormatterPboardType]; + id array = [NSUnarchiver unarchiveObjectWithData: data]; + + if(array != nil) + { + if([array count] > 0) + { + id formatter = [array objectAtIndex: 0]; + + // Add the formatter if the object accepts one... + if([obj respondsToSelector: @selector(setFormatter:)]) + { + // Touch the document... + [[(id)NSApp activeDocument] touch]; + + [obj setFormatter: formatter]; + RETAIN(formatter); + if ([formatter isMemberOfClass: [NSNumberFormatter class]]) + { + id fieldValue = [NSNumber numberWithFloat: 1.123456789]; + [obj setStringValue: [fieldValue stringValue]]; + [obj setObjectValue: fieldValue]; + } + else if ([formatter isMemberOfClass: [NSDateFormatter class]]) + { + id fieldValue = [NSDate date]; + [obj setStringValue: [fieldValue description]]; + [obj setObjectValue: fieldValue]; + } + } + } + } +} + +/** + * Should we draw the connection frame when the resource is + * dragged in? + */ +- (BOOL) shouldDrawConnectionFrame +{ + return NO; +} + +/** + * Types of resources accepted by this view. + */ +- (NSArray *)viewResourcePasteboardTypes +{ + return [NSArray arrayWithObject: IBFormatterPboardType]; +} + +@end diff --git a/Palettes/5Formatters/FormattersPalette.tiff b/Palettes/5Formatters/FormattersPalette.tiff new file mode 100644 index 00000000..fa9ab4bb Binary files /dev/null and b/Palettes/5Formatters/FormattersPalette.tiff differ diff --git a/Palettes/5Formatters/GNUmakefile b/Palettes/5Formatters/GNUmakefile new file mode 100644 index 00000000..e16dda12 --- /dev/null +++ b/Palettes/5Formatters/GNUmakefile @@ -0,0 +1,52 @@ +# GNUmakefile +# +# Copyright (C) 1999, 2021 Free Software Foundation, Inc. +# +# Author: Gregory Casamento +# Date: Nov 2001 +# +# This file is part of GNUstep. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +PACKAGE_NAME = gorm +include $(GNUSTEP_MAKEFILES)/common.make + +PALETTE_NAME = 5Formatters +5Formatters_PALETTE_ICON = FormattersPalette +5Formatters_PRINCIPAL_CLASS = FormattersPalette + +5Formatters_OBJC_FILES = \ + FormattersPalette.m + +5Formatters_RESOURCE_FILES = FormattersPalette.tiff \ + bytecount_formatter.tiff \ + date_comp_formatter.tiff \ + energy_formatter.tiff \ + measurement_formatter.tiff \ + date_interval_formatter.tiff \ + length_formatter.tiff \ + palette.table + +5Formatters_STANDARD_INSTALL = no + +-include GNUmakefile.preamble + +-include GNUmakefile.local + +include $(GNUSTEP_MAKEFILES)/palette.make + +#-include GNUmakefile.postamble + diff --git a/Palettes/5Formatters/GNUmakefile.preamble b/Palettes/5Formatters/GNUmakefile.preamble new file mode 100644 index 00000000..e9249b0e --- /dev/null +++ b/Palettes/5Formatters/GNUmakefile.preamble @@ -0,0 +1,21 @@ +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += -I../.. + +ifeq ($(GNUSTEP_TARGET_OS),mingw32) +ADDITIONAL_LIB_DIRS += \ + -L../../GormLib/$(GNUSTEP_OBJ_DIR) \ + -L../../GormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \ + -L../../GormPrefs/$(GNUSTEP_OBJ_DIR) \ + -L../../GormCore/$(GNUSTEP_OBJ_DIR) + +ADDITIONAL_GUI_LIBS += -lGorm -lGormCore +endif +ifeq ($(GNUSTEP_TARGET_OS),cygwin) +ADDITIONAL_LIB_DIRS += \ + -L../../GormLib/$(GNUSTEP_OBJ_DIR) \ + -L../../GormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \ + -L../../GormPrefs/$(GNUSTEP_OBJ_DIR) \ + -L../../GormCore/$(GNUSTEP_OBJ_DIR) + +4Data_LIBRARIES_DEPEND_UPON += -lGorm -lGormCore +endif \ No newline at end of file diff --git a/Palettes/5Formatters/bytecount_formatter.tiff b/Palettes/5Formatters/bytecount_formatter.tiff new file mode 100644 index 00000000..ea09e4fe Binary files /dev/null and b/Palettes/5Formatters/bytecount_formatter.tiff differ diff --git a/Palettes/5Formatters/date_comp_formatter.tiff b/Palettes/5Formatters/date_comp_formatter.tiff new file mode 100644 index 00000000..916a43b1 Binary files /dev/null and b/Palettes/5Formatters/date_comp_formatter.tiff differ diff --git a/Palettes/5Formatters/date_interval_formatter.tiff b/Palettes/5Formatters/date_interval_formatter.tiff new file mode 100644 index 00000000..a679a469 Binary files /dev/null and b/Palettes/5Formatters/date_interval_formatter.tiff differ diff --git a/Palettes/5Formatters/energy_formatter.tiff b/Palettes/5Formatters/energy_formatter.tiff new file mode 100644 index 00000000..f30fffbe Binary files /dev/null and b/Palettes/5Formatters/energy_formatter.tiff differ diff --git a/Palettes/5Formatters/length_formatter.tiff b/Palettes/5Formatters/length_formatter.tiff new file mode 100644 index 00000000..a713324f Binary files /dev/null and b/Palettes/5Formatters/length_formatter.tiff differ diff --git a/Palettes/5Formatters/measurement_formatter.tiff b/Palettes/5Formatters/measurement_formatter.tiff new file mode 100644 index 00000000..9e63087e Binary files /dev/null and b/Palettes/5Formatters/measurement_formatter.tiff differ diff --git a/Palettes/5Formatters/palette.table b/Palettes/5Formatters/palette.table new file mode 100644 index 00000000..5db14514 --- /dev/null +++ b/Palettes/5Formatters/palette.table @@ -0,0 +1,6 @@ +{ + NOTE = "Automatically generated, do not edit!"; + NibFile = ""; + Class = "FormattersPalette"; + Icon = "FormattersPalette"; +} diff --git a/Palettes/6GridStack/GNUmakefile b/Palettes/6GridStack/GNUmakefile new file mode 100644 index 00000000..46b79198 --- /dev/null +++ b/Palettes/6GridStack/GNUmakefile @@ -0,0 +1,48 @@ +# GNUmakefile +# +# Copyright (C) 1999 Free Software Foundation, Inc. +# +# Author: Laurent Julliard +# Date: Nov 2001 +# +# This file is part of GNUstep. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +PACKAGE_NAME = gorm +include $(GNUSTEP_MAKEFILES)/common.make + +PALETTE_NAME = 6GridStack +6GridStack_PALETTE_ICON = GridStackPalette +6GridStack_PRINCIPAL_CLASS = GridStackPalette + +6GridStack_OBJC_FILES = \ + GridStackPalette.m + +6GridStack_RESOURCE_FILES = GridStackPalette.tiff \ + stack_view.tiff \ + grid_view.tiff \ + palette.table + +6GridStack_STANDARD_INSTALL = no + +-include GNUmakefile.preamble + +-include GNUmakefile.local + +include $(GNUSTEP_MAKEFILES)/palette.make + +#-include GNUmakefile.postamble + diff --git a/Palettes/6GridStack/GNUmakefile.preamble b/Palettes/6GridStack/GNUmakefile.preamble new file mode 100644 index 00000000..e9249b0e --- /dev/null +++ b/Palettes/6GridStack/GNUmakefile.preamble @@ -0,0 +1,21 @@ +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += -I../.. + +ifeq ($(GNUSTEP_TARGET_OS),mingw32) +ADDITIONAL_LIB_DIRS += \ + -L../../GormLib/$(GNUSTEP_OBJ_DIR) \ + -L../../GormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \ + -L../../GormPrefs/$(GNUSTEP_OBJ_DIR) \ + -L../../GormCore/$(GNUSTEP_OBJ_DIR) + +ADDITIONAL_GUI_LIBS += -lGorm -lGormCore +endif +ifeq ($(GNUSTEP_TARGET_OS),cygwin) +ADDITIONAL_LIB_DIRS += \ + -L../../GormLib/$(GNUSTEP_OBJ_DIR) \ + -L../../GormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \ + -L../../GormPrefs/$(GNUSTEP_OBJ_DIR) \ + -L../../GormCore/$(GNUSTEP_OBJ_DIR) + +4Data_LIBRARIES_DEPEND_UPON += -lGorm -lGormCore +endif \ No newline at end of file diff --git a/Palettes/6GridStack/GridStackPalette.h b/Palettes/6GridStack/GridStackPalette.h new file mode 100644 index 00000000..a10b96b0 --- /dev/null +++ b/Palettes/6GridStack/GridStackPalette.h @@ -0,0 +1,35 @@ +/* GridStackPalette + + Copyright (C) 2021 Free Software Foundation, Inc. + + Author: Gregory Casamento + Date: June 1 2021 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. +*/ + +#ifndef INCLUDED_GridStackPalette_h +#define INCLUDED_GridStackPalette_h + +#include +#include + +@interface GridStackPalette: IBPalette +@end + +#endif + diff --git a/Palettes/6GridStack/GridStackPalette.m b/Palettes/6GridStack/GridStackPalette.m new file mode 100644 index 00000000..b67319a1 --- /dev/null +++ b/Palettes/6GridStack/GridStackPalette.m @@ -0,0 +1,207 @@ +/* GridStackPalette.m + + Copyright (C) 2021 Free Software Foundation, Inc. + + Author: Gregory Casamento + Date: Jun 4 2021 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. +*/ + +#import +#import + +#import +#import "GridStackPalette.h" + +/* ---------------------------------------------------------------------- + * Some additions to the NSGridView, NSStackView Classes specific to Gorm + * ----------------------------------------------------------------------*/ + +@implementation GridStackPalette + +- (id) init +{ + if((self = [super init]) != nil) + { + // Make ourselves a delegate, so that when the formatter is dragged in, + // this code is called... + [NSView registerViewResourceDraggingDelegate: self]; + + // subscribe to the notification... + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(willInspectObject:) + name: IBWillInspectObjectNotification + object: nil]; + } + + return self; +} + +- (void) dealloc +{ + [NSView unregisterViewResourceDraggingDelegate: self]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [super dealloc]; +} + +- (void) placeView: (NSView *)o + withImageNamed: (NSString *)imageName + atRect: (NSRect)frame + inView: (NSView *)contents + toolTip: (NSString *)tooltip +{ + id v; + NSImage *img; + NSString *path = [[NSBundle bundleForClass: [self class]] + pathForImageResource: imageName]; + + img = [[NSImage alloc] initWithContentsOfFile: path]; + v = [[NSImageView alloc] initWithFrame: frame]; + [v setImageFrameStyle: NSImageFramePhoto]; + [v setImageScaling: NSScaleProportionally]; + [v setImageAlignment: NSImageAlignCenter]; + [v setImage: img]; + [v setToolTip: tooltip]; + [contents addSubview: v]; + [self associateObject: o type: IBViewPboardType with: v]; + RELEASE(v); + RELEASE(img); +} + +- (void) finishInstantiate +{ + NSView *contents; + + originalWindow = [[NSWindow alloc] initWithContentRect: + NSMakeRect(0, 0, 272, 192) + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreRetained + defer: NO]; + [originalWindow setTitle: @"NSGridView / NSStackView"]; + contents = [originalWindow contentView]; + + /* views */ + [self placeView: [[NSStackView alloc] initWithFrame: NSMakeRect(10, 10, 100, 100)] + withImageNamed: @"stack_view" + atRect: NSMakeRect(192, 48, 43, 43) + inView: contents + toolTip: @"NSStackView"]; + + [self placeView: [[NSGridView alloc] initWithFrame: NSMakeRect(10, 10, 100, 100)] + withImageNamed: @"grid_view" + atRect: NSMakeRect(144, 48, 43, 43) + inView: contents + toolTip: @"NSGridView"]; +} + +- (void) willInspectObject: (NSNotification *)notification +{ + id o = [notification object]; + if([o respondsToSelector: @selector(cell)]) + { + id cell = [o cell]; + if([cell respondsToSelector: @selector(formatter)]) + { + id formatter = [o formatter]; + if([formatter isKindOfClass: [NSFormatter class]]) + { + NSString *ident = NSStringFromClass([formatter class]); + [[IBInspectorManager sharedInspectorManager] + addInspectorModeWithIdentifier: ident + forObject: o + localizedLabel: _(@"Formatter") + inspectorClassName: [formatter inspectorClassName] + ordering: -1.0]; + } + } + } +} + +// view resource dragging delegate... + +/** + * Ask if the view accepts the object. + */ +- (BOOL) acceptsViewResourceFromPasteboard: (NSPasteboard *)pb + forObject: (id)obj + atPoint: (NSPoint)p +{ + return ([obj respondsToSelector: @selector(setFormatter:)] && + [[pb types] containsObject: IBFormatterPboardType]); +} + +/** + * Perform the action of depositing the object. + */ +- (void) depositViewResourceFromPasteboard: (NSPasteboard *)pb + onObject: (id)obj + atPoint: (NSPoint)p +{ + NSData *data = [pb dataForType: IBFormatterPboardType]; + id array = [NSUnarchiver unarchiveObjectWithData: data]; + + if(array != nil) + { + if([array count] > 0) + { + id formatter = [array objectAtIndex: 0]; + + // Add the formatter if the object accepts one... + if([obj respondsToSelector: @selector(setFormatter:)]) + { + // Touch the document... + [[(id)NSApp activeDocument] touch]; + + [obj setFormatter: formatter]; + RETAIN(formatter); + if ([formatter isMemberOfClass: [NSNumberFormatter class]]) + { + id fieldValue = [NSNumber numberWithFloat: 1.123456789]; + [obj setStringValue: [fieldValue stringValue]]; + [obj setObjectValue: fieldValue]; + } + else if ([formatter isMemberOfClass: [NSDateFormatter class]]) + { + id fieldValue = [NSDate date]; + [obj setStringValue: [fieldValue description]]; + [obj setObjectValue: fieldValue]; + } + } + } + } +} + +/** + * Should we draw the connection frame when the resource is + * dragged in? + */ +- (BOOL) shouldDrawConnectionFrame +{ + return NO; +} + +/** + * Types of resources accepted by this view. + */ +- (NSArray *)viewResourcePasteboardTypes +{ + return [NSArray arrayWithObject: IBViewPboardType]; +} + +@end diff --git a/Palettes/6GridStack/GridStackPalette.tiff b/Palettes/6GridStack/GridStackPalette.tiff new file mode 100644 index 00000000..fa9ab4bb Binary files /dev/null and b/Palettes/6GridStack/GridStackPalette.tiff differ diff --git a/Palettes/6GridStack/grid_view.tiff b/Palettes/6GridStack/grid_view.tiff new file mode 100644 index 00000000..9e63087e Binary files /dev/null and b/Palettes/6GridStack/grid_view.tiff differ diff --git a/Palettes/6GridStack/palette.table b/Palettes/6GridStack/palette.table new file mode 100644 index 00000000..745a24e1 --- /dev/null +++ b/Palettes/6GridStack/palette.table @@ -0,0 +1,6 @@ +{ + NOTE = "Automatically generated, do not edit!"; + NibFile = ""; + Class = "GridStackPalette"; + Icon = "GridStackPalette"; +} diff --git a/Palettes/6GridStack/stack_view.tiff b/Palettes/6GridStack/stack_view.tiff new file mode 100644 index 00000000..a713324f Binary files /dev/null and b/Palettes/6GridStack/stack_view.tiff differ