mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +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
|
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?
|
What is ProjectCenter?
|
||||||
======================
|
======================
|
||||||
|
@ -15,7 +16,7 @@ What is ProjectCenter?
|
||||||
distribution fees, for others to use the program. You should read the
|
distribution fees, for others to use the program. You should read the
|
||||||
Documentation/COPYING file for more information.
|
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!]
|
- Finish save/restore size of split views in Project Window [done!]
|
||||||
- Save last used path separately for different file panels stoyan
|
- Save last used path separately for different file panels stoyan
|
||||||
--- Project Editor:
|
--- Project Editor:
|
||||||
- Implement on demand loading (editor for file type) stoyan
|
- Implement on demand loading (editor for file type) [done!]
|
||||||
- Open some files read only (Supporting Files) stoyan
|
- Open some files read only (Supporting Files) [done!]
|
||||||
- Implement code parser (get it from CodeEditor?) stoyan
|
- Implement code parser (get it from CodeEditor?) [done!]
|
||||||
- Project Browser should show file structure. stoyan
|
- Project Browser should show file structure. [done!]
|
||||||
- Click on Browser item should move cursor to line in file stoyan
|
- Click on Browser item should move cursor to line in file [done!]
|
||||||
- Implement Editor indentation stoyan
|
- Implement Editor indentation stoyan
|
||||||
--- Project Builder:
|
--- Project Builder:
|
||||||
- Implement root build directory handling stoyan
|
- 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
|
- Display warnings,errors,options etc. as clickable list stoyan
|
||||||
- Imlement pending adding/removal of files (history?) stoyan
|
- Imlement pending adding/removal of files (history?) stoyan
|
||||||
- Finish FileNameIcon (draggable, files can be dragged to it) stoyan
|
- Finish FileNameIcon (draggable, files can be dragged to it) stoyan
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
include $(GNUSTEP_MAKEFILES)/common.make
|
include $(GNUSTEP_MAKEFILES)/common.make
|
||||||
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
|
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
|
||||||
|
#GNUSTEP_BUILD_DIR = $(HOME)/Projects/GNUstep/==BUILD==/ProjectCenter
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main application
|
# Main application
|
||||||
|
@ -27,12 +28,6 @@ ProjectCenter_RESOURCE_FILES = \
|
||||||
Resources/ProjectCenter.gorm \
|
Resources/ProjectCenter.gorm \
|
||||||
Resources/Info-gnustep.plist \
|
Resources/Info-gnustep.plist \
|
||||||
Images/ProjectCenter.tiff \
|
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/FileRTF.tiff \
|
||||||
Images/FileProject.tiff \
|
Images/FileProject.tiff \
|
||||||
Images/Build.tiff \
|
Images/Build.tiff \
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
@class NSTextField;
|
@class NSTextField;
|
||||||
|
|
||||||
|
extern NSString *PCFileNameFieldNoFiles;
|
||||||
|
|
||||||
@interface PCFileNameField : NSTextField
|
@interface PCFileNameField : NSTextField
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,22 @@
|
||||||
NSString *filePath;
|
NSString *filePath;
|
||||||
NSTextField *fileNameField;
|
NSTextField *fileNameField;
|
||||||
NSString *msfText;
|
NSString *msfText;
|
||||||
|
|
||||||
|
id delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFileNameField:(NSTextField *)field;
|
- (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
|
@end
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,12 @@ extern NSString *PCBrowserDidSetPathNotification;
|
||||||
// Returns nil if multiple files selected
|
// Returns nil if multiple files selected
|
||||||
- (NSString *)nameOfSelectedFile;
|
- (NSString *)nameOfSelectedFile;
|
||||||
- (NSString *)pathToSelectedFile;
|
- (NSString *)pathToSelectedFile;
|
||||||
|
|
||||||
// Returns nil if multiple categories selected
|
// Returns nil if multiple categories selected
|
||||||
- (NSString *)nameOfSelectedCategory;
|
- (NSString *)nameOfSelectedCategory;
|
||||||
// Returns nil of multiple categories selected
|
|
||||||
- (NSString *)pathToSelectedCategory;
|
- (NSString *)pathToSelectedCategory;
|
||||||
// Returns nil of multiple categories selected
|
|
||||||
- (NSString *)pathFromSelectedCategory;
|
- (NSString *)pathFromSelectedCategory;
|
||||||
|
|
||||||
- (NSString *)nameOfSelectedRootCategory;
|
- (NSString *)nameOfSelectedRootCategory;
|
||||||
|
|
||||||
// Returns nil if multiple category selected
|
// Returns nil if multiple category selected
|
||||||
|
|
|
@ -29,9 +29,7 @@
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
|
|
||||||
#include <Protocols/CodeEditor.h>
|
#include <Protocols/CodeEditor.h>
|
||||||
#include <Protocols/ProjectEditor.h>
|
#include <Protocols/CodeParser.h>
|
||||||
|
|
||||||
#include "PCProject.h"
|
|
||||||
|
|
||||||
@class PCProject;
|
@class PCProject;
|
||||||
@class PCEditor;
|
@class PCEditor;
|
||||||
|
@ -41,9 +39,7 @@
|
||||||
@class NSView;
|
@class NSView;
|
||||||
@class NSScrollView;
|
@class NSScrollView;
|
||||||
|
|
||||||
@protocol CodeParser;
|
@interface PCProjectEditor : NSObject
|
||||||
|
|
||||||
@interface PCProjectEditor : NSObject <ProjectEditor>
|
|
||||||
{
|
{
|
||||||
PCProject *project;
|
PCProject *project;
|
||||||
NSBox *componentView;
|
NSBox *componentView;
|
||||||
|
@ -79,17 +75,16 @@
|
||||||
|
|
||||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
||||||
|
|
||||||
- (id<CodeEditor>)editorForCategoryPath:(NSString *)categoryPath
|
// Returns nil if editor is not opened
|
||||||
windowed:(BOOL)windowed;
|
- (id<CodeEditor>)editorForFile:(NSString *)fileName key:(NSString *)key;
|
||||||
|
|
||||||
/*- (id<CodeEditor>)editorForFile:(NSString *)path
|
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||||
categoryPath:(NSString *)categoryPath
|
windowed:(BOOL)windowed;
|
||||||
windowed:(BOOL)yn;*/
|
|
||||||
|
- (id<CodeEditor>)openEditorForFile:(NSString *)path
|
||||||
- (id<CodeEditor>)editorForFile:(NSString *)path
|
categoryPath:(NSString *)categoryPath
|
||||||
categoryPath:(NSString *)categoryPath
|
editable:(BOOL)editable
|
||||||
editable:(BOOL)editable
|
windowed:(BOOL)windowed;
|
||||||
windowed:(BOOL)windowed;
|
|
||||||
|
|
||||||
- (void)orderFrontEditorForFile:(NSString *)path;
|
- (void)orderFrontEditorForFile:(NSString *)path;
|
||||||
- (id<CodeEditor>)activeEditor;
|
- (id<CodeEditor>)activeEditor;
|
||||||
|
@ -120,5 +115,26 @@
|
||||||
|
|
||||||
@end
|
@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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,8 @@
|
||||||
|
|
||||||
// File Attributes
|
// File Attributes
|
||||||
IBOutlet NSBox *fileAttributesView;
|
IBOutlet NSBox *fileAttributesView;
|
||||||
IBOutlet PCFileNameIcon *fileIcon;
|
IBOutlet PCFileNameIcon *fileIconView;
|
||||||
IBOutlet PCFileNameField *fileIconField;
|
IBOutlet PCFileNameField *fileNameField;
|
||||||
NSString *fileName;
|
NSString *fileName;
|
||||||
IBOutlet NSButton *localizableButton;
|
IBOutlet NSButton *localizableButton;
|
||||||
IBOutlet NSButton *publicHeaderButton;
|
IBOutlet NSButton *publicHeaderButton;
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#ifndef _PCProjectWindow_h_
|
#ifndef _PCProjectWindow_h_
|
||||||
#define _PCProjectWindow_h_
|
#define _PCProjectWindow_h_
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#include <ProjectCenter/PCFileNameField.h>
|
#import <ProjectCenter/PCFileNameField.h>
|
||||||
#include <ProjectCenter/PCFileNameIcon.h>
|
#import <ProjectCenter/PCFileNameIcon.h>
|
||||||
|
|
||||||
@class PCProject;
|
@class PCProject;
|
||||||
@class PCProjectBrowser;
|
@class PCProjectBrowser;
|
||||||
|
@ -71,9 +71,6 @@
|
||||||
// ==== Intialization & deallocation
|
// ==== Intialization & deallocation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// Will go into gorm file
|
|
||||||
- (void)_initUI;
|
|
||||||
|
|
||||||
- (id)initWithProject:(PCProject *)owner;
|
- (id)initWithProject:(PCProject *)owner;
|
||||||
- (void)setTitle;
|
- (void)setTitle;
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,6 @@
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
//#include <Protocols/ProjectEditor.h>
|
|
||||||
|
|
||||||
@protocol ProjectEditor;
|
|
||||||
|
|
||||||
@protocol CodeEditor <NSObject>
|
@protocol CodeEditor <NSObject>
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@ -41,12 +37,12 @@
|
||||||
|
|
||||||
- (id)openFileAtPath:(NSString *)file
|
- (id)openFileAtPath:(NSString *)file
|
||||||
categoryPath:(NSString *)categoryPath
|
categoryPath:(NSString *)categoryPath
|
||||||
projectEditor:(id<ProjectEditor>)aProjectEditor
|
projectEditor:(id)aProjectEditor
|
||||||
editable:(BOOL)editable;
|
editable:(BOOL)editable;
|
||||||
|
|
||||||
- (id)openExternalEditor:(NSString *)editor
|
- (id)openExternalEditor:(NSString *)editor
|
||||||
withPath:(NSString *)file
|
withPath:(NSString *)file
|
||||||
projectEditor:(id<ProjectEditor>)aProjectEditor;
|
projectEditor:(id)aProjectEditor;
|
||||||
|
|
||||||
- (void)show;
|
- (void)show;
|
||||||
- (void)setWindowed:(BOOL)yn;
|
- (void)setWindowed:(BOOL)yn;
|
||||||
|
@ -55,17 +51,26 @@
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// ==== Accessor methods
|
// ==== Accessor methods
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
- (id<ProjectEditor>)projectEditor;
|
- (id)projectEditor;
|
||||||
|
|
||||||
- (NSWindow *)editorWindow;
|
- (NSWindow *)editorWindow;
|
||||||
- (NSView *)editorView;
|
- (NSView *)editorView;
|
||||||
- (NSView *)componentView;
|
- (NSView *)componentView;
|
||||||
|
|
||||||
- (NSString *)path;
|
- (NSString *)path;
|
||||||
- (void)setPath:(NSString *)path;
|
- (void)setPath:(NSString *)path;
|
||||||
|
|
||||||
- (NSString *)categoryPath;
|
- (NSString *)categoryPath;
|
||||||
- (void)setCategoryPath:(NSString *)path;
|
- (void)setCategoryPath:(NSString *)path;
|
||||||
|
|
||||||
- (BOOL)isEdited;
|
- (BOOL)isEdited;
|
||||||
- (void)setIsEdited:(BOOL)yn;
|
- (void)setIsEdited:(BOOL)yn;
|
||||||
|
|
||||||
|
- (NSImage *)fileIcon;
|
||||||
|
|
||||||
|
// Returns class or method names
|
||||||
|
- (NSArray *)browserItemsForItem:(NSString *)item;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// ==== Object managment
|
// ==== Object managment
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@ -79,12 +84,10 @@
|
||||||
// ==== Parser and scrolling
|
// ==== Parser and scrolling
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
// Returns class or method names
|
- (void)fileStructureItemSelected:(NSString *)item;
|
||||||
- (NSArray *)browserItemsForItem:(NSString *)item;
|
|
||||||
|
|
||||||
- (void)scrollToClassName:(NSString *)className;
|
- (void)scrollToClassName:(NSString *)className;
|
||||||
- (void)scrollToMethodName:(NSString *)methodName;
|
- (void)scrollToMethodName:(NSString *)methodName;
|
||||||
- (void)scrollToLineNumber:(int)line;
|
- (void)scrollToLineNumber:(unsigned int)lineNumber;
|
||||||
|
|
||||||
@end
|
@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_CPPFLAGS +=
|
||||||
|
|
||||||
# Additional flags to pass to the Objective-C compiler
|
# Additional flags to pass to the Objective-C compiler
|
||||||
ADDITIONAL_OBJCFLAGS += -Wall -DPCDefaultBuildTool=@"\"$(GMAKE)\"" \
|
ADDITIONAL_OBJCFLAGS += -W -DPCDefaultBuildTool=@"\"$(GMAKE)\"" \
|
||||||
-DPCDefaultDebugger=@"\"$(GDB)\""
|
-DPCDefaultDebugger=@"\"$(GDB)\""
|
||||||
|
|
||||||
# Additional flags to pass to the C compiler
|
# Additional flags to pass to the C compiler
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <ProjectCenter/PCFileNameField.h>
|
#include <ProjectCenter/PCFileNameField.h>
|
||||||
|
|
||||||
|
NSString *PCFileNameFieldNoFiles = @"No files selected";
|
||||||
|
|
||||||
@implementation PCFileNameField
|
@implementation PCFileNameField
|
||||||
|
|
||||||
- (void)setFont:(NSFont *)fontObject
|
- (void)setFont:(NSFont *)fontObject
|
||||||
|
@ -106,10 +108,9 @@
|
||||||
|
|
||||||
- (BOOL)textShouldSetEditable:(NSString *)text
|
- (BOOL)textShouldSetEditable:(NSString *)text
|
||||||
{
|
{
|
||||||
id delegate = [self delegate];
|
id delegate = [self delegate];
|
||||||
|
|
||||||
if ([text isEqualToString:@"No files selected"]
|
if ([text isEqualToString:PCFileNameFieldNoFiles])
|
||||||
|| [text isEqualToString:@"Multiple files selected"])
|
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCFileNameIcon.h>
|
#import <ProjectCenter/PCFileNameIcon.h>
|
||||||
#include <ProjectCenter/PCProjectBrowser.h>
|
#import <ProjectCenter/PCProjectBrowser.h>
|
||||||
|
|
||||||
@implementation PCFileNameIcon
|
@implementation PCFileNameIcon
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
|
||||||
RELEASE(fileNameField);
|
RELEASE(fileNameField);
|
||||||
|
RELEASE(delegate);
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -68,128 +69,36 @@
|
||||||
fileNameField = RETAIN(field);
|
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;
|
if (delegate)
|
||||||
NSString *fileName = nil;
|
|
||||||
NSString *fileExtension = nil;
|
|
||||||
NSString *iconName = nil;
|
|
||||||
NSImage *icon = nil;
|
|
||||||
|
|
||||||
fileName = [object nameOfSelectedFile];
|
|
||||||
if (fileName)
|
|
||||||
{
|
{
|
||||||
fileExtension = [fileName pathExtension];
|
if ([delegate respondsToSelector:@selector(fileNameIconImage)])
|
||||||
}
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
[fileNameField setStringValue:msfText];
|
[self setImage:[delegate fileNameIconImage]];
|
||||||
}
|
}
|
||||||
else
|
if ([delegate respondsToSelector:@selector(fileNameIconTitle)])
|
||||||
{
|
{
|
||||||
[fileNameField setStringValue:
|
[fileNameField setStringValue:[delegate fileNameIconTitle]];
|
||||||
[NSString stringWithFormat:
|
|
||||||
@"%i files", [[object selectedFiles] count]]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (categoryName)
|
}
|
||||||
{
|
|
||||||
[fileNameField setStringValue:categoryName];
|
@end
|
||||||
}
|
|
||||||
else if (fileName)
|
@implementation PCFileNameIcon (FileNameIconDelegate)
|
||||||
{
|
|
||||||
[fileNameField setStringValue:fileName];
|
- (NSImage *)fileNameIconImage
|
||||||
}
|
{
|
||||||
else
|
}
|
||||||
{
|
|
||||||
[fileNameField setStringValue:@"No files selected"];
|
- (NSString *)fileNameIconTitle
|
||||||
}
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
PCLog(id sender, int tag, NSString* format, va_list args)
|
PCLog(id sender, int tag, NSString* format, va_list args)
|
||||||
|
@ -128,6 +128,8 @@ static PCLogController *_logCtrllr = nil;
|
||||||
NSLog(@"PCLogController: dealloc");
|
NSLog(@"PCLogController: dealloc");
|
||||||
#endif
|
#endif
|
||||||
RELEASE(textAttributes);
|
RELEASE(textAttributes);
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showPanel
|
- (void)showPanel
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCPrefController.h>
|
#import <ProjectCenter/PCPrefController.h>
|
||||||
|
|
||||||
// TODO: rewrite it as PCPrefernces, use +sharedPreferences instead of
|
// TODO: rewrite it as PCPrefernces, use +sharedPreferences instead of
|
||||||
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
|
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
|
||||||
|
@ -139,8 +139,8 @@ static PCPrefController *_prefCtrllr = nil;
|
||||||
|
|
||||||
- (void)loadPreferences
|
- (void)loadPreferences
|
||||||
{
|
{
|
||||||
NSDictionary *prefs = nil;
|
NSDictionary *prefs;
|
||||||
NSString *val = nil;
|
NSString *val;
|
||||||
|
|
||||||
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||||
[preferencesDict addEntriesFromDictionary: prefs];
|
[preferencesDict addEntriesFromDictionary: prefs];
|
||||||
|
@ -148,14 +148,14 @@ static PCPrefController *_prefCtrllr = nil;
|
||||||
// Fill in the defaults
|
// Fill in the defaults
|
||||||
|
|
||||||
// Building
|
// Building
|
||||||
[successField setStringValue:
|
val = [preferencesDict objectForKey:SuccessSound];
|
||||||
(val = [preferencesDict objectForKey: SuccessSound]) ? val : @""];
|
[successField setStringValue: (val == nil) ? @"" : val];
|
||||||
|
|
||||||
[failureField setStringValue:
|
[failureField setStringValue:
|
||||||
(val = [preferencesDict objectForKey: FailureSound]) ? val : @""];
|
(val = [preferencesDict objectForKey:FailureSound]) ? val : @""];
|
||||||
|
|
||||||
[promptOnClean setState:
|
[promptOnClean setState:
|
||||||
([[preferencesDict objectForKey: PromptOnClean]
|
([[preferencesDict objectForKey:PromptOnClean]
|
||||||
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
||||||
|
|
||||||
[rootBuildDirField setStringValue:
|
[rootBuildDirField setStringValue:
|
||||||
|
@ -250,8 +250,8 @@ static PCPrefController *_prefCtrllr = nil;
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
NSArray *tabMatrixCells = nil;
|
NSArray *tabMatrixCells;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
[promptOnClean setRefusesFirstResponder:YES];
|
[promptOnClean setRefusesFirstResponder:YES];
|
||||||
|
|
||||||
|
|
|
@ -787,7 +787,7 @@ NSString
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resPath = [projectPath stringByAppendingPathComponent:@"Resources"];
|
resPath = [projectPath stringByAppendingPathComponent:@"Resources"];
|
||||||
resFilePath = [resPath stringByAppendingPathComponent:file];
|
resFilePath = [resPath stringByAppendingPathComponent:file];
|
||||||
localizedResources = [[self localizedResources] mutableCopy];
|
localizedResources = [[self localizedResources] mutableCopy];
|
||||||
|
@ -854,8 +854,7 @@ NSString
|
||||||
NSString *fileName = [filePath lastPathComponent];
|
NSString *fileName = [filePath lastPathComponent];
|
||||||
NSString *extension = [filePath pathExtension];
|
NSString *extension = [filePath pathExtension];
|
||||||
|
|
||||||
if ([key isEqualToString:PCSupportingFiles]
|
if ([key isEqualToString:PCSupportingFiles])
|
||||||
|| [key isEqualToString:PCDocuFiles])
|
|
||||||
{
|
{
|
||||||
if ([fileName isEqualToString:@"GNUmakefile"] ||
|
if ([fileName isEqualToString:@"GNUmakefile"] ||
|
||||||
[extension isEqualToString:@"plist"])
|
[extension isEqualToString:@"plist"])
|
||||||
|
@ -1006,7 +1005,7 @@ NSString
|
||||||
// File is located in project's directory tree
|
// File is located in project's directory tree
|
||||||
if (pathRange.length && ![type isEqualToString:PCLibraries])
|
if (pathRange.length && ![type isEqualToString:PCLibraries])
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < [subprojects count]; i++)
|
for (i = 0; i < [subprojects count]; i++)
|
||||||
{
|
{
|
||||||
|
@ -1279,12 +1278,14 @@ NSString
|
||||||
|
|
||||||
if ([[self localizedResources] containsObject:fromFile])
|
if ([[self localizedResources] containsObject:fromFile])
|
||||||
{// Rename file in language dirs
|
{// Rename file in language dirs
|
||||||
NSArray *userLanguages = nil;
|
NSArray *userLanguages;
|
||||||
NSEnumerator *enumerator = nil;
|
NSEnumerator *enumerator;
|
||||||
NSString *lang = nil;
|
NSString *lang;
|
||||||
NSString *langPath = nil;
|
NSString *langPath;
|
||||||
NSMutableArray *localizedResources = [self localizedResources];
|
NSMutableArray *localizedResources;
|
||||||
|
|
||||||
|
localizedResources =
|
||||||
|
[NSMutableArray arrayWithArray:[self localizedResources]];
|
||||||
userLanguages = [projectDict objectForKey:PCUserLanguages];
|
userLanguages = [projectDict objectForKey:PCUserLanguages];
|
||||||
enumerator = [userLanguages objectEnumerator];
|
enumerator = [userLanguages objectEnumerator];
|
||||||
while ((lang = [enumerator nextObject]))
|
while ((lang = [enumerator nextObject]))
|
||||||
|
@ -1517,8 +1518,6 @@ NSString
|
||||||
|
|
||||||
@implementation PCProject (ProjectBrowser)
|
@implementation PCProject (ProjectBrowser)
|
||||||
|
|
||||||
// TODO: Think about moving all browser related methods into PCProjectBrowser
|
|
||||||
|
|
||||||
- (NSArray *)rootKeys
|
- (NSArray *)rootKeys
|
||||||
{
|
{
|
||||||
// e.g. CLASS_FILES
|
// e.g. CLASS_FILES
|
||||||
|
@ -1556,6 +1555,43 @@ NSString
|
||||||
return [rootEntries objectForKey:key];
|
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
|
- (NSArray *)contentAtCategoryPath:(NSString *)categoryPath
|
||||||
{
|
{
|
||||||
NSString *key = [self keyForRootCategoryInCategoryPath:categoryPath];
|
NSString *key = [self keyForRootCategoryInCategoryPath:categoryPath];
|
||||||
|
@ -1608,15 +1644,6 @@ NSString
|
||||||
{ // The file is selected, ask editor for browser items
|
{ // The file is selected, ask editor for browser items
|
||||||
return [[projectEditor activeEditor] browserItemsForItem:listEntry];
|
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
|
- (BOOL)hasChildrenAtCategoryPath:(NSString *)categoryPath
|
||||||
|
@ -1646,10 +1673,10 @@ NSString
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Files
|
// Files. listEntry is file in category or contents of file
|
||||||
if ([[projectDict objectForKey:categoryKey] containsObject:listEntry])
|
if ([[projectDict objectForKey:categoryKey] containsObject:listEntry] ||
|
||||||
|
[projectBrowser nameOfSelectedFile])
|
||||||
{
|
{
|
||||||
// NSLog(@"PCP [hasChildrenAtCategoryPath]: item is file selected");
|
|
||||||
// TODO: Libraries
|
// TODO: Libraries
|
||||||
if ([category isEqualToString:@"Libraries"])
|
if ([category isEqualToString:@"Libraries"])
|
||||||
{
|
{
|
||||||
|
@ -1665,40 +1692,5 @@ NSString
|
||||||
return NO;
|
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
|
@end
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,15 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCFileManager.h>
|
#import <ProjectCenter/PCFileManager.h>
|
||||||
#include <ProjectCenter/PCProjectManager.h>
|
#import <ProjectCenter/PCProjectManager.h>
|
||||||
#include <ProjectCenter/PCProject.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
#include <ProjectCenter/PCProjectBrowser.h>
|
#import <ProjectCenter/PCProjectBrowser.h>
|
||||||
#include <ProjectCenter/PCProjectEditor.h>
|
#import <ProjectCenter/PCProjectEditor.h>
|
||||||
|
#import <ProjectCenter/PCFileNameField.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
|
|
||||||
|
@ -66,12 +67,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
selector:@selector(projectDictDidChange:)
|
selector:@selector(projectDictDidChange:)
|
||||||
name:PCProjectDictDidChangeNotification
|
name:PCProjectDictDidChangeNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
addObserver:self
|
|
||||||
selector:@selector(editorDidOpen:)
|
|
||||||
name:PCEditorDidOpenNotification
|
|
||||||
object:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -366,6 +361,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
NSString *category;
|
NSString *category;
|
||||||
PCProject *activeProject;
|
PCProject *activeProject;
|
||||||
NSString *browserPath;
|
NSString *browserPath;
|
||||||
|
NSString *filePath;
|
||||||
|
|
||||||
if (sender != browser)
|
if (sender != browser)
|
||||||
{
|
{
|
||||||
|
@ -376,17 +372,20 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
category = [self nameOfSelectedCategory];
|
category = [self nameOfSelectedCategory];
|
||||||
activeProject = [[project projectManager] activeProject];
|
activeProject = [[project projectManager] activeProject];
|
||||||
browserPath = [self path];
|
browserPath = [self path];
|
||||||
|
filePath = [self pathToSelectedFile];
|
||||||
|
|
||||||
NSLog(@"browserPath: %@ forProject: %@",
|
/* NSLog(@"browserPath: %@ forProject: %@",
|
||||||
browserPath, [activeProject projectName]);
|
browserPath, [activeProject projectName]);*/
|
||||||
|
|
||||||
if ([[self selectedFiles] count] == 1
|
// if ([[self selectedFiles] count] == 1
|
||||||
&& ![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
|
if (filePath &&
|
||||||
|
[filePath isEqualToString:browserPath] &&
|
||||||
|
![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
|
||||||
{
|
{
|
||||||
/* PCLogInfo(self, @"[click] category: %@ filePath: %@",
|
/* PCLogInfo(self, @"[click] category: %@ filePath: %@",
|
||||||
category, filePath);*/
|
category, filePath);*/
|
||||||
[[activeProject projectEditor] editorForCategoryPath:browserPath
|
[[activeProject projectEditor] openEditorForCategoryPath:browserPath
|
||||||
windowed:NO];
|
windowed:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
@ -423,8 +422,8 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
{
|
{
|
||||||
if ([[NSWorkspace sharedWorkspace] openFile:filePath] == NO)
|
if ([[NSWorkspace sharedWorkspace] openFile:filePath] == NO)
|
||||||
{
|
{
|
||||||
[[project projectEditor] editorForCategoryPath:[browser path]
|
[[project projectEditor] openEditorForCategoryPath:[browser path]
|
||||||
windowed:YES];
|
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
|
@end
|
||||||
|
|
||||||
@implementation PCProjectBrowser (ProjectBrowserDelegate)
|
@implementation PCProjectBrowser (ProjectBrowserDelegate)
|
||||||
|
@ -527,7 +517,144 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||||
[categoryPath appendString:[files objectAtIndex:i]];
|
[categoryPath appendString:[files objectAtIndex:i]];
|
||||||
|
|
||||||
[cell setLeaf:![project hasChildrenAtCategoryPath:categoryPath]];
|
[cell setLeaf:![project hasChildrenAtCategoryPath:categoryPath]];
|
||||||
|
[cell setRefusesFirstResponder:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@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.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCFileManager.h>
|
#import <ProjectCenter/PCFileManager.h>
|
||||||
#include <ProjectCenter/PCProjectManager.h>
|
#import <ProjectCenter/PCProjectManager.h>
|
||||||
#include <ProjectCenter/PCBundleManager.h>
|
#import <ProjectCenter/PCBundleManager.h>
|
||||||
#include <ProjectCenter/PCProjectWindow.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
#include <ProjectCenter/PCProjectBrowser.h>
|
#import <ProjectCenter/PCProjectWindow.h>
|
||||||
#include <ProjectCenter/PCProjectEditor.h>
|
#import <ProjectCenter/PCProjectBrowser.h>
|
||||||
|
#import <ProjectCenter/PCProjectEditor.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
#include <Protocols/CodeParser.h>
|
|
||||||
|
|
||||||
NSString *PCEditorDidChangeFileNameNotification =
|
NSString *PCEditorDidChangeFileNameNotification =
|
||||||
@"PCEditorDidChangeFileNameNotification";
|
@"PCEditorDidChangeFileNameNotification";
|
||||||
|
|
||||||
NSString *PCEditorWillOpenNotification =
|
NSString *PCEditorWillOpenNotification = @"PCEditorWillOpenNotification";
|
||||||
@"PCEditorWillOpenNotification";
|
NSString *PCEditorDidOpenNotification = @"PCEditorDidOpenNotification";
|
||||||
NSString *PCEditorDidOpenNotification =
|
NSString *PCEditorWillCloseNotification = @"PCEditorWillCloseNotification";
|
||||||
@"PCEditorDidOpenNotification";
|
NSString *PCEditorDidCloseNotification = @"PCEditorDidCloseNotification";
|
||||||
NSString *PCEditorDidCloseNotification =
|
|
||||||
@"PCEditorDidCloseNotification";
|
NSString *PCEditorWillChangeNotification = @"PCEditorWillChangeNotification";
|
||||||
|
NSString *PCEditorDidChangeNotification = @"PCEditorDidChangeNotification";
|
||||||
|
NSString *PCEditorWillSaveNotification = @"PCEditorWillSaveNotification";
|
||||||
|
NSString *PCEditorDidSaveNotification = @"PCEditorDidSaveNotification";
|
||||||
|
NSString *PCEditorWillRevertNotification = @"PCEditorWillRevertNotification";
|
||||||
|
NSString *PCEditorDidRevertNotification = @"PCEditorDidRevertNotification";
|
||||||
|
|
||||||
NSString *PCEditorDidBecomeActiveNotification =
|
NSString *PCEditorDidBecomeActiveNotification =
|
||||||
@"PCEditorDidBecomeActiveNotification";
|
@"PCEditorDidBecomeActiveNotification";
|
||||||
|
@ -258,8 +262,21 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
// TODO: Should it be editor or parser?
|
// TODO: Should it be editor or parser?
|
||||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item
|
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item
|
||||||
{
|
{
|
||||||
NSDictionary *infoTable = [self infoTableForBundleType:@"editor"
|
NSString *file = [[project projectBrowser] nameOfSelectedFile];
|
||||||
andFileType:[item pathExtension]];
|
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"])
|
if ([[infoTable objectForKey:@"ProvidesBrowserItems"] isEqualToString:@"YES"])
|
||||||
{
|
{
|
||||||
|
@ -269,11 +286,20 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id<CodeEditor>)editorForFile:(NSString *)fileName key:(NSString *)key
|
||||||
|
{
|
||||||
|
NSString *filePath = nil;
|
||||||
|
|
||||||
|
filePath = [project pathForFile:fileName forKey:key];
|
||||||
|
|
||||||
|
return [editorsDict objectForKey:filePath];
|
||||||
|
}
|
||||||
|
|
||||||
// categoryPath:
|
// categoryPath:
|
||||||
// 1. "/Classes/Class.m/- init"
|
// 1. "/Classes/Class.m/- init"
|
||||||
// 2. "/Subprojects/Project/Classes/Class.m/- init"
|
// 2. "/Subprojects/Project/Classes/Class.m/- init"
|
||||||
// 3. "/Library/gnustep-gui"
|
// 3. "/Library/gnustep-gui"
|
||||||
- (id<CodeEditor>)editorForCategoryPath:(NSString *)categoryPath
|
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||||
windowed:(BOOL)windowed
|
windowed:(BOOL)windowed
|
||||||
{
|
{
|
||||||
NSArray *pathArray = [categoryPath pathComponents];
|
NSArray *pathArray = [categoryPath pathComponents];
|
||||||
|
@ -316,10 +342,10 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
|
|
||||||
// NSLog(@"fileName: %@ > %@", fileName, listEntry);
|
// NSLog(@"fileName: %@ > %@", fileName, listEntry);
|
||||||
|
|
||||||
editor = [self editorForFile:filePath
|
editor = [self openEditorForFile:filePath
|
||||||
categoryPath:categoryPath
|
categoryPath:categoryPath
|
||||||
editable:editable
|
editable:editable
|
||||||
windowed:windowed];
|
windowed:windowed];
|
||||||
if (!editor)
|
if (!editor)
|
||||||
{
|
{
|
||||||
NSLog(@"We don't have editor for file: %@", fileName);
|
NSLog(@"We don't have editor for file: %@", fileName);
|
||||||
|
@ -332,7 +358,7 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
[pathLastObject substringWithRange:NSMakeRange(0,1)]);*/
|
[pathLastObject substringWithRange:NSMakeRange(0,1)]);*/
|
||||||
|
|
||||||
pathLastObject = [pathArray lastObject];
|
pathLastObject = [pathArray lastObject];
|
||||||
firstSymbol = [pathLastObject substringWithRange:NSMakeRange(0,1)];
|
firstSymbol = [pathLastObject substringToIndex:1];
|
||||||
if ([pathLastObject isEqualToString:@"/"]) // file selected
|
if ([pathLastObject isEqualToString:@"/"]) // file selected
|
||||||
{
|
{
|
||||||
[[project projectBrowser] reloadLastColumnAndNotify:NO];
|
[[project projectBrowser] reloadLastColumnAndNotify:NO];
|
||||||
|
@ -349,10 +375,10 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<CodeEditor>)editorForFile:(NSString *)path
|
- (id<CodeEditor>)openEditorForFile:(NSString *)path
|
||||||
categoryPath:(NSString *)categoryPath
|
categoryPath:(NSString *)categoryPath
|
||||||
editable:(BOOL)editable
|
editable:(BOOL)editable
|
||||||
windowed:(BOOL)windowed
|
windowed:(BOOL)windowed
|
||||||
{
|
{
|
||||||
// NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
// NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||||
// NSString *ed = [ud objectForKey:Editor];
|
// NSString *ed = [ud objectForKey:Editor];
|
||||||
|
@ -385,7 +411,7 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parser
|
// Parser
|
||||||
parserClassName = [self classNameForBundleType:@"parser"
|
/* parserClassName = [self classNameForBundleType:@"parser"
|
||||||
andFile:[path lastPathComponent]];
|
andFile:[path lastPathComponent]];
|
||||||
if (parserClassName != nil)
|
if (parserClassName != nil)
|
||||||
{
|
{
|
||||||
|
@ -393,9 +419,9 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
parser = [bundleManager objectForClassName:parserClassName
|
parser = [bundleManager objectForClassName:parserClassName
|
||||||
withProtocol:@protocol(CodeParser)
|
withProtocol:@protocol(CodeParser)
|
||||||
inBundleType:@"parser"];
|
inBundleType:@"parser"];
|
||||||
AUTORELEASE(parser);
|
|
||||||
[editor setParser:parser];
|
[editor setParser:parser];
|
||||||
}
|
RELEASE(parser);
|
||||||
|
}*/
|
||||||
|
|
||||||
[editor openFileAtPath:path
|
[editor openFileAtPath:path
|
||||||
categoryPath:categoryPath
|
categoryPath:categoryPath
|
||||||
|
@ -593,10 +619,10 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
res = [editor saveFileTo:file];
|
res = [editor saveFileTo:file];
|
||||||
[editor closeFile:self save:NO];
|
[editor closeFile:self save:NO];
|
||||||
|
|
||||||
[self editorForFile:file
|
[self openEditorForFile:file
|
||||||
categoryPath:categoryPath
|
categoryPath:categoryPath
|
||||||
editable:YES
|
editable:YES
|
||||||
windowed:iw];
|
windowed:iw];
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -654,7 +680,7 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[editorsDict removeObjectForKey:[editor path]];
|
[editorsDict removeObjectForKey:[editor path]];
|
||||||
|
|
||||||
if ([editorsDict count])
|
if ([editorsDict count])
|
||||||
|
@ -683,7 +709,7 @@ NSString *PCEditorDidResignActiveNotification =
|
||||||
id<CodeEditor> editor = [aNotif object];
|
id<CodeEditor> editor = [aNotif object];
|
||||||
NSString *categoryPath = nil;
|
NSString *categoryPath = nil;
|
||||||
|
|
||||||
if ([editor projectEditor] != self) // || activeEditor == editor)
|
if ([editor projectEditor] != self)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCProjectManager.h>
|
#import <ProjectCenter/PCProjectManager.h>
|
||||||
#include <ProjectCenter/PCProject.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
#include <ProjectCenter/PCProjectBrowser.h>
|
#import <ProjectCenter/PCProjectBrowser.h>
|
||||||
#include <ProjectCenter/PCProjectWindow.h>
|
#import <ProjectCenter/PCProjectWindow.h>
|
||||||
#include <ProjectCenter/PCProjectInspector.h>
|
#import <ProjectCenter/PCProjectInspector.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
@implementation PCProjectInspector
|
@implementation PCProjectInspector
|
||||||
|
|
||||||
|
@ -342,13 +342,14 @@
|
||||||
[authorsList reloadData];
|
[authorsList reloadData];
|
||||||
|
|
||||||
// File Attributes
|
// File Attributes
|
||||||
[fileIcon setFileIcon:(id)[project projectBrowser]];
|
[fileIconView setDelegate:[project projectBrowser]];
|
||||||
|
[fileIconView updateIcon];
|
||||||
[self updateFileAttributes];
|
[self updateFileAttributes];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)browserDidSetPath:(NSNotification *)aNotif
|
- (void)browserDidSetPath:(NSNotification *)aNotif
|
||||||
{
|
{
|
||||||
[fileIcon setFileIcon:[aNotif object]];
|
[fileIconView updateIcon];
|
||||||
[self updateFileAttributes];
|
[self updateFileAttributes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,9 +638,9 @@
|
||||||
|
|
||||||
- (void)downAuthor:(id)sender
|
- (void)downAuthor:(id)sender
|
||||||
{
|
{
|
||||||
int selectedRow = [authorsList selectedRow];
|
unsigned selectedRow = [authorsList selectedRow];
|
||||||
id nextRow;
|
id nextRow;
|
||||||
id currentRow;
|
id currentRow;
|
||||||
|
|
||||||
if (selectedRow < [authorsItems count]-1)
|
if (selectedRow < [authorsItems count]-1)
|
||||||
{
|
{
|
||||||
|
@ -669,7 +670,7 @@
|
||||||
|
|
||||||
if ([NSBundle loadNibNamed:@"FileAttributes" owner:self] == NO)
|
if ([NSBundle loadNibNamed:@"FileAttributes" owner:self] == NO)
|
||||||
{
|
{
|
||||||
PCLogError(self, @"error loading ProjectDescription NIB file!");
|
PCLogError(self, @"error loading FileAttributes NIB file!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,8 +678,7 @@
|
||||||
[localizableButton setRefusesFirstResponder:YES];
|
[localizableButton setRefusesFirstResponder:YES];
|
||||||
[publicHeaderButton setRefusesFirstResponder:YES];
|
[publicHeaderButton setRefusesFirstResponder:YES];
|
||||||
|
|
||||||
[fileIcon setFileNameField:fileIconField];
|
[fileIconView setFileNameField:fileNameField];
|
||||||
[fileIcon setMultipleFilesSelectionText:@"Multiple files selected"];
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver:self
|
addObserver:self
|
||||||
|
@ -790,8 +790,8 @@
|
||||||
|
|
||||||
- (void)beginFileRename
|
- (void)beginFileRename
|
||||||
{
|
{
|
||||||
[fileIconField setEditableField:YES];
|
[fileNameField setEditableField:YES];
|
||||||
[inspectorPanel makeFirstResponder:fileIconField];
|
[inspectorPanel makeFirstResponder:fileNameField];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delegate method of PCFileNameField class
|
// Delegate method of PCFileNameField class
|
||||||
|
@ -817,17 +817,17 @@
|
||||||
|
|
||||||
- (void)fileNameDidChange:(id)sender
|
- (void)fileNameDidChange:(id)sender
|
||||||
{
|
{
|
||||||
if ([fileName isEqualToString:[fileIconField stringValue]])
|
if ([fileName isEqualToString:[fileNameField stringValue]])
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PCLogInfo(self, @"{%@} file name changed from: %@ to: %@",
|
/* 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
|
- (void)panelDidResignKey:(NSNotification *)aNotif
|
||||||
{
|
{
|
||||||
if ([fileIconField isEditable] == YES)
|
if ([fileNameField isEditable] == YES)
|
||||||
{
|
{
|
||||||
[inspectorPanel makeFirstResponder:fileIcon];
|
[inspectorPanel makeFirstResponder:fileIconView];
|
||||||
[fileIconField setStringValue:fileName];
|
[fileNameField setStringValue:fileName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,15 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCProject.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
#include <ProjectCenter/PCProjectEditor.h>
|
#import <ProjectCenter/PCProjectEditor.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCPrefController.h>
|
#import <ProjectCenter/PCPrefController.h>
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
#include <Protocols/CodeEditor.h>
|
#import <Protocols/CodeEditor.h>
|
||||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||||
|
|
||||||
@implementation PCProjectLoadedFiles
|
@implementation PCProjectLoadedFiles
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
[filesScroll setHasHorizontalScroller:NO];
|
[filesScroll setHasHorizontalScroller:NO];
|
||||||
[filesScroll setHasVerticalScroller:YES];
|
[filesScroll setHasVerticalScroller:YES];
|
||||||
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||||
objectForKey: SeparateLoadedFiles] isEqualToString: @"NO"])
|
objectForKey:SeparateLoadedFiles] isEqualToString:@"NO"])
|
||||||
{
|
{
|
||||||
[filesScroll setBorderType:NSBezelBorder];
|
[filesScroll setBorderType:NSBezelBorder];
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver:self
|
addObserver:self
|
||||||
selector:@selector(fileWillOpen:)
|
selector:@selector(fileDidOpen:)
|
||||||
name:PCEditorWillOpenNotification
|
name:PCEditorDidOpenNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
@ -228,7 +228,7 @@
|
||||||
// ==== Notifications
|
// ==== Notifications
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
- (void)fileWillOpen:(NSNotification *)aNotif
|
- (void)fileDidOpen:(NSNotification *)aNotif
|
||||||
{
|
{
|
||||||
id<CodeEditor> editor = [aNotif object];
|
id<CodeEditor> editor = [aNotif object];
|
||||||
NSString *filePath = nil;
|
NSString *filePath = nil;
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
row = [[self editedFilesRep] indexOfObject:filePath];
|
row = [[self editedFilesRep] indexOfObject:filePath];
|
||||||
[filesList selectRow:row byExtendingSelection:NO];
|
[filesList selectRow:row byExtendingSelection:NO];
|
||||||
|
|
||||||
PCLogInfo(self, @"fileWillOpen.END");
|
// PCLogInfo(self, @"fileDidOpen.END");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)fileDidClose:(NSNotification *)aNotif
|
- (void)fileDidClose:(NSNotification *)aNotif
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
{
|
{
|
||||||
filePath = [editor path];
|
filePath = [editor path];
|
||||||
index = [[self editedFilesRep] indexOfObject:filePath];
|
index = [[self editedFilesRep] indexOfObject:filePath];
|
||||||
if (index >=0 && index < filesCount)
|
if (index < filesCount)
|
||||||
{
|
{
|
||||||
[filesList selectRow:index byExtendingSelection:NO];
|
[filesList selectRow:index byExtendingSelection:NO];
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
#include "Protocols/ProjectType.h"
|
#include "Protocols/ProjectType.h"
|
||||||
#include "Protocols/CodeEditor.h"
|
#include "Protocols/CodeEditor.h"
|
||||||
#include "Protocols/ProjectEditor.h"
|
|
||||||
|
|
||||||
NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
|
|
||||||
|
@ -445,7 +444,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
NSString *_file = nil;
|
NSString *_file = nil;
|
||||||
NSString *_2file = nil;
|
NSString *_2file = nil;
|
||||||
NSString *_resFile = nil;
|
NSString *_resFile = nil;
|
||||||
int i = 0;
|
unsigned i = 0;
|
||||||
PCProject<ProjectType> *project = nil;
|
PCProject<ProjectType> *project = nil;
|
||||||
NSMutableArray *otherResArray = nil;
|
NSMutableArray *otherResArray = nil;
|
||||||
NSString *plistFile = nil;
|
NSString *plistFile = nil;
|
||||||
|
@ -825,7 +824,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
NSString *directory = [activeProject dirForCategoryKey:categoryKey];
|
NSString *directory = [activeProject dirForCategoryKey:categoryKey];
|
||||||
NSString *removeString = nil;
|
NSString *removeString = nil;
|
||||||
NSMutableArray *subprojs = [NSMutableArray array];
|
NSMutableArray *subprojs = [NSMutableArray array];
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
// Determining target project
|
// Determining target project
|
||||||
if ([categoryKey isEqualToString:PCSubprojects])
|
if ([categoryKey isEqualToString:PCSubprojects])
|
||||||
|
@ -1293,7 +1292,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
NSString *spDir = nil;
|
NSString *spDir = nil;
|
||||||
NSDictionary *spDict = nil;
|
NSDictionary *spDict = nil;
|
||||||
NSString *spName = nil;
|
NSString *spName = nil;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
files = [fileManager
|
files = [fileManager
|
||||||
filesForAddOfTypes:[NSArray arrayWithObjects:@"subproj",nil]];
|
filesForAddOfTypes:[NSArray arrayWithObjects:@"subproj",nil]];
|
||||||
|
|
|
@ -23,23 +23,23 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCSplitView.h>
|
#import <ProjectCenter/PCSplitView.h>
|
||||||
#include <ProjectCenter/PCButton.h>
|
#import <ProjectCenter/PCButton.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCProjectManager.h>
|
#import <ProjectCenter/PCProjectManager.h>
|
||||||
#include <ProjectCenter/PCProject.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCProjectWindow.h>
|
#import <ProjectCenter/PCProjectWindow.h>
|
||||||
#include <ProjectCenter/PCProjectBrowser.h>
|
#import <ProjectCenter/PCProjectBrowser.h>
|
||||||
#include <ProjectCenter/PCProjectEditor.h>
|
#import <ProjectCenter/PCProjectEditor.h>
|
||||||
#include <ProjectCenter/PCProjectBuilder.h>
|
#import <ProjectCenter/PCProjectBuilder.h>
|
||||||
#include <ProjectCenter/PCProjectLauncher.h>
|
#import <ProjectCenter/PCProjectLauncher.h>
|
||||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||||
#include <ProjectCenter/PCProjectInspector.h>
|
#import <ProjectCenter/PCProjectInspector.h>
|
||||||
|
|
||||||
#include <ProjectCenter/PCPrefController.h>
|
#import <ProjectCenter/PCPrefController.h>
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
@implementation PCProjectWindow
|
@implementation PCProjectWindow
|
||||||
|
|
||||||
|
@ -63,21 +63,9 @@
|
||||||
[h_split adjustSubviews];
|
[h_split adjustSubviews];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_initUI
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
NSRect rect;
|
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 setToolTip:@"Build"];
|
||||||
// [buildButton setImage:IMAGE(@"Build")];
|
// [buildButton setImage:IMAGE(@"Build")];
|
||||||
|
@ -103,6 +91,8 @@
|
||||||
// [inspectorButton setImage:IMAGE(@"Inspector")];
|
// [inspectorButton setImage:IMAGE(@"Inspector")];
|
||||||
|
|
||||||
[fileIcon setFileNameField:fileIconTitle];
|
[fileIcon setFileNameField:fileIconTitle];
|
||||||
|
[fileIcon setDelegate:[project projectBrowser]];
|
||||||
|
[fileIcon updateIcon];
|
||||||
|
|
||||||
[statusLine setStringValue:@""];
|
[statusLine setStringValue:@""];
|
||||||
|
|
||||||
|
@ -167,11 +157,18 @@
|
||||||
_isToolbarVisible = YES;
|
_isToolbarVisible = YES;
|
||||||
_splitViewsRestored = NO;
|
_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];
|
[self setTitle];
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
[projectWindow setFrameAutosaveName: @"ProjectWindow"];
|
[projectWindow setFrameAutosaveName:@"ProjectWindow"];
|
||||||
|
|
||||||
pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"];
|
pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"];
|
||||||
windowFrame = [pcWindows objectForKey:@"ProjectWindow"];
|
windowFrame = [pcWindows objectForKey:@"ProjectWindow"];
|
||||||
|
@ -225,6 +222,23 @@
|
||||||
selector:@selector (browserDidSetPath:)
|
selector:@selector (browserDidSetPath:)
|
||||||
name:PCBrowserDidSetPathNotification
|
name:PCBrowserDidSetPathNotification
|
||||||
object:[project projectBrowser]];
|
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;
|
return self;
|
||||||
|
@ -372,8 +386,10 @@
|
||||||
|
|
||||||
- (void)showProjectLoadedFiles:(id)sender
|
- (void)showProjectLoadedFiles:(id)sender
|
||||||
{
|
{
|
||||||
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
||||||
NSScrollView *componentView = [[project projectLoadedFiles] componentView];
|
NSScrollView *componentView;
|
||||||
|
|
||||||
|
componentView = (NSScrollView *)[[project projectLoadedFiles] componentView];
|
||||||
|
|
||||||
// PCLogInfo(self, @"showProjectLoadedFiles");
|
// PCLogInfo(self, @"showProjectLoadedFiles");
|
||||||
|
|
||||||
|
@ -618,7 +634,50 @@
|
||||||
|
|
||||||
- (void)browserDidSetPath:(NSNotification *)aNotif
|
- (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";
|
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||||
FirstResponder = {
|
FirstResponder = {
|
||||||
Actions = (
|
Actions = (
|
||||||
"fileNameDidChange:"
|
"fileNameDidChange:",
|
||||||
|
"setLocalizableResource:"
|
||||||
);
|
);
|
||||||
Super = NSObject;
|
Super = NSObject;
|
||||||
};
|
};
|
||||||
|
@ -23,7 +24,8 @@
|
||||||
PCProjectInspector = {
|
PCProjectInspector = {
|
||||||
Actions = (
|
Actions = (
|
||||||
"fileNameDidChange:",
|
"fileNameDidChange:",
|
||||||
"setPublicHeader:"
|
"setPublicHeader:",
|
||||||
|
"setLocalizableResource:"
|
||||||
);
|
);
|
||||||
Outlets = (
|
Outlets = (
|
||||||
fileIconView,
|
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/Info.table \
|
||||||
Resources/C.syntax \
|
Resources/C.syntax \
|
||||||
Resources/ObjC.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
|
# Header files
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
// TODO: Needs checking
|
// TODO: Needs checking
|
||||||
@implementation PCEditor (Document)
|
@implementation PCEditor (Document)
|
||||||
|
|
||||||
#import "CommandQueryPanel.h"
|
|
||||||
#import "LineQueryPanel.h"
|
|
||||||
#import "TextFinder.h"
|
|
||||||
#import "EditorRulerView.h"
|
#import "EditorRulerView.h"
|
||||||
#import "EditorTextView.h"
|
#import "EditorTextView.h"
|
||||||
#import "SyntaxHighlighter.h"
|
#import "SyntaxHighlighter.h"
|
||||||
|
@ -154,76 +151,9 @@ unsigned int FindDelimiterInString(NSString * string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)pipeOutputOfCommand:(NSString *)command
|
// --- Parentesis highlighting
|
||||||
{
|
|
||||||
NSTask * task;
|
|
||||||
NSPipe * inPipe, * outPipe;
|
|
||||||
NSString * inString, * outString;
|
|
||||||
NSFileHandle * inputHandle;
|
|
||||||
|
|
||||||
inString = [[textView string] substringWithRange:
|
- (void)unhighlightCharacter
|
||||||
[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
|
|
||||||
{
|
{
|
||||||
if (isCharacterHighlit)
|
if (isCharacterHighlit)
|
||||||
{
|
{
|
||||||
|
@ -274,7 +204,7 @@ unsigned int FindDelimiterInString(NSString * string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) highlightCharacterAt: (unsigned int) location
|
- (void)highlightCharacterAt:(unsigned int)location
|
||||||
{
|
{
|
||||||
if (isCharacterHighlit == NO)
|
if (isCharacterHighlit == NO)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +245,7 @@ unsigned int FindDelimiterInString(NSString * string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) computeNewParenthesisNesting
|
- (void)computeNewParenthesisNesting
|
||||||
{
|
{
|
||||||
NSRange selectedRange;
|
NSRange selectedRange;
|
||||||
NSString * myString;
|
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]];
|
icon = [NSImage imageNamed:
|
||||||
}*/
|
[NSString stringWithFormat: @"File_%@_mod", [self fileType]]];
|
||||||
}
|
|
||||||
|
|
||||||
- (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]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = NSMakeRange([[textView string] length], 0);
|
icon = [NSImage imageNamed:
|
||||||
}
|
[NSString stringWithFormat: @"File_%@", [self fileType]]];
|
||||||
[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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[self updateChangeCount: NSChangeDone];
|
[myWindow setMiniwindowImage: icon];
|
||||||
}
|
|
||||||
|
|
||||||
- (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]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -57,6 +57,36 @@
|
||||||
NSArray *parserMethods;
|
NSArray *parserMethods;
|
||||||
// NSMutableArray *classNames;
|
// NSMutableArray *classNames;
|
||||||
// NSMutableArray *methodNames;
|
// 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;
|
- (BOOL)editorShouldClose;
|
||||||
|
@ -72,6 +102,10 @@
|
||||||
// ==== TextView (_intEditorView, _extEditorView) delegate
|
// ==== TextView (_intEditorView, _extEditorView) delegate
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
- (void)textDidChange:(NSNotification *)aNotification;
|
- (void)textDidChange:(NSNotification *)aNotification;
|
||||||
|
- (void)textViewDidChangeSelection:(NSNotification *)notification;
|
||||||
|
- (void)editorTextViewWillPressKey:sender;
|
||||||
|
- (void)editorTextViewDidPressKey:sender;
|
||||||
|
|
||||||
- (BOOL)becomeFirstResponder;
|
- (BOOL)becomeFirstResponder;
|
||||||
- (BOOL)resignFirstResponder;
|
- (BOOL)resignFirstResponder;
|
||||||
|
|
||||||
|
@ -85,5 +119,24 @@
|
||||||
|
|
||||||
@end
|
@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_
|
#endif // _PCEDITOR_H_
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,15 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ProjectCenter/PCDefines.h>
|
#import <ProjectCenter/PCDefines.h>
|
||||||
#include <ProjectCenter/PCProjectWindow.h>
|
#import <ProjectCenter/PCProjectWindow.h>
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#import <ProjectCenter/PCLogController.h>
|
||||||
|
|
||||||
#include "PCEditor.h"
|
#import "PCEditor.h"
|
||||||
#include "PCEditorView.h"
|
#import "PCEditorView.h"
|
||||||
|
//#import "CommandQueryPanel.h"
|
||||||
|
//#import "LineQueryPanel.h"
|
||||||
|
//#import "TextFinder.h"
|
||||||
|
|
||||||
@implementation PCEditor (UInterface)
|
@implementation PCEditor (UInterface)
|
||||||
|
|
||||||
|
@ -124,6 +127,8 @@
|
||||||
RELEASE(lm);
|
RELEASE(lm);
|
||||||
|
|
||||||
ev = [[PCEditorView alloc] initWithFrame:fr textContainer:tc];
|
ev = [[PCEditorView alloc] initWithFrame:fr textContainer:tc];
|
||||||
|
[ev setBackgroundColor:textBackground];
|
||||||
|
[ev setTextColor:textColor];
|
||||||
[ev createSyntaxHighlighterForFileType:[_path pathExtension]];
|
[ev createSyntaxHighlighterForFileType:[_path pathExtension]];
|
||||||
[ev setEditor:self];
|
[ev setEditor:self];
|
||||||
|
|
||||||
|
@ -165,18 +170,57 @@
|
||||||
_isEdited = NO;
|
_isEdited = NO;
|
||||||
_isWindowed = NO;
|
_isWindowed = NO;
|
||||||
_isExternal = YES;
|
_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;
|
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
|
- (void)setParser:(id)parser
|
||||||
{
|
{
|
||||||
// NSLog(@"RC aParser:%i parser:%i",
|
/* NSLog(@"RC aParser:%i parser:%i",
|
||||||
// [aParser retainCount], [parser retainCount]);
|
[aParser retainCount], [parser retainCount]);*/
|
||||||
ASSIGN(aParser, parser);
|
ASSIGN(aParser, parser);
|
||||||
// NSLog(@"RC aParser:%i parser:%i",
|
/* NSLog(@"RC aParser:%i parser:%i",
|
||||||
// [aParser retainCount], [parser retainCount]);
|
[aParser retainCount], [parser retainCount]);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)openFileAtPath:(NSString *)file
|
- (id)openFileAtPath:(NSString *)file
|
||||||
|
@ -184,37 +228,38 @@
|
||||||
projectEditor:(id)aProjectEditor
|
projectEditor:(id)aProjectEditor
|
||||||
editable:(BOOL)editable
|
editable:(BOOL)editable
|
||||||
{
|
{
|
||||||
NSString *text;
|
NSString *text;
|
||||||
NSAttributedString *attributedString;
|
NSAttributedString *attributedString = [NSAttributedString alloc];
|
||||||
NSDictionary *attributes;
|
NSMutableDictionary *attributes = [NSMutableDictionary new];
|
||||||
NSFont *font;
|
NSFont *font;
|
||||||
NSColor *textBackground;
|
// NSColor *textBackground;
|
||||||
|
|
||||||
|
NSLog(@"PCEditor: openFileAtPath");
|
||||||
|
|
||||||
|
// Inform about future file opening
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:PCEditorWillOpenNotification
|
||||||
|
object:self];
|
||||||
projectEditor = aProjectEditor;
|
projectEditor = aProjectEditor;
|
||||||
_path = [file copy];
|
_path = [file copy];
|
||||||
_categoryPath = [categoryPath copy];
|
_categoryPath = [categoryPath copy];
|
||||||
_storage = [[NSTextStorage alloc] init];
|
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
font = [NSFont userFixedPitchFontOfSize:0.0];
|
font = [NSFont userFixedPitchFontOfSize:0.0];
|
||||||
if (editable)
|
if (editable)
|
||||||
{
|
{
|
||||||
textBackground = [NSColor whiteColor];
|
textBackground = backgroundColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textBackground = [NSColor colorWithCalibratedRed:0.97
|
textBackground = readOnlyColor;
|
||||||
green:0.90
|
|
||||||
blue:0.90
|
|
||||||
alpha:1.0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
|
[attributes setObject:font forKey:NSFontAttributeName];
|
||||||
font, NSFontAttributeName,
|
[attributes setObject:textBackground forKey:NSBackgroundColorAttributeName];
|
||||||
textBackground, NSBackgroundColorAttributeName];
|
|
||||||
text = [NSString stringWithContentsOfFile:file];
|
text = [NSString stringWithContentsOfFile:file];
|
||||||
attributedString = [[NSAttributedString alloc] initWithString:text
|
[attributedString initWithString:text attributes:attributes];
|
||||||
attributes:attributes];
|
|
||||||
//
|
//
|
||||||
|
|
||||||
_storage = [[NSTextStorage alloc] init];
|
_storage = [[NSTextStorage alloc] init];
|
||||||
|
@ -229,7 +274,6 @@
|
||||||
{
|
{
|
||||||
[self _createInternalView];
|
[self _createInternalView];
|
||||||
[_intEditorView setEditable:editable];
|
[_intEditorView setEditable:editable];
|
||||||
[_intEditorView setBackgroundColor:textBackground];
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver:self
|
addObserver:self
|
||||||
|
@ -244,11 +288,12 @@
|
||||||
selector:@selector(textDidChange:)
|
selector:@selector(textDidChange:)
|
||||||
name:NSTextDidChangeNotification
|
name:NSTextDidChangeNotification
|
||||||
object:_extEditorView];
|
object:_extEditorView];
|
||||||
|
|
||||||
// Inform about future file opening
|
// File open was finished
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName:PCEditorWillOpenNotification
|
postNotificationName:PCEditorDidOpenNotification
|
||||||
object:self];
|
object:self];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,31 +360,12 @@
|
||||||
object:self];
|
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
|
// ==== Accessory methods
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
//--- CodeEditor protocol
|
||||||
|
|
||||||
- (id)projectEditor
|
- (id)projectEditor
|
||||||
{
|
{
|
||||||
return projectEditor;
|
return projectEditor;
|
||||||
|
@ -411,6 +437,84 @@
|
||||||
_isEdited = yn;
|
_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
|
- (BOOL)isWindowed
|
||||||
{
|
{
|
||||||
return _isWindowed;
|
return _isWindowed;
|
||||||
|
@ -461,9 +565,28 @@
|
||||||
|
|
||||||
- (BOOL)saveFile
|
- (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
|
- (BOOL)saveFileTo:(NSString *)path
|
||||||
|
@ -478,6 +601,15 @@
|
||||||
NSDictionary *at = nil;
|
NSDictionary *at = nil;
|
||||||
NSFont *ft = nil;
|
NSFont *ft = nil;
|
||||||
|
|
||||||
|
if (_isEdited == NO)
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:PCEditorWillRevertNotification
|
||||||
|
object:self];
|
||||||
|
|
||||||
// This is temporary
|
// This is temporary
|
||||||
ft = [NSFont userFixedPitchFontOfSize:0.0];
|
ft = [NSFont userFixedPitchFontOfSize:0.0];
|
||||||
at = [NSDictionary dictionaryWithObject:ft forKey:NSFontAttributeName];
|
at = [NSDictionary dictionaryWithObject:ft forKey:NSFontAttributeName];
|
||||||
|
@ -492,6 +624,10 @@
|
||||||
[_intEditorView setNeedsDisplay:YES];
|
[_intEditorView setNeedsDisplay:YES];
|
||||||
[_extEditorView setNeedsDisplay:YES];
|
[_extEditorView setNeedsDisplay:YES];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:PCEditorDidRevertNotification
|
||||||
|
object:self];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,10 +747,45 @@
|
||||||
if ([object isKindOfClass:[PCEditorView class]]
|
if ([object isKindOfClass:[PCEditorView class]]
|
||||||
&& (object == _intEditorView || object == _extEditorView))
|
&& (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
|
- (BOOL)becomeFirstResponder
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
@ -637,57 +808,12 @@
|
||||||
// ==== Parser and scrolling
|
// ==== 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
|
// === Scrolling
|
||||||
|
|
||||||
|
- (void)fileStructureItemSelected:(NSString *)item
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (void)scrollToClassName:(NSString *)className
|
- (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
|
@end
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#import <AppKit/NSTextView.h>
|
||||||
/*#import <AppKit/NSView.h>
|
|
||||||
#import <AppKit/NSTextView.h>*/
|
|
||||||
|
|
||||||
@class NSColor;
|
@class NSColor;
|
||||||
@class PCEditor;
|
@class PCEditor;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Implementation of the PCEditorView class for the
|
Implementation of the PCEditorView class for the
|
||||||
ProjectManager application.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -40,8 +40,7 @@
|
||||||
#import "PCEditor.h"
|
#import "PCEditor.h"
|
||||||
#import "SyntaxHighlighter.h"
|
#import "SyntaxHighlighter.h"
|
||||||
|
|
||||||
static inline float
|
static inline float my_abs(float aValue)
|
||||||
my_abs(float aValue)
|
|
||||||
{
|
{
|
||||||
if (aValue >= 0)
|
if (aValue >= 0)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +124,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
|
|
||||||
@interface PCEditorView (Private)
|
@interface PCEditorView (Private)
|
||||||
|
|
||||||
- (void) insertSpaceFillAlignedAtTabsOfSize: (unsigned int) tabSize;
|
- (void)insertSpaceFillAlignedAtTabsOfSize:(unsigned int)tabSize;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
*
|
*
|
||||||
* @argument tabSize Specifies how many spaces represent one tab.
|
* @argument tabSize Specifies how many spaces represent one tab.
|
||||||
*/
|
*/
|
||||||
- (void) insertSpaceFillAlignedAtTabsOfSize: (unsigned int) tabSize
|
- (void)insertSpaceFillAlignedAtTabsOfSize:(unsigned int)tabSize
|
||||||
{
|
{
|
||||||
char buf[tabSize];
|
char buf[tabSize];
|
||||||
NSString * string = [self string];
|
NSString * string = [self string];
|
||||||
|
@ -174,51 +173,51 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
|
|
||||||
@implementation PCEditorView
|
@implementation PCEditorView
|
||||||
|
|
||||||
+ (NSFont *) defaultEditorFont
|
+ (NSFont *)defaultEditorFont
|
||||||
{
|
{
|
||||||
NSUserDefaults * df = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *df = [NSUserDefaults standardUserDefaults];
|
||||||
NSString * fontName;
|
NSString *fontName;
|
||||||
float fontSize;
|
float fontSize;
|
||||||
NSFont * font = nil;
|
NSFont *font;
|
||||||
|
|
||||||
fontName = [df objectForKey:@"EditorFont"];
|
fontName = [df objectForKey:@"EditorFont"];
|
||||||
fontSize = [df floatForKey:@"EditorFontSize"];
|
fontSize = [df floatForKey:@"EditorFontSize"];
|
||||||
|
|
||||||
if (fontName != nil)
|
if (fontName != nil)
|
||||||
{
|
{
|
||||||
font = [NSFont fontWithName: fontName size: fontSize];
|
font = [NSFont fontWithName:fontName size:fontSize];
|
||||||
}
|
}
|
||||||
if (font == nil)
|
if (font == nil)
|
||||||
{
|
{
|
||||||
font = [NSFont userFixedPitchFontOfSize: fontSize];
|
font = [NSFont userFixedPitchFontOfSize:fontSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont *) defaultEditorBoldFont
|
+ (NSFont *)defaultEditorBoldFont
|
||||||
{
|
{
|
||||||
NSFont * font = [self defaultEditorFont];
|
NSFont *font = [self defaultEditorFont];
|
||||||
|
|
||||||
return [[NSFontManager sharedFontManager] convertFont: font
|
return [[NSFontManager sharedFontManager] convertFont:font
|
||||||
toHaveTrait: NSBoldFontMask];
|
toHaveTrait:NSBoldFontMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont *) defaultEditorItalicFont
|
+ (NSFont *)defaultEditorItalicFont
|
||||||
{
|
{
|
||||||
NSFont * font = [self defaultEditorFont];
|
NSFont *font = [self defaultEditorFont];
|
||||||
|
|
||||||
return [[NSFontManager sharedFontManager] convertFont: font
|
return [[NSFontManager sharedFontManager] convertFont:font
|
||||||
toHaveTrait: NSItalicFontMask];
|
toHaveTrait:NSItalicFontMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont *) defaultEditorBoldItalicFont
|
+ (NSFont *)defaultEditorBoldItalicFont
|
||||||
{
|
{
|
||||||
NSFont * font = [self defaultEditorFont];
|
NSFont *font = [self defaultEditorFont];
|
||||||
|
|
||||||
return [[NSFontManager sharedFontManager] convertFont: font
|
return [[NSFontManager sharedFontManager] convertFont:font
|
||||||
toHaveTrait: NSBoldFontMask |
|
toHaveTrait:NSBoldFontMask |
|
||||||
NSItalicFontMask];
|
NSItalicFontMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
@ -238,7 +237,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
}
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
- (void) dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
TEST_RELEASE(highlighter);
|
TEST_RELEASE(highlighter);
|
||||||
|
|
||||||
|
@ -247,10 +246,10 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
|
|
||||||
- (void)setEditor:(PCEditor *)anEditor
|
- (void)setEditor:(PCEditor *)anEditor
|
||||||
{
|
{
|
||||||
ASSIGN(editor, anEditor);
|
editor = anEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
/* NSData * data;
|
/* NSData * data;
|
||||||
NSUserDefaults * df = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults * df = [NSUserDefaults standardUserDefaults];
|
||||||
|
@ -285,9 +284,8 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
- (void)createSyntaxHighlighterForFileType:(NSString *)fileType
|
- (void)createSyntaxHighlighterForFileType:(NSString *)fileType
|
||||||
{
|
{
|
||||||
ASSIGN(highlighter, [[[SyntaxHighlighter alloc]
|
ASSIGN(highlighter, [[[SyntaxHighlighter alloc]
|
||||||
initWithFileType: fileType textStorage: [self textStorage]]
|
initWithFileType:fileType
|
||||||
autorelease]);
|
textStorage:[self textStorage]] autorelease]);
|
||||||
// [highlighter highlightRange: NSMakeRange(0, [[self string] length])];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertText:text
|
- (void)insertText:text
|
||||||
|
@ -364,16 +362,16 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
||||||
*/
|
*/
|
||||||
- (void)keyDown:(NSEvent *)ev
|
- (void)keyDown:(NSEvent *)ev
|
||||||
{
|
{
|
||||||
// [editorDocument editorTextViewWillPressKey: self];
|
[editor editorTextViewWillPressKey: self];
|
||||||
[super keyDown:ev];
|
[super keyDown:ev];
|
||||||
// [editorDocument editorTextViewDidPressKey: self];
|
[editor editorTextViewDidPressKey: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)paste:sender
|
- (void)paste:sender
|
||||||
{
|
{
|
||||||
// [editorDocument editorTextViewWillPressKey: self];
|
[editor editorTextViewWillPressKey:self];
|
||||||
[super paste:sender];
|
[super paste:sender];
|
||||||
// [editorDocument editorTextViewDidPressKey: self];
|
[editor editorTextViewDidPressKey:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)ev
|
- (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 = "/\\*";
|
Beginning = "/\\*";
|
||||||
Ending = "\\*/";
|
Ending = "\\*/";
|
||||||
ForegroundColor = "0.4 0.4 0.4";
|
ForegroundColor = "0.0 0.0 1.0";
|
||||||
Italic = YES;
|
Italic = YES;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
{
|
{
|
||||||
Beginning = "//";
|
Beginning = "//";
|
||||||
Ending = "\n";
|
Ending = "\n";
|
||||||
ForegroundColor = "0.4 0.4 0.4";
|
ForegroundColor = "0.0 0.0 1.0";
|
||||||
Italic = YES;
|
Italic = YES;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -748,16 +748,16 @@ LocateString(NSString * str,
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) highlightRange: (NSRange) r
|
- (void)highlightRange:(NSRange)r
|
||||||
{
|
{
|
||||||
if (delayedProcessedRange.length > 0)
|
if (delayedProcessedRange.length > 0)
|
||||||
{
|
{
|
||||||
[self beginEditingIfNeeded];
|
[self beginEditingIfNeeded];
|
||||||
[self fixUpContextsInRange: delayedProcessedRange];
|
[self fixUpContextsInRange:delayedProcessedRange];
|
||||||
[self fixUpKeywordsInRange: delayedProcessedRange];
|
[self fixUpKeywordsInRange:delayedProcessedRange];
|
||||||
|
|
||||||
if ([self contextAtEndOfRange: delayedProcessedRange] !=
|
if ([self contextAtEndOfRange:delayedProcessedRange] !=
|
||||||
[self contextAfterRange: delayedProcessedRange])
|
[self contextAfterRange:delayedProcessedRange])
|
||||||
{
|
{
|
||||||
NSRange invalidatedRange;
|
NSRange invalidatedRange;
|
||||||
|
|
||||||
|
@ -765,9 +765,9 @@ LocateString(NSString * str,
|
||||||
|
|
||||||
invalidatedRange = NSMakeRange(NSMaxRange(delayedProcessedRange),
|
invalidatedRange = NSMakeRange(NSMaxRange(delayedProcessedRange),
|
||||||
[textStorage length] - NSMaxRange(delayedProcessedRange));
|
[textStorage length] - NSMaxRange(delayedProcessedRange));
|
||||||
[textStorage addAttribute: KeywordsNotFixedAttributeName
|
[textStorage addAttribute:KeywordsNotFixedAttributeName
|
||||||
value: [NSNull null]
|
value:[NSNull null]
|
||||||
range: invalidatedRange];
|
range:invalidatedRange];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,8 +7,8 @@ ADDITIONAL_CPPFLAGS +=
|
||||||
ADDITIONAL_INCLUDE_DIRS += -I../../../ -I../../../Headers
|
ADDITIONAL_INCLUDE_DIRS += -I../../../ -I../../../Headers
|
||||||
ADDITIONAL_LIB_DIRS += -L../../../Library/ProjectCenter.framework/Versions/Current
|
ADDITIONAL_LIB_DIRS += -L../../../Library/ProjectCenter.framework/Versions/Current
|
||||||
|
|
||||||
# BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources
|
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources
|
||||||
$(BUNDLE_NAME)_STANDARD_INSTALL = no
|
# $(BUNDLE_NAME)_STANDARD_INSTALL = no
|
||||||
|
|
||||||
DO_LIB_LINK=no
|
DO_LIB_LINK=no
|
||||||
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||||
|
|
|
@ -29,6 +29,7 @@ ProjectCenter_HEADERS= \
|
||||||
PCParser.h \
|
PCParser.h \
|
||||||
CodeHandler.h \
|
CodeHandler.h \
|
||||||
ObjCCommentHandler.h \
|
ObjCCommentHandler.h \
|
||||||
|
ObjCClassHandler.h \
|
||||||
ObjCMethodHandler.h
|
ObjCMethodHandler.h
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -37,6 +38,7 @@ ProjectCenter_HEADERS= \
|
||||||
ProjectCenter_OBJC_FILES= \
|
ProjectCenter_OBJC_FILES= \
|
||||||
PCParser.m \
|
PCParser.m \
|
||||||
ObjCCommentHandler.m \
|
ObjCCommentHandler.m \
|
||||||
|
ObjCClassHandler.m \
|
||||||
ObjCMethodHandler.m
|
ObjCMethodHandler.m
|
||||||
|
|
||||||
include ../../GNUmakefile.bundles
|
include ../../GNUmakefile.bundles
|
||||||
|
|
|
@ -28,24 +28,26 @@
|
||||||
#include "ObjCCommentHandler.h"
|
#include "ObjCCommentHandler.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassStart ClassSymbol ClassName ClassEnd
|
* ClassStart ClassSymbol ClassName ClassSuper ClassProto | ClassCategory
|
||||||
* @interface/@implementation Name ;/{
|
* @... CName : CSuper < Protocol > | ( Category )
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* MethodStart is after each ';' or new line
|
* ClassStart is after each ';' or new line
|
||||||
* MethodSymbol is +/- for objective-C
|
* ClassSymbol is '@' with 'interface'/'implementation' after that
|
||||||
* MethodReturnValue is surround by '(' and ')', and can be ignore
|
* ClassName started after ClassSymbol and next first ' '
|
||||||
* MethodName contain method name and messages
|
* ClassCategory is surround by '(' and ')'. Started after ClassName and ' '
|
||||||
* MethodNone is not method;
|
* ClassNone is not method;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum _CheckStep {
|
typedef enum _CS {
|
||||||
ClassStart,
|
ClassStart,
|
||||||
ClassSymbol,
|
ClassSymbol,
|
||||||
ClassReturnValue,
|
ClassName,
|
||||||
ClassName,
|
ClassSuper,
|
||||||
ClassNone
|
ClassProto,
|
||||||
} CheckStep;
|
ClassCategory,
|
||||||
|
ClassBody,
|
||||||
|
ClassNone,
|
||||||
|
} CS;
|
||||||
|
|
||||||
|
|
||||||
@class NSMutableString;
|
@class NSMutableString;
|
||||||
|
@ -56,18 +58,27 @@ typedef enum _CheckStep {
|
||||||
unsigned int position;
|
unsigned int position;
|
||||||
|
|
||||||
BOOL inSpace;
|
BOOL inSpace;
|
||||||
|
NSMutableString *keyword;
|
||||||
NSMutableString *class;
|
NSMutableString *class;
|
||||||
NSMutableArray *classes;
|
NSMutableArray *classes;
|
||||||
unichar _preSymbol;
|
unichar _preSymbol;
|
||||||
unsigned classBeginPosition;
|
unsigned nameBeginPosition;
|
||||||
|
unsigned nameEndPosition;
|
||||||
|
unsigned bodyBeginPosition;
|
||||||
|
int bodySymbolCount;
|
||||||
|
|
||||||
CheckStep step;
|
CS step;
|
||||||
|
CS prev_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSArray of NSDictionaries
|
// NSArray of NSDictionaries
|
||||||
// (method = NSString; position = NSNumber)
|
// ClassName = NSString;
|
||||||
|
// ClassNameRange = NSString <- NSStringFromRange(NSRange)
|
||||||
|
// ClassBodyRange = NSString <- NSStringFromRange(NSRange)
|
||||||
- (NSArray *)classes;
|
- (NSArray *)classes;
|
||||||
|
|
||||||
|
- (void)addClassToArray;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* _ObjCClassHandler_H_ */
|
#endif /* _ObjCClassHandler_H_ */
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
** 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
|
@implementation ObjCClassHandler
|
||||||
|
|
||||||
|
@ -30,12 +30,17 @@
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
position = 0;
|
position = 0;
|
||||||
classBeginPosition = 0;
|
nameBeginPosition = 0;
|
||||||
|
nameEndPosition = 0;
|
||||||
|
bodyBeginPosition = 0;
|
||||||
|
bodySymbolCount = -1;
|
||||||
|
|
||||||
inSpace = NO;
|
inSpace = NO;
|
||||||
|
keyword = [[NSMutableString alloc] init];
|
||||||
class = [[NSMutableString alloc] init];
|
class = [[NSMutableString alloc] init];
|
||||||
classes = [[NSMutableArray alloc] init];
|
classes = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
prev_step = ClassNone;
|
||||||
step = ClassNone;
|
step = ClassNone;
|
||||||
_preSymbol = 0;
|
_preSymbol = 0;
|
||||||
|
|
||||||
|
@ -45,6 +50,7 @@
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
NSLog(@"ClassHandler: dealloc");
|
NSLog(@"ClassHandler: dealloc");
|
||||||
|
RELEASE(keyword);
|
||||||
RELEASE(class);
|
RELEASE(class);
|
||||||
RELEASE(classes);
|
RELEASE(classes);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -52,7 +58,35 @@
|
||||||
|
|
||||||
- (NSArray *)classes
|
- (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: @""];}
|
#define NotClass {step = ClassNone; [class setString: @""];}
|
||||||
|
@ -61,16 +95,16 @@
|
||||||
{
|
{
|
||||||
unsigned int len = [element length];
|
unsigned int len = [element length];
|
||||||
|
|
||||||
[super string: element];
|
[super string:element];
|
||||||
|
|
||||||
/* Comments */
|
/* Comments */
|
||||||
if (_commentType != NoComment)
|
if (_commentType != NoComment)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if (_stringBegin/* != NoString*/)
|
else if (_stringBegin /* != NoString*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else if (step != ClassNone)
|
||||||
{
|
{
|
||||||
inSpace = NO;
|
inSpace = NO;
|
||||||
|
|
||||||
|
@ -78,25 +112,13 @@
|
||||||
{
|
{
|
||||||
NotClass;
|
NotClass;
|
||||||
}
|
}
|
||||||
else if (step == MethodSymbol)
|
else if (step == ClassSymbol)
|
||||||
{
|
{
|
||||||
if (_preSymbol == '(')
|
[keyword appendString:element];
|
||||||
step = MethodReturnValue;
|
|
||||||
else if ((_preSymbol == '+') || (_preSymbol == '='))
|
|
||||||
step = MethodName;
|
|
||||||
|
|
||||||
[method appendString: element];
|
|
||||||
}
|
}
|
||||||
else if (step == MethodReturnValue)
|
else if ((step == ClassName) || (step == ClassCategory))
|
||||||
{
|
{
|
||||||
if (_preSymbol == ')')
|
[class appendString:element];
|
||||||
step = MethodName;
|
|
||||||
|
|
||||||
[method appendString: element];
|
|
||||||
}
|
|
||||||
else if (step == MethodName)
|
|
||||||
{
|
|
||||||
[method appendString: element];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +128,7 @@
|
||||||
|
|
||||||
- (void)number:(NSString *)element
|
- (void)number:(NSString *)element
|
||||||
{
|
{
|
||||||
[super number: element];
|
[super number:element];
|
||||||
|
|
||||||
/* Comments */
|
/* Comments */
|
||||||
if (_commentType != NoComment)
|
if (_commentType != NoComment)
|
||||||
|
@ -123,13 +145,17 @@
|
||||||
{
|
{
|
||||||
NotClass;
|
NotClass;
|
||||||
}
|
}
|
||||||
else if (step == ClassSymbol)
|
/* else if (step == ClassSymbol)
|
||||||
{
|
{
|
||||||
NotClass;
|
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;
|
BOOL newline = NO;
|
||||||
|
|
||||||
[super spaceAndNewLine: element];
|
[super spaceAndNewLine:element];
|
||||||
|
|
||||||
if ((element == 0x0A) || (element == 0x0D))
|
if ((element == 0x0A) || (element == 0x0D))
|
||||||
{
|
{
|
||||||
|
@ -159,20 +185,52 @@
|
||||||
{
|
{
|
||||||
if (step != ClassNone)
|
if (step != ClassNone)
|
||||||
{
|
{
|
||||||
if ((!newline) && (!inSpace))
|
/* if ((!newline) && (!inSpace))
|
||||||
{
|
{
|
||||||
[method appendString:[NSString stringWithFormat:@"%c",element]];
|
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||||
}
|
|
||||||
if (element == ' ')
|
|
||||||
{
|
|
||||||
inSpace = YES;
|
|
||||||
}
|
}
|
||||||
|
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;
|
step = ClassStart;
|
||||||
classBeginPosition = position;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +240,7 @@
|
||||||
|
|
||||||
- (void)symbol:(unichar)element
|
- (void)symbol:(unichar)element
|
||||||
{
|
{
|
||||||
[super symbol: element];
|
[super symbol:element];
|
||||||
|
|
||||||
/* Comments */
|
/* Comments */
|
||||||
if (_commentType != NoComment)
|
if (_commentType != NoComment)
|
||||||
|
@ -196,55 +254,45 @@
|
||||||
inSpace = NO;
|
inSpace = NO;
|
||||||
_preSymbol = element;
|
_preSymbol = element;
|
||||||
|
|
||||||
if (step == ClassStart)
|
if ((step == ClassStart) || (step == ClassBody))
|
||||||
{
|
{
|
||||||
if ((element == '+') || (element == '-'))
|
if (element == '@')
|
||||||
{
|
{
|
||||||
step = ClassSymbol;
|
prev_step = step;
|
||||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
step = ClassSymbol;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
NotClass;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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 == ')')
|
if (element == ')')
|
||||||
{
|
{
|
||||||
step = ClassName;
|
step = ClassName;
|
||||||
}
|
}
|
||||||
[method appendString:[NSString stringWithFormat:@"%c", element]];
|
[class appendString:[NSString stringWithFormat:@"%c",element]];
|
||||||
}
|
}
|
||||||
else if (step == ClassName)
|
else if (step == ClassProto)
|
||||||
{
|
{
|
||||||
if (element != '{')
|
if (element == '>')
|
||||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((element == ';') || (element == '{') ||
|
|
||||||
(element == '}') || (position == 0))
|
|
||||||
{
|
|
||||||
step = ClassStart;
|
|
||||||
classBeginPosition = position;
|
|
||||||
if ([class length])
|
|
||||||
{
|
{
|
||||||
NSDictionary *dict;
|
step = ClassName;
|
||||||
|
|
||||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
||||||
AUTORELEASE([class copy]), @"class",
|
|
||||||
[NSNumber numberWithUnsignedInt:methodBeginPosition], @"position", nil];
|
|
||||||
[methods addObject: dict];
|
|
||||||
}
|
}
|
||||||
[class setString:@""];
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
position++;
|
position++;
|
||||||
|
@ -254,7 +302,7 @@
|
||||||
- (void)invisible:(unichar)element
|
- (void)invisible:(unichar)element
|
||||||
{
|
{
|
||||||
[super invisible:element];
|
[super invisible:element];
|
||||||
position ++;
|
position++;
|
||||||
_preChar = element;
|
_preChar = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,9 @@ typedef enum _CheckStep {
|
||||||
MethodBody,
|
MethodBody,
|
||||||
MethodSymbol,
|
MethodSymbol,
|
||||||
MethodReturnValue,
|
MethodReturnValue,
|
||||||
MethodName,
|
MethodName,
|
||||||
|
MethodParameterStart,
|
||||||
|
MethodParameter,
|
||||||
MethodNone
|
MethodNone
|
||||||
} CheckStep;
|
} CheckStep;
|
||||||
|
|
||||||
|
@ -65,6 +67,7 @@ typedef enum _CheckStep {
|
||||||
int bodySymbolCount;
|
int bodySymbolCount;
|
||||||
|
|
||||||
CheckStep step;
|
CheckStep step;
|
||||||
|
CheckStep prev_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSArray of NSDictionaries
|
// NSArray of NSDictionaries
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
method = [[NSMutableString alloc] init];
|
method = [[NSMutableString alloc] init];
|
||||||
methods = [[NSMutableArray alloc] init];
|
methods = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
step = MethodNone;
|
prev_step = step = MethodNone;
|
||||||
_preSymbol = 0;
|
_preSymbol = 0;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -108,30 +108,14 @@
|
||||||
{
|
{
|
||||||
NotMethod;
|
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)
|
else if (step == MethodName)
|
||||||
{
|
{
|
||||||
[method appendString:element];
|
[method appendString:element];
|
||||||
}
|
}
|
||||||
|
else if (step == MethodParameterStart)
|
||||||
|
{
|
||||||
|
step = MethodParameter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
position += len;
|
position += len;
|
||||||
|
@ -197,12 +181,17 @@
|
||||||
{
|
{
|
||||||
if (step != MethodNone)
|
if (step != MethodNone)
|
||||||
{
|
{
|
||||||
if ((!newline) && (!inSpace))
|
/* if ((!newline) && (!inSpace))
|
||||||
{
|
{
|
||||||
[method appendString:[NSString stringWithFormat:@"%c",element]];
|
[method appendString:[NSString stringWithFormat:@"%c",element]];
|
||||||
}
|
}*/
|
||||||
if (element == ' ')
|
if (element == ' ' || newline)
|
||||||
{
|
{
|
||||||
|
if (step == MethodParameter)
|
||||||
|
{
|
||||||
|
step = MethodName;
|
||||||
|
prev_step = MethodNone;
|
||||||
|
}
|
||||||
inSpace = YES;
|
inSpace = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +210,7 @@
|
||||||
|
|
||||||
- (void)symbol:(unichar)element
|
- (void)symbol:(unichar)element
|
||||||
{
|
{
|
||||||
[super symbol: element];
|
[super symbol:element];
|
||||||
|
|
||||||
/* Comments */
|
/* Comments */
|
||||||
if (_commentType != NoComment)
|
if (_commentType != NoComment)
|
||||||
|
@ -244,22 +233,34 @@
|
||||||
nameBeginPosition = position;
|
nameBeginPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* else if (step == MethodSymbol)
|
else if ((step == MethodName) || (step == MethodParameterStart))
|
||||||
{
|
{
|
||||||
if (element == '(')
|
if (element == '(')
|
||||||
{
|
{
|
||||||
|
if (step == MethodParameterStart)
|
||||||
|
{
|
||||||
|
prev_step = step;
|
||||||
|
}
|
||||||
step = MethodReturnValue;
|
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 == ')')
|
if (prev_step == MethodParameterStart)
|
||||||
{
|
{
|
||||||
step = MethodName;
|
step = prev_step;
|
||||||
}
|
}
|
||||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
else
|
||||||
}*/
|
{
|
||||||
|
step = MethodName;
|
||||||
|
}
|
||||||
|
// [method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||||
|
}
|
||||||
else if ((step == MethodName) && (element != '{') && (element != ';'))
|
else if ((step == MethodName) && (element != '{') && (element != ';'))
|
||||||
{
|
{
|
||||||
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
[method appendString:[NSString stringWithFormat: @"%c", element]];
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Protocols/CodeParser.h>
|
#import <Protocols/CodeParser.h>
|
||||||
|
|
||||||
#include "PCParser.h"
|
#import "PCParser.h"
|
||||||
#include "ObjCMethodHandler.h"
|
#import "ObjCClassHandler.h"
|
||||||
|
#import "ObjCMethodHandler.h"
|
||||||
|
|
||||||
typedef enum _CodeType {
|
typedef enum _CodeType {
|
||||||
StringCodeType, /* 41-5A, 61-7A, 5F */
|
StringCodeType, /* 41-5A, 61-7A, 5F */
|
||||||
|
@ -39,17 +40,19 @@ typedef enum _CodeType {
|
||||||
// ==== Initialisation
|
// ==== Initialisation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
- (id) init
|
- (id)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
NSLog(@"CEParser: dealloc");
|
NSLog(@"PCParser: dealloc");
|
||||||
free(_uchar);
|
free(_uchar);
|
||||||
RELEASE(_string);
|
RELEASE(_string);
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)setString:(NSString *)text
|
- (id)setString:(NSString *)text
|
||||||
|
@ -70,11 +73,11 @@ typedef enum _CodeType {
|
||||||
|
|
||||||
- (NSArray *)classNames
|
- (NSArray *)classNames
|
||||||
{
|
{
|
||||||
/* _handler = [[ObjCClassHandler alloc] init];
|
_handler = [[ObjCClassHandler alloc] init];
|
||||||
[self parse];
|
[self parse];
|
||||||
AUTORELEASE(_handler);
|
AUTORELEASE(_handler);
|
||||||
|
|
||||||
return [(ObjCClassHandler *)_handler methods];*/
|
return [(ObjCClassHandler *)_handler classes];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)methodNames
|
- (NSArray *)methodNames
|
||||||
|
@ -142,15 +145,15 @@ static void (*impSymbol)(id, SEL, unichar);
|
||||||
NSLog(@"CodeParser begin...");
|
NSLog(@"CodeParser begin...");
|
||||||
|
|
||||||
impString = (void (*)(id, SEL, id))
|
impString = (void (*)(id, SEL, id))
|
||||||
[[_handler class] instanceMethodForSelector: selString];
|
[[_handler class] instanceMethodForSelector:selString];
|
||||||
impNumber = (void (*)(id, SEL, id))
|
impNumber = (void (*)(id, SEL, id))
|
||||||
[[_handler class] instanceMethodForSelector: selNumber];
|
[[_handler class] instanceMethodForSelector:selNumber];
|
||||||
impSpaceAndNewLine = (void (*)(id, SEL, unichar))
|
impSpaceAndNewLine = (void (*)(id, SEL, unichar))
|
||||||
[[_handler class] instanceMethodForSelector: selSpaceAndNewLine];
|
[[_handler class] instanceMethodForSelector:selSpaceAndNewLine];
|
||||||
impInvisible = (void (*)(id, SEL, unichar))
|
impInvisible = (void (*)(id, SEL, unichar))
|
||||||
[[_handler class] instanceMethodForSelector: selInvisible];
|
[[_handler class] instanceMethodForSelector:selInvisible];
|
||||||
impSymbol = (void (*)(id, SEL, unichar))
|
impSymbol = (void (*)(id, SEL, unichar))
|
||||||
[[_handler class] instanceMethodForSelector: selSymbol];
|
[[_handler class] instanceMethodForSelector:selSymbol];
|
||||||
|
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
startType = codeType(_uchar+start);
|
startType = codeType(_uchar+start);
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include <ProjectCenter/PCLogController.h>
|
#include <ProjectCenter/PCLogController.h>
|
||||||
#include <ProjectCenter/ProjectCenter.h>
|
#include <ProjectCenter/ProjectCenter.h>
|
||||||
|
|
||||||
|
#include <Protocols/CodeEditor.h>
|
||||||
|
|
||||||
#include "PCAppController.h"
|
#include "PCAppController.h"
|
||||||
#include "PCMenuController.h"
|
#include "PCMenuController.h"
|
||||||
#include "PCInfoController.h"
|
#include "PCInfoController.h"
|
||||||
|
@ -206,10 +208,10 @@
|
||||||
[project addFiles:[NSArray arrayWithObject:newFilePath]
|
[project addFiles:[NSArray arrayWithObject:newFilePath]
|
||||||
forKey:PCNonProject
|
forKey:PCNonProject
|
||||||
notify:YES];
|
notify:YES];
|
||||||
[[project projectEditor] editorForFile:newFilePath
|
[[project projectEditor] openEditorForFile:newFilePath
|
||||||
categoryPath:categoryPath
|
categoryPath:categoryPath
|
||||||
editable:YES
|
editable:YES
|
||||||
windowed:NO];
|
windowed:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue