Beispiel #1
0
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
    plogf("sp: NPP_New() mode=%d ", mode);

    if (!instance)
    {
        plogf("sp: error: NPERR_INVALID_INSTANCE_ERROR");
        return NPERR_INVALID_INSTANCE_ERROR;
    }

    if (pluginType)
        plogf("sp:   pluginType: %s ", pluginType);
    if (saved)
        plogf("sp:   SavedData: len=%d", saved->len);

    instance->pdata = AllocStruct<InstanceData>();
    if (!instance->pdata)
    {
        plogf("sp: error: NPERR_OUT_OF_MEMORY_ERROR");
        return NPERR_OUT_OF_MEMORY_ERROR;
    }

    gNPNFuncs.setvalue(instance, NPPVpluginWindowBool, (void *)true);
    
    InstanceData *data = (InstanceData *)instance->pdata;
    bool ok = GetExePath(data->exepath, dimof(data->exepath));
    SelectTranslation(ok ? data->exepath : NULL);
    if (ok)
        data->message = _TR("Opening document in SumatraPDF...");
    else
        data->message = _TR("Error: SumatraPDF hasn't been found!");
    
    return NPERR_NO_ERROR;
}
Beispiel #2
0
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
    InstanceData *data;

    plogf("sp: NPP_New() mode=%d ", mode);

    if (!instance)
    {
        plogf("error: NPERR_INVALID_INSTANCE_ERROR");
        return NPERR_INVALID_INSTANCE_ERROR;
    }

    if (pluginType)
        plogf("sp:   pluginType: %s ", ScopedMem<TCHAR>(str::conv::FromAnsi(pluginType)));
    if (saved)
        plogf("sp:   SavedData: len=%d", saved->len);

    instance->pdata = calloc(1, sizeof(InstanceData));
    if (!instance->pdata)
    {
        plogf("error: NPERR_OUT_OF_MEMORY_ERROR");
        return NPERR_OUT_OF_MEMORY_ERROR;
    }

    data = (InstanceData *)instance->pdata;
    gNPNFuncs.setvalue(instance, NPPVpluginWindowBool, (void *)true);
    
    if (GetExePath(data->exepath, dimof(data->exepath)))
        data->message = _T("Opening document in SumatraPDF...");
    else
        data->message = _T("Error: SumatraPDF hasn't been found!");
    
    return NPERR_NO_ERROR;
}
Beispiel #3
0
NPError
NPN_SetValue(NPP instance, NPPVariable variable, void *value)
{
    NPError rv = NPERR_GENERIC_ERROR;
    if (NPNFuncs.setvalue) {
    rv = NPNFuncs.setvalue(instance, variable, value);
    }
    return rv;
}
Beispiel #4
0
static
NPError MyNPN_SetValue(NPP instance, NPPVariable variable,
               void *value)
{
	NPError ret;
	DEB(ef, "-> NPN_SetValue( %x, %d, 0x%x)\n", instance, variable, value);	

	ret = gNetscapeFuncs.setvalue( instance, variable, value );		
	DEB(ef, "<- NPN_SetValue = %d\n", ret);
	return ret;
}
NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
{
    NPError rv = NPERR_NO_ERROR;

    if(logger)
        logger->logCall(action_npn_set_value, (DWORD)instance, (DWORD)variable, (DWORD)value);

    rv = NPNFuncs.setvalue(instance, variable, value);

    if(logger)
        logger->logReturn();

    return rv;
}
NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
{
  return NPNFuncs.setvalue(instance, variable, value);
}