*** empty log message ***

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_4@19258 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2004-05-07 12:15:26 +00:00
parent b6f5be86d3
commit bd44b4a7c4
6 changed files with 354 additions and 51 deletions

View file

@ -22,14 +22,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef _PCHistoryPanel_h
#define _PCHistoryPanel_h
#ifndef _PCLoadedFilesPanel_h
#define _PCLoadedFilesPanel_h
#include <AppKit/AppKit.h>
@class PCProjectManager;
@interface PCHistoryPanel : NSPanel
@interface PCLoadedFilesPanel : NSPanel
{
PCProjectManager *projectManager;
NSBox *contentBox;

View file

@ -24,19 +24,19 @@
#include "PCProjectManager.h"
#include "PCProject.h"
#include "PCProjectHistory.h"
#include "PCHistoryPanel.h"
#include "PCProjectLoadedFiles.h"
#include "PCLoadedFilesPanel.h"
@implementation PCHistoryPanel
@implementation PCLoadedFilesPanel
- (id)initWithProjectManager:(PCProjectManager *)aManager
{
PCProjectHistory *projectHistory = nil;
PCProject *activeProject = nil;
PCProjectLoadedFiles *projectLoadedFiles = nil;
PCProject *activeProject = nil;
projectManager = aManager;
activeProject = [projectManager rootActiveProject];
projectHistory = [activeProject projectHistory];
projectLoadedFiles = [activeProject projectLoadedFiles];
self = [super initWithContentRect: NSMakeRect (0, 300, 220, 322)
styleMask: (NSTitledWindowMask
@ -57,7 +57,7 @@
[contentBox setBorderType:NSNoBorder];
[self setContentView:contentBox];
[contentBox setContentView:[projectHistory componentView]];
[contentBox setContentView:[projectLoadedFiles componentView]];
// Track project switching
[[NSNotificationCenter defaultCenter]
@ -76,7 +76,7 @@
- (void)dealloc
{
NSLog (@"PCHistoryPanel: dealloc");
NSLog (@"PCLoadedFilesPanel: dealloc");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
@ -102,7 +102,7 @@
else
{
[contentBox
setContentView:[[activeProject projectHistory] componentView]];
setContentView:[[activeProject projectLoadedFiles] componentView]];
}
}

View file

@ -2,33 +2,47 @@
* Project ProjectCenter
*/
#ifndef _PCProjectHistory_h_
#define _PCProjectHistory_h_
#ifndef _PCProjectLoadedFiles_h_
#define _PCProjectLoadedFiles_h_
#include <AppKit/AppKit.h>
@class PCProject;
@interface PCProjectHistory : NSObject
typedef enum _PHSortType
{
PHSortByTime,
PHSortByName
} PHSortType;
@interface PCProjectLoadedFiles : NSObject
{
PCProject *project;
NSTableView *filesList;
NSTableColumn *filesColumn;
NSScrollView *filesScroll;
NSMutableArray *editedFiles;
NSMutableArray *filesPath;
PHSortType sortType;
}
- (id)initWithProject:(PCProject *)aProj;
- (void)dealloc;
- (NSView *)componentView;
- (NSArray *)editedFilesRep;
- (void)setSortType:(PHSortType)type;
- (void)setSortByTime;
- (void)setSortByName;
- (void)selectNextFile;
- (void)selectPreviousFile;
- (void)click:(id)sender;
- (void)doubleClick:(id)sender;
@end
@interface PCProjectHistory (HistoryTableDelegate)
@interface PCProjectLoadedFiles (HistoryTableDelegate)
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;

View file

@ -2,13 +2,14 @@
* Project ProjectCenter
*/
#include "PCProjectHistory.h"
#include "PCDefines.h"
#include "PCProject.h"
#include "PCProjectEditor.h"
#include "PCEditor.h"
@implementation PCProjectHistory
#include "PCProjectLoadedFiles.h"
@implementation PCProjectLoadedFiles
- (id)initWithProject:(PCProject *)aProj
{
@ -18,7 +19,6 @@
{
project = aProj;
editedFiles = [[NSMutableArray alloc] init];
filesPath = [[NSMutableArray alloc] init];
// Column
filesColumn = [[NSTableColumn alloc] initWithIdentifier: @"Files List"];
@ -53,11 +53,13 @@
[filesScroll setHasHorizontalScroller:NO];
[filesScroll setHasVerticalScroller:YES];
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
objectForKey: SeparateHistory] isEqualToString: @"NO"])
objectForKey: SeparateLoadedFiles] isEqualToString: @"NO"])
{
[filesScroll setBorderType:NSBezelBorder];
}
sortType = PHSortByTime;
[filesList reloadData];
[[NSNotificationCenter defaultCenter]
@ -84,22 +86,104 @@
- (void)dealloc
{
NSLog (@"PCProjectHistory: dealloc");
NSLog (@"PCProjectLoadedFiles: dealloc");
[[NSNotificationCenter defaultCenter] removeObserver:self];
RELEASE(filesColumn);
RELEASE(filesList);
RELEASE(editedFiles);
RELEASE(filesPath);
[super dealloc];
}
- (NSView *)componentView
{
return filesScroll;
}
- (NSArray *)editedFilesRep
{
if (sortType == PHSortByName)
{
NSArray *sortedArray = nil;
sortedArray = [editedFiles
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
return sortedArray;
}
return editedFiles;
}
- (void)setSortType:(PHSortType)type
{
int row;
NSString *filePath = nil;
if ([editedFiles count] > 0)
{
row = [filesList selectedRow];
filePath = [[self editedFilesRep] objectAtIndex:row];
}
sortType = type;
[filesList reloadData];
if ([editedFiles count] > 0)
{
row = [[self editedFilesRep] indexOfObject:filePath];
[filesList selectRow:row byExtendingSelection:NO];
}
}
- (void)setSortByTime
{
[self setSortType:PHSortByTime];
}
- (void)setSortByName
{
[self setSortType:PHSortByName];
}
- (void)selectNextFile
{
int row = [filesList selectedRow];
if (row == ([filesList numberOfRows]-1))
{
[filesList selectRow:0 byExtendingSelection:NO];
}
else
{
[filesList selectRow:row+1 byExtendingSelection:NO];
}
[self click:self];
}
- (void)selectPreviousFile
{
int row = [filesList selectedRow];
if (row == 0)
{
[filesList selectRow:[filesList numberOfRows]-1 byExtendingSelection:NO];
}
else
{
[filesList selectRow:row-1 byExtendingSelection:NO];
}
[self click:self];
}
- (void)click:(id)sender
{
int row = [filesList selectedRow];
NSString *path = [filesPath objectAtIndex:row];
NSString *path = [[self editedFilesRep] objectAtIndex:row];
[[project projectEditor] orderFrontEditorForFile:path];
}
@ -107,12 +191,7 @@
- (void)doubleClick:(id)sender
{
// TODO: Open separate editor window for file
NSLog(@"ProjectHistory doubleClick received");
}
- (NSView *)componentView
{
return filesScroll;
NSLog(@"ProjectLoadedFiles doubleClick received");
}
// ===========================================================================
@ -122,55 +201,63 @@
- (void)fileDidOpen:(NSNotification *)aNotif
{
PCEditor *editor = [aNotif object];
NSString *path = nil;
NSString *file = nil;
NSString *filePath = nil;
int row;
if ([editor projectEditor] != [project projectEditor])
{
return;
}
NSLog(@"PCProjectHistory: project %@", [project projectName]);
NSLog(@"PCProjectLoadedFiles: project %@", [project projectName]);
path = [editor path];
file = [path lastPathComponent];
filePath = [editor path];
if ([editedFiles containsObject:file] == YES)
if ([editedFiles containsObject:filePath] == YES)
{
[editedFiles removeObject:file];
[editedFiles removeObject:filePath];
}
[editedFiles insertObject:file atIndex:0];
[filesPath insertObject:path atIndex:0];
[editedFiles insertObject:filePath atIndex:0];
[filesList reloadData];
row = [[self editedFilesRep] indexOfObject:filePath];
[filesList selectRow:row byExtendingSelection:NO];
NSLog(@"PCProjectHistory: fileDidOpen.END");
NSLog(@"PCProjectLoadedFiles: fileDidOpen.END");
}
- (void)fileDidClose:(NSNotification *)aNotif
{
PCEditor *editor = [aNotif object];
NSString *file = [[editor path] lastPathComponent];
NSString *filePath = [editor path];
if ([editor projectEditor] != [project projectEditor])
{
NSLog(@"File from other project closed");
return;
}
if ([editedFiles containsObject:file] == YES)
if ([editedFiles containsObject:filePath] == YES)
{
unsigned index = [editedFiles indexOfObject:file];
[editedFiles removeObject:file];
[filesPath removeObjectAtIndex:index];
[editedFiles removeObject:filePath];
[filesList reloadData];
if ([editedFiles count] > 0)
{
unsigned row;
filePath = [editedFiles objectAtIndex:0];
row = [[self editedFilesRep] indexOfObject:filePath];
[filesList selectRow:row byExtendingSelection:NO];
}
}
}
- (void)editorDidBecomeActive:(NSNotification *)aNotif
{
PCEditor *editor = [aNotif object];
NSString *file = nil;
NSString *filePath = nil;
unsigned index;
if ([editor projectEditor] != [project projectEditor])
@ -180,15 +267,15 @@
if ([editedFiles count] > 0)
{
file = [[editor path] lastPathComponent];
index = [editedFiles indexOfObject:file];
filePath = [editor path];
index = [[self editedFilesRep] indexOfObject:filePath];
[filesList selectRow:index byExtendingSelection:NO];
}
}
@end
@implementation PCProjectHistory (HistoryTableDelegate)
@implementation PCProjectLoadedFiles (LoadedFilesTableDelegate)
- (int)numberOfRowsInTableView: (NSTableView *)aTableView
{
@ -209,7 +296,17 @@
return nil;
}
return [editedFiles objectAtIndex: rowIndex];
if (sortType == PHSortByName)
{
NSArray *sortedArray = nil;
sortedArray = [editedFiles
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
return [[sortedArray objectAtIndex:rowIndex] lastPathComponent];
}
return [[editedFiles objectAtIndex:rowIndex] lastPathComponent];
}
- (void) tableView:(NSTableView *)aTableView

View file

@ -0,0 +1,192 @@
{
FirstResponder = {
Actions = (
"activateContextHelpMode:",
"alignCenter:",
"alignJustified:",
"alignLeft:",
"alignRight:",
"arrangeInFront:",
"cancel:",
"capitalizeWord:",
"changeColor:",
"checkSpelling:",
"close:",
"complete:",
"copy:",
"copyFont:",
"copyRuler:",
"cut:",
"delete:",
"deleteBackward:",
"deleteForward:",
"deleteToBeginningOfLine:",
"deleteToBeginningOfParagraph:",
"deleteToEndOfLine:",
"deleteToEndOfParagraph:",
"deleteToMark:",
"deleteWordBackward:",
"deleteWordForward:",
"deminiaturize:",
"deselectAll:",
"fax:",
"hide:",
"hideOtherApplications:",
"indent:",
"loosenKerning:",
"lowerBaseline:",
"lowercaseWord:",
"makeKeyAndOrderFront:",
"miniaturize:",
"miniaturizeAll:",
"moveBackward:",
"moveBackwardAndModifySelection:",
"moveDown:",
"moveDownAndModifySelection:",
"moveForward:",
"moveForwardAndModifySelection:",
"moveLeft:",
"moveRight:",
"moveToBeginningOfDocument:",
"moveToBeginningOfLine:",
"moveToBeginningOfParagraph:",
"moveToEndOfDocument:",
"moveToEndOfLine:",
"moveToEndOfParagraph:",
"moveUp:",
"moveUpAndModifySelection:",
"moveWordBackward:",
"moveWordBackwardAndModifySelection:",
"moveWordForward:",
"moveWordForwardAndModifySelection:",
"newDocument:",
"ok:",
"open:",
"openDocument:",
"orderBack:",
"orderFront:",
"orderFrontColorPanel:",
"orderFrontDataLinkPanel:",
"orderFrontHelpPanel:",
"orderFrontStandardAboutPanel:",
"orderFrontStandardInfoPanel:",
"orderOut:",
"pageDown:",
"pageUp:",
"paste:",
"pasteAsPlainText:",
"pasteAsRichText:",
"pasteFont:",
"pasteRuler:",
"performClose:",
"performMiniaturize:",
"performZoom:",
"print:",
"raiseBaseline:",
"revertDocumentToSaved:",
"runPageLayout:",
"runToolbarCustomizationPalette:",
"saveAllDocuments:",
"saveDocument:",
"saveDocumentAs:",
"saveDocumentTo:",
"scrollLineDown:",
"scrollLineUp:",
"scrollPageDown:",
"scrollPageUp:",
"scrollViaScroller:",
"selectAll:",
"selectLine:",
"selectNextKeyView:",
"selectParagraph:",
"selectPreviousKeyView:",
"selectText:",
"selectToMark:",
"selectWord:",
"showContextHelp:",
"showGuessPanel:",
"showHelp:",
"showWindow:",
"stop:",
"subscript:",
"superscript:",
"swapWithMark:",
"takeDoubleValueFrom:",
"takeFloatValueFrom:",
"takeIntValueFrom:",
"takeObjectValueFrom:",
"takeStringValueFrom:",
"terminate:",
"tightenKerning:",
"toggle:",
"toggleContinuousSpellChecking:",
"toggleRuler:",
"toggleToolbarShown:",
"toggleTraditionalCharacterShape:",
"transpose:",
"transposeWords:",
"turnOffKerning:",
"turnOffLigatures:",
"underline:",
"unhide:",
"unhideAllApplications:",
"unscript:",
"uppercaseWord:",
"useAllLigatures:",
"useStandardKerning:",
"useStandardLigatures:",
"yank:",
"zoom:"
);
Super = NSObject;
};
PCAppController = {
Actions = (
);
Outlets = (
menuController
);
Super = NSObject;
};
PCMenuController = {
Actions = (
"showInfoPanel:",
"showPrefWindow:",
"projectOpen:",
"projectNew:",
"projectSave:",
"projectAddFiles:",
"projectSaveFiles:",
"projectRemoveFiles:",
"subprojectNew:",
"subprojectAdd:",
"fileOpen:",
"fileNew:",
"fileSave:",
"fileSaveAs:",
"fileSaveTo:",
"fileRevertToSaved:",
"fileClose:",
"fileOpenQuickly:",
"fileRename:",
"fileNewUntitled:",
"showInspector:",
"showBuildPanel:",
"showHistoryPanel:",
"runTarget:",
"executeBuild:",
"stopBuild:",
"startClean:",
"showLaunchPanel:",
"debugTarget:",
"toggleToolbar:",
"historySortByTime:",
"historySortByName:",
"historyNextFile:",
"historyPreviousFile:"
);
Outlets = (
);
Super = NSObject;
};
}

Binary file not shown.