mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Changes to write nib files.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23195 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e26b4303fd
commit
e46f1a4cbf
7 changed files with 84 additions and 23 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2006-08-01 00:12-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GNUmakefile: Add GormNibWrapperBuilder.m
|
||||
* GormCore/GormClassManager.m: Correct nibData method to properly
|
||||
output information in classes.nib format.
|
||||
* GormCore/GormDocument.m: Slight improvement to windowAndRect:
|
||||
forObject:.
|
||||
* GormCore/GormFilePrefsManager.[hm]: Add nibData method.
|
||||
* GormInfo.plist: Change GSNibFileType entry to "Editor"
|
||||
* GormNibWrapperBuilder.m: Class to write nibs.
|
||||
|
||||
2006-07-18 23:04 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormFunctions.m: Remove the width and height adjustment
|
||||
|
|
|
@ -119,6 +119,7 @@ GormCore_OBJC_FILES = \
|
|||
GormInspectorsManager.m \
|
||||
GormInternalViewEditor.m \
|
||||
GormMatrixEditor.m \
|
||||
GormNibWrapperBuilder.m \
|
||||
GormNibWrapperLoader.m \
|
||||
GormNSSplitViewInspector.m \
|
||||
GormObjectEditor.m \
|
||||
|
|
|
@ -1166,9 +1166,9 @@
|
|||
NSMutableDictionary *dict = nil;
|
||||
NSMutableArray *classes = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSMutableArray *cats = [NSMutableArray arrayWithArray: categoryClasses];
|
||||
id name = nil;
|
||||
NSString *result = nil;
|
||||
|
||||
|
||||
// save all custom classes....
|
||||
dict = [NSMutableDictionary dictionary];
|
||||
[dict setObject: @"1" forKey: @"IBVersion"];
|
||||
|
@ -1207,7 +1207,7 @@
|
|||
{
|
||||
obj = extraObj;
|
||||
}
|
||||
if (obj != nil)
|
||||
if (obj != nil && [obj count] > 0)
|
||||
{
|
||||
NSMutableDictionary *outletDict = [NSMutableDictionary dictionary];
|
||||
NSEnumerator *oen = [obj objectEnumerator];
|
||||
|
@ -1232,7 +1232,7 @@
|
|||
{
|
||||
obj = extraObj;
|
||||
}
|
||||
if (obj != nil)
|
||||
if (obj != nil && [obj count] > 0)
|
||||
{
|
||||
NSMutableDictionary *actionDict = [NSMutableDictionary dictionary];
|
||||
NSEnumerator *aen = [obj objectEnumerator];
|
||||
|
@ -1240,17 +1240,28 @@
|
|||
|
||||
while((action = [aen nextObject]) != nil)
|
||||
{
|
||||
[actionDict setObject: @"id" forKey: action];
|
||||
NSString *actionName = nil;
|
||||
NSScanner *scanner = [NSScanner scannerWithString: action];
|
||||
|
||||
[scanner scanUpToString: @":" intoString: &actionName];
|
||||
[actionDict setObject: @"id" forKey: actionName];
|
||||
}
|
||||
|
||||
[newInfo setObject: actionDict forKey: @"ACTIONS"];
|
||||
}
|
||||
|
||||
[newInfo setObject: @"ObjC" forKey: @"LANGUAGE"];
|
||||
|
||||
[classes addObject: newInfo];
|
||||
}
|
||||
|
||||
// save all categories on existing, non-custom classes....
|
||||
enumerator = [categoryClasses objectEnumerator];
|
||||
// Save all categories on existing, non-custom classes....
|
||||
// Always save the FirstResponder....
|
||||
if([cats containsObject: @"FirstResponder"] == NO)
|
||||
{
|
||||
[cats addObject: @"FirstResponder"];
|
||||
}
|
||||
enumerator = [cats objectEnumerator];
|
||||
while((name = [enumerator nextObject]) != nil)
|
||||
{
|
||||
NSDictionary *classInfo;
|
||||
|
@ -1271,7 +1282,7 @@
|
|||
|
||||
// actions...
|
||||
obj = [classInfo objectForKey: @"ExtraActions"];
|
||||
if (obj != nil)
|
||||
if (obj != nil && [obj count] > 0)
|
||||
{
|
||||
NSMutableDictionary *actionDict = [NSMutableDictionary dictionary];
|
||||
NSEnumerator *aen = [obj objectEnumerator];
|
||||
|
@ -1279,20 +1290,25 @@
|
|||
|
||||
while((action = [aen nextObject]) != nil)
|
||||
{
|
||||
[actionDict setObject: @"id" forKey: action];
|
||||
NSString *actionName = nil;
|
||||
NSScanner *scanner = [NSScanner scannerWithString: action];
|
||||
|
||||
[scanner scanUpToString: @":" intoString: &actionName];
|
||||
[actionDict setObject: @"id" forKey: actionName];
|
||||
}
|
||||
|
||||
[newInfo setObject: @"ObjC" forKey: @"LANGUAGE"];
|
||||
[newInfo setObject: actionDict forKey: @"ACTIONS"];
|
||||
}
|
||||
|
||||
[classes addObject: newInfo];
|
||||
}
|
||||
|
||||
[dict setObject: @"ObjC" forKey: @"LANGUAGE"];
|
||||
result = [dict description];
|
||||
[dict setObject: classes forKey: @"IBClasses"];
|
||||
|
||||
return [NSData dataWithBytes: [result cString]
|
||||
length: [result cStringLength]];
|
||||
return [NSPropertyListSerialization dataFromPropertyList: dict
|
||||
format: NSPropertyListOpenStepFormat
|
||||
errorDescription: NULL];
|
||||
}
|
||||
|
||||
- (NSData *) data
|
||||
|
@ -1300,7 +1316,6 @@
|
|||
NSMutableDictionary *ci = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
id key = nil;
|
||||
NSString *result = nil;
|
||||
|
||||
// save all custom classes....
|
||||
ci = [NSMutableDictionary dictionary];
|
||||
|
@ -1389,10 +1404,9 @@
|
|||
[ci setObject: @"Do NOT change this file, Gorm maintains it"
|
||||
forKey: @"## Comment"];
|
||||
|
||||
result = [ci description];
|
||||
|
||||
return [NSData dataWithBytes: [result cString]
|
||||
length: [result cStringLength]];
|
||||
return [NSPropertyListSerialization dataFromPropertyList: ci
|
||||
format: NSPropertyListOpenStepFormat
|
||||
errorDescription: NULL];
|
||||
}
|
||||
|
||||
- (BOOL) saveToFile: (NSString *)path
|
||||
|
|
|
@ -2557,13 +2557,12 @@ static NSImage *fileImage = nil;
|
|||
toView: nil];
|
||||
return [th window];
|
||||
}
|
||||
else
|
||||
else if([object isKindOfClass: [NSCell class]])
|
||||
{
|
||||
*r = NSZeroRect;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// never reached, keeps gcc happy
|
||||
// if we get here, then it wasn't any of the above.
|
||||
*r = NSZeroRect;
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
*/
|
||||
- (NSData *) data;
|
||||
|
||||
/**
|
||||
* Saves the encoded file info.
|
||||
*/
|
||||
- (NSData *) nibData;
|
||||
|
||||
/**
|
||||
* Saves the encoded file info.
|
||||
*/
|
||||
|
|
|
@ -34,9 +34,11 @@
|
|||
#include <GNUstepGUI/GSNibTemplates.h>
|
||||
#include "GormFilePrefsManager.h"
|
||||
#include "GormFunctions.h"
|
||||
#include "GormDocument.h"
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <GNUstepBase/GSObjCRuntime.h>
|
||||
#include <InterfaceBuilder/IBApplicationAdditions.h>
|
||||
|
||||
NSString *formatVersion(int version)
|
||||
{
|
||||
|
@ -175,6 +177,34 @@ NSString *formatVersion(int version)
|
|||
return [NSArchiver archivedDataWithRootObject: self];
|
||||
}
|
||||
|
||||
- (NSData *) nibData
|
||||
{
|
||||
NSMutableDictionary *dict =
|
||||
[NSMutableDictionary dictionary];
|
||||
NSRect docLocation =
|
||||
[[(GormDocument *)[(id<IB>)NSApp activeDocument] window] frame];
|
||||
NSRect screenRect = [[NSScreen mainScreen] frame];
|
||||
NSString *stringRect = [NSString stringWithFormat: @"%d %d %d %d %d %d %d %d",
|
||||
docLocation.origin.x, docLocation.origin.y,
|
||||
docLocation.size.width, docLocation.size.height,
|
||||
screenRect.origin.x, screenRect.origin.y,
|
||||
screenRect.size.width, screenRect.size.height];
|
||||
|
||||
// upon saving, update to the latest.
|
||||
version = [GormFilePrefsManager currentVersion];
|
||||
[gormAppVersion setStringValue: formatVersion(version)];
|
||||
|
||||
[dict setObject: stringRect forKey: @"IBDocumentLocation"];
|
||||
[dict setObject: @"437.0" forKey: @"IBFramework Version"];
|
||||
[dict setObject: @"8I127" forKey: @"IBSystem Version"];
|
||||
[dict setObject: [NSNumber numberWithBool: YES]
|
||||
forKey: @"IBUsesTextArchiving"]; // for now.
|
||||
|
||||
return [NSPropertyListSerialization dataFromPropertyList: dict
|
||||
format: NSPropertyListXMLFormat_v1_0
|
||||
errorDescription: NULL];
|
||||
}
|
||||
|
||||
- (int) versionOfClass: (NSString *)className
|
||||
{
|
||||
int result = -1;
|
||||
|
@ -298,5 +328,6 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
row: (int)rowIndex
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{
|
||||
NSName = "GSNibFileType";
|
||||
NSHumanReadableName = "Cocoa Nib";
|
||||
NSRole = Viewer;
|
||||
NSRole = Editor;
|
||||
NSDocumentClass = GormDocument;
|
||||
NSUnixExtensions = ( "nib" );
|
||||
NSIcon = "GormNib.tiff";
|
||||
|
|
Loading…
Reference in a new issue