mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-17 08:01:24 +00:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@16779 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c70e1a179d
commit
d0f26f386c
19 changed files with 755 additions and 410 deletions
66
ChangeLog
66
ChangeLog
|
@ -1,3 +1,69 @@
|
|||
2003-05-23 Serg Stoyan <stoyan@hologr.com>
|
||||
|
||||
* PCMenuController.h: Added fileOpenQuickly:, fileNewUntitled:
|
||||
methods.
|
||||
* PCMenuController.m:
|
||||
(projectSaveFiles:): Call [projectManager saveAllFiles].
|
||||
(openFile:): Check existance of opening file and call
|
||||
[PCEditorController openFileInEditor:] here.
|
||||
(fileSaveTo:): Implemented.
|
||||
(fileRevertToSaved:): Call [projectManager revertFileToSaved].
|
||||
(fileOpenQuickly:): Added with alert panel.
|
||||
(fileNewUntitled:): Ditto.
|
||||
(validateMenuItem:): "File" menu items enabled for external editor
|
||||
window.
|
||||
|
||||
* ProjectCenter_main.m: (createMenu): Added actions to
|
||||
"Open Quickly..." and "New Untitled" menu items.
|
||||
|
||||
* PCLib/PCBrowserController.[hm]: setPathForFile: method added.
|
||||
Removed browser:willDisplayCell:atRow:column: and
|
||||
browser:selectCellWithString:inColumn: methods.
|
||||
|
||||
* PCLib/PCBrowserController.m:
|
||||
(click:): Don't load file into editor if multiple files selected.
|
||||
|
||||
* PCLib/PCEditor+UInterface.m:
|
||||
(_initUI): Set delegate for window to self. Removed bezel border.
|
||||
Set text container added. Cleanup.
|
||||
|
||||
* PCLib/PCEditor.[hm]: Added methods internalView, externalView,
|
||||
setPath:, isEdited, saveFileAs:, saveFileTo:, revertFileToSaved,
|
||||
closeFile:, editorShouldClose, windowShouldClose:
|
||||
|
||||
* PCLib/PCEditor.m:
|
||||
(setDelegate:): Set delegate for internal and external text views.
|
||||
(revertFileToSaved): Set attributes to saved text before loading
|
||||
into text view.
|
||||
|
||||
* PCLib/PCEditorController.[hm]: Added methods saveFileAs:,
|
||||
saveFileTo:, closeFile:, revertFileToSaved, setBrowserPath:.
|
||||
|
||||
* PCLib/PCEditorController.m:
|
||||
(openFileInEditor:): Set delegate to editor.
|
||||
(closeAllEditors): Call PCEditor closeFile instead of
|
||||
editor's window performClose.
|
||||
(editorDidClose): After closing editor, show next in list. Set
|
||||
to / if no editors left.
|
||||
|
||||
* PCLib/PCEditorView.m: becomeFirstResponder method added.
|
||||
|
||||
* PCLib/PCProject.[hm]: categoryForFile:, projectEditor,
|
||||
editorController methodd added. saveFile, saveAllFiles,
|
||||
saveAllFilesIfNeeded, revertFile methods removed.
|
||||
|
||||
* PCLib/PCProjectDebugger.h: textAttributes ivar added.
|
||||
logString:error: and logString:error:newLine: methods removed.
|
||||
logString:newLine: added.
|
||||
|
||||
* PCLib/PCProjectDebugger.m: Cleanup. Error view removed.
|
||||
|
||||
* PCLib/PCProjectEditor.m: Removed horizonal scroller.
|
||||
|
||||
* PCLib/PCProjectManager.[hm]: saveAllFiles, saveFileAs:,
|
||||
saveFileTo:, revertFileToSaved, closeFile, activeProject,
|
||||
projectPath, selectedFileName methods added.
|
||||
|
||||
2003-05-16 Serg Stoyan <stoyan@hologr.com>
|
||||
|
||||
* GNUmakefile: Remove PCAppController+MenuHandling.h and
|
||||
|
|
|
@ -52,14 +52,13 @@
|
|||
|
||||
- (void)setBrowser:(NSBrowser *)aBrowser;
|
||||
- (void)setProject:(PCProject *)aProj;
|
||||
- (BOOL)setPathForFile:(NSString *)file;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCBrowserController (ProjectBrowserDelegate)
|
||||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix;
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column;
|
||||
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
- (void)click:(id)sender
|
||||
{
|
||||
if ([[sender selectedCell] isLeaf])
|
||||
if ([[sender selectedCell] isLeaf] && [[self selectedFiles] count] == 1)
|
||||
{
|
||||
NSString *ltitle = [[sender selectedCell] stringValue];
|
||||
NSString *category = [[sender selectedCellInColumn:0] stringValue];
|
||||
|
@ -82,7 +82,6 @@
|
|||
|
||||
if ([k isEqualToString:PCClasses] ||
|
||||
[k isEqualToString:PCHeaders] ||
|
||||
[k isEqualToString:PCOtherResources] ||
|
||||
[k isEqualToString:PCSupportingFiles] ||
|
||||
[k isEqualToString:PCDocuFiles] ||
|
||||
[k isEqualToString:PCOtherSources])
|
||||
|
@ -123,8 +122,8 @@
|
|||
{
|
||||
NSArray *cells = [browser selectedCells];
|
||||
NSMutableArray *files = [[NSMutableArray alloc] initWithCapacity: 1];
|
||||
int i;
|
||||
int count = [cells count];
|
||||
int i;
|
||||
int count = [cells count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -164,43 +163,62 @@
|
|||
project = aProj;
|
||||
}
|
||||
|
||||
- (BOOL)setPathForFile:(NSString *)file
|
||||
{
|
||||
NSString *category = [project categoryForFile:file];
|
||||
NSString *browserCategory = [[[project rootCategories]
|
||||
allKeysForObject: category]
|
||||
lastObject];
|
||||
NSArray *comp = [NSArray arrayWithObjects: @"/",browserCategory,file,nil];
|
||||
NSString *path = [NSString pathWithComponents:comp];
|
||||
|
||||
int selectedColumn;
|
||||
NSMatrix *columnMatrix = nil;
|
||||
|
||||
if ([[browser path] isEqualToString: path])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Workaround!!! NSBrowser needs fixing!!!
|
||||
while ((selectedColumn = [browser selectedColumn]) >= 0)
|
||||
{
|
||||
columnMatrix = [browser matrixInColumn:selectedColumn];
|
||||
[columnMatrix deselectAllCells];
|
||||
}
|
||||
// End of workaround
|
||||
|
||||
return [browser setPath:path];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCBrowserController (ProjectBrowserDelegate)
|
||||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix
|
||||
{
|
||||
NSString *pathToCol = [sender pathToColumn:column];
|
||||
NSArray *files = [project contentAtKeyPath:pathToCol];
|
||||
int i;
|
||||
int count = [files count];
|
||||
|
||||
if( sender != browser ) return;
|
||||
NSString *pathToCol = [sender pathToColumn:column];
|
||||
NSArray *files = [project contentAtKeyPath:pathToCol];
|
||||
int i;
|
||||
int count = [files count];
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
if( sender != browser ) return;
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
NSMutableString *keyPath = [NSMutableString stringWithString:pathToCol];
|
||||
id cell;
|
||||
|
||||
|
||||
[matrix insertRow:i];
|
||||
|
||||
|
||||
cell = [matrix cellAtRow:i column:0];
|
||||
[cell setStringValue:[files objectAtIndex:i]];
|
||||
|
||||
|
||||
[keyPath appendString:@"/"];
|
||||
[keyPath appendString:[files objectAtIndex:i]];
|
||||
|
||||
|
||||
[cell setLeaf:![project hasChildrenAtKeyPath:keyPath]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
defer:YES];
|
||||
[_window setReleasedWhenClosed:NO];
|
||||
[_window setMinSize:NSMakeSize(512,320)];
|
||||
[_window setDelegate:self];
|
||||
rect = [[_window contentView] frame];
|
||||
|
||||
/*
|
||||
|
@ -67,24 +68,23 @@
|
|||
scrollView = [[NSScrollView alloc] initWithFrame:rect];
|
||||
[scrollView setHasHorizontalScroller: NO];
|
||||
[scrollView setHasVerticalScroller: YES];
|
||||
[scrollView setBorderType: NSBezelBorder];
|
||||
[scrollView setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];
|
||||
rect = [[scrollView contentView] frame];
|
||||
|
||||
/*
|
||||
* Creating external view
|
||||
*/
|
||||
|
||||
_eView = [self _createEditorViewWithFrame:rect];
|
||||
|
||||
/*
|
||||
* Setting up external view / scroll view / window
|
||||
*/
|
||||
|
||||
[scrollView setDocumentView:_eView];
|
||||
[_window setContentView:scrollView];
|
||||
[_window setDelegate:self];
|
||||
[[_eView textContainer] setContainerSize:NSMakeSize(rect.size.width, 1e7)];
|
||||
RELEASE (_eView);
|
||||
|
||||
[_window makeFirstResponder:_eView];
|
||||
[_window setContentView:scrollView];
|
||||
RELEASE(scrollView);
|
||||
|
||||
/*
|
||||
|
@ -95,9 +95,7 @@
|
|||
* The height should be large as this will be the height it will be
|
||||
* will be visible.
|
||||
*/
|
||||
|
||||
rect = NSMakeRect( 0, 0, 1e7, 1e7);
|
||||
_iView = [self _createEditorViewWithFrame:rect];
|
||||
_iView = [self _createEditorViewWithFrame:NSMakeRect(0, 0, 1e7, 1e7)];
|
||||
RETAIN(_iView);
|
||||
}
|
||||
|
||||
|
@ -126,12 +124,13 @@
|
|||
|
||||
[ev setMinSize: NSMakeSize( 0, 0)];
|
||||
[ev setMaxSize: NSMakeSize(1e7, 1e7)];
|
||||
[ev setRichText: YES];
|
||||
[ev setRichText: YES];
|
||||
[ev setEditable: YES];
|
||||
[ev setVerticallyResizable: YES];
|
||||
[ev setHorizontallyResizable: NO];
|
||||
[ev setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
||||
[ev setVerticallyResizable: YES];
|
||||
[ev setHorizontallyResizable: NO];
|
||||
[ev setTextContainerInset: NSMakeSize( 5, 5)];
|
||||
[[ev textContainer] setWidthTracksTextView:YES];
|
||||
[[ev textContainer] setWidthTracksTextView: YES];
|
||||
|
||||
return AUTORELEASE(ev);
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
@interface PCEditor : NSObject
|
||||
{
|
||||
PCEditorView *_iView; // internal (embedded) view
|
||||
PCEditorView *_eView; // external (window) view
|
||||
NSTextStorage *_storage;
|
||||
NSWindow *_window;
|
||||
NSMutableString *_path;
|
||||
PCEditorView *_iView; // internal (embedded) view
|
||||
PCEditorView *_eView; // external (window) view
|
||||
NSTextStorage *_storage;
|
||||
NSWindow *_window;
|
||||
NSMutableString *_path;
|
||||
|
||||
id _delegate;
|
||||
id _delegate;
|
||||
|
||||
BOOL _isEdited;
|
||||
BOOL _isEdited;
|
||||
}
|
||||
|
||||
- (id)initWithPath:(NSString*)file;
|
||||
|
@ -35,20 +35,27 @@
|
|||
- (void)setDelegate:(id)aDelegate;
|
||||
- (id)delegate;
|
||||
|
||||
- (PCEditorView *)internalView;
|
||||
- (PCEditorView *)externalView;
|
||||
- (NSWindow *)editorWindow;
|
||||
- (NSString *)path;
|
||||
|
||||
- (void)setPath:(NSString *)path;
|
||||
- (BOOL)isEdited;
|
||||
- (void)setIsEdited:(BOOL)yn;
|
||||
|
||||
- (void)showInProjectEditor:(PCProjectEditor *)pe;
|
||||
- (void)show;
|
||||
- (void)close;
|
||||
|
||||
- (BOOL)saveFileIfNeeded;
|
||||
- (BOOL)saveFile;
|
||||
- (BOOL)revertFile;
|
||||
- (BOOL)saveFileAs:(NSString *)path;
|
||||
- (BOOL)saveFileTo:(NSString *)path;
|
||||
- (BOOL)revertFileToSaved;
|
||||
- (BOOL)closeFile:(id)sender;
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)aNotif;
|
||||
// Delegates
|
||||
- (BOOL)editorShouldClose;
|
||||
|
||||
- (BOOL)windowShouldClose:(id)sender;
|
||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification;
|
||||
- (void)windowDidResignKey:(NSNotification *)aNotification;
|
||||
|
||||
|
@ -56,7 +63,7 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface NSObject (PCEditorDelegate )
|
||||
@interface NSObject (PCEditorDelegate)
|
||||
|
||||
- (void)editorDidClose:(id)sender;
|
||||
|
||||
|
|
213
PCLib/PCEditor.m
213
PCLib/PCEditor.m
|
@ -22,6 +22,10 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
|
||||
@implementation PCEditor
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Initialisation
|
||||
// ===========================================================================
|
||||
|
||||
- (id)initWithPath:(NSString*)file
|
||||
{
|
||||
if((self = [super init]))
|
||||
|
@ -76,6 +80,8 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
- (void)setDelegate:(id)aDelegate
|
||||
{
|
||||
_delegate = aDelegate;
|
||||
[_iView setDelegate: aDelegate];
|
||||
[_eView setDelegate: aDelegate];
|
||||
}
|
||||
|
||||
- (id)delegate
|
||||
|
@ -83,22 +89,51 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
return _delegate;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Accessor methods
|
||||
// ===========================================================================
|
||||
|
||||
- (NSWindow *)editorWindow
|
||||
{
|
||||
return _window;
|
||||
}
|
||||
|
||||
- (PCEditorView *)internalView
|
||||
{
|
||||
return _iView;
|
||||
}
|
||||
|
||||
- (PCEditorView *)externalView
|
||||
{
|
||||
return _eView;
|
||||
}
|
||||
|
||||
- (NSString *)path
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
- (void)setPath:(NSString *)path
|
||||
{
|
||||
[_path autorelease];
|
||||
_path = [path copy];
|
||||
}
|
||||
|
||||
- (BOOL)isEdited
|
||||
{
|
||||
return _isEdited;
|
||||
}
|
||||
|
||||
- (void)setIsEdited:(BOOL)yn
|
||||
{
|
||||
[_window setDocumentEdited:yn];
|
||||
_isEdited = yn;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Object managment
|
||||
// ===========================================================================
|
||||
|
||||
- (void)showInProjectEditor:(PCProjectEditor *)pe
|
||||
{
|
||||
[pe setEditorView:_iView];
|
||||
|
@ -109,48 +144,12 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
[_window makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
if( _isEdited )
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
if( [_window isVisible] )
|
||||
{
|
||||
[_window makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
ret = NSRunAlertPanel(@"Edited File!",
|
||||
@"Should '%@' be saved before closing?",
|
||||
@"Yes",@"No",nil,_path);
|
||||
|
||||
if( ret == YES )
|
||||
{
|
||||
ret = [self saveFile];
|
||||
|
||||
if((ret == NO))
|
||||
{
|
||||
NSRunAlertPanel(@"Save Failed!",
|
||||
@"Could not save file '%@'!",
|
||||
@"OK",nil,nil,_path);
|
||||
}
|
||||
}
|
||||
|
||||
[self setIsEdited:NO];
|
||||
}
|
||||
|
||||
if( _delegate && [_delegate respondsToSelector:@selector(editorDidClose:)] )
|
||||
{
|
||||
[_delegate editorDidClose:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)saveFileIfNeeded
|
||||
{
|
||||
if((_isEdited))
|
||||
{
|
||||
return [self saveFile];
|
||||
}
|
||||
if ((_isEdited))
|
||||
{
|
||||
return [self saveFile];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -163,10 +162,32 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
return [[_storage string] writeToFile:_path atomically:YES];
|
||||
}
|
||||
|
||||
- (BOOL)revertFile
|
||||
- (BOOL)saveFileAs:(NSString *)path
|
||||
{
|
||||
NSString *text = [NSString stringWithContentsOfFile:_path];
|
||||
NSAttributedString *as = [[NSAttributedString alloc] initWithString:text];
|
||||
// Unfinished
|
||||
/* [self setPath:file];
|
||||
|
||||
// Operate on the text storage!*/
|
||||
return [self saveFile];
|
||||
}
|
||||
|
||||
- (BOOL)saveFileTo:(NSString *)path
|
||||
{
|
||||
// Operate on the text storage!
|
||||
return [[_storage string] writeToFile:path atomically:YES];
|
||||
}
|
||||
|
||||
- (BOOL)revertFileToSaved
|
||||
{
|
||||
NSString *text = [NSString stringWithContentsOfFile:_path];
|
||||
NSAttributedString *as = nil;
|
||||
NSDictionary *at = nil;
|
||||
NSFont *ft = nil;
|
||||
|
||||
// This is temporary
|
||||
ft = [NSFont userFixedPitchFontOfSize:0.0];
|
||||
at = [NSDictionary dictionaryWithObject:ft forKey:NSFontAttributeName];
|
||||
as = [[NSAttributedString alloc] initWithString:text attributes:at];
|
||||
|
||||
[self setIsEdited:NO];
|
||||
|
||||
|
@ -180,19 +201,106 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)aNotification
|
||||
- (BOOL)closeFile:(id)sender
|
||||
{
|
||||
if( [[aNotification object] isEqual:_window] )
|
||||
{
|
||||
[self close];
|
||||
}
|
||||
if ([self editorShouldClose])
|
||||
{
|
||||
// Close window first if visible
|
||||
if ([_window isVisible] && (sender != _window))
|
||||
{
|
||||
[_window close];
|
||||
}
|
||||
|
||||
// Remove internal editor view
|
||||
if ([_iView superview])
|
||||
{
|
||||
[_iView removeFromSuperview];
|
||||
}
|
||||
|
||||
// Inform delegate
|
||||
if (_delegate
|
||||
&& [_delegate respondsToSelector:@selector(editorDidClose:)])
|
||||
{
|
||||
[_delegate editorDidClose:self];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)editorShouldClose
|
||||
{
|
||||
if (_isEdited)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
if ([_window isVisible])
|
||||
{
|
||||
[_window makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
ret = NSRunAlertPanel(@"Close File",
|
||||
@"Save changes to\n%@?",
|
||||
@"Save", @"Don't save", @"Cancel", _path);
|
||||
|
||||
if (ret == YES)
|
||||
{
|
||||
if ([self saveFile] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Close File",
|
||||
@"Save failed!\nCould not save file '%@'!",
|
||||
@"OK", nil, nil, _path);
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
else if (ret == NO) // Close but don't save
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
else // Cancel closing
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
[self setIsEdited:NO];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Window delegate
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
{
|
||||
if ([sender isEqual:_window])
|
||||
{
|
||||
if ([_iView superview] != nil)
|
||||
{
|
||||
// Just close if this file also displayed in internal view
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self closeFile:_window];
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
if( [[aNotification object] isEqual:_window] )
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PCEditorDidBecomeKeyNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorDidBecomeKeyNotification object:self];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,10 +308,15 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification";
|
|||
{
|
||||
if( [[aNotification object] isEqual:_window] )
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PCEditorDidResignKeyNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorDidResignKeyNotification object:self];
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== TextView (_iView, _eView) delegate
|
||||
// ===========================================================================
|
||||
|
||||
- (void)textDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
[self setIsEdited:YES];
|
||||
|
|
|
@ -33,15 +33,8 @@
|
|||
// ===========================================================================
|
||||
|
||||
- (id)init;
|
||||
|
||||
- (void)dealloc;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Acessor methods
|
||||
// ===========================================================================
|
||||
|
||||
- (PCEditor *) activeEditor;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Project and Editor handling
|
||||
// ===========================================================================
|
||||
|
@ -50,20 +43,29 @@
|
|||
|
||||
- (PCEditor *)internalEditorForFile:(NSString *)path;
|
||||
- (PCEditor *)editorForFile:(NSString *)path;
|
||||
- (PCEditor *)activeEditor;
|
||||
- (NSArray *)allEditors;
|
||||
|
||||
- (void)closeAllEditors;
|
||||
|
||||
- (void)editorDidClose:(id)sender;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== File handling
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)saveAllFiles;
|
||||
|
||||
- (BOOL)saveFile;
|
||||
- (BOOL)revertFile;
|
||||
- (BOOL)saveFileAs:(NSString *)file;
|
||||
- (BOOL)saveFileTo:(NSString *)file;
|
||||
- (void)closeFile:(id)sender;
|
||||
- (BOOL)revertFileToSaved;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Delegate
|
||||
// ===========================================================================
|
||||
|
||||
- (void)editorDidClose:(id)sender;
|
||||
|
||||
- (void)setBrowserPath:(NSString *)file;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -8,11 +8,14 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#include "PCProjectEditor.h"
|
||||
#include "PCEditorController.h"
|
||||
#include "PCEditorView.h"
|
||||
#include "PCDefines.h"
|
||||
#include "PCProject.h"
|
||||
#include "PCEditor.h"
|
||||
#include "PCProject+ComponentHandling.h"
|
||||
#include "PCBrowserController.h"
|
||||
|
||||
@implementation PCEditorController
|
||||
|
||||
|
@ -64,6 +67,7 @@
|
|||
PCEditor *editor;
|
||||
|
||||
editor = [[PCEditor alloc] initWithPath:path];
|
||||
[editor setDelegate:self];
|
||||
[editor show];
|
||||
}
|
||||
}
|
||||
|
@ -89,32 +93,6 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Acessor methods
|
||||
// ===========================================================================
|
||||
|
||||
- (PCEditor *) activeEditor
|
||||
{
|
||||
NSEnumerator *enumerator = [editorDict keyEnumerator];
|
||||
PCEditor *editor;
|
||||
NSString *key;
|
||||
NSWindow *window;
|
||||
|
||||
while(( key = [enumerator nextObject] ))
|
||||
{
|
||||
editor = [editorDict objectForKey:key];
|
||||
window = [editor editorWindow];
|
||||
|
||||
if( ([window isKeyWindow] && [window isMainWindow]) ||
|
||||
([project isEditorActive] && [[project projectWindow] isKeyWindow]))
|
||||
{
|
||||
return editor;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Project and Editor handling
|
||||
// ===========================================================================
|
||||
|
@ -161,6 +139,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (PCEditor *)activeEditor
|
||||
{
|
||||
NSEnumerator *enumerator = [editorDict keyEnumerator];
|
||||
PCEditor *editor;
|
||||
NSString *key;
|
||||
NSWindow *window;
|
||||
|
||||
while(( key = [enumerator nextObject] ))
|
||||
{
|
||||
editor = [editorDict objectForKey:key];
|
||||
window = [editor editorWindow];
|
||||
|
||||
if (([window isVisible] && [window isKeyWindow])
|
||||
|| ([[editor internalView] superview]
|
||||
&& [project isEditorActive]
|
||||
&& [[project projectWindow] isKeyWindow]))
|
||||
{
|
||||
return editor;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *)allEditors
|
||||
{
|
||||
return [editorDict allValues];
|
||||
|
@ -168,24 +170,16 @@
|
|||
|
||||
- (void)closeAllEditors
|
||||
{
|
||||
NSEnumerator *enumerator = [editorDict keyEnumerator];
|
||||
PCEditor *editor;
|
||||
NSString *key;
|
||||
NSEnumerator *enumerator = [editorDict keyEnumerator];
|
||||
PCEditor *editor;
|
||||
NSString *key;
|
||||
|
||||
while(( key = [enumerator nextObject] ))
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
editor = [editorDict objectForKey:key];
|
||||
[editor close];
|
||||
[[editor editorWindow] performClose:self];
|
||||
editor = [editorDict objectForKey:key];
|
||||
[editor closeFile:self];
|
||||
}
|
||||
[editorDict removeAllObjects];
|
||||
}
|
||||
|
||||
- (void)editorDidClose:(id)sender
|
||||
{
|
||||
PCEditor *editor = (PCEditor*)sender;
|
||||
|
||||
[editorDict removeObjectForKey:[editor path]];
|
||||
[editorDict removeAllObjects];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
@ -224,16 +218,74 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)revertFile
|
||||
- (BOOL)saveFileAs:(NSString *)file
|
||||
{
|
||||
PCEditor *editor = [self activeEditor];
|
||||
|
||||
if (editor != nil)
|
||||
{
|
||||
return [editor revertFile];
|
||||
return [editor saveFileAs:file];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)saveFileTo:(NSString *)file
|
||||
{
|
||||
PCEditor *editor = [self activeEditor];
|
||||
|
||||
if (editor != nil)
|
||||
{
|
||||
return [editor saveFileTo:file];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)revertFileToSaved
|
||||
{
|
||||
PCEditor *editor = [self activeEditor];
|
||||
|
||||
if (editor != nil)
|
||||
{
|
||||
return [editor revertFileToSaved];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)closeFile:(id)sender
|
||||
{
|
||||
[[self activeEditor] closeFile:self];
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Delegate
|
||||
// ===========================================================================
|
||||
|
||||
- (void)editorDidClose:(id)sender
|
||||
{
|
||||
PCEditor *editor = (PCEditor*)sender;
|
||||
|
||||
[editorDict removeObjectForKey:[editor path]];
|
||||
|
||||
if ([editorDict count])
|
||||
{
|
||||
editor = [editorDict objectForKey: [[editorDict allKeys] lastObject]];
|
||||
[editor showInProjectEditor: [project projectEditor]];
|
||||
[[project projectWindow] makeFirstResponder:[editor internalView]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[project projectEditor] setEditorView:nil];
|
||||
[self setBrowserPath:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setBrowserPath:(NSString *)file
|
||||
{
|
||||
[(PCBrowserController *)[project browserController] setPathForFile:file];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -27,12 +27,22 @@
|
|||
#include "PCEditorView.h"
|
||||
#include "PCEditor.h"
|
||||
#include "PCEditorView+Highlighting.h"
|
||||
#include "PCEditorController.h"
|
||||
|
||||
@implementation PCEditorView
|
||||
|
||||
static BOOL shouldHighlight = NO;
|
||||
static int _tabFlags = PCTab4Sp;
|
||||
|
||||
- (BOOL) becomeFirstResponder
|
||||
{
|
||||
NSString *file = [[editor path] lastPathComponent];
|
||||
|
||||
[(PCEditorController *)[self delegate] setBrowserPath:file];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (void)setTabBehaviour:(int)tabFlags
|
||||
{
|
||||
_tabFlags = tabFlags;
|
||||
|
|
|
@ -137,25 +137,25 @@ static NSString * const PCBuildTool = @"BUILDTOOL";
|
|||
PCEditorController *editorController;
|
||||
NSBox *box;
|
||||
|
||||
id projectAttributeInspectorView;
|
||||
id projectAttributeInspectorView;
|
||||
NSTextField *installPathField;
|
||||
NSTextField *toolField;
|
||||
NSTextField *ccOptField;
|
||||
NSTextField *ldOptField;
|
||||
|
||||
id projectProjectInspectorView;
|
||||
id projectProjectInspectorView;
|
||||
NSTextField *projectTypeField;
|
||||
|
||||
id projectFileInspectorView;
|
||||
id projectFileInspectorView;
|
||||
NSTextField *fileNameField;
|
||||
NSButton *changeFileNameButton;
|
||||
NSButton *changeFileNameButton;
|
||||
|
||||
id buildTargetPanel;
|
||||
id buildTargetHostField;
|
||||
id buildTargetArgsField;
|
||||
|
||||
NSString *projectName;
|
||||
NSString *projectPath;
|
||||
NSString *projectName;
|
||||
NSString *projectPath;
|
||||
NSMutableDictionary *projectDict;
|
||||
|
||||
NSDictionary *rootCategories; // Needs to be initialised by subclasses!
|
||||
|
@ -181,6 +181,7 @@ static NSString * const PCBuildTool = @"BUILDTOOL";
|
|||
- (NSString *)selectedRootCategory;
|
||||
|
||||
- (NSArray *)fileExtensionsForCategory:(NSString *)key;
|
||||
- (NSString *)categoryForFile:(NSString *)file;
|
||||
|
||||
- (void)setProjectName:(NSString *)aName;
|
||||
- (NSString *)projectName;
|
||||
|
@ -188,7 +189,8 @@ static NSString * const PCBuildTool = @"BUILDTOOL";
|
|||
|
||||
- (Class)principalClass;
|
||||
|
||||
- (PCEditorController*)editorController;
|
||||
- (PCProjectEditor *)projectEditor;
|
||||
- (PCEditorController *)editorController;
|
||||
|
||||
//=============================================================================
|
||||
// ==== Delegate and manager
|
||||
|
@ -248,13 +250,6 @@ static NSString * const PCBuildTool = @"BUILDTOOL";
|
|||
- (BOOL)save;
|
||||
- (BOOL)saveAt:(NSString *)projPath;
|
||||
|
||||
- (BOOL)saveFile;
|
||||
- (BOOL)saveAllFiles;
|
||||
- (BOOL)saveAllFilesIfNeeded;
|
||||
// Saves all the files that need to be saved.
|
||||
|
||||
- (BOOL)revertFile;
|
||||
|
||||
- (BOOL)writeSpecFile;
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -163,6 +163,55 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)categoryForFile:(NSString *)file
|
||||
{
|
||||
NSString *fileExt = [[file componentsSeparatedByString: @"."] lastObject];
|
||||
|
||||
if ([fileExt isEqualToString:@"gmodel"] || [fileExt isEqualToString:@"gorm"])
|
||||
{
|
||||
return PCGModels;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"gsmarkup"])
|
||||
{
|
||||
return PCGSMarkupFiles;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"h"] || [fileExt isEqualToString:@"H"])
|
||||
{
|
||||
return PCHeaders;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"m"] || [fileExt isEqualToString:@"M"])
|
||||
{
|
||||
return PCClasses;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"c"] || [fileExt isEqualToString:@"C"])
|
||||
{
|
||||
return PCOtherSources;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"so"] || [fileExt isEqualToString:@"lib"]
|
||||
|| [fileExt isEqualToString:@"a"])
|
||||
{
|
||||
return PCLibraries;
|
||||
}
|
||||
else if ([fileExt isEqualToString:@"subproj"])
|
||||
{
|
||||
return PCSubprojects;
|
||||
}
|
||||
else if ([[NSImage imageFileTypes] containsObject: fileExt])
|
||||
{
|
||||
return PCImages;
|
||||
}
|
||||
else if ([file hasPrefix: @"GNUmakefile"])
|
||||
{
|
||||
return PCSupportingFiles;
|
||||
}
|
||||
else if (file != nil)
|
||||
{
|
||||
return PCOtherResources;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setProjectName:(NSString *)aName
|
||||
{
|
||||
AUTORELEASE(projectName);
|
||||
|
@ -184,6 +233,11 @@
|
|||
return [self class];
|
||||
}
|
||||
|
||||
- (PCProjectEditor *)projectEditor
|
||||
{
|
||||
return projectEditor;
|
||||
}
|
||||
|
||||
- (PCEditorController*)editorController
|
||||
{
|
||||
return editorController;
|
||||
|
@ -281,25 +335,25 @@
|
|||
|
||||
- (void)browserDidClickFile:(NSString *)fileName category:(NSString*)c
|
||||
{
|
||||
NSString *p = [[self projectPath] stringByAppendingPathComponent:fileName];
|
||||
PCEditor *e;
|
||||
NSString *p = [[self projectPath] stringByAppendingPathComponent:fileName];
|
||||
PCEditor *e;
|
||||
|
||||
// Set the name in the inspector
|
||||
[fileNameField setStringValue:fileName];
|
||||
// Set the name in the inspector
|
||||
[fileNameField setStringValue:fileName];
|
||||
|
||||
// Show the file in the internal editor!
|
||||
e = [editorController internalEditorForFile:p];
|
||||
// Show the file in the internal editor!
|
||||
e = [editorController internalEditorForFile:p];
|
||||
|
||||
if( e == nil )
|
||||
if( e == nil )
|
||||
{
|
||||
NSLog(@"No editor for file '%@'...",p);
|
||||
return;
|
||||
NSLog(@"No editor for file '%@'...",p);
|
||||
return;
|
||||
}
|
||||
|
||||
[self showEditorView:self];
|
||||
[e showInProjectEditor:projectEditor];
|
||||
[self showEditorView:self];
|
||||
[e showInProjectEditor:projectEditor];
|
||||
|
||||
[projectWindow makeFirstResponder:(NSResponder*)[projectEditor editorView]];
|
||||
[projectWindow makeFirstResponder:(NSResponder*)[projectEditor editorView]];
|
||||
}
|
||||
|
||||
- (void)browserDidDblClickFile:(NSString *)fileName category:(NSString*)c
|
||||
|
@ -563,28 +617,6 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)saveFile
|
||||
{
|
||||
return [editorController saveFile];
|
||||
}
|
||||
|
||||
- (BOOL)saveAllFiles
|
||||
{
|
||||
return [editorController saveAllFiles];
|
||||
}
|
||||
|
||||
- (BOOL)saveAllFilesIfNeeded
|
||||
{
|
||||
BOOL ret = YES;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL)revertFile
|
||||
{
|
||||
return [editorController revertFile];
|
||||
}
|
||||
|
||||
- (BOOL)writeSpecFile
|
||||
{
|
||||
NSString *name = [projectDict objectForKey:PCProjectName];
|
||||
|
@ -830,25 +862,16 @@
|
|||
|
||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||
{
|
||||
if( editorIsActive )
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PCEditorDidResignKeyNotification object:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
if( editorIsActive )
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PCEditorDidBecomeKeyNotification object:self];
|
||||
}
|
||||
|
||||
[projectManager setActiveProject:self];
|
||||
[projectManager setActiveProject:self];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)aNotification
|
||||
{
|
||||
[projectManager setActiveProject:self];
|
||||
[projectManager setActiveProject:self];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)aNotification
|
||||
|
@ -859,8 +882,8 @@
|
|||
{
|
||||
if ([[self projectWindow] isDocumentEdited])
|
||||
{
|
||||
if (NSRunAlertPanel(@"Project changed!",
|
||||
@"The project %@ has been edited! Should it be saved before closing?",
|
||||
if (NSRunAlertPanel(@"Close Project",
|
||||
@"The project %@ has been edited!\nShould it be saved before closing?",
|
||||
@"Yes", @"No", nil,[self projectName]))
|
||||
{
|
||||
[self save];
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
NSDictionary *currentOptions; // Not retained!
|
||||
|
||||
NSTextView *stdOut;
|
||||
NSTextView *stdError;
|
||||
NSDictionary *textAttributes;
|
||||
|
||||
NSFileHandle *readHandle;
|
||||
NSFileHandle *errorReadHandle;
|
||||
|
@ -76,8 +76,7 @@
|
|||
|
||||
@interface PCProjectDebugger (BuildLogging)
|
||||
|
||||
- (void)logString:(NSString *)string error:(BOOL)yn;
|
||||
- (void)logString:(NSString *)string error:(BOOL)yn newLine:(BOOL)newLine;
|
||||
- (void)logString:(NSString *)string newLine:(BOOL)newLine;
|
||||
- (void)logData:(NSData *)data error:(BOOL)yn;
|
||||
|
||||
@end
|
||||
|
|
|
@ -77,14 +77,15 @@ enum {
|
|||
|
||||
- (void)_createComponentView
|
||||
{
|
||||
// NSSplitView *split;
|
||||
// NSScrollView *scrollView1;
|
||||
NSScrollView *scrollView2;
|
||||
NSScrollView *scrollView;
|
||||
NSMatrix *matrix;
|
||||
NSRect _w_frame;
|
||||
NSButtonCell *buttonCell = [[[NSButtonCell alloc] init] autorelease];
|
||||
id button;
|
||||
|
||||
NSString *string;
|
||||
NSAttributedString *attributedString;
|
||||
|
||||
componentView = [[NSBox alloc] initWithFrame:NSMakeRect(8,-1,464,322)];
|
||||
[componentView setTitlePosition:NSNoTitle];
|
||||
[componentView setBorderType:NSNoBorder];
|
||||
|
@ -129,64 +130,39 @@ enum {
|
|||
/*
|
||||
*
|
||||
*/
|
||||
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,-1,464,253)];
|
||||
|
||||
/* scrollView1 = [[NSScrollView alloc] initWithFrame:NSMakeRect (-1,0,562,46)];
|
||||
[scrollView setHasHorizontalScroller:NO];
|
||||
[scrollView setHasVerticalScroller:YES];
|
||||
[scrollView setBorderType: NSBezelBorder];
|
||||
[scrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
[scrollView1 setHasHorizontalScroller: NO];
|
||||
[scrollView1 setHasVerticalScroller: YES];
|
||||
[scrollView1 setBorderType: NSBezelBorder];
|
||||
[scrollView1 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
stdOut=[[NSTextView alloc] initWithFrame:[[scrollView contentView] frame]];
|
||||
|
||||
stdOut = [[NSTextView alloc] initWithFrame:[[scrollView1 contentView]frame]];
|
||||
|
||||
[stdOut setRichText:NO];
|
||||
[stdOut setMinSize: NSMakeSize(0, 0)];
|
||||
[stdOut setMaxSize: NSMakeSize(1e7, 1e7)];
|
||||
[stdOut setRichText:YES];
|
||||
[stdOut setEditable:NO];
|
||||
[stdOut setSelectable:YES];
|
||||
[stdOut setVerticallyResizable: YES];
|
||||
[stdOut setHorizontallyResizable: NO];
|
||||
[stdOut setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
[stdOut setBackgroundColor:[NSColor colorWithDeviceRed:0.95
|
||||
green:0.75
|
||||
blue:0.85
|
||||
alpha:1.0]];
|
||||
[[stdOut textContainer] setWidthTracksTextView:YES];
|
||||
[[stdOut textContainer] setContainerSize:
|
||||
NSMakeSize([stdOut frame].size.width, 1e7)];
|
||||
|
||||
[scrollView1 setDocumentView:stdOut];*/
|
||||
// Font
|
||||
string = [NSString stringWithString:@"=== Launcher ready ==="];
|
||||
attributedString =
|
||||
[[NSAttributedString alloc] initWithString:string
|
||||
attributes:textAttributes];
|
||||
[[stdOut textStorage] setAttributedString:attributedString];
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
[scrollView setDocumentView:stdOut];
|
||||
RELEASE (stdOut);
|
||||
|
||||
scrollView2 = [[NSScrollView alloc] initWithFrame:NSMakeRect (0,-1,464,253)];
|
||||
|
||||
[scrollView2 setHasHorizontalScroller:NO];
|
||||
[scrollView2 setHasVerticalScroller:YES];
|
||||
[scrollView2 setBorderType: NSBezelBorder];
|
||||
[scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
stdError=[[NSTextView alloc] initWithFrame:[[scrollView2 contentView]frame]];
|
||||
|
||||
[stdError setRichText:NO];
|
||||
[stdError setEditable:NO];
|
||||
[stdError setSelectable:YES];
|
||||
[stdError setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
[stdError setBackgroundColor:[NSColor whiteColor]];
|
||||
[[stdError textContainer] setWidthTracksTextView:YES];
|
||||
|
||||
[scrollView2 setDocumentView:stdError];
|
||||
|
||||
/* split = [[NSSplitView alloc] initWithFrame:NSMakeRect(-1,-1,562,152)];
|
||||
[split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||
[split addSubview: scrollView1];
|
||||
[split addSubview: scrollView2];
|
||||
|
||||
[componentView addSubview:split];*/
|
||||
[componentView addSubview: scrollView2];
|
||||
|
||||
// RELEASE(scrollView1);
|
||||
RELEASE(scrollView2);
|
||||
// RELEASE(split);
|
||||
|
||||
// [componentView sizeToFit];
|
||||
// [split adjustSubviews];
|
||||
[componentView addSubview: scrollView];
|
||||
RELEASE(scrollView);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -195,26 +171,37 @@ enum {
|
|||
|
||||
- (id)initWithProject:(PCProject *)aProject
|
||||
{
|
||||
NSAssert(aProject,@"No project specified!");
|
||||
NSAssert (aProject, @"No project specified!");
|
||||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
currentProject = aProject;
|
||||
debugTarget = DEBUG_DEFAULT_TARGET;
|
||||
if ((self = [super init]))
|
||||
{
|
||||
NSFont *font = [NSFont userFixedPitchFontOfSize: 10.0];
|
||||
|
||||
currentProject = aProject;
|
||||
debugTarget = DEBUG_DEFAULT_TARGET;
|
||||
|
||||
textAttributes =
|
||||
[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
|
||||
[textAttributes retain];
|
||||
}
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(componentView);
|
||||
RELEASE (componentView);
|
||||
RELEASE (textAttributes);
|
||||
|
||||
RELEASE(stdOut);
|
||||
RELEASE(stdError);
|
||||
|
||||
if (readHandle) RELEASE(readHandle);
|
||||
if (errorReadHandle) RELEASE(errorReadHandle);
|
||||
if (readHandle)
|
||||
{
|
||||
RELEASE (readHandle);
|
||||
}
|
||||
|
||||
if (errorReadHandle)
|
||||
{
|
||||
RELEASE (errorReadHandle);
|
||||
}
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -236,9 +223,10 @@ enum {
|
|||
|
||||
- (NSView *)componentView;
|
||||
{
|
||||
if (!componentView) {
|
||||
[self _createComponentView];
|
||||
}
|
||||
if (!componentView)
|
||||
{
|
||||
[self _createComponentView];
|
||||
}
|
||||
|
||||
return componentView;
|
||||
}
|
||||
|
@ -355,7 +343,7 @@ enum {
|
|||
[stdOut setString:@""];
|
||||
[readHandle waitForDataInBackgroundAndNotify];
|
||||
|
||||
[stdError setString:@""];
|
||||
[stdOut setString:@""];
|
||||
[errorReadHandle waitForDataInBackgroundAndNotify];
|
||||
|
||||
/*
|
||||
|
@ -399,9 +387,10 @@ enum {
|
|||
{
|
||||
NSData *data;
|
||||
|
||||
if ((data = [readHandle availableData])) {
|
||||
[self logData:data error:NO];
|
||||
}
|
||||
if ((data = [readHandle availableData]))
|
||||
{
|
||||
[self logData:data error:NO];
|
||||
}
|
||||
|
||||
[readHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
}
|
||||
|
@ -409,11 +398,12 @@ enum {
|
|||
- (void)logErrOut:(NSNotification *)aNotif
|
||||
{
|
||||
NSData *data;
|
||||
|
||||
if ((data = [errorReadHandle availableData])) {
|
||||
[self logData:data error:YES];
|
||||
}
|
||||
|
||||
|
||||
if ((data = [errorReadHandle availableData]))
|
||||
{
|
||||
[self logData:data error:YES];
|
||||
}
|
||||
|
||||
[errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
}
|
||||
|
||||
|
@ -421,37 +411,38 @@ enum {
|
|||
|
||||
@implementation PCProjectDebugger (BuildLogging)
|
||||
|
||||
- (void)logString:(NSString *)string error:(BOOL)yn
|
||||
- (void)logString:(NSString *)str newLine:(BOOL)newLine
|
||||
{
|
||||
[self logString:string error:yn newLine:YES];
|
||||
}
|
||||
|
||||
- (void)logString:(NSString *)str error:(BOOL)yn newLine:(BOOL)newLine
|
||||
{
|
||||
NSTextView *out = (yn)?stdError:stdOut;
|
||||
|
||||
[out replaceCharactersInRange:NSMakeRange([[out string] length],0)
|
||||
[stdOut replaceCharactersInRange:NSMakeRange([[stdOut string] length],0)
|
||||
withString:str];
|
||||
|
||||
if (newLine) {
|
||||
[out replaceCharactersInRange:NSMakeRange([[out string] length], 0)
|
||||
[stdOut replaceCharactersInRange:NSMakeRange([[stdOut string] length], 0)
|
||||
withString:@"\n"];
|
||||
}
|
||||
else {
|
||||
[out replaceCharactersInRange:NSMakeRange([[out string] length], 0)
|
||||
[stdOut replaceCharactersInRange:NSMakeRange([[stdOut string] length], 0)
|
||||
withString:@" "];
|
||||
}
|
||||
|
||||
[out scrollRangeToVisible:NSMakeRange([[out string] length], 0)];
|
||||
[stdOut scrollRangeToVisible:NSMakeRange([[stdOut string] length], 0)];
|
||||
}
|
||||
|
||||
- (void)logData:(NSData *)data error:(BOOL)yn
|
||||
{
|
||||
NSString *s = [[NSString alloc] initWithData:data
|
||||
encoding:[NSString defaultCStringEncoding]];
|
||||
NSString *s = nil;
|
||||
NSAttributedString *as = nil;
|
||||
|
||||
[self logString:s error:yn newLine:YES];
|
||||
[s autorelease];
|
||||
// [self logString:s newLine:NO];
|
||||
s = [[NSString alloc] initWithData:data
|
||||
encoding:[NSString defaultCStringEncoding]];
|
||||
as = [[NSAttributedString alloc] initWithString:s
|
||||
attributes:textAttributes];
|
||||
[[stdOut textStorage] appendAttributedString: as];
|
||||
[stdOut scrollRangeToVisible:NSMakeRange([[stdOut string] length], 0)];
|
||||
|
||||
[s release];
|
||||
[as release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
frame = NSMakeRect (0, 0, 562, 40);
|
||||
_scrollView = [[NSScrollView alloc] initWithFrame:frame];
|
||||
[_scrollView setHasHorizontalScroller: YES];
|
||||
[_scrollView setHasHorizontalScroller: NO];
|
||||
[_scrollView setHasVerticalScroller: YES];
|
||||
[_scrollView setBorderType: NSBezelBorder];
|
||||
[_scrollView setAutoresizingMask:(NSViewWidthSizable|NSViewHeightSizable)];
|
||||
|
|
|
@ -41,19 +41,19 @@
|
|||
|
||||
@interface PCProjectManager : NSObject <ProjectBuilder>
|
||||
{
|
||||
id<ProjectDelegate> delegate; // The PCAppController
|
||||
id fileManager;
|
||||
id<ProjectDelegate> delegate; // The PCAppController
|
||||
id fileManager;
|
||||
|
||||
id inspector;
|
||||
id inspectorView;
|
||||
id inspectorPopup;
|
||||
id inspector;
|
||||
id inspectorView;
|
||||
id inspectorPopup;
|
||||
|
||||
NSMutableDictionary *loadedProjects;
|
||||
PCProject *activeProject;
|
||||
NSMutableDictionary *loadedProjects;
|
||||
PCProject *activeProject;
|
||||
|
||||
NSString *rootBuildPath;
|
||||
NSString *rootBuildPath;
|
||||
|
||||
NSTimer *saveTimer;
|
||||
NSTimer *saveTimer;
|
||||
|
||||
@private
|
||||
BOOL _needsReleasing;
|
||||
|
@ -83,39 +83,48 @@
|
|||
// ==== Project management
|
||||
// ===========================================================================
|
||||
|
||||
// Returns all currently loaded projects. They are stored with their absolut
|
||||
// paths as the keys.
|
||||
- (NSMutableDictionary *)loadedProjects;
|
||||
// Returns all currently loaded projects. They are stored with their absolut paths as the keys.
|
||||
|
||||
// Returns the currently active project
|
||||
- (PCProject *)activeProject;
|
||||
// Returns the currently active project
|
||||
|
||||
// Sets the new currently active project
|
||||
- (void)setActiveProject:(PCProject *)aProject;
|
||||
// Sets the new currently active project
|
||||
|
||||
- (void)saveAllProjectsIfNeeded;
|
||||
// Calls saveAllProjects if the preferences are setup accordingly.
|
||||
|
||||
- (void)saveAllProjects;
|
||||
// Saves all projects if needed.
|
||||
|
||||
// Gets set while initialising!
|
||||
- (NSString *)rootBuildPath;
|
||||
// Gets set while initialising!
|
||||
|
||||
// Returns active project's path
|
||||
- (NSString *)projectPath;
|
||||
|
||||
// Returns name of file selected in browser(and visible in internal editor)
|
||||
- (NSString *)selectedFileName;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Project actions
|
||||
// ===========================================================================
|
||||
|
||||
// Returns the loaded project if the builder class is known, nil else.
|
||||
- (PCProject *)loadProjectAt:(NSString *)aPath;
|
||||
// Returns the loaded project if the builder class is known, nil else.
|
||||
|
||||
// Invokes loadProjectAt to load the project properly.
|
||||
- (BOOL)openProjectAt:(NSString *)aPath;
|
||||
// Invokes loadProjectAt to load the project properly.
|
||||
|
||||
// projectType is exactly the name of the class to be invoked to create the
|
||||
// project!
|
||||
- (BOOL)createProjectOfType:(NSString *)projectType path:(NSString *)aPath;
|
||||
// projectType is exactly the name of the class to be invoked to create the project!
|
||||
|
||||
// Saves the current project
|
||||
- (BOOL)saveProject;
|
||||
// Saves the current project
|
||||
|
||||
// Calls saveAllProjects if the preferences are setup accordingly.
|
||||
- (void)saveAllProjectsIfNeeded;
|
||||
|
||||
// Saves all projects if needed.
|
||||
- (void)saveAllProjects;
|
||||
|
||||
|
||||
- (BOOL)saveProjectAs:(NSString *)projName;
|
||||
|
||||
|
@ -124,9 +133,6 @@
|
|||
- (void)showInspectorForProject:(PCProject *)aProject;
|
||||
// Opens the inspector for aProject
|
||||
|
||||
- (void)saveFiles;
|
||||
// Saves all the edited files from the currently active project
|
||||
|
||||
- (void)revertToSaved;
|
||||
// Reverts the currently active project
|
||||
|
||||
|
@ -142,10 +148,13 @@
|
|||
// ==== File actions
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)openFile:(NSString *)path;
|
||||
|
||||
- (BOOL)saveAllFiles;
|
||||
- (BOOL)saveFile;
|
||||
- (BOOL)revertFile;
|
||||
- (BOOL)saveFileAs:(NSString *)path;
|
||||
- (BOOL)saveFileTo:(NSString *)path;
|
||||
- (BOOL)revertFileToSaved;
|
||||
- (void)closeFile;
|
||||
|
||||
- (BOOL)renameFileTo:(NSString *)path;
|
||||
- (BOOL)removeFilePermanently:(BOOL)yn;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "PCDefines.h"
|
||||
#include "PCProject.h"
|
||||
#include "PCServer.h"
|
||||
#include "PCBrowserController.h"
|
||||
#include "PCEditorController.h"
|
||||
#include "ProjectComponent.h"
|
||||
#include "ProjectType.h"
|
||||
|
@ -151,7 +152,7 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
|
||||
- (PCProject *)activeProject
|
||||
{
|
||||
return activeProject;
|
||||
return activeProject;
|
||||
}
|
||||
|
||||
- (void)setActiveProject:(PCProject *)aProject
|
||||
|
@ -215,6 +216,16 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
return rootBuildPath;
|
||||
}
|
||||
|
||||
- (NSString *)projectPath
|
||||
{
|
||||
return [activeProject projectPath];
|
||||
}
|
||||
|
||||
- (NSString *)selectedFileName
|
||||
{
|
||||
return [[activeProject browserController] nameOfSelectedFile];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Project actions
|
||||
// ===========================================================================
|
||||
|
@ -387,11 +398,6 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
[inspector makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (void)saveFiles
|
||||
{
|
||||
[activeProject saveAllFiles];
|
||||
}
|
||||
|
||||
- (void)revertToSaved
|
||||
{
|
||||
}
|
||||
|
@ -450,39 +456,34 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
// ==== File actions
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)openFile:(NSString *)path
|
||||
- (BOOL)saveAllFiles
|
||||
{
|
||||
BOOL isDir;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
if ([fm fileExistsAtPath:path isDirectory:&isDir] && !isDir)
|
||||
{
|
||||
[PCEditorController openFileInEditor:path];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
return [[activeProject editorController] saveAllFiles];
|
||||
}
|
||||
|
||||
- (BOOL)saveFile
|
||||
{
|
||||
if (!activeProject)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [activeProject saveFile];
|
||||
return [[activeProject editorController] saveFile];
|
||||
}
|
||||
|
||||
- (BOOL)revertFile
|
||||
- (BOOL)saveFileAs:(NSString *)path
|
||||
{
|
||||
if (!activeProject)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return [[activeProject editorController] saveFileAs:path];
|
||||
}
|
||||
|
||||
return [activeProject revertFile];
|
||||
- (BOOL)saveFileTo:(NSString *)path
|
||||
{
|
||||
return [[activeProject editorController] saveFileTo:path];
|
||||
}
|
||||
|
||||
- (BOOL)revertFileToSaved
|
||||
{
|
||||
return [[activeProject editorController] revertFileToSaved];
|
||||
}
|
||||
|
||||
- (void)closeFile
|
||||
{
|
||||
return [[activeProject editorController] closeFile:self];
|
||||
}
|
||||
|
||||
- (BOOL)renameFileTo:(NSString *)path
|
||||
|
@ -492,11 +493,12 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
|
||||
- (BOOL)removeFilePermanently:(BOOL)yn
|
||||
{
|
||||
if (!activeProject) {
|
||||
return NO;
|
||||
if (!activeProject)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [activeProject removeSelectedFilePermanently:yn];
|
||||
return [activeProject removeSelectedFilePermanently:yn];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -566,7 +568,6 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
[activeProject addFile:file forKey:key];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -89,8 +89,10 @@
|
|||
- (void)fileSaveAs:(id)sender;
|
||||
- (void)fileSaveTo:(id)sender;
|
||||
- (void)fileRevertToSaved:(id)sender;
|
||||
- (void)fileRename:(id)sender;
|
||||
- (void)fileClose:(id)sender;
|
||||
- (void)fileOpenQuickly:(id)sender;
|
||||
- (void)fileRename:(id)sender;
|
||||
- (void)fileNewUntitled:(id)sender;
|
||||
|
||||
// Edit
|
||||
- (void)findShowPanel:(id)sender;
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
|
||||
- (void)projectSaveFiles:(id)sender
|
||||
{
|
||||
[projectManager saveFiles];
|
||||
[projectManager saveAllFiles];
|
||||
}
|
||||
|
||||
- (void)projectRemoveFiles:(id)sender
|
||||
|
@ -291,7 +291,6 @@
|
|||
}
|
||||
|
||||
// File
|
||||
|
||||
- (void)fileOpen:(id)sender
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
@ -304,29 +303,31 @@
|
|||
[openPanel setCanChooseDirectories:NO];
|
||||
[openPanel setCanChooseFiles:YES];
|
||||
|
||||
retval = [openPanel runModalForDirectory:[ud objectForKey:@"LastOpenDirectory"]
|
||||
file:nil
|
||||
types:nil];
|
||||
retval = [openPanel
|
||||
runModalForDirectory:[ud objectForKey:@"LastOpenDirectory"]
|
||||
file:nil
|
||||
types:nil];
|
||||
|
||||
if (retval == NSOKButton)
|
||||
{
|
||||
BOOL isDir;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
[ud setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
|
||||
|
||||
filePath = [[openPanel filenames] objectAtIndex:0];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath
|
||||
isDirectory:&isDir] && !isDir)
|
||||
if (![fm fileExistsAtPath:filePath isDirectory:&isDir] && !isDir)
|
||||
{
|
||||
if (![projectManager openFile:filePath])
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't open %@!",
|
||||
@"OK",nil,nil,filePath);
|
||||
}
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't open %@!",
|
||||
@"OK",nil,nil,filePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[PCEditorController openFileInEditor:filePath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)fileNew:(id)sender
|
||||
|
@ -339,43 +340,102 @@
|
|||
[projectManager saveFile];
|
||||
}
|
||||
|
||||
// Not finished
|
||||
- (void)fileSaveAs:(id)sender
|
||||
{
|
||||
// [projectManager saveFileAs];
|
||||
/* NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSSavePanel *savePanel = [NSSavePanel savePanel];;
|
||||
NSString *oldFilePath;
|
||||
NSString *newFilePath;
|
||||
int retval;
|
||||
|
||||
oldFilePath =
|
||||
[[[[projectManager activeProject] editorController] activeEditor] path];
|
||||
|
||||
[savePanel setTitle: @"Save As..."];
|
||||
retval = [savePanel runModalForDirectory:[projectManager projectPath]
|
||||
file:[projectManager selectedFileName]];
|
||||
|
||||
if (retval == NSOKButton)
|
||||
{
|
||||
[ud setObject:[savePanel directory] forKey:@"LastOpenDirectory"];
|
||||
|
||||
newFilePath = [savePanel filename];
|
||||
|
||||
if (![projectManager saveFileAs:newFilePath])
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save file as\n%@!",
|
||||
@"OK",nil,nil,newFilePath);
|
||||
}
|
||||
}*/
|
||||
NSRunAlertPanel(@"PCMenuController: Sorry!",
|
||||
@"This feature is not yet implemented!",
|
||||
@"OK",nil,nil);
|
||||
@"This feature not finished yet",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
|
||||
- (void)fileSaveTo:(id)sender
|
||||
{
|
||||
// [projectManager saveFileTo];
|
||||
NSRunAlertPanel(@"PCMenuController: Sorry!",
|
||||
@"This feature is not yet implemented!",
|
||||
@"OK",nil,nil);
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *filePath = [projectManager selectedFileName];
|
||||
NSSavePanel *savePanel = [NSSavePanel savePanel];;
|
||||
int retval;
|
||||
|
||||
[savePanel setTitle: @"Save To..."];
|
||||
retval = [savePanel runModalForDirectory:[projectManager projectPath]
|
||||
file:filePath];
|
||||
|
||||
if (retval == NSOKButton)
|
||||
{
|
||||
[ud setObject:[savePanel directory] forKey:@"LastOpenDirectory"];
|
||||
|
||||
filePath = [savePanel filename];
|
||||
|
||||
if (![projectManager saveFileTo:filePath])
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save file to\n%@!",
|
||||
@"OK",nil,nil,filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)fileRevertToSaved:(id)sender
|
||||
{
|
||||
[projectManager revertFile];
|
||||
[projectManager revertFileToSaved];
|
||||
}
|
||||
|
||||
- (void)fileClose:(id)sender
|
||||
{
|
||||
[projectManager closeFile];
|
||||
}
|
||||
|
||||
- (void)fileOpenQuickly:(id)sender
|
||||
{
|
||||
NSRunAlertPanel(@"PCMenuController: Sorry!",
|
||||
@"This feature is not yet implemented!",
|
||||
@"OK",nil,nil);
|
||||
@"This feature not finished yet",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
|
||||
- (void)fileRename:(id)sender
|
||||
{
|
||||
NSString *proj = nil;
|
||||
/* NSString *proj = nil;
|
||||
|
||||
// Show open panel
|
||||
// Show Inspector panel with "File Attributes" section
|
||||
|
||||
[projectManager renameFileTo:proj];
|
||||
[projectManager renameFileTo:proj];*/
|
||||
|
||||
NSRunAlertPanel(@"PCMenuController: Sorry!",
|
||||
@"This feature not finished yet",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
|
||||
- (void)fileNewUntitled:(id)sender
|
||||
{
|
||||
NSRunAlertPanel(@"PCMenuController: Sorry!",
|
||||
@"This feature not finished yet",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
|
||||
// Edit
|
||||
- (void)findShowPanel:(id)sender
|
||||
|
@ -420,9 +480,9 @@
|
|||
|
||||
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
|
||||
{
|
||||
NSString *menuTitle = [[menuItem menu] title];
|
||||
PCProject *aProject = [projectManager activeProject];
|
||||
NSResponder *firstResponder = [[aProject projectWindow] firstResponder];
|
||||
NSString *menuTitle = [[menuItem menu] title];
|
||||
PCProject *aProject = [projectManager activeProject];
|
||||
NSResponder *firstResponder = [[NSApp keyWindow] firstResponder];
|
||||
|
||||
if ([[projectManager loadedProjects] count] == 0)
|
||||
{
|
||||
|
@ -510,8 +570,7 @@
|
|||
// File related menu items
|
||||
if (([menuTitle isEqualToString: @"File"]))
|
||||
{
|
||||
if (![[firstResponder className] isEqualToString: @"PCEditorView"]
|
||||
|| ![[aProject projectWindow] isKeyWindow])
|
||||
if (![[firstResponder className] isEqualToString: @"PCEditorView"])
|
||||
{
|
||||
if ([[menuItem title] isEqualToString:@"Save"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Save As..."]) return NO;
|
||||
|
|
|
@ -186,7 +186,7 @@ createMenu()
|
|||
action:@selector(fileSaveTo:)
|
||||
keyEquivalent:@""];
|
||||
[file addItemWithTitle:@"Revert to Saved"
|
||||
action:@selector(fileRevert:)
|
||||
action:@selector(fileRevertToSaved:)
|
||||
keyEquivalent:@"u"];
|
||||
[file addItemWithTitle:@"Close"
|
||||
action:@selector(fileClose:)
|
||||
|
@ -195,13 +195,13 @@ createMenu()
|
|||
action:action
|
||||
keyEquivalent:@""];
|
||||
[file addItemWithTitle:@"Open Quickly..."
|
||||
action:action
|
||||
action:@selector(fileOpenQuickly:)
|
||||
keyEquivalent:@"D"];
|
||||
[file addItemWithTitle:@"Rename"
|
||||
action:@selector(fileRename:)
|
||||
keyEquivalent:@""];
|
||||
[file addItemWithTitle:@"New Untitled"
|
||||
action:action
|
||||
action:@selector(fileNewUntitled:)
|
||||
keyEquivalent:@""];
|
||||
|
||||
file_view = [[[NSMenu alloc] init] autorelease];
|
||||
|
|
Loading…
Reference in a new issue