2002-02-11 22:19:39 +00:00
|
|
|
/*
|
|
|
|
* PCProjectEditor.m created by probert on 2002-02-10 09:27:09 +0000
|
|
|
|
*
|
|
|
|
* Project ProjectCenter
|
|
|
|
*
|
|
|
|
* Created with ProjectCenter - http://www.gnustep.org
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
#include "PCProjectEditor.h"
|
|
|
|
#include "PCDefines.h"
|
|
|
|
#include "PCEditorView.h"
|
|
|
|
#include "ProjectComponent.h"
|
2002-02-11 22:19:39 +00:00
|
|
|
|
|
|
|
@interface PCProjectEditor (CreateUI)
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (void) _createComponentView;
|
2002-02-11 22:19:39 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation PCProjectEditor (CreateUI)
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (void) _createComponentView
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
NSRect frame;
|
|
|
|
NSTextView *textView;
|
|
|
|
|
|
|
|
frame = NSMakeRect(0,0,562,248);
|
|
|
|
_componentView = [[NSBox alloc] initWithFrame:frame];
|
|
|
|
[_componentView setTitlePosition: NSNoTitle];
|
|
|
|
[_componentView setBorderType: NSNoBorder];
|
|
|
|
[_componentView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
|
|
[_componentView setContentViewMargins: NSMakeSize(0.0,0.0)];
|
|
|
|
|
|
|
|
frame = NSMakeRect (0, 0, 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];
|
|
|
|
textView = [[NSTextView alloc] initWithFrame:frame];
|
|
|
|
[textView setMinSize: NSMakeSize (0, 0)];
|
|
|
|
[textView setMaxSize: NSMakeSize(1e7, 1e7)];
|
|
|
|
[textView setRichText: NO];
|
|
|
|
[textView setEditable: NO];
|
|
|
|
[textView setSelectable: YES];
|
|
|
|
[textView setVerticallyResizable: YES];
|
|
|
|
[textView setHorizontallyResizable: NO];
|
|
|
|
[textView setAutoresizingMask:(NSViewWidthSizable|NSViewHeightSizable)];
|
|
|
|
[[textView textContainer] setWidthTracksTextView: YES];
|
|
|
|
[_scrollView setDocumentView: textView];
|
|
|
|
RELEASE(textView);
|
|
|
|
|
|
|
|
frame.size = NSMakeSize([_scrollView contentSize].width,1e7);
|
|
|
|
[[textView textContainer] setContainerSize:frame.size];
|
|
|
|
|
|
|
|
[_componentView addSubview:_scrollView];
|
|
|
|
RELEASE(_scrollView);
|
|
|
|
|
|
|
|
[_componentView sizeToFit];
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation PCProjectEditor
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (id)initWithProject: (PCProject *)aProject
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
NSAssert(aProject, @"No project specified!");
|
2002-02-11 22:19:39 +00:00
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
if((self = [super init]))
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
_currentProject = aProject;
|
|
|
|
_componentView = nil;
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
2003-04-21 13:46:10 +00:00
|
|
|
return self;
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (void) dealloc
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
if( _componentView )
|
|
|
|
{
|
|
|
|
RELEASE(_componentView);
|
|
|
|
}
|
2002-02-11 22:19:39 +00:00
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
[super dealloc];
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (NSView *) componentView
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
if (_componentView == nil)
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
[self _createComponentView];
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
return _componentView;
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (void)setEditorView: (PCEditorView *)ev
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
NSRect frame;
|
2002-02-11 22:19:39 +00:00
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
_editorView = ev;
|
2002-02-11 22:19:39 +00:00
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
[_scrollView setDocumentView:_editorView];
|
2002-02-16 20:46:26 +00:00
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
frame = [[_scrollView contentView] frame];
|
|
|
|
frame.size = NSMakeSize([_scrollView contentSize].width,1e7);
|
|
|
|
[_editorView setFrame:frame];
|
|
|
|
[_editorView sizeToFit];
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
2003-04-21 13:46:10 +00:00
|
|
|
- (PCEditorView *) editorView
|
2002-02-11 22:19:39 +00:00
|
|
|
{
|
2003-04-21 13:46:10 +00:00
|
|
|
return _editorView;
|
2002-02-11 22:19:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
2002-10-06 13:45:02 +00:00
|
|
|
|