diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-09-27 21:00:01 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-09-27 21:00:01 +0200 |
commit | 4ba5df93fea93d8c71757e89429f9838b41ca9e0 (patch) | |
tree | 49d88a89cd720d1e4353199ea335cb1b6b7e323b |
Import FireBreath plugin skeleton
This is the unmodified plugin skeleton generated using FireBreath 1.6
fbgen.py script.
-rw-r--r-- | CMakeLists.txt | 39 | ||||
-rw-r--r-- | Factory.cpp | 55 | ||||
-rw-r--r-- | Mac/bundle_template/Info.plist | 60 | ||||
-rw-r--r-- | Mac/bundle_template/InfoPlist.strings | 4 | ||||
-rw-r--r-- | Mac/bundle_template/Localized.r | 20 | ||||
-rw-r--r-- | Mac/projectDef.cmake | 38 | ||||
-rw-r--r-- | PluginConfig.cmake | 59 | ||||
-rw-r--r-- | SPICEConsole.cpp | 124 | ||||
-rw-r--r-- | SPICEConsole.h | 60 | ||||
-rw-r--r-- | SPICEConsoleAPI.cpp | 66 | ||||
-rw-r--r-- | SPICEConsoleAPI.h | 85 | ||||
-rw-r--r-- | Win/WiX/SPICEConsoleInstaller.wxs | 76 | ||||
-rw-r--r-- | Win/projectDef.cmake | 73 | ||||
-rw-r--r-- | X11/projectDef.cmake | 32 |
14 files changed, 791 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b6f65c9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,39 @@ +#/**********************************************************\ +# +# Auto-generated CMakeLists.txt for the SPICE Console project +# +#\**********************************************************/ + +# Written to work with cmake 2.6 +cmake_minimum_required (VERSION 2.6) +set (CMAKE_BACKWARDS_COMPATIBILITY 2.6) + +Project(${PLUGIN_NAME}) + +file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + [^.]*.cpp + [^.]*.h + [^.]*.cmake + ) + +include_directories(${PLUGIN_INCLUDE_DIRS}) + +# Generated files are stored in ${GENERATED} by the project configuration +SET_SOURCE_FILES_PROPERTIES( + ${GENERATED} + PROPERTIES + GENERATED 1 + ) + +SOURCE_GROUP(Generated FILES + ${GENERATED} + ) + +SET( SOURCES + ${GENERAL} + ${GENERATED} + ) + +# This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef +# depending on the platform +include_platform() diff --git a/Factory.cpp b/Factory.cpp new file mode 100644 index 0000000..029927d --- /dev/null +++ b/Factory.cpp @@ -0,0 +1,55 @@ +/**********************************************************\ + + Auto-generated Factory.cpp + + This file contains the auto-generated factory methods + for the SPICEConsole project + +\**********************************************************/ + +#include "FactoryBase.h" +#include "SPICEConsole.h" +#include <boost/make_shared.hpp> + +class PluginFactory : public FB::FactoryBase +{ +public: + /////////////////////////////////////////////////////////////////////////////// + /// @fn FB::PluginCorePtr createPlugin(const std::string& mimetype) + /// + /// @brief Creates a plugin object matching the provided mimetype + /// If mimetype is empty, returns the default plugin + /////////////////////////////////////////////////////////////////////////////// + FB::PluginCorePtr createPlugin(const std::string& mimetype) + { + return boost::make_shared<SPICEConsole>(); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @see FB::FactoryBase::globalPluginInitialize + /////////////////////////////////////////////////////////////////////////////// + void globalPluginInitialize() + { + SPICEConsole::StaticInitialize(); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @see FB::FactoryBase::globalPluginDeinitialize + /////////////////////////////////////////////////////////////////////////////// + void globalPluginDeinitialize() + { + SPICEConsole::StaticDeinitialize(); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +/// @fn getFactoryInstance() +/// +/// @brief Returns the factory instance for this plugin module +/////////////////////////////////////////////////////////////////////////////// +FB::FactoryBasePtr getFactoryInstance() +{ + static boost::shared_ptr<PluginFactory> factory = boost::make_shared<PluginFactory>(); + return factory; +} + diff --git a/Mac/bundle_template/Info.plist b/Mac/bundle_template/Info.plist new file mode 100644 index 0000000..cada904 --- /dev/null +++ b/Mac/bundle_template/Info.plist @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${PLUGIN_NAME}</string> + <key>CFBundleGetInfoString</key> + <string>${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION}, ${FBSTRING_LegalCopyright}</string> + <key>CFBundleIdentifier</key> + <string>com.${FBTYPELIB_NAME}.${FBSTRING_PluginName}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>BRPL</string> + <key>CFBundleShortVersionString</key> + <string>${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION}</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>${FBSTRING_PLUGIN_VERSION}</string> + <key>CFPlugInDynamicRegisterFunction</key> + <string></string> + <key>CFPlugInDynamicRegistration</key> + <string>NO</string> + <key>CFPlugInFactories</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <string>MyFactoryFunction</string> + </dict> + <key>CFPlugInTypes</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <array> + <string>00000000-0000-0000-0000-000000000000</string> + </array> + </dict> + <key>CFPlugInUnloadFunction</key> + <string></string> + <key>WebPluginName</key> + <string>${FBSTRING_ProductName}</string> + <key>WebPluginDescription</key> + <string>${FBSTRING_FileDescription}</string> + <key>WebPluginMIMETypes</key> + <dict> +@foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileDescription CUR_DESC) + <key>${CUR_MIMETYPE}</key> + <dict> + <key>WebPluginExtensions</key> + <array> + <string></string> + </array> + <key>WebPluginTypeDescription</key> + <string>${CUR_DESC}</string> + </dict> +@endforeach + </dict> +</dict> +</plist> diff --git a/Mac/bundle_template/InfoPlist.strings b/Mac/bundle_template/InfoPlist.strings new file mode 100644 index 0000000..790ead0 --- /dev/null +++ b/Mac/bundle_template/InfoPlist.strings @@ -0,0 +1,4 @@ +/* Localized versions of Info.plist keys */ + +CFBundleName = "${PLUGIN_NAME}.plugin"; +NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}"; diff --git a/Mac/bundle_template/Localized.r b/Mac/bundle_template/Localized.r new file mode 100644 index 0000000..69d9c4e --- /dev/null +++ b/Mac/bundle_template/Localized.r @@ -0,0 +1,20 @@ +#include <CoreServices/CoreServices.r> + +resource 'STR#' (126) +{ { + "${FBSTRING_LegalCopyright}", + "${FBSTRING_ProductName}" +} }; + +resource 'STR#' (127) +{ { + "", +} }; + +resource 'STR#' (128) +{ { +@foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT) + "${CUR_MIMETYPE}", + "${CUR_EXTENT}", +@endforeach +} }; diff --git a/Mac/projectDef.cmake b/Mac/projectDef.cmake new file mode 100644 index 0000000..9b6449f --- /dev/null +++ b/Mac/projectDef.cmake @@ -0,0 +1,38 @@ +#/**********************************************************\ +# Auto-generated Mac project definition file for the +# SPICE Console project +#\**********************************************************/ + +# Mac template platform definition CMake file +# Included from ../CMakeLists.txt + +# remember that the current source dir is the project root; this file is in Mac/ +file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + Mac/[^.]*.cpp + Mac/[^.]*.h + Mac/[^.]*.cmake + ) + +# use this to add preprocessor definitions +add_definitions( + +) + + +SOURCE_GROUP(Mac FILES ${PLATFORM}) + +set (SOURCES + ${SOURCES} + ${PLATFORM} + ) + +set(PLIST "Mac/bundle_template/Info.plist") +set(STRINGS "Mac/bundle_template/InfoPlist.strings") +set(LOCALIZED "Mac/bundle_template/Localized.r") + +add_mac_plugin(${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES) + +# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! +target_link_libraries(${PROJECT_NAME} + ${PLUGIN_INTERNAL_DEPS} + ) diff --git a/PluginConfig.cmake b/PluginConfig.cmake new file mode 100644 index 0000000..9bf4bc5 --- /dev/null +++ b/PluginConfig.cmake @@ -0,0 +1,59 @@ +#/**********************************************************\ +# +# Auto-Generated Plugin Configuration file +# for SPICE Console +# +#\**********************************************************/ + +set(PLUGIN_NAME "SPICEConsole") +set(PLUGIN_PREFIX "SPC") +set(COMPANY_NAME "RedHat") + +# ActiveX constants: +set(FBTYPELIB_NAME SPICEConsoleLib) +set(FBTYPELIB_DESC "SPICEConsole 1.0 Type Library") +set(IFBControl_DESC "SPICEConsole Control Interface") +set(FBControl_DESC "SPICEConsole Control Class") +set(IFBComJavascriptObject_DESC "SPICEConsole IComJavascriptObject Interface") +set(FBComJavascriptObject_DESC "SPICEConsole ComJavascriptObject Class") +set(IFBComEventSource_DESC "SPICEConsole IFBComEventSource Interface") +set(AXVERSION_NUM "1") + +# NOTE: THESE GUIDS *MUST* BE UNIQUE TO YOUR PLUGIN/ACTIVEX CONTROL! YES, ALL OF THEM! +set(FBTYPELIB_GUID dbe5cd0e-afb5-51d4-a4cd-a05a8a0ab536) +set(IFBControl_GUID 1ee3c2ca-01ed-54be-9d3e-42b56fa91777) +set(FBControl_GUID a5e462b0-0a8c-520c-8a2c-46d1d1839eee) +set(IFBComJavascriptObject_GUID 711b204d-3d3e-5cef-bd54-66e1a50360f4) +set(FBComJavascriptObject_GUID d41002e6-8aa4-5cdf-beab-21267b252157) +set(IFBComEventSource_GUID a468a437-44b6-5e8d-8acb-b936588703f3) + +# these are the pieces that are relevant to using it from Javascript +set(ACTIVEX_PROGID "RedHat.SPICEConsole") +set(MOZILLA_PLUGINID "redhat.com/SPICEConsole") + +# strings +set(FBSTRING_CompanyName "Red Hat, Inc") +set(FBSTRING_FileDescription "SPICE Console") +set(FBSTRING_PLUGIN_VERSION "1.0.0.0") +set(FBSTRING_LegalCopyright "Copyright 2012 Red Hat, Inc") +set(FBSTRING_PluginFileName "np${PLUGIN_NAME}.dll") +set(FBSTRING_ProductName "SPICE Console") +set(FBSTRING_FileExtents "") +set(FBSTRING_PluginName "SPICE Console") +set(FBSTRING_MIMEType "application/x-spice") + +# Uncomment this next line if you're not planning on your plugin doing +# any drawing: + +set (FB_GUI_DISABLED 1) + +# Mac plugin settings. If your plugin does not draw, set these all to 0 +set(FBMAC_USE_QUICKDRAW 0) +set(FBMAC_USE_CARBON 0) +set(FBMAC_USE_COCOA 0) +set(FBMAC_USE_COREGRAPHICS 0) +set(FBMAC_USE_COREANIMATION 0) +set(FBMAC_USE_INVALIDATINGCOREANIMATION 0) + +# If you want to register per-machine on Windows, uncomment this line +#set (FB_ATLREG_MACHINEWIDE 1) diff --git a/SPICEConsole.cpp b/SPICEConsole.cpp new file mode 100644 index 0000000..7e0e1bc --- /dev/null +++ b/SPICEConsole.cpp @@ -0,0 +1,124 @@ +/**********************************************************\ + + Auto-generated SPICEConsole.cpp + + This file contains the auto-generated main plugin object + implementation for the SPICE Console project + +\**********************************************************/ + +#include "SPICEConsoleAPI.h" + +#include "SPICEConsole.h" + +/////////////////////////////////////////////////////////////////////////////// +/// @fn SPICEConsole::StaticInitialize() +/// +/// @brief Called from PluginFactory::globalPluginInitialize() +/// +/// @see FB::FactoryBase::globalPluginInitialize +/////////////////////////////////////////////////////////////////////////////// +void SPICEConsole::StaticInitialize() +{ + // Place one-time initialization stuff here; As of FireBreath 1.4 this should only + // be called once per process +} + +/////////////////////////////////////////////////////////////////////////////// +/// @fn SPICEConsole::StaticInitialize() +/// +/// @brief Called from PluginFactory::globalPluginDeinitialize() +/// +/// @see FB::FactoryBase::globalPluginDeinitialize +/////////////////////////////////////////////////////////////////////////////// +void SPICEConsole::StaticDeinitialize() +{ + // Place one-time deinitialization stuff here. As of FireBreath 1.4 this should + // always be called just before the plugin library is unloaded +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief SPICEConsole constructor. Note that your API is not available +/// at this point, nor the window. For best results wait to use +/// the JSAPI object until the onPluginReady method is called +/////////////////////////////////////////////////////////////////////////////// +SPICEConsole::SPICEConsole() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief SPICEConsole destructor. +/////////////////////////////////////////////////////////////////////////////// +SPICEConsole::~SPICEConsole() +{ + // This is optional, but if you reset m_api (the shared_ptr to your JSAPI + // root object) and tell the host to free the retained JSAPI objects then + // unless you are holding another shared_ptr reference to your JSAPI object + // they will be released here. + releaseRootJSAPI(); + m_host->freeRetainedObjects(); +} + +void SPICEConsole::onPluginReady() +{ + // When this is called, the BrowserHost is attached, the JSAPI object is + // created, and we are ready to interact with the page and such. The + // PluginWindow may or may not have already fire the AttachedEvent at + // this point. +} + +void SPICEConsole::shutdown() +{ + // This will be called when it is time for the plugin to shut down; + // any threads or anything else that may hold a shared_ptr to this + // object should be released here so that this object can be safely + // destroyed. This is the last point that shared_from_this and weak_ptr + // references to this object will be valid +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Creates an instance of the JSAPI object that provides your main +/// Javascript interface. +/// +/// Note that m_host is your BrowserHost and shared_ptr returns a +/// FB::PluginCorePtr, which can be used to provide a +/// boost::weak_ptr<SPICEConsole> for your JSAPI class. +/// +/// Be very careful where you hold a shared_ptr to your plugin class from, +/// as it could prevent your plugin class from getting destroyed properly. +/////////////////////////////////////////////////////////////////////////////// +FB::JSAPIPtr SPICEConsole::createJSAPI() +{ + // m_host is the BrowserHost + return boost::make_shared<SPICEConsoleAPI>(FB::ptr_cast<SPICEConsole>(shared_from_this()), m_host); +} + +bool SPICEConsole::onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *) +{ + //printf("Mouse down at: %d, %d\n", evt->m_x, evt->m_y); + return false; +} + +bool SPICEConsole::onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *) +{ + //printf("Mouse up at: %d, %d\n", evt->m_x, evt->m_y); + return false; +} + +bool SPICEConsole::onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *) +{ + //printf("Mouse move at: %d, %d\n", evt->m_x, evt->m_y); + return false; +} +bool SPICEConsole::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *) +{ + // The window is attached; act appropriately + return false; +} + +bool SPICEConsole::onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *) +{ + // The window is about to be detached; act appropriately + return false; +} + diff --git a/SPICEConsole.h b/SPICEConsole.h new file mode 100644 index 0000000..42cfebc --- /dev/null +++ b/SPICEConsole.h @@ -0,0 +1,60 @@ +/**********************************************************\ + + Auto-generated SPICEConsole.h + + This file contains the auto-generated main plugin object + implementation for the SPICE Console project + +\**********************************************************/ +#ifndef H_SPICEConsolePLUGIN +#define H_SPICEConsolePLUGIN + +#include "PluginWindow.h" +#include "PluginEvents/MouseEvents.h" +#include "PluginEvents/AttachedEvent.h" + +#include "PluginCore.h" + + +FB_FORWARD_PTR(SPICEConsole) +class SPICEConsole : public FB::PluginCore +{ +public: + static void StaticInitialize(); + static void StaticDeinitialize(); + +public: + SPICEConsole(); + virtual ~SPICEConsole(); + +public: + void onPluginReady(); + void shutdown(); + virtual FB::JSAPIPtr createJSAPI(); + // If you want your plugin to always be windowless, set this to true + // If you want your plugin to be optionally windowless based on the + // value of the "windowless" param tag, remove this method or return + // FB::PluginCore::isWindowless() + virtual bool isWindowless() { return false; } + + BEGIN_PLUGIN_EVENT_MAP() + EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow) + EVENTTYPE_CASE(FB::MouseUpEvent, onMouseUp, FB::PluginWindow) + EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow) + EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow) + EVENTTYPE_CASE(FB::AttachedEvent, onWindowAttached, FB::PluginWindow) + EVENTTYPE_CASE(FB::DetachedEvent, onWindowDetached, FB::PluginWindow) + END_PLUGIN_EVENT_MAP() + + /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ + virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *); + virtual bool onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *); + virtual bool onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *); + virtual bool onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *); + virtual bool onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *); + /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ +}; + + +#endif + diff --git a/SPICEConsoleAPI.cpp b/SPICEConsoleAPI.cpp new file mode 100644 index 0000000..810269d --- /dev/null +++ b/SPICEConsoleAPI.cpp @@ -0,0 +1,66 @@ +/**********************************************************\ + + Auto-generated SPICEConsoleAPI.cpp + +\**********************************************************/ + +#include "JSObject.h" +#include "variant_list.h" +#include "DOM/Document.h" +#include "global/config.h" + +#include "SPICEConsoleAPI.h" + +/////////////////////////////////////////////////////////////////////////////// +/// @fn FB::variant SPICEConsoleAPI::echo(const FB::variant& msg) +/// +/// @brief Echos whatever is passed from Javascript. +/// Go ahead and change it. See what happens! +/////////////////////////////////////////////////////////////////////////////// +FB::variant SPICEConsoleAPI::echo(const FB::variant& msg) +{ + static int n(0); + fire_echo("So far, you clicked this many times: ", n++); + + // return "foobar"; + return msg; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @fn SPICEConsolePtr SPICEConsoleAPI::getPlugin() +/// +/// @brief Gets a reference to the plugin that was passed in when the object +/// was created. If the plugin has already been released then this +/// will throw a FB::script_error that will be translated into a +/// javascript exception in the page. +/////////////////////////////////////////////////////////////////////////////// +SPICEConsolePtr SPICEConsoleAPI::getPlugin() +{ + SPICEConsolePtr plugin(m_plugin.lock()); + if (!plugin) { + throw FB::script_error("The plugin is invalid"); + } + return plugin; +} + +// Read/Write property testString +std::string SPICEConsoleAPI::get_testString() +{ + return m_testString; +} + +void SPICEConsoleAPI::set_testString(const std::string& val) +{ + m_testString = val; +} + +// Read-only property version +std::string SPICEConsoleAPI::get_version() +{ + return FBSTRING_PLUGIN_VERSION; +} + +void SPICEConsoleAPI::testEvent() +{ + fire_test(); +} diff --git a/SPICEConsoleAPI.h b/SPICEConsoleAPI.h new file mode 100644 index 0000000..2864e46 --- /dev/null +++ b/SPICEConsoleAPI.h @@ -0,0 +1,85 @@ +/**********************************************************\ + + Auto-generated SPICEConsoleAPI.h + +\**********************************************************/ + +#include <string> +#include <sstream> +#include <boost/weak_ptr.hpp> +#include "JSAPIAuto.h" +#include "BrowserHost.h" +#include "SPICEConsole.h" + +#ifndef H_SPICEConsoleAPI +#define H_SPICEConsoleAPI + +class SPICEConsoleAPI : public FB::JSAPIAuto +{ +public: + //////////////////////////////////////////////////////////////////////////// + /// @fn SPICEConsoleAPI::SPICEConsoleAPI(const SPICEConsolePtr& plugin, const FB::BrowserHostPtr host) + /// + /// @brief Constructor for your JSAPI object. + /// You should register your methods, properties, and events + /// that should be accessible to Javascript from here. + /// + /// @see FB::JSAPIAuto::registerMethod + /// @see FB::JSAPIAuto::registerProperty + /// @see FB::JSAPIAuto::registerEvent + //////////////////////////////////////////////////////////////////////////// + SPICEConsoleAPI(const SPICEConsolePtr& plugin, const FB::BrowserHostPtr& host) : + m_plugin(plugin), m_host(host) + { + registerMethod("echo", make_method(this, &SPICEConsoleAPI::echo)); + registerMethod("testEvent", make_method(this, &SPICEConsoleAPI::testEvent)); + + // Read-write property + registerProperty("testString", + make_property(this, + &SPICEConsoleAPI::get_testString, + &SPICEConsoleAPI::set_testString)); + + // Read-only property + registerProperty("version", + make_property(this, + &SPICEConsoleAPI::get_version)); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @fn SPICEConsoleAPI::~SPICEConsoleAPI() + /// + /// @brief Destructor. Remember that this object will not be released until + /// the browser is done with it; this will almost definitely be after + /// the plugin is released. + /////////////////////////////////////////////////////////////////////////////// + virtual ~SPICEConsoleAPI() {}; + + SPICEConsolePtr getPlugin(); + + // Read/Write property ${PROPERTY.ident} + std::string get_testString(); + void set_testString(const std::string& val); + + // Read-only property ${PROPERTY.ident} + std::string get_version(); + + // Method echo + FB::variant echo(const FB::variant& msg); + + // Event helpers + FB_JSAPI_EVENT(test, 0, ()); + FB_JSAPI_EVENT(echo, 2, (const FB::variant&, const int)); + + // Method test-event + void testEvent(); + +private: + SPICEConsoleWeakPtr m_plugin; + FB::BrowserHostPtr m_host; + + std::string m_testString; +}; + +#endif // H_SPICEConsoleAPI + diff --git a/Win/WiX/SPICEConsoleInstaller.wxs b/Win/WiX/SPICEConsoleInstaller.wxs new file mode 100644 index 0000000..14cfb01 --- /dev/null +++ b/Win/WiX/SPICEConsoleInstaller.wxs @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + <Product Id="*" Name="${FBSTRING_PluginName}" Language="1033" Version="${FBSTRING_PLUGIN_VERSION}" Manufacturer="${FBSTRING_CompanyName}" UpgradeCode="{66d9b760-8e92-57dd-9a5e-122c988bf5af}"> + <Package InstallerVersion="200" Compressed="yes" Description="Installer for the ${PLUGIN_NAME} plugin" InstallScope="perUser" /> + <Upgrade Id="{66d9b760-8e92-57dd-9a5e-122c988bf5af}"> + <UpgradeVersion + Property="OLD_VERSION_FOUND" + Minimum="0.0.1" IncludeMinimum="yes" + Maximum="${FBSTRING_PLUGIN_VERSION}" IncludeMaximum="yes" + OnlyDetect="no" IgnoreRemoveFailure="yes" + MigrateFeatures="yes" /> + </Upgrade> + <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" /> + <InstallExecuteSequence> + <RemoveExistingProducts After="InstallInitialize" /> + <InstallExecute After="RemoveExistingProducts" /> + </InstallExecuteSequence> + <Media Id="1" Cabinet="${PLUGIN_NAME}.cab" EmbedCab="yes" /> + + <Directory Id="TARGETDIR" Name="SourceDir"> + <Directory Id="${FB_WIX_INSTALL_LOCATION}"> + <Directory Id="CompanyDir" Name="${COMPANY_NAME}"> + <Component Id="CompanyDirComp" Guid="*"> + <RemoveFolder Id="RemoveCompanyDir" On="uninstall" /> + <RegistryValue + Root="HKCU" + Key="SOFTWARE\${COMPANY_NAME}" + Name="Uninstall" + Type="string" + Value="${FBSTRING_PLUGIN_VERSION}" + KeyPath="yes" /> + </Component> + <Directory Id="PluginNameDir" Name="${PLUGIN_NAME}"> + <Component Id="PluginNameDirComp" Guid="*"> + <RemoveFolder Id="RemovePluginNameDir" On="uninstall" /> + <RegistryValue + Root="HKCU" + Key="SOFTWARE\${COMPANY_NAME}\${PLUGIN_NAME}" + Name="Uninstall" + Type="string" + Value="${FBSTRING_PLUGIN_VERSION}" + KeyPath="yes" /> + </Component> + <Directory Id="INSTALLDIR" Name="${FBSTRING_PLUGIN_VERSION}"> + <Component Id="InstallDirComp" Guid="*"> + <RemoveFolder Id="RemoveInstallDir" On="uninstall" /> + <RegistryValue + Root="HKCU" + Key="SOFTWARE\${COMPANY_NAME}\${PLUGIN_NAME}\${FBSTRING_PLUGIN_VERSION}" + Name="Uninstall" + Type="string" + Value="${FBSTRING_PLUGIN_VERSION}" + KeyPath="yes" /> + </Component> + + <!-- Put Additional files here: --> + <!-- example: + <Component Id="UniqueComponentId" Guid="*"> + <File Id="uniqueFileId" KeyPath="yes" Source="SourceDir\filename.ext" /> + </Component> + /example --> + <!-- --> + </Directory> + </Directory> + </Directory> + </Directory> + </Directory> + + <Feature Id="MainPluginFeature" Title="${FBSTRING_ProductName}" Level="1"> + <ComponentRef Id="InstallDirComp"/> + <ComponentRef Id="PluginNameDirComp"/> + <ComponentRef Id="CompanyDirComp"/> + <ComponentGroupRef Id="PluginDLLGroup"/> + </Feature> + </Product> +</Wix> diff --git a/Win/projectDef.cmake b/Win/projectDef.cmake new file mode 100644 index 0000000..6124ba2 --- /dev/null +++ b/Win/projectDef.cmake @@ -0,0 +1,73 @@ +#/**********************************************************\ +# Auto-generated Windows project definition file for the +# SPICE Console project +#\**********************************************************/ + +# Windows template platform definition CMake file +# Included from ../CMakeLists.txt + +# remember that the current source dir is the project root; this file is in Win/ +file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + Win/[^.]*.cpp + Win/[^.]*.h + Win/[^.]*.cmake + ) + +# use this to add preprocessor definitions +add_definitions( + /D "_ATL_STATIC_REGISTRY" +) + +SOURCE_GROUP(Win FILES ${PLATFORM}) + +set (SOURCES + ${SOURCES} + ${PLATFORM} + ) + +add_windows_plugin(${PROJECT_NAME} SOURCES) + +# This is an example of how to add a build step to sign the plugin DLL before +# the WiX installer builds. The first filename (certificate.pfx) should be +# the path to your pfx file. If it requires a passphrase, the passphrase +# should be located inside the second file. If you don't need a passphrase +# then set the second filename to "". If you don't want signtool to timestamp +# your DLL then make the last parameter "". +# +# Note that this will not attempt to sign if the certificate isn't there -- +# that's so that you can have development machines without the cert and it'll +# still work. Your cert should only be on the build machine and shouldn't be in +# source control! +# -- uncomment lines below this to enable signing -- +#firebreath_sign_plugin(${PROJECT_NAME} +# "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx" +# "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt" +# "http://timestamp.verisign.com/scripts/timestamp.dll") + +# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! +target_link_libraries(${PROJECT_NAME} + ${PLUGIN_INTERNAL_DEPS} + ) + +set(WIX_HEAT_FLAGS + -gg # Generate GUIDs + -srd # Suppress Root Dir + -cg PluginDLLGroup # Set the Component group name + -dr INSTALLDIR # Set the directory ID to put the files in + ) + +add_wix_installer( ${PLUGIN_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/SPICEConsoleInstaller.wxs + PluginDLLGroup + ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/ + ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll + ${PROJECT_NAME} + ) + +# This is an example of how to add a build step to sign the WiX installer +# -- uncomment lines below this to enable signing -- +#firebreath_sign_file("${PLUGIN_NAME}_WiXInstall" +# "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.msi" +# "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx" +# "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt" +# "http://timestamp.verisign.com/scripts/timestamp.dll") diff --git a/X11/projectDef.cmake b/X11/projectDef.cmake new file mode 100644 index 0000000..3004bd6 --- /dev/null +++ b/X11/projectDef.cmake @@ -0,0 +1,32 @@ +#/**********************************************************\ +# Auto-generated X11 project definition file for the +# SPICE Console project +#\**********************************************************/ + +# X11 template platform definition CMake file +# Included from ../CMakeLists.txt + +# remember that the current source dir is the project root; this file is in X11/ +file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + X11/[^.]*.cpp + X11/[^.]*.h + X11/[^.]*.cmake + ) + +SOURCE_GROUP(X11 FILES ${PLATFORM}) + +# use this to add preprocessor definitions +add_definitions( +) + +set (SOURCES + ${SOURCES} + ${PLATFORM} + ) + +add_x11_plugin(${PROJECT_NAME} SOURCES) + +# add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! +target_link_libraries(${PROJECT_NAME} + ${PLUGIN_INTERNAL_DEPS} + ) |