Beispiel #1
0
    /**
     * Instantiate StApplication.
     */
    ST_LOCAL virtual void createApplication() override {
        StMutexAuto aLock(myFetchLock);
        const StString aFileExtension = StFileNode::getExtension(myCreatePath);

        StHandle<StOpenInfo> anInfo = new StOpenInfo();
        anInfo->setPath(myDndPath);
        myDndPath.clear();

        StHandle<StResourceManager> aResMgr = new StResourceManager(myActivity->assetManager);
        //StHandle<StResourceManager> aResMgr = new StResourceManager(myActivity->assetManager"com.sview.cad");
        aResMgr->setFolder(StResourceManager::FolderId_SdCard,
                           getStoragePath(myThJniEnv, "sdcard"));
        aResMgr->setFolder(StResourceManager::FolderId_Downloads,
                           getStoragePath(myThJniEnv, "Download"));
        aResMgr->setFolder(StResourceManager::FolderId_Pictures,
                           getStoragePath(myThJniEnv, "Pictures"));
        aResMgr->setFolder(StResourceManager::FolderId_Photos,
                           getStoragePath(myThJniEnv, "DCIM"));

        StString anOcctResFolder = aResMgr->getUserDataFolder();
        copyResource(aResMgr, "lang", anOcctResFolder, "IGES.us");
        copyResource(aResMgr, "lang", anOcctResFolder, "IGES.fr");
        copyResource(aResMgr, "lang", anOcctResFolder, "SHAPE.us");
        copyResource(aResMgr, "lang", anOcctResFolder, "SHAPE.fr");
        copyResource(aResMgr, "lang", anOcctResFolder, "XSTEP.us");
        copyResource(aResMgr, "lang", anOcctResFolder, "XSTEP.fr");
        copyResource(aResMgr, "lang", anOcctResFolder, "TObj.msg");

        copyResource(aResMgr, "res",  anOcctResFolder, "Units.dat");
        copyResource(aResMgr, "res",  anOcctResFolder, "Lexi_Expr.dat");
        copyResource(aResMgr, "res",  anOcctResFolder, "IGES");
        copyResource(aResMgr, "res",  anOcctResFolder, "STEP");
        //copyResource(aResMgr, "res",  anOcctResFolder, "TObj");
        //copyResource(aResMgr, "res",  anOcctResFolder, "XCAF");
        //copyResource(aResMgr, "res",  anOcctResFolder, "Plugin");
        //copyResource(aResMgr, "res",  anOcctResFolder, "Standard");
        //copyResource(aResMgr, "res",  anOcctResFolder, "StandardLite");

        copyResource(aResMgr, "shaders/occt", anOcctResFolder, "Declarations.glsl");
        copyResource(aResMgr, "shaders/occt", anOcctResFolder, "DeclarationsImpl.glsl");

        StProcess::setEnv("CSF_UnitsLexicon",     anOcctResFolder + "/Lexi_Expr.dat");
        StProcess::setEnv("CSF_UnitsDefinition",  anOcctResFolder + "/Units.dat");
        StProcess::setEnv("CSF_ShadersDirectory", anOcctResFolder);
        StProcess::setEnv("CSF_SHMessage",        anOcctResFolder);

        if(myStAppClass.isEmpty()) {
            myStAppClass = "cad";
        }

        if(anInfo->isEmpty()) {
            // open recent file by default
            StArgumentsMap anArgs = anInfo->getArgumentsMap();
            anArgs.set(StDictEntry("last", "true"));
            anArgs.set(StDictEntry("toSaveRecent","true"));
            anInfo->setArgumentsMap(anArgs);
        }

        myApp = new StCADViewer(aResMgr, this, anInfo);
    }
Beispiel #2
0
void StCADViewerGUI::doOpenFile(const size_t ) {
    StGLOpenFile* aDialog = new StGLOpenFile(this, tr(DIALOG_OPEN_FILE), tr(BUTTON_CLOSE));
    aDialog->setMimeList(StCADLoader::ST_CAD_MIME_LIST);
#if defined(_WIN32)
    //
#else
    aDialog->addHotItem("/", "Root");
#endif
    aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_SdCard));
    aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Downloads));
    aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Pictures));
    aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Photos));
    aDialog->signals.onFileSelected = stSlot(myPlugin, &StCADViewer::doOpen1FileFromGui);

    if(myPlugin->params.LastFolder.isEmpty()) {
        StHandle<StFileNode> aCurrFile = myPlugin->myPlayList->getCurrentFile();
        if(!aCurrFile.isNull()) {
            myPlugin->params.LastFolder = aCurrFile->isEmpty() ? aCurrFile->getFolderPath() : aCurrFile->getValue(0)->getFolderPath();
        }
    }
    aDialog->openFolder(myPlugin->params.LastFolder);
    setModalDialog(aDialog);
}