mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Finally, everything does compile.
However, it still won't work (no gorm, commented code, ...). Borrow an old implementation of the Storage class until I figure out just what it's being used for.
This commit is contained in:
parent
ddc493d657
commit
d3a12ee727
17 changed files with 694 additions and 246 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include "Storage.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *key;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "qedefs.h"
|
||||
#include "Dict.h"
|
||||
|
||||
@implementation Dict
|
||||
|
||||
|
@ -31,14 +31,14 @@ copyFromZone
|
|||
JDC
|
||||
===========
|
||||
*/
|
||||
- copyFromZone:(NSZone *)zone
|
||||
- copy
|
||||
{
|
||||
id new;
|
||||
int i;
|
||||
dict_t *d;
|
||||
char *old;
|
||||
|
||||
new = [super copyFromZone: zone];
|
||||
new = [super copy];
|
||||
for (i=0 ; i<numElements ; i++)
|
||||
{
|
||||
d = [self elementAt: i];
|
||||
|
@ -202,7 +202,7 @@ JDC
|
|||
|
||||
temp = [self parseMultipleFrom:key];
|
||||
count = [temp count];
|
||||
[temp free];
|
||||
[temp release];
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ JDC
|
|||
[temp removeElementAt:i];
|
||||
free(d->value);
|
||||
d->value = [self convertListToString:temp];
|
||||
[temp free];
|
||||
[temp release];
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef DictList_h
|
||||
#endif DictList_h
|
||||
#define DictList_h
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
@interface DictList:List
|
||||
@interface DictList:NSMutableArray
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "qedefs.h"
|
||||
#include "DictList.h"
|
||||
#include "Dict.h"
|
||||
|
||||
@implementation DictList
|
||||
|
||||
|
@ -17,7 +18,7 @@
|
|||
if (d != NULL)
|
||||
[self addObject:d];
|
||||
} while(d != NULL);
|
||||
[d free];
|
||||
[d release];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -37,9 +38,9 @@
|
|||
|
||||
fprintf(fp,"// Object List written by QuakeEd\n");
|
||||
|
||||
for (i = 0;i < maxElements;i++)
|
||||
for (i = 0;i < [self count];i++)
|
||||
{
|
||||
obj = [self objectAt:i];
|
||||
obj = [self objectAtIndex:i];
|
||||
[obj writeBlockTo:fp];
|
||||
}
|
||||
fclose(fp);
|
||||
|
@ -56,9 +57,9 @@
|
|||
dict_t *d;
|
||||
id dict;
|
||||
|
||||
for (i = 0;i < maxElements;i++)
|
||||
for (i = 0;i < [self count];i++)
|
||||
{
|
||||
dict = [self objectAt:i];
|
||||
dict = [self objectAtIndex:i];
|
||||
d = [(Dict *)dict findKeyword:key];
|
||||
if (d != NULL)
|
||||
return dict;
|
||||
|
|
|
@ -12,7 +12,7 @@ MapEdit_RESOURCE_FILES= \
|
|||
MapEdit.gorm
|
||||
|
||||
MapEdit_OBJC_FILES= \
|
||||
CameraView.m Clipper.m Entity.m EntityClass.m KeypairView.m Map.m PopScrollView.m Things.m XYView.m ZScrollView.m ZView.m render.m
|
||||
CameraView.m Clipper.m Dict.m DictList.m Entity.m EntityClass.m InspectorControl.m KeypairView.m Map.m PopScrollView.m Preferences.m Project.m QuakeEd.m QuakeEd_main.m SetBrush.m Storage.m TexturePalette.m TextureView.m Things.m XYView.m ZScrollView.m ZView.m render.m
|
||||
|
||||
MapEdit_HEADERS= \
|
||||
EntityClass.h
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "qedefs.h"
|
||||
#include "InspectorControl.h"
|
||||
|
||||
// Add .h-files here for new inspectors
|
||||
#include "Things.h"
|
||||
|
@ -16,52 +16,52 @@ id inspcontrol_i;
|
|||
|
||||
currentInspectorType = -1;
|
||||
|
||||
contentList = [[List alloc] init];
|
||||
windowList = [[List alloc] init];
|
||||
itemList = [[List alloc] init];
|
||||
contentList = [[NSArray alloc] init];
|
||||
windowList = [[NSArray alloc] init];
|
||||
itemList = [[NSArray alloc] init];
|
||||
|
||||
// ADD NEW INSPECTORS HERE...
|
||||
|
||||
[windowList addObject:win_project_i];
|
||||
[contentList addObject:[win_project_i contentView]];
|
||||
[itemProject_i setKeyEquivalent:'1'];
|
||||
[itemProject_i setKeyEquivalent:@"1"];
|
||||
[itemList addObject:itemProject_i];
|
||||
|
||||
[windowList addObject:win_textures_i];
|
||||
[contentList addObject:[win_textures_i contentView]];
|
||||
[itemTextures_i setKeyEquivalent:'2'];
|
||||
[itemTextures_i setKeyEquivalent:@"2"];
|
||||
[itemList addObject:itemTextures_i];
|
||||
|
||||
[windowList addObject:win_things_i];
|
||||
[contentList addObject:[win_things_i contentView]];
|
||||
[itemThings_i setKeyEquivalent:'3'];
|
||||
[itemThings_i setKeyEquivalent:@"3"];
|
||||
[itemList addObject:itemThings_i];
|
||||
|
||||
[windowList addObject:win_prefs_i];
|
||||
[contentList addObject:[win_prefs_i contentView]];
|
||||
[itemPrefs_i setKeyEquivalent:'4'];
|
||||
[itemPrefs_i setKeyEquivalent:@"4"];
|
||||
[itemList addObject:itemPrefs_i];
|
||||
|
||||
[windowList addObject:win_settings_i];
|
||||
[contentList addObject:[win_settings_i contentView]];
|
||||
[itemSettings_i setKeyEquivalent:'5'];
|
||||
[itemSettings_i setKeyEquivalent:@"5"];
|
||||
[itemList addObject:itemSettings_i];
|
||||
|
||||
[windowList addObject:win_output_i];
|
||||
[contentList addObject:[win_output_i contentView]];
|
||||
[itemOutput_i setKeyEquivalent:'6'];
|
||||
[itemOutput_i setKeyEquivalent:@"6"];
|
||||
[itemList addObject:itemOutput_i];
|
||||
|
||||
[windowList addObject:win_help_i];
|
||||
[contentList addObject:[win_help_i contentView]];
|
||||
[itemHelp_i setKeyEquivalent:'7'];
|
||||
[itemHelp_i setKeyEquivalent:@"7"];
|
||||
[itemList addObject:itemHelp_i];
|
||||
|
||||
// Setup inspector window with project subview first
|
||||
|
||||
[inspectorView_i setAutoresizeSubviews:YES];
|
||||
[inspectorView_i setAutoresizesSubviews:YES];
|
||||
|
||||
inspectorSubview_i = [contentList objectAt:i_project];
|
||||
inspectorSubview_i = [contentList objectAtIndex:i_project];
|
||||
[inspectorView_i addSubview:inspectorSubview_i];
|
||||
|
||||
currentInspectorType = -1;
|
||||
|
@ -98,21 +98,23 @@ id inspcontrol_i;
|
|||
return self;
|
||||
|
||||
currentInspectorType = which;
|
||||
newView = [contentList objectAt:which];
|
||||
newView = [contentList objectAtIndex:which];
|
||||
|
||||
cell = [itemList objectAt:which]; // set PopUpButton title
|
||||
cell = [itemList objectAtIndex:which]; // set PopUpButton title
|
||||
[popUpButton_i setTitle:[cell title]];
|
||||
|
||||
[inspectorView_i replaceSubview:inspectorSubview_i with:newView];
|
||||
[inspectorView_i getFrame:&r];
|
||||
r = [inspectorView_i frame];
|
||||
inspectorSubview_i = newView;
|
||||
[inspectorSubview_i setAutosizing:NS_WIDTHSIZABLE | NS_HEIGHTSIZABLE];
|
||||
[inspectorSubview_i sizeTo:r.size.width - 4 :r.size.height - 4];
|
||||
[inspectorSubview_i setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
r.size.width -= 4;
|
||||
r.size.height -= 4;
|
||||
[inspectorSubview_i setFrameSize:r.size];
|
||||
|
||||
[inspectorSubview_i lockFocus];
|
||||
[inspectorSubview_i getBounds:&f];
|
||||
PSsetgray(NS_LTGRAY);
|
||||
NSRectFill(&f);
|
||||
f = [inspectorSubview_i bounds];
|
||||
PSsetgray(NSLightGray);
|
||||
NSRectFill(f);
|
||||
[inspectorSubview_i unlockFocus];
|
||||
[inspectorView_i display];
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef Preferences_h
|
||||
#define Preferences_h
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
extern id preferences_i;
|
||||
|
||||
extern float lightaxis[3];
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
|
||||
#include "qedefs.h"
|
||||
#include "Preferences.h"
|
||||
#include "Map.h"
|
||||
#include "QuakeEd.h"
|
||||
#include "Project.h"
|
||||
|
||||
id preferences_i;
|
||||
|
||||
|
@ -35,11 +38,11 @@ void WriteNumericDefault (char *name, float value)
|
|||
char str[128];
|
||||
|
||||
sprintf (str,"%f", value);
|
||||
NSWriteDefault (DEFOWNER, name, str);
|
||||
//XXX NSWriteDefault (DEFOWNER, name, str);
|
||||
}
|
||||
void WriteStringDefault (char *name, char *value)
|
||||
{
|
||||
NSWriteDefault (DEFOWNER, name, value);
|
||||
//XXX NSWriteDefault (DEFOWNER, name, value);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -47,31 +50,31 @@ void WriteStringDefault (char *name, char *value)
|
|||
//
|
||||
- readDefaults
|
||||
{
|
||||
char *string;
|
||||
float value;
|
||||
char *string = "";
|
||||
float value = 0;
|
||||
|
||||
string = (char *)NSGetDefaultValue(DEFOWNER,"ProjectPath");
|
||||
//XXX string = (char *)NSGetDefaultValue(DEFOWNER,"ProjectPath");
|
||||
[self setProjectPath: string];
|
||||
|
||||
string = (char *)NSGetDefaultValue(DEFOWNER,"BspSoundPath");
|
||||
//XXX string = (char *)NSGetDefaultValue(DEFOWNER,"BspSoundPath");
|
||||
[self setBspSoundPath:string];
|
||||
|
||||
value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"ShowBSPOutput"));
|
||||
//XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"ShowBSPOutput"));
|
||||
[self setShowBSP:value];
|
||||
|
||||
value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"OffsetBrushCopy"));
|
||||
//XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"OffsetBrushCopy"));
|
||||
[self setBrushOffset:value];
|
||||
|
||||
value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"StartWad"));
|
||||
//XXX value = _atoi((char *)NSGetDefaultValue(DEFOWNER,"StartWad"));
|
||||
[self setStartWad:value];
|
||||
|
||||
value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Xlight"));
|
||||
//XXX value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Xlight"));
|
||||
[self setXlight:value];
|
||||
|
||||
value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Ylight"));
|
||||
//XXX value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Ylight"));
|
||||
[self setYlight:value];
|
||||
|
||||
value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Zlight"));
|
||||
//XXX value = _atof((char *)NSGetDefaultValue(DEFOWNER,"Zlight"));
|
||||
[self setZlight:value];
|
||||
|
||||
return self;
|
||||
|
@ -83,14 +86,14 @@ void WriteStringDefault (char *name, char *value)
|
|||
if (!path)
|
||||
path = "";
|
||||
strcpy (projectpath, path);
|
||||
[startproject_i setStringValue: path];
|
||||
[startproject_i setStringValue: [NSString stringWithCString:path]];
|
||||
WriteStringDefault ("ProjectPath", path);
|
||||
return self;
|
||||
}
|
||||
|
||||
- setCurrentProject:sender
|
||||
{
|
||||
[startproject_i setStringValue: [project_i currentProjectFile]];
|
||||
[startproject_i setStringValue: [NSString stringWithCString:[project_i currentProjectFile]]];
|
||||
[self UIChanged: self];
|
||||
return self;
|
||||
}
|
||||
|
@ -111,27 +114,27 @@ void WriteStringDefault (char *name, char *value)
|
|||
- setBspSound:sender
|
||||
{
|
||||
id panel;
|
||||
char *types[]={"snd",NULL};
|
||||
NSString *types[] = {@"snd"};
|
||||
int rtn;
|
||||
char **filename;
|
||||
NSArray *filenames;
|
||||
char path[1024], file[64];
|
||||
|
||||
panel = [OpenPanel new];
|
||||
panel = [NSOpenPanel new];
|
||||
|
||||
ExtractFilePath (bspSound, path);
|
||||
ExtractFileBase (bspSound, file);
|
||||
//XXX ExtractFilePath (bspSound, path);
|
||||
//XXX ExtractFileBase (bspSound, file);
|
||||
|
||||
rtn = [panel
|
||||
runModalForDirectory:path
|
||||
file: file
|
||||
types: types];
|
||||
runModalForDirectory:[NSString stringWithCString:path]
|
||||
file: [NSString stringWithCString:file]
|
||||
types: [NSArray arrayWithObjects:types count:1]];
|
||||
|
||||
if (rtn)
|
||||
{
|
||||
filename = (char **)[panel filenames];
|
||||
strcpy(bspSound,[panel directory]);
|
||||
filenames = [panel filenames];
|
||||
strcpy(bspSound,[[panel directory] cString]);
|
||||
strcat(bspSound,"/");
|
||||
strcat(bspSound,filename[0]);
|
||||
strcat(bspSound, [[filenames objectAtIndex:0] cString]);
|
||||
[self setBspSoundPath:bspSound];
|
||||
[self playBspSound];
|
||||
}
|
||||
|
@ -160,15 +163,15 @@ void WriteStringDefault (char *name, char *value)
|
|||
strcpy(bspSound,path);
|
||||
|
||||
if (bspSound_i)
|
||||
[bspSound_i free];
|
||||
bspSound_i = [[Sound alloc] initFromSoundfile:bspSound];
|
||||
[bspSound_i release];
|
||||
bspSound_i = [[NSSound alloc] initWithContentsOfFile:[NSString stringWithCString:bspSound]];
|
||||
if (!bspSound_i)
|
||||
{
|
||||
strcpy (bspSound, "/NextLibrary/Sounds/Funk.snd");
|
||||
bspSound_i = [[Sound alloc] initFromSoundfile:bspSound];
|
||||
bspSound_i = [[NSSound alloc] initWithContentsOfFile:[NSString stringWithCString:bspSound]];
|
||||
}
|
||||
|
||||
[bspSoundField_i setStringValue:bspSound];
|
||||
[bspSoundField_i setStringValue:[NSString stringWithCString:bspSound]];
|
||||
|
||||
WriteStringDefault ("BspSoundPath", bspSound);
|
||||
|
||||
|
@ -233,7 +236,7 @@ void WriteStringDefault (char *name, char *value)
|
|||
if (startwad<0 || startwad>2)
|
||||
startwad = 0;
|
||||
|
||||
[startwad_i selectCellAt:startwad : 0];
|
||||
[startwad_i selectCellAtRow:startwad column: 0];
|
||||
|
||||
WriteNumericDefault ("StartWad", value);
|
||||
return self;
|
||||
|
|
|
@ -4,7 +4,17 @@
|
|||
//
|
||||
//======================================
|
||||
|
||||
#include "qedefs.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "Project.h"
|
||||
#include "Map.h"
|
||||
#include "QuakeEd.h"
|
||||
#include "Preferences.h"
|
||||
#include "Dict.h"
|
||||
#include "Things.h"
|
||||
#include "TexturePalette.h"
|
||||
|
||||
|
||||
id project_i;
|
||||
|
@ -28,7 +38,7 @@ id project_i;
|
|||
char *s;
|
||||
|
||||
s = [preferences_i getProjectPath];
|
||||
StripFilename(s);
|
||||
//XXX StripFilename(s);
|
||||
strcpy(path_basepath,s);
|
||||
|
||||
strcpy(path_progdir,s);
|
||||
|
@ -40,7 +50,7 @@ id project_i;
|
|||
strcpy(path_finalmapdir,s);
|
||||
strcat(path_finalmapdir,"/"SUBDIR_MAPS); // dest dir
|
||||
|
||||
[basepathinfo_i setStringValue:s]; // in Project Inspector
|
||||
[basepathinfo_i setStringValue:[NSString stringWithCString:s]]; // in Project Inspector
|
||||
|
||||
#if 0
|
||||
if ((s = [projectInfo getStringFor:BASEPATHKEY]))
|
||||
|
@ -114,12 +124,12 @@ id project_i;
|
|||
//
|
||||
- initProjSettings
|
||||
{
|
||||
[pis_basepath_i setStringValue:path_basepath];
|
||||
[pis_fullvis_i setStringValue:string_fullvis];
|
||||
[pis_fastvis_i setStringValue:string_fastvis];
|
||||
[pis_novis_i setStringValue:string_novis];
|
||||
[pis_relight_i setStringValue:string_relight];
|
||||
[pis_leaktest_i setStringValue:string_leaktest];
|
||||
[pis_basepath_i setStringValue:[NSString stringWithCString:path_basepath]];
|
||||
[pis_fullvis_i setStringValue:[NSString stringWithCString:string_fullvis]];
|
||||
[pis_fastvis_i setStringValue:[NSString stringWithCString:string_fastvis]];
|
||||
[pis_novis_i setStringValue:[NSString stringWithCString:string_novis]];
|
||||
[pis_relight_i setStringValue:[NSString stringWithCString:string_relight]];
|
||||
[pis_leaktest_i setStringValue:[NSString stringWithCString:string_leaktest]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -132,27 +142,28 @@ id project_i;
|
|||
int end;
|
||||
|
||||
end = [BSPoutput_i textLength];
|
||||
[BSPoutput_i setSel:end :end];
|
||||
[BSPoutput_i replaceSel:string];
|
||||
[BSPoutput_i replaceCharactersInRange:NSMakeRange (end, 0) withString:[NSString stringWithCString:string]];
|
||||
|
||||
end = [BSPoutput_i textLength];
|
||||
[BSPoutput_i setSel:end :end];
|
||||
[BSPoutput_i scrollSelToVisible];
|
||||
[BSPoutput_i setSelectedRange:NSMakeRange (end, 0)];
|
||||
//XXX [BSPoutput_i scrollSelToVisible];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- clearBspOutput:sender
|
||||
{
|
||||
[BSPoutput_i selectAll:self];
|
||||
[BSPoutput_i replaceSel:"\0"];
|
||||
int end;
|
||||
|
||||
end = [BSPoutput_i textLength];
|
||||
[BSPoutput_i replaceCharactersInRange:NSMakeRange (0, end) withString:@""];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- print
|
||||
{
|
||||
[BSPoutput_i printPSCode:self];
|
||||
//XXX [BSPoutput_i printPSCode:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -163,9 +174,9 @@ id project_i;
|
|||
if (projectInfo == NULL)
|
||||
return self;
|
||||
[self initVars];
|
||||
[mapbrowse_i reuseColumns:YES];
|
||||
[mapbrowse_i setReusesColumns:YES];
|
||||
[mapbrowse_i loadColumnZero];
|
||||
[pis_wads_i reuseColumns:YES];
|
||||
[pis_wads_i setReusesColumns:YES];
|
||||
[pis_wads_i loadColumnZero];
|
||||
|
||||
[things_i initEntities];
|
||||
|
@ -209,7 +220,7 @@ id project_i;
|
|||
else
|
||||
{
|
||||
list = nil;
|
||||
Error ("Project: unknown browser to fill");
|
||||
Sys_Error ("Project: unknown browser to fill");
|
||||
}
|
||||
|
||||
max = [list count];
|
||||
|
@ -217,8 +228,8 @@ id project_i;
|
|||
{
|
||||
name = [list elementAt:i];
|
||||
[matrix addRow];
|
||||
cell = [matrix cellAt:i :0];
|
||||
[cell setStringValue:name];
|
||||
cell = [matrix cellAtRow:i column:0];
|
||||
[cell setStringValue:[NSString stringWithCString:name]];
|
||||
[cell setLeaf:YES];
|
||||
[cell setLoaded:YES];
|
||||
}
|
||||
|
@ -240,14 +251,14 @@ id project_i;
|
|||
sprintf(fname,"%s/%s.map",path_mapdirectory,
|
||||
(char *)[mapList elementAt:row]);
|
||||
|
||||
panel = NSGetAlertPanel("Loading...",
|
||||
"Loading map. Please wait.",NULL,NULL,NULL);
|
||||
panel = NSGetAlertPanel(@"Loading...",
|
||||
@"Loading map. Please wait.",NULL,NULL,NULL);
|
||||
[panel orderFront:NULL];
|
||||
|
||||
[quakeed_i doOpen:fname];
|
||||
|
||||
[panel performClose:NULL];
|
||||
NSFreeAlertPanel(panel);
|
||||
//NSFreeAlertPanel(panel);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -266,14 +277,14 @@ id project_i;
|
|||
name = (char *)[wadList elementAt:i];
|
||||
if (!strcmp(name, wf))
|
||||
{
|
||||
[[pis_wads_i matrixInColumn:0] selectCellAt: i : 0];
|
||||
[[pis_wads_i matrixInColumn:0] selectCellAtRow: i column: 0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// update the texture inspector
|
||||
[texturepalette_i initPaletteFromWadfile:wf ];
|
||||
[[map_i objectAt: 0] setKey:"wad" toValue: wf];
|
||||
[[map_i objectAtIndex: 0] setKey:"wad" toValue: wf];
|
||||
// [inspcontrol_i changeInspectorTo:i_textures];
|
||||
|
||||
[quakeed_i updateAll];
|
||||
|
@ -311,9 +322,9 @@ id project_i;
|
|||
path = [preferences_i getProjectPath];
|
||||
if (!path || !path[0] || access(path,0))
|
||||
{
|
||||
rtn = NSRunAlertPanel("Project Error!",
|
||||
"A default project has not been found.\n"
|
||||
, "Open Project", NULL, NULL);
|
||||
rtn = NSRunAlertPanel(@"Project Error!",
|
||||
@"A default project has not been found.\n"
|
||||
, @"Open Project", NULL, NULL);
|
||||
if ([self openProject] == nil)
|
||||
while (1) // can't run without a project
|
||||
[NSApp terminate: self];
|
||||
|
@ -361,19 +372,19 @@ id project_i;
|
|||
char path[128];
|
||||
id openpanel;
|
||||
int rtn;
|
||||
char *projtypes[2] = {"qpr",NULL};
|
||||
char **filenames;
|
||||
char *dir;
|
||||
NSString *projtypes[] ={ @"qpr"};
|
||||
NSArray *filenames;
|
||||
const char *dir;
|
||||
|
||||
openpanel = [OpenPanel new];
|
||||
[openpanel allowMultipleFiles:NO];
|
||||
[openpanel chooseDirectories:NO];
|
||||
rtn = [openpanel runModalForTypes:projtypes];
|
||||
if (rtn == NS_OKTAG)
|
||||
openpanel = [NSOpenPanel new];
|
||||
//[openpanel allowMultipleFiles:NO];
|
||||
//[openpanel chooseDirectories:NO];
|
||||
rtn = [openpanel runModalForTypes:[NSArray arrayWithObjects: projtypes count:1]];
|
||||
if (rtn == NSOKButton)
|
||||
{
|
||||
(const char *const *)filenames = [openpanel filenames];
|
||||
dir = (char *)[openpanel directory];
|
||||
sprintf(path,"%s/%s",dir,filenames[0]);
|
||||
filenames = [openpanel filenames];
|
||||
dir = [[openpanel directory] cString];
|
||||
sprintf (path, "%s/%s", dir, [[filenames objectAtIndex:0] cString]);
|
||||
strcpy(path_projectinfo,path);
|
||||
[self openProjectFile:path];
|
||||
return self;
|
||||
|
|
|
@ -1,9 +1,25 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "QF/quakeio.h"
|
||||
|
||||
#include "QuakeEd.h"
|
||||
#include "Clipper.h"
|
||||
#include "XYView.h"
|
||||
#include "Map.h"
|
||||
#include "CameraView.h"
|
||||
#include "ZView.h"
|
||||
#include "Preferences.h"
|
||||
#include "InspectorControl.h"
|
||||
#include "Project.h"
|
||||
|
||||
id quakeed_i;
|
||||
id entclasses_i;
|
||||
|
||||
extern NSBezierPath *path;
|
||||
id g_cmd_out_i;
|
||||
|
||||
BOOL autodirty;
|
||||
|
@ -36,30 +52,18 @@ void My_Malloc_Error (int code)
|
|||
write (1, "malloc error!\n", strlen("malloc error!\n")+1);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
AutoSave
|
||||
|
||||
Every five minutes, save a modified map
|
||||
===============
|
||||
*/
|
||||
void AutoSave(DPSTimedEntry tag, double now, void *userData)
|
||||
{
|
||||
// automatic backup
|
||||
if (autodirty)
|
||||
{
|
||||
autodirty = NO;
|
||||
[map_i writeMapFile: FN_AUTOSAVE useRegion: NO];
|
||||
}
|
||||
[map_i writeStats];
|
||||
}
|
||||
|
||||
|
||||
#define FN_CMDOUT "/tmp/QuakeEdCmd.txt"
|
||||
void DisplayCmdOutput (void)
|
||||
{
|
||||
char *buffer;
|
||||
QFile *file;
|
||||
int size;
|
||||
|
||||
LoadFile (FN_CMDOUT, (void **)&buffer);
|
||||
file = Qopen (FN_CMDOUT, "rt");
|
||||
size = Qfilesize (file);
|
||||
buffer = malloc (size + 1);
|
||||
size = Qread (file, buffer, size);
|
||||
Qclose (file);
|
||||
unlink (FN_CMDOUT);
|
||||
[project_i addToOutput:buffer];
|
||||
free (buffer);
|
||||
|
@ -69,7 +73,6 @@ void DisplayCmdOutput (void)
|
|||
|
||||
[preferences_i playBspSound];
|
||||
|
||||
NSPing ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -79,8 +82,8 @@ CheckCmdDone
|
|||
See if the BSP is done
|
||||
===============
|
||||
*/
|
||||
DPSTimedEntry cmdte;
|
||||
void CheckCmdDone(DPSTimedEntry tag, double now, void *userData)
|
||||
//DPSTimedEntry cmdte;
|
||||
void CheckCmdDone(/*DPSTimedEntry tag,*/ double now, void *userData)
|
||||
{
|
||||
union wait statusp;
|
||||
struct rusage rusage;
|
||||
|
@ -89,49 +92,71 @@ void CheckCmdDone(DPSTimedEntry tag, double now, void *userData)
|
|||
return;
|
||||
DisplayCmdOutput ();
|
||||
bsppid = 0;
|
||||
DPSRemoveTimedEntry( cmdte );
|
||||
// DPSRemoveTimedEntry( cmdte );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
@implementation QuakeEd
|
||||
|
||||
/*
|
||||
===============
|
||||
AutoSave
|
||||
|
||||
Every five minutes, save a modified map
|
||||
===============
|
||||
*/
|
||||
-(void) AutoSave
|
||||
{
|
||||
// automatic backup
|
||||
if (autodirty)
|
||||
{
|
||||
autodirty = NO;
|
||||
#define FN_AUTOSAVE "/qcache/AutoSaveMap.map"
|
||||
[map_i writeMapFile: FN_AUTOSAVE useRegion: NO];
|
||||
}
|
||||
[map_i writeStats];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
init
|
||||
===============
|
||||
*/
|
||||
- initContent:(const NSRect *)contentRect
|
||||
- initContent:(NSRect)contentRect
|
||||
style:(int)aStyle
|
||||
backing:(int)backingType
|
||||
buttonMask:(int)mask
|
||||
defer:(BOOL)flag
|
||||
{
|
||||
[super initContent:contentRect
|
||||
style:aStyle
|
||||
[super initWithContentRect:contentRect
|
||||
styleMask:aStyle
|
||||
backing:backingType
|
||||
buttonMask:mask
|
||||
defer:flag];
|
||||
|
||||
[self addToEventMask:
|
||||
NS_RMOUSEDRAGGEDMASK|NS_LMOUSEDRAGGEDMASK];
|
||||
//XXX [self addToEventMask:
|
||||
//XXX NSRightMouseDragged|NSLeftMouseDragged];
|
||||
|
||||
malloc_error(My_Malloc_Error);
|
||||
//XXX malloc_error(My_Malloc_Error);
|
||||
|
||||
quakeed_i = self;
|
||||
dirty = autodirty = NO;
|
||||
|
||||
DPSAddTimedEntry(5*60, AutoSave, self, NS_BASETHRESHOLD);
|
||||
[NSTimer timerWithTimeInterval: 5 * 60
|
||||
target: self
|
||||
selector: @selector(AutoSave)
|
||||
userInfo: nil
|
||||
repeats: YES];
|
||||
|
||||
upath = newUserPath ();
|
||||
path = [NSBezierPath new];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#define FN_TEMPSAVE "/qcache/temp.map"
|
||||
- setDefaultFilename
|
||||
{
|
||||
strcpy (filename, FN_TEMPSAVE);
|
||||
[self setTitleAsFilename:filename];
|
||||
[self setTitleWithRepresentedFilename:[NSString stringWithCString:filename]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -160,15 +185,22 @@ BOOL updatecamera;
|
|||
|
||||
void postappdefined (void)
|
||||
{
|
||||
NSEvent ev;
|
||||
NSEvent *ev;
|
||||
|
||||
if (updateinflight)
|
||||
return;
|
||||
|
||||
// post an event at the end of the que
|
||||
ev.type = NS_APPDEFINED;
|
||||
if (DPSPostEvent(&ev, 0) == -1)
|
||||
printf ("WARNING: DPSPostEvent: full\n");
|
||||
ev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
location: NSZeroPoint
|
||||
modifierFlags: 0
|
||||
timestamp: [[NSDate date] timeIntervalSinceReferenceDate]
|
||||
windowNumber: 0
|
||||
context: [NSApp context]
|
||||
subtype: 0
|
||||
data1: 0
|
||||
data2: 0];
|
||||
[NSApp postEvent: ev atStart: NO];
|
||||
//printf ("posted\n");
|
||||
updateinflight = YES;
|
||||
}
|
||||
|
@ -237,44 +269,44 @@ instance draw the brush after each flush
|
|||
{
|
||||
[super flushWindow];
|
||||
|
||||
if (!running || in_error)
|
||||
if (!running)
|
||||
return self; // don't lock focus before nib is finished loading
|
||||
|
||||
if (_flushDisabled)
|
||||
return self;
|
||||
//if (_flushDisabled)
|
||||
// return self;
|
||||
|
||||
[cameraview_i lockFocus];
|
||||
if (clearinstance)
|
||||
{
|
||||
PSnewinstance ();
|
||||
//XXX PSnewinstance ();
|
||||
clearinstance = NO;
|
||||
}
|
||||
|
||||
PSsetinstance (1);
|
||||
//XXX PSsetinstance (1);
|
||||
linestart (0,0,0);
|
||||
[map_i makeSelectedPerform: @selector(CameraDrawSelf)];
|
||||
[clipper_i cameraDrawSelf];
|
||||
lineflush ();
|
||||
PSsetinstance (0);
|
||||
//XXX PSsetinstance (0);
|
||||
[cameraview_i unlockFocus];
|
||||
|
||||
[xyview_i lockFocus];
|
||||
PSsetinstance (1);
|
||||
//XXX PSsetinstance (1);
|
||||
linestart (0,0,0);
|
||||
[map_i makeSelectedPerform: @selector(XYDrawSelf)];
|
||||
lineflush ();
|
||||
[cameraview_i XYDrawSelf];
|
||||
[zview_i XYDrawSelf];
|
||||
[clipper_i XYDrawSelf];
|
||||
PSsetinstance (0);
|
||||
//XXX PSsetinstance (0);
|
||||
[xyview_i unlockFocus];
|
||||
|
||||
[zview_i lockFocus];
|
||||
PSsetinstance (1);
|
||||
//XXX PSsetinstance (1);
|
||||
[map_i makeSelectedPerform: @selector(ZDrawSelf)];
|
||||
[cameraview_i ZDrawSelf];
|
||||
[clipper_i ZDrawSelf];
|
||||
PSsetinstance (0);
|
||||
//XXX PSsetinstance (0);
|
||||
[zview_i unlockFocus];
|
||||
|
||||
return self;
|
||||
|
@ -291,14 +323,17 @@ App delegate methods
|
|||
|
||||
- applicationDefined:(NSEvent *)theEvent
|
||||
{
|
||||
NSEvent ev, *evp;
|
||||
NSEvent *evp;
|
||||
|
||||
updateinflight = NO;
|
||||
|
||||
//printf ("serviced\n");
|
||||
|
||||
// update screen
|
||||
evp = [NSApp peekNextEvent:-1 into:&ev];
|
||||
evp = [NSApp nextEventMatchingMask: NSAnyEventMask
|
||||
untilDate: [NSDate distantPast]
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
dequeue: NO];
|
||||
if (evp)
|
||||
{
|
||||
postappdefined();
|
||||
|
@ -322,7 +357,7 @@ App delegate methods
|
|||
|
||||
updatecamera = updatexy = updatez = NO;
|
||||
|
||||
[self reenableFlushWindow];
|
||||
[self enableFlushWindow];
|
||||
[self flushWindow];
|
||||
|
||||
// NSPing ();
|
||||
|
@ -332,8 +367,8 @@ App delegate methods
|
|||
|
||||
- appDidInit:sender
|
||||
{
|
||||
NSScreen const *screens;
|
||||
int screencount;
|
||||
NSArray *screens;
|
||||
NSScreen *scrn;
|
||||
|
||||
running = YES;
|
||||
g_cmd_out_i = cmd_out_i; // for qprintf
|
||||
|
@ -345,14 +380,16 @@ App delegate methods
|
|||
// scrollview and can't be
|
||||
// connected directly in IB
|
||||
|
||||
[self setFrameAutosaveName:"EditorWinFrame"];
|
||||
[self setFrameAutosaveName:@"EditorWinFrame"];
|
||||
[self clear: self];
|
||||
|
||||
// go to my second monitor
|
||||
[NSApp getScreens:&screens count:&screencount];
|
||||
if (screencount == 2)
|
||||
[self moveTopLeftTo:0 : screens[1].screenBounds.size.height
|
||||
screen:screens+1];
|
||||
screens = [NSScreen screens];
|
||||
if ([screens count] == 2) {
|
||||
scrn = [screens objectAtIndex: 1];
|
||||
//XXX [self moveTopLeftTo:0 : [scrn frame].size.height
|
||||
//XXX screen:scrn];
|
||||
}
|
||||
|
||||
[self makeKeyAndOrderFront: self];
|
||||
|
||||
|
@ -379,7 +416,7 @@ App delegate methods
|
|||
{
|
||||
char const *t;
|
||||
|
||||
t = [sender stringValue];
|
||||
t = [[sender stringValue] cString];
|
||||
|
||||
if (!strcmp (t, "texname"))
|
||||
{
|
||||
|
@ -425,7 +462,7 @@ App delegate methods
|
|||
{
|
||||
NSRect sbounds;
|
||||
|
||||
[[xyview_i _super_view] getBounds: &sbounds];
|
||||
sbounds = [[xyview_i superview] bounds];
|
||||
|
||||
sbounds.origin.x += sbounds.size.width/2;
|
||||
sbounds.origin.y += sbounds.size.height/2;
|
||||
|
@ -440,7 +477,7 @@ App delegate methods
|
|||
{
|
||||
NSRect sbounds;
|
||||
|
||||
[[xyview_i _super_view] getBounds: &sbounds];
|
||||
sbounds = [[xyview_i superview] bounds];
|
||||
|
||||
sbounds.origin.x += sbounds.size.width/2;
|
||||
sbounds.origin.y += sbounds.size.height/2;
|
||||
|
@ -529,7 +566,7 @@ applyRegion:
|
|||
NSRect bounds;
|
||||
|
||||
// get xy size
|
||||
[[xyview_i _super_view] getBounds: &bounds];
|
||||
bounds = [[xyview_i superview] bounds];
|
||||
|
||||
region_min[0] = bounds.origin.x;
|
||||
region_min[1] = bounds.origin.y;
|
||||
|
@ -624,7 +661,7 @@ saveBSP
|
|||
if ([regionbutton_i intValue])
|
||||
{
|
||||
strcpy (mappath, filename);
|
||||
StripExtension (mappath);
|
||||
//XXX StripExtension (mappath);
|
||||
strcat (mappath, ".reg");
|
||||
[map_i writeMapFile: mappath useRegion: YES];
|
||||
wt = YES; // allways pop the dialog on region ops
|
||||
|
@ -646,7 +683,7 @@ saveBSP
|
|||
|
||||
strcpy (bsppath, destdir);
|
||||
strcat (bsppath, "/");
|
||||
ExtractFileBase (mappath, bsppath + strlen(bsppath));
|
||||
//XXX ExtractFileBase (mappath, bsppath + strlen(bsppath));
|
||||
strcat (bsppath, ".bsp");
|
||||
|
||||
ExpandCommand (cmdline, expandedcmd, mappath, bsppath);
|
||||
|
@ -666,16 +703,16 @@ saveBSP
|
|||
{
|
||||
id panel;
|
||||
|
||||
panel = NSGetAlertPanel("BSP In Progress",expandedcmd,NULL,NULL,NULL);
|
||||
panel = NSGetAlertPanel(@"BSP In Progress",[NSString stringWithCString:expandedcmd],NULL,NULL,NULL);
|
||||
[panel makeKeyAndOrderFront:NULL];
|
||||
system(expandedcmd);
|
||||
NSFreeAlertPanel(panel);
|
||||
[panel release];
|
||||
[self makeKeyAndOrderFront:NULL];
|
||||
DisplayCmdOutput ();
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdte = DPSAddTimedEntry(1, CheckCmdDone, self, NS_BASETHRESHOLD);
|
||||
//cmdte = DPSAddTimedEntry(1, CheckCmdDone, self, NS_BASETHRESHOLD);
|
||||
if (! (bsppid = fork ()) )
|
||||
{
|
||||
system (expandedcmd);
|
||||
|
@ -726,7 +763,7 @@ saveBSP
|
|||
}
|
||||
|
||||
kill (bsppid, 9);
|
||||
CheckCmdDone (cmdte, 0, NULL);
|
||||
//CheckCmdDone (cmdte, 0, NULL);
|
||||
[project_i addToOutput: "\n\n========= STOPPED =========\n\n"];
|
||||
|
||||
return self;
|
||||
|
@ -748,7 +785,7 @@ Called by open or the project panel
|
|||
[map_i readMapFile:filename];
|
||||
|
||||
[regionbutton_i setIntValue: 0];
|
||||
[self setTitleAsFilename:fname];
|
||||
[self setTitleWithRepresentedFilename:[NSString stringWithCString:fname]];
|
||||
[self updateAll];
|
||||
|
||||
qprintf ("%s loaded\n", fname);
|
||||
|
@ -765,17 +802,17 @@ open
|
|||
- open: sender;
|
||||
{
|
||||
id openpanel;
|
||||
static char *suffixlist[] = {"map", 0};
|
||||
NSString *suffixlist[] = {@"map"};
|
||||
|
||||
openpanel = [OpenPanel new];
|
||||
openpanel = [NSOpenPanel new];
|
||||
|
||||
if ( [openpanel
|
||||
runModalForDirectory: [project_i getMapDirectory]
|
||||
file: ""
|
||||
types: suffixlist] != NS_OKTAG)
|
||||
runModalForDirectory: [NSString stringWithCString:[project_i getMapDirectory]]
|
||||
file: @""
|
||||
types: [NSArray arrayWithObjects:suffixlist count:1]] != NSOKButton)
|
||||
return self;
|
||||
|
||||
[self doOpen: (char *)[openpanel filename]];
|
||||
[self doOpen: (char *)[[openpanel filename] cString]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -797,7 +834,7 @@ save:
|
|||
dirty = autodirty = NO;
|
||||
|
||||
strcpy (backup, filename);
|
||||
StripExtension (backup);
|
||||
//XXX StripExtension (backup);
|
||||
strcat (backup, ".bak");
|
||||
rename (filename, backup); // copy old to .bak
|
||||
|
||||
|
@ -817,15 +854,15 @@ saveAs
|
|||
id panel_i;
|
||||
char dir[1024];
|
||||
|
||||
panel_i = [SavePanel new];
|
||||
ExtractFileBase (filename, dir);
|
||||
[panel_i setRequiredFileType: "map"];
|
||||
if ( [panel_i runModalForDirectory:[project_i getMapDirectory] file: dir] != NS_OKTAG)
|
||||
panel_i = [NSSavePanel new];
|
||||
//XXX ExtractFileBase (filename, dir);
|
||||
[panel_i setRequiredFileType: @"map"];
|
||||
if ( [panel_i runModalForDirectory:[NSString stringWithCString:[project_i getMapDirectory]] file: [NSString stringWithCString:dir]] != NSOKButton)
|
||||
return self;
|
||||
|
||||
strcpy (filename, [panel_i filename]);
|
||||
strcpy (filename, [[panel_i filename] cString]);
|
||||
|
||||
[self setTitleAsFilename:filename];
|
||||
[self setTitleWithRepresentedFilename:[NSString stringWithCString:filename]];
|
||||
|
||||
[self save: self];
|
||||
|
||||
|
@ -855,7 +892,7 @@ saveAs
|
|||
if ([clipper_i hide]) // first click hides only the clipper
|
||||
return [self updateAll];
|
||||
|
||||
[map_i setCurrentEntity: [map_i objectAt: 0]]; // make world selected
|
||||
[map_i setCurrentEntity: [map_i objectAtIndex: 0]]; // make world selected
|
||||
[map_i makeSelectedPerform: @selector(deselect)];
|
||||
[self updateAll];
|
||||
|
||||
|
@ -879,7 +916,7 @@ keyDown
|
|||
int ch;
|
||||
|
||||
// function keys
|
||||
switch (theEvent->data.key.keyCode)
|
||||
switch ([theEvent keyCode])
|
||||
{
|
||||
case 60: // F2
|
||||
[cameraview_i setDrawMode: dr_wire];
|
||||
|
@ -924,7 +961,7 @@ keyDown
|
|||
}
|
||||
|
||||
// portable things
|
||||
ch = tolower(theEvent->data.key.charCode);
|
||||
ch = tolower([[theEvent characters] cString][0]);
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
/* Generated by the NeXT Project Builder
|
||||
NOTE: Do NOT change this file -- Project Builder maintains it.
|
||||
*/
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include <appkit/appkit.h>
|
||||
|
||||
void main(int argc, char *argv[]) {
|
||||
|
||||
[Application new];
|
||||
if ([NSApp loadNibSection:"QuakeEd.nib" owner:NSApp withNames:NO])
|
||||
[NSApp run];
|
||||
|
||||
[NSApp free];
|
||||
exit(0);
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
return NSApplicationMain (argc, argv);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
#include "EntityClass.h"
|
||||
#include "Map.h"
|
||||
#include "Preferences.h"
|
||||
#include "XYView.h"
|
||||
#include "ZView.h"
|
||||
#include "CameraView.h"
|
||||
#include "Clipper.h"
|
||||
#include "QuakeEd.h"
|
||||
|
||||
@implementation SetBrush
|
||||
|
||||
|
@ -1091,7 +1096,7 @@ BOOL fakebrush;
|
|||
copy = [copy addFace: &face];
|
||||
if (copy)
|
||||
{
|
||||
[copy perform:call];
|
||||
[copy performSelector:call];
|
||||
[copy dealloc];
|
||||
}
|
||||
fakebrush = NO;
|
||||
|
@ -1720,7 +1725,7 @@ id sb_newowner;
|
|||
parent = sb_newowner;
|
||||
|
||||
// hack to allow them to be copied to another map
|
||||
if ( [parent respondsTo:@selector(valueForQKey:)])
|
||||
if ( [parent respondsToSelector:@selector(valueForQKey:)])
|
||||
{
|
||||
eclass = [entity_classes_i classForName: [parent valueForQKey: "classname"]];
|
||||
c = [eclass drawColor];
|
||||
|
|
85
tools/Forge/Bundles/MapEdit/Storage.h
Normal file
85
tools/Forge/Bundles/MapEdit/Storage.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* Interface for Objective C NeXT-compatible Storage object
|
||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Kresten Krab Thorup <krab@iesd.auc.dk>
|
||||
Dept. of Mathematics and Computer Science, Aalborg U., Denmark
|
||||
|
||||
This file is part of the Gnustep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/******************************************************************
|
||||
TODO:
|
||||
Does not implement methods for archiving itself.
|
||||
******************************************************************/
|
||||
|
||||
#ifndef __Storage_h_INCLUDE_GNU
|
||||
#define __Storage_h_INCLUDE_GNU
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
@interface Storage : NSObject
|
||||
{
|
||||
@public
|
||||
void *dataPtr; /* data of the Storage object */
|
||||
const char *description; /* Element description */
|
||||
NSUInteger numElements; /* Actual number of elements */
|
||||
NSUInteger maxElements; /* Total allocated elements */
|
||||
NSUInteger elementSize; /* Element size */
|
||||
}
|
||||
|
||||
/* Creating, freeing, initializing, and emptying */
|
||||
|
||||
- init;
|
||||
- initCount:(NSUInteger)numSlots elementSize:(NSUInteger)sizeInBytes
|
||||
description:(const char*)elemDesc;
|
||||
- (void)dealloc;
|
||||
- empty;
|
||||
- copy;
|
||||
|
||||
/* Manipulating the elements */
|
||||
|
||||
- (BOOL)isEqual: anObject;
|
||||
- (const char *)description;
|
||||
- (NSUInteger)count;
|
||||
- (void *)elementAt:(NSUInteger)index;
|
||||
- replaceElementAt:(NSUInteger)index with:(void *)anElement;
|
||||
- setNumSlots:(NSUInteger)numSlots;
|
||||
- setAvailableCapacity:(NSUInteger)numSlots;
|
||||
- addElement:(void *)anElement;
|
||||
- removeLastElement;
|
||||
- insertElement:(void *)anElement at:(NSUInteger)index;
|
||||
- removeElementAt:(NSUInteger)index;
|
||||
|
||||
/* Archiving */
|
||||
|
||||
- write:(TypedStream *)stream;
|
||||
- read:(TypedStream *)stream;
|
||||
|
||||
/* old-style creation */
|
||||
|
||||
+ new;
|
||||
+ newCount:(NSUInteger)count elementSize:(NSUInteger)sizeInBytes
|
||||
description:(const char *)descriptor;
|
||||
|
||||
@end
|
||||
|
||||
typedef struct {
|
||||
@defs(Storage)
|
||||
} NXStorageId;
|
||||
|
||||
|
||||
#endif /* __Storage_h_INCLUDE_GNU */
|
284
tools/Forge/Bundles/MapEdit/Storage.m
Normal file
284
tools/Forge/Bundles/MapEdit/Storage.m
Normal file
|
@ -0,0 +1,284 @@
|
|||
/* Implementation of Objective C NeXT-compatible Storage object
|
||||
Copyright (C) 1993,1994, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Kresten Krab Thorup <krab@iesd.auc.dk>
|
||||
Dept. of Mathematics and Computer Science, Aalborg U., Denmark
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* #include <config.h> */
|
||||
#include "Storage.h"
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
|
||||
#define GNU_STORAGE_NTH(x,N) \
|
||||
({ GNUStorageId* __s=(GNUStorageId*)(x); \
|
||||
(void*)(((char*)__s->dataPtr)+(__s->elementSize*(N))); })
|
||||
#define STORAGE_NTH(N) GNU_STORAGE_NTH (self, N)
|
||||
|
||||
typedef struct {
|
||||
@defs(Storage)
|
||||
} GNUStorageId;
|
||||
|
||||
@implementation Storage
|
||||
|
||||
+ initialize
|
||||
{
|
||||
if (self == [Storage class])
|
||||
[self setVersion:0]; /* beta release */
|
||||
return self;
|
||||
}
|
||||
|
||||
// INITIALIZING, FREEING;
|
||||
|
||||
- initCount: (NSUInteger)numSlots
|
||||
elementSize: (NSUInteger)sizeInBytes
|
||||
description: (const char*)elemDesc;
|
||||
{
|
||||
[super init];
|
||||
numElements = numSlots;
|
||||
maxElements = (numSlots > 0) ? numSlots : 1;
|
||||
elementSize = sizeInBytes;
|
||||
description = elemDesc;
|
||||
dataPtr = (void*) objc_malloc (maxElements * elementSize);
|
||||
bzero(dataPtr, numElements * elementSize);
|
||||
return self;
|
||||
}
|
||||
|
||||
- init
|
||||
{
|
||||
return [self initCount:1
|
||||
elementSize:sizeof(id)
|
||||
description:@encode(id)];
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (dataPtr)
|
||||
free(dataPtr);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (const char*) description
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
// COPYING;
|
||||
|
||||
- copy
|
||||
{
|
||||
Storage *c = [super copy];
|
||||
c->dataPtr = (void*) objc_malloc (maxElements * elementSize);
|
||||
memcpy(c->dataPtr, dataPtr, numElements * elementSize);
|
||||
return c;
|
||||
}
|
||||
|
||||
// COMPARING TWO STORAGES;
|
||||
|
||||
- (BOOL)isEqual: anObject
|
||||
{
|
||||
if ([anObject isKindOfClass: [Storage class]]
|
||||
&& [anObject count] == [self count]
|
||||
&& !memcmp(((GNUStorageId*)anObject)->dataPtr,
|
||||
dataPtr, numElements*elementSize))
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
// MANAGING THE STORAGE CAPACITY;
|
||||
|
||||
static inline void _makeRoomForAnotherIfNecessary(Storage *self)
|
||||
{
|
||||
if (self->numElements == self->maxElements)
|
||||
{
|
||||
self->maxElements *= 2;
|
||||
self->dataPtr = (void*)
|
||||
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _shrinkIfDesired(Storage *self)
|
||||
{
|
||||
if (self->numElements < (self->maxElements / 2))
|
||||
{
|
||||
self->maxElements /= 2;
|
||||
self->dataPtr = (void *)
|
||||
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
||||
}
|
||||
}
|
||||
|
||||
- setAvailableCapacity:(NSUInteger)numSlots
|
||||
{
|
||||
if (numSlots > numElements)
|
||||
{
|
||||
maxElements = numSlots;
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- setNumSlots:(NSUInteger)numSlots
|
||||
{
|
||||
if (numSlots > numElements)
|
||||
{
|
||||
maxElements = numSlots;
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize);
|
||||
}
|
||||
else if (numSlots < numElements)
|
||||
{
|
||||
numElements = numSlots;
|
||||
_shrinkIfDesired (self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Manipulating objects by index */
|
||||
|
||||
#define CHECK_INDEX(IND) if (IND >= numElements) return 0
|
||||
|
||||
- (NSUInteger) count
|
||||
{
|
||||
return numElements;
|
||||
}
|
||||
|
||||
- (void*) elementAt: (NSUInteger)index
|
||||
{
|
||||
CHECK_INDEX(index);
|
||||
return STORAGE_NTH (index);
|
||||
}
|
||||
|
||||
- addElement: (void*)anElement
|
||||
{
|
||||
_makeRoomForAnotherIfNecessary(self);
|
||||
memcpy(STORAGE_NTH(numElements), anElement, elementSize);
|
||||
numElements++;
|
||||
return self;
|
||||
}
|
||||
|
||||
- insertElement: (void*)anElement at: (NSUInteger)index
|
||||
{
|
||||
int i;
|
||||
|
||||
CHECK_INDEX(index);
|
||||
_makeRoomForAnotherIfNecessary(self);
|
||||
#ifndef STABLE_MEMCPY
|
||||
for (i = numElements; i >= index; i--)
|
||||
memcpy (STORAGE_NTH(i+1), STORAGE_NTH(i), elementSize);
|
||||
#else
|
||||
memcpy (STORAGE_NTH (index+1),
|
||||
STORAGE_NTH (index),
|
||||
elementSize*(numElements-index));
|
||||
#endif
|
||||
memcpy(STORAGE_NTH(i), anElement, elementSize);
|
||||
numElements++;
|
||||
return self;
|
||||
}
|
||||
|
||||
- removeElementAt: (NSUInteger)index
|
||||
{
|
||||
int i;
|
||||
|
||||
CHECK_INDEX(index);
|
||||
numElements--;
|
||||
#ifndef STABLE_MEMCPY
|
||||
for (i = index; i < numElements; i++)
|
||||
memcpy(STORAGE_NTH(i),
|
||||
STORAGE_NTH(i+1),
|
||||
elementSize);
|
||||
#else
|
||||
memcpy (STORAGE_NTH (index),
|
||||
STORAGE_NTH (index+1),
|
||||
elementSize*(numElements-index-1));
|
||||
#endif
|
||||
_shrinkIfDesired(self);
|
||||
return self;
|
||||
}
|
||||
|
||||
- removeLastElement
|
||||
{
|
||||
if (numElements)
|
||||
{
|
||||
numElements--;
|
||||
_shrinkIfDesired(self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- replaceElementAt:(NSUInteger)index with:(void*)newElement
|
||||
{
|
||||
CHECK_INDEX(index);
|
||||
memcpy(STORAGE_NTH(index), newElement, elementSize);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Emptying the Storage */
|
||||
|
||||
- empty
|
||||
{
|
||||
numElements = 0;
|
||||
maxElements = 1;
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Archiving */
|
||||
|
||||
- write: (TypedStream*)aStream
|
||||
{
|
||||
int i;
|
||||
|
||||
[super write:aStream];
|
||||
objc_write_types(aStream, "III*",
|
||||
&numElements, &maxElements, &elementSize, &description);
|
||||
for (i = 0; i < numElements; i++)
|
||||
objc_write_type(aStream, description, STORAGE_NTH(i));
|
||||
return self;
|
||||
}
|
||||
|
||||
- read: (TypedStream*)aStream
|
||||
{
|
||||
int i;
|
||||
|
||||
[super read:aStream];
|
||||
objc_read_types(aStream, "III*",
|
||||
&numElements, &maxElements, &elementSize, &description);
|
||||
dataPtr = (void*) objc_malloc (maxElements * elementSize);
|
||||
for (i = 0; i < numElements; i++)
|
||||
objc_read_type(aStream, description, STORAGE_NTH(i));
|
||||
return self;
|
||||
}
|
||||
|
||||
+ new
|
||||
{
|
||||
return [[self alloc] init];
|
||||
}
|
||||
|
||||
+ newCount:(NSUInteger)count elementSize:(NSUInteger)sizeInBytes
|
||||
description:(const char *)descriptor
|
||||
{
|
||||
return [[self alloc] initCount:count elementSize:sizeInBytes
|
||||
description:descriptor];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,6 +1,17 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/quakeio.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "TexturePalette.h"
|
||||
#include "Preferences.h"
|
||||
#include "Map.h"
|
||||
#include "Entity.h"
|
||||
#include "QuakeEd.h"
|
||||
#include "SetBrush.h"
|
||||
|
||||
#include "Storage.h"
|
||||
|
||||
id texturepalette_i;
|
||||
|
||||
|
@ -101,18 +112,18 @@ void TEX_ImageFromMiptex (miptex_t *qtex)
|
|||
height = LittleLong(qtex->height);
|
||||
|
||||
bm = [[NSBitmapImageRep alloc]
|
||||
initData: NULL
|
||||
initWithBitmapDataPlanes: NULL
|
||||
pixelsWide: width
|
||||
pixelsHigh: height
|
||||
bitsPerSample: 8
|
||||
samplesPerPixel:3
|
||||
hasAlpha: NO
|
||||
isPlanar: NO
|
||||
colorSpace: NS_RGBColorSpace
|
||||
colorSpaceName: NSCalibratedRGBColorSpace
|
||||
bytesPerRow: width*4
|
||||
bitsPerPixel: 32];
|
||||
|
||||
dest = (unsigned *)[bm data];
|
||||
dest = (unsigned *)[bm bitmapData];
|
||||
count = width*height;
|
||||
source = (byte *)qtex + LittleLong(qtex->offsets[0]);
|
||||
|
||||
|
@ -176,6 +187,8 @@ void TEX_InitFromWad (char *path)
|
|||
lumpinfo_t *lumpinfo;
|
||||
int numlumps;
|
||||
float start, stop;
|
||||
QFile *file;
|
||||
size_t size;
|
||||
|
||||
start = I_FloatTime ();
|
||||
|
||||
|
@ -185,21 +198,25 @@ void TEX_InitFromWad (char *path)
|
|||
|
||||
// free any textures
|
||||
for (i=0 ; i<tex_count ; i++)
|
||||
[qtextures[i].rep free];
|
||||
[qtextures[i].rep release];
|
||||
tex_count = 0;
|
||||
|
||||
// try and use the cached wadfile
|
||||
sprintf (local, "/qcache%s", newpath);
|
||||
|
||||
Sys_UpdateFile (local, newpath);
|
||||
|
||||
LoadFile (local, (void **)&wadfile);
|
||||
//Sys_UpdateFile (local, newpath);
|
||||
//FIXME use wad functions
|
||||
file = Qopen (local, "rb");
|
||||
size = Qfilesize (file);
|
||||
wadfile = malloc (size);
|
||||
Qread (file, wadfile, size);
|
||||
Qclose (file);
|
||||
wadinfo = (wadinfo_t *)wadfile;
|
||||
|
||||
if (strncmp (wadfile, "WAD2", 4))
|
||||
if (strncmp ((char *)wadfile, "WAD2", 4))
|
||||
{
|
||||
unlink (local);
|
||||
Error ("TEX_InitFromWad: %s isn't a wadfile", newpath);
|
||||
Sys_Error ("TEX_InitFromWad: %s isn't a wadfile", newpath);
|
||||
}
|
||||
|
||||
numlumps = LittleLong (wadinfo->numlumps);
|
||||
|
@ -208,7 +225,7 @@ void TEX_InitFromWad (char *path)
|
|||
if (strcmp (lumpinfo->name, "PALETTE"))
|
||||
{
|
||||
unlink (local);
|
||||
Error ("TEX_InitFromWad: %s doesn't have palette as 0",path);
|
||||
Sys_Error ("TEX_InitFromWad: %s doesn't have palette as 0",path);
|
||||
}
|
||||
|
||||
TEX_InitPalette (wadfile + LittleLong(lumpinfo->filepos));
|
||||
|
@ -217,8 +234,8 @@ void TEX_InitFromWad (char *path)
|
|||
for (i=1 ; i<numlumps ; i++, lumpinfo++)
|
||||
{
|
||||
if (lumpinfo->type != TYP_MIPTEX)
|
||||
Error ("TEX_InitFromWad: %s is not a miptex!",lumpinfo->name);
|
||||
CleanupName (lumpinfo->name,qtextures[tex_count].name);
|
||||
Sys_Error ("TEX_InitFromWad: %s is not a miptex!",lumpinfo->name);
|
||||
//XXX CleanupName (lumpinfo->name,qtextures[tex_count].name);
|
||||
TEX_ImageFromMiptex ( (miptex_t *)(wadfile +
|
||||
LittleLong(lumpinfo->filepos) ));
|
||||
}
|
||||
|
@ -237,11 +254,11 @@ TEX_NumForName
|
|||
*/
|
||||
qtexture_t *TEX_ForName (char *name)
|
||||
{
|
||||
char newname[16];
|
||||
//XXX char newname[16];
|
||||
int i;
|
||||
qtexture_t *q;
|
||||
|
||||
CleanupName (name, newname);
|
||||
//XXX CleanupName (name, newname);
|
||||
|
||||
for (i=0,q = qtextures ; i< tex_count ; i++, q++)
|
||||
{
|
||||
|
@ -266,10 +283,9 @@ qtexture_t *TEX_ForName (char *name)
|
|||
return self;
|
||||
}
|
||||
|
||||
- display
|
||||
- (void)display
|
||||
{
|
||||
[[textureView_i superview] display];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
|
@ -384,7 +400,7 @@ qtexture_t *TEX_ForName (char *name)
|
|||
x = TEX_INDENT;
|
||||
|
||||
view = [textureView_i superview];
|
||||
[view getBounds:&b];
|
||||
b = [view bounds];
|
||||
maxwidth = b.size.width;
|
||||
|
||||
for (i = 0;i < max; i++)
|
||||
|
@ -407,9 +423,9 @@ qtexture_t *TEX_ForName (char *name)
|
|||
|
||||
viewWidth = maxwidth;
|
||||
viewHeight = y + TEX_SPACING;
|
||||
[textureView_i sizeTo:viewWidth :viewHeight];
|
||||
[textureView_i setBoundsSize:NSMakeSize (viewWidth, viewHeight)];
|
||||
pt.x = pt.y = 0;
|
||||
[textureView_i scrollPoint:&pt];
|
||||
[textureView_i scrollPoint:pt];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -471,11 +487,11 @@ qtexture_t *TEX_ForName (char *name)
|
|||
r.size.height += TEX_INDENT*2;
|
||||
r.origin.x -= TEX_INDENT;
|
||||
r.origin.y -= TEX_INDENT;
|
||||
[textureView_i scrollRectToVisible:&r];
|
||||
[textureView_i scrollRectToVisible:r];
|
||||
[textureView_i display];
|
||||
sprintf(string,"%d x %d",(int)t->r.size.width,
|
||||
(int)t->r.size.height - TEX_SPACING);
|
||||
[sizeField_i setStringValue:string];
|
||||
[sizeField_i setStringValue:[NSString stringWithCString:string]];
|
||||
}
|
||||
|
||||
[self texturedefChanged:self];
|
||||
|
@ -528,7 +544,7 @@ qtexture_t *TEX_ForName (char *name)
|
|||
int max;
|
||||
|
||||
max = [textureList_i count];
|
||||
CleanupName(name,name);
|
||||
//XXX CleanupName(name,name);
|
||||
for (i = 0;i < max;i++)
|
||||
{
|
||||
t = [textureList_i elementAt:i];
|
||||
|
@ -556,7 +572,7 @@ qtexture_t *TEX_ForName (char *name)
|
|||
int i;
|
||||
int max;
|
||||
int len;
|
||||
char name[32];
|
||||
char name[32], *n;
|
||||
texpal_t *t;
|
||||
|
||||
if (selectedTexture == -1)
|
||||
|
@ -564,7 +580,9 @@ qtexture_t *TEX_ForName (char *name)
|
|||
|
||||
max = [textureList_i count];
|
||||
strcpy(name,(const char *)[sender stringValue]);
|
||||
[sender setStringValue:strupr(name)];
|
||||
for (n = name; *n; n++)
|
||||
*n = toupper (*n);
|
||||
[sender setStringValue:[NSString stringWithCString:name]];
|
||||
len = strlen(name);
|
||||
|
||||
for (i = selectedTexture-1;i >= 0; i--)
|
||||
|
@ -779,11 +797,11 @@ qtexture_t *TEX_ForName (char *name)
|
|||
for (i = 0;i < max; i++)
|
||||
[self setDisplayFlag:i to:0];
|
||||
|
||||
brushes = [map_i objectAt:0];
|
||||
brushes = [map_i objectAtIndex:0];
|
||||
max = [brushes count];
|
||||
for (i = 0;i < max; i++)
|
||||
{
|
||||
b = (SetBrush *)[brushes objectAt:i];
|
||||
b = (SetBrush *)[brushes objectAtIndex:i];
|
||||
numfaces = [b getNumBrushFaces];
|
||||
for (j = 0; j < numfaces; j++)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef TextureView_h
|
||||
#define TextureView_h
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
@interface TextureView:NSView
|
||||
{
|
||||
id parent_i;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
|
||||
#include "qedefs.h"
|
||||
#include "KeypairView.h"
|
||||
#include "TextureView.h"
|
||||
#include "TexturePalette.h"
|
||||
|
||||
#include "Storage.h"
|
||||
|
||||
/*
|
||||
|
||||
|
@ -40,10 +44,10 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
|
||||
selected = [parent_i getSelectedTexture];
|
||||
list_i = [parent_i getList];
|
||||
PSselectfont("Helvetica-Medium",FONTSIZE);
|
||||
GSSetFont (DEFCTXT, [NSFont fontWithName:@"Helvetica-Medium" size:FONTSIZE]);
|
||||
PSrotate(0);
|
||||
|
||||
PSsetgray(NS_LTGRAY);
|
||||
PSsetgray(NSLightGray);
|
||||
PSrectfill(rects->origin.x, rects->origin.y,
|
||||
rects->size.width, rects->size.height);
|
||||
|
||||
|
@ -59,12 +63,12 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
r.size.width += TEX_INDENT*2;
|
||||
r.size.height += TEX_INDENT*2;
|
||||
|
||||
PSsetgray(NSGrayComponent(NS_COLORLTGRAY));
|
||||
//XXX PSsetgray(NSGrayComponent(NS_COLORLTGRAY));
|
||||
PSrectfill(r.origin.x, r.origin.y,
|
||||
r.size.width, r.size.height);
|
||||
p = t->r.origin;
|
||||
p.y += TEX_SPACING;
|
||||
[t->image drawAt:&p];
|
||||
[t->image drawAtPoint:p fromRect:r operation:NSCompositeCopy fraction:1.0];
|
||||
PSsetgray(0);
|
||||
x = t->r.origin.x;
|
||||
y = t->r.origin.y + 7;
|
||||
|
@ -84,7 +88,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
r.origin.x -= TEX_INDENT/2;
|
||||
r.size.width += TEX_INDENT;
|
||||
r.origin.y += 4;
|
||||
if (NSIntersectsRect(&rects[0],&r) == YES &&
|
||||
if (NSIntersectsRect(rects[0],r) == YES &&
|
||||
t->display)
|
||||
{
|
||||
if (selected == i)
|
||||
|
@ -100,7 +104,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
|
||||
p = t->r.origin;
|
||||
p.y += TEX_SPACING;
|
||||
[t->image drawAt:&p];
|
||||
[t->image drawAtPoint:p fromRect:r operation:NSCompositeCopy fraction:1.0];
|
||||
x = t->r.origin.x;
|
||||
y = t->r.origin.y + 7;
|
||||
PSmoveto(x,y);
|
||||
|
@ -122,14 +126,14 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
NSPoint loc;
|
||||
int i;
|
||||
int max;
|
||||
int oldwindowmask;
|
||||
//int oldwindowmask;
|
||||
texpal_t *t;
|
||||
id list;
|
||||
NSRect r;
|
||||
|
||||
oldwindowmask = [window addToEventMask:NS_LMOUSEDRAGGEDMASK];
|
||||
loc = theEvent->location;
|
||||
[self convertPoint:&loc fromView:NULL];
|
||||
//oldwindowmask = [window addToEventMask:NSLeftMouseDraggedMask];
|
||||
loc = [theEvent locationInWindow];
|
||||
[self convertPoint:loc fromView:NULL];
|
||||
|
||||
list = [parent_i getList];
|
||||
max = [list count];
|
||||
|
@ -137,7 +141,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
{
|
||||
t = [list elementAt:i];
|
||||
r = t->r;
|
||||
if (NSPointInRect(&loc,&r) == YES)
|
||||
if (NSPointInRect(loc,r) == YES)
|
||||
{
|
||||
[self deselect];
|
||||
[parent_i setSelectedTexture:i];
|
||||
|
@ -145,7 +149,7 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
|
|||
}
|
||||
}
|
||||
|
||||
[window setEventMask:oldwindowmask];
|
||||
//[window setEventMask:oldwindowmask];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue