コード例 #1
0
ファイル: Settings.cpp プロジェクト: fireattack/plugins
DescriptorEnumID GetKeysAction::GetEnum()
{
	DescriptorEnumID iValue;
	OSErr iErr = m_pReadProcs->getEnumeratedProc(m_Token, &iValue);
	if(iErr)
		throw ExceptionSPErr(StringUtil::ssprintf("GetKeysAction::GetEnum(%08x)", m_CurKey), iErr);
	return iValue;
}
コード例 #2
0
//-------------------------------------------------------------------------------
//
// ReadScriptParameters
//
// See if we were called by the Photoshop scripting system and return the value
// in displayDialog if the user wants to see our dialog.
//
//-------------------------------------------------------------------------------
OSErr ReadScriptParameters(Boolean* displayDialog)
{
    OSErr err = noErr;
    PIReadDescriptor token = NULL;
    DescriptorKeyID key = 0;
    DescriptorTypeID type = 0;
    DescriptorUnitID units;
    int32 flags = 0;
    double percent;
    DescriptorEnumID disposition;
    Boolean ignoreSelection;
    DescriptorKeyIDArray array = { keyAmount, keyDisposition, 0 };

    if (displayDialog != NULL)
        *displayDialog = gData->queryForParameters;
    else
        return errMissingParameter;

    PIDescriptorParameters* descParams = gFilterRecord->descriptorParameters;
    if (descParams == NULL) return err;

    ReadDescriptorProcs* readProcs = gFilterRecord->descriptorParameters->readDescriptorProcs;
    if (readProcs == NULL) return err;

    if (descParams->descriptor != NULL)
    {
        token = readProcs->openReadDescriptorProc(descParams->descriptor, array);
        if (token != NULL)
        {
            while(readProcs->getKeyProc(token, &key, &type, &flags) && !err)
            {
                switch (key)
                {
                case keyAmount:
                    err = readProcs->getUnitFloatProc(token, &units, &percent);
                    if (!err)
                        gParams->percent = (int16)percent;
                    break;
                case keyDisposition:
                    err = readProcs->getEnumeratedProc(token, &disposition);
                    if (!err)
                    {
                        gParams->disposition = ScriptToDialog(disposition);
                        CopyColor(gData->color,
                                  gData->colorArray[gParams->disposition]);
                    }
                    break;
                case keyIgnoreSelection:
                    err = readProcs->getBooleanProc(token, &ignoreSelection);
                    if (!err)
                        gParams->ignoreSelection = ignoreSelection;
                    break;
                default:
                    err = readErr;
                    break;
                }
            }
            err = readProcs->closeReadDescriptorProc(token);
            gFilterRecord->handleProcs->disposeProc(descParams->descriptor);
            descParams->descriptor = NULL;
        }
        *displayDialog = descParams->playInfo == plugInDialogDisplay;
    }
    return err;
}