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
|
2003-05-06 21:52:58 +00:00
|
|
|
#include "Things.h"
|
|
|
|
#include "TexturePalette.h"
|
|
|
|
#include "Preferences.h"
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:03:41 +00:00
|
|
|
id inspcontrol_i;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-14 13:17:35 +00:00
|
|
|
@interface CustomView:NSView
|
|
|
|
@end
|
|
|
|
@implementation CustomView
|
|
|
|
@end
|
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
@implementation InspectorControl
|
|
|
|
|
2010-09-14 14:10:20 +00:00
|
|
|
-(void)awakeFromNib
|
|
|
|
{
|
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-14 13:17: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...
|
|
|
|
|
|
|
|
[windowList addObject:win_project_i];
|
|
|
|
[contentList addObject:[win_project_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemProject_i setKeyEquivalent:@"1"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemProject_i];
|
|
|
|
|
|
|
|
[windowList addObject:win_textures_i];
|
|
|
|
[contentList addObject:[win_textures_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemTextures_i setKeyEquivalent:@"2"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemTextures_i];
|
|
|
|
|
|
|
|
[windowList addObject:win_things_i];
|
|
|
|
[contentList addObject:[win_things_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemThings_i setKeyEquivalent:@"3"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemThings_i];
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
[windowList addObject:win_prefs_i];
|
|
|
|
[contentList addObject:[win_prefs_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemPrefs_i setKeyEquivalent:@"4"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemPrefs_i];
|
|
|
|
|
|
|
|
[windowList addObject:win_settings_i];
|
|
|
|
[contentList addObject:[win_settings_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemSettings_i setKeyEquivalent:@"5"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemSettings_i];
|
|
|
|
|
|
|
|
[windowList addObject:win_output_i];
|
|
|
|
[contentList addObject:[win_output_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemOutput_i setKeyEquivalent:@"6"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemOutput_i];
|
|
|
|
|
|
|
|
[windowList addObject:win_help_i];
|
|
|
|
[contentList addObject:[win_help_i contentView]];
|
2010-09-11 08:35:25 +00:00
|
|
|
[itemHelp_i setKeyEquivalent:@"7"];
|
2003-03-18 19:48:24 +00:00
|
|
|
[itemList addObject:itemHelp_i];
|
|
|
|
|
|
|
|
// Setup inspector window with project subview first
|
|
|
|
|
2010-09-11 08:35:25 +00:00
|
|
|
[inspectorView_i setAutoresizesSubviews:YES];
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:03:41 +00:00
|
|
|
inspectorSubview_i =[contentList objectAtIndex:i_project];
|
2010-09-14 14:10:20 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
[inspectorView_i addSubview:inspectorSubview_i];
|
|
|
|
|
|
|
|
currentInspectorType = -1;
|
|
|
|
[self changeInspectorTo:i_project];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
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-11 10:03:41 +00:00
|
|
|
-changeInspector:sender
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
2010-09-11 10:03:41 +00:00
|
|
|
id cell;
|
2003-03-18 19:48:24 +00:00
|
|
|
|
2010-09-11 10:03:41 +00:00
|
|
|
cell =[sender selectedCell];
|
2010-09-17 05:30:46 +00:00
|
|
|
Sys_Printf ("%p %d\n", cell, (int)[cell tag]);
|
2003-03-18 19:48:24 +00:00
|
|
|
[self changeInspectorTo:[cell tag]];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2010-09-11 10:03:41 +00:00
|
|
|
// Change to specific Inspector
|
2003-03-18 19:48:24 +00:00
|
|
|
//
|
2010-09-11 10:03:41 +00:00
|
|
|
-changeInspectorTo:(insp_e) which
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
2010-09-11 10:03:41 +00:00
|
|
|
id newView;
|
|
|
|
NSRect r;
|
|
|
|
id cell;
|
|
|
|
NSRect f;
|
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
if (which == currentInspectorType)
|
|
|
|
return self;
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
currentInspectorType = which;
|
2010-09-11 10:03:41 +00:00
|
|
|
newView =[contentList objectAtIndex:which];
|
|
|
|
|
|
|
|
cell =[itemList objectAtIndex:which];// set PopUpButton title
|
2003-03-18 19:48:24 +00:00
|
|
|
[popUpButton_i setTitle:[cell title]];
|
2010-09-11 10:03:41 +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-11 10:03:41 +00:00
|
|
|
[inspectorSubview_i setAutoresizingMask:NSViewWidthSizable |
|
|
|
|
NSViewHeightSizable];
|
2010-09-11 08:35:25 +00:00
|
|
|
r.size.width -= 4;
|
|
|
|
r.size.height -= 4;
|
|
|
|
[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-11 10:03:41 +00:00
|
|
|
f =[inspectorSubview_i bounds];
|
|
|
|
PSsetgray (NSLightGray);
|
|
|
|
NSRectFill (f);
|
2003-03-18 19:48:24 +00:00
|
|
|
[inspectorSubview_i unlockFocus];
|
|
|
|
[inspectorView_i display];
|
2010-09-11 10:03:41 +00:00
|
|
|
|
2003-03-18 19:48:24 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2010-09-11 10:03:41 +00:00
|
|
|
-(insp_e) getCurrentInspector
|
2003-03-18 19:48:24 +00:00
|
|
|
{
|
|
|
|
return currentInspectorType;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|