2010-09-14 14:10:20 +00:00
|
|
|
#include "QF/sys.h"
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 08:35:25 +00:00
|
|
|
#include "InspectorControl.h"
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// Add .h-files here for new inspectors
|
2010-09-28 19:43:35 +00:00
|
|
|
#include "Things.h"
|
|
|
|
#include "TexturePalette.h"
|
|
|
|
#include "Preferences.h"
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
InspectorControl *inspcontrol_i;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
@interface CustomView: NSView
|
2010-09-14 13:17:35 +00:00
|
|
|
@end
|
|
|
|
@implementation CustomView
|
|
|
|
@end
|
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
@implementation InspectorControl
|
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
- (void) awakeFromNib
|
2010-09-14 14:10:20 +00:00
|
|
|
{
|
2010-09-28 19:43:35 +00:00
|
|
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
|
|
|
NSString *path = [mainBundle pathForResource: @"help" ofType: @"txt"
|
|
|
|
inDirectory: nil];
|
|
|
|
NSString *help = [NSString stringWithContentsOfFile: path];
|
2010-09-24 11:46:24 +00:00
|
|
|
|
|
|
|
[helpView setString: help];
|
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
inspcontrol_i = self;
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
currentInspectorType = -1;
|
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
contentList = [[NSMutableArray alloc] init];
|
|
|
|
windowList = [[NSMutableArray alloc] init];
|
|
|
|
itemList = [[NSMutableArray alloc] init];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// ADD NEW INSPECTORS HERE...
|
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
[windowList addObject: win_project_i];
|
|
|
|
[contentList addObject: [win_project_i contentView]];
|
|
|
|
[itemProject_i setKeyEquivalent: @"1"];
|
|
|
|
[itemList addObject: itemProject_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_textures_i];
|
|
|
|
[contentList addObject: [win_textures_i contentView]];
|
|
|
|
[itemTextures_i setKeyEquivalent: @"2"];
|
|
|
|
[itemList addObject: itemTextures_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_things_i];
|
|
|
|
[contentList addObject: [win_things_i contentView]];
|
|
|
|
[itemThings_i setKeyEquivalent: @"3"];
|
|
|
|
[itemList addObject: itemThings_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_prefs_i];
|
|
|
|
[contentList addObject: [win_prefs_i contentView]];
|
|
|
|
[itemPrefs_i setKeyEquivalent: @"4"];
|
|
|
|
[itemList addObject: itemPrefs_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_settings_i];
|
|
|
|
[contentList addObject: [win_settings_i contentView]];
|
|
|
|
[itemSettings_i setKeyEquivalent: @"5"];
|
|
|
|
[itemList addObject: itemSettings_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_output_i];
|
|
|
|
[contentList addObject: [win_output_i contentView]];
|
|
|
|
[itemOutput_i setKeyEquivalent: @"6"];
|
|
|
|
[itemList addObject: itemOutput_i];
|
|
|
|
|
|
|
|
[windowList addObject: win_help_i];
|
|
|
|
[contentList addObject: [win_help_i contentView]];
|
|
|
|
[itemHelp_i setKeyEquivalent: @"7"];
|
|
|
|
[itemList addObject: itemHelp_i];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
// Setup inspector window with project subview first
|
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorView_i setAutoresizesSubviews: YES];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
inspectorSubview_i = [contentList objectAtIndex: i_project];
|
2010-09-14 14:10:20 +00:00
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorView_i addSubview: inspectorSubview_i];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
|
|
|
currentInspectorType = -1;
|
2010-09-28 19:43:35 +00:00
|
|
|
[self setCurrentInspector: i_project];
|
2003-03-18 19:48:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2010-09-11 10:03:41 +00:00
|
|
|
// Sent by the PopUpList in the Inspector
|
|
|
|
// Each cell in the PopUpList must have the correct tag
|
2003-03-18 19:48:24 +00:00
|
|
|
//
|
2010-09-28 19:43:35 +00:00
|
|
|
- (IBAction) changeInspector: sender
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
2010-09-28 19:43:35 +00:00
|
|
|
[self setCurrentInspector: [sender selectedTag]];
|
2003-03-18 19:48:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2010-09-11 10:03:41 +00:00
|
|
|
// Change to specific Inspector
|
2003-03-18 19:48:24 +00:00
|
|
|
//
|
2010-09-28 19:43:35 +00:00
|
|
|
- (void) setCurrentInspector: (insp_e)which
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
2010-09-28 19:43:35 +00:00
|
|
|
id newView;
|
|
|
|
NSRect r;
|
|
|
|
NSRect f;
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2010-09-29 20:09:11 +00:00
|
|
|
if (which == currentInspectorType)
|
2010-09-26 07:26:12 +00:00
|
|
|
return;
|
2003-03-18 19:48:24 +00:00
|
|
|
currentInspectorType = which;
|
2010-09-28 19:43:35 +00:00
|
|
|
newView = [contentList objectAtIndex: which];
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
[popUpButton_i selectItemAtIndex: which];
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorView_i replaceSubview: inspectorSubview_i with: newView];
|
|
|
|
r = [inspectorView_i frame];
|
2003-03-18 19:48:24 +00:00
|
|
|
inspectorSubview_i = newView;
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorSubview_i setAutoresizingMask: NSViewWidthSizable |
|
2010-09-11 10:03:41 +00:00
|
|
|
NSViewHeightSizable];
|
2010-09-11 08:35:25 +00:00
|
|
|
r.size.width -= 4;
|
|
|
|
r.size.height -= 4;
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorSubview_i setFrameSize: r.size];
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
[inspectorSubview_i lockFocus];
|
2010-09-28 19:43:35 +00:00
|
|
|
f = [inspectorSubview_i bounds];
|
|
|
|
[[NSColor windowBackgroundColor] set];
|
2010-09-11 10:03:41 +00:00
|
|
|
NSRectFill (f);
|
2003-03-18 19:48:24 +00:00
|
|
|
[inspectorSubview_i unlockFocus];
|
2010-09-28 19:43:35 +00:00
|
|
|
[inspectorView_i setNeedsDisplay: YES];
|
2003-03-18 19:48:24 +00:00
|
|
|
}
|
|
|
|
|
2010-09-28 19:43:35 +00:00
|
|
|
- (insp_e) currentInspector
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
|
|
|
return currentInspectorType;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|