Rhino C++ API  7.26
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
CRhinoPlugInRecord Class Reference

#include <RhinoSdkPlugInManager.h>

Public Member Functions

 CRhinoPlugInRecord ()
 
 CRhinoPlugInRecord (const CRhinoPlugInRecord &)
 
 ~CRhinoPlugInRecord ()
 
void AddCommand (const wchar_t *lpsEnglishCommandName, const wchar_t *lpsLocalizedCommandName, int nFlags=0)
 
void AddFileTypes (const wchar_t *lpsDescr, const wchar_t *lpsExtensions)
 
bool AddToHelpMenu () const
 
int CommandRecordCount () const
 
bool ContainsCommandNamed (const wchar_t *lpsCmdName, bool bEnglishCommandName) const
 
const wchar_t * Description () const
 
const wchar_t * EnglishCommandName (int nIndex) const
 
const wchar_t * EnglishName () const
 
const wchar_t * FileName () const
 
const CRhinoFileTypeFileType (int index) const
 
int FileTypeCount () const
 
const ON_ClassArray< CRhinoFileType > & FileTypes () const
 
const CRhinoPlugInCommandRecordGetCommandRecord (int nIndex) const
 
HICON Icon (const ON_2iSize &size)
 
HINSTANCE Instance () const
 
bool IsDirectoryInstall () const
 
bool IsDotNETPlugIn () const
 
bool IsLoadDisabled () const
 
bool IsLoaded () const
 
bool IsShippingPlugIn () const
 Is this plug-in one that ships with Rhino. More...
 
bool LoadAttempted () const
 
int LoadAttemptedCount () const
 
int LoadOrder () const
 
int LoadProtection () const
 
const wchar_t * LocalizedCommandName (int) const
 
const wchar_t * Name () const
 
const CRhinoPlugInRecordoperator= (const CRhinoPlugInRecord &)
 
CRhinoPlugInPlugIn () const
 
const CRhinoPlugInInfoPlugInInfo () const
 
int PlugInLoadTime () const
 
CRhinoPlugIn::plugin_type PlugInType () const
 
const wchar_t * PlugInTypeString () const
 
UUID PlugInUUID () const
 
int PreviousPlugInLoadTime () const
 
const wchar_t * RegistryPath () const
 
void SetLoadProtection (int load_protection)
 

Static Public Member Functions

static const wchar_t * PlugInTypeString (CRhinoPlugIn::plugin_type type)
 

Protected Attributes

bool m_bAddToHelpMenu = false
 
bool m_bIsDotNETAndIsLoaded = false
 
bool m_bIsDotNETPlugIn = false
 
ON_ClassArray< CRhinoPlugInCommandRecordm_command_list
 
ON_ClassArray< CRhinoFileTypem_file_types
 
HINSTANCE m_hInstance = nullptr
 
int m_load_order = -1
 
int m_nLoadAttempts = 0
 
int m_nLoadMode = CRhinoPlugIn::load_plugin_when_needed
 
int m_nLoadProtection = 0
 
int m_nPreviousLoadMode = -1
 initialized to -1, set whenever the load mode value of a plug-in is written to the registry More...
 
int m_on_classid_mark = -1
 
CRhinoPlugInm_plug_in = nullptr
 
UUID m_plug_in_id = ON_nil_uuid
 
CRhinoPlugInInfo m_plug_in_info
 
CRhinoPlugIn::plugin_type m_type = CRhinoPlugIn::unknown_plugin_type
 
ON_wString m_wFileName
 
ON_wString m_wName
 
ON_wString m_wRegPath
 

Friends

class CPlugInManagerDlg
 
class CRhInstallPlugIn
 
class CRhPlugInManager
 

Detailed Description

This class is used to manage loaded and unloaded plug-ins.

Constructor & Destructor Documentation

◆ CRhinoPlugInRecord() [1/2]

CRhinoPlugInRecord::CRhinoPlugInRecord ( )

◆ CRhinoPlugInRecord() [2/2]

CRhinoPlugInRecord::CRhinoPlugInRecord ( const CRhinoPlugInRecord )

◆ ~CRhinoPlugInRecord()

CRhinoPlugInRecord::~CRhinoPlugInRecord ( )

Member Function Documentation

◆ AddCommand()

void CRhinoPlugInRecord::AddCommand ( const wchar_t *  lpsEnglishCommandName,
const wchar_t *  lpsLocalizedCommandName,
int  nFlags = 0 
)

Description: Add English and localized command names to appropriate list. Parameters: lpsEnglishCommandName - [in] English command name. lpsLocalizedCommandName - [in] Localized command name (may be same as English if not localized) nFlags - [in] See CRhinoCommand::m_cmd_flags for a description of flags.

◆ AddFileTypes()

void CRhinoPlugInRecord::AddFileTypes ( const wchar_t *  lpsDescr,
const wchar_t *  lpsExtensions 
)

Description: Add to list of file types associated with a CRhinoFileImport or CRhinoFileExport plug-in that is registered but not loaded. This is used by the Rhino file dialog when displaying file types. Parameters: lpsDescr - [in] File type description. lpsExtensions - [in] File extensions supported by this description.

◆ AddToHelpMenu()

bool CRhinoPlugInRecord::AddToHelpMenu ( ) const

Description: If the plug-in is loaded this will return the PlugIn()->AddToPlugInHelpMenu() otherwise it returns the value found in the registry. Returns: true If plug-in name is added to the Rhino Help/Plug-ins menu. See Also: CRhinoPlugIn::AddToPlugInHelpMenu()

◆ CommandRecordCount()

int CRhinoPlugInRecord::CommandRecordCount ( ) const

Description: Length of command list.

◆ ContainsCommandNamed()

bool CRhinoPlugInRecord::ContainsCommandNamed ( const wchar_t *  lpsCmdName,
bool  bEnglishCommandName 
) const

Description: Search list of registered command names for specified command name. This is used when looking for command names associated with a registered but unloaded plug-in. Parameters: lpsCmdName - [in] Command name to search for. bEnglishCommandName - [in] If true then look in the english command name list otherwise look in the localized command name list. Returns: true If command name found.

◆ Description()

const wchar_t* CRhinoPlugInRecord::Description ( ) const

Description: If the plug-in is loaded this will return PlugIn()->PlugInDescription(), otherwise it returns the plug-in description found in CRhinoPlugInInfo. Returns: Description of this plug-in. See Also: CRhinoPlugIn::PlugInDescription()

◆ EnglishCommandName()

const wchar_t* CRhinoPlugInRecord::EnglishCommandName ( int  nIndex) const

◆ EnglishName()

const wchar_t* CRhinoPlugInRecord::EnglishName ( ) const

Added by John Morse 17 February 2021 Description: If the plug-in is loaded this will return PlugIn()->PlugInName(), otherwise it returns the English plug-in name found in the registry. Returns: Name used to describe this plug-in. See Also: CRhinoPlugIn::PlugInName()

◆ FileName()

const wchar_t* CRhinoPlugInRecord::FileName ( ) const

Description: Full path to the plug-in file to load or the loaded file name. Returns: Full path to plug-in file.

◆ FileType()

const CRhinoFileType& CRhinoPlugInRecord::FileType ( int  index) const

Description: Used to iterate file type list. If invalid index is passed then a bogus, empty CRhinoFileType reference is returned. Returns: Length of file type list. See Also: CRhinoPlugInRecord::AddFileTypes() CRhinoFileType CRhinoFileImportPlugIn::AddFileType CRhinoFileExportPlugIn::AddFileType

◆ FileTypeCount()

int CRhinoPlugInRecord::FileTypeCount ( ) const

Description: Length of file type list associated with file import/export plug-in.

◆ FileTypes()

const ON_ClassArray<CRhinoFileType>& CRhinoPlugInRecord::FileTypes ( ) const

◆ GetCommandRecord()

const CRhinoPlugInCommandRecord* CRhinoPlugInRecord::GetCommandRecord ( int  nIndex) const

Description: Used to iterate list of registered commands associated with this plug-in. Returns: Pointer to a CRhinoPlugInCommandRecordif nIndex is valid otherwise NULL. Parameters: nIndex - [in] Zero based index of command to return. Value must be >= 0 and less than CommandRecordCount()

◆ Icon()

HICON CRhinoPlugInRecord::Icon ( const ON_2iSize size)

Description: If the plug-in is loaded this will return PlugIn()->PlugInIcon(), otherwise it create a new icon based on the resource id found in CRhinoPlugInInfo. Returns: The plug-in's icon. See Also: CRhinoPlugIn::PlugInIcon()

◆ Instance()

HINSTANCE CRhinoPlugInRecord::Instance ( ) const

Description: Instance handle for loaded Rhino RHP plug-in file. Returns: Instance handle for loaded Rhino RHP plug-in file or NULL if not loaded.

◆ IsDirectoryInstall()

bool CRhinoPlugInRecord::IsDirectoryInstall ( ) const

◆ IsDotNETPlugIn()

bool CRhinoPlugInRecord::IsDotNETPlugIn ( ) const

Description: Determine if the plug-in is a .NET plug-in or a C++ plug-in; Returns: true If plug-in is a .NET plug-in

◆ IsLoadDisabled()

bool CRhinoPlugInRecord::IsLoadDisabled ( ) const

Description: This will check to see if PlugInLoadTime() is set to CRhinoPlugIn::load_plugin_disabled Returns: True if plug-in is not currently loaded and PlugInLoadTime() == CRhinoPlugIn::load_plugin_disabled See Also: CRhinoPlugIn::plugin_load_time CRhinoPlugIn::PlugInLoadTime()

◆ IsLoaded()

bool CRhinoPlugInRecord::IsLoaded ( ) const

Description: Check to see if plug-in was successfully loaded. Returns: true If plug-in is currently loaded.

◆ IsShippingPlugIn()

bool CRhinoPlugInRecord::IsShippingPlugIn ( ) const

Is this plug-in one that ships with Rhino.

◆ LoadAttempted()

bool CRhinoPlugInRecord::LoadAttempted ( ) const

Description: Check to see if a previous attempt was made to load this plug-in. Returns: true If one or more attempts was made to load this plug-in.

◆ LoadAttemptedCount()

int CRhinoPlugInRecord::LoadAttemptedCount ( ) const

Description: Number of attempts made to load this plug-in.

◆ LoadOrder()

int CRhinoPlugInRecord::LoadOrder ( ) const

◆ LoadProtection()

int CRhinoPlugInRecord::LoadProtection ( ) const

◆ LocalizedCommandName()

const wchar_t* CRhinoPlugInRecord::LocalizedCommandName ( int  ) const

◆ Name()

const wchar_t* CRhinoPlugInRecord::Name ( ) const

Description: If the plug-in is loaded this will return PlugIn()->LocalPlugInName(), otherwise it returns the plug-in name found in the registry. Returns: Name used to describe this plug-in. See Also: CRhinoPlugIn::PlugInName()

◆ operator=()

const CRhinoPlugInRecord& CRhinoPlugInRecord::operator= ( const CRhinoPlugInRecord )

◆ PlugIn()

CRhinoPlugIn* CRhinoPlugInRecord::PlugIn ( ) const

Description: If this plug-in has been loaded this will be a pointer to the one and only CRhinoPlugIn... derived application object. Returns: Pointer to plug-in application object or NULL if the plug-in has not yet been loaded. See Also: CRhinoPlugIn

◆ PlugInInfo()

const CRhinoPlugInInfo& CRhinoPlugInRecord::PlugInInfo ( ) const

Description: This method is used to get information about the plug-in. Returns: Reference to a CRhinoPlugInInfo item which describes this plug-in. See Also: CRhinoPlugInInfo

◆ PlugInLoadTime()

int CRhinoPlugInRecord::PlugInLoadTime ( ) const

Description: If the plug-in is loaded this will return the PlugIn()->PlugInLoadTime() otherwise it returns the plug-in load time value found in the registry. Returns: load_plug-in_when_needed = Plug-in will not be loaded when Rhino starts. Plug-in will be loaded when a plug-in defined command is run or when a user selects a plug-in defined file import/export type. load_plug-in_at_startup = Plug-in is loaded when Rhino is loaded and initialized. See Also: CRhinoPlugIn::plugin_load_time CRhinoPlugIn::PlugInLoadTime()

◆ PlugInType()

CRhinoPlugIn::plugin_type CRhinoPlugInRecord::PlugInType ( ) const

Description: If the plug-in is loaded this will return the PlugIn()->PlugInType() otherwise it returns the plug-in type flag found in the registry. Returns: Returns CRhinoPlugIn::plug-in_type, see CRhinoPlugIn::plug-in_type for details. See Also: CRhinoPlugIn::plug-in_type CRhinoPlugIn::PlugInType()

◆ PlugInTypeString() [1/2]

const wchar_t* CRhinoPlugInRecord::PlugInTypeString ( ) const

Description: Get a localized description for PlugInType() associated with this record. Returns: Returns localized description for PlugInType() associated with this record. See Also: CRhinoPlugIn::plug-in_type CRhinoPlugIn::PlugInType()

◆ PlugInTypeString() [2/2]

static const wchar_t* CRhinoPlugInRecord::PlugInTypeString ( CRhinoPlugIn::plugin_type  type)
static

Description: Get a localized description for specified CRhinoPlugIn::plugin_type. Parameters: type - [in] Type of plug-in. Returns: Returns localized description for PlugInType() associated with this record. See Also: CRhinoPlugIn::plug-in_type CRhinoPlugIn::PlugInType()

◆ PlugInUUID()

UUID CRhinoPlugInRecord::PlugInUUID ( ) const

Description: If the plug-in is loaded this will return the PlugIn()->PlugInID() otherwise it returns the registry UUID key name. Returns: Reference to a unique plug-in UUID. See Also: CRhinoPlugIn::PlugInID()

◆ PreviousPlugInLoadTime()

int CRhinoPlugInRecord::PreviousPlugInLoadTime ( ) const
Deprecated:
Not used in Rhino

◆ RegistryPath()

const wchar_t* CRhinoPlugInRecord::RegistryPath ( ) const

Description: Complete registry path used to describe where the plug-in load information may be found. Returns: Full path to registry entry used to load the plug-in.

◆ SetLoadProtection()

void CRhinoPlugInRecord::SetLoadProtection ( int  load_protection)

Description: Lets you set load protection. This value is saved in the HKEY_CURRENT_USER section of the registry. and determines how the plug-in will load next time. This is NOT the way SAFEMODE prevents loading of plug-ins. Parameters: load_protection - [in] 0,1: silent load 2: query load - when the plug-in manager attempts to load the plug-in, a modal Yes/No message box pops up and asks the user if they want to load the plug-in. any other value: treated as 2.

Friends And Related Function Documentation

◆ CPlugInManagerDlg

friend class CPlugInManagerDlg
friend

◆ CRhInstallPlugIn

friend class CRhInstallPlugIn
friend

◆ CRhPlugInManager

friend class CRhPlugInManager
friend

Member Data Documentation

◆ m_bAddToHelpMenu

bool CRhinoPlugInRecord::m_bAddToHelpMenu = false
protected

◆ m_bIsDotNETAndIsLoaded

bool CRhinoPlugInRecord::m_bIsDotNETAndIsLoaded = false
protected

◆ m_bIsDotNETPlugIn

bool CRhinoPlugInRecord::m_bIsDotNETPlugIn = false
protected

◆ m_command_list

ON_ClassArray<CRhinoPlugInCommandRecord> CRhinoPlugInRecord::m_command_list
protected

◆ m_file_types

ON_ClassArray<CRhinoFileType> CRhinoPlugInRecord::m_file_types
protected

◆ m_hInstance

HINSTANCE CRhinoPlugInRecord::m_hInstance = nullptr
protected

◆ m_load_order

int CRhinoPlugInRecord::m_load_order = -1
protected

◆ m_nLoadAttempts

int CRhinoPlugInRecord::m_nLoadAttempts = 0
protected

◆ m_nLoadMode

int CRhinoPlugInRecord::m_nLoadMode = CRhinoPlugIn::load_plugin_when_needed
protected

◆ m_nLoadProtection

int CRhinoPlugInRecord::m_nLoadProtection = 0
protected

Added by Dale Lear 25 February 2004

In SDK's with RHINO_SDK_SERVICE_RELEASE >= 200402250. We need a way for Rhino to prevent loading of certain plug-ins that are known to cause trouble. The default load protection is 0. If a user decides a certain plug-in is causing trouble, they can use the plug-in manager to add load protection. The reason that both the 0 and 1 values mean silent loading is so that we don't waste time saving the default information in registry unless we are actually dealing with a plug-in where the user has explicitly changed the load protection.

0 = silently load - (default setting)
1 = silently load - (setting came from registry)
2 = query load (yes/no modal message box)

The PlugInManager command provides UI for changing setting the load protection to silent load or query load.

The non-default load permissions are stored in HKEY_CURRENT_USER...\Global Settings\Plug-ins<plug-in uuid>\LoadProtection so that ordinary users (non-administrators) can control loading of buggy plug-ins.

Use CRhinoPlugIn::SaveLoadProtectionToRegistry(plug-in_uuid,m_LoadProtection)

to save this value if it is ever changed.

ALERT - snotty comment follows: Because the CRhPlugInManager has become such a twisted pile of crap, this value has to be stored on 2 different classes: CRhinoPlugInRecord::m_nLoadProtection CRhinoInstallPlugIn::m_nLoadProtection and kept in sync. In V4 the information on these three similar classes will be stored in a SINGLE CLASS. There will be ONE instance of the class for each UNIQUE plug-in. The values on this new class will indicate the status of the plug-in. The settings on this class will be stored someplace that ordinary users have permission to write. End of rant.

Please discuss changes with Dale Lear.

◆ m_nPreviousLoadMode

int CRhinoPlugInRecord::m_nPreviousLoadMode = -1
protected

initialized to -1, set whenever the load mode value of a plug-in is written to the registry

◆ m_on_classid_mark

int CRhinoPlugInRecord::m_on_classid_mark = -1
protected

◆ m_plug_in

CRhinoPlugIn* CRhinoPlugInRecord::m_plug_in = nullptr
protected

◆ m_plug_in_id

UUID CRhinoPlugInRecord::m_plug_in_id = ON_nil_uuid
protected

◆ m_plug_in_info

CRhinoPlugInInfo CRhinoPlugInRecord::m_plug_in_info
protected

◆ m_type

CRhinoPlugIn::plugin_type CRhinoPlugInRecord::m_type = CRhinoPlugIn::unknown_plugin_type
protected

◆ m_wFileName

ON_wString CRhinoPlugInRecord::m_wFileName
protected

◆ m_wName

ON_wString CRhinoPlugInRecord::m_wName
protected

◆ m_wRegPath

ON_wString CRhinoPlugInRecord::m_wRegPath
protected

From registered but not loaded class