# HG changeset patch # User Chris Cannam # Date 1194276666 0 # Node ID 55a4719c8e7d6025ddcdc778a564c85257623d07 # Parent 0b4d563d74698d2e04cede75a5b870fbefe19672 * Introduce new Transform class which contains data necessary to describe the context for a plugin -- the plugin's name and output, the step/block size etc (formerly spread across ExecutionContext and TransformFactory). Other code hasn't been updated to use this yet. * Rename existing Transform stuff to Transformers (because they run Transforms) I'm still not 100% sure about this change, don't rely on it. diff -r 0b4d563d7469 -r 55a4719c8e7d main/MainWindow.cpp --- a/main/MainWindow.cpp Thu Nov 01 17:24:38 2007 +0000 +++ b/main/MainWindow.cpp Mon Nov 05 15:31:06 2007 +0000 @@ -60,7 +60,7 @@ #include "data/fileio/FileSource.h" #include "data/fft/FFTDataServer.h" #include "base/RecentFiles.h" -#include "plugin/transform/TransformFactory.h" +#include "plugin/transform/TransformerFactory.h" #include "base/PlayParameterRepository.h" #include "base/XmlExportable.h" #include "base/CommandHistory.h" @@ -122,10 +122,10 @@ m_existingLayersMenu(0), m_sliceMenu(0), m_recentFilesMenu(0), - m_recentTransformsMenu(0), + m_recentTransformersMenu(0), m_rightButtonMenu(0), m_rightButtonLayerMenu(0), - m_rightButtonTransformsMenu(0), + m_rightButtonTransformersMenu(0), m_rightButtonPlaybackMenu(0), m_soloAction(0), m_soloModified(false), @@ -303,11 +303,11 @@ m_rightButtonMenu->addSeparator(); } - if (m_rightButtonTransformsMenu) { - m_rightButtonTransformsMenu->clear(); + if (m_rightButtonTransformersMenu) { + m_rightButtonTransformersMenu->clear(); } else { - m_rightButtonTransformsMenu = m_rightButtonMenu->addMenu(tr("&Transform")); - m_rightButtonTransformsMenu->setTearOffEnabled(true); + m_rightButtonTransformersMenu = m_rightButtonMenu->addMenu(tr("&Transformer")); + m_rightButtonTransformersMenu->setTearOffEnabled(true); m_rightButtonMenu->addSeparator(); } @@ -320,7 +320,7 @@ setupEditMenu(); setupViewMenu(); setupPaneAndLayerMenus(); - setupTransformsMenu(); + setupTransformersMenu(); m_mainMenusCreated = true; } @@ -900,7 +900,7 @@ }; std::vector models; - if (m_document) models = m_document->getTransformInputModels(); //!!! not well named for this! + if (m_document) models = m_document->getTransformerInputModels(); //!!! not well named for this! bool plural = (models.size() > 1); if (models.empty()) { models.push_back(getMainModel()); // probably 0 @@ -1161,7 +1161,7 @@ } void -MainWindow::setupTransformsMenu() +MainWindow::setupTransformersMenu() { if (m_transformsMenu) { m_transformActions.clear(); @@ -1172,11 +1172,11 @@ m_transformsMenu->setTearOffEnabled(true); } - TransformFactory::TransformList transforms = - TransformFactory::getInstance()->getAllTransforms(); + TransformerFactory::TransformerList transforms = + TransformerFactory::getInstance()->getAllTransformers(); vector types = - TransformFactory::getInstance()->getAllTransformTypes(); + TransformerFactory::getInstance()->getAllTransformerTypes(); map > categoryMenus; map > makerMenus; @@ -1186,20 +1186,20 @@ set pendingMenus; - m_recentTransformsMenu = m_transformsMenu->addMenu(tr("&Recent Transforms")); - m_recentTransformsMenu->setTearOffEnabled(true); - m_rightButtonTransformsMenu->addMenu(m_recentTransformsMenu); - connect(&m_recentTransforms, SIGNAL(recentChanged()), - this, SLOT(setupRecentTransformsMenu())); + m_recentTransformersMenu = m_transformsMenu->addMenu(tr("&Recent Transforms")); + m_recentTransformersMenu->setTearOffEnabled(true); + m_rightButtonTransformersMenu->addMenu(m_recentTransformersMenu); + connect(&m_recentTransformers, SIGNAL(recentChanged()), + this, SLOT(setupRecentTransformersMenu())); m_transformsMenu->addSeparator(); - m_rightButtonTransformsMenu->addSeparator(); + m_rightButtonTransformersMenu->addSeparator(); for (vector::iterator i = types.begin(); i != types.end(); ++i) { if (i != types.begin()) { m_transformsMenu->addSeparator(); - m_rightButtonTransformsMenu->addSeparator(); + m_rightButtonTransformersMenu->addSeparator(); } QString byCategoryLabel = tr("%1 by Category").arg(*i); @@ -1207,11 +1207,11 @@ 20, 40); byCategoryMenu->setTearOffEnabled(true); m_transformsMenu->addMenu(byCategoryMenu); - m_rightButtonTransformsMenu->addMenu(byCategoryMenu); + m_rightButtonTransformersMenu->addMenu(byCategoryMenu); pendingMenus.insert(byCategoryMenu); vector categories = - TransformFactory::getInstance()->getTransformCategories(*i); + TransformerFactory::getInstance()->getTransformerCategories(*i); for (vector::iterator j = categories.begin(); j != categories.end(); ++j) { @@ -1252,18 +1252,18 @@ byPluginNameMenus[*i] = new SubdividingMenu(byPluginNameLabel); byPluginNameMenus[*i]->setTearOffEnabled(true); m_transformsMenu->addMenu(byPluginNameMenus[*i]); - m_rightButtonTransformsMenu->addMenu(byPluginNameMenus[*i]); + m_rightButtonTransformersMenu->addMenu(byPluginNameMenus[*i]); pendingMenus.insert(byPluginNameMenus[*i]); QString byMakerLabel = tr("%1 by Maker").arg(*i); SubdividingMenu *byMakerMenu = new SubdividingMenu(byMakerLabel, 20, 40); byMakerMenu->setTearOffEnabled(true); m_transformsMenu->addMenu(byMakerMenu); - m_rightButtonTransformsMenu->addMenu(byMakerMenu); + m_rightButtonTransformersMenu->addMenu(byMakerMenu); pendingMenus.insert(byMakerMenu); vector makers = - TransformFactory::getInstance()->getTransformMakers(*i); + TransformerFactory::getInstance()->getTransformerMakers(*i); for (vector::iterator j = makers.begin(); j != makers.end(); ++j) { @@ -1330,7 +1330,7 @@ connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); action->setStatusTip(transforms[i].description); -// cerr << "Transform: \"" << name.toStdString() << "\": plugin name \"" << pluginName.toStdString() << "\"" << endl; +// cerr << "Transformer: \"" << name.toStdString() << "\": plugin name \"" << pluginName.toStdString() << "\"" << endl; if (pluginNameMenus[type].find(pluginName) == pluginNameMenus[type].end()) { @@ -1360,7 +1360,7 @@ (*i)->entriesAdded(); } - setupRecentTransformsMenu(); + setupRecentTransformersMenu(); } void @@ -1419,15 +1419,15 @@ } void -MainWindow::setupRecentTransformsMenu() +MainWindow::setupRecentTransformersMenu() { - m_recentTransformsMenu->clear(); - vector transforms = m_recentTransforms.getRecent(); + m_recentTransformersMenu->clear(); + vector transforms = m_recentTransformers.getRecent(); for (size_t i = 0; i < transforms.size(); ++i) { - TransformActionReverseMap::iterator ti = + TransformerActionReverseMap::iterator ti = m_transformActionsReverse.find(transforms[i]); if (ti == m_transformActionsReverse.end()) { - std::cerr << "WARNING: MainWindow::setupRecentTransformsMenu: " + std::cerr << "WARNING: MainWindow::setupRecentTransformersMenu: " << "Unknown transform \"" << transforms[i].toStdString() << "\" in recent transforms list" << std::endl; continue; @@ -1435,11 +1435,11 @@ if (i == 0) { ti->second->setShortcut(tr("Ctrl+T")); m_keyReference->registerShortcut - (tr("Repeat Transform"), + (tr("Repeat Transformer"), ti->second->shortcut(), tr("Re-select the most recently run transform")); } - m_recentTransformsMenu->addAction(ti->second); + m_recentTransformersMenu->addAction(ti->second); } } @@ -2718,7 +2718,7 @@ if (suggestedModel) { // check its validity - std::vector inputModels = m_document->getTransformInputModels(); + std::vector inputModels = m_document->getTransformerInputModels(); for (size_t j = 0; j < inputModels.size(); ++j) { if (inputModels[j] == suggestedModel) { model = suggestedModel; @@ -2800,7 +2800,7 @@ return; } - TransformActionMap::iterator i = m_transformActions.find(action); + TransformerActionMap::iterator i = m_transformActions.find(action); if (i == m_transformActions.end()) { @@ -2835,8 +2835,8 @@ return; } - TransformId transform = i->second; - TransformFactory *factory = TransformFactory::getInstance(); + TransformerId transform = i->second; + TransformerFactory *factory = TransformerFactory::getInstance(); QString configurationXml; @@ -2854,10 +2854,10 @@ // supposed to be configurable, because we need to let the user // change the execution context (block size etc). - PluginTransform::ExecutionContext context(channel); + PluginTransformer::ExecutionContext context(channel); std::vector candidateInputModels = - m_document->getTransformInputModels(); + m_document->getTransformerInputModels(); size_t startFrame = 0, duration = 0; size_t endFrame = 0; @@ -2865,7 +2865,7 @@ if (endFrame > startFrame) duration = endFrame - startFrame; else startFrame = 0; - Model *inputModel = factory->getConfigurationForTransform(transform, + Model *inputModel = factory->getConfigurationForTransformer(transform, candidateInputModels, context, configurationXml, @@ -2884,7 +2884,7 @@ if (newLayer) { m_document->addLayerToView(pane, newLayer); m_document->setChannel(newLayer, context.channel); - m_recentTransforms.add(transform); + m_recentTransformers.add(transform); m_paneStack->setCurrentLayer(pane, newLayer); } @@ -3707,18 +3707,18 @@ message.getArgCount() == 1 && message.getArg(0).canConvert(QVariant::String)) { - TransformId transform = message.getArg(0).toString(); + TransformerId transform = message.getArg(0).toString(); Layer *newLayer = m_document->createDerivedLayer (transform, getMainModel(), - TransformFactory::getInstance()->getDefaultContextForTransform + TransformerFactory::getInstance()->getDefaultContextForTransformer (transform, getMainModel()), ""); if (newLayer) { m_document->addLayerToView(pane, newLayer); - m_recentTransforms.add(transform); + m_recentTransformers.add(transform); m_paneStack->setCurrentLayer(pane, newLayer); } } diff -r 0b4d563d7469 -r 55a4719c8e7d main/MainWindow.h --- a/main/MainWindow.h Thu Nov 01 17:24:38 2007 +0000 +++ b/main/MainWindow.h Mon Nov 05 15:31:06 2007 +0000 @@ -27,7 +27,7 @@ #include "base/PropertyContainer.h" #include "base/RecentFiles.h" #include "layer/LayerFactory.h" -#include "plugin/transform/Transform.h" +#include "plugin/transform/Transformer.h" #include "framework/SVFileReader.h" #include "data/fileio/FileFinder.h" #include "data/fileio/FileSource.h" @@ -127,7 +127,7 @@ virtual void paneDropAccepted(Pane *, QString); virtual void setupRecentFilesMenu(); - virtual void setupRecentTransformsMenu(); + virtual void setupRecentTransformersMenu(); virtual void playSpeedChanged(int); virtual void playSharpenToggled(); @@ -175,10 +175,10 @@ QMenu *m_existingLayersMenu; QMenu *m_sliceMenu; QMenu *m_recentFilesMenu; - QMenu *m_recentTransformsMenu; + QMenu *m_recentTransformersMenu; QMenu *m_rightButtonMenu; QMenu *m_rightButtonLayerMenu; - QMenu *m_rightButtonTransformsMenu; + QMenu *m_rightButtonTransformersMenu; QMenu *m_rightButtonPlaybackMenu; QAction *m_deleteSelectedAction; @@ -208,11 +208,11 @@ typedef std::map PaneActionMap; PaneActionMap m_paneActions; - typedef std::map TransformActionMap; - TransformActionMap m_transformActions; + typedef std::map TransformerActionMap; + TransformerActionMap m_transformActions; - typedef std::map TransformActionReverseMap; - TransformActionReverseMap m_transformActionsReverse; + typedef std::map TransformerActionReverseMap; + TransformerActionReverseMap m_transformActionsReverse; typedef std::map LayerActionMap; LayerActionMap m_layerActions; @@ -232,7 +232,7 @@ virtual void setupEditMenu(); virtual void setupViewMenu(); virtual void setupPaneAndLayerMenus(); - virtual void setupTransformsMenu(); + virtual void setupTransformersMenu(); virtual void setupHelpMenu(); virtual void setupExistingLayersMenus(); virtual void setupToolbars();