Visual Plugin SDK
 
The following functions are for Visual Plugins only.

NOTES:
The SAMURIZE_PLUGIN_CHAR and SAMURIZE_PLUGIN_INT types are defined as

#define SAMURIZE_PLUGIN_CHAR extern "C" __declspec(dllexport) char* __stdcall
#define SAMURIZE_PLUGIN_INT extern "C" __declspec(dllexport) int __stdcall


In Delphi they are simply the PChar and Integer types.

Function List
SAMURIZE_PLUGIN_INT vis_configure(int id)
 
VISUAL PLUGINS ONLY

vis_configure() is called when the user clicks on the "Configure..." button in Samurize.
You can display some kind of popup window that allows users to specify various display settings for this visual plugin. Note that you need to store the settings for each meter individually for saving later on.
This function is optional - if it is not provided, you will not be able to specify settings on a meter-by-meter basis.

Parameters:
  • id - the unique ID of the meter being configured (that your plugin assigned to the meter as the return value of dllstartup)
Return Value:
This function should always return 0.
 
SAMURIZE_PLUGIN_INT repaint(HDC hdc, int id, char* cValue, int width, int height)
 
VISUAL PLUGINS ONLY

repaint() is called every time Samurize refreshes its display. Visual plugins need to be repainted every time this occurs.

The bitmap you are drawing on is a 32-bit bitmap with alpha channel. Thus if you use GDI functions to draw, the alpha will be 0 and you will see nothing. You can either use GDI+ (supports transparency) or a custom library such as the graphics32 library for Delphi.

Parameters:
  • h - the device context (HDC) for the bitmap you should draw on
  • id - the unique ID assigned to the meter that is calling this function (assigned by the dllstartup() function)
  • value - the value of the meter in string form (eg. "20", "Some text")
  • width - the width of the bitmap in pixels
  • height - the height of the bitmap in pixels
Return Value:
This function should always return 0.
 
SAMURIZE_PLUGIN_INT load_settings(int id, char* inifile, char* section)
 
VISUAL PLUGINS ONLY

load_settings() is called when the config is loaded from file in the config editor or the clients. Your plugin should load its settings from the given section of the specified config file.

Parameters:
  • id - the unique ID assigned to the meter by the dllstartup() function
  • inifile - the full path to the config file
  • section - the section of the config file where the values are listed
Return Value:
This function should always return 0.
 
SAMURIZE_PLUGIN_INT save_settings(int id, char* inifile, char* section)
 
VISUAL PLUGINS ONLY

save_settings() is called when the config is being saved by the config editor. Your plugin should save its settings to the given section of the specified config file.

Parameters:
  • id - the unique ID assigned to the meter by the dllstartup() function
  • inifile - the full path to the config file
  • section - the section of the config file where the values should be saved
SAMURIZE_PLUGIN_INT setdefaults(int unique_id, PPluginDefaults* def)
 
VISUAL PLUGINS ONLY

setdefaults is called when the config editor receives the WM_SAM_CONFIGEDITOR_SETDEFAULTS message.

When this is called, your plugin can set the X, Y, Width and Height of its meter via the passed pointer.

Parameters:
  • unique_id - the unique ID assigned to the meter by the dllstartup() function
  • def - A pointer to a structure that looks like this:
    TPluginDefaults = packed record
        X:Word;
        Y:Word;
        Width:Word;
        Height:Word;
        Reserved:Word;
    end;
    PPluginDefaults = ^TPluginDefaults;
Return Value:
This function should always return 0.