You copied the Doc URL to your clipboard.

The MxPlugin class

The first step to implementing the MxPluginInit() function is the creation of an object of type MxPlugin. This provides the interface for all of the SoC Designer plugin functionality.

The following example shows the MxPluginInit() class definition.

class MxPlugin {
public:
    MxPlugin(const char *name);
    ~MxPlugin();
    //inserts a menu item into the main menu under “Plugins”
    bool insertItemMenu(const char *text, MxPluginCallBack *myCallback, 
        const char *pixmap[] = NULL, const char *toolTips = "", 
        const char *whatsThis = "");

    bool insertSeparator();

    //Inserts a context menu item for the component context menu 
    bool insertContextMenuItem(const char *text, 
        MxPluginComponentCallBack *myComponentCallback, 
        const char *toolTips = "", const char *whatsThis = "");

    //Inserts a script batch-mode plugin command 
    bool insertBatchModeCommand(const char *batchCommand, 
        MxPluginCallBack *myCallback);

    bool insertCustomCallback(MxPluginCustomComponentCallBack
        *myComponentCallback, MxCustomComponentCallbackType context,
        const char *typeComponent);

     bool insertDoubleClickCallBack(MxPluginComponentDoubleClick 
                     *dClickCallBack);

    bool insertComponentUpdateCallBack(MxPluginComponentUpdate *updateCallBack);

    bool insertListenerCallBack(MxPluginListener *listenerCallBack);

    //Creates a custom dialog 
    MxPluginDialog *createCustomDialog(const char *title);

    //Removes a custom dialog 
    void removeDialog(MxPluginDialog *);

    //Save the current system as an MXP file 
    bool saveMXPFile(const char *filename);

    //Display a message on the output window 
    void message(const char *text);

    //Execute a batch-mode script command 
    bool executeBatchmodeCommand (const char *command, int numParams, … );

    //Get the path to the component’s library file 
    const char *getDllPathComponent(CASIModule *component);

    //MxDesigner only: Returns the number of connections in the current syst. 
    int getNoDesignerConnections(void); 

    //MxDesigner only: Returns the “index” connection for the system for 
    //which the getNoDesignerConnection() function was called last 
    MxPluginDesignerConnection *getDesignerConnection(int index); 

    bool loadMXPFile(const char *mxpfilepath);

    bool addLibComponent(const char *conffile, const char *releasePath, 
         const char *debugPath = NULL, bool bRelease = true,
         bool bRelative = true);

    bool addLibMXP(const char *conffile, const char *mxpfilepath, 
                   bool bRelative = true);

    string  getInstanceName(){return instanceName;}
    bool checkGUIMode();

    bool checkDesignerMode();

    bool exportSPIRIT(char *module_name, char *vendor, char *library,
                       char *version, char *file_path, char *lgi_path);

    void GetMxVersionInfo(int* major, int* minor, int* revision);

    void sendPluginMessage(const char *ReceiverPluginName, 
        unsigned long cmdWord, unsigned long dataBuffer, 
        unsigned long dataBufferSize, string& retStatus);

    bool insertCustomProbe(eslapi::CASIPortIF *portA, eslapi::CASIPortIF *portB,
        eslapi::CASIModuleIF* puProbe, eslapi::CASIPortIF *puProbeMasterPort,
        eslapi::CASIPortIF *puProbeSlavePort, string& strErrorMessage, 
        bool bValueChange = false);

    bool removeCustomProbe(eslapi::CASIModuleIF* puProbe, 
        string& strErrorMessage);

    bool insertCustomIcon(eslapi::CASIModuleIF* puComponentA, 
        eslapi::CASIPortIF *portA,
        eslapi::CASIModuleIF* puComponentB, eslapi::CASIPortIF *portB, 
        const char **pixmap, 
        string& strErrorMessage);

    bool removeCustomIcon(eslapi::CASIModuleIF* puComponentA, 
        eslapi::CASIPortIF *portA,
        eslapi::CASIModuleIF* puComponentB, eslapi::CASIPortIF *portB, 
        const char **pixmap, 
        string& strErrorMessage);"

private:
    string instanceName;     // Name of the instance given at creation time
};

You can access the plugin object and its functions from a pointer in your implementation. For example,

pluginP->GetMxVersionInfo(&major, &minor, &revision);

where pluginP points to a new plugin object that is created in MxPluginInit(). See Chapter 4 Creating GUI-mode Plugins for examples of accessing plugin functions.

Was this page helpful? Yes No