mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
* Headers/ProjectCenter/PCEditormanager.h: Added. * PCMenuController.m: (-fileSaveAs:): move code to PCProjectManager.m. * Headers/ProjectCenter/PCEditorManager.h: New file. * Framework/PCEditorManager.m: New file. Superclass for PCProjectEditor. * Framework/PCProjectManager.m: Use PCEditorManager. Implement opening files outside of projects (fixes bug #15992). * Framework/PCProjectLoadedFiles.m: Use PCEditorManager. * Framework/PCProject.m: (-setProjectManager:): Use new method of initializing PCProjectEditor. * Framework/GNUmakefile: Add PCEditorManager.[hm]. * Framework/PCProjectBrowser.m: Made use of PCProjectEditor's editorForFile: method. * Framework/PCProjectEditor.m: Remove initializing of extern variables (moved into PCEditorManager). Use '_componentView' var instead of 'componentView'. The same with _scrollView and _project. (-initWithProject:): renamed into init. Removed code duplicated with superclass' code. (-dealloc): Removed code duplicated with superclass' code. (-editorForFile🔑): Removed. Code moved into superclass' editorForFile: method. (-openEditorForCategoryPath:windowed:): Code that determines existance of file and if file is plain text move into [super openEditorForFile:editable:windowed:]. Changed file opening coditions. Made use of [<CodeEditor> fileStructureItemSelected] method. Code that determines classes and methods in category path was removed. (openEditorForFile:categoryPath:editable:windowed:): Removed in favour of superclass' method. (activeEditor): Ditto. (allEditors): Ditto. (closeActiveEditor:): Ditto. (closeEditorForFile:): Ditto. (saveFile): Ditto. (saveFileTo:): Ditto. (revertFileToSaved): Ditto. (editorDidResignActive:): Ditto. (editorDidChangeFileName:): Ditto. (closeAllEditors:): Cleanup. (saveFileAs:): Made use of new -openEditorForFile:editable:windowed: method. * Framework/PCProjectWindow.m: Made usage of editorManager method of <CodeEditor> protocol. * Modules/Editors/ProjectCenter/PCEditorView.m: (becomeFirstResponder): Use new -becomeFirstResponder: method of PCEditor class. * Modules/Editors/ProjectCenter/PCEditor.h: Change name of var projectEditor to _editorManager. Add parameter (PCEditorView *)view to becomeFistResponder and resignFirstResponder methods. Add some comments. * Modules/Editors/ProjectCenter/PCEditor.m: Rename method -openFileAtPath:categoryPath:projectEditor:editable: to -openFileAtPath:editorManager:editable. Rename -projectEditor method to -editorManager. Change becomeFistResponder and resignFirstResponder methods' definitions. (fileStructureItemSelected:): Add initial implementation of action code according to the type of selected item. * Headers/Protocols/CodeEditor.h: Change definition of -openFileAtPath:categoryPath:projectEditor:editable: mathod to -openFileAtPath:editorManager:editable. Remove methods scrollToClassName: and scrollToMethodName:. Rename projectEditor method into editorManager. * Headers/ProjectCenter/PCProjectEditor.h: Made PCProjectEditor as subclass of PCEditorManager. Add prefix '_' to variables. (-initWithProject:): renamed into init. (setProject:): Added. Removed methods and variables duplicated with superclass. * Headers/ProjectCenter/PCProjectManager.h: Add editorManager var. (-saveFileAs:): renamed to saveFileAs. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@25991 72102866-910b-0410-8b05-ffd578937521
235 lines
7 KiB
Objective-C
235 lines
7 KiB
Objective-C
/*
|
|
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
|
|
|
Copyright (C) 2000-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 _PCProjectManager_h_
|
|
#define _PCProjectManager_h_
|
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
@class PCBundleManager;
|
|
@class PCFileManager;
|
|
@class PCEditorManager;
|
|
@class PCProject;
|
|
@class PCProjectInspector;
|
|
@class PCProjectBuilder;
|
|
@class PCProjectLauncher;
|
|
@class PCProjectLoadedFiles;
|
|
@class PCProjectFinder;
|
|
|
|
@class NewSubprojectController;
|
|
|
|
extern NSString *PCActiveProjectDidChangeNotification;
|
|
|
|
@interface PCProjectManager : NSObject
|
|
{
|
|
id delegate;
|
|
id prefController;
|
|
|
|
PCBundleManager *bundleManager;
|
|
NSMutableDictionary *projectTypes;
|
|
|
|
PCFileManager *fileManager;
|
|
PCEditorManager *editorManager;
|
|
PCProjectInspector *projectInspector;
|
|
|
|
NSPanel *buildPanel;
|
|
NSPanel *launchPanel;
|
|
NSPanel *loadedFilesPanel;
|
|
NSPanel *findPanel;
|
|
|
|
NSMutableDictionary *loadedProjects;
|
|
PCProject *activeProject;
|
|
|
|
NSTimer *saveTimer;
|
|
|
|
NSMutableDictionary *nonProjectEditors;
|
|
|
|
NSBox *projectTypeAccessaryView;
|
|
id projectTypePopup;
|
|
|
|
NSBox *fileTypeAccessaryView;
|
|
id fileTypePopup;
|
|
|
|
IBOutlet NSPanel *nsPanel;
|
|
IBOutlet NSImageView *nsImage;
|
|
IBOutlet NSTextField *nsTitle;
|
|
IBOutlet NSTextField *projectNameField;
|
|
IBOutlet NSTextField *nsNameField;
|
|
IBOutlet NSPopUpButton *nsTypePB;
|
|
IBOutlet NSButton *nsCancelButton;
|
|
IBOutlet NSButton *nsCreateButton;
|
|
|
|
@private
|
|
BOOL _needsReleasing;
|
|
}
|
|
|
|
// ============================================================================
|
|
// ==== Intialization & deallocation
|
|
// ============================================================================
|
|
- (id)init;
|
|
- (void)dealloc;
|
|
- (void)setDelegate:(id)aDelegate;
|
|
- (id)delegate;
|
|
- (void)setPrefController:(id)aController;
|
|
- (id)prefController;
|
|
|
|
- (void)createProjectTypeAccessaryView;
|
|
- (NSMutableDictionary *)loadProjectTypesInfo;
|
|
|
|
// ============================================================================
|
|
// ==== Timer handling
|
|
// ============================================================================
|
|
- (BOOL)startSaveTimer;
|
|
- (BOOL)resetSaveTimer:(NSNotification *)notif;
|
|
- (BOOL)stopSaveTimer;
|
|
|
|
// ============================================================================
|
|
// ==== Accessory methods
|
|
// ============================================================================
|
|
- (PCBundleManager *)bundleManager;
|
|
- (PCFileManager *)fileManager;
|
|
- (PCProjectInspector *)projectInspector;
|
|
- (NSPanel *)inspectorPanel;
|
|
- (void)showProjectInspector:(id)sender;
|
|
- (NSPanel *)loadedFilesPanel;
|
|
- (void)showProjectLoadedFiles:(id)sender;
|
|
- (NSPanel *)buildPanel;
|
|
- (NSPanel *)launchPanel;
|
|
- (NSPanel *)projectFinderPanel;
|
|
- (NSString *)projectPath;
|
|
- (NSString *)selectedFileName;
|
|
|
|
// ============================================================================
|
|
// ==== Project management
|
|
// ============================================================================
|
|
|
|
// Returns all currently loaded projects. They are stored with their absolut
|
|
// paths as the keys.
|
|
- (NSMutableDictionary *)loadedProjects;
|
|
- (PCProject *)activeProject;
|
|
- (PCProject *)rootActiveProject;
|
|
- (void)setActiveProject:(PCProject *)aProject;
|
|
|
|
// ============================================================================
|
|
// ==== Project actions
|
|
// ============================================================================
|
|
|
|
- (PCProject *)convertLegacyProject:(NSMutableDictionary *)pDict
|
|
atPath:(NSString *)aPath;
|
|
|
|
// Returns the loaded project if the builder class is known, nil else.
|
|
- (PCProject *)loadProjectAt:(NSString *)aPath;
|
|
|
|
// Invokes loadProjectAt to load the project properly.
|
|
- (BOOL)openProjectAt:(NSString *)aPath;
|
|
|
|
- (PCProject *)createProjectOfType:(NSString *)projectType
|
|
path:(NSString *)aPath;
|
|
|
|
- (void)openProject;
|
|
- (void)newProject;
|
|
- (BOOL)saveProject;
|
|
|
|
// Calls saveAllProjects if the preferences are setup accordingly.
|
|
- (void)saveAllProjectsIfNeeded;
|
|
|
|
// Saves all projects if needed.
|
|
- (BOOL)saveAllProjects;
|
|
- (BOOL)addProjectFiles;
|
|
- (BOOL)saveProjectFiles;
|
|
- (BOOL)removeProjectFiles;
|
|
|
|
- (void)closeProject:(PCProject *)aProject;
|
|
- (void)closeProject;
|
|
- (BOOL)closeAllProjects;
|
|
|
|
// ============================================================================
|
|
// ==== File actions
|
|
// ============================================================================
|
|
|
|
- (void)openFile;
|
|
- (void)newFile;
|
|
- (BOOL)saveFile;
|
|
- (BOOL)saveFileAs;
|
|
- (BOOL)saveFileTo;
|
|
- (BOOL)revertFileToSaved;
|
|
- (BOOL)renameFile;
|
|
- (void)closeFile;
|
|
|
|
// ============================================================================
|
|
// ==== Non project editors
|
|
// ============================================================================
|
|
|
|
- (void)openFileWithEditor:(NSString *)path;
|
|
- (void)editorDidClose:(NSNotification *)aNotif;
|
|
|
|
@end
|
|
|
|
@interface PCProjectManager (FileManagerDelegates)
|
|
|
|
// Returns the full path if the type is valid, nil else.
|
|
- (NSString *)fileManager:(id)sender
|
|
willCreateFile:(NSString *)aFile
|
|
withKey:(NSString *)key;
|
|
|
|
// Adds the file to the project and updates the makefile!
|
|
- (void)fileManager:(id)sender
|
|
didCreateFile:(NSString *)aFile
|
|
withKey:(NSString *)key;
|
|
|
|
@end
|
|
|
|
@interface NSObject (PCProjectManagerDelegates)
|
|
|
|
- (void)projectManager:(id)sender willCloseProject:(PCProject *)aProject;
|
|
- (void)projectManager:(id)sender didCloseProject:(PCProject *)aProject;
|
|
- (void)projectManager:(id)sender didOpenProject:(PCProject *)aProject;
|
|
- (BOOL)projectManager:(id)sender shouldOpenProject:(PCProject *)aProject;
|
|
|
|
@end
|
|
|
|
@interface NewSubprojectController : NSWindowController
|
|
{
|
|
id image;
|
|
id nameTextField;
|
|
id typePopup;
|
|
id createButton;
|
|
id cancelButton;
|
|
}
|
|
|
|
@end
|
|
|
|
@interface PCProjectManager (Subprojects)
|
|
|
|
- (BOOL)newSubproject;
|
|
- (BOOL)addSubproject;
|
|
- (void)closeNewSubprojectPanel:(id)sender;
|
|
- (BOOL)createSubproject:(id)sender;
|
|
- (PCProject *)createSubprojectOfType:(NSString *)projectType
|
|
path:(NSString *)aPath;
|
|
- (BOOL)createSubproject;
|
|
@end
|
|
|
|
#endif
|