diff --git a/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp b/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp new file mode 100644 index 0000000..30c12c6 --- /dev/null +++ b/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp @@ -0,0 +1,76 @@ + +#include "PhotoshopExporter.h" + +#include + +SPBasicSuite * sSPBasic = NULL; + + + +void InitGlobals (Ptr globalPtr) +{ + Globals * globals = (Globals *)globalPtr; + + // Set default values. + globals->queryForParameters = true; +} + + + + +DLLExport MACPASCAL void PluginMain (const short selector, + void *exportParamBlock, + long *data, + short *result) +{ + if (selector == exportSelectorAbout) + { + sSPBasic = ((AboutRecord*)exportParamBlock)->sSPBasic; + //DoAbout((AboutRecordPtr)exportParamBlock); + } + else + { + sSPBasic = ((ExportRecordPtr)exportParamBlock)->sSPBasic; + + // Allocate and initialize globals. + Ptr globalPtr = AllocateGlobals ((uint32)result, (uint32)exportParamBlock, ((ExportRecordPtr)exportParamBlock)->handleProcs, sizeof(Globals), data, InitGlobals); + + if (globalPtr == NULL) + { + *result = memFullErr; + return; + } + + // Get our "globals" variable assigned as a Global Pointer struct with the + // data we've returned: + Globals * globals = (Globals *)globalPtr; + + + //----------------------------------------------------------------------- + // (3) Dispatch selector. + //----------------------------------------------------------------------- + + switch (selector) + { + case exportSelectorPrepare: + // DoPrepare(globals); + break; + case exportSelectorStart: + // DoStart(globals); + break; + case exportSelectorContinue: + // DoContinue(globals); + break; + case exportSelectorFinish: + // DoFinish(globals); + break; + } + + // unlock handle pointing to parameter block and data so it can move + // if memory gets shuffled: + if ((Handle)*data != NULL) + { + PIUnlockHandle((Handle)*data); + } + } +} diff --git a/project/vc8/PhotoshopExporter/PhotoshopExporter.h b/project/vc8/PhotoshopExporter/PhotoshopExporter.h new file mode 100644 index 0000000..669a6fa --- /dev/null +++ b/project/vc8/PhotoshopExporter/PhotoshopExporter.h @@ -0,0 +1,27 @@ + +#ifndef NV_PHOTOSHOP_EXPORTER_H +#define NV_PHOTOSHOP_EXPORTER_H + +#include // Export Photoshop header file. +#include // SDK Utility library. + +// Photoshop crazyness: +//#define gResult (*(globals->result)) +#define gStuff (globals->exportParamBlock) + + +// This is our structure that we use to pass globals between routines: +struct Globals +{ + short * result; // Must always be first in Globals. + ExportRecord * exportParamBlock; // Must always be second in Globals. + + Boolean queryForParameters; + + // ... + +}; + + + +#endif // NV_PHOTOSHOP_EXPORTER_H diff --git a/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj b/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj new file mode 100644 index 0000000..f1f1832 --- /dev/null +++ b/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +