mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Changed the class inspector to use the table view pointer to determine which table is calling the delegate. Added some, soon to be uncommented, code to the class manager to prevent tampering with the data.classes file outside of Gorm.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20323 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5fe525e109
commit
4eff9148d0
4 changed files with 75 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-11-08 00:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassInspector.m: Modified the code in the table delegate
|
||||
to use the NSTableView * to determine which table is calling
|
||||
the delegate instead of which tab is currently selected.
|
||||
|
||||
2004-11-07 22:56 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassManager.m: Added code to [GormClassManager
|
||||
|
|
|
@ -553,16 +553,14 @@ shouldEditTableColumn: (NSTableColumn *)aTableColumn
|
|||
{
|
||||
NSArray *list = nil;
|
||||
NSString *name = nil;
|
||||
NSTabViewItem *tvi = [tabView selectedTabViewItem];
|
||||
BOOL isAction = [[tvi identifier] isEqualToString: @"Actions"];
|
||||
NSString *className = [self _currentClass];
|
||||
|
||||
if(isAction)
|
||||
if(tableView == actionTable)
|
||||
{
|
||||
list = [classManager allActionsForClassNamed: className];
|
||||
name = [list objectAtIndex: rowIndex];
|
||||
}
|
||||
else
|
||||
else if(tableView == outletTable)
|
||||
{
|
||||
list = [classManager allOutletsForClassNamed: className];
|
||||
name = [list objectAtIndex: rowIndex];
|
||||
|
@ -570,12 +568,12 @@ shouldEditTableColumn: (NSTableColumn *)aTableColumn
|
|||
|
||||
if([classManager isCustomClass: className])
|
||||
{
|
||||
if (isAction)
|
||||
if(tableView == actionTable)
|
||||
{
|
||||
result = [classManager isAction: name
|
||||
ofClass: className];
|
||||
}
|
||||
else
|
||||
else if(tableView == outletTable)
|
||||
{
|
||||
result = [classManager isOutlet: name
|
||||
ofClass: className];
|
||||
|
@ -590,6 +588,43 @@ shouldEditTableColumn: (NSTableColumn *)aTableColumn
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
- (void) tableView: (NSTableView *)tableView
|
||||
willDisplayCell: (id)aCell
|
||||
forTableColumn: (NSTableColumn *)aTableColumn
|
||||
row: (int)rowIndex
|
||||
{
|
||||
NSString *name = [aCell stringValue];
|
||||
NSString *className = [self _currentClass];
|
||||
|
||||
if(tableView == actionTable)
|
||||
{
|
||||
if(([classManager isCustomClass: className] &&
|
||||
[classManager isAction: name ofClass: className]) ||
|
||||
[classManager isAction: name onCategoryForClassNamed: className])
|
||||
{
|
||||
[aCell setTextColor: [NSColor blackColor]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCell setTextColor: [NSColor darkGrayColor]];
|
||||
}
|
||||
}
|
||||
else if(tableView == outletTable)
|
||||
{
|
||||
if([classManager isCustomClass: className] &&
|
||||
[classManager isOutlet: name ofClass: className])
|
||||
{
|
||||
[aCell setTextColor: [NSColor blackColor]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCell setTextColor: [NSColor darkGrayColor]];
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
- (BOOL) tableView: (NSTableView *)tv
|
||||
shouldSelectRow: (int)rowIndex
|
||||
{
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include "GormPalettesManager.h"
|
||||
#include <InterfaceBuilder/IBEditors.h>
|
||||
#include <InterfaceBuilder/IBPalette.h>
|
||||
// #include <GNUstepBase/GSCategories.h>
|
||||
#include <GNUstepBase/GSCategories.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
/** Private methods not accesible from outside */
|
||||
@interface GormClassManager (Private)
|
||||
|
@ -1196,15 +1197,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
// add the extras...
|
||||
[ci setObject: @"Do NOT change this file, Gorm maintains it"
|
||||
forKey: @"## Comment"];
|
||||
|
||||
/*
|
||||
[ci setObject: [NSNumber numberWithInt: [[ci description] hash]]
|
||||
forKey: @"hashValue"];
|
||||
*/
|
||||
|
||||
return [ci writeToFile: path atomically: YES];
|
||||
}
|
||||
|
||||
- (BOOL) loadFromFile: (NSString*)path
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSDictionary *dict;
|
||||
NSEnumerator *enumerator;
|
||||
NSString *key;
|
||||
|
||||
|
@ -1222,6 +1229,8 @@
|
|||
*/
|
||||
RELEASE(classInformation);
|
||||
classInformation = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// iterate over all entries..
|
||||
enumerator = [dict keyEnumerator];
|
||||
while ((key = [enumerator nextObject]) != nil)
|
||||
{
|
||||
|
@ -1272,6 +1281,8 @@
|
|||
NSMutableDictionary *dict;
|
||||
NSEnumerator *en;
|
||||
id key;
|
||||
int hash;
|
||||
int hashDict;
|
||||
|
||||
NSDebugLog(@"Load custom classes from file %@",path);
|
||||
|
||||
|
@ -1288,6 +1299,18 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
/*
|
||||
// Hash value to prevent tampering. This value stops someone from
|
||||
// being able to manually modify the file.
|
||||
hash = [[dict objectForKey: @"hashValue"] intValue];
|
||||
[dict removeObjectForKey: @"hashValue"];
|
||||
hashDict = [[dict description] hash];
|
||||
if(hash != hashDict && hash != 0)
|
||||
{
|
||||
NSLog(@"WARNING: The data.classes file has been tampered with");
|
||||
}
|
||||
*/
|
||||
|
||||
// Iterate over the set of classes, if it's in the classInformation
|
||||
// list, it's a category, if it's not it's a custom class.
|
||||
en = [dict keyEnumerator];
|
||||
|
|
|
@ -269,7 +269,7 @@ static NSImage *fileImage = nil;
|
|||
NSViewHeightSizable|NSViewWidthSizable];
|
||||
[scrollView setDocumentView: objectsView];
|
||||
RELEASE(objectsView);
|
||||
|
||||
|
||||
// images...
|
||||
mainRect.origin = NSMakePoint(0,0);
|
||||
imagesScrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
|
||||
|
@ -285,7 +285,7 @@ static NSImage *fileImage = nil;
|
|||
[imagesView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
||||
[imagesScrollView setDocumentView: imagesView];
|
||||
RELEASE(imagesView);
|
||||
|
||||
|
||||
// sounds...
|
||||
mainRect.origin = NSMakePoint(0,0);
|
||||
soundsScrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
|
||||
|
@ -301,7 +301,7 @@ static NSImage *fileImage = nil;
|
|||
[soundsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
||||
[soundsScrollView setDocumentView: soundsView];
|
||||
RELEASE(soundsView);
|
||||
|
||||
|
||||
// classes...
|
||||
classesScrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
|
||||
[classesScrollView setHasVerticalScroller: YES];
|
||||
|
@ -315,7 +315,6 @@ static NSImage *fileImage = nil;
|
|||
[classesView setFrame: mainRect];
|
||||
[classesScrollView setDocumentView: classesView];
|
||||
RELEASE(classesView);
|
||||
[classesView sizeToFit];
|
||||
|
||||
/*
|
||||
* Set the objects view as the initial view the user's see on startup.
|
||||
|
|
Loading…
Reference in a new issue