User Tools

Site Tools


en:app:photovision:plugins

PhotoVision Plugins

Plugins is an extension to use third party app from PhotoVision.

1. Create Plugin:

  • Plugins\[plugin_name].ini
  • PS\[Plugin_name].pas

All settings is stored in PV global config file

[MSPaint]
Path=C:\WINDOWS\system32\mspaint.exe
OpenFile={File}
{File}     - selected file 
{FILENAME} - selected file
{DIR_Or_FILE} - selected directory or file
{DIR}   - selected directory
{SelectedDialogDir} - folder selection dialog selected directory
{QJPEG} - global settings - JPEG Quality

[plugin_name].ini - plugin file

[Plugin_name].pas - plugin configuration page file.

Ini file description:

[Config]
;Caption - Title in menu "Plugins"
Caption=MS Paint
;Name - Internal plugin name, no space or special char. This name is used in app config file as section name.
Name=MSPaint
;Type - plugin configuration type. 1 - pascal script file.
Type=1
CFGPath=Path
;EnableCMD - enable command line input for plugin. Value: 0/1
EnableCMD=1
ToolBar_Button_0=[Section_Name]

PascalScript functions and constants:

//Constants
CfgFile // Path to PhotoVision configuration file
 
//Controls
//Bottom panel with button - Apply
procedure CreateButtonPanel;
//Header panel with Plugin name
procedure CreateHeaderPanel(pluginName: string);
//Bottom pannel with plugin informations
procedure CreateAboutPanel(const pluginCreatorName, pluginCreatorURL, appCreatorName, AppCreatorUrl:string);
procedure CreateLabel(Caption: string; Top, Left: Integer; Parent: TWinControl);
 
//UI Languages
function TranslateUI(const default_text:string;const id: string):string;
 
//File and Directory Functions
function FileExists(const FileName: string):boolean;
function GetFileVersion(const FileName: string): String;
function GetSystemFolder():string;
function GetAppDirectory():String;
function ExtractFilePath ( const FullFileName : String ) : String;
 
//Registry Functions
function RegQueryStringValue(const RootKey: cardinal; const SubKeyName, ValueName: String; var ResultStr: String): Boolean;
function RegQueryStringValueSearchKey(const RootKey: cardinal; const SubKeyName, KeyToSearch,  ValueName: String; var ResultStr: String): Boolean;
 
//INI Functions
function GetIniString(const Section, Key, Default, Filename: String): String;
procedure SetIniString(const Section, Key, Value, Filename: String);
function GetIniInt(const Section, Key: String; const Default: Integer; const Filename: String): Integer;
procedure SetIniInt(const Section, Key: String; const Value: Integer; const Filename: String);
function GetIniBool(const Section, Key: string ;const Default:boolean; Filename: String): boolean;
Const
	plugin_Name		= 'Plugin Name';
	plugin_CreatorName 	= 'Plugin Author Name';
	plugin_CreatorWWW	= 'Plugin Author URL';
	plugin_AppCreatorName 	= 'APP manufacturer';
	plugin_AppCreatorWWW  	= 'App url';
        plugin_IniSection	= 'MSPaint';
	App_EXE			= 'app.exe';		//App filename 
 
 
 
function IsPluginConfigured:boolean; 
begin
	result:=false;
	if FileExists(GetIniString(plugin_IniSection, 'Path', '',CfgFile)) then
	result:=true;
end;
 
procedure SetSettings(); 
begin
   	SetIniString(plugin_IniSection, 'Path', TB_Path.Text,CfgFile); 
	SetIniString(plugin_IniSection, 'OpenFile', '{File}',CfgFile);
end;
 
//Autodetect. If plugin not configured then check if app is installed or exist
//set path and save settings.
Procedure AutoDetect;
begin
if not IsPluginConfigured then
	begin
		if FileExists(GetSystemFolder+'\'+App_EXE) then 
		   TB_Path.Text:=GetSystemFolder+'\'+App_EXE;
		SetSettings;		
	end;
end;
 
procedure GetSettings; 
begin
    TB_Path.Text := GetIniString(plugin_IniSection, 'Path', '',CfgFile);
end;
 
procedure CreateControls;
begin
 
end;
 
begin
	CreateControls;
	GetSettings();
	AutoDetect;
	LBL_Version.caption:=TranslateUI('Version','100')+': '+GetFileVersion(TB_Path.Text);
 
 
	CreateAboutPanel(plugin_CreatorName,plugin_CreatorWWW,plugin_AppCreatorName,plugin_AppCreatorWWW);
	CreateButtonPanel();
	CreateHeaderPanel(plugin_Name);	
end.
en/app/photovision/plugins.txt · Last modified: 2022/02/27 20:13 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki