Example #1
0
bool
GuiAppInstance::checkAllReadersModificationDate(bool errorAndWarn)
{
    NodesList allNodes;
    SequenceTime time = getProject()->getCurrentTime();

    getProject()->getNodes_recursive(allNodes, true);
    bool changed =  false;
    for (NodesList::iterator it = allNodes.begin(); it != allNodes.end(); ++it) {
        if ( (*it)->getEffectInstance()->isReader() ) {
            KnobPtr fileKnobI = (*it)->getKnobByName(kOfxImageEffectFileParamName);
            if (!fileKnobI) {
                continue;
            }
            boost::shared_ptr<KnobGuiI> knobUi_i = fileKnobI->getKnobGuiPointer();
            KnobGuiFile* isFileKnob = dynamic_cast<KnobGuiFile*>( knobUi_i.get() );

            if (!isFileKnob) {
                continue;
            }
            changed |= isFileKnob->checkFileModificationAndWarn(time, errorAndWarn);
        }
    }

    return changed;
}
Example #2
0
void WorkspacePanel::OnNewTechnique(wxCommandEvent& event)
{
	Project* project = NULL;
	MaterialController* material = NULL;

	wxTreeItemId selId = mTreeCtrl->GetSelection();
	if(isProject(selId))
	{
		project = getProject(selId);
	}
	else if(isMaterial(selId))
	{
		wxTreeItemId projectId = mTreeCtrl->GetItemParent(selId);
		project = getProject(projectId);

		material = getMaterial(selId);
	}

	TechniqueWizard* wizard = new TechniqueWizard();
	wizard->Create(this, wxID_ANY, wxT("New Technique"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	wizard->getTechniquePage()->setProject(project);
	wizard->getTechniquePage()->setMaterial(material);
	wizard->RunWizard(wizard->getTechniquePage()); // This seems unnatural, seems there must be a better way to deal with wizards

	wizard->Destroy();

	delete wizard;
}
void MainApplication::saveProject(const BoostPath& ProjectFile)
{
    if(getProject() != NULL)
    {
        getProject()->save(ProjectFile);

        updateRecentProject(ProjectFile);
    }
}
void ProjectExporter::addCommonAudioPluginSettings()
{
    if (isLinux() && (getProject().shouldBuildVST().getValue() || getProject().shouldBuildVST3().getValue()))
        makefileExtraLinkerFlags.add ("-Wl,--no-undefined");

    if (supportsAAX() && getProject().shouldBuildAAX().getValue())
        addAAXFoldersToPath();

    // Note: RTAS paths are platform-dependent, impl -> addPlatformSpecificSettingsForProjectType
 }
Example #5
0
void MainWindow::activeWindowStatusChanged()
{
    DocumentWindow::activeWindowStatusChanged();

    if (auto* pcc = getProjectContentComponent())
        pcc->updateMissingFileStatuses();

    ProjucerApplication::getApp().openDocumentManager.reloadModifiedFiles();

    if (auto* p = getProject())
    {
        if (p->hasProjectBeenModified())
        {
            Component::SafePointer<Component> safePointer (this);

            MessageManager::callAsync ([=] ()
            {
                if (safePointer == nullptr)
                    return; // bail out if the window has been deleted

                auto result = AlertWindow::showOkCancelBox (AlertWindow::QuestionIcon,
                                                            TRANS ("The .jucer file has been modified since the last save."),
                                                            TRANS ("Do you want to keep the current project or re-load from disk?"),
                                                            TRANS ("Keep"),
                                                            TRANS ("Re-load from disk"));

                if (safePointer == nullptr)
                    return;

                if (result == 0)
                {
                    if (auto* project = getProject())
                    {
                        auto oldTemporaryDirectory = project->getTemporaryDirectory();

                        auto projectFile = project->getFile();
                        setProject (nullptr);
                        openFile (projectFile);

                        if (oldTemporaryDirectory != File())
                            if (auto* newProject = getProject())
                                newProject->setTemporaryDirectory (oldTemporaryDirectory);
                    }
                }
                else
                {
                    ProjucerApplication::getApp().getCommandManager().invokeDirectly (CommandIDs::saveProject, true);
                }
            });
        }
    }
}
Example #6
0
void UmlPackage::import(QString path)
{
    bool manual = path.isEmpty();

    if (manual)
        path = Q3FileDialog::getOpenFileName(QString::null, QString::null, 0, 0, "open xmi/xml file");

    if (! path.isEmpty()) {
        // note : QTextStream(FILE *) bugged under windows
        FILE * fp = fopen(path, "rb");

        if (fp == 0)
            UmlCom::trace("cannot open " + path);
        else {
            QString s = "import " + path + "<br>";

            UmlCom::trace(s);

            FileIn in(path, fp);

            getProject()->set_childrenVisible(FALSE);

            init();
            importHeader(in);

            UmlCom::trace(WrapperStr("<br><font face=helvetica>xmi import done<br><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(numberOf() - 1) + WrapperStr(" packages </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlUseCase::numberOf()) + WrapperStr(" use cases </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlClass::numberOf()) + WrapperStr(" classes </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlActivity::numberOf()) + WrapperStr(" activities </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlState::numberOf()) + " states </font><br>" +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlComponent::numberOf()) + WrapperStr(" components </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlArtifact::numberOf()) + WrapperStr(" artifacts </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlNode::numberOf()) + WrapperStr(" deployment nodes </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlPackage::numberOfProfile()) + WrapperStr(" profiles </font><br>") +
                          WrapperStr("<font face=helvetica> ") +
                          WrapperStr().setNum(UmlClass::numberOfStereotype()) + WrapperStr(" stereotypes </font><br><br>"));

            if (manual)
                getProject()->set_childrenVisible(TRUE);
        }
    }
}
Example #7
0
    Component* createEditor() override
    {
        if (ScopedPointer<JucerDocument> jucerDoc = JucerDocument::createForCppFile (getProject(), getFile()))
            return new JucerDocumentEditor (jucerDoc.release());

        return SourceCodeDocument::createEditor();
    }
Example #8
0
void MainWindow::activeWindowStatusChanged()
{
    DocumentWindow::activeWindowStatusChanged();

    if (ProjectContentComponent* const pcc = getProjectContentComponent())
        pcc->updateMissingFileStatuses();

    ProjucerApplication::getApp().openDocumentManager.reloadModifiedFiles();

    if (Project* p = getProject())
    {
        if (p->hasProjectBeenModified())
        {
            const int r = AlertWindow::showOkCancelBox (AlertWindow::QuestionIcon,
                                                           TRANS ("The .jucer file has been modified since the last save."),
                                                           TRANS ("Do you want to keep the current project or re-load from disk?"),
                                                           TRANS ("Keep"),
                                                           TRANS ("Re-load from disk"));

            if (r == 0)
            {
                File projectFile = p->getFile();
                setProject (nullptr);
                openFile (projectFile);
            }
            else if (r == 1)
            {
                ProjucerApplication::getApp().getCommandManager().invokeDirectly (CommandIDs::saveProject, true);
            }
        }
    }
}
Example #9
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;
}
Example #10
0
void UmlPackage::fileControl(bool ci) {
  UmlPackage * prj = getProject();
  Q3CString prjfile = prj->supportFile();
  BooL rec;
  BooL reload;
  Q3CString cmd;
  
  if (! prj->propertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd))
    cmd = "specify the command containing %file and %dir or %dironly";
  
  Dialog dialog(ci, cmd, rec, reload);	// the dialog execution set 'cmd' and 'rec'
  
  if (dialog.exec() == QDialog::Accepted) {
    // save the command for a future usage
    prj->set_PropertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd);
    
    if (reload)
      saveProject();
    
    // get files list
    Q3Dict<void> files;
  
    getFiles(files, (rec) ? ~0u : 1);
    if (this == prj)
      getAuxFiles(files);
  
    // apply the command on each file
    Q3DictIterator<void> it(files);
    QFileInfo prjpath(prjfile);
    QString dir = prjpath.dirPath(TRUE);
    QString dironly = dir;
    int index;
    
    if ((dironly.length() > 3) &&
        (((const char *) dironly)[1] == ':') &&
        (((const char *) dironly)[2] == '/'))
      dironly = dironly.mid(2);
  
    while ((index = cmd.find("%dironly")) != -1)
      cmd.replace(index, 8, dironly);
    
    while ((index = cmd.find("%dir")) != -1)
      cmd.replace(index, 4, dir);
      
    while (it.current()) {
      QString s = cmd;
  
      while ((index = s.find("%file")) != -1)
        s.replace(index, 5, it.currentKey());
      
      system((const char *) s);
      ++it;
    }
    
    UmlCom::trace("Done.");
  
    if (reload)
      loadProject(prjfile);
  }
}
Example #11
0
void
GuiAppInstance::declareCurrentAppVariable_Python()
{
#ifdef NATRON_RUN_WITHOUT_PYTHON

    return;
#endif
    std::string appIDStr = getAppIDString();
    /// define the app variable
    std::stringstream ss;

    ss << appIDStr << " = " << NATRON_GUI_PYTHON_MODULE_NAME << ".natron.getGuiInstance(" << getAppID() << ") \n";
    const KnobsVec& knobs = getProject()->getKnobs();
    for (KnobsVec::const_iterator it = knobs.begin(); it != knobs.end(); ++it) {
        ss << appIDStr << "." << (*it)->getName() << " = "  << appIDStr  << ".getProjectParam('" <<
        (*it)->getName() << "')\n";
    }

    std::string script = ss.str();
    std::string err;
    _imp->declareAppAndParamsString = script;
    bool ok = NATRON_PYTHON_NAMESPACE::interpretPythonScript(script, &err, 0);
    if (!ok) {
        throw std::runtime_error("GuiAppInstance::declareCurrentAppVariable_Python() failed!");
    }
}
Example #12
0
void WorkspacePanel::OnAddMaterial(wxCommandEvent& event)
{
	wxFileDialog * openDialog = new wxFileDialog(this, wxT("Add a Material"), wxEmptyString, wxEmptyString,
		wxT("Material Files (*.material)|*.material|All Files (*.*)|*.*"));

	if(openDialog->ShowModal() == wxID_OK)
	{
		wxString path = openDialog->GetPath();
		if(path.EndsWith(wxT(".material")))
		{
			wxTreeItemId selId = mTreeCtrl->GetSelection();
			if(isProject(selId))
			{
				Project* project = getProject(selId);

				MaterialScriptEditor* editor = new MaterialScriptEditor(EditorManager::getSingletonPtr()->getEditorNotebook());
				editor->loadFile(path);
				int index = (int)path.find_last_of('\\');
				if(index == -1) index = (int)path.find_last_of('/');
				editor->setName((index != -1) ? path.substr(index + 1, path.Length()) : path);

				EditorManager::getSingletonPtr()->openEditor(editor);

				Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName("Ogre/Earring");
				project->addMaterial(mat);
			}
		}
	}
}
Example #13
0
WrapperStr UmlPackage::rootDir(aLanguage who)
{
    if (! RootDirRead) {
        RootDirRead = TRUE;

        switch (who) {
        case cppLanguage:
            RootDir = CppSettings::rootDir();
            break;

        case javaLanguage:
            RootDir = JavaSettings::rootDir();
            break;

        case phpLanguage:
            RootDir = PhpSettings::rootDir();
            break;

        default:
            RootDir = PythonSettings::rootDir();
        }

        if (!RootDir.isEmpty() && // empty -> error
            QDir::isRelativePath(RootDir)) {
            QFileInfo f(getProject()->supportFile());
            QDir d(f.path());

            RootDir = d.filePath(RootDir);
        }
    }

    return RootDir;
}
Example #14
0
bool
GuiAppInstance::findAndTryLoadUntitledAutoSave()
{
    if ( !appPTR->getCurrentSettings()->isAutoSaveEnabledForUnsavedProjects() ) {
        return false;
    }

    QDir savesDir( Project::autoSavesDir() );
    QStringList entries = savesDir.entryList(QDir::Files | QDir::NoDotAndDotDot);
    QStringList foundAutosaves;
    for (int i = 0; i < entries.size(); ++i) {
        const QString & entry = entries.at(i);
        QString searchStr( QLatin1Char('.') );
        searchStr.append( QString::fromUtf8(NATRON_PROJECT_FILE_EXT) );
        searchStr.append( QString::fromUtf8(".autosave") );
        int suffixPos = entry.indexOf(searchStr);
        if ( (suffixPos == -1) || entry.contains( QString::fromUtf8("RENDER_SAVE") ) ) {
            continue;
        }

        foundAutosaves << entry;
    }
    if ( foundAutosaves.empty() ) {
        return false;
    }

    QString text = tr("An auto-saved project was found with no associated project file.\n"
                      "Would you like to restore it? Clicking No will remove this auto-save.");


    appPTR->hideSplashScreen();

    StandardButtonEnum ret = Dialogs::questionDialog(tr("Auto-save").toStdString(),
                                                     text.toStdString(), false, StandardButtons(eStandardButtonYes | eStandardButtonNo),
                                                     eStandardButtonYes);
    if ( (ret == eStandardButtonNo) || (ret == eStandardButtonEscape) ) {
        Project::clearAutoSavesDir();

        return false;
    }

    for (int i = 0; i < foundAutosaves.size(); ++i) {
        const QString& autoSaveFileName = foundAutosaves[i];
        if (i == 0) {
            //Load the first one into the current instance of Natron, then open-up new instances
            if ( !getProject()->loadProject(savesDir.path() + QLatin1Char('/'), autoSaveFileName, true) ) {
                return false;
            }
        } else {
            CLArgs cl;
            AppInstance* newApp = appPTR->newAppInstance(cl, false);
            if ( !newApp->getProject()->loadProject(savesDir.path() + QLatin1Char('/'), autoSaveFileName, true) ) {
                return false;
            }
        }
    }

    return true;
} // findAndTryLoadAutoSave
void CLangModelsDoc::OnCloseDocument()
{
	CFrameWnd* pF = getFrame();
	if(!theApp.getProject(TRUE) || !pF ||
		getProject()->getIsClosing())
		CTabbedTreeDoc::OnCloseDocument();
	else
		pF->ShowWindow(SW_MINIMIZE);
}
Example #16
0
    Component* createEditor() override
    {
        std::unique_ptr<JucerDocument> jucerDoc (JucerDocument::createForCppFile (getProject(), getFile()));

        if (jucerDoc != nullptr)
            return new JucerDocumentEditor (jucerDoc.release());

        return SourceCodeDocument::createEditor();
    }
void ProjectContentComponent::cleanAll()
{
    lastCrashMessage = String();

    if (childProcess != nullptr)
        childProcess->cleanAll();
    else if (Project* p = getProject())
        CompileEngineChildProcess::cleanAllCachedFilesForProject (*p);
}
Example #18
0
int ProjectManager::getIdFromSgProject(SgProject * sgProj)
{
    for(int i=0; i < getProjectCount(); i++)
    {
        if(getProject(i)->getSgProject() == sgProj)
            return i;
    }
    qDebug() << "Warning: ProjectManager::getIdFromProject";
    qDebug() << "Tried to get a projectId with an unknown sgProject";
    return -1;
}
Example #19
0
void ProjectsTree::p_task()
{
    QAction *action = qobject_cast<QAction *>(sender());

    if (action) {
	int projId =  qVariantValue<int>(action->data());
	Project *projItem = getProject(projId);
	addTaskW->setParentProject(*projItem);
	addTaskW->show();
    }
}
Example #20
0
Q3CString UmlPackage::path(const Q3CString & f) {
  if (!read) {
    dir = idlDir();
    
    if (! RootDirRead) {
      RootDirRead = TRUE;
      RootDir = IdlSettings::rootDir();

      if (!RootDir.isEmpty() && // empty -> error
	  QDir::isRelativePath(RootDir)) {
	QFileInfo f(getProject()->supportFile());
	QDir d(f.dirPath());

	RootDir = d.filePath(RootDir);
      }
    }

    QDir d_root(RootDir);
    
    if (dir.isEmpty())
      dir = RootDir;
    else if (QDir::isRelativePath(dir))
      dir = d_root.filePath(dir);

    if (dir.isEmpty()) {
      UmlCom::trace(Q3CString("<font color=\"red\"><b><b> The generation directory "
			    "must be specified for the package<i> ") + name()
			    + "</i>, edit the <i> generation settings</i> (tab 'directory') "
			    "or edit the package (tab 'Idl')</b></font><br>");
      UmlCom::bye(n_errors() + 1);
      UmlCom::fatal_error("UmlPackage::file_path");
    }
    
    if (QDir::isRelativePath(dir)) {
      UmlCom::trace(Q3CString("<font color=\"red\"><b><i>")
		    + name() + "</i>'s source path <i>(" + dir
		    + "</i>) is not absolute, edit the <i> generation settings</i> "
		    "(tab 'directory'), or edit the package (tab 'Idl')</b></font><br>");
      UmlCom::bye(n_errors() + 1);
      UmlCom::fatal_error("UmlPackage::file_path");
    }

    read = TRUE;
  }
  
  QDir d(dir);
  
  if (! d.exists())
    create_directory(dir);	// don't return on error
  
  return Q3CString(d.filePath(f).toAscii().constData()) + Q3CString(".") + 
    IdlSettings::sourceExtension();
}
Example #21
0
void WorkspacePanel::OnSelectionChanged(wxTreeEvent& event)
{
	SelectionList list;
	wxTreeItemId id = event.GetItem();
	if(isProject(id)) list.push_back(getProject(id));
	else if(isMaterial(id)) list.push_back(getMaterial(id));
	else if(isTechnique(id)) list.push_back(getTechnique(id));
	else if(isPass(id)) list.push_back(getPass(id));
	// else its the workspace so just leave the list empty as if nothing were selected

	SelectionService::getSingletonPtr()->setSelection(list);
}
Example #22
0
void WorkspacePanel::OnNewPass(wxCommandEvent& event)
{
	Project* project = NULL;
	MaterialController* material = NULL;
	TechniqueController* technique = NULL;

	wxTreeItemId selId = mTreeCtrl->GetSelection();
	if(isProject(selId))
	{
		project = getProject(selId);
	}
	else if(isMaterial(selId))
	{
		wxTreeItemId projectId = mTreeCtrl->GetItemParent(selId);
		project = getProject(projectId);

		material = getMaterial(selId);
	}
	else if(isTechnique(selId))
	{
		wxTreeItemId materialId = mTreeCtrl->GetItemParent(selId);
		material = getMaterial(materialId);

		wxTreeItemId projectId = mTreeCtrl->GetItemParent(materialId);
		project = getProject(projectId);
	
		technique = getTechnique(selId);
	}

	PassWizard* wizard = new PassWizard();
	wizard->Create(this, wxID_ANY, wxT("New Pass"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	wizard->getPassPage()->setProject(project);
	wizard->getPassPage()->setMaterial(material);
	wizard->getPassPage()->setTechnique(technique);
	wizard->RunWizard(wizard->getPassPage());

	wizard->Destroy();

	delete wizard;
}
Example #23
0
void WorkspacePanel::OnNewMaterial(wxCommandEvent& event)
{
	wxTreeItemId id = mTreeCtrl->GetSelection();

	MaterialWizard* wizard = new MaterialWizard();
	wizard->Create(this, wxID_ANY, wxT("New Project"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	wizard->getMaterialPage()->setProject(getProject(id));
	wizard->RunWizard(wizard->getMaterialPage()); // This seems unnatural, seems there must be a better way to deal with wizards

	wizard->Destroy();

	delete wizard;
}
CLangModelsDoc::~CLangModelsDoc()
{
	// the following is actually to avoid a bug which happens when you cancel in the middle
	// of the carlamenu wizard.  The project wouldn't know that this was deleted
	getProject()->removeLangDoc(this);

	if(m_pLang)
		delete m_pLang;
	if(m_pFunctionalInterface)
		delete m_pFunctionalInterface;
	if(m_pCarlaMenuInterface)
		delete m_pCarlaMenuInterface;
}
Example #25
0
UmlPackage * UmlPackage::importProfile(FileIn & in, WrapperStr href)
{
    if (!href.isEmpty() && (href.left(5) != "http:") && (href.left(8) != "pathmap:")) {
        int index = href.find('#');

        if (index != -1) {
            WrapperStr id = href.mid(index + 1);
            QMap<WrapperStr, UmlItem *>::Iterator it = All.find(id);

            if (it == All.end()) {
                UmlPackage * pf = getProject()->findProfile(id);

                if (pf == 0) {
                    QFileInfo fi(in.path());
                    QDir d(fi.dir(TRUE));
                    QString fn = d.absFilePath(href.left(index));

                    if (QFile::exists(fn)) {
                        WrapperStr cmd = qApp->argv()[0] + WrapperStr(" ") + WrapperStr((const char *)fn); //[rageek] ambiguous, cast
                        int pid = UmlCom::targetItem()->apply(cmd);

                        while (isToolRunning(pid)) {
#ifdef WIN32
                            Sleep(1000);
#else
                            sleep(1);
#endif
                        }

                        UmlCom::targetItem()->unload(FALSE, FALSE); // to reread children

                        if ((pf = ((UmlPackage *) UmlCom::targetItem())->findProfile(id)) != 0)
                            // not in Bouml case
                            pf->loadFromProfile();
                    }
                    else
                        in.warning("can't open " + href.left(index));
                }
                else
                    // not in Bouml case
                    pf->loadFromProfile();

                return pf;
            }
            else if ((*it)->kind() == aPackage)
                return (UmlPackage *) *it;
        }
    }

    return 0;
}
Example #26
0
void
GuiAppInstance::goToNextKeyframe()
{
    ///runs only in the main thread
    assert( QThread::currentThread() == qApp->thread() );

    _imp->timelineKeyframes.sort();
    boost::shared_ptr<TimeLine> timeline = getProject()->getTimeLine();
    SequenceTime currentFrame = timeline->currentFrame();
    std::list<SequenceTime>::iterator upperBound = std::upper_bound(_imp->timelineKeyframes.begin(), _imp->timelineKeyframes.end(), currentFrame);
    if ( upperBound != _imp->timelineKeyframes.end() ) {
        timeline->seekFrame(*upperBound, true, NULL, eTimelineChangeReasonPlaybackSeek);
    }
}
Example #27
0
bool
GuiAppInstance::save(const std::string& filename)
{
    if ( filename.empty() ) {
        boost::shared_ptr<Project> project = getProject();
        if ( project->hasProjectBeenSavedByUser() ) {
            return _imp->_gui->saveProject();
        } else {
            return _imp->_gui->saveProjectAs();
        }
    } else {
        return _imp->_gui->saveProjectAs(filename);
    }
}
Example #28
0
void
GuiAppInstance::goToPreviousKeyframe()
{
    ///runs only in the main thread
    assert( QThread::currentThread() == qApp->thread() );

    _imp->timelineKeyframes.sort();
    TimeLinePtr timeline = getProject()->getTimeLine();
    SequenceTime currentFrame = timeline->currentFrame();
    std::list<SequenceTime>::iterator lowerBound = std::lower_bound(_imp->timelineKeyframes.begin(), _imp->timelineKeyframes.end(), currentFrame);
    if ( lowerBound != _imp->timelineKeyframes.begin() ) {
        --lowerBound;
        timeline->seekFrame(*lowerBound, true, OutputEffectInstancePtr(), eTimelineChangeReasonPlaybackSeek);
    }
}
Example #29
0
void BI_StrokeText::init() {
  mText->registerObserver(*this);
  mText->setAttributeProvider(&mBoard);
  mText->setFont(&getProject().getStrokeFonts().getFont(
      mBoard.getDefaultFontName()));  // can throw

  mGraphicsItem.reset(
      new StrokeTextGraphicsItem(*mText, mBoard.getLayerStack()));
  mAnchorGraphicsItem.reset(new LineGraphicsItem());
  updateGraphicsItems();

  // connect to the "attributes changed" signal of the board
  connect(&mBoard, &Board::attributesChanged, this,
          &BI_StrokeText::boardAttributesChanged);
}
Example #30
0
const Drawable* Project::Item::getIcon() const
{
    if (isFile())
    {
        if (isImageFile())
            return StoredSettings::getInstance()->getImageFileIcon();

        return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage();
    }
    else if (isMainGroup())
    {
        return &(getProject().mainProjectIcon);
    }

    return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage();
}