mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-19 00:51:51 +00:00
* Framework/PCProjectBuilderOptions.m: New file.
* Headers/ProjectCenter/PCProjectBuilderOptions.h: New file. * ProjectBuilder options handling finished. * Fixed compliance to GNUstep make v2. * Framework/PCFileNameIcon.m: Start implementing drag/drop. * Images/ProjectCenter.tiff: Use ProjectManager's app icon. * Modules/Projects/*/Resources/Info.table: change default targets. * Headers/ProjectCenter/PCDefines.h: Clean up. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@25406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f1f6ae6234
commit
74db52149f
10 changed files with 187 additions and 112 deletions
Framework
|
@ -9,8 +9,7 @@
|
|||
"showProjectLaunch:",
|
||||
"showProjectLoadedFiles:",
|
||||
"startBuild:",
|
||||
"startClean:",
|
||||
"startInstall:"
|
||||
"startClean:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
@ -23,7 +22,6 @@
|
|||
};
|
||||
PCProjectBuilder = {
|
||||
Actions = (
|
||||
"startInstall:",
|
||||
"startBuild:",
|
||||
"startClean:",
|
||||
"showOptionsPanel:"
|
||||
|
@ -32,10 +30,9 @@
|
|||
buildButton,
|
||||
cleanButton,
|
||||
componentView,
|
||||
installButton,
|
||||
split,
|
||||
optionsButton,
|
||||
buildStatusField,
|
||||
statusField,
|
||||
targetField,
|
||||
errorsCountField
|
||||
);
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -2,20 +2,22 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"popupChanged:"
|
||||
"optionsButtonClicked:",
|
||||
"optionsPopupChanged:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PCProjectBuilder = {
|
||||
PCProjectBuilderOptions = {
|
||||
Actions = (
|
||||
"popupChanged:"
|
||||
"optionsPopupChanged:",
|
||||
"optionsButtonClicked:"
|
||||
);
|
||||
Outlets = (
|
||||
buildArgsField,
|
||||
debugButton,
|
||||
verboseButton,
|
||||
optionsPanel,
|
||||
profileButton,
|
||||
stripButton,
|
||||
sharedLibsButton,
|
||||
targetPopup
|
||||
);
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -39,6 +39,7 @@ ProjectCenter_HEADER_FILES = \
|
|||
PCProjectWindow.h \
|
||||
PCProjectInspector.h \
|
||||
PCProjectBuilder.h \
|
||||
PCProjectBuilderOptions.h \
|
||||
PCProjectBuilderPanel.h \
|
||||
PCProjectLauncher.h \
|
||||
PCProjectLauncherPanel.h \
|
||||
|
@ -67,6 +68,7 @@ ProjectCenter_OBJC_FILES = \
|
|||
PCProjectWindow.m \
|
||||
PCProjectInspector.m \
|
||||
PCProjectBuilder.m \
|
||||
PCProjectBuilderOptions.m \
|
||||
PCProjectBuilderPanel.m \
|
||||
PCProjectLauncher.m \
|
||||
PCProjectLauncherPanel.m \
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
- (void)awakeFromNib
|
||||
{
|
||||
filePath = nil;
|
||||
msfText = nil;
|
||||
[self setImage:[NSImage imageNamed:@"projectSuitcase"]];
|
||||
[self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
[self
|
||||
registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(NSRect)frameRect
|
||||
|
@ -42,10 +43,9 @@
|
|||
self = [super initWithFrame:frameRect];
|
||||
|
||||
filePath = nil;
|
||||
msfText = nil;
|
||||
[self setRefusesFirstResponder:YES];
|
||||
[self setEditable:NO];
|
||||
[self setImage:[NSImage imageNamed:@"projectSuitcase"]];
|
||||
[self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -89,15 +89,59 @@
|
|||
}
|
||||
}
|
||||
|
||||
@end
|
||||
// --- Drag and drop
|
||||
|
||||
@implementation PCFileNameIcon (FileNameIconDelegate)
|
||||
// --- NSDraggingDestination protocol methods
|
||||
// -- Before the image is released
|
||||
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
|
||||
unsigned int draggingOp = NSDragOperationNone;
|
||||
|
||||
- (NSImage *)fileNameIconImage
|
||||
NSLog(@"Dragging entered");
|
||||
|
||||
if (![paths isKindOfClass:[NSArray class]] || [paths count] == 0)
|
||||
{
|
||||
return draggingOp;
|
||||
}
|
||||
|
||||
if (delegate &&
|
||||
[delegate respondsToSelector:@selector(canPerformDraggingOf:)] &&
|
||||
[delegate canPerformDraggingOf:paths] == YES)
|
||||
{
|
||||
draggingOp = NSDragOperationCopy;
|
||||
}
|
||||
|
||||
if (draggingOp == NSDragOperationCopy)
|
||||
{ // TODO: Change icon to icon that shows open state of destination
|
||||
}
|
||||
|
||||
return draggingOp;
|
||||
}
|
||||
|
||||
- (void)draggingExited:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *)fileNameIconTitle
|
||||
// -- After the image is released
|
||||
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSLog(@"Prepare for drag operation");
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
|
||||
|
||||
NSLog(@"performDragOperation: %@", paths);
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)concludeDragOperation:(id <NSDraggingInfo>)sendera
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -657,4 +657,35 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return PCFileNameFieldNoFiles;
|
||||
}
|
||||
|
||||
- (BOOL)canPerformDraggingOf:(NSArray *)paths
|
||||
{
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
NSString *categoryKey = [project keyForCategory:category];
|
||||
NSArray *fileTypes = [project fileTypesForCategoryKey:categoryKey];
|
||||
NSEnumerator *e = [paths objectEnumerator];
|
||||
NSString *s;
|
||||
|
||||
NSLog(@"PCBrowser: canPerformDraggingOf -> %@", category);
|
||||
|
||||
if (!category)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![project isEditableCategory:category])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
while ((s = [e nextObject]))
|
||||
{
|
||||
if (![fileTypes containsObject:[s pathExtension]])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectBuilder.h>
|
||||
#include <ProjectCenter/PCProjectBuilderOptions.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#include <ProjectCenter/PCPrefController.h>
|
||||
|
@ -57,8 +58,11 @@
|
|||
if ((self = [super init]))
|
||||
{
|
||||
project = aProject;
|
||||
buildTarget = [[NSMutableString alloc] initWithString:@"Default"];
|
||||
buildStatusTarget = [[NSMutableString alloc] initWithString:@"all"];
|
||||
buildTarget = [[NSMutableString alloc] initWithString:@"all"];
|
||||
buildArgs = [[NSMutableArray array] retain];
|
||||
buildOptions = [[PCProjectBuilderOptions alloc] initWithProject:project
|
||||
delegate:self];
|
||||
postProcess = NULL;
|
||||
makeTask = nil;
|
||||
_isBuilding = NO;
|
||||
|
@ -81,6 +85,7 @@
|
|||
NSLog (@"PCProjectBuilder: dealloc");
|
||||
#endif
|
||||
|
||||
[buildStatusTarget release];
|
||||
[buildTarget release];
|
||||
[buildArgs release];
|
||||
[makePath release];
|
||||
|
@ -90,6 +95,7 @@
|
|||
[componentView release];
|
||||
[errorArray release];
|
||||
[errorString release];
|
||||
[buildOptions release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -118,13 +124,11 @@
|
|||
[cleanButton setToolTip:@"Clean"];
|
||||
[cleanButton setImage:IMAGE(@"Clean")];
|
||||
|
||||
[installButton setToolTip:@"Install"];
|
||||
[installButton setImage:IMAGE(@"Install")];
|
||||
|
||||
[optionsButton setToolTip:@"Build Options"];
|
||||
[optionsButton setImage:IMAGE(@"Options")];
|
||||
|
||||
[errorsCountField setStringValue:@""];
|
||||
[self updateTargetField];
|
||||
|
||||
/*
|
||||
* Error output
|
||||
|
@ -233,6 +237,19 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)updateTargetField
|
||||
{
|
||||
NSString *s;
|
||||
NSString *args;
|
||||
|
||||
args = [[[project projectDict] objectForKey:PCBuilderArguments]
|
||||
componentsJoinedByString:@" "];
|
||||
|
||||
s = [NSString stringWithFormat:@"%@ with args '%@'", buildTarget, args];
|
||||
|
||||
[targetField setStringValue:s];
|
||||
}
|
||||
|
||||
// --- Accessory
|
||||
- (BOOL)isBuilding
|
||||
{
|
||||
|
@ -272,32 +289,58 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (NSArray *)buildArguments
|
||||
{
|
||||
NSDictionary *projectDict = [project projectDict];
|
||||
NSString *instDir = [projectDict objectForKey:PCInstallDir];
|
||||
NSMutableArray *args = [NSMutableArray new];
|
||||
|
||||
if (![instDir isEqualToString:@"LOCAL"] &&
|
||||
![instDir isEqualToString:@"SYSTEM"] &&
|
||||
![instDir isEqualToString:@"USER"] &&
|
||||
![instDir isEqualToString:@"NETWORK"] &&
|
||||
![instDir isEqualToString:@""])
|
||||
{
|
||||
[args addObject:[NSString stringWithFormat:@"DESTDIR=%@", instDir]];
|
||||
}
|
||||
|
||||
[args addObjectsFromArray:[projectDict objectForKey:PCBuilderArguments]];
|
||||
|
||||
// Get arguments from options
|
||||
if ([[projectDict objectForKey:PCBuilderVerbose] isEqualToString:@"YES"])
|
||||
{ // default is 'messages=no'
|
||||
[args addObject:@"messages=yes"];
|
||||
}
|
||||
if ([[projectDict objectForKey:PCBuilderDebug] isEqualToString:@"NO"])
|
||||
{ // default is 'debug=yes'
|
||||
[args addObject:@"debug=no"];
|
||||
}
|
||||
if ([[projectDict objectForKey:PCBuilderStrip] isEqualToString:@"YES"])
|
||||
{ // default is 'strip=no'
|
||||
[args addObject:@"strip=yes"];
|
||||
}
|
||||
if ([[projectDict objectForKey:PCBuilderSharedLibs] isEqualToString:@"NO"])
|
||||
{ // default is 'shared=yes'
|
||||
[args addObject:@"shared=no"];
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
// --- GUI Actions
|
||||
- (void)startBuild:(id)sender
|
||||
{
|
||||
NSString *tFString = [targetField stringValue];
|
||||
NSArray *tFArray = [tFString componentsSeparatedByString:@" "];
|
||||
|
||||
if ([self stopMake:self] == YES)
|
||||
{// We've just stopped build process
|
||||
return;
|
||||
}
|
||||
[buildTarget setString:[tFArray objectAtIndex:0]];
|
||||
|
||||
[buildArgs addObject:buildTarget];
|
||||
|
||||
// Set build arguments
|
||||
if ([buildTarget isEqualToString:@"Debug"])
|
||||
{
|
||||
[buildArgs addObject:@"debug=yes"];
|
||||
}
|
||||
else if ([buildTarget isEqualToString:@"Profile"])
|
||||
{
|
||||
[buildArgs addObject:@"profile=yes"];
|
||||
[buildArgs addObject:@"static=yes"];
|
||||
}
|
||||
else if ([buildTarget isEqualToString:@"Tarball"])
|
||||
{
|
||||
[buildArgs addObject:@"dist"];
|
||||
}
|
||||
[buildArgs addObjectsFromArray:[self buildArguments]];
|
||||
|
||||
NSLog(@"ProjectBuilder arguments: %@", buildArgs);
|
||||
|
||||
currentEL = ELNone;
|
||||
lastEL = ELNone;
|
||||
|
@ -308,10 +351,9 @@
|
|||
[currentBuildPath addObject:[project projectPath]];
|
||||
currentBuildFile = [[NSMutableString alloc] initWithString:@""];
|
||||
|
||||
statusString = [NSString stringWithString:@"Building..."];
|
||||
[buildTarget setString:@"Build"];
|
||||
buildStatus = [NSString stringWithString:@"Building..."];
|
||||
[buildStatusTarget setString:@"Build"];
|
||||
[cleanButton setEnabled:NO];
|
||||
[installButton setEnabled:NO];
|
||||
[self build:self];
|
||||
_isBuilding = YES;
|
||||
}
|
||||
|
@ -336,30 +378,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
statusString = [NSString stringWithString:@"Cleaning..."];
|
||||
[buildTarget setString:@"Clean"];
|
||||
buildStatus = [NSString stringWithString:@"Cleaning..."];
|
||||
[buildStatusTarget setString:@"Clean"];
|
||||
[buildArgs addObject:@"clean"];
|
||||
[buildButton setEnabled:NO];
|
||||
[installButton setEnabled:NO];
|
||||
[self build:self];
|
||||
_isCleaning = YES;
|
||||
}
|
||||
|
||||
- (void)startInstall:(id)sender
|
||||
{
|
||||
if ([self stopMake:self] == YES)
|
||||
{// We've just stopped build process
|
||||
return;
|
||||
}
|
||||
|
||||
[buildTarget setString:@"Install"];
|
||||
statusString = [NSString stringWithString:@"Installing..."];
|
||||
[buildArgs addObject:@"install"];
|
||||
[buildButton setEnabled:NO];
|
||||
[cleanButton setEnabled:NO];
|
||||
[self build:self];
|
||||
}
|
||||
|
||||
- (BOOL)stopMake:(id)sender
|
||||
{
|
||||
// [makeTask isRunning] doesn't work here.
|
||||
|
@ -382,36 +408,33 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (void)showOptionsPanel:(id)sender
|
||||
{
|
||||
[buildOptions show:[[componentView window] frame]];
|
||||
}
|
||||
|
||||
- (void)cleanupAfterMake
|
||||
{
|
||||
if (_isBuilding || _isCleaning)
|
||||
{
|
||||
[buildStatusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ terminated", [project projectName], buildTarget]];
|
||||
[statusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ terminated", [project projectName], buildStatusTarget]];
|
||||
}
|
||||
|
||||
// Restore buttons state
|
||||
if ([buildTarget isEqualToString:@"Build"])
|
||||
if ([buildStatusTarget isEqualToString:@"Build"])
|
||||
{
|
||||
[buildButton setState:NSOffState];
|
||||
[cleanButton setEnabled:YES];
|
||||
[installButton setEnabled:YES];
|
||||
}
|
||||
else if ([buildTarget isEqualToString:@"Clean"])
|
||||
else if ([buildStatusTarget isEqualToString:@"Clean"])
|
||||
{
|
||||
[cleanButton setState:NSOffState];
|
||||
[buildButton setEnabled:YES];
|
||||
[installButton setEnabled:YES];
|
||||
}
|
||||
else if ([buildTarget isEqualToString:@"Install"])
|
||||
{
|
||||
[installButton setState:NSOffState];
|
||||
[buildButton setEnabled:YES];
|
||||
[cleanButton setEnabled:YES];
|
||||
}
|
||||
|
||||
[buildArgs removeAllObjects];
|
||||
[buildTarget setString:@"Default"];
|
||||
[buildStatusTarget setString:@"Default"];
|
||||
|
||||
if (_isBuilding)
|
||||
{
|
||||
|
@ -424,7 +447,6 @@
|
|||
}
|
||||
|
||||
// --- Actions
|
||||
|
||||
- (BOOL)prebuildCheck
|
||||
{
|
||||
PCPrefController *prefs = [PCPrefController sharedPCPreferences];
|
||||
|
@ -512,7 +534,7 @@
|
|||
errorsCount = 0;
|
||||
warningsCount = 0;
|
||||
|
||||
[buildStatusField setStringValue:statusString];
|
||||
[statusField setStringValue:buildStatus];
|
||||
|
||||
// Run make task
|
||||
[logOutput setString:@""];
|
||||
|
@ -591,29 +613,29 @@
|
|||
if (status == 0)
|
||||
{
|
||||
[self logString:
|
||||
[NSString stringWithFormat:@"=== %@ succeeded! ===", buildTarget]
|
||||
[NSString stringWithFormat:@"=== %@ succeeded! ===", buildStatusTarget]
|
||||
error:NO
|
||||
newLine:YES];
|
||||
[buildStatusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ succeeded", [project projectName], buildTarget]];
|
||||
[statusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ succeeded", [project projectName], buildStatusTarget]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self logString:
|
||||
[NSString stringWithFormat:@"=== %@ terminated! ===", buildTarget]
|
||||
[NSString stringWithFormat:@"=== %@ terminated! ===", buildStatusTarget]
|
||||
error:NO
|
||||
newLine:YES];
|
||||
if (errorsCount > 0)
|
||||
{
|
||||
[buildStatusField setStringValue:[NSString stringWithFormat:
|
||||
[statusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ failed (%i errors)",
|
||||
[project projectName], buildTarget, errorsCount]];
|
||||
[project projectName], buildStatusTarget, errorsCount]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[buildStatusField setStringValue:[NSString stringWithFormat:
|
||||
[statusField setStringValue:[NSString stringWithFormat:
|
||||
@"%@ - %@ failed",
|
||||
[project projectName], buildTarget]];
|
||||
[project projectName], buildStatusTarget]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,6 +735,13 @@
|
|||
[errorsCountField setStringValue:string];
|
||||
}
|
||||
|
||||
// --- BuilderOptions delgate
|
||||
- (void)targetDidSet:(NSString *)target
|
||||
{
|
||||
[buildTarget setString:target];
|
||||
[self updateTargetField];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCProjectBuilder (BuildLogging)
|
||||
|
@ -1108,33 +1137,3 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation PCProjectBuilder (Options)
|
||||
|
||||
- (void)showOptionsPanel:(id)sender
|
||||
{
|
||||
if (!optionsPanel)
|
||||
{
|
||||
if ([NSBundle loadNibNamed:@"BuilderOptions" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading BuilderOptions NIB file!");
|
||||
return;
|
||||
}
|
||||
[targetPopup addItemsWithTitles:[project buildTargets]];
|
||||
}
|
||||
|
||||
[optionsPanel makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)popupChanged:(id)sender
|
||||
{
|
||||
NSString *target = [targetField stringValue];
|
||||
|
||||
target = [NSString stringWithFormat:
|
||||
@"%@ with args ' %@ '",
|
||||
[targetPopup titleOfSelectedItem],
|
||||
[buildArgsField stringValue]];
|
||||
|
||||
[targetField setStringValue:target];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue