Synergy Editor now has a brand new plugin engine. Plugins are dynamic link libraries that contain specific methods for interacting with Synergy Editor. There are functions available for reading and setting a number of variables. You can respond to events that occur e.g. compiling and register your own entries into file menu.
The header file as it stands.
#ifndef _PLUGINCORE_H_
#define _PLUGINCORE_H_
/*
Engine Version: 1
-: Rules :-
1). Do not modify this file
2). It is your responsibility to free any memory that your dll uses
3). Synergy Editor is a unicode application, all strings will be in unicode
4). Do not cache the information you receive outside of methods, it may change at anytime
*/
// Use these entries when registering actions with Synergy Editor
struct GUIEntry
{
TCHAR text[20]; // The text to display
UINT actionID; // The action ID to use with your plugin (your first id should be 100, increment from there)
UINT type; // The type of GUI Entry (see enum)
UINT internalID; // Reserved; Do not use
};
class PluginCore
{
public:
// These are the actions that you can deal with.
enum { actionBeforeCompile, actionAfterCompile, actionBeforeProjectSave, actionAfterProjectSave, actionBeforeProjectLoad, actionAfterProjectLoad,
actionBeforeFilesSave, actionAfterFilesSave, actionBeforeFileSave, actionAfterFileSave, actionBeforeFileLoad, actionAfterFileLoad, actionPluginAbout };
// These are the id's of the strings you can request/set.
enum { strProjectDBPROFile, strCompileDBPROFile, strCompileDBAFile, strProjectSourceFile /* Extra information=index|Readonly */, strConsoleOutput /* Writeonly */ };
// These are the id's of the strings you can request.
enum { intProjectSourceFileCount /* Readonly */ };
// Error codes returned by GetString, GetInt can return errUnknownID
enum { errOK = 1, errBufferTooSmall = -1, errUnknownID = -2, errPropertyReadOnly = -3, errPropertyWriteOnly = -4 };
// The type of GUI Entry
enum { toolsMenuEntry };
// Use this method to get integer data out of Synergy Editor
int (*GetInt)(UINT /* The integer id */, UINT /* Extra information */);
// Use this method to get string data out of Synergy Editor
int (*GetString)(wchar_t* /* The buffer to receive the name */, UINT /* The buffer size */, UINT /* The string id */, UINT /* Extra information */);
// Use this method to send strings to Synergy Editor
int (*SetString)(wchar_t* /* The buffer with the new data */, UINT /* The string id */);
};
/*
Your plugin should have the following methods to be accepted as a valid plugin
// Retrieve the engine version we're going to expect
extern "C" __declspec(dllexport) int getEngineVersion() { return 1; }
// Tells us to register our functionality; return the number of actions you are registering
extern "C" __declspec(dllexport) UINT registerPlugin(PluginCore *plugincore) { }
// Called when the plugin is being deleted
extern "C" __declspec(dllexport) void unregisterPlugin() { }
// Returns the name of the plugin
extern "C" __declspec(dllexport) wchar_t* getPluginDetails() { }
// Fill the array with your action details (array is sized from the number of actions you are registering)
extern "C" __declspec(dllexport) void registerActions(GUIEntry* guiEntries) { }
// Called when an action occurs; see Plugin Core for enumeration
extern "C" __declspec(dllexport) bool onAction(UINT action)
{
bool res = true;
switch(action)
{
case PluginCore::actionPluginAbout:
// Show a message box or dialog. It is also possible to configure the plugin here.
break;
}
return res;
}
*/
#endif _PLUGINCORE_H_
Synergy Editor - Available for free HERE!