mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Forge: Committing the stuff I _was_ working on. These will all go away
in a few minutes.
This commit is contained in:
parent
ccbb1c3f04
commit
2fbdbd5522
11 changed files with 35 additions and 397 deletions
|
@ -31,10 +31,13 @@
|
|||
#import <Foundation/NSGeometry.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#import <AppKit/DPSOperators.h>
|
||||
#import <AppKit/NSGraphicsContext.h>
|
||||
|
||||
#import "CameraView.h"
|
||||
#import "Forge.h"
|
||||
#import "Map.h"
|
||||
#import "UserPath.h"
|
||||
//#import "UserPath.h"
|
||||
#import "ZView.h"
|
||||
|
||||
#import "render.h"
|
||||
|
|
|
@ -110,8 +110,11 @@
|
|||
};
|
||||
XYView = {
|
||||
Actions = (
|
||||
autoresizingMask,
|
||||
setAutoresizingMask:
|
||||
);
|
||||
Outlets = (
|
||||
target
|
||||
);
|
||||
Super = NSView;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
#import "qedefs.h"
|
||||
//#import "qedefs.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
@ -6,9 +6,12 @@
|
|||
#import "Forge.h"
|
||||
|
||||
#import "Preferences.h"
|
||||
#import "Project.h"
|
||||
#import "UserPath.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern Preferences *prefs;
|
||||
extern Project *project;
|
||||
|
|
|
@ -101,29 +101,29 @@ Forge_HEADERS= \
|
|||
# Class files
|
||||
#
|
||||
Forge_OBJC_FILES= \
|
||||
CameraView.m \
|
||||
Clipper.m \
|
||||
Forge_main.m \
|
||||
Preferences.m \
|
||||
Project.m \
|
||||
Forge.m \
|
||||
Map.m \
|
||||
Things.m \
|
||||
misc.m \
|
||||
Entity.m \
|
||||
EntityArray.m \
|
||||
EntityClass.m \
|
||||
Forge.m \
|
||||
Forge_main.m \
|
||||
InspectorControl.m \
|
||||
CameraView.m \
|
||||
XYView.m \
|
||||
KeypairView.m \
|
||||
Map.m \
|
||||
InspectorControl.m \
|
||||
PopScrollView.m \
|
||||
Preferences.m \
|
||||
Project.m \
|
||||
TexturePalette.m \
|
||||
TextureView.m \
|
||||
Things.m \
|
||||
UserPath.m \
|
||||
XYView.m \
|
||||
ZScrollView.m \
|
||||
ZView.m \
|
||||
misc.m \
|
||||
render.m
|
||||
# SetBrush.m \
|
||||
# UserPath.m \
|
||||
|
||||
#
|
||||
# C files
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
- (id) initVars;
|
||||
- (void) initProjectSettings;
|
||||
|
||||
- (void) setTextureWad: (NSString *) wadFile;
|
||||
//- (void) setTextureWad: (NSString *) wadFile;
|
||||
|
||||
- (void) addToOutput: (NSString *) string;
|
||||
|
||||
|
@ -105,8 +105,8 @@
|
|||
- (void) openProjectWithFile: (NSString *) path; // called by openProject and newProject
|
||||
- (id) openProject;
|
||||
|
||||
- (void) wadWasClicked: (id) sender; // called if clicked on wad in browser
|
||||
- (void) mapWasClicked: (id) sender; // called if clicked on map in browser
|
||||
//- (void) wadWasClicked: (id) sender; // called if clicked on wad in browser
|
||||
//- (void) mapWasClicked: (id) sender; // called if clicked on map in browser
|
||||
- (void) clearBspOutput: (id) sender; // Called if the BSP output view should
|
||||
// be cleared
|
||||
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
|
||||
#import "qedefs.h"
|
||||
|
||||
// Add .h-files here for new inspectors
|
||||
#import "Things.h"
|
||||
#import "TexturePalette.h"
|
||||
#import "Preferences.h"
|
||||
|
||||
id inspcontrol_i;
|
||||
|
||||
@implementation InspectorControl
|
||||
|
||||
- (id) awakeFromNib
|
||||
{
|
||||
inspcontrol_i = self;
|
||||
|
||||
currentInspectorType = -1;
|
||||
|
||||
contentList = [[NSMutableArray alloc] init];
|
||||
windowList = [[NSMutableArray alloc] init];
|
||||
itemList = [[NSMutableArray alloc] init];
|
||||
|
||||
// ADD NEW INSPECTORS HERE...
|
||||
|
||||
[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];
|
||||
|
||||
// Setup inspector window with project subview first
|
||||
|
||||
[inspectorView_i setAutoresizesSubviews: YES];
|
||||
|
||||
inspectorSubview_i = [contentList objectAtIndex: i_project];
|
||||
[inspectorView_i addSubview: inspectorSubview_i];
|
||||
|
||||
currentInspectorType = -1;
|
||||
[self changeInspectorTo: i_project];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Sent by the PopUpList in the Inspector
|
||||
// Each cell in the PopUpList must have the correct tag
|
||||
//
|
||||
- (void) changeInspector: (id) sender
|
||||
{
|
||||
id cell;
|
||||
|
||||
cell = [sender selectedCell];
|
||||
[self changeInspectorTo: [cell tag]];
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Change to specific Inspector
|
||||
//
|
||||
- (void) changeInspectorTo: (insp_e) which
|
||||
{
|
||||
id newView;
|
||||
NSRect r;
|
||||
id cell;
|
||||
NSRect f;
|
||||
|
||||
if (which == currentInspectorType)
|
||||
return;
|
||||
|
||||
currentInspectorType = which;
|
||||
newView = [contentList objectAtIndex: which];
|
||||
|
||||
cell = [itemList objectAtIndex: which]; // set PopUpButton title
|
||||
[popUpButton_i setTitle:[cell title]];
|
||||
|
||||
[inspectorView_i replaceSubview:inspectorSubview_i with:newView];
|
||||
r = [inspectorView_i frame];
|
||||
inspectorSubview_i = newView;
|
||||
[inspectorSubview_i setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
|
||||
[inspectorSubview_i resizeWithOldSuperviewSize: r.size];
|
||||
|
||||
[inspectorSubview_i lockFocus];
|
||||
r = [inspectorSubview_i bounds];
|
||||
|
||||
PSsetgray (NSLightGray);
|
||||
NSRectFill (f);
|
||||
|
||||
[inspectorSubview_i unlockFocus];
|
||||
[inspectorView_i display];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
- (insp_e) currentInspector
|
||||
{
|
||||
return currentInspectorType;
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
#import "qedefs.h"
|
||||
|
||||
id keypairview_i;
|
||||
|
||||
@implementation KeypairView
|
||||
|
||||
/*
|
||||
==================
|
||||
initFrame:
|
||||
==================
|
||||
*/
|
||||
- (id) initWithFrame: (NSRect) frameRect
|
||||
{
|
||||
[super initWithFrame: frameRect];
|
||||
keypairview_i = self;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void) calcViewSize
|
||||
{
|
||||
NSRect b = [[self superview] bounds];
|
||||
NSRect newFrame;
|
||||
NSPoint pt;
|
||||
id ent = [map_i currentEntity];
|
||||
int count = [ent numPairs];
|
||||
|
||||
// [[self superview] setFlipped: YES];
|
||||
|
||||
newFrame = b;
|
||||
newFrame.size.height = LINEHEIGHT * count + SPACING;
|
||||
|
||||
[[self superview] setNeedsDisplayInRect: newFrame];
|
||||
[self setFrame: newFrame];
|
||||
[self setNeedsDisplay: YES];
|
||||
|
||||
pt.x = pt.y = 0;
|
||||
[self scrollPoint: pt];
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) drawSelf: (NSRect) aRect
|
||||
{
|
||||
epair_t *pair;
|
||||
int y;
|
||||
|
||||
PSsetgray (NSLightGray);
|
||||
NSRectFill (aRect);
|
||||
|
||||
PSselectfont ("Helvetica-Bold", FONTSIZE);
|
||||
PSrotate (0);
|
||||
PSsetgray (0);
|
||||
|
||||
pair = [[map_i currentEntity] epairs];
|
||||
y = [self bounds].size.height - LINEHEIGHT;
|
||||
for (; pair; pair = pair->next) {
|
||||
PSmoveto (SPACING, y);
|
||||
PSshow (pair->key);
|
||||
PSmoveto (100, y);
|
||||
PSshow (pair->value);
|
||||
y -= LINEHEIGHT;
|
||||
}
|
||||
PSstroke ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *) theEvent
|
||||
{
|
||||
NSPoint loc = [theEvent locationInWindow];
|
||||
NSRect bounds = [self bounds];
|
||||
int i;
|
||||
epair_t *p;
|
||||
|
||||
[self convertPoint: loc fromView: NULL];
|
||||
|
||||
i = (bounds.size.height - loc.y - 4) / LINEHEIGHT;
|
||||
|
||||
p = [[map_i currentEntity] epairs];
|
||||
while ( i ) {
|
||||
p = p->next;
|
||||
if (!p)
|
||||
return;
|
||||
i--;
|
||||
}
|
||||
if (p)
|
||||
[things_i setSelectedKey: p];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@end
|
|
@ -4,11 +4,12 @@
|
|||
//
|
||||
//======================================
|
||||
|
||||
#import "qedefs.h"
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#import "Preferences.h"
|
||||
#import "Project.h"
|
||||
|
||||
Project * project;
|
||||
Project *project;
|
||||
|
||||
@implementation Project
|
||||
|
||||
|
@ -133,7 +134,7 @@ Project * project;
|
|||
// [ppWadBrowser reuseColumns: YES];
|
||||
[ppWadBrowser loadColumnZero];
|
||||
|
||||
[things_i initEntities];
|
||||
// [things_i initEntities]; // FIXME
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -210,14 +211,14 @@ Project * project;
|
|||
panel = NSGetInformationalAlertPanel (@"Loading...",
|
||||
@"Loading map. Please wait...", nil, nil, nil);
|
||||
[panel orderFront: self];
|
||||
[quakeed_i doOpen: fname];
|
||||
[NSApp tryToPerform: @selector(openFile:) with: fname];
|
||||
[panel performClose: self];
|
||||
NSReleaseAlertPanel (panel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
- (void) setTextureWad: (NSString *) wadFile
|
||||
{
|
||||
int i, c;
|
||||
|
@ -262,6 +263,7 @@ Project * project;
|
|||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
|
||||
#import "qedefs.h"
|
||||
|
||||
/*
|
||||
|
||||
NOTE: I am specifically not using cached image reps, because the data is also needed for texturing the views, and a cached rep would waste tons of space.
|
||||
|
||||
*/
|
||||
|
||||
@implementation TextureView
|
||||
|
||||
- init
|
||||
{
|
||||
deselectIndex = -1;
|
||||
return self;
|
||||
}
|
||||
|
||||
- setParent:(id)from
|
||||
{
|
||||
parent_i = from;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstMouse
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- drawSelf:(const NSRect *)rects :(int)rectCount
|
||||
{
|
||||
int i;
|
||||
int max;
|
||||
id list_i;
|
||||
texpal_t *t;
|
||||
int x;
|
||||
int y;
|
||||
NSPoint p;
|
||||
NSRect r;
|
||||
int selected;
|
||||
|
||||
selected = [parent_i getSelectedTexture];
|
||||
list_i = [parent_i getList];
|
||||
PSselectfont("Helvetica-Medium",FONTSIZE);
|
||||
PSrotate(0);
|
||||
|
||||
PSsetgray(NSLightGray);
|
||||
PSrectfill(rects->origin.x, rects->origin.y,
|
||||
rects->size.width, rects->size.height);
|
||||
|
||||
if (!list_i) // WADfile didn't init
|
||||
return self;
|
||||
|
||||
if (deselectIndex != -1)
|
||||
{
|
||||
t = [list_i elementAtIndex:deselectIndex];
|
||||
r = t->r;
|
||||
r.origin.x -= TEX_INDENT;
|
||||
r.origin.y -= TEX_INDENT;
|
||||
r.size.width += TEX_INDENT*2;
|
||||
r.size.height += TEX_INDENT*2;
|
||||
|
||||
PSsetgray(NSGrayComponent(NSGray));
|
||||
PSrectfill(r.origin.x, r.origin.y,
|
||||
r.size.width, r.size.height);
|
||||
p = t->r.origin;
|
||||
p.y += TEX_SPACING;
|
||||
[t->image drawAtPoint:p];
|
||||
PSsetgray(0);
|
||||
x = t->r.origin.x;
|
||||
y = t->r.origin.y + 7;
|
||||
PSmoveto(x,y);
|
||||
PSshow(t->name);
|
||||
PSstroke();
|
||||
deselectIndex = -1;
|
||||
}
|
||||
|
||||
max = [list_i count];
|
||||
PSsetgray(0);
|
||||
|
||||
for (i = 0;i < max; i++)
|
||||
{
|
||||
t = [list_i elementAtIndex:i];
|
||||
r = t->r;
|
||||
r.origin.x -= TEX_INDENT/2;
|
||||
r.size.width += TEX_INDENT;
|
||||
r.origin.y += 4;
|
||||
if (NSIntersectsRect(rects[0],r) == YES &&
|
||||
t->display)
|
||||
{
|
||||
if (selected == i)
|
||||
{
|
||||
PSsetgray(1);
|
||||
PSrectfill(r.origin.x,r.origin.y,
|
||||
r.size.width,r.size.height);
|
||||
PSsetrgbcolor(1,0,0);
|
||||
PSrectstroke(r.origin.x, r.origin.y,
|
||||
r.size.width, r.size.height);
|
||||
PSsetgray(0);
|
||||
}
|
||||
|
||||
p = t->r.origin;
|
||||
p.y += TEX_SPACING;
|
||||
[t->image drawAtPoint:p];
|
||||
x = t->r.origin.x;
|
||||
y = t->r.origin.y + 7;
|
||||
PSmoveto(x,y);
|
||||
PSshow(t->name);
|
||||
}
|
||||
}
|
||||
PSstroke();
|
||||
return self;
|
||||
}
|
||||
|
||||
- deselect
|
||||
{
|
||||
deselectIndex = [parent_i getSelectedTexture];
|
||||
return self;
|
||||
}
|
||||
|
||||
- mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
NSPoint loc;
|
||||
int i;
|
||||
int max;
|
||||
int oldwindowmask;
|
||||
texpal_t *t;
|
||||
id list;
|
||||
NSRect r;
|
||||
|
||||
oldwindowmask = [[self window] addToEventMask:NSLeftMouseDraggedMask];
|
||||
loc = [theEvent locationInWindow];
|
||||
[self convertPoint:loc fromView:NULL];
|
||||
|
||||
list = [parent_i getList];
|
||||
max = [list count];
|
||||
for (i = 0;i < max; i++)
|
||||
{
|
||||
t = [list elementAtIndex:i];
|
||||
r = t->r;
|
||||
if (NSPointInRect(loc,r) == YES)
|
||||
{
|
||||
[self deselect];
|
||||
[parent_i setSelectedTexture:i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[[self window] setEventMask:oldwindowmask];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,4 +1,6 @@
|
|||
#import "qedefs.h"
|
||||
#import "XYView.h"
|
||||
|
||||
//#import "qedefs.h"
|
||||
|
||||
id xyview_i;
|
||||
|
||||
|
|
Loading…
Reference in a new issue