mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-18 16:41:35 +00:00
First attempt of integrating a history browser for better file navigation.
There are still bugs though... git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12628 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
78eaf33537
commit
50bdad85b9
8 changed files with 199 additions and 24 deletions
|
@ -68,7 +68,8 @@ PCTextFinder.h \
|
|||
PCProjectEditor.h \
|
||||
ProjectComponent.h \
|
||||
PCProject+ComponentHandling.h \
|
||||
PCEditorView+Highlighting.h
|
||||
PCEditorView+Highlighting.h \
|
||||
PCHistoryController.h
|
||||
|
||||
#
|
||||
|
||||
|
@ -92,7 +93,8 @@ PCEditorController.m \
|
|||
PCTextFinder.m \
|
||||
PCProjectEditor.m \
|
||||
PCProject+ComponentHandling.m \
|
||||
PCEditorView+Highlighting.m
|
||||
PCEditorView+Highlighting.m \
|
||||
PCHistoryController.m
|
||||
|
||||
#
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
if ([self isEditableCategory:category])
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"FileBecomesEditedNotification" object:ltitle];
|
||||
|
||||
[project browserDidClickFile:ltitle category:category];
|
||||
}
|
||||
}
|
||||
|
@ -118,8 +120,7 @@
|
|||
|
||||
- (void)setBrowser:(NSBrowser *)aBrowser
|
||||
{
|
||||
[browser autorelease];
|
||||
browser = [aBrowser retain];
|
||||
browser = aBrowser;
|
||||
|
||||
[browser setTitled:NO];
|
||||
|
||||
|
@ -138,8 +139,7 @@
|
|||
|
||||
- (void)setProject:(PCProject *)aProj
|
||||
{
|
||||
AUTORELEASE(project);
|
||||
project = RETAIN(aProj);
|
||||
project = aProj;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -153,18 +153,10 @@
|
|||
int i;
|
||||
int count = [files count];
|
||||
|
||||
if (count == 0) {
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: create rows for column in %@ (%x) aborted - 0 files!",[self class],self,[project class],project);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if( sender != browser ) return;
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: create rows for column %d in %x",[self class],self,column,sender);
|
||||
#endif //DEBUG
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
NSMutableString *keyPath = [NSMutableString stringWithString:pathToCol];
|
||||
id cell;
|
||||
|
||||
|
@ -182,9 +174,6 @@
|
|||
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: browser %x will display %@ %x at %d,%d",[self class],self,sender,[cell class],cell,row,column);
|
||||
#endif //DEBUG
|
||||
}
|
||||
|
||||
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column
|
||||
|
|
45
PCLib/PCHistoryController.h
Normal file
45
PCLib/PCHistoryController.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* PCHistoryController.h created by probert on 2002-02-21 14:28:09 +0000
|
||||
*
|
||||
* Project ProjectCenter
|
||||
*
|
||||
* Created with ProjectCenter - http://www.gnustep.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _PCHISTORYCONTROLLER_H_
|
||||
#define _PCHISTORYCONTROLLER_H_
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@class PCProject;
|
||||
|
||||
@interface PCHistoryController : NSObject
|
||||
{
|
||||
id browser;
|
||||
PCProject *project;
|
||||
NSMutableArray *editedFiles;
|
||||
}
|
||||
|
||||
- (id)initWithProject:(PCProject *)aProj;
|
||||
- (void)dealloc;
|
||||
|
||||
- (void)click:(id)sender;
|
||||
|
||||
- (void)setBrowser:(NSBrowser *)aBrowser;
|
||||
|
||||
- (void)historyDidChange:(NSNotification *)notif;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCHistoryController (HistoryBrowserDelegate)
|
||||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix;
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column;
|
||||
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _PCHISTORYCONTROLLER_H_
|
||||
|
113
PCLib/PCHistoryController.m
Normal file
113
PCLib/PCHistoryController.m
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* PCHistoryController.m created by probert on 2002-02-21 14:28:08 +0000
|
||||
*
|
||||
* Project ProjectCenter
|
||||
*
|
||||
* Created with ProjectCenter - http://www.gnustep.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#import "PCHistoryController.h"
|
||||
#import "PCProject.h"
|
||||
|
||||
@implementation PCHistoryController
|
||||
|
||||
- (id)initWithProject:(PCProject *)aProj
|
||||
{
|
||||
NSAssert(aProj, @"Project is mandatory!");
|
||||
|
||||
if((self = [super init]))
|
||||
{
|
||||
project = aProj;
|
||||
|
||||
editedFiles = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
RELEASE(editedFiles);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)click:(id)sender
|
||||
{
|
||||
NSString *file = [[[sender selectedCell] stringValue] copy];
|
||||
|
||||
[project browserDidClickFile:file category:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"FileBecomesEditedNotification" object:file];
|
||||
//[browser selectRow:0 inColumn:0];
|
||||
|
||||
RELEASE(file);
|
||||
}
|
||||
|
||||
- (void)setBrowser:(NSBrowser *)aBrowser
|
||||
{
|
||||
NSAssert(browser==nil,@"The browser is already set!");
|
||||
|
||||
browser = aBrowser;
|
||||
|
||||
[browser setTitled:NO];
|
||||
|
||||
[browser setTarget:self];
|
||||
[browser setAction:@selector(click:)];
|
||||
|
||||
[browser setMaxVisibleColumns:1];
|
||||
[browser setAllowsMultipleSelection:NO];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(historyDidChange:) name:@"FileBecomesEditedNotification" object:nil];
|
||||
}
|
||||
|
||||
- (void)historyDidChange:(NSNotification *)notif
|
||||
{
|
||||
NSString *file = [notif object];
|
||||
|
||||
if( [editedFiles containsObject:file] == YES )
|
||||
{
|
||||
[editedFiles removeObject:file];
|
||||
}
|
||||
|
||||
[editedFiles insertObject:file atIndex:0];
|
||||
[browser reloadColumn:0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCHistoryController (HistoryBrowserDelegate)
|
||||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix
|
||||
{
|
||||
int i;
|
||||
int count = [editedFiles count];
|
||||
|
||||
if( sender != browser ) return;
|
||||
|
||||
for( i=0; i<count;++i )
|
||||
{
|
||||
id cell;
|
||||
|
||||
[matrix insertRow:i];
|
||||
|
||||
cell = [matrix cellAtRow:i column:0];
|
||||
[cell setStringValue:[editedFiles objectAtIndex:i]];
|
||||
[cell setLeaf:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)browser:(NSBrowser *)sender selectCellWithString:(NSString *)title inColumn:(int)column
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -124,6 +124,7 @@ static NSString * const PCBuildTool = @"BUILDTOOL";
|
|||
id delegate;
|
||||
id projectManager;
|
||||
id browserController;
|
||||
id historyController;
|
||||
|
||||
PCProjectBuilder *projectBuilder;
|
||||
PCProjectDebugger *projectDebugger;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#import "PCProjectBuilder.h"
|
||||
#import "PCSplitView.h"
|
||||
#import "PCEditorController.h"
|
||||
#import "PCHistoryController.h"
|
||||
|
||||
@interface PCProject (CreateUI)
|
||||
|
||||
|
@ -46,6 +47,7 @@
|
|||
unsigned int style = NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask | NSResizableWindowMask;
|
||||
NSBrowser *browser;
|
||||
NSBrowser *history;
|
||||
NSRect rect;
|
||||
NSMatrix* matrix;
|
||||
NSButtonCell* buttonCell = [[[NSButtonCell alloc] init] autorelease];
|
||||
|
@ -77,7 +79,6 @@
|
|||
[browser setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin];
|
||||
|
||||
[browserController setBrowser:browser];
|
||||
rect.size.height -= 64;
|
||||
[browserController setProject:self];
|
||||
|
||||
box = [[NSBox alloc] initWithFrame:NSMakeRect (-1,-1,562,252)];
|
||||
|
@ -109,10 +110,29 @@
|
|||
[split addSubview:box];
|
||||
[split adjustSubviews];
|
||||
[_c_view addSubview:split];
|
||||
RELEASE(split);
|
||||
|
||||
RELEASE(split);
|
||||
RELEASE(browser);
|
||||
|
||||
/*
|
||||
* File Browser
|
||||
*/
|
||||
|
||||
historyController = [[PCHistoryController alloc] initWithProject:self];
|
||||
|
||||
history = [[NSBrowser alloc] initWithFrame:NSMakeRect(320,372,232,60)];
|
||||
|
||||
[history setDelegate:historyController];
|
||||
[history setMaxVisibleColumns:1];
|
||||
[history setAllowsMultipleSelection:NO];
|
||||
[history setHasHorizontalScroller:NO];
|
||||
[history setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin];
|
||||
|
||||
[historyController setBrowser:history];
|
||||
|
||||
[_c_view addSubview:history];
|
||||
RELEASE(history);
|
||||
|
||||
/*
|
||||
* Left button matrix
|
||||
*/
|
||||
|
@ -391,6 +411,7 @@
|
|||
*/
|
||||
|
||||
[browser loadColumnZero];
|
||||
[history loadColumnZero];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -447,6 +468,7 @@
|
|||
if( projectDebugger) RELEASE(projectDebugger);
|
||||
if( projectEditor) RELEASE(projectEditor);
|
||||
|
||||
RELEASE(historyController);
|
||||
RELEASE(browserController);
|
||||
RELEASE(projectWindow);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#import <ProjectCenter/PCBundleLoader.h>
|
||||
#import <ProjectCenter/PCDataSource.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCHistoryController.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCServer.h>
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
PCTextFinder.m,
|
||||
PCProjectEditor.m,
|
||||
PCProject+ComponentHandling.m,
|
||||
PCEditorView+Highlighting.m
|
||||
PCEditorView+Highlighting.m,
|
||||
PCHistoryController.m
|
||||
);
|
||||
COMPILEROPTIONS = "";
|
||||
CREATION_DATE = "";
|
||||
|
@ -54,7 +55,8 @@
|
|||
PCProjectEditor.h,
|
||||
ProjectComponent.h,
|
||||
PCProject+ComponentHandling.h,
|
||||
PCEditorView+Highlighting.h
|
||||
PCEditorView+Highlighting.h,
|
||||
PCHistoryController.h
|
||||
);
|
||||
INSTALLDIR = "$(GNUSTEP_SYSTEM_ROOT)";
|
||||
LANGUAGE = English;
|
||||
|
|
Loading…
Reference in a new issue