OSErr WriteScriptParams (GPtr globals) { const double rows = gLastRows, columns = gLastCols; int32 depth = gOutputDepth; PIWriteDescriptor token = NULL; OSErr stickyError = noErr; WriteDescriptorProcs *writer; PIDescriptorHandle h = NULL; #ifndef PIPutUnitFloat #define PIPutUnitFloat(token, key, unit, value) \ writer->putUnitFloatProc(token, key, unit, value) #endif #ifndef PIPutInt #define PIPutInt(token, key, value) \ writer->putIntegerProc(token, key, value) #endif if (gStuff->descriptorParameters) { writer = gStuff->descriptorParameters->writeDescriptorProcs; token = writer->openWriteDescriptorProc(); if (token) { // HostCloseWriter gStuff->descriptorParameters->writeDescriptorProcs->closeWriteDescriptorProc(token, &h); gStuff->descriptorParameters->descriptor = h; gStuff->descriptorParameters->recordInfo = plugInDialogOptional; } } return stickyError; }
//------------------------------------------------------------------------------- // // WriteScriptParamsOnWrite // // Takes our parameters from our global variables and writes them out to the // scripting system, which hands it all back to the host. // // Inputs: // void Pointer to global structure. // // Boolean gBarWrite Boolean to write to scripting system. // // Outputs: // returns an OSErr If there was a serious error. // returns noErr If everything worked fine. // //------------------------------------------------------------------------------- OSErr WriteScriptParamsOnWrite (void) { OSErr gotErr = noErr; PIDescriptorHandle h; PIDescriptorParameters * descParams = gFormatRecord->descriptorParameters; if (descParams == NULL) { return gotErr; } WriteDescriptorProcs * writeProcs = descParams->writeDescriptorProcs; if (writeProcs == NULL) { return gotErr; } PIWriteDescriptor token = writeProcs->openWriteDescriptorProc(); if (token == NULL) { return gotErr; } // writeProcs->putBooleanProc(token, keyMyBar, gData->barValueForWrite); sPSHandle->Dispose(descParams->descriptor); writeProcs->closeWriteDescriptorProc(token, &h); descParams->descriptor = h; return gotErr; }
void PutKeysAction::PutFloat(DescriptorKeyID key, float f, DescriptorUnitID units) { double ff = f; SPErr iErr = writeProcs->putUnitFloatProc(m_Token, key, units, &ff); if(iErr) throw ExceptionSPErr(StringUtil::ssprintf("PutKeysAction::PutFloat(%08x)", key), iErr); }
void DoReadFinish(FormatRecordPtr formatRecord) { PIDescriptorHandle h; PIDescriptorParameters * descParams = formatRecord->descriptorParameters; if (descParams == NULL) return; WriteDescriptorProcs * writeProcs = descParams->writeDescriptorProcs; if (writeProcs == NULL) return; PIWriteDescriptor token = writeProcs->openWriteDescriptorProc(); if (token == NULL) return; sPSHandle->Dispose(descParams->descriptor); writeProcs->closeWriteDescriptorProc(token, &h); descParams->descriptor = h; }
//------------------------------------------------------------------------------- // // WriteScriptParameters // // Write our parameters to the Photoshop scripting system in case we are being // recorded in the actions pallete. // //------------------------------------------------------------------------------- OSErr WriteScriptParameters(void) { OSErr err = noErr; PIWriteDescriptor token = NULL; PIDescriptorHandle h; const double gamma = gParams->gamma; PIDescriptorParameters* descParams = gFilterRecord->descriptorParameters; if (descParams == NULL) return err; WriteDescriptorProcs* writeProcs = gFilterRecord->descriptorParameters->writeDescriptorProcs; if (writeProcs == NULL) return err; token = writeProcs->openWriteDescriptorProc(); if (token != NULL) { writeProcs->putFloatProc(token, keyPSGamma, &gamma); if (gParams->invert) writeProcs->putBooleanProc(token, keyPSInvert, gParams->invert); gFilterRecord->handleProcs->disposeProc(descParams->descriptor); writeProcs->closeWriteDescriptorProc(token, &h); descParams->descriptor = h; descParams->recordInfo = plugInDialogOptional; } else { return errMissingParameter; } return err; }
//------------------------------------------------------------------------------- // // WriteScriptParameters // // Write our parameters to the Photoshop scripting system in case we are being // recorded in the actions pallete. // //------------------------------------------------------------------------------- OSErr WriteScriptParameters(void) { OSErr err = noErr; PIWriteDescriptor token = NULL; PIDescriptorHandle h; const double percent = gParams->percent; PIDescriptorParameters* descParams = gFilterRecord->descriptorParameters; if (descParams == NULL) return err; WriteDescriptorProcs* writeProcs = gFilterRecord->descriptorParameters->writeDescriptorProcs; if (writeProcs == NULL) return err; token = writeProcs->openWriteDescriptorProc(); if (token != NULL) { writeProcs->putUnitFloatProc(token, keyAmount, unitPercent, &percent); writeProcs->putEnumeratedProc(token, keyDisposition, typeMood, DialogToScript(gParams->disposition)); if (gParams->ignoreSelection) writeProcs->putBooleanProc(token, keyIgnoreSelection, gParams->ignoreSelection); gFilterRecord->handleProcs->disposeProc(descParams->descriptor); writeProcs->closeWriteDescriptorProc(token, &h); descParams->descriptor = h; descParams->recordInfo = plugInDialogOptional; } else { return errMissingParameter; } return err; }
void PutKeysAction::PutEnum(DescriptorKeyID key, DescriptorEnumID e, DescriptorEnumTypeID type) { SPErr iErr = writeProcs->putEnumeratedProc(m_Token, key, type, e); if(iErr) throw ExceptionSPErr(StringUtil::ssprintf("PutKeysAction::PutEnum(%08x)", key), iErr); }
void PutKeysAction::PutBoolean(DescriptorKeyID key, bool b) { SPErr iErr = writeProcs->putBooleanProc(m_Token, key, b); if(iErr) throw ExceptionSPErr(StringUtil::ssprintf("PutKeysAction::PutBoolean(%08x)", key), iErr); }
void PutKeysAction::PutInteger(DescriptorKeyID key, int i) { SPErr iErr = writeProcs->putIntegerProc(m_Token, key, i); if(iErr) throw ExceptionSPErr(StringUtil::ssprintf("PutKeysAction::PutInteger(%08x)", key), iErr); }