mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
Synchronize local repository with SVN after long delay
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_5@23393 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ac1131830a
commit
0360e20f00
50 changed files with 1488 additions and 900 deletions
|
@ -1,7 +1,8 @@
|
|||
|
||||
ANNOUNCE
|
||||
************
|
||||
|
||||
This is version 0.4.1 of ProjectCenter. This is a bugfix version.
|
||||
This is version 0.5.0 of ProjectCenter.
|
||||
|
||||
What is ProjectCenter?
|
||||
======================
|
||||
|
@ -15,7 +16,7 @@ What is ProjectCenter?
|
|||
distribution fees, for others to use the program. You should read the
|
||||
Documentation/COPYING file for more information.
|
||||
|
||||
Noteworthy changes in version `0.4.1'.
|
||||
Noteworthy changes in version `0.5.0'.
|
||||
======================================
|
||||
|
||||
*
|
||||
|
|
|
@ -29,15 +29,16 @@ ProjectCenter 0.5
|
|||
- Finish save/restore size of split views in Project Window [done!]
|
||||
- Save last used path separately for different file panels stoyan
|
||||
--- Project Editor:
|
||||
- Implement on demand loading (editor for file type) stoyan
|
||||
- Open some files read only (Supporting Files) stoyan
|
||||
- Implement code parser (get it from CodeEditor?) stoyan
|
||||
- Project Browser should show file structure. stoyan
|
||||
- Click on Browser item should move cursor to line in file stoyan
|
||||
- Implement on demand loading (editor for file type) [done!]
|
||||
- Open some files read only (Supporting Files) [done!]
|
||||
- Implement code parser (get it from CodeEditor?) [done!]
|
||||
- Project Browser should show file structure. [done!]
|
||||
- Click on Browser item should move cursor to line in file [done!]
|
||||
- Implement Editor indentation stoyan
|
||||
--- Project Builder:
|
||||
- Implement root build directory handling stoyan
|
||||
- Parse gcc output
|
||||
- Finish options handling stoyan
|
||||
- Parse gcc output stoyan
|
||||
- Display warnings,errors,options etc. as clickable list stoyan
|
||||
- Imlement pending adding/removal of files (history?) stoyan
|
||||
- Finish FileNameIcon (draggable, files can be dragged to it) stoyan
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
|
||||
#GNUSTEP_BUILD_DIR = $(HOME)/Projects/GNUstep/==BUILD==/ProjectCenter
|
||||
|
||||
#
|
||||
# Main application
|
||||
|
@ -27,12 +28,6 @@ ProjectCenter_RESOURCE_FILES = \
|
|||
Resources/ProjectCenter.gorm \
|
||||
Resources/Info-gnustep.plist \
|
||||
Images/ProjectCenter.tiff \
|
||||
Images/FileC.tiff \
|
||||
Images/FileCH.tiff \
|
||||
Images/FileH.tiff \
|
||||
Images/FileHH.tiff \
|
||||
Images/FileM.tiff \
|
||||
Images/FileMH.tiff \
|
||||
Images/FileRTF.tiff \
|
||||
Images/FileProject.tiff \
|
||||
Images/Build.tiff \
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
@class NSTextField;
|
||||
|
||||
extern NSString *PCFileNameFieldNoFiles;
|
||||
|
||||
@interface PCFileNameField : NSTextField
|
||||
{
|
||||
}
|
||||
|
|
|
@ -32,11 +32,22 @@
|
|||
NSString *filePath;
|
||||
NSTextField *fileNameField;
|
||||
NSString *msfText;
|
||||
|
||||
id delegate;
|
||||
}
|
||||
|
||||
- (void)setFileNameField:(NSTextField *)field;
|
||||
- (void)setMultipleFilesSelectionText:(NSString *)text;
|
||||
- (void)setFileIcon:(NSNotification *)notification;
|
||||
|
||||
- (void)setDelegate:(id)object;
|
||||
|
||||
- (void)updateIcon;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCFileNameIcon (FileNameIconDelegate)
|
||||
|
||||
- (NSImage *)fileNameIconImage;
|
||||
- (NSString *)fileNameIconTitle;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -53,12 +53,12 @@ extern NSString *PCBrowserDidSetPathNotification;
|
|||
// Returns nil if multiple files selected
|
||||
- (NSString *)nameOfSelectedFile;
|
||||
- (NSString *)pathToSelectedFile;
|
||||
|
||||
// Returns nil if multiple categories selected
|
||||
- (NSString *)nameOfSelectedCategory;
|
||||
// Returns nil of multiple categories selected
|
||||
- (NSString *)pathToSelectedCategory;
|
||||
// Returns nil of multiple categories selected
|
||||
- (NSString *)pathFromSelectedCategory;
|
||||
|
||||
- (NSString *)nameOfSelectedRootCategory;
|
||||
|
||||
// Returns nil if multiple category selected
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <Protocols/CodeEditor.h>
|
||||
#include <Protocols/ProjectEditor.h>
|
||||
|
||||
#include "PCProject.h"
|
||||
#include <Protocols/CodeParser.h>
|
||||
|
||||
@class PCProject;
|
||||
@class PCEditor;
|
||||
|
@ -41,9 +39,7 @@
|
|||
@class NSView;
|
||||
@class NSScrollView;
|
||||
|
||||
@protocol CodeParser;
|
||||
|
||||
@interface PCProjectEditor : NSObject <ProjectEditor>
|
||||
@interface PCProjectEditor : NSObject
|
||||
{
|
||||
PCProject *project;
|
||||
NSBox *componentView;
|
||||
|
@ -79,17 +75,16 @@
|
|||
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
||||
|
||||
- (id<CodeEditor>)editorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
// Returns nil if editor is not opened
|
||||
- (id<CodeEditor>)editorForFile:(NSString *)fileName key:(NSString *)key;
|
||||
|
||||
/*- (id<CodeEditor>)editorForFile:(NSString *)path
|
||||
categoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)yn;*/
|
||||
|
||||
- (id<CodeEditor>)editorForFile:(NSString *)path
|
||||
categoryPath:(NSString *)categoryPath
|
||||
editable:(BOOL)editable
|
||||
windowed:(BOOL)windowed;
|
||||
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
- (id<CodeEditor>)openEditorForFile:(NSString *)path
|
||||
categoryPath:(NSString *)categoryPath
|
||||
editable:(BOOL)editable
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
- (void)orderFrontEditorForFile:(NSString *)path;
|
||||
- (id<CodeEditor>)activeEditor;
|
||||
|
@ -120,5 +115,26 @@
|
|||
|
||||
@end
|
||||
|
||||
extern NSString *PCEditorDidChangeFileNameNotification;
|
||||
|
||||
extern NSString *PCEditorWillOpenNotification;
|
||||
extern NSString *PCEditorDidOpenNotification;
|
||||
extern NSString *PCEditorWillCloseNotification;
|
||||
extern NSString *PCEditorDidCloseNotification;
|
||||
|
||||
extern NSString *PCEditorWillChangeNotification;
|
||||
extern NSString *PCEditorDidChangeNotification;
|
||||
extern NSString *PCEditorWillSaveNotification;
|
||||
extern NSString *PCEditorDidSaveNotification;
|
||||
extern NSString *PCEditorWillRevertNotification;
|
||||
extern NSString *PCEditorDidRevertNotification;
|
||||
|
||||
extern NSString *PCEditorDidBecomeActiveNotification;
|
||||
extern NSString *PCEditorDidResignActiveNotification;
|
||||
|
||||
/*
|
||||
extern NSString *PCEditorSaveDidFailNotification;
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
|
||||
// File Attributes
|
||||
IBOutlet NSBox *fileAttributesView;
|
||||
IBOutlet PCFileNameIcon *fileIcon;
|
||||
IBOutlet PCFileNameField *fileIconField;
|
||||
IBOutlet PCFileNameIcon *fileIconView;
|
||||
IBOutlet PCFileNameField *fileNameField;
|
||||
NSString *fileName;
|
||||
IBOutlet NSButton *localizableButton;
|
||||
IBOutlet NSButton *publicHeaderButton;
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#ifndef _PCProjectWindow_h_
|
||||
#define _PCProjectWindow_h_
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <ProjectCenter/PCFileNameField.h>
|
||||
#include <ProjectCenter/PCFileNameIcon.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <ProjectCenter/PCFileNameField.h>
|
||||
#import <ProjectCenter/PCFileNameIcon.h>
|
||||
|
||||
@class PCProject;
|
||||
@class PCProjectBrowser;
|
||||
|
@ -71,9 +71,6 @@
|
|||
// ==== Intialization & deallocation
|
||||
// ============================================================================
|
||||
|
||||
// Will go into gorm file
|
||||
- (void)_initUI;
|
||||
|
||||
- (id)initWithProject:(PCProject *)owner;
|
||||
- (void)setTitle;
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
//#include <Protocols/ProjectEditor.h>
|
||||
|
||||
@protocol ProjectEditor;
|
||||
|
||||
@protocol CodeEditor <NSObject>
|
||||
|
||||
// ===========================================================================
|
||||
|
@ -41,12 +37,12 @@
|
|||
|
||||
- (id)openFileAtPath:(NSString *)file
|
||||
categoryPath:(NSString *)categoryPath
|
||||
projectEditor:(id<ProjectEditor>)aProjectEditor
|
||||
projectEditor:(id)aProjectEditor
|
||||
editable:(BOOL)editable;
|
||||
|
||||
- (id)openExternalEditor:(NSString *)editor
|
||||
withPath:(NSString *)file
|
||||
projectEditor:(id<ProjectEditor>)aProjectEditor;
|
||||
projectEditor:(id)aProjectEditor;
|
||||
|
||||
- (void)show;
|
||||
- (void)setWindowed:(BOOL)yn;
|
||||
|
@ -55,17 +51,26 @@
|
|||
// ===========================================================================
|
||||
// ==== Accessor methods
|
||||
// ===========================================================================
|
||||
- (id<ProjectEditor>)projectEditor;
|
||||
- (id)projectEditor;
|
||||
|
||||
- (NSWindow *)editorWindow;
|
||||
- (NSView *)editorView;
|
||||
- (NSView *)componentView;
|
||||
|
||||
- (NSString *)path;
|
||||
- (void)setPath:(NSString *)path;
|
||||
|
||||
- (NSString *)categoryPath;
|
||||
- (void)setCategoryPath:(NSString *)path;
|
||||
|
||||
- (BOOL)isEdited;
|
||||
- (void)setIsEdited:(BOOL)yn;
|
||||
|
||||
- (NSImage *)fileIcon;
|
||||
|
||||
// Returns class or method names
|
||||
- (NSArray *)browserItemsForItem:(NSString *)item;
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Object managment
|
||||
// ===========================================================================
|
||||
|
@ -79,12 +84,10 @@
|
|||
// ==== Parser and scrolling
|
||||
// ===========================================================================
|
||||
|
||||
// Returns class or method names
|
||||
- (NSArray *)browserItemsForItem:(NSString *)item;
|
||||
|
||||
- (void)fileStructureItemSelected:(NSString *)item;
|
||||
- (void)scrollToClassName:(NSString *)className;
|
||||
- (void)scrollToMethodName:(NSString *)methodName;
|
||||
- (void)scrollToLineNumber:(int)line;
|
||||
- (void)scrollToLineNumber:(unsigned int)lineNumber;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2002-2004 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCProjectEditorProtocol_h_
|
||||
#define _PCProjectEditorProtocol_h_
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
@protocol CodeParser;
|
||||
|
||||
@protocol ProjectEditor
|
||||
|
||||
// ===========================================================================
|
||||
// ==== File handling
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)saveEditedFiles:(NSArray *)files;
|
||||
- (BOOL)saveAllFiles;
|
||||
- (BOOL)saveFile;
|
||||
- (BOOL)saveFileAs:(NSString *)file;
|
||||
- (BOOL)saveFileTo:(NSString *)file;
|
||||
- (BOOL)revertFileToSaved;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString *PCEditorDidChangeFileNameNotification;
|
||||
|
||||
extern NSString *PCEditorWillOpenNotification;
|
||||
extern NSString *PCEditorDidOpenNotification;
|
||||
extern NSString *PCEditorDidCloseNotification;
|
||||
|
||||
extern NSString *PCEditorDidBecomeActiveNotification;
|
||||
extern NSString *PCEditorDidResignActiveNotification;
|
||||
|
||||
/*extern NSString *PCEditorDidChangeNotification;
|
||||
extern NSString *PCEditorWillSaveNotification;
|
||||
extern NSString *PCEditorDidSaveNotification;
|
||||
extern NSString *PCEditorSaveDidFailNotification;
|
||||
extern NSString *PCEditorWillRevertNotification;
|
||||
extern NSString *PCEditorDidRevertNotification;
|
||||
extern NSString *PCEditorDeletedNotification;
|
||||
extern NSString *PCEditorRenamedNotification;*/
|
||||
|
||||
#endif
|
||||
|
|
@ -45,7 +45,7 @@ GDB = `which gdb`
|
|||
ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS += -Wall -DPCDefaultBuildTool=@"\"$(GMAKE)\"" \
|
||||
ADDITIONAL_OBJCFLAGS += -W -DPCDefaultBuildTool=@"\"$(GMAKE)\"" \
|
||||
-DPCDefaultDebugger=@"\"$(GDB)\""
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <ProjectCenter/PCFileNameField.h>
|
||||
|
||||
NSString *PCFileNameFieldNoFiles = @"No files selected";
|
||||
|
||||
@implementation PCFileNameField
|
||||
|
||||
- (void)setFont:(NSFont *)fontObject
|
||||
|
@ -106,10 +108,9 @@
|
|||
|
||||
- (BOOL)textShouldSetEditable:(NSString *)text
|
||||
{
|
||||
id delegate = [self delegate];
|
||||
id delegate = [self delegate];
|
||||
|
||||
if ([text isEqualToString:@"No files selected"]
|
||||
|| [text isEqualToString:@"Multiple files selected"])
|
||||
if ([text isEqualToString:PCFileNameFieldNoFiles])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCFileNameIcon.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCFileNameIcon.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
|
||||
@implementation PCFileNameIcon
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
RELEASE(fileNameField);
|
||||
RELEASE(delegate);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -68,128 +69,36 @@
|
|||
fileNameField = RETAIN(field);
|
||||
}
|
||||
|
||||
- (void)setMultipleFilesSelectionText:(NSString *)text
|
||||
- (void)setDelegate:(id)object
|
||||
{
|
||||
msfText = [text copy];
|
||||
delegate = object;
|
||||
}
|
||||
|
||||
- (void)setFileIcon:(id)object
|
||||
- (void)updateIcon
|
||||
{
|
||||
NSString *categoryName = nil;
|
||||
NSString *fileName = nil;
|
||||
NSString *fileExtension = nil;
|
||||
NSString *iconName = nil;
|
||||
NSImage *icon = nil;
|
||||
|
||||
fileName = [object nameOfSelectedFile];
|
||||
if (fileName)
|
||||
if (delegate)
|
||||
{
|
||||
fileExtension = [fileName pathExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
categoryName = [object nameOfSelectedCategory];
|
||||
}
|
||||
|
||||
/* PCLogError(self,@"{setFileIcon} file %@ category %@",
|
||||
fileName, categoryName);*/
|
||||
|
||||
// Should be provided by PC*Proj bundles
|
||||
if ([[object selectedFiles] count] > 1)
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"MultiFiles"];
|
||||
}
|
||||
else if (!categoryName && !fileName) // Nothing selected
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"projectSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Classes"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"classSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Headers"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"headerSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Other Sources"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"genericSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Interfaces"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"nibSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Images"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"iconSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Other Resources"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"otherSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Subprojects"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"subprojectSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Documentation"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"helpSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Supporting Files"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"genericSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Libraries"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"librarySuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Non Project Files"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"projectSuitcase"];
|
||||
}
|
||||
|
||||
if (iconName != nil)
|
||||
{
|
||||
icon = IMAGE(iconName);
|
||||
RELEASE(iconName);
|
||||
}
|
||||
else //if (fileExtension != nil && ![fileExtension isEqualToString:@""])
|
||||
{
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFile:fileName];
|
||||
}
|
||||
|
||||
// Set icon
|
||||
if (icon != nil)
|
||||
{
|
||||
[self setImage:icon];
|
||||
}
|
||||
|
||||
// Set title
|
||||
if ([[object selectedFiles] count] > 1)
|
||||
{
|
||||
if (msfText != nil)
|
||||
if ([delegate respondsToSelector:@selector(fileNameIconImage)])
|
||||
{
|
||||
[fileNameField setStringValue:msfText];
|
||||
[self setImage:[delegate fileNameIconImage]];
|
||||
}
|
||||
else
|
||||
if ([delegate respondsToSelector:@selector(fileNameIconTitle)])
|
||||
{
|
||||
[fileNameField setStringValue:
|
||||
[NSString stringWithFormat:
|
||||
@"%i files", [[object selectedFiles] count]]];
|
||||
[fileNameField setStringValue:[delegate fileNameIconTitle]];
|
||||
}
|
||||
}
|
||||
else if (categoryName)
|
||||
{
|
||||
[fileNameField setStringValue:categoryName];
|
||||
}
|
||||
else if (fileName)
|
||||
{
|
||||
[fileNameField setStringValue:fileName];
|
||||
}
|
||||
else
|
||||
{
|
||||
[fileNameField setStringValue:@"No files selected"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCFileNameIcon (FileNameIconDelegate)
|
||||
|
||||
- (NSImage *)fileNameIconImage
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *)fileNameIconTitle
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
void
|
||||
PCLog(id sender, int tag, NSString* format, va_list args)
|
||||
|
@ -128,6 +128,8 @@ static PCLogController *_logCtrllr = nil;
|
|||
NSLog(@"PCLogController: dealloc");
|
||||
#endif
|
||||
RELEASE(textAttributes);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)showPanel
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#include <ProjectCenter/PCPrefController.h>
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
|
||||
// TODO: rewrite it as PCPrefernces, use +sharedPreferences instead of
|
||||
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
|
||||
|
@ -139,8 +139,8 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
|
||||
- (void)loadPreferences
|
||||
{
|
||||
NSDictionary *prefs = nil;
|
||||
NSString *val = nil;
|
||||
NSDictionary *prefs;
|
||||
NSString *val;
|
||||
|
||||
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
[preferencesDict addEntriesFromDictionary: prefs];
|
||||
|
@ -148,14 +148,14 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
// Fill in the defaults
|
||||
|
||||
// Building
|
||||
[successField setStringValue:
|
||||
(val = [preferencesDict objectForKey: SuccessSound]) ? val : @""];
|
||||
val = [preferencesDict objectForKey:SuccessSound];
|
||||
[successField setStringValue: (val == nil) ? @"" : val];
|
||||
|
||||
[failureField setStringValue:
|
||||
(val = [preferencesDict objectForKey: FailureSound]) ? val : @""];
|
||||
(val = [preferencesDict objectForKey:FailureSound]) ? val : @""];
|
||||
|
||||
[promptOnClean setState:
|
||||
([[preferencesDict objectForKey: PromptOnClean]
|
||||
([[preferencesDict objectForKey:PromptOnClean]
|
||||
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
[rootBuildDirField setStringValue:
|
||||
|
@ -250,8 +250,8 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSArray *tabMatrixCells = nil;
|
||||
int i;
|
||||
NSArray *tabMatrixCells;
|
||||
unsigned i;
|
||||
|
||||
[promptOnClean setRefusesFirstResponder:YES];
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ NSString
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
resPath = [projectPath stringByAppendingPathComponent:@"Resources"];
|
||||
resFilePath = [resPath stringByAppendingPathComponent:file];
|
||||
localizedResources = [[self localizedResources] mutableCopy];
|
||||
|
@ -854,8 +854,7 @@ NSString
|
|||
NSString *fileName = [filePath lastPathComponent];
|
||||
NSString *extension = [filePath pathExtension];
|
||||
|
||||
if ([key isEqualToString:PCSupportingFiles]
|
||||
|| [key isEqualToString:PCDocuFiles])
|
||||
if ([key isEqualToString:PCSupportingFiles])
|
||||
{
|
||||
if ([fileName isEqualToString:@"GNUmakefile"] ||
|
||||
[extension isEqualToString:@"plist"])
|
||||
|
@ -1006,7 +1005,7 @@ NSString
|
|||
// File is located in project's directory tree
|
||||
if (pathRange.length && ![type isEqualToString:PCLibraries])
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < [subprojects count]; i++)
|
||||
{
|
||||
|
@ -1279,12 +1278,14 @@ NSString
|
|||
|
||||
if ([[self localizedResources] containsObject:fromFile])
|
||||
{// Rename file in language dirs
|
||||
NSArray *userLanguages = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSString *lang = nil;
|
||||
NSString *langPath = nil;
|
||||
NSMutableArray *localizedResources = [self localizedResources];
|
||||
NSArray *userLanguages;
|
||||
NSEnumerator *enumerator;
|
||||
NSString *lang;
|
||||
NSString *langPath;
|
||||
NSMutableArray *localizedResources;
|
||||
|
||||
localizedResources =
|
||||
[NSMutableArray arrayWithArray:[self localizedResources]];
|
||||
userLanguages = [projectDict objectForKey:PCUserLanguages];
|
||||
enumerator = [userLanguages objectEnumerator];
|
||||
while ((lang = [enumerator nextObject]))
|
||||
|
@ -1517,8 +1518,6 @@ NSString
|
|||
|
||||
@implementation PCProject (ProjectBrowser)
|
||||
|
||||
// TODO: Think about moving all browser related methods into PCProjectBrowser
|
||||
|
||||
- (NSArray *)rootKeys
|
||||
{
|
||||
// e.g. CLASS_FILES
|
||||
|
@ -1556,6 +1555,43 @@ NSString
|
|||
return [rootEntries objectForKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)rootCategoryForCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSArray *pathComponents = nil;
|
||||
|
||||
if ([categoryPath isEqualToString:@"/"] || [categoryPath isEqualToString:@""])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
pathComponents = [categoryPath componentsSeparatedByString:@"/"];
|
||||
|
||||
return [pathComponents objectAtIndex:1];
|
||||
}
|
||||
|
||||
- (NSString *)keyForRootCategoryInCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSString *category = nil;
|
||||
NSString *key = nil;
|
||||
|
||||
if (categoryPath == nil
|
||||
|| [categoryPath isEqualToString:@""]
|
||||
|| [categoryPath isEqualToString:@"/"])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
category = [self rootCategoryForCategoryPath:categoryPath];
|
||||
key = [self keyForCategory:category];
|
||||
|
||||
/* PCLogInfo(self, @"{%@}(keyForRootCategoryInCategoryPath): %@ key:%@",
|
||||
projectName, categoryPath, key);*/
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
// --- Requested by Project Browser
|
||||
|
||||
- (NSArray *)contentAtCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSString *key = [self keyForRootCategoryInCategoryPath:categoryPath];
|
||||
|
@ -1608,15 +1644,6 @@ NSString
|
|||
{ // The file is selected, ask editor for browser items
|
||||
return [[projectEditor activeEditor] browserItemsForItem:listEntry];
|
||||
}
|
||||
/* else if ([[listEntry pathExtension] isEqualToString:@"m"]
|
||||
|| [[listEntry pathExtension] isEqualToString:@"h"])
|
||||
{// Class and header files (TODO: test subprojects)
|
||||
return [[projectEditor activeEditor] classNames];
|
||||
}
|
||||
else if ([[listEntry substringToIndex:1] isEqualToString:@"@"])
|
||||
{// Class name (TODO: test subprojects)
|
||||
return [[projectEditor activeEditor] methodNamesForClass:listEntry];
|
||||
}*/
|
||||
}
|
||||
|
||||
- (BOOL)hasChildrenAtCategoryPath:(NSString *)categoryPath
|
||||
|
@ -1646,10 +1673,10 @@ NSString
|
|||
return YES;
|
||||
}
|
||||
|
||||
// Files
|
||||
if ([[projectDict objectForKey:categoryKey] containsObject:listEntry])
|
||||
// Files. listEntry is file in category or contents of file
|
||||
if ([[projectDict objectForKey:categoryKey] containsObject:listEntry] ||
|
||||
[projectBrowser nameOfSelectedFile])
|
||||
{
|
||||
// NSLog(@"PCP [hasChildrenAtCategoryPath]: item is file selected");
|
||||
// TODO: Libraries
|
||||
if ([category isEqualToString:@"Libraries"])
|
||||
{
|
||||
|
@ -1665,40 +1692,5 @@ NSString
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)rootCategoryForCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSArray *pathComponents = nil;
|
||||
|
||||
if ([categoryPath isEqualToString:@"/"] || [categoryPath isEqualToString:@""])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
pathComponents = [categoryPath componentsSeparatedByString:@"/"];
|
||||
|
||||
return [pathComponents objectAtIndex:1];
|
||||
}
|
||||
|
||||
- (NSString *)keyForRootCategoryInCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSString *category = nil;
|
||||
NSString *key = nil;
|
||||
|
||||
if (categoryPath == nil
|
||||
|| [categoryPath isEqualToString:@""]
|
||||
|| [categoryPath isEqualToString:@"/"])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
category = [self rootCategoryForCategoryPath:categoryPath];
|
||||
key = [self keyForCategory:category];
|
||||
|
||||
/* PCLogInfo(self, @"{%@}(keyForRootCategoryInCategoryPath): %@ key:%@",
|
||||
projectName, categoryPath, key);*/
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -23,14 +23,15 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCFileManager.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCFileNameField.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||
|
||||
|
@ -66,12 +67,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
selector:@selector(projectDictDidChange:)
|
||||
name:PCProjectDictDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(editorDidOpen:)
|
||||
name:PCEditorDidOpenNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -366,6 +361,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
NSString *category;
|
||||
PCProject *activeProject;
|
||||
NSString *browserPath;
|
||||
NSString *filePath;
|
||||
|
||||
if (sender != browser)
|
||||
{
|
||||
|
@ -376,17 +372,20 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
category = [self nameOfSelectedCategory];
|
||||
activeProject = [[project projectManager] activeProject];
|
||||
browserPath = [self path];
|
||||
filePath = [self pathToSelectedFile];
|
||||
|
||||
NSLog(@"browserPath: %@ forProject: %@",
|
||||
browserPath, [activeProject projectName]);
|
||||
/* NSLog(@"browserPath: %@ forProject: %@",
|
||||
browserPath, [activeProject projectName]);*/
|
||||
|
||||
if ([[self selectedFiles] count] == 1
|
||||
&& ![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
|
||||
// if ([[self selectedFiles] count] == 1
|
||||
if (filePath &&
|
||||
[filePath isEqualToString:browserPath] &&
|
||||
![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
|
||||
{
|
||||
/* PCLogInfo(self, @"[click] category: %@ filePath: %@",
|
||||
category, filePath);*/
|
||||
[[activeProject projectEditor] editorForCategoryPath:browserPath
|
||||
windowed:NO];
|
||||
[[activeProject projectEditor] openEditorForCategoryPath:browserPath
|
||||
windowed:NO];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
@ -423,8 +422,8 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
{
|
||||
if ([[NSWorkspace sharedWorkspace] openFile:filePath] == NO)
|
||||
{
|
||||
[[project projectEditor] editorForCategoryPath:[browser path]
|
||||
windowed:YES];
|
||||
[[project projectEditor] openEditorForCategoryPath:[browser path]
|
||||
windowed:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -474,15 +473,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
}
|
||||
}
|
||||
|
||||
- (void)editorDidOpen:(NSNotification *)aNotif
|
||||
{
|
||||
/* PCEditor *object = [aNotif object];
|
||||
|
||||
NSLog(@"PCBrowser: %@ classes: %@",
|
||||
[object categoryPath], [object classNames]);*/
|
||||
[self reloadLastColumnAndNotify:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCProjectBrowser (ProjectBrowserDelegate)
|
||||
|
@ -527,7 +517,144 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
[categoryPath appendString:[files objectAtIndex:i]];
|
||||
|
||||
[cell setLeaf:![project hasChildrenAtCategoryPath:categoryPath]];
|
||||
[cell setRefusesFirstResponder:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCProjectBrowser (FileNameIconDelegate)
|
||||
|
||||
// If file was opened in editor:
|
||||
// 1. Determine editor
|
||||
// 2. Ask editor for icon
|
||||
- (NSImage *)_editorIconImageForFile:(NSString *)fileName
|
||||
{
|
||||
PCProjectEditor *projectEditor = [project projectEditor];
|
||||
id<CodeEditor> editor = nil;
|
||||
NSString *categoryName = [self nameOfSelectedCategory];
|
||||
NSString *categoryKey = [project keyForCategory:categoryName];
|
||||
|
||||
editor = [projectEditor editorForFile:fileName key:categoryKey];
|
||||
if (editor != nil)
|
||||
{
|
||||
return [editor fileIcon];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSImage *)fileNameIconImage
|
||||
{
|
||||
NSString *categoryName = nil;
|
||||
NSString *fileName = nil;
|
||||
NSString *fileExtension = nil;
|
||||
NSString *iconName = nil;
|
||||
NSImage *icon = nil;
|
||||
|
||||
fileName = [self nameOfSelectedFile];
|
||||
if (fileName)
|
||||
{
|
||||
if ((icon = [self _editorIconImageForFile:fileName]))
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
fileExtension = [fileName pathExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
categoryName = [self nameOfSelectedCategory];
|
||||
}
|
||||
|
||||
/* PCLogError(self,@"{setFileIcon} file %@ category %@",
|
||||
fileName, categoryName);*/
|
||||
|
||||
if ([[self selectedFiles] count] > 1)
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"MultiFiles"];
|
||||
}
|
||||
else if (!categoryName && !fileName) // Nothing selected
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"FileProject"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Classes"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"classSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Headers"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"headerSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Other Sources"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"genericSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Interfaces"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"nibSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Images"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"iconSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Other Resources"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"otherSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Subprojects"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"subprojectSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Documentation"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"helpSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Supporting Files"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"genericSuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Libraries"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"librarySuitcase"];
|
||||
}
|
||||
else if ([categoryName isEqualToString: @"Non Project Files"])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"projectSuitcase"];
|
||||
}
|
||||
|
||||
if (iconName != nil)
|
||||
{
|
||||
icon = IMAGE(iconName);
|
||||
RELEASE(iconName);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFile:fileName];
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
- (NSString *)fileNameIconTitle
|
||||
{
|
||||
NSString *categoryName = [self nameOfSelectedCategory];
|
||||
NSString *fileName = [self nameOfSelectedFile];
|
||||
int filesCount = [[self selectedFiles] count];
|
||||
|
||||
if (filesCount > 1)
|
||||
{
|
||||
return [NSString stringWithFormat:@"%i files", filesCount];
|
||||
}
|
||||
else if (fileName)
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
else if (categoryName)
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
return PCFileNameFieldNoFiles;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,27 +23,31 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCFileManager.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCBundleManager.h>
|
||||
#include <ProjectCenter/PCProjectWindow.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCBundleManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
|
||||
#include <Protocols/CodeParser.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
NSString *PCEditorDidChangeFileNameNotification =
|
||||
@"PCEditorDidChangeFileNameNotification";
|
||||
|
||||
NSString *PCEditorWillOpenNotification =
|
||||
@"PCEditorWillOpenNotification";
|
||||
NSString *PCEditorDidOpenNotification =
|
||||
@"PCEditorDidOpenNotification";
|
||||
NSString *PCEditorDidCloseNotification =
|
||||
@"PCEditorDidCloseNotification";
|
||||
|
||||
NSString *PCEditorWillOpenNotification = @"PCEditorWillOpenNotification";
|
||||
NSString *PCEditorDidOpenNotification = @"PCEditorDidOpenNotification";
|
||||
NSString *PCEditorWillCloseNotification = @"PCEditorWillCloseNotification";
|
||||
NSString *PCEditorDidCloseNotification = @"PCEditorDidCloseNotification";
|
||||
|
||||
NSString *PCEditorWillChangeNotification = @"PCEditorWillChangeNotification";
|
||||
NSString *PCEditorDidChangeNotification = @"PCEditorDidChangeNotification";
|
||||
NSString *PCEditorWillSaveNotification = @"PCEditorWillSaveNotification";
|
||||
NSString *PCEditorDidSaveNotification = @"PCEditorDidSaveNotification";
|
||||
NSString *PCEditorWillRevertNotification = @"PCEditorWillRevertNotification";
|
||||
NSString *PCEditorDidRevertNotification = @"PCEditorDidRevertNotification";
|
||||
|
||||
NSString *PCEditorDidBecomeActiveNotification =
|
||||
@"PCEditorDidBecomeActiveNotification";
|
||||
|
@ -258,8 +262,21 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
// TODO: Should it be editor or parser?
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item
|
||||
{
|
||||
NSDictionary *infoTable = [self infoTableForBundleType:@"editor"
|
||||
andFileType:[item pathExtension]];
|
||||
NSString *file = [[project projectBrowser] nameOfSelectedFile];
|
||||
NSDictionary *infoTable = nil;
|
||||
|
||||
// File selected and editor should already be loaded
|
||||
if (file != nil)
|
||||
{
|
||||
if ([[item substringToIndex:1] isEqualToString:@"@"])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
// Category selected
|
||||
infoTable = [self infoTableForBundleType:@"editor"
|
||||
andFileType:[item pathExtension]];
|
||||
|
||||
if ([[infoTable objectForKey:@"ProvidesBrowserItems"] isEqualToString:@"YES"])
|
||||
{
|
||||
|
@ -269,11 +286,20 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id<CodeEditor>)editorForFile:(NSString *)fileName key:(NSString *)key
|
||||
{
|
||||
NSString *filePath = nil;
|
||||
|
||||
filePath = [project pathForFile:fileName forKey:key];
|
||||
|
||||
return [editorsDict objectForKey:filePath];
|
||||
}
|
||||
|
||||
// categoryPath:
|
||||
// 1. "/Classes/Class.m/- init"
|
||||
// 2. "/Subprojects/Project/Classes/Class.m/- init"
|
||||
// 3. "/Library/gnustep-gui"
|
||||
- (id<CodeEditor>)editorForCategoryPath:(NSString *)categoryPath
|
||||
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed
|
||||
{
|
||||
NSArray *pathArray = [categoryPath pathComponents];
|
||||
|
@ -316,10 +342,10 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
|
||||
// NSLog(@"fileName: %@ > %@", fileName, listEntry);
|
||||
|
||||
editor = [self editorForFile:filePath
|
||||
categoryPath:categoryPath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
editor = [self openEditorForFile:filePath
|
||||
categoryPath:categoryPath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
if (!editor)
|
||||
{
|
||||
NSLog(@"We don't have editor for file: %@", fileName);
|
||||
|
@ -332,7 +358,7 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
[pathLastObject substringWithRange:NSMakeRange(0,1)]);*/
|
||||
|
||||
pathLastObject = [pathArray lastObject];
|
||||
firstSymbol = [pathLastObject substringWithRange:NSMakeRange(0,1)];
|
||||
firstSymbol = [pathLastObject substringToIndex:1];
|
||||
if ([pathLastObject isEqualToString:@"/"]) // file selected
|
||||
{
|
||||
[[project projectBrowser] reloadLastColumnAndNotify:NO];
|
||||
|
@ -349,10 +375,10 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
return editor;
|
||||
}
|
||||
|
||||
- (id<CodeEditor>)editorForFile:(NSString *)path
|
||||
categoryPath:(NSString *)categoryPath
|
||||
editable:(BOOL)editable
|
||||
windowed:(BOOL)windowed
|
||||
- (id<CodeEditor>)openEditorForFile:(NSString *)path
|
||||
categoryPath:(NSString *)categoryPath
|
||||
editable:(BOOL)editable
|
||||
windowed:(BOOL)windowed
|
||||
{
|
||||
// NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
// NSString *ed = [ud objectForKey:Editor];
|
||||
|
@ -385,7 +411,7 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
}
|
||||
|
||||
// Parser
|
||||
parserClassName = [self classNameForBundleType:@"parser"
|
||||
/* parserClassName = [self classNameForBundleType:@"parser"
|
||||
andFile:[path lastPathComponent]];
|
||||
if (parserClassName != nil)
|
||||
{
|
||||
|
@ -393,9 +419,9 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
parser = [bundleManager objectForClassName:parserClassName
|
||||
withProtocol:@protocol(CodeParser)
|
||||
inBundleType:@"parser"];
|
||||
AUTORELEASE(parser);
|
||||
[editor setParser:parser];
|
||||
}
|
||||
RELEASE(parser);
|
||||
}*/
|
||||
|
||||
[editor openFileAtPath:path
|
||||
categoryPath:categoryPath
|
||||
|
@ -593,10 +619,10 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
res = [editor saveFileTo:file];
|
||||
[editor closeFile:self save:NO];
|
||||
|
||||
[self editorForFile:file
|
||||
categoryPath:categoryPath
|
||||
editable:YES
|
||||
windowed:iw];
|
||||
[self openEditorForFile:file
|
||||
categoryPath:categoryPath
|
||||
editable:YES
|
||||
windowed:iw];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -654,7 +680,7 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[editorsDict removeObjectForKey:[editor path]];
|
||||
|
||||
if ([editorsDict count])
|
||||
|
@ -683,7 +709,7 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
id<CodeEditor> editor = [aNotif object];
|
||||
NSString *categoryPath = nil;
|
||||
|
||||
if ([editor projectEditor] != self) // || activeEditor == editor)
|
||||
if ([editor projectEditor] != self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCProjectWindow.h>
|
||||
#include <ProjectCenter/PCProjectInspector.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCProjectInspector.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
@implementation PCProjectInspector
|
||||
|
||||
|
@ -342,13 +342,14 @@
|
|||
[authorsList reloadData];
|
||||
|
||||
// File Attributes
|
||||
[fileIcon setFileIcon:(id)[project projectBrowser]];
|
||||
[fileIconView setDelegate:[project projectBrowser]];
|
||||
[fileIconView updateIcon];
|
||||
[self updateFileAttributes];
|
||||
}
|
||||
|
||||
- (void)browserDidSetPath:(NSNotification *)aNotif
|
||||
{
|
||||
[fileIcon setFileIcon:[aNotif object]];
|
||||
[fileIconView updateIcon];
|
||||
[self updateFileAttributes];
|
||||
}
|
||||
|
||||
|
@ -637,9 +638,9 @@
|
|||
|
||||
- (void)downAuthor:(id)sender
|
||||
{
|
||||
int selectedRow = [authorsList selectedRow];
|
||||
id nextRow;
|
||||
id currentRow;
|
||||
unsigned selectedRow = [authorsList selectedRow];
|
||||
id nextRow;
|
||||
id currentRow;
|
||||
|
||||
if (selectedRow < [authorsItems count]-1)
|
||||
{
|
||||
|
@ -669,7 +670,7 @@
|
|||
|
||||
if ([NSBundle loadNibNamed:@"FileAttributes" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading ProjectDescription NIB file!");
|
||||
PCLogError(self, @"error loading FileAttributes NIB file!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -677,8 +678,7 @@
|
|||
[localizableButton setRefusesFirstResponder:YES];
|
||||
[publicHeaderButton setRefusesFirstResponder:YES];
|
||||
|
||||
[fileIcon setFileNameField:fileIconField];
|
||||
[fileIcon setMultipleFilesSelectionText:@"Multiple files selected"];
|
||||
[fileIconView setFileNameField:fileNameField];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
|
@ -790,8 +790,8 @@
|
|||
|
||||
- (void)beginFileRename
|
||||
{
|
||||
[fileIconField setEditableField:YES];
|
||||
[inspectorPanel makeFirstResponder:fileIconField];
|
||||
[fileNameField setEditableField:YES];
|
||||
[inspectorPanel makeFirstResponder:fileNameField];
|
||||
}
|
||||
|
||||
// Delegate method of PCFileNameField class
|
||||
|
@ -817,17 +817,17 @@
|
|||
|
||||
- (void)fileNameDidChange:(id)sender
|
||||
{
|
||||
if ([fileName isEqualToString:[fileIconField stringValue]])
|
||||
if ([fileName isEqualToString:[fileNameField stringValue]])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* PCLogInfo(self, @"{%@} file name changed from: %@ to: %@",
|
||||
[project projectName], fileName, [fileIconField stringValue]);*/
|
||||
[project projectName], fileName, [fileNameField stringValue]);*/
|
||||
|
||||
if ([project renameFile:fileName toFile:[fileIconField stringValue]] == NO)
|
||||
if ([project renameFile:fileName toFile:[fileNameField stringValue]] == NO)
|
||||
{
|
||||
[fileIconField setStringValue:fileName];
|
||||
[fileNameField setStringValue:fileName];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -873,10 +873,10 @@
|
|||
|
||||
- (void)panelDidResignKey:(NSNotification *)aNotif
|
||||
{
|
||||
if ([fileIconField isEditable] == YES)
|
||||
if ([fileNameField isEditable] == YES)
|
||||
{
|
||||
[inspectorPanel makeFirstResponder:fileIcon];
|
||||
[fileIconField setStringValue:fileName];
|
||||
[inspectorPanel makeFirstResponder:fileIconView];
|
||||
[fileNameField setStringValue:fileName];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
|
||||
#include <ProjectCenter/PCPrefController.h>
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#include <Protocols/CodeEditor.h>
|
||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#import <Protocols/CodeEditor.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
|
||||
@implementation PCProjectLoadedFiles
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
|||
[filesScroll setHasHorizontalScroller:NO];
|
||||
[filesScroll setHasVerticalScroller:YES];
|
||||
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||
objectForKey: SeparateLoadedFiles] isEqualToString: @"NO"])
|
||||
objectForKey:SeparateLoadedFiles] isEqualToString:@"NO"])
|
||||
{
|
||||
[filesScroll setBorderType:NSBezelBorder];
|
||||
}
|
||||
|
@ -86,8 +86,8 @@
|
|||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(fileWillOpen:)
|
||||
name:PCEditorWillOpenNotification
|
||||
selector:@selector(fileDidOpen:)
|
||||
name:PCEditorDidOpenNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
@ -228,7 +228,7 @@
|
|||
// ==== Notifications
|
||||
// ===========================================================================
|
||||
|
||||
- (void)fileWillOpen:(NSNotification *)aNotif
|
||||
- (void)fileDidOpen:(NSNotification *)aNotif
|
||||
{
|
||||
id<CodeEditor> editor = [aNotif object];
|
||||
NSString *filePath = nil;
|
||||
|
@ -255,7 +255,7 @@
|
|||
row = [[self editedFilesRep] indexOfObject:filePath];
|
||||
[filesList selectRow:row byExtendingSelection:NO];
|
||||
|
||||
PCLogInfo(self, @"fileWillOpen.END");
|
||||
// PCLogInfo(self, @"fileDidOpen.END");
|
||||
}
|
||||
|
||||
- (void)fileDidClose:(NSNotification *)aNotif
|
||||
|
@ -301,7 +301,7 @@
|
|||
{
|
||||
filePath = [editor path];
|
||||
index = [[self editedFilesRep] indexOfObject:filePath];
|
||||
if (index >=0 && index < filesCount)
|
||||
if (index < filesCount)
|
||||
{
|
||||
[filesList selectRow:index byExtendingSelection:NO];
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
#include "Protocols/ProjectType.h"
|
||||
#include "Protocols/CodeEditor.h"
|
||||
#include "Protocols/ProjectEditor.h"
|
||||
|
||||
NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||
|
||||
|
@ -445,7 +444,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
NSString *_resFile = nil;
|
||||
int i = 0;
|
||||
unsigned i = 0;
|
||||
PCProject<ProjectType> *project = nil;
|
||||
NSMutableArray *otherResArray = nil;
|
||||
NSString *plistFile = nil;
|
||||
|
@ -825,7 +824,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
NSString *directory = [activeProject dirForCategoryKey:categoryKey];
|
||||
NSString *removeString = nil;
|
||||
NSMutableArray *subprojs = [NSMutableArray array];
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
// Determining target project
|
||||
if ([categoryKey isEqualToString:PCSubprojects])
|
||||
|
@ -1293,7 +1292,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
NSString *spDir = nil;
|
||||
NSDictionary *spDict = nil;
|
||||
NSString *spName = nil;
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
files = [fileManager
|
||||
filesForAddOfTypes:[NSArray arrayWithObjects:@"subproj",nil]];
|
||||
|
|
|
@ -23,23 +23,23 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCSplitView.h>
|
||||
#include <ProjectCenter/PCButton.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCSplitView.h>
|
||||
#import <ProjectCenter/PCButton.h>
|
||||
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
|
||||
#include <ProjectCenter/PCProjectWindow.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCProjectEditor.h>
|
||||
#include <ProjectCenter/PCProjectBuilder.h>
|
||||
#include <ProjectCenter/PCProjectLauncher.h>
|
||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#include <ProjectCenter/PCProjectInspector.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCProjectBuilder.h>
|
||||
#import <ProjectCenter/PCProjectLauncher.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#import <ProjectCenter/PCProjectInspector.h>
|
||||
|
||||
#include <ProjectCenter/PCPrefController.h>
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
@implementation PCProjectWindow
|
||||
|
||||
|
@ -63,21 +63,9 @@
|
|||
[h_split adjustSubviews];
|
||||
}
|
||||
|
||||
- (void)_initUI
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSRect rect;
|
||||
// NSView *browserView = nil;
|
||||
|
||||
if (projectWindow != nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ([NSBundle loadNibNamed:@"ProjectWindow" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading ProjectWindow NIB file!");
|
||||
return;
|
||||
}
|
||||
|
||||
[buildButton setToolTip:@"Build"];
|
||||
// [buildButton setImage:IMAGE(@"Build")];
|
||||
|
@ -103,6 +91,8 @@
|
|||
// [inspectorButton setImage:IMAGE(@"Inspector")];
|
||||
|
||||
[fileIcon setFileNameField:fileIconTitle];
|
||||
[fileIcon setDelegate:[project projectBrowser]];
|
||||
[fileIcon updateIcon];
|
||||
|
||||
[statusLine setStringValue:@""];
|
||||
|
||||
|
@ -167,11 +157,18 @@
|
|||
_isToolbarVisible = YES;
|
||||
_splitViewsRestored = NO;
|
||||
|
||||
[self _initUI];
|
||||
if (projectWindow == nil)
|
||||
{
|
||||
if ([NSBundle loadNibNamed:@"ProjectWindow" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading ProjectWindow NIB file!");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
[self setTitle];
|
||||
|
||||
// Window
|
||||
[projectWindow setFrameAutosaveName: @"ProjectWindow"];
|
||||
[projectWindow setFrameAutosaveName:@"ProjectWindow"];
|
||||
|
||||
pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"];
|
||||
windowFrame = [pcWindows objectForKey:@"ProjectWindow"];
|
||||
|
@ -225,6 +222,23 @@
|
|||
selector:@selector (browserDidSetPath:)
|
||||
name:PCBrowserDidSetPathNotification
|
||||
object:[project projectBrowser]];
|
||||
|
||||
// Editor changes
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector (editorDidChange:)
|
||||
name:PCEditorDidChangeNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector (editorDidSave:)
|
||||
name:PCEditorDidSaveNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector (editorDidRevert:)
|
||||
name:PCEditorDidRevertNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -372,8 +386,10 @@
|
|||
|
||||
- (void)showProjectLoadedFiles:(id)sender
|
||||
{
|
||||
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
||||
NSScrollView *componentView = [[project projectLoadedFiles] componentView];
|
||||
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
||||
NSScrollView *componentView;
|
||||
|
||||
componentView = (NSScrollView *)[[project projectLoadedFiles] componentView];
|
||||
|
||||
// PCLogInfo(self, @"showProjectLoadedFiles");
|
||||
|
||||
|
@ -618,7 +634,50 @@
|
|||
|
||||
- (void)browserDidSetPath:(NSNotification *)aNotif
|
||||
{
|
||||
[fileIcon setFileIcon:[aNotif object]];
|
||||
PCProjectBrowser *browser = [aNotif object];
|
||||
|
||||
if (browser != [project projectBrowser])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[fileIcon updateIcon];
|
||||
}
|
||||
|
||||
- (void)editorDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
id<CodeEditor> editor = [aNotif object];
|
||||
|
||||
if ([editor projectEditor] != [project projectEditor])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[fileIcon updateIcon];
|
||||
}
|
||||
|
||||
- (void)editorDidSave:(NSNotification *)aNotif
|
||||
{
|
||||
id<CodeEditor> editor = [aNotif object];
|
||||
|
||||
if ([editor projectEditor] != [project projectEditor])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[fileIcon updateIcon];
|
||||
}
|
||||
|
||||
- (void)editorDidRevert:(NSNotification *)aNotif
|
||||
{
|
||||
id<CodeEditor> editor = [aNotif object];
|
||||
|
||||
if ([editor projectEditor] != [project projectEditor])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[fileIcon updateIcon];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"fileNameDidChange:"
|
||||
"fileNameDidChange:",
|
||||
"setLocalizableResource:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
@ -23,7 +24,8 @@
|
|||
PCProjectInspector = {
|
||||
Actions = (
|
||||
"fileNameDidChange:",
|
||||
"setPublicHeader:"
|
||||
"setPublicHeader:",
|
||||
"setLocalizableResource:"
|
||||
);
|
||||
Outlets = (
|
||||
fileIconView,
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -23,7 +23,13 @@ ProjectCenter_RESOURCE_FILES= \
|
|||
Resources/Info.table \
|
||||
Resources/C.syntax \
|
||||
Resources/ObjC.syntax \
|
||||
Resources/Plist.syntax
|
||||
Resources/Plist.syntax \
|
||||
Resources/FileC.tiff \
|
||||
Resources/FileCH.tiff \
|
||||
Resources/FileH.tiff \
|
||||
Resources/FileHH.tiff \
|
||||
Resources/FileM.tiff \
|
||||
Resources/FileMH.tiff
|
||||
|
||||
#
|
||||
# Header files
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
// TODO: Needs checking
|
||||
@implementation PCEditor (Document)
|
||||
|
||||
#import "CommandQueryPanel.h"
|
||||
#import "LineQueryPanel.h"
|
||||
#import "TextFinder.h"
|
||||
#import "EditorRulerView.h"
|
||||
#import "EditorTextView.h"
|
||||
#import "SyntaxHighlighter.h"
|
||||
|
@ -154,76 +151,9 @@ unsigned int FindDelimiterInString(NSString * string,
|
|||
}
|
||||
}
|
||||
|
||||
- (void)pipeOutputOfCommand:(NSString *)command
|
||||
{
|
||||
NSTask * task;
|
||||
NSPipe * inPipe, * outPipe;
|
||||
NSString * inString, * outString;
|
||||
NSFileHandle * inputHandle;
|
||||
// --- Parentesis highlighting
|
||||
|
||||
inString = [[textView string] substringWithRange:
|
||||
[textView selectedRange]];
|
||||
inPipe = [NSPipe pipe];
|
||||
outPipe = [NSPipe pipe];
|
||||
|
||||
task = [[NSTask new] autorelease];
|
||||
|
||||
[task setLaunchPath: @"/bin/sh"];
|
||||
[task setArguments: [NSArray arrayWithObjects: @"-c", command, nil]];
|
||||
[task setStandardInput: inPipe];
|
||||
[task setStandardOutput: outPipe];
|
||||
[task setStandardError: outPipe];
|
||||
|
||||
inputHandle = [inPipe fileHandleForWriting];
|
||||
|
||||
[task launch];
|
||||
[inputHandle writeData: [inString
|
||||
dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
[inputHandle closeFile];
|
||||
[task waitUntilExit];
|
||||
outString = [[[NSString alloc]
|
||||
initWithData: [[outPipe fileHandleForReading] availableData]
|
||||
encoding: NSUTF8StringEncoding]
|
||||
autorelease];
|
||||
if ([task terminationStatus] != 0)
|
||||
{
|
||||
if (NSRunAlertPanel(_(@"Error running command"),
|
||||
_(@"The command returned with a non-zero exit status"
|
||||
@" -- aborting pipe.\n"
|
||||
@"Do you want to see the command's output?\n"),
|
||||
_(@"No"), _(@"Yes"), nil) == NSAlertAlternateReturn)
|
||||
{
|
||||
NSRunAlertPanel(_(@"The command's output"),
|
||||
outString, nil, nil, nil);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[textView replaceCharactersInRange:[textView selectedRange]
|
||||
withString:outString];
|
||||
[self textDidChange: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateMiniwindowIconToEdited: (BOOL) flag
|
||||
{
|
||||
NSImage * icon;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
icon = [NSImage imageNamed:
|
||||
[NSString stringWithFormat: @"File_%@_mod", [self fileType]]];
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = [NSImage imageNamed:
|
||||
[NSString stringWithFormat: @"File_%@", [self fileType]]];
|
||||
}
|
||||
|
||||
[myWindow setMiniwindowImage: icon];
|
||||
}
|
||||
|
||||
- (void) unhighlightCharacter
|
||||
- (void)unhighlightCharacter
|
||||
{
|
||||
if (isCharacterHighlit)
|
||||
{
|
||||
|
@ -274,7 +204,7 @@ unsigned int FindDelimiterInString(NSString * string,
|
|||
}
|
||||
}
|
||||
|
||||
- (void) highlightCharacterAt: (unsigned int) location
|
||||
- (void)highlightCharacterAt:(unsigned int)location
|
||||
{
|
||||
if (isCharacterHighlit == NO)
|
||||
{
|
||||
|
@ -315,7 +245,7 @@ unsigned int FindDelimiterInString(NSString * string,
|
|||
}
|
||||
}
|
||||
|
||||
- (void) computeNewParenthesisNesting
|
||||
- (void)computeNewParenthesisNesting
|
||||
{
|
||||
NSRange selectedRange;
|
||||
NSString * myString;
|
||||
|
@ -367,93 +297,24 @@ unsigned int FindDelimiterInString(NSString * string,
|
|||
}
|
||||
|
||||
|
||||
// --- State
|
||||
|
||||
- (void)goToLine:sender
|
||||
- (void)updateMiniwindowIconToEdited:(BOOL)flag
|
||||
{
|
||||
/* LineQueryPanel * lqp = [LineQueryPanel shared];
|
||||
NSImage * icon;
|
||||
|
||||
if ([lqp runModal] == NSOKButton)
|
||||
if (flag)
|
||||
{
|
||||
[self goToLineNumber: (unsigned int) [lqp unsignedIntValue]];
|
||||
}*/
|
||||
}
|
||||
|
||||
- (void)goToLineNumber:(unsigned int)lineNumber
|
||||
{
|
||||
/* unsigned int offset;
|
||||
unsigned int i;
|
||||
NSString * line;
|
||||
NSEnumerator * e;
|
||||
NSArray * lines = [[textView string] componentsSeparatedByString: @"\n"];
|
||||
e = [lines objectEnumerator];
|
||||
NSRange r;
|
||||
|
||||
for (offset = 0, i=1;
|
||||
(line = [e nextObject]) != nil && i < lineNumber;
|
||||
i++, offset += [line length] + 1);
|
||||
|
||||
if (line != nil)
|
||||
{
|
||||
r = NSMakeRange(offset, [line length]);
|
||||
icon = [NSImage imageNamed:
|
||||
[NSString stringWithFormat: @"File_%@_mod", [self fileType]]];
|
||||
}
|
||||
else
|
||||
{
|
||||
r = NSMakeRange([[textView string] length], 0);
|
||||
}
|
||||
[textView setSelectedRange: r];
|
||||
[textView scrollRangeToVisible: r];*/
|
||||
}
|
||||
|
||||
- (void)textViewDidChangeSelection:(NSNotification *)notification
|
||||
{
|
||||
if (editorTextViewIsPressingKey == NO)
|
||||
{
|
||||
[self computeNewParenthesisNesting];
|
||||
}
|
||||
[(EditorRulerView *) [[textView enclosingScrollView] horizontalRulerView]
|
||||
refreshHighlightedArea];
|
||||
[(EditorRulerView *) [[textView enclosingScrollView] verticalRulerView]
|
||||
refreshHighlightedArea];
|
||||
}
|
||||
|
||||
- (void) textDidChange: (NSNotification *) notif
|
||||
{
|
||||
|
||||
if (![self isDocumentEdited])
|
||||
{
|
||||
[self updateMiniwindowIconToEdited: YES];
|
||||
icon = [NSImage imageNamed:
|
||||
[NSString stringWithFormat: @"File_%@", [self fileType]]];
|
||||
}
|
||||
|
||||
[self updateChangeCount: NSChangeDone];
|
||||
}
|
||||
|
||||
- (void) editorTextViewWillPressKey: sender
|
||||
{
|
||||
editorTextViewIsPressingKey = YES;
|
||||
|
||||
[self unhighlightCharacter];
|
||||
}
|
||||
|
||||
- (void) editorTextViewDidPressKey: sender
|
||||
{
|
||||
[self computeNewParenthesisNesting];
|
||||
|
||||
editorTextViewIsPressingKey = NO;
|
||||
}
|
||||
|
||||
- (void) findNext: sender
|
||||
{
|
||||
[[TextFinder sharedInstance] findNext: self];
|
||||
}
|
||||
|
||||
- (void) findPrevious: sender
|
||||
{
|
||||
[[TextFinder sharedInstance] findPrevious: self];
|
||||
}
|
||||
|
||||
- (void) jumpToSelection: sender
|
||||
{
|
||||
[textView scrollRangeToVisible: [textView selectedRange]];
|
||||
[myWindow setMiniwindowImage: icon];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -57,6 +57,36 @@
|
|||
NSArray *parserMethods;
|
||||
// NSMutableArray *classNames;
|
||||
// NSMutableArray *methodNames;
|
||||
|
||||
IBOutlet NSMenu *menu;
|
||||
|
||||
NSFont *defaultFont;
|
||||
NSFont *highlightFont;
|
||||
|
||||
NSColor *textColor;
|
||||
NSColor *highlightColor;
|
||||
NSColor *backgroundColor;
|
||||
NSColor *readOnlyColor;
|
||||
NSColor *textBackground;
|
||||
|
||||
// location of the highlit delimiter character
|
||||
unsigned int highlitCharacterLocation;
|
||||
|
||||
// is YES if we are currently highlighting a delimiter character
|
||||
// otherwise NO
|
||||
BOOL isCharacterHighlit;
|
||||
|
||||
// the stored color and font attributes of the highlit character, so
|
||||
// that they can be restored later on when the character is un-highlit
|
||||
NSColor *previousFGColor;
|
||||
NSColor *previousBGColor;
|
||||
NSColor *previousFont;
|
||||
|
||||
// This is used to protect that -textViewDidChangeSelection: invocations
|
||||
// don't do anything when the text view changing, because this causes
|
||||
// further changes to the text view and infinite recursive invocations
|
||||
// of this method.
|
||||
BOOL editorTextViewIsPressingKey;
|
||||
}
|
||||
|
||||
- (BOOL)editorShouldClose;
|
||||
|
@ -72,6 +102,10 @@
|
|||
// ==== TextView (_intEditorView, _extEditorView) delegate
|
||||
// ===========================================================================
|
||||
- (void)textDidChange:(NSNotification *)aNotification;
|
||||
- (void)textViewDidChangeSelection:(NSNotification *)notification;
|
||||
- (void)editorTextViewWillPressKey:sender;
|
||||
- (void)editorTextViewDidPressKey:sender;
|
||||
|
||||
- (BOOL)becomeFirstResponder;
|
||||
- (BOOL)resignFirstResponder;
|
||||
|
||||
|
@ -85,5 +119,24 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface PCEditor (Menu)
|
||||
|
||||
- (void)pipeOutputOfCommand:(NSString *)command;
|
||||
// Find
|
||||
- (void)findNext:sender;
|
||||
- (void)findPrevious:sender;
|
||||
- (void)jumpToSelection:sender;
|
||||
- (void)goToLine:sender;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCEditor (Parentesis)
|
||||
|
||||
- (void)unhighlightCharacter;
|
||||
- (void)highlightCharacterAt:(unsigned int)location;
|
||||
- (void)computeNewParenthesisNesting;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _PCEDITOR_H_
|
||||
|
||||
|
|
|
@ -23,12 +23,15 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProjectWindow.h>
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#include "PCEditor.h"
|
||||
#include "PCEditorView.h"
|
||||
#import "PCEditor.h"
|
||||
#import "PCEditorView.h"
|
||||
//#import "CommandQueryPanel.h"
|
||||
//#import "LineQueryPanel.h"
|
||||
//#import "TextFinder.h"
|
||||
|
||||
@implementation PCEditor (UInterface)
|
||||
|
||||
|
@ -124,6 +127,8 @@
|
|||
RELEASE(lm);
|
||||
|
||||
ev = [[PCEditorView alloc] initWithFrame:fr textContainer:tc];
|
||||
[ev setBackgroundColor:textBackground];
|
||||
[ev setTextColor:textColor];
|
||||
[ev createSyntaxHighlighterForFileType:[_path pathExtension]];
|
||||
[ev setEditor:self];
|
||||
|
||||
|
@ -165,18 +170,57 @@
|
|||
_isEdited = NO;
|
||||
_isWindowed = NO;
|
||||
_isExternal = YES;
|
||||
|
||||
ASSIGN(defaultFont, [PCEditorView defaultEditorFont]);
|
||||
ASSIGN(highlightFont, [PCEditorView defaultEditorBoldFont]);
|
||||
ASSIGN(textColor, [NSColor blackColor]);
|
||||
ASSIGN(backgroundColor, [NSColor whiteColor]);
|
||||
ASSIGN(readOnlyColor, [NSColor lightGrayColor]);
|
||||
|
||||
previousFGColor = nil;
|
||||
previousBGColor = nil;
|
||||
previousFont = nil;
|
||||
|
||||
isCharacterHighlit = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#endif
|
||||
NSLog(@"PCEditor: %@ dealloc", [_path lastPathComponent]);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
// _window is setReleasedWhenClosed:YES
|
||||
RELEASE(_path);
|
||||
RELEASE(_categoryPath);
|
||||
RELEASE(_intScrollView);
|
||||
RELEASE(_storage);
|
||||
|
||||
// RELEASE(parserClasses);
|
||||
RELEASE(parserMethods);
|
||||
RELEASE(aParser);
|
||||
|
||||
RELEASE(defaultFont);
|
||||
RELEASE(highlightFont);
|
||||
RELEASE(textColor);
|
||||
RELEASE(backgroundColor);
|
||||
RELEASE(readOnlyColor);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setParser:(id)parser
|
||||
{
|
||||
// NSLog(@"RC aParser:%i parser:%i",
|
||||
// [aParser retainCount], [parser retainCount]);
|
||||
/* NSLog(@"RC aParser:%i parser:%i",
|
||||
[aParser retainCount], [parser retainCount]);*/
|
||||
ASSIGN(aParser, parser);
|
||||
// NSLog(@"RC aParser:%i parser:%i",
|
||||
// [aParser retainCount], [parser retainCount]);
|
||||
/* NSLog(@"RC aParser:%i parser:%i",
|
||||
[aParser retainCount], [parser retainCount]);*/
|
||||
}
|
||||
|
||||
- (id)openFileAtPath:(NSString *)file
|
||||
|
@ -184,37 +228,38 @@
|
|||
projectEditor:(id)aProjectEditor
|
||||
editable:(BOOL)editable
|
||||
{
|
||||
NSString *text;
|
||||
NSAttributedString *attributedString;
|
||||
NSDictionary *attributes;
|
||||
NSFont *font;
|
||||
NSColor *textBackground;
|
||||
NSString *text;
|
||||
NSAttributedString *attributedString = [NSAttributedString alloc];
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary new];
|
||||
NSFont *font;
|
||||
// NSColor *textBackground;
|
||||
|
||||
NSLog(@"PCEditor: openFileAtPath");
|
||||
|
||||
// Inform about future file opening
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorWillOpenNotification
|
||||
object:self];
|
||||
projectEditor = aProjectEditor;
|
||||
_path = [file copy];
|
||||
_categoryPath = [categoryPath copy];
|
||||
_storage = [[NSTextStorage alloc] init];
|
||||
|
||||
// Prepare
|
||||
font = [NSFont userFixedPitchFontOfSize:0.0];
|
||||
if (editable)
|
||||
{
|
||||
textBackground = [NSColor whiteColor];
|
||||
textBackground = backgroundColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
textBackground = [NSColor colorWithCalibratedRed:0.97
|
||||
green:0.90
|
||||
blue:0.90
|
||||
alpha:1.0];
|
||||
textBackground = readOnlyColor;
|
||||
}
|
||||
|
||||
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
font, NSFontAttributeName,
|
||||
textBackground, NSBackgroundColorAttributeName];
|
||||
[attributes setObject:font forKey:NSFontAttributeName];
|
||||
[attributes setObject:textBackground forKey:NSBackgroundColorAttributeName];
|
||||
|
||||
text = [NSString stringWithContentsOfFile:file];
|
||||
attributedString = [[NSAttributedString alloc] initWithString:text
|
||||
attributes:attributes];
|
||||
[attributedString initWithString:text attributes:attributes];
|
||||
//
|
||||
|
||||
_storage = [[NSTextStorage alloc] init];
|
||||
|
@ -229,7 +274,6 @@
|
|||
{
|
||||
[self _createInternalView];
|
||||
[_intEditorView setEditable:editable];
|
||||
[_intEditorView setBackgroundColor:textBackground];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
|
@ -244,11 +288,12 @@
|
|||
selector:@selector(textDidChange:)
|
||||
name:NSTextDidChangeNotification
|
||||
object:_extEditorView];
|
||||
|
||||
// Inform about future file opening
|
||||
|
||||
// File open was finished
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorWillOpenNotification
|
||||
postNotificationName:PCEditorDidOpenNotification
|
||||
object:self];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -315,31 +360,12 @@
|
|||
object:self];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#endif
|
||||
NSLog(@"PCEditor: %@ dealloc", [_path lastPathComponent]);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
// _window is setReleasedWhenClosed:YES
|
||||
RELEASE(_path);
|
||||
RELEASE(_categoryPath);
|
||||
RELEASE(_intScrollView);
|
||||
RELEASE(_storage);
|
||||
|
||||
// RELEASE(parserClasses);
|
||||
RELEASE(parserMethods);
|
||||
RELEASE(aParser);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Accessory methods
|
||||
// ===========================================================================
|
||||
|
||||
//--- CodeEditor protocol
|
||||
|
||||
- (id)projectEditor
|
||||
{
|
||||
return projectEditor;
|
||||
|
@ -411,6 +437,84 @@
|
|||
_isEdited = yn;
|
||||
}
|
||||
|
||||
- (NSImage *)fileIcon
|
||||
{
|
||||
NSString *fileExtension = [[_path lastPathComponent] uppercaseString];
|
||||
NSString *imageName = nil;
|
||||
NSString *imagePath = nil;
|
||||
NSBundle *bundle = nil;
|
||||
NSImage *image = nil;
|
||||
|
||||
fileExtension = [[[_path lastPathComponent] pathExtension] uppercaseString];
|
||||
if (_isEdited)
|
||||
{
|
||||
imageName = [NSString stringWithFormat:@"File%@H", fileExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
imageName = [NSString stringWithFormat:@"File%@", fileExtension];
|
||||
}
|
||||
|
||||
bundle = [NSBundle bundleForClass:NSClassFromString(@"PCEditor")];
|
||||
imagePath = [bundle pathForResource:imageName ofType:@"tiff"];
|
||||
|
||||
image = [[NSImage alloc] initWithContentsOfFile:imagePath];
|
||||
|
||||
return AUTORELEASE(image);
|
||||
}
|
||||
|
||||
- (NSArray *)browserItemsForItem:(NSString *)item
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSDictionary *method;
|
||||
NSDictionary *class;
|
||||
NSMutableArray *items;
|
||||
|
||||
NSLog(@"PCEditor: asked for browser items for: %@", item);
|
||||
|
||||
[aParser setString:[_storage string]];
|
||||
|
||||
// If item is .m or .h file show class list
|
||||
if ([[item pathExtension] isEqualToString:@"m"]
|
||||
|| [[item pathExtension] isEqualToString:@"h"])
|
||||
{
|
||||
ASSIGN(parserClasses, [aParser classNames]);
|
||||
|
||||
NSLog(@"Class names %@@", parserClasses);
|
||||
|
||||
items = [NSMutableArray array];
|
||||
enumerator = [parserClasses objectEnumerator];
|
||||
while ((class = [enumerator nextObject]))
|
||||
{
|
||||
NSLog(@"Class> %@", class);
|
||||
[items addObject:[class objectForKey:@"ClassName"]];
|
||||
}
|
||||
}
|
||||
|
||||
// If item starts with "@" show method list
|
||||
if ([[item substringToIndex:1] isEqualToString:@"@"])
|
||||
{
|
||||
ASSIGN(parserMethods, [aParser methodNames]);
|
||||
|
||||
items = [NSMutableArray array];
|
||||
enumerator = [parserMethods objectEnumerator];
|
||||
while ((method = [enumerator nextObject]))
|
||||
{
|
||||
// NSLog(@"Method> %@", method);
|
||||
[items addObject:[method objectForKey:@"MethodName"]];
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
- (NSMenu *)menu
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
//--- protocol end
|
||||
|
||||
- (BOOL)isWindowed
|
||||
{
|
||||
return _isWindowed;
|
||||
|
@ -461,9 +565,28 @@
|
|||
|
||||
- (BOOL)saveFile
|
||||
{
|
||||
[self setIsEdited:NO];
|
||||
BOOL saved = NO;
|
||||
|
||||
return [[_storage string] writeToFile:_path atomically:YES];
|
||||
if (_isEdited == NO)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorWillSaveNotification
|
||||
object:self];
|
||||
|
||||
saved = [[_storage string] writeToFile:_path atomically:YES];
|
||||
|
||||
if (saved == YES)
|
||||
{
|
||||
[self setIsEdited:NO];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorDidSaveNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
- (BOOL)saveFileTo:(NSString *)path
|
||||
|
@ -478,6 +601,15 @@
|
|||
NSDictionary *at = nil;
|
||||
NSFont *ft = nil;
|
||||
|
||||
if (_isEdited == NO)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorWillRevertNotification
|
||||
object:self];
|
||||
|
||||
// This is temporary
|
||||
ft = [NSFont userFixedPitchFontOfSize:0.0];
|
||||
at = [NSDictionary dictionaryWithObject:ft forKey:NSFontAttributeName];
|
||||
|
@ -492,6 +624,10 @@
|
|||
[_intEditorView setNeedsDisplay:YES];
|
||||
[_extEditorView setNeedsDisplay:YES];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorDidRevertNotification
|
||||
object:self];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -611,10 +747,45 @@
|
|||
if ([object isKindOfClass:[PCEditorView class]]
|
||||
&& (object == _intEditorView || object == _extEditorView))
|
||||
{
|
||||
[self setIsEdited:YES];
|
||||
if (_isEdited == NO)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorWillChangeNotification
|
||||
object:self];
|
||||
|
||||
[self setIsEdited:YES];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCEditorDidChangeNotification
|
||||
object:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)textViewDidChangeSelection:(NSNotification *)notification
|
||||
{
|
||||
if (editorTextViewIsPressingKey == NO)
|
||||
{
|
||||
[self computeNewParenthesisNesting];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)editorTextViewWillPressKey:sender
|
||||
{
|
||||
editorTextViewIsPressingKey = YES;
|
||||
// NSLog(@"Will pressing key");
|
||||
|
||||
[self unhighlightCharacter];
|
||||
}
|
||||
|
||||
- (void)editorTextViewDidPressKey:sender
|
||||
{
|
||||
// NSLog(@"Did pressing key");
|
||||
[self computeNewParenthesisNesting];
|
||||
|
||||
editorTextViewIsPressingKey = NO;
|
||||
}
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
@ -637,57 +808,12 @@
|
|||
// ==== Parser and scrolling
|
||||
// ===========================================================================
|
||||
|
||||
// ==== Parsing
|
||||
|
||||
- (BOOL)providesChildrenForBrowserItem:(NSString *)item
|
||||
{
|
||||
}
|
||||
|
||||
// protocol
|
||||
- (NSArray *)browserItemsForItem:(NSString *)item
|
||||
{
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSDictionary *method = nil;
|
||||
NSMutableArray *methodNames = nil;
|
||||
|
||||
NSLog(@"PCEditor: asked for browser items");
|
||||
|
||||
// If item is .m or .h file show class list
|
||||
/* if ([[item pathExtension] isEqualToString:@"m"]
|
||||
|| [[item pathExtension] isEqualToString:@"h"])
|
||||
{
|
||||
return [aParser classNames];
|
||||
}
|
||||
|
||||
// If item starts with "@" show method list
|
||||
if ([[item substringToIndex:1] isEqualToString:@"@"])
|
||||
{
|
||||
}*/
|
||||
|
||||
/* if (aParser)
|
||||
{
|
||||
[aParser setString:[_storage string]];
|
||||
NSLog(@"===\nMethods list:\n%@\n\n", [aParser methods]);
|
||||
}*/
|
||||
|
||||
[aParser setString:[_storage string]];
|
||||
|
||||
// Methods
|
||||
ASSIGN(parserMethods, [aParser methodNames]);
|
||||
|
||||
methodNames = [NSMutableArray array];
|
||||
enumerator = [parserMethods objectEnumerator];
|
||||
while ((method = [enumerator nextObject]))
|
||||
{
|
||||
// NSLog(@"Method> %@", method);
|
||||
[methodNames addObject:[method objectForKey:@"MethodName"]];
|
||||
}
|
||||
|
||||
return methodNames;
|
||||
}
|
||||
|
||||
// === Scrolling
|
||||
|
||||
- (void)fileStructureItemSelected:(NSString *)item
|
||||
{
|
||||
}
|
||||
|
||||
- (void)scrollToClassName:(NSString *)className
|
||||
{
|
||||
}
|
||||
|
@ -719,8 +845,408 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)scrollToLineNumber:(int)line
|
||||
- (void)scrollToLineNumber:(unsigned int)lineNumber
|
||||
{
|
||||
unsigned int offset;
|
||||
unsigned int i;
|
||||
NSString *line;
|
||||
NSEnumerator *e;
|
||||
NSArray *lines;
|
||||
NSRange range;
|
||||
|
||||
lines = [[_intEditorView string] componentsSeparatedByString: @"\n"];
|
||||
e = [lines objectEnumerator];
|
||||
|
||||
for (offset = 0, i = 1;
|
||||
(line = [e nextObject]) != nil && i < lineNumber;
|
||||
i++, offset += [line length] + 1);
|
||||
|
||||
if (line != nil)
|
||||
{
|
||||
range = NSMakeRange(offset, [line length]);
|
||||
}
|
||||
else
|
||||
{
|
||||
range = NSMakeRange([[_intEditorView string] length], 0);
|
||||
}
|
||||
[_intEditorView setSelectedRange:range];
|
||||
[_intEditorView scrollRangeToVisible:range];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCEditor (Menu)
|
||||
|
||||
- (void)pipeOutputOfCommand:(NSString *)command
|
||||
{
|
||||
NSTask * task;
|
||||
NSPipe * inPipe, * outPipe;
|
||||
NSString * inString, * outString;
|
||||
NSFileHandle * inputHandle;
|
||||
|
||||
inString = [[_intEditorView string] substringWithRange:
|
||||
[_intEditorView selectedRange]];
|
||||
inPipe = [NSPipe pipe];
|
||||
outPipe = [NSPipe pipe];
|
||||
|
||||
task = [[NSTask new] autorelease];
|
||||
|
||||
[task setLaunchPath: @"/bin/sh"];
|
||||
[task setArguments: [NSArray arrayWithObjects: @"-c", command, nil]];
|
||||
[task setStandardInput: inPipe];
|
||||
[task setStandardOutput: outPipe];
|
||||
[task setStandardError: outPipe];
|
||||
|
||||
inputHandle = [inPipe fileHandleForWriting];
|
||||
|
||||
[task launch];
|
||||
[inputHandle writeData: [inString
|
||||
dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
[inputHandle closeFile];
|
||||
[task waitUntilExit];
|
||||
outString = [[[NSString alloc]
|
||||
initWithData: [[outPipe fileHandleForReading] availableData]
|
||||
encoding: NSUTF8StringEncoding]
|
||||
autorelease];
|
||||
if ([task terminationStatus] != 0)
|
||||
{
|
||||
if (NSRunAlertPanel(_(@"Error running command"),
|
||||
_(@"The command returned with a non-zero exit status"
|
||||
@" -- aborting pipe.\n"
|
||||
@"Do you want to see the command's output?\n"),
|
||||
_(@"No"), _(@"Yes"), nil) == NSAlertAlternateReturn)
|
||||
{
|
||||
NSRunAlertPanel(_(@"The command's output"),
|
||||
outString, nil, nil, nil);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[_intEditorView replaceCharactersInRange:[_intEditorView selectedRange]
|
||||
withString:outString];
|
||||
[self textDidChange: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)findNext:sender
|
||||
{
|
||||
// [[TextFinder sharedInstance] findNext: self];
|
||||
}
|
||||
|
||||
- (void)findPrevious:sender
|
||||
{
|
||||
// [[TextFinder sharedInstance] findPrevious: self];
|
||||
}
|
||||
|
||||
- (void)jumpToSelection:sender
|
||||
{
|
||||
[_intEditorView scrollRangeToVisible:[_intEditorView selectedRange]];
|
||||
}
|
||||
|
||||
- (void)goToLine:sender
|
||||
{
|
||||
/* LineQueryPanel * lqp = [LineQueryPanel shared];
|
||||
|
||||
if ([lqp runModal] == NSOKButton)
|
||||
{
|
||||
[self goToLineNumber: (unsigned int) [lqp unsignedIntValue]];
|
||||
}*/
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Checks whether a character is a delimiter.
|
||||
*
|
||||
* This function checks whether `character' is a delimiter character,
|
||||
* (i.e. one of "(", ")", "[", "]", "{", "}") and returns YES if it
|
||||
* is and NO if it isn't. Additionaly, if `character' is a delimiter,
|
||||
* `oppositeDelimiter' is set to a string denoting it's opposite
|
||||
* delimiter and `searchBackwards' is set to YES if the opposite
|
||||
* delimiter is located before the checked delimiter character, or
|
||||
* to NO if it is located after the delimiter character.
|
||||
*/
|
||||
static inline BOOL CheckDelimiter(unichar character,
|
||||
unichar * oppositeDelimiter,
|
||||
BOOL * searchBackwards)
|
||||
{
|
||||
if (character == '(')
|
||||
{
|
||||
*oppositeDelimiter = ')';
|
||||
*searchBackwards = NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if (character == ')')
|
||||
{
|
||||
*oppositeDelimiter = '(';
|
||||
*searchBackwards = YES;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if (character == '[')
|
||||
{
|
||||
*oppositeDelimiter = ']';
|
||||
*searchBackwards = NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if (character == ']')
|
||||
{
|
||||
*oppositeDelimiter = '[';
|
||||
*searchBackwards = YES;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if (character == '{')
|
||||
{
|
||||
*oppositeDelimiter = '}';
|
||||
*searchBackwards = NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if (character == '}')
|
||||
{
|
||||
*oppositeDelimiter = '{';
|
||||
*searchBackwards = YES;
|
||||
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to find a delimiter in a certain string around a certain location.
|
||||
*
|
||||
* Attempts to locate `delimiter' in `string', starting at
|
||||
* location `startLocation' a searching forwards (backwards if
|
||||
* searchBackwards = YES) at most 1000 characters. The argument
|
||||
* `oppositeDelimiter' denotes what is considered to be the opposite
|
||||
* delimiter of the one being search for, so that nested delimiters
|
||||
* are ignored correctly.
|
||||
*
|
||||
* @return The location of the delimiter if it is found, or NSNotFound
|
||||
* if it isn't.
|
||||
*/
|
||||
unsigned int FindDelimiterInString(NSString * string,
|
||||
unichar delimiter,
|
||||
unichar oppositeDelimiter,
|
||||
unsigned int startLocation,
|
||||
BOOL searchBackwards)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int length;
|
||||
unichar (*charAtIndex)(id, SEL, unsigned int);
|
||||
SEL sel = @selector(characterAtIndex:);
|
||||
int nesting = 1;
|
||||
|
||||
charAtIndex = (unichar (*)(id, SEL, unsigned int)) [string
|
||||
methodForSelector: sel];
|
||||
|
||||
if (searchBackwards)
|
||||
{
|
||||
if (startLocation < 1000)
|
||||
length = startLocation;
|
||||
else
|
||||
length = 1000;
|
||||
|
||||
for (i=1; i <= length; i++)
|
||||
{
|
||||
unichar c;
|
||||
|
||||
c = charAtIndex(string, sel, startLocation - i);
|
||||
if (c == delimiter)
|
||||
nesting--;
|
||||
else if (c == oppositeDelimiter)
|
||||
nesting++;
|
||||
|
||||
if (nesting == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i > length)
|
||||
return NSNotFound;
|
||||
else
|
||||
return startLocation - i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([string length] < startLocation + 1000)
|
||||
length = [string length] - startLocation;
|
||||
else
|
||||
length = 1000;
|
||||
|
||||
for (i=1; i < length; i++)
|
||||
{
|
||||
unichar c;
|
||||
|
||||
c = charAtIndex(string, sel, startLocation + i);
|
||||
if (c == delimiter)
|
||||
nesting--;
|
||||
else if (c == oppositeDelimiter)
|
||||
nesting++;
|
||||
|
||||
if (nesting == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == length)
|
||||
return NSNotFound;
|
||||
else
|
||||
return startLocation + i;
|
||||
}
|
||||
}
|
||||
|
||||
@implementation PCEditor (Parentesis)
|
||||
|
||||
- (void)unhighlightCharacter
|
||||
{
|
||||
if (isCharacterHighlit)
|
||||
{
|
||||
NSTextStorage *textStorage = [_intEditorView textStorage];
|
||||
NSRange r = NSMakeRange(highlitCharacterLocation, 1);
|
||||
|
||||
NSLog(@"highlight");
|
||||
|
||||
isCharacterHighlit = NO;
|
||||
|
||||
[textStorage beginEditing];
|
||||
|
||||
// restore the character's color and font attributes
|
||||
if (previousFont != nil)
|
||||
{
|
||||
[textStorage addAttribute: NSFontAttributeName
|
||||
value: previousFont
|
||||
range: r];
|
||||
}
|
||||
else
|
||||
{
|
||||
[textStorage removeAttribute: NSFontAttributeName range: r];
|
||||
}
|
||||
|
||||
if (previousFGColor != nil)
|
||||
{
|
||||
[textStorage addAttribute: NSForegroundColorAttributeName
|
||||
value: previousFGColor
|
||||
range: r];
|
||||
}
|
||||
else
|
||||
{
|
||||
[textStorage removeAttribute: NSForegroundColorAttributeName
|
||||
range: r];
|
||||
}
|
||||
|
||||
if (previousBGColor != nil)
|
||||
{
|
||||
[textStorage addAttribute: NSBackgroundColorAttributeName
|
||||
value: previousBGColor
|
||||
range: r];
|
||||
}
|
||||
else
|
||||
{
|
||||
[textStorage removeAttribute: NSBackgroundColorAttributeName
|
||||
range: r];
|
||||
}
|
||||
|
||||
[textStorage endEditing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)highlightCharacterAt:(unsigned int)location
|
||||
{
|
||||
if (isCharacterHighlit == NO)
|
||||
{
|
||||
NSTextStorage * textStorage = [_intEditorView textStorage];
|
||||
NSRange r = NSMakeRange(location, 1);
|
||||
NSRange tmp;
|
||||
|
||||
NSLog(@"highlight");
|
||||
|
||||
highlitCharacterLocation = location;
|
||||
|
||||
isCharacterHighlit = YES;
|
||||
|
||||
[textStorage beginEditing];
|
||||
|
||||
// store the previous character's attributes
|
||||
ASSIGN(previousFGColor,
|
||||
[textStorage attribute: NSForegroundColorAttributeName
|
||||
atIndex: location
|
||||
effectiveRange: &tmp]);
|
||||
ASSIGN(previousBGColor,
|
||||
[textStorage attribute: NSBackgroundColorAttributeName
|
||||
atIndex: location
|
||||
effectiveRange: &tmp]);
|
||||
ASSIGN(previousFont, [textStorage attribute: NSFontAttributeName
|
||||
atIndex: location
|
||||
effectiveRange: &tmp]);
|
||||
|
||||
[textStorage addAttribute: NSFontAttributeName
|
||||
value: highlightFont
|
||||
range: r];
|
||||
[textStorage addAttribute: NSForegroundColorAttributeName
|
||||
value: highlightColor
|
||||
range: r];
|
||||
|
||||
[textStorage removeAttribute: NSBackgroundColorAttributeName
|
||||
range: r];
|
||||
|
||||
[textStorage endEditing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)computeNewParenthesisNesting
|
||||
{
|
||||
NSRange selectedRange;
|
||||
NSString * myString;
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DontTrackNesting"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
selectedRange = [_intEditorView selectedRange];
|
||||
|
||||
// make sure we un-highlight a previously highlit delimiter
|
||||
[self unhighlightCharacter];
|
||||
|
||||
// if we have a character at the selected location, check
|
||||
// to see if it is a delimiter character
|
||||
myString = [_intEditorView string];
|
||||
if (selectedRange.length <= 1 && [myString length] > selectedRange.location)
|
||||
{
|
||||
unichar c;
|
||||
// we must initialize these explicitly in order to make
|
||||
// gcc shut up about flow control
|
||||
unichar oppositeDelimiter = 0;
|
||||
BOOL searchBackwards = NO;
|
||||
|
||||
c = [myString characterAtIndex: selectedRange.location];
|
||||
|
||||
// if it is, search for the opposite delimiter in a range
|
||||
// of at most 1000 characters around it in either forward
|
||||
// or backward direction (depends on the kind of delimiter
|
||||
// we're searching for).
|
||||
if (CheckDelimiter(c, &oppositeDelimiter, &searchBackwards))
|
||||
{
|
||||
unsigned int result;
|
||||
|
||||
result = FindDelimiterInString(myString,
|
||||
oppositeDelimiter,
|
||||
c,
|
||||
selectedRange.location,
|
||||
searchBackwards);
|
||||
|
||||
// and in case a delimiter is found, highlight it
|
||||
if (result != NSNotFound)
|
||||
{
|
||||
[self highlightCharacterAt: result];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
/*#import <AppKit/NSView.h>
|
||||
#import <AppKit/NSTextView.h>*/
|
||||
#import <AppKit/NSTextView.h>
|
||||
|
||||
@class NSColor;
|
||||
@class PCEditor;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Implementation of the PCEditorView class for the
|
||||
ProjectManager application.
|
||||
|
||||
Copyright (C) 2005 Saso Kiselkov
|
||||
Copyright (C) 2006 Saso Kiselkov, Sergii Stoian
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,8 +40,7 @@
|
|||
#import "PCEditor.h"
|
||||
#import "SyntaxHighlighter.h"
|
||||
|
||||
static inline float
|
||||
my_abs(float aValue)
|
||||
static inline float my_abs(float aValue)
|
||||
{
|
||||
if (aValue >= 0)
|
||||
{
|
||||
|
@ -125,7 +124,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
|
||||
@interface PCEditorView (Private)
|
||||
|
||||
- (void) insertSpaceFillAlignedAtTabsOfSize: (unsigned int) tabSize;
|
||||
- (void)insertSpaceFillAlignedAtTabsOfSize:(unsigned int)tabSize;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -137,7 +136,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
*
|
||||
* @argument tabSize Specifies how many spaces represent one tab.
|
||||
*/
|
||||
- (void) insertSpaceFillAlignedAtTabsOfSize: (unsigned int) tabSize
|
||||
- (void)insertSpaceFillAlignedAtTabsOfSize:(unsigned int)tabSize
|
||||
{
|
||||
char buf[tabSize];
|
||||
NSString * string = [self string];
|
||||
|
@ -174,51 +173,51 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
|
||||
@implementation PCEditorView
|
||||
|
||||
+ (NSFont *) defaultEditorFont
|
||||
+ (NSFont *)defaultEditorFont
|
||||
{
|
||||
NSUserDefaults * df = [NSUserDefaults standardUserDefaults];
|
||||
NSString * fontName;
|
||||
float fontSize;
|
||||
NSFont * font = nil;
|
||||
NSUserDefaults *df = [NSUserDefaults standardUserDefaults];
|
||||
NSString *fontName;
|
||||
float fontSize;
|
||||
NSFont *font;
|
||||
|
||||
fontName = [df objectForKey:@"EditorFont"];
|
||||
fontSize = [df floatForKey:@"EditorFontSize"];
|
||||
|
||||
if (fontName != nil)
|
||||
{
|
||||
font = [NSFont fontWithName: fontName size: fontSize];
|
||||
font = [NSFont fontWithName:fontName size:fontSize];
|
||||
}
|
||||
if (font == nil)
|
||||
{
|
||||
font = [NSFont userFixedPitchFontOfSize: fontSize];
|
||||
font = [NSFont userFixedPitchFontOfSize:fontSize];
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
+ (NSFont *) defaultEditorBoldFont
|
||||
+ (NSFont *)defaultEditorBoldFont
|
||||
{
|
||||
NSFont * font = [self defaultEditorFont];
|
||||
NSFont *font = [self defaultEditorFont];
|
||||
|
||||
return [[NSFontManager sharedFontManager] convertFont: font
|
||||
toHaveTrait: NSBoldFontMask];
|
||||
return [[NSFontManager sharedFontManager] convertFont:font
|
||||
toHaveTrait:NSBoldFontMask];
|
||||
}
|
||||
|
||||
+ (NSFont *) defaultEditorItalicFont
|
||||
+ (NSFont *)defaultEditorItalicFont
|
||||
{
|
||||
NSFont * font = [self defaultEditorFont];
|
||||
NSFont *font = [self defaultEditorFont];
|
||||
|
||||
return [[NSFontManager sharedFontManager] convertFont: font
|
||||
toHaveTrait: NSItalicFontMask];
|
||||
return [[NSFontManager sharedFontManager] convertFont:font
|
||||
toHaveTrait:NSItalicFontMask];
|
||||
}
|
||||
|
||||
+ (NSFont *) defaultEditorBoldItalicFont
|
||||
+ (NSFont *)defaultEditorBoldItalicFont
|
||||
{
|
||||
NSFont * font = [self defaultEditorFont];
|
||||
NSFont *font = [self defaultEditorFont];
|
||||
|
||||
return [[NSFontManager sharedFontManager] convertFont: font
|
||||
toHaveTrait: NSBoldFontMask |
|
||||
NSItalicFontMask];
|
||||
return [[NSFontManager sharedFontManager] convertFont:font
|
||||
toHaveTrait:NSBoldFontMask |
|
||||
NSItalicFontMask];
|
||||
}
|
||||
|
||||
// ---
|
||||
|
@ -238,7 +237,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
}
|
||||
// ---
|
||||
|
||||
- (void) dealloc
|
||||
- (void)dealloc
|
||||
{
|
||||
TEST_RELEASE(highlighter);
|
||||
|
||||
|
@ -247,10 +246,10 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
|
||||
- (void)setEditor:(PCEditor *)anEditor
|
||||
{
|
||||
ASSIGN(editor, anEditor);
|
||||
editor = anEditor;
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
/* NSData * data;
|
||||
NSUserDefaults * df = [NSUserDefaults standardUserDefaults];
|
||||
|
@ -285,9 +284,8 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
- (void)createSyntaxHighlighterForFileType:(NSString *)fileType
|
||||
{
|
||||
ASSIGN(highlighter, [[[SyntaxHighlighter alloc]
|
||||
initWithFileType: fileType textStorage: [self textStorage]]
|
||||
autorelease]);
|
||||
// [highlighter highlightRange: NSMakeRange(0, [[self string] length])];
|
||||
initWithFileType:fileType
|
||||
textStorage:[self textStorage]] autorelease]);
|
||||
}
|
||||
|
||||
- (void)insertText:text
|
||||
|
@ -364,16 +362,16 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
*/
|
||||
- (void)keyDown:(NSEvent *)ev
|
||||
{
|
||||
// [editorDocument editorTextViewWillPressKey: self];
|
||||
[editor editorTextViewWillPressKey: self];
|
||||
[super keyDown:ev];
|
||||
// [editorDocument editorTextViewDidPressKey: self];
|
||||
[editor editorTextViewDidPressKey: self];
|
||||
}
|
||||
|
||||
- (void)paste:sender
|
||||
{
|
||||
// [editorDocument editorTextViewWillPressKey: self];
|
||||
[editor editorTextViewWillPressKey:self];
|
||||
[super paste:sender];
|
||||
// [editorDocument editorTextViewDidPressKey: self];
|
||||
[editor editorTextViewDidPressKey:self];
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent *)ev
|
||||
|
|
BIN
Modules/Editors/ProjectCenter/Resources/FileC.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileC.tiff
Normal file
Binary file not shown.
BIN
Modules/Editors/ProjectCenter/Resources/FileCH.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileCH.tiff
Normal file
Binary file not shown.
BIN
Modules/Editors/ProjectCenter/Resources/FileH.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileH.tiff
Normal file
Binary file not shown.
BIN
Modules/Editors/ProjectCenter/Resources/FileHH.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileHH.tiff
Normal file
Binary file not shown.
BIN
Modules/Editors/ProjectCenter/Resources/FileM.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileM.tiff
Normal file
Binary file not shown.
BIN
Modules/Editors/ProjectCenter/Resources/FileMH.tiff
Normal file
BIN
Modules/Editors/ProjectCenter/Resources/FileMH.tiff
Normal file
Binary file not shown.
|
@ -368,7 +368,7 @@
|
|||
{
|
||||
Beginning = "/\\*";
|
||||
Ending = "\\*/";
|
||||
ForegroundColor = "0.4 0.4 0.4";
|
||||
ForegroundColor = "0.0 0.0 1.0";
|
||||
Italic = YES;
|
||||
},
|
||||
|
||||
|
@ -376,7 +376,7 @@
|
|||
{
|
||||
Beginning = "//";
|
||||
Ending = "\n";
|
||||
ForegroundColor = "0.4 0.4 0.4";
|
||||
ForegroundColor = "0.0 0.0 1.0";
|
||||
Italic = YES;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -748,16 +748,16 @@ LocateString(NSString * str,
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) highlightRange: (NSRange) r
|
||||
- (void)highlightRange:(NSRange)r
|
||||
{
|
||||
if (delayedProcessedRange.length > 0)
|
||||
{
|
||||
[self beginEditingIfNeeded];
|
||||
[self fixUpContextsInRange: delayedProcessedRange];
|
||||
[self fixUpKeywordsInRange: delayedProcessedRange];
|
||||
[self fixUpContextsInRange:delayedProcessedRange];
|
||||
[self fixUpKeywordsInRange:delayedProcessedRange];
|
||||
|
||||
if ([self contextAtEndOfRange: delayedProcessedRange] !=
|
||||
[self contextAfterRange: delayedProcessedRange])
|
||||
if ([self contextAtEndOfRange:delayedProcessedRange] !=
|
||||
[self contextAfterRange:delayedProcessedRange])
|
||||
{
|
||||
NSRange invalidatedRange;
|
||||
|
||||
|
@ -765,9 +765,9 @@ LocateString(NSString * str,
|
|||
|
||||
invalidatedRange = NSMakeRange(NSMaxRange(delayedProcessedRange),
|
||||
[textStorage length] - NSMaxRange(delayedProcessedRange));
|
||||
[textStorage addAttribute: KeywordsNotFixedAttributeName
|
||||
value: [NSNull null]
|
||||
range: invalidatedRange];
|
||||
[textStorage addAttribute:KeywordsNotFixedAttributeName
|
||||
value:[NSNull null]
|
||||
range:invalidatedRange];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -7,8 +7,8 @@ ADDITIONAL_CPPFLAGS +=
|
|||
ADDITIONAL_INCLUDE_DIRS += -I../../../ -I../../../Headers
|
||||
ADDITIONAL_LIB_DIRS += -L../../../Library/ProjectCenter.framework/Versions/Current
|
||||
|
||||
# BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources
|
||||
$(BUNDLE_NAME)_STANDARD_INSTALL = no
|
||||
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources
|
||||
# $(BUNDLE_NAME)_STANDARD_INSTALL = no
|
||||
|
||||
DO_LIB_LINK=no
|
||||
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||
|
|
|
@ -29,6 +29,7 @@ ProjectCenter_HEADERS= \
|
|||
PCParser.h \
|
||||
CodeHandler.h \
|
||||
ObjCCommentHandler.h \
|
||||
ObjCClassHandler.h \
|
||||
ObjCMethodHandler.h
|
||||
|
||||
#
|
||||
|
@ -37,6 +38,7 @@ ProjectCenter_HEADERS= \
|
|||
ProjectCenter_OBJC_FILES= \
|
||||
PCParser.m \
|
||||
ObjCCommentHandler.m \
|
||||
ObjCClassHandler.m \
|
||||
ObjCMethodHandler.m
|
||||
|
||||
include ../../GNUmakefile.bundles
|
||||
|
|
|
@ -28,24 +28,26 @@
|
|||
#include "ObjCCommentHandler.h"
|
||||
|
||||
/**
|
||||
* ClassStart ClassSymbol ClassName ClassEnd
|
||||
* @interface/@implementation Name ;/{
|
||||
*
|
||||
* ClassStart ClassSymbol ClassName ClassSuper ClassProto | ClassCategory
|
||||
* @... CName : CSuper < Protocol > | ( Category )
|
||||
*
|
||||
* MethodStart is after each ';' or new line
|
||||
* MethodSymbol is +/- for objective-C
|
||||
* MethodReturnValue is surround by '(' and ')', and can be ignore
|
||||
* MethodName contain method name and messages
|
||||
* MethodNone is not method;
|
||||
* ClassStart is after each ';' or new line
|
||||
* ClassSymbol is '@' with 'interface'/'implementation' after that
|
||||
* ClassName started after ClassSymbol and next first ' '
|
||||
* ClassCategory is surround by '(' and ')'. Started after ClassName and ' '
|
||||
* ClassNone is not method;
|
||||
*/
|
||||
|
||||
typedef enum _CheckStep {
|
||||
typedef enum _CS {
|
||||
ClassStart,
|
||||
ClassSymbol,
|
||||
ClassReturnValue,
|
||||
ClassName,
|
||||
ClassNone
|
||||
} CheckStep;
|
||||
ClassName,
|
||||
ClassSuper,
|
||||
ClassProto,
|
||||
ClassCategory,
|
||||
ClassBody,
|
||||
ClassNone,
|
||||
} CS;
|
||||
|
||||
|
||||
@class NSMutableString;
|
||||
|
@ -56,18 +58,27 @@ typedef enum _CheckStep {
|
|||
unsigned int position;
|
||||
|
||||
BOOL inSpace;
|
||||
NSMutableString *keyword;
|
||||
NSMutableString *class;
|
||||
NSMutableArray *classes;
|
||||
unichar _preSymbol;
|
||||
unsigned classBeginPosition;
|
||||
unsigned nameBeginPosition;
|
||||
unsigned nameEndPosition;
|
||||
unsigned bodyBeginPosition;
|
||||
int bodySymbolCount;
|
||||
|
||||
CheckStep step;
|
||||
CS step;
|
||||
CS prev_step;
|
||||
}
|
||||
|
||||
// NSArray of NSDictionaries
|
||||
// (method = NSString; position = NSNumber)
|
||||
// ClassName = NSString;
|
||||
// ClassNameRange = NSString <- NSStringFromRange(NSRange)
|
||||
// ClassBodyRange = NSString <- NSStringFromRange(NSRange)
|
||||
- (NSArray *)classes;
|
||||
|
||||
- (void)addClassToArray;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* _ObjCClassHandler_H_ */
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include "ObjCClassHandler.h"
|
||||
#import "ObjCClassHandler.h"
|
||||
|
||||
@implementation ObjCClassHandler
|
||||
|
||||
|
@ -30,12 +30,17 @@
|
|||
{
|
||||
self = [super init];
|
||||
position = 0;
|
||||
classBeginPosition = 0;
|
||||
nameBeginPosition = 0;
|
||||
nameEndPosition = 0;
|
||||
bodyBeginPosition = 0;
|
||||
bodySymbolCount = -1;
|
||||
|
||||
inSpace = NO;
|
||||
keyword = [[NSMutableString alloc] init];
|
||||
class = [[NSMutableString alloc] init];
|
||||
classes = [[NSMutableArray alloc] init];
|
||||
|
||||
prev_step = ClassNone;
|
||||
step = ClassNone;
|
||||
_preSymbol = 0;
|
||||
|
||||
|
@ -45,6 +50,7 @@
|
|||
- (void)dealloc
|
||||
{
|
||||
NSLog(@"ClassHandler: dealloc");
|
||||
RELEASE(keyword);
|
||||
RELEASE(class);
|
||||
RELEASE(classes);
|
||||
[super dealloc];
|
||||
|
@ -52,7 +58,35 @@
|
|||
|
||||
- (NSArray *)classes
|
||||
{
|
||||
return methods;
|
||||
return classes;
|
||||
}
|
||||
|
||||
- (void)addClassToArray
|
||||
{
|
||||
// NSLog(@"OCCH: class: %@", class);
|
||||
if ([class length])
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSString *dClass;
|
||||
NSString *dNRange;
|
||||
NSString *dBRange;
|
||||
|
||||
dClass = [class copy];
|
||||
dNRange = NSStringFromRange(NSMakeRange(nameBeginPosition,
|
||||
nameEndPosition-nameBeginPosition));
|
||||
dBRange = NSStringFromRange(NSMakeRange(bodyBeginPosition,
|
||||
position-bodyBeginPosition));
|
||||
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
dClass, @"ClassName",
|
||||
dNRange, @"ClassNameRange",
|
||||
dBRange, @"ClassBodyRange",
|
||||
nil];
|
||||
|
||||
[classes addObject:dict];
|
||||
RELEASE(dClass);
|
||||
}
|
||||
[class setString:@""];
|
||||
}
|
||||
|
||||
#define NotClass {step = ClassNone; [class setString: @""];}
|
||||
|
@ -61,16 +95,16 @@
|
|||
{
|
||||
unsigned int len = [element length];
|
||||
|
||||
[super string: element];
|
||||
[super string:element];
|
||||
|
||||
/* Comments */
|
||||
if (_commentType != NoComment)
|
||||
{
|
||||
}
|
||||
else if (_stringBegin/* != NoString*/)
|
||||
else if (_stringBegin /* != NoString*/)
|
||||
{
|
||||
}
|
||||
else
|
||||
else if (step != ClassNone)
|
||||
{
|
||||
inSpace = NO;
|
||||
|
||||
|
@ -78,25 +112,13 @@
|
|||
{
|
||||
NotClass;
|
||||
}
|
||||
else if (step == MethodSymbol)
|
||||
else if (step == ClassSymbol)
|
||||
{
|
||||
if (_preSymbol == '(')
|
||||
step = MethodReturnValue;
|
||||
else if ((_preSymbol == '+') || (_preSymbol == '='))
|
||||
step = MethodName;
|
||||
|
||||
[method appendString: element];
|
||||
[keyword appendString:element];
|
||||
}
|
||||
else if (step == MethodReturnValue)
|
||||
else if ((step == ClassName) || (step == ClassCategory))
|
||||
{
|
||||
if (_preSymbol == ')')
|
||||
step = MethodName;
|
||||
|
||||
[method appendString: element];
|
||||
}
|
||||
else if (step == MethodName)
|
||||
{
|
||||
[method appendString: element];
|
||||
[class appendString:element];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +128,7 @@
|
|||
|
||||
- (void)number:(NSString *)element
|
||||
{
|
||||
[super number: element];
|
||||
[super number:element];
|
||||
|
||||
/* Comments */
|
||||
if (_commentType != NoComment)
|
||||
|
@ -123,13 +145,17 @@
|
|||
{
|
||||
NotClass;
|
||||
}
|
||||
else if (step == ClassSymbol)
|
||||
/* else if (step == ClassSymbol)
|
||||
{
|
||||
NotClass;
|
||||
}
|
||||
else if ((step == ClassName))
|
||||
else if (step == ClassCategory)
|
||||
{
|
||||
[class appendString: element];
|
||||
NotClass;
|
||||
}*/
|
||||
else if (step == ClassName)
|
||||
{
|
||||
[class appendString:element];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +167,7 @@
|
|||
{
|
||||
BOOL newline = NO;
|
||||
|
||||
[super spaceAndNewLine: element];
|
||||
[super spaceAndNewLine:element];
|
||||
|
||||
if ((element == 0x0A) || (element == 0x0D))
|
||||
{
|
||||
|
@ -159,20 +185,52 @@
|
|||
{
|
||||
if (step != ClassNone)
|
||||
{
|
||||
if ((!newline) && (!inSpace))
|
||||
/* if ((!newline) && (!inSpace))
|
||||
{
|
||||
[method appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
if (element == ' ')
|
||||
{
|
||||
inSpace = YES;
|
||||
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
else*/
|
||||
if ((newline || element == ' ') && (step == ClassSymbol))
|
||||
{
|
||||
// NSLog(@"keyword: %@", keyword);
|
||||
if ([keyword isEqualToString:@"end"])
|
||||
{
|
||||
// NSLog(@"@end reached");
|
||||
[self addClassToArray];
|
||||
step = ClassNone;
|
||||
}
|
||||
else if ([keyword isEqualToString:@"interface"] ||
|
||||
[keyword isEqualToString:@"implementation"])
|
||||
{
|
||||
[class appendString:@"@"];
|
||||
step = ClassName;
|
||||
prev_step = ClassNone;
|
||||
nameBeginPosition = position;
|
||||
}
|
||||
[keyword setString:@""];
|
||||
|
||||
if (prev_step == ClassBody)
|
||||
{
|
||||
step = ClassBody;
|
||||
prev_step = ClassNone;
|
||||
}
|
||||
|
||||
inSpace = YES;
|
||||
}
|
||||
else if (newline && (step == ClassName))
|
||||
{
|
||||
// NSLog(@"Class body start: \"%@\"", class);
|
||||
step = ClassBody;
|
||||
nameEndPosition = position - 1;
|
||||
bodyBeginPosition = position;
|
||||
}
|
||||
}
|
||||
|
||||
if (newline && (step == MethodNone))
|
||||
// Class name should start from beginning of line
|
||||
// (some spaces may prepend "@" symbol)
|
||||
if (newline && (step == ClassNone))
|
||||
{
|
||||
step = ClassStart;
|
||||
classBeginPosition = position;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +240,7 @@
|
|||
|
||||
- (void)symbol:(unichar)element
|
||||
{
|
||||
[super symbol: element];
|
||||
[super symbol:element];
|
||||
|
||||
/* Comments */
|
||||
if (_commentType != NoComment)
|
||||
|
@ -196,55 +254,45 @@
|
|||
inSpace = NO;
|
||||
_preSymbol = element;
|
||||
|
||||
if (step == ClassStart)
|
||||
if ((step == ClassStart) || (step == ClassBody))
|
||||
{
|
||||
if ((element == '+') || (element == '-'))
|
||||
{
|
||||
step = ClassSymbol;
|
||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NotClass;
|
||||
}
|
||||
if (element == '@')
|
||||
{
|
||||
prev_step = step;
|
||||
step = ClassSymbol;
|
||||
}
|
||||
}
|
||||
else if (step == ClassSymbol)
|
||||
else if (step == ClassName)
|
||||
{
|
||||
if ((element == '(') || (element == '_'))
|
||||
if (element == '(')
|
||||
{
|
||||
[method appendString: [NSString stringWithFormat:@"%c", element]];
|
||||
step = ClassCategory;
|
||||
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
else if (element == '<')
|
||||
{
|
||||
step = ClassProto;
|
||||
}
|
||||
else if (element == ':')
|
||||
{
|
||||
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
}
|
||||
else if (step == ClassReturnValue)
|
||||
else if (step == ClassCategory)
|
||||
{
|
||||
if (element == ')')
|
||||
{
|
||||
step = ClassName;
|
||||
}
|
||||
[method appendString:[NSString stringWithFormat:@"%c", element]];
|
||||
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
else if (step == ClassName)
|
||||
{
|
||||
if (element != '{')
|
||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
}
|
||||
|
||||
if ((element == ';') || (element == '{') ||
|
||||
(element == '}') || (position == 0))
|
||||
{
|
||||
step = ClassStart;
|
||||
classBeginPosition = position;
|
||||
if ([class length])
|
||||
else if (step == ClassProto)
|
||||
{
|
||||
if (element == '>')
|
||||
{
|
||||
NSDictionary *dict;
|
||||
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
AUTORELEASE([class copy]), @"class",
|
||||
[NSNumber numberWithUnsignedInt:methodBeginPosition], @"position", nil];
|
||||
[methods addObject: dict];
|
||||
step = ClassName;
|
||||
}
|
||||
[class setString:@""];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
position++;
|
||||
|
@ -254,7 +302,7 @@
|
|||
- (void)invisible:(unichar)element
|
||||
{
|
||||
[super invisible:element];
|
||||
position ++;
|
||||
position++;
|
||||
_preChar = element;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,9 @@ typedef enum _CheckStep {
|
|||
MethodBody,
|
||||
MethodSymbol,
|
||||
MethodReturnValue,
|
||||
MethodName,
|
||||
MethodName,
|
||||
MethodParameterStart,
|
||||
MethodParameter,
|
||||
MethodNone
|
||||
} CheckStep;
|
||||
|
||||
|
@ -65,6 +67,7 @@ typedef enum _CheckStep {
|
|||
int bodySymbolCount;
|
||||
|
||||
CheckStep step;
|
||||
CheckStep prev_step;
|
||||
}
|
||||
|
||||
// NSArray of NSDictionaries
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
method = [[NSMutableString alloc] init];
|
||||
methods = [[NSMutableArray alloc] init];
|
||||
|
||||
step = MethodNone;
|
||||
prev_step = step = MethodNone;
|
||||
_preSymbol = 0;
|
||||
|
||||
return self;
|
||||
|
@ -108,30 +108,14 @@
|
|||
{
|
||||
NotMethod;
|
||||
}
|
||||
else if (step == MethodSymbol)
|
||||
{
|
||||
if (_preSymbol == '(')
|
||||
{
|
||||
step = MethodReturnValue;
|
||||
}
|
||||
else if ((_preSymbol == '+') || (_preSymbol == '='))
|
||||
{
|
||||
step = MethodName;
|
||||
}
|
||||
[method appendString:element];
|
||||
}
|
||||
else if (step == MethodReturnValue)
|
||||
{
|
||||
if (_preSymbol == ')')
|
||||
{
|
||||
step = MethodName;
|
||||
}
|
||||
[method appendString:element];
|
||||
}
|
||||
else if (step == MethodName)
|
||||
{
|
||||
[method appendString:element];
|
||||
}
|
||||
else if (step == MethodParameterStart)
|
||||
{
|
||||
step = MethodParameter;
|
||||
}
|
||||
}
|
||||
|
||||
position += len;
|
||||
|
@ -197,12 +181,17 @@
|
|||
{
|
||||
if (step != MethodNone)
|
||||
{
|
||||
if ((!newline) && (!inSpace))
|
||||
/* if ((!newline) && (!inSpace))
|
||||
{
|
||||
[method appendString:[NSString stringWithFormat:@"%c",element]];
|
||||
}
|
||||
if (element == ' ')
|
||||
}*/
|
||||
if (element == ' ' || newline)
|
||||
{
|
||||
if (step == MethodParameter)
|
||||
{
|
||||
step = MethodName;
|
||||
prev_step = MethodNone;
|
||||
}
|
||||
inSpace = YES;
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +210,7 @@
|
|||
|
||||
- (void)symbol:(unichar)element
|
||||
{
|
||||
[super symbol: element];
|
||||
[super symbol:element];
|
||||
|
||||
/* Comments */
|
||||
if (_commentType != NoComment)
|
||||
|
@ -244,22 +233,34 @@
|
|||
nameBeginPosition = position;
|
||||
}
|
||||
}
|
||||
/* else if (step == MethodSymbol)
|
||||
else if ((step == MethodName) || (step == MethodParameterStart))
|
||||
{
|
||||
if (element == '(')
|
||||
{
|
||||
if (step == MethodParameterStart)
|
||||
{
|
||||
prev_step = step;
|
||||
}
|
||||
step = MethodReturnValue;
|
||||
}
|
||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
else if (element == ':')
|
||||
{
|
||||
step = MethodParameterStart;
|
||||
[method appendString:@":"];
|
||||
}
|
||||
}
|
||||
else if (step == MethodReturnValue)
|
||||
else if (step == MethodReturnValue && element == ')')
|
||||
{
|
||||
if (element == ')')
|
||||
{
|
||||
step = MethodName;
|
||||
}
|
||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
}*/
|
||||
if (prev_step == MethodParameterStart)
|
||||
{
|
||||
step = prev_step;
|
||||
}
|
||||
else
|
||||
{
|
||||
step = MethodName;
|
||||
}
|
||||
// [method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
}
|
||||
else if ((step == MethodName) && (element != '{') && (element != ';'))
|
||||
{
|
||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <Protocols/CodeParser.h>
|
||||
#import <Protocols/CodeParser.h>
|
||||
|
||||
#include "PCParser.h"
|
||||
#include "ObjCMethodHandler.h"
|
||||
#import "PCParser.h"
|
||||
#import "ObjCClassHandler.h"
|
||||
#import "ObjCMethodHandler.h"
|
||||
|
||||
typedef enum _CodeType {
|
||||
StringCodeType, /* 41-5A, 61-7A, 5F */
|
||||
|
@ -39,17 +40,19 @@ typedef enum _CodeType {
|
|||
// ==== Initialisation
|
||||
// ===========================================================================
|
||||
|
||||
- (id) init
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
- (void)dealloc
|
||||
{
|
||||
NSLog(@"CEParser: dealloc");
|
||||
NSLog(@"PCParser: dealloc");
|
||||
free(_uchar);
|
||||
RELEASE(_string);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)setString:(NSString *)text
|
||||
|
@ -70,11 +73,11 @@ typedef enum _CodeType {
|
|||
|
||||
- (NSArray *)classNames
|
||||
{
|
||||
/* _handler = [[ObjCClassHandler alloc] init];
|
||||
_handler = [[ObjCClassHandler alloc] init];
|
||||
[self parse];
|
||||
AUTORELEASE(_handler);
|
||||
|
||||
return [(ObjCClassHandler *)_handler methods];*/
|
||||
return [(ObjCClassHandler *)_handler classes];
|
||||
}
|
||||
|
||||
- (NSArray *)methodNames
|
||||
|
@ -142,15 +145,15 @@ static void (*impSymbol)(id, SEL, unichar);
|
|||
NSLog(@"CodeParser begin...");
|
||||
|
||||
impString = (void (*)(id, SEL, id))
|
||||
[[_handler class] instanceMethodForSelector: selString];
|
||||
[[_handler class] instanceMethodForSelector:selString];
|
||||
impNumber = (void (*)(id, SEL, id))
|
||||
[[_handler class] instanceMethodForSelector: selNumber];
|
||||
[[_handler class] instanceMethodForSelector:selNumber];
|
||||
impSpaceAndNewLine = (void (*)(id, SEL, unichar))
|
||||
[[_handler class] instanceMethodForSelector: selSpaceAndNewLine];
|
||||
[[_handler class] instanceMethodForSelector:selSpaceAndNewLine];
|
||||
impInvisible = (void (*)(id, SEL, unichar))
|
||||
[[_handler class] instanceMethodForSelector: selInvisible];
|
||||
[[_handler class] instanceMethodForSelector:selInvisible];
|
||||
impSymbol = (void (*)(id, SEL, unichar))
|
||||
[[_handler class] instanceMethodForSelector: selSymbol];
|
||||
[[_handler class] instanceMethodForSelector:selSymbol];
|
||||
|
||||
start = end = 0;
|
||||
startType = codeType(_uchar+start);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <ProjectCenter/PCLogController.h>
|
||||
#include <ProjectCenter/ProjectCenter.h>
|
||||
|
||||
#include <Protocols/CodeEditor.h>
|
||||
|
||||
#include "PCAppController.h"
|
||||
#include "PCMenuController.h"
|
||||
#include "PCInfoController.h"
|
||||
|
@ -206,10 +208,10 @@
|
|||
[project addFiles:[NSArray arrayWithObject:newFilePath]
|
||||
forKey:PCNonProject
|
||||
notify:YES];
|
||||
[[project projectEditor] editorForFile:newFilePath
|
||||
categoryPath:categoryPath
|
||||
editable:YES
|
||||
windowed:NO];
|
||||
[[project projectEditor] openEditorForFile:newFilePath
|
||||
categoryPath:categoryPath
|
||||
editable:YES
|
||||
windowed:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue