Ejemplo n.º 1
0
void FaustgenFactory::generateSVG()
{
  // To be sure we get a correct SVG diagram...
  removeSVG();
 
  // Prepare compile options
  std::string error;
  const char* argv[64];
  memset(argv, 0, 64 * sizeof(char*));
  
  jassert(fCompileOptions.size() < 64);
  
  auto opt = 0;
  
  for (opt = 0; opt < fCompileOptions.size(); opt++)
  {
    argv[opt] = (char*) fCompileOptions.getReference(opt).toRawUTF8();
  }
  
  argv[opt++] = "-svg";
  argv[opt++] = "-sn";
  argv[opt++] = "-sd";

  if (fDrawPath != File::nonexistent)
  {
    // Generate SVG file
    if (!generateAuxFilesFromString(getTMPName().toStdString(), fSourceCode.toStdString(), fCompileOptions.size() + 3, argv, error))
    {
      //TODO: if there is an error here STOP
      LOG("Generate SVG error : " + error);
    }

    File svgFile = getSVGFile();

    if (svgFile.exists())
    {
    #if 0
      File htmlFile(fDrawPath.getFullPathName() + "/" + getSVGFolderName() + "/index.html");
      htmlFile.appendText(HTML_WRAPPER);  
    #else
      XmlDocument svgXML(svgFile);
      ScopedPointer<XmlElement> mainElement (svgXML.getDocumentElement());
      mainElement->setAttribute("width", "100%");
      mainElement->setAttribute("height", "100%");
      mainElement->writeToFile(svgFile, String::empty);
    #endif
    }
  }
}
Ejemplo n.º 2
0
FaustgenFactory::~FaustgenFactory()
{
  freeDSPFactory();
  removeSVG();
}