Пример #1
0
void StApplication::stApplicationInit(const StHandle<StOpenInfo>& theOpenInfo) {
    if(myResMgr.isNull()) {
        myResMgr = new StResourceManager();
    }
#ifdef ST_DEBUG_GL
    myGlDebug = true;
#endif
    StSettings aGlobalSettings(myResMgr, "sview");
    params.ActiveDevice = new StEnumParam(0, "Change device");
    params.ActiveDevice->signals.onChanged.connect(this, &StApplication::doChangeDevice);

    params.VSyncMode = new StEnumParam(0, "VSync mode");
    params.VSyncMode->changeValues().add("Off");
    params.VSyncMode->changeValues().add("On");
    params.VSyncMode->changeValues().add("Mixed");

    bool isOutModeAuto = true; // AUTO by default
    aGlobalSettings.loadBool(ST_SETTING_RENDERER_AUTO, isOutModeAuto);
    if(!isOutModeAuto) {
        aGlobalSettings.loadString(ST_SETTING_RENDERER, myRendId);
    }

    // add additional paths
#ifdef _WIN32
    // requires Windows XP with SP1 or higher
    StStringUtfWide aStCoreFolder = StProcess::getStCoreFolder().toUtfWide();
    SetDllDirectoryW(aStCoreFolder.toCString());
#endif
    myOpenFileInfo = theOpenInfo;
    if(myOpenFileInfo.isNull()) {
        myOpenFileInfo = parseProcessArguments();
    }
    if(myOpenFileInfo.isNull()) {
        myOpenFileInfo = new StOpenInfo();
    }

    const StArgumentsMap anArgs = myOpenFileInfo->getArgumentsMap();
    const StString ARGUMENT_PLUGIN_OUT        = "out";
    const StString ARGUMENT_PLUGIN_OUT_DEVICE = "outDevice";
    const StString ARGUMENT_GLDEBUG           = "gldebug";
    StArgument anArgRenderer = anArgs[ARGUMENT_PLUGIN_OUT];
    StArgument anArgDevice   = anArgs[ARGUMENT_PLUGIN_OUT_DEVICE];
    StArgument anArgGlDebug  = anArgs[ARGUMENT_GLDEBUG];
    if(anArgRenderer.isValid()) {
        myRendId = anArgRenderer.getValue();
    }
    //if(anArgDevice.isValid()) {
    //    aDevice = anArgDevice.getValue();
    //}
    if(anArgGlDebug.isValid()) {
        myGlDebug = true;
    }
}
Пример #2
0
int StActiveXCtrl::OnCreate(LPCREATESTRUCT theCreateStruct) {
    myBackBrush.CreateSolidBrush(RGB(0, 0, 0));
    if(COleControl::OnCreate(theCreateStruct) == -1) {
        return -1;
    }

    const StString ST_ASTERIX = '*';
    StMIME aMime(StString(myMimeType), ST_ASTERIX, ST_ASTERIX);
    myOpenInfo.setMIME(aMime);

    StArgumentsMap aDrawerArgs;
    const StString ST_SETTING_SRCFORMAT    = stCString("srcFormat");
    const StString ST_SETTING_COMPRESS     = stCString("toCompress");
    const StString ST_SETTING_ESCAPENOQUIT = stCString("escNoQuit");
    const StMIME ST_MIME_X_JPS("image/x-jps", ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_JPS  ("image/jps",   ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_X_PNS("image/x-pns", ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_PNS  ("image/pns",   ST_ASTERIX, ST_ASTERIX);
    StArgument anArgSrcFormat = aDrawerArgs[ST_SETTING_SRCFORMAT];
    if(!anArgSrcFormat.isValid()) {
        anArgSrcFormat.setKey(ST_SETTING_SRCFORMAT);
        if(aMime == ST_MIME_X_JPS
        || aMime == ST_MIME_JPS
        || aMime == ST_MIME_X_PNS
        || aMime == ST_MIME_PNS) {
            anArgSrcFormat.setValue(st::formatToString(StFormat_SideBySide_RL));
            aDrawerArgs.add(anArgSrcFormat);
        }
    }
    aDrawerArgs.add(StArgument(ST_SETTING_COMPRESS,     "true")); // optimize memory usage
    aDrawerArgs.add(StArgument(ST_SETTING_ESCAPENOQUIT, "true")); // do not close plugin instance by Escape key
    myOpenInfo.setArgumentsMap(aDrawerArgs);

    // set window
    myParentWin = m_hWnd;

    // starts out plugin main loop in another thread
    myThread = new StThread(stThreadFunction, (void* )this, "StActiveXCtrl");

    // load URL
    StString aFilePath = loadURL(myHasPreview ? myUrlPreview : myUrlFull);
    if(aFilePath.isEmpty()) {
        if(!myHasPreview) {
            return 0;
        }
        if(myHasPreview) {
            // if we have 2 URLs - try to load another one
            aFilePath = loadURL(myUrlFull);
            if(aFilePath.isEmpty()) {
                return 0;
            }
            myHasPreview = false;
        }
    }

    myOpenInfo.setPath(aFilePath);
    myOpenEvent.set();
    return 0;
}
Пример #3
0
StBrowserPlugin::StBrowserPlugin(NSPluginCreateData* theCreateDataStruct)
    : nppInstance(theCreateDataStruct->instance),
      myResMgr(new StResourceManager()),
      myParentWin((StNativeWin_t )NULL),
#ifdef _WIN32
      myProcOrig(NULL),
      myBackBrush(CreateSolidBrush(RGB(0, 0, 0))),
#endif
      myToLoadFull(false),
      myIsActive(false),
      myToQuit(false) {
    if(ST_PLUGIN_INSTANCES.increment() == 1) {
        StSearchMonitors aMonitors;
        aMonitors.init(true); // force update of cached state
    }

    StArgumentsMap aDrawerArgs;
    for(int aParamId = 0; aParamId < theCreateDataStruct->argc; ++aParamId) {
        StString aParamName  = StString(theCreateDataStruct->argn[aParamId]);
        StString aParamValue = StString(theCreateDataStruct->argv[aParamId]);

        StArgument stArg(aParamName, aParamValue);
        aDrawerArgs.add(stArg);

        if(aParamName.isEqualsIgnoreCase(stCString("data-prv-url"))) {
            myPreviewUrl = aParamValue;
            myPreviewUrlUtf8.fromUrl(aParamValue);
        }
    }
    const StString ST_ASTERIX = '*';
    StMIME stMIME(StString(theCreateDataStruct->type), ST_ASTERIX, ST_ASTERIX);
    myOpenInfo.setMIME(stMIME);

    const StString ST_SETTING_SRCFORMAT    = stCString("srcFormat");
    const StString ST_SETTING_COMPRESS     = stCString("toCompress");
    const StString ST_SETTING_ESCAPENOQUIT = stCString("escNoQuit");
    const StMIME ST_MIME_X_JPS("image/x-jps", ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_JPS  ("image/jps",   ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_X_PNS("image/x-pns", ST_ASTERIX, ST_ASTERIX);
    const StMIME ST_MIME_PNS  ("image/pns",   ST_ASTERIX, ST_ASTERIX);
    StArgument anArgSrcFormat = aDrawerArgs[ST_SETTING_SRCFORMAT];
    if(!anArgSrcFormat.isValid()) {
        anArgSrcFormat.setKey(ST_SETTING_SRCFORMAT);
        if(stMIME == ST_MIME_X_JPS
                || stMIME == ST_MIME_JPS
                || stMIME == ST_MIME_X_PNS
                || stMIME == ST_MIME_PNS) {
            anArgSrcFormat.setValue(st::formatToString(StFormat_SideBySide_RL));
            aDrawerArgs.add(anArgSrcFormat);
        }
    }
    aDrawerArgs.add(StArgument(ST_SETTING_COMPRESS,     "true")); // optimize memory usage
    aDrawerArgs.add(StArgument(ST_SETTING_ESCAPENOQUIT, "true")); // do not close plugin instance by Escape key
    myOpenInfo.setArgumentsMap(aDrawerArgs);
}
Пример #4
0
void StPlayList::loadRecentList(const StString theString) {
    StMutexAuto anAutoLock(myMutex);
    StArgumentsMap aMap;
    aMap.parseString(theString);
    myRecent.clear();

    for(size_t anIter = 0; anIter < myRecentLimit; ++anIter) {
        const StArgument anArgFile  = aMap[StString("file")  + anIter];
        const StArgument anArgLeft  = aMap[StString("left")  + anIter];
        const StArgument anArgRight = aMap[StString("right") + anIter];
        const StArgument anArgTime  = aMap[StString("time")  + anIter];
        StHandle<StRecentItem> aRecent;
        if(anArgLeft.isValid() && anArgRight.isValid()) {
            StHandle<StFileNode> aFileNode = new StFileNode(StString());
            aFileNode->add(new StFileNode(anArgLeft.getValue(),  aFileNode.access()));
            aFileNode->add(new StFileNode(anArgRight.getValue(), aFileNode.access()));
            aRecent = addRecentFile(*aFileNode, false);
        } else if(anArgFile.isValid()) {
            StHandle<StFileNode> aFileNode = new StFileNode(anArgFile.getValue());
            const StArgument anArgPos = aMap[StString("pos") + anIter];
            if(anArgPos.isValid()) {
                aFileNode->add(new StFileNode(anArgPos.getValue(), aFileNode.access()));
            }
            aRecent = addRecentFile(*aFileNode, false);
        }
        if(aRecent.isNull()) {
            continue;
        }

        if(anArgTime.isValid()) {
            if(aRecent->Params.isNull()) {
                aRecent->Params = new StStereoParams();
            }
            std::stringstream aStream;
            aStream.imbue(std::locale("C"));
            aStream << anArgTime.getValue().toCString();
            aStream >> aRecent->Params->Timestamp;
        }
    }
}