The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
4.0KB

  1. Juce Browser Plugin Framework
  2. =============================
  3. These classes let you wrap a normal Juce component as a Mac/Windows NPAPI plugin for use in Firefox,
  4. Safari, Chrome, etc., and/or an ActiveX plugin for IE.
  5. To create your plugin, your code just needs to implement the createBrowserPlugin() function
  6. to return a subclass of BrowserPluginComponent, and this acts as the plugin window.
  7. To communicate with javascript running in the host webpage, the 'var' and 'DynamicObject' juce
  8. classes emulate javascript objects, so you can create a javascript object that represents
  9. your plugin, and the webpage can invoke methods and access properties on this object. To
  10. get bi-directional communication between the plugin and webpage, your webpage can simply
  11. pass its own object to your plugin, and the plugin can call methods on this object to invoke
  12. javascript actions.
  13. In a similar style to audio plugins, your project has to contain a BrowserPluginCharacteristics.h
  14. file that defines various properties of the plugin.
  15. Building a Mac NPAPI Plugin with XCode
  16. --------------------------------------
  17. - Create a new "CFPlugin Bundle" project
  18. - Add the juce wrapper source files to the project (have a look at the demo project to
  19. find out which files this includes).
  20. - Set up all the usual frameworks, etc, like you would for any other juce project.
  21. - In the project or target settings, change the "Wrapper Extension" to "plugin"
  22. - In your target, add a build phase "Build ResourceManager resources", and add the juce_NPAPI_MacResource.r file
  23. to this step.
  24. - Check that your info.plist contains the same items as the demo plugin, because these need to be set for the
  25. browser to recognise it as a plugin. In particular, the "Bundle OS Type Code" should be set to BRPL.
  26. - The finished bundle needs to be copied into "/Library/Internet Plug-Ins", so you might want to set up a
  27. post-build copy step to do this automatically
  28. Building a Windows NPAPI plugin in Visual Studio
  29. ------------------------------------------------
  30. - Create a new project to build a win32 DLL
  31. - Add the juce wrapper source files to the project (have a look at the demo project to
  32. find out which files this includes).
  33. - Your compiled plugin DLL must begin with the letters 'np' (in lower case) for it to be recognised as
  34. a plugin, so you should make sure your target settings reflect this.
  35. - To include the BrowserPluginCharacteristics.h file, you may need to add an include path to wherever this
  36. file lives in your project. Don't use a global include path for this - just add it to the project's
  37. search paths (both the c++ include paths and the resource include paths)
  38. - (Refer to the normal juce instructions for setting up other project settings such as which c++ libs to link to etc)
  39. - The finished plugin needs to be copied into "C:\Program Files\Mozilla Firefox\plugins", so you might want
  40. to add a post-build step to copy it
  41. - Note that the "browser plugins/wrapper/npapi" folder contains a copy of some NPAPI header files. If you're
  42. building a closed-source project, please check the licensing details in these files to make sure
  43. you're not breaking any Mozilla licensing restictions.
  44. Building a Windows ActiveX control for Internet Explorer
  45. --------------------------------------------------------
  46. - This is actually quite easy, because the same DLL that functions as an NPAPI plugin can
  47. also be used as an ActiveX control.
  48. - Just create a windows NPAPI plugin as described above, but add the juce_ActiveX_GlueCode.cpp
  49. file to the project.
  50. - In your BrowserPluginCharacteristics.h file, the JuceBrowserPlugin_ActiveXCLSID setting needs
  51. to be given a unique GUID for your plugin.
  52. - Because the plugin is a COM object, it doesn't matter where the DLL lives, but it needs to
  53. be registered in the normal COM way, with regsvr32.exe. Note that on Vista, this command
  54. needs to be run with administrator permissions for it to be able to write to the registry.