mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-05-06 04:00:43 +00:00
Added code and gorm file to show inconsistencies in gorm files when they are detected.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@25813 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c1f3e4d48c
commit
d047746fce
11 changed files with 126 additions and 46 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-12-31 21:22-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* English.lproj/GormInconsistenciesPanel.gorm: Error panel to show
|
||||
detected inconsistencies.
|
||||
* English.lproj/GormPrefGeneral.gorm: Added option to turn on
|
||||
repair method.
|
||||
* GNUmakefile: Added reference to new gorm file.
|
||||
* GormCore/GormGormWrapperLoader.m: Added code to bring up the
|
||||
new panel and show the errors.
|
||||
* GormPrefs/GormGeneralPref.[mh]: Added new method and ivar to
|
||||
handle switch for consistency checking.
|
||||
|
||||
2007-12-19 19:03-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormGormWrapperLoader.m
|
||||
|
|
20
English.lproj/GormInconsistenciesPanel.gorm/data.classes
Normal file
20
English.lproj/GormInconsistenciesPanel.gorm/data.classes
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
GormGormWrapperLoader = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
message,
|
||||
textField,
|
||||
panel
|
||||
);
|
||||
Super = GormWrapperLoader;
|
||||
};
|
||||
GormWrapperLoader = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
BIN
English.lproj/GormInconsistenciesPanel.gorm/data.info
Normal file
BIN
English.lproj/GormInconsistenciesPanel.gorm/data.info
Normal file
Binary file not shown.
BIN
English.lproj/GormInconsistenciesPanel.gorm/objects.gorm
Normal file
BIN
English.lproj/GormInconsistenciesPanel.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -4,6 +4,7 @@
|
|||
Actions = (
|
||||
"archiveAction:",
|
||||
"classesAction:",
|
||||
"consistencyAction:",
|
||||
"orderFrontFontPanel:"
|
||||
);
|
||||
Super = NSObject;
|
||||
|
@ -14,7 +15,8 @@
|
|||
"inspectorAction:",
|
||||
"backupAction:",
|
||||
"archiveAction:",
|
||||
"classesAction:"
|
||||
"classesAction:",
|
||||
"consistencyAction:"
|
||||
);
|
||||
Outlets = (
|
||||
window,
|
||||
|
@ -22,7 +24,8 @@
|
|||
inspectorButton,
|
||||
backupButton,
|
||||
archiveMatrix,
|
||||
interfaceMatrix
|
||||
interfaceMatrix,
|
||||
checkConsistency
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -145,6 +145,7 @@ Gorm_LOCALIZED_RESOURCE_FILES = \
|
|||
GormHelpInspector.gorm \
|
||||
Gorm.gorm \
|
||||
GormImageInspector.gorm \
|
||||
GormInconsistenciesPanel.gorm \
|
||||
GormInspectorPanel.gorm \
|
||||
GormObjectInspector.gorm \
|
||||
GormNSSplitViewInspector.gorm \
|
||||
|
|
|
@ -36,6 +36,12 @@
|
|||
#include <GormCore/GormFunctions.h>
|
||||
|
||||
@interface GormGormWrapperLoader : GormWrapperLoader
|
||||
{
|
||||
NSMutableArray *_repairLog;
|
||||
id message;
|
||||
id textField;
|
||||
id panel;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormGormWrapperLoader
|
||||
|
@ -44,6 +50,44 @@
|
|||
return @"GSGormFileType";
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if((self = [super init]) != nil)
|
||||
{
|
||||
_repairLog = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_repairLog);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) _openMessagePanel: (NSString *) msg
|
||||
{
|
||||
NSEnumerator *en = [_repairLog objectEnumerator];
|
||||
id m = nil;
|
||||
|
||||
if([NSBundle loadNibNamed: @"GormInconsistenciesPanel"
|
||||
owner: self] == NO)
|
||||
{
|
||||
NSLog(@"Failed to open message panel...");
|
||||
}
|
||||
else
|
||||
{
|
||||
[message setStringValue: msg];
|
||||
|
||||
while((m = [en nextObject]) != nil)
|
||||
{
|
||||
[textField insertText: m];
|
||||
}
|
||||
|
||||
[panel orderFront: self];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The sole purpose of this method is to clean up .gorm files from older
|
||||
* versions of Gorm which might have some dangling references. This method
|
||||
|
@ -80,7 +124,9 @@
|
|||
if(sm == nil)
|
||||
{
|
||||
NSArray *menus = findAll(obj);
|
||||
NSLog(@"Found and removed a dangling menu %@, %@.",obj,[document nameForObject: obj]);
|
||||
[_repairLog addObject:
|
||||
[NSString stringWithFormat: @"ERROR ==> Found and removed a dangling menu %@, %@.\n",
|
||||
obj,[document nameForObject: obj]]];
|
||||
[document detachObjects: menus];
|
||||
[document detachObject: obj];
|
||||
|
||||
|
@ -104,7 +150,9 @@
|
|||
{
|
||||
id sm = [obj submenu];
|
||||
|
||||
NSLog(@"Found and removed a dangling menu item %@, %@.",obj,[document nameForObject: obj]);
|
||||
[_repairLog addObject:
|
||||
[NSString stringWithFormat: @"ERROR ==> Found and removed a dangling menu item %@, %@.\n",
|
||||
obj,[document nameForObject: obj]]];
|
||||
[document detachObject: obj];
|
||||
|
||||
// if there are any submenus, detach those as well.
|
||||
|
@ -133,21 +181,24 @@
|
|||
{
|
||||
[document attachObject: v toParent: [v superview]];
|
||||
name = [document nameForObject: v];
|
||||
NSLog(@"==> Found view %@ without an associated name, adding to the nametable as %@", v, name);
|
||||
[_repairLog addObject:
|
||||
[NSString stringWithFormat:
|
||||
@"ERROR ==> Found view %@ without an associated name, adding to the nametable as %@\n",
|
||||
v, name]];
|
||||
if([v respondsToSelector: @selector(stringValue)])
|
||||
{
|
||||
NSLog(@"View string value is %@",[v stringValue]);
|
||||
[_repairLog addObject: [NSString stringWithFormat: @"INFO: View string value is %@\n",[v stringValue]]];
|
||||
}
|
||||
errorCount++;
|
||||
}
|
||||
NSLog(@"Found view %@ with name %@", v, name);
|
||||
[_repairLog addObject: [NSString stringWithFormat: @"INFO: Checking view %@ with name %@\n", v, name]];
|
||||
}
|
||||
}
|
||||
}
|
||||
[document reactivateEditors];
|
||||
|
||||
/**
|
||||
* Iterate over all connections...
|
||||
* Iterate over all connections... remove connections with nil sources.
|
||||
*/
|
||||
en = [connections objectEnumerator];
|
||||
while((con = [en nextObject]) != nil)
|
||||
|
@ -156,14 +207,8 @@
|
|||
{
|
||||
if([con source] == nil)
|
||||
{
|
||||
NSLog(@"==> Removing bad connector with nil source: %@",con);
|
||||
[document removeConnector: con];
|
||||
errorCount++;
|
||||
}
|
||||
|
||||
if([con destination] == nil)
|
||||
{
|
||||
NSLog(@"==> Removing bad connector with nil destination: %@",con);
|
||||
[_repairLog addObject:
|
||||
[NSString stringWithFormat: @"ERROR ==> Removing bad connector with nil source: %@\n",con]];
|
||||
[document removeConnector: con];
|
||||
errorCount++;
|
||||
}
|
||||
|
@ -174,9 +219,7 @@
|
|||
if(errorCount > 0)
|
||||
{
|
||||
errorMsg = [NSString stringWithFormat: @"%d inconsistencies were found, please save the file.",errorCount];
|
||||
NSRunAlertPanel(_(@"Warning"),
|
||||
errorMsg,
|
||||
nil, nil, nil);
|
||||
[self _openMessagePanel: errorMsg];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
id window;
|
||||
id backupButton;
|
||||
id interfaceMatrix;
|
||||
|
||||
id checkConsistency;
|
||||
id _view;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
|||
* Show the classes view as a browser or an outline.
|
||||
*/
|
||||
- (void) classesAction: (id)sender;
|
||||
|
||||
- (void) consistencyAction: (id)sender;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
static NSString *BACKUPFILE=@"BackupFile";
|
||||
static NSString *INTTYPE=@"ClassViewType";
|
||||
static NSString *REPAIRFILE=@"GormRepairFileOnLoad";
|
||||
|
||||
@implementation GormGeneralPref
|
||||
|
||||
|
@ -59,6 +60,7 @@ static NSString *INTTYPE=@"ClassViewType";
|
|||
NSString *intType = [defaults stringForKey: INTTYPE];
|
||||
|
||||
[backupButton setState: [defaults integerForKey: BACKUPFILE]];
|
||||
[checkConsistency setState: ([defaults boolForKey: REPAIRFILE]?NSOnState:NSOffState)];
|
||||
|
||||
// set the interface matrix...
|
||||
if([intType isEqual: @"Outline"])
|
||||
|
@ -88,21 +90,12 @@ static NSString *INTTYPE=@"ClassViewType";
|
|||
}
|
||||
|
||||
- (void) backupAction: (id)sender
|
||||
{
|
||||
if (sender != backupButton)
|
||||
return;
|
||||
else
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setInteger:[backupButton state] forKey:BACKUPFILE];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) classesAction: (id)sender
|
||||
{
|
||||
if (sender != interfaceMatrix)
|
||||
return;
|
||||
else
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
// NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
@ -121,6 +114,12 @@ static NSString *INTTYPE=@"ClassViewType";
|
|||
// object: nil];
|
||||
|
||||
}
|
||||
|
||||
- (void) consistencyAction: (id)sender
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setBool: (([checkConsistency state] == NSOnState)?YES:NO)
|
||||
forKey: REPAIRFILE];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue