apps-projectcenter/PCLib/PCProjectEditor.m
Philippe C.D. Robert 396f6b9751 Began to work on support for an integrated editor, thus much has been rewritten
related to editor handling. This is work in progress... Every PCProject
component now has to conform to the ProjectComponent protocol.
Syntax highlighting is disabled for now, this will undergo a major rewrite soon.
Furthermore I separated the component handling stuff from the main class file
and put it into PCProject+ComponentHandling.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12499 72102866-910b-0410-8b05-ffd578937521
2002-02-11 22:19:39 +00:00

125 lines
2.9 KiB
Objective-C

/*
* PCProjectEditor.m created by probert on 2002-02-10 09:27:09 +0000
*
* Project ProjectCenter
*
* Created with ProjectCenter - http://www.gnustep.org
*
* $Id$
*/
#import "PCProjectEditor.h"
#import "PCEditorView.h"
@interface PCProjectEditor (CreateUI)
- (void)_createComponentView;
@end
@implementation PCProjectEditor (CreateUI)
- (void)_createComponentView
{
NSPopUpButton *methods;
NSRect frame;
NSTextView *etv;
componentView = [[NSBox alloc] initWithFrame:NSMakeRect(-1,-1,562,248)];
[componentView setTitlePosition:NSNoTitle];
[componentView setBorderType:NSNoBorder];
[componentView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[componentView setContentViewMargins: NSMakeSize(0.0,0.0)];
frame = NSMakeRect(20,16,240,16);
methods = [[NSPopUpButton alloc] initWithFrame:frame];
[methods addItemWithTitle:@"No Method"];
[methods setPullsDown:YES];
[methods setTarget:self];
[methods setAction:@selector(pullDownSelected:)];
[componentView addSubview:methods];
RELEASE(methods);
frame = NSMakeRect (-1,32,562,40);
scrollView = [[NSScrollView alloc] initWithFrame:frame];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: YES];
[scrollView setBorderType: NSBezelBorder];
[scrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
// This is a placeholder!
frame = [[scrollView contentView] frame];
etv = [[NSTextView alloc] initWithFrame:frame];
[etv setMinSize: NSMakeSize (0, 0)];
[etv setMaxSize:NSMakeSize(1e7, 1e7)];
[etv setRichText:NO];
[etv setEditable:NO];
[etv setSelectable:YES];
[etv setVerticallyResizable:YES];
[etv setHorizontallyResizable:NO];
[etv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[[etv textContainer] setWidthTracksTextView:YES];
[scrollView setDocumentView:etv];
RELEASE(etv);
frame.size = NSMakeSize([scrollView contentSize].width,1e7);
[[etv textContainer] setContainerSize:frame.size];
[componentView addSubview:scrollView];
RELEASE(scrollView);
[componentView sizeToFit];
}
@end
@implementation PCProjectEditor
- (id)initWithProject:(PCProject *)aProject
{
NSAssert(aProject,@"No project specified!");
if((self = [super init]))
{
currentProject = aProject;
}
return self;
}
- (void)dealloc
{
RELEASE(componentView);
[super dealloc];
}
- (NSView *)componentView
{
if (!componentView)
{
[self _createComponentView];
}
return componentView;
}
- (void)setEditorView:(PCEditorView *)ev
{
NSRect frame;
editor = ev;
frame = [[scrollView contentView] frame];
[scrollView setDocumentView:editor];
[editor setNeedsDisplay:YES];
frame.size = NSMakeSize([scrollView contentSize].width,1e7);
[[editor textContainer] setContainerSize:frame.size];
}
- (PCEditorView *)editorView
{
return editor;
}
@end