예제 #1
0
bool MainWindow::openFile (const File& file)
{
    createProjectContentCompIfNeeded();

    if (file.hasFileExtension (Project::projectFileExtension))
    {
        ScopedPointer<Project> newDoc (new Project (file));

        Result result (newDoc->loadFrom (file, true));

        if (result.wasOk() && closeCurrentProject())
        {
            setProject (newDoc);
            newDoc.release()->setChangedFlag (false);

            jassert (getProjectContentComponent() != nullptr);
            getProjectContentComponent()->reloadLastOpenDocuments();

            if (Project* p = getProject())
                p->updateDeprecatedProjectSettingsInteractively();

            return true;
        }
    }
    else if (file.exists())
    {
        return getProjectContentComponent()->showEditorForFile (file, true);
    }

    return false;
}
예제 #2
0
bool SAMApplication::openFile(const File& file)
{
    for (int j = mainWindows.size(); --j >= 0;)
    {
        if (mainWindows.getUnchecked(j)->getMDLFile() != nullptr
             && mainWindows.getUnchecked(j)->getMDLFile()->getFile() == file)
        {
            mainWindows.getUnchecked(j)->toFront (true);
            return true;
        }
    }
    if (file.hasFileExtension (MDLFile::mdlFileExtension))
    {
        ScopedPointer <MDLFile> newMDL (new MDLFile());

        if (newMDL->loadFrom (file, true))
        {
            MainAppWindow* w = getOrCreateEmptyWindow();
            w->setMDLFile(newMDL.release());
            w->makeVisible();
            avoidSuperimposedWindows (w);
            addToFileList(w->getMDLFile()->getFile());
            w->updateTitle();
            return true;
        }
    }
    else if (file.exists())
    {
    	Alerts::wrongFileType();
    }
    return false;
}
예제 #3
0
bool MainWindow::openFile (const File& file)
{
    if (file.hasFileExtension (Project::projectFileExtension))
    {
        ScopedPointer <Project> newDoc (new Project (file));

        if (newDoc->loadFrom (file, true)
             && closeCurrentProject())
        {
            setProject (newDoc.release());
            return true;
        }
    }
    else if (file.exists())
    {
        return getProjectContentComponent()->showEditorForFile (file);
    }

    return false;
}
bool MainWindowList::openFile (const File& file)
{
    for (int i = windows.size(); --i >= 0;)
    {
        MainWindow* const w = windows.getUnchecked(i);

        if (w->getProject() != nullptr && w->getProject()->getFile() == file)
        {
            w->toFront (true);
            return true;
        }
    }

    if (file.hasFileExtension (Project::projectFileExtension))
    {
        ScopedPointer<Project> newDoc (new Project (file));

        if (newDoc->loadFrom (file, true))
        {
            MainWindow* const w = getOrCreateEmptyWindow();
            w->setProject (newDoc);

            newDoc.release()->setChangedFlag (false);

            w->makeVisible();
            avoidSuperimposedWindows (w);

            jassert (w->getProjectContentComponent() != nullptr);
            w->getProjectContentComponent()->reloadLastOpenDocuments();

            return true;
        }
    }
    else if (file.exists())
    {
        MainWindow* const w = getOrCreateFrontmostWindow();
        return w->openFile (file);
    }

    return false;
}