Rhino C++ API  8.14
Public Types | Public Member Functions | List of all members
CRhinoEventWatcher Class Reference

#include <rhinoSdkEventWatcher.h>

Inheritance diagram for CRhinoEventWatcher:
CRhRdkLightManagerSupport CRhRdkLightManagerSupport_BuiltIn

Public Types

enum  alias_event {
  alias_added, alias_deleted, alias_undeleted, alias_modified,
  alias_sorted, alias_current
}
 
enum  dimstyle_event {
  dimstyle_added, dimstyle_deleted, dimstyle_undeleted, dimstyle_modified,
  dimstyle_sorted, dimstyle_current
}
 
enum  event_id { event_id_none = 0, event_id_force_4byte_size = 0xFFFFFFFF }
 OBSOLETE - NEVER USE THIS. More...
 
enum  font_event {
  font_added, font_deleted, font_undeleted, font_modified,
  font_sorted, font_current
}
 
enum  group_event {
  group_added, group_deleted, group_undeleted, group_modified,
  group_sorted
}
 
enum  hatchpattern_event {
  hatchpattern_added, hatchpattern_deleted, hatchpattern_undeleted, hatchpattern_modified,
  hatchpattern_sorted, hatchpattern_current
}
 
enum  idef_event {
  idef_added, idef_deleted, idef_undeleted, idef_modified,
  idef_sorted
}
 
enum  layer_event {
  layer_added, layer_deleted, layer_undeleted, layer_modified,
  layer_sorted, layer_current
}
 
enum  light_event {
  light_added, light_deleted, light_undeleted, light_modified,
  light_sorted
}
 
enum  linetype_event {
  linetype_added, linetype_deleted, linetype_undeleted, linetype_modified,
  linetype_sorted, linetype_current
}
 
enum  material_event {
  material_added, material_deleted, material_undeleted, material_modified,
  material_sorted, material_current
}
 
enum  text_style_event : unsigned int {
  text_style_added, text_style_deleted, text_style_undeleted, text_style_modified,
  text_style_sorted, text_style_current
}
 
enum  texture_mapping_event {
  texture_mapping_added, texture_mapping_deleted, texture_mapping_undeleted, texture_mapping_modified,
  texture_mapping_sorted, texture_mapping_current
}
 
enum  undo_event {
  no_undo_event = 0, begin_recording, end_recording, begin_undo,
  end_undo, begin_redo, end_redo, before_begin_recording,
  before_end_recording, purge_record = 86
}
 

Public Member Functions

 CRhinoEventWatcher ()
 
 CRhinoEventWatcher (bool headlessDocAware, bool headlessAppAware)
 
virtual ~CRhinoEventWatcher ()
 
virtual void AliasTableEvent (CRhinoEventWatcher::alias_event event, const CRhinoAppAliasList &alias_table, int alias_index, const CRhinoCommandAlias *old_settings)
 
virtual int DeleteLayerCheck (CRhinoDoc &doc, ON_SimpleArray< int > &layer_index_list, bool bQuiet)
 
virtual void DimStyleTableEvent (CRhinoEventWatcher::dimstyle_event event, const CRhinoDimStyleTable &dimstyle_table, int dimstyle_index, const ON_DimStyle *old_settings)
 
void Enable (BOOL32 b=TRUE)
 
virtual void Event (event_id id, unsigned int iParam1, int iParam2, const void *ptrParam1, const void *ptrParam2)
 OBSOLETE - NEVER USE THIS. More...
 
virtual void GroupTableEvent (CRhinoEventWatcher::group_event event, const CRhinoGroupTable &group_table, int group_index, const ON_Group *old_settings)
 
virtual void HatchPatternTableEvent (CRhinoEventWatcher::hatchpattern_event event, const CRhinoHatchPatternTable &hatchpattern_table, int hatchpattern_index, const ON_HatchPattern *old_settings)
 
virtual void InstanceDefinitionTableEvent (CRhinoEventWatcher::idef_event event, const CRhinoInstanceDefinitionTable &idef_table, int idef_index, const ON_InstanceDefinition *old_settings)
 
bool IsEnabled () const
 
bool IsHeadlessAppAware () const
 
bool IsHeadlessDocAware () const
 
virtual void LayerTableEvent (CRhinoEventWatcher::layer_event event, const CRhinoLayerTable &layer_table, int layer_index, const ON_Layer *old_settings)
 
virtual void LightTableEvent (CRhinoEventWatcher::light_event event, const CRhinoLightTable &light_table, int light_index, const ON_Light *old_settings)
 
virtual void LinetypeTableEvent (CRhinoEventWatcher::linetype_event event, const CRhinoLinetypeTable &linetype_table, int linetype_index, const ON_Linetype *old_settings)
 
virtual void MaterialTableEvent (CRhinoEventWatcher::material_event event, const CRhinoMaterialTable &material_table, int material_index, const ON_Material *old_settings)
 
virtual void OnActiveDocumentChanged (CRhinoDoc *doc)
 
virtual void OnAddObject (CRhinoDoc &doc, CRhinoObject &object)
 
virtual void OnAppSettingsChanged (const CRhinoAppSettings &new_app_settings)
 
virtual void OnBeginCommand (const CRhinoCommand &command, const CRhinoCommandContext &context)
 
virtual void OnBeginOpenDocument (CRhinoDoc &doc, const wchar_t *filename, BOOL32 bMerge, BOOL32 bReference)
 
virtual void OnBeginSaveDocument (CRhinoDoc &doc, const wchar_t *filename, BOOL32 bExportSelected)
 
virtual void OnCloseDocument (CRhinoDoc &doc)
 
virtual void OnCloseRhino (class CRhinoApp &app)
 
virtual void OnCreateView (CRhinoView *rhino_view)
 
virtual void OnDeleteObject (CRhinoDoc &doc, CRhinoObject &object)
 
virtual void OnDeselectAllObjects (CRhinoDoc &doc, int count)
 
virtual void OnDeselectObject (CRhinoDoc &doc, const CRhinoObject &object)
 
virtual void OnDeselectObjects (CRhinoDoc &doc, const ON_SimpleArray< const CRhinoObject * > &objects)
 
virtual void OnDestroyView (CRhinoView *rhino_view)
 
virtual void OnDocumentPropertiesChanged (CRhinoDoc &doc)
 
virtual void OnEnableEventWatcher (BOOL32 b)
 
virtual void OnEndCommand (const CRhinoCommand &command, const CRhinoCommandContext &context, CRhinoCommand::result rc)
 
virtual void OnEndOpenDocument (CRhinoDoc &doc, const wchar_t *filename, BOOL32 bMerge, BOOL32 bReference)
 
virtual void OnEndSaveDocument (CRhinoDoc &doc, const wchar_t *filename, BOOL32 bExportSelected)
 
virtual void OnInitRhino (class CRhinoApp &app)
 
virtual void OnModifyObjectAttributes (CRhinoDoc &doc, CRhinoObject &object, const CRhinoObjectAttributes &old_attributes)
 
virtual void OnNewDocument (CRhinoDoc &doc)
 
virtual void OnObjectReplaced (unsigned int rhino_doc_serial_number, unsigned int deleted_object_sn, unsigned int added_object_sn)
 
virtual void OnPurgeObject (CRhinoDoc &doc, CRhinoObject &object)
 
virtual void OnRenameView (CRhinoView *rhino_view)
 
virtual void OnReplaceObject (CRhinoDoc &doc, CRhinoObject &old_object, CRhinoObject &new_object)
 
virtual void OnSelectObject (CRhinoDoc &doc, const CRhinoObject &object)
 
virtual void OnSelectObjects (CRhinoDoc &doc, const ON_SimpleArray< const CRhinoObject * > &objects)
 
virtual void OnSetActiveView (CRhinoView *rhino_view)
 
virtual void OnUnDeleteObject (CRhinoDoc &doc, CRhinoObject &object)
 
virtual void OnUnitsChangedWithScaling (CRhinoDoc &doc, double scale)
 
virtual void OnUpdateObjectMesh (CRhinoDoc &doc, CRhinoObject &object, ON::mesh_type mesh_type)
 
void Register ()
 
unsigned int SerialNumber () const
 
virtual void TextureMappingTableEvent (CRhinoEventWatcher::texture_mapping_event event, const CRhinoTextureMappingTable &texture_mapping_table, int texture_mapping_index, const ON_TextureMapping *old_settings)
 
virtual void UndoEvent (CRhinoEventWatcher::undo_event event, unsigned int undo_record_serialnumber, const CRhinoCommand *cmd)
 
void UnRegister ()
 

Detailed Description

Description: This class is a virtual base class that defines the interface for watching events in Rhino. If you want to watch one or more events, derive a class from CRhinoEventWatcher and override the virtual functions that correspond to the events you want to watch.

You will only be notified if your event watcher is registered and enabled. You must explicitly register your event watcher by calling Register() and then enable your event watcher by calling Enable(true).

Member Enumeration Documentation

◆ alias_event

Alias table events

Enumerator
alias_added 
alias_deleted 
alias_undeleted 
alias_modified 

name, color, etc., change

alias_sorted 

doc.m_alias_table.Sort() potentially changed sort order

alias_current 

◆ dimstyle_event

DimStyle table events

Enumerator
dimstyle_added 
dimstyle_deleted 
dimstyle_undeleted 
dimstyle_modified 

name, color, etc., change

dimstyle_sorted 

doc.m_dimstyle_table.Sort() potentially changed sort order

dimstyle_current 

current dim style change

◆ event_id

OBSOLETE - NEVER USE THIS.

Enumerator
event_id_none 
event_id_force_4byte_size 

This line insures that adding events will not change the size of the event_id.

◆ font_event

OBSOLETE

Enumerator
font_added 
font_deleted 
font_undeleted 
font_modified 
font_sorted 
font_current 

◆ group_event

Group table events

Enumerator
group_added 
group_deleted 
group_undeleted 
group_modified 

name, color, etc., change

group_sorted 

doc.m_group_table.Sort() potentially changed sort order

◆ hatchpattern_event

HatchPattern table events

Enumerator
hatchpattern_added 
hatchpattern_deleted 
hatchpattern_undeleted 
hatchpattern_modified 

name, color, etc., change

hatchpattern_sorted 

doc.m_hatchpattern_table.Sort() potentially changed sort order

hatchpattern_current 

current hatch pattern change

◆ idef_event

InstanceDefinition table events

Enumerator
idef_added 
idef_deleted 
idef_undeleted 
idef_modified 
idef_sorted 

doc.m_instance_definition_table.Sort() potentially changed sort order

◆ layer_event

/ Description: virtual void OnPreselectObjects();

virtual void OnPreselectObjects(); Layer table events

Enumerator
layer_added 
layer_deleted 
layer_undeleted 
layer_modified 
layer_sorted 

doc.m_layer_table.Sort() potentially changed sort order

layer_current 

current layer change

◆ light_event

Light table events

Enumerator
light_added 
light_deleted 
light_undeleted 
light_modified 
light_sorted 

doc.m_light_table.Sort() potentially changed sort order

◆ linetype_event

Linetype table events

Enumerator
linetype_added 
linetype_deleted 
linetype_undeleted 
linetype_modified 
linetype_sorted 

doc.m_linetype_table.Sort() potentially changed sort order

linetype_current 

current linetype change

◆ material_event

Material table events

Enumerator
material_added 
material_deleted 
material_undeleted 
material_modified 
material_sorted 

doc.m_material_table.Sort() potentially changed sort order

material_current 

current material change

◆ text_style_event

Font table events

OBSOLETE

Enumerator
text_style_added 
text_style_deleted 
text_style_undeleted 
text_style_modified 
text_style_sorted 
text_style_current 

◆ texture_mapping_event

TextureMapping table events

Enumerator
texture_mapping_added 
texture_mapping_deleted 
texture_mapping_undeleted 
texture_mapping_modified 
texture_mapping_sorted 

doc.m_texture_mapping_table.Sort() potentially changed sort order

texture_mapping_current 

current texture_mapping change

◆ undo_event

Enumerator
no_undo_event 
begin_recording 

Begin recording changes.

end_recording 
begin_undo 

Begin undoing a changes.

end_undo 
begin_redo 

Begin redoing a changes.

end_redo 
before_begin_recording 
before_end_recording 
purge_record 

Constructor & Destructor Documentation

◆ CRhinoEventWatcher() [1/2]

CRhinoEventWatcher::CRhinoEventWatcher ( )

◆ CRhinoEventWatcher() [2/2]

CRhinoEventWatcher::CRhinoEventWatcher ( bool  headlessDocAware,
bool  headlessAppAware 
)

Description: By default event watchers are not called for headless docs and headless app scenarios. Use this constructor if you want to make your event watcher be called for these headless cases. Note that there is a good chance that your event watcher can be called on a different thread than expected when dealing with "headless"

◆ ~CRhinoEventWatcher()

virtual CRhinoEventWatcher::~CRhinoEventWatcher ( )
virtual

Member Function Documentation

◆ AliasTableEvent()

virtual void CRhinoEventWatcher::AliasTableEvent ( CRhinoEventWatcher::alias_event  event,
const CRhinoAppAliasList alias_table,
int  alias_index,
const CRhinoCommandAlias old_settings 
)
virtual

Description: AliasTableEvent() is called whenever the alias table is changed.

Parameters: event - [in] type of event alias_table - [in] alias table alias_index - [in] index of alias If the event is alias_sorted, then alias_index is 0. old_settings - [in] If the event is alias_modified, then the old alias definition is passed here. Otherwise, this parameter is NULL.

◆ DeleteLayerCheck()

virtual int CRhinoEventWatcher::DeleteLayerCheck ( CRhinoDoc doc,
ON_SimpleArray< int > &  layer_index_list,
bool  bQuiet 
)
virtual

Description: Asks if a layers can be deleted. Parameters: layer_index_list - [in] indices of layers to be deleted. bQuiet - [in] If bQuiet is true, make a decision and set the return value accordingly.

If bQuiet is false and the plug-in cares, the plug-in should do something like the example.

Example:

    int CMyEventWatcher::DeleteLayerCheck(
                CRhinoDoc& doc,
                ON_SimpleArray<int>& layer_index_list, 
                bool bQuiet)
    {
      const int layer_index_count = layer_index_list.Count();
      int delete_count = 0;
      for ( int i = 0; i < layer_index_count; i++ )
      {
        const int layer_index = layer_index_list[i];

        if ( MyPlugInUsesLayer(layer_index) )
        {
          const CRhinoLayer& layer = doc.m_layer_table[layer_index];
          ON_wString msg;
          msg.Format(L"My plug-in uses layer %s. Do you really want to delete it?",
                     layer.LayerName());
          const int yn = ::RhinoYesNoMessageBox( 
                      msg, 
                      L"Delete Layer",
                      (1|2|4|8),  ///< Yes, Yes to All, No, No to All,
                      MB_ICONEXCLAMATION | MB_DEFBUTTON3);

          if( 1 == yn )
          {

/ yes delete_count++; continue; } if( 2 == yn ) { / yes to all delete_count += (layer_index_count-i); break; } if( 3 == yn ) { / no layer_index_list[i] = -1; continue; } if( 4 == yn ) { / no to all layer_index_list.SetCount(i); break; } } }

if ( 0 == delete_count ) return 0; if ( layer_index_count == delete_count ) return 1; return 2; }

Returns: 0 - Delete no layers 1 - Delete all layers in list 2 - Delete layers in layer_index_list[]

WARNING: Never modify the Rhino document in a DeleteLayerCheck() override. If you need to change the Rhino document or post update messages to controls, then your DeleteLayerCheck() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ DimStyleTableEvent()

virtual void CRhinoEventWatcher::DimStyleTableEvent ( CRhinoEventWatcher::dimstyle_event  event,
const CRhinoDimStyleTable dimstyle_table,
int  dimstyle_index,
const ON_DimStyle old_settings 
)
virtual

/ Description: / DimStyleTableEvent() is called whenever the dimstyle table is changed. / / Parameters: / event - [in] type of event / dimstyle_table - [in] dimstyle table / dimstyle_index - [in] index of dimstyle / If the event is dimstyle_sorted, then dimstyle_index is 0. / old_settings - [in] If the event is dimstyle_modified, / then the old dimstyle definition is passed here. / Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a DimStyleTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your DimStyleTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ Enable()

void CRhinoEventWatcher::Enable ( BOOL32  b = TRUE)

Description: You will only be notified if your event watcher is reistered and enabled. You must explicitly register and then enable your even watcher.

Parameters: b - [in] TRUE enables the event watcher and FALSE disables the event watcher.

Returns: TRUE if the event manager is registered and enabled.

Remarks: Enable() is fast and efficient. Use it when you need to repeatedly enable/disable your event watcher. Call UnRegister() when you are done watching events. See Also: CRhinoEventWatcher::Register();

◆ Event()

virtual void CRhinoEventWatcher::Event ( event_id  id,
unsigned int  iParam1,
int  iParam2,
const void *  ptrParam1,
const void *  ptrParam2 
)
virtual

OBSOLETE - NEVER USE THIS.

◆ GroupTableEvent()

virtual void CRhinoEventWatcher::GroupTableEvent ( CRhinoEventWatcher::group_event  event,
const CRhinoGroupTable group_table,
int  group_index,
const ON_Group old_settings 
)
virtual

/ Description: / GroupTableEvent() is called whenever the group table is changed. / / Parameters: / event - [in] type of event / group_table - [in] group table / group_index - [in] index of group / If the event is group_sorted, then group_index is 0. / old_settings - [in] If the event is group_modified, / then the old group definition is passed here. / Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a GroupTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your GroupTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ HatchPatternTableEvent()

virtual void CRhinoEventWatcher::HatchPatternTableEvent ( CRhinoEventWatcher::hatchpattern_event  event,
const CRhinoHatchPatternTable hatchpattern_table,
int  hatchpattern_index,
const ON_HatchPattern old_settings 
)
virtual

/ Description: / HatchPatternTableEvent() is called whenever the hatchpattern table is changed. / / Parameters: / event - [in] type of event / hatchpattern_table - [in] hatch pattern table / hatchpattern_index - [in] index of hatchpattern / If the event is hatchpattern_sorted, then hatchpattern_index is 0. / old_settings - [in] If the event is hatchpattern_modified, / then the old hatchpattern definition is passed here. / Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a HatchPatternTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your HatchPatternTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ InstanceDefinitionTableEvent()

virtual void CRhinoEventWatcher::InstanceDefinitionTableEvent ( CRhinoEventWatcher::idef_event  event,
const CRhinoInstanceDefinitionTable idef_table,
int  idef_index,
const ON_InstanceDefinition old_settings 
)
virtual

/ Description: / InstanceDefinitionTableEvent() is called whenever the idef table is changed. / / Parameters: / event - [in] type of event / idef_table - [in] instance definition table / idef_index - [in] index of idef / If the event is idef_sorted, then idef_index is 0. / old_settings - [in] If the event is idef_modified, / then the old idef definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a InstanceDefinitionTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your InstanceDefinitionTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ IsEnabled()

bool CRhinoEventWatcher::IsEnabled ( ) const

Description: You will only be notified if your event watcher is reistered and enabled. You must explicitly register and then enable your even watcher.

Returns: TRUE if the event manager is registered and enabled.

See Also: CRhinoEventWatcher::Register();

◆ IsHeadlessAppAware()

bool CRhinoEventWatcher::IsHeadlessAppAware ( ) const

◆ IsHeadlessDocAware()

bool CRhinoEventWatcher::IsHeadlessDocAware ( ) const

◆ LayerTableEvent()

virtual void CRhinoEventWatcher::LayerTableEvent ( CRhinoEventWatcher::layer_event  event,
const CRhinoLayerTable layer_table,
int  layer_index,
const ON_Layer old_settings 
)
virtual

/ Description: / LayerTableEvent() is called whenever the layer table is changed. / / Parameters: / event - [in] type of event / layer_table - [in] layer table / layer_index - [in] index of layer / If the event is layer_sorted, then layer_index is 0. / old_settings - [in] If the event is layer_modified, / then the old layer definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a LayerTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your LayerTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ LightTableEvent()

virtual void CRhinoEventWatcher::LightTableEvent ( CRhinoEventWatcher::light_event  event,
const CRhinoLightTable light_table,
int  light_index,
const ON_Light old_settings 
)
virtual

/ Description: / LightTableEvent() is called whenever the light table is changed. / / Parameters: / event - [in] type of event / light_table - [in] light table / light_index - [in] light of light / If the event is light_sorted, then light_index is 0. / old_settings - [in] If the event is light_modified, / then the old light definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a LightTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your LightTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ LinetypeTableEvent()

virtual void CRhinoEventWatcher::LinetypeTableEvent ( CRhinoEventWatcher::linetype_event  event,
const CRhinoLinetypeTable linetype_table,
int  linetype_index,
const ON_Linetype old_settings 
)
virtual

/ Description: / LinetypeTableEvent() is called whenever the linetype table is changed. / / Parameters: / event - [in] type of event / linetype_table - [in] linetype table / linetype_index - [in] index of linetype / If the event is linetype_sorted, then linetype_index is 0. / old_settings - [in] If the event is linetype_modified, / then the old linetype definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a LinetypeTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your LinetypeTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ MaterialTableEvent()

virtual void CRhinoEventWatcher::MaterialTableEvent ( CRhinoEventWatcher::material_event  event,
const CRhinoMaterialTable material_table,
int  material_index,
const ON_Material old_settings 
)
virtual

/ Description: / MaterialTableEvent() is called whenever the material table is changed. / / Parameters: / event - [in] type of event / material_table - [in] material table / material_index - [in] index of material / If the event is material_sorted, then material_index is 0. / old_settings - [in] If the event is material_modified, / then the old material definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a MaterialTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your MaterialTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnActiveDocumentChanged()

virtual void CRhinoEventWatcher::OnActiveDocumentChanged ( CRhinoDoc doc)
virtual

Description: Called when the active document changes. Parameters: doc - [in] The new current document or null if no documents are currently open.

◆ OnAddObject()

virtual void CRhinoEventWatcher::OnAddObject ( CRhinoDoc doc,
CRhinoObject object 
)
virtual

Object events / Description: / Called if a new object is added to the document. / / Parameters: / doc - [in] object's document / object - [in] new object WARNING: Never modify the Rhino document in a OnAddObject() override. If you need to change the Rhino document or post update messages to controls, then your OnAddObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnAppSettingsChanged()

virtual void CRhinoEventWatcher::OnAppSettingsChanged ( const CRhinoAppSettings new_app_settings)
virtual

Description: Called after a value in CRhinoApp::AppSettings() changes. WARNING: Never modify the Rhino document in a OnAppSettingsChanged() override. If you need to change the Rhino document or post update messages to controls, then your OnAppSettingsChanged() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnBeginCommand()

virtual void CRhinoEventWatcher::OnBeginCommand ( const CRhinoCommand command,
const CRhinoCommandContext context 
)
virtual

/ Description: / Called just before command.RunCommand(). WARNING: Never modify the Rhino document in a OnBeginCommand() override. If you need to change the Rhino document or post update messages to controls, then your OnBeginCommand() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnBeginOpenDocument()

virtual void CRhinoEventWatcher::OnBeginOpenDocument ( CRhinoDoc doc,
const wchar_t *  filename,
BOOL32  bMerge,
BOOL32  bReference 
)
virtual

WARNING: Never modify the Rhino document in an OnBeginOpenDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnBeginOpenDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnBeginSaveDocument()

virtual void CRhinoEventWatcher::OnBeginSaveDocument ( CRhinoDoc doc,
const wchar_t *  filename,
BOOL32  bExportSelected 
)
virtual

WARNING: Never modify the Rhino document in an OnBeginSaveDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnBeginSaveDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnCloseDocument()

virtual void CRhinoEventWatcher::OnCloseDocument ( CRhinoDoc doc)
virtual

Document events WARNING: Never modify the Rhino document in an OnCloseDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnCloseDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnCloseRhino()

virtual void CRhinoEventWatcher::OnCloseRhino ( class CRhinoApp app)
virtual

/ Description: / Called when Rhino stops. / / Parameters: / app - [in] instance of Rhino begin closed. WARNING: Never modify the Rhino document in an OnCloseRhino() override. If you need to change the Rhino document or post update messages to controls, then your OnCloseRhino() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnCreateView()

virtual void CRhinoEventWatcher::OnCreateView ( CRhinoView rhino_view)
virtual

View events WARNING: Never modify the Rhino document in a view event override. If you need to change the Rhino document or post update messages to controls, then your view event override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnDeleteObject()

virtual void CRhinoEventWatcher::OnDeleteObject ( CRhinoDoc doc,
CRhinoObject object 
)
virtual

/ Description: / Called if an object is deleted. At some later point / the object can be un-deleted. / / Parameters: / doc - [in] object's document / object - [in] object that was deleted. WARNING: Never modify the Rhino document in a OnDeleteObject() override. If you need to change the Rhino document or post update messages to controls, then your OnDeleteObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnDeselectAllObjects()

virtual void CRhinoEventWatcher::OnDeselectAllObjects ( CRhinoDoc doc,
int  count 
)
virtual

/ Description: / Called if a all objects are begin deselected. / / Parameters: / doc - [in] object's document / count - [in] number of object's that were deselected. WARNING: Never modify the Rhino document in a OnDeselectAllObjects() override. If you need to change the Rhino document or post update messages to controls, then your OnDeselectAllObjects() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnDeselectObject()

virtual void CRhinoEventWatcher::OnDeselectObject ( CRhinoDoc doc,
const CRhinoObject object 
)
virtual

/ Description: / Called if an object is being deselected. / / Parameters: / doc - [in] object's document / object - [in] object that was deselected. / / Remarks: / If all objects are being deselected, then / a single notification is sent to / OnDeselectAllObjects. WARNING: Never modify the Rhino document in a OnDeselectObject() override. If you need to change the Rhino document or post update messages to controls, then your OnDeselectObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnDeselectObjects()

virtual void CRhinoEventWatcher::OnDeselectObjects ( CRhinoDoc doc,
const ON_SimpleArray< const CRhinoObject * > &  objects 
)
virtual

/ Description: / Called when a collection of objects is deselected. / / Parameters: / doc - [in] object's document / objects - [in] object that were deselected WARNING: Never modify the Rhino document in a OnDeselectObjects() override. If you need to change the Rhino document or post update messages to controls, then your OnDeselectObjects() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnDestroyView()

virtual void CRhinoEventWatcher::OnDestroyView ( CRhinoView rhino_view)
virtual

◆ OnDocumentPropertiesChanged()

virtual void CRhinoEventWatcher::OnDocumentPropertiesChanged ( CRhinoDoc doc)
virtual

WARNING: Never modify the Rhino document in an OnDocumentPropertiesChanged() override. If you need to change the Rhino document or post update messages to controls, then your OnDocumentPropertiesChanged() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnEnableEventWatcher()

virtual void CRhinoEventWatcher::OnEnableEventWatcher ( BOOL32  b)
virtual

Description: Called when this event watcher is enabled/disabled.

Parameters: b - [in] TRUE means event watcher is being enabled.

Remarks: For advanced users.

◆ OnEndCommand()

virtual void CRhinoEventWatcher::OnEndCommand ( const CRhinoCommand command,
const CRhinoCommandContext context,
CRhinoCommand::result  rc 
)
virtual

/ Description: / Called immediately after command.RunCommand(). WARNING: Never modify the Rhino document in a OnEndCommand() override. If you need to change the Rhino document or post update messages to controls, then your OnEndCommand() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnEndOpenDocument()

virtual void CRhinoEventWatcher::OnEndOpenDocument ( CRhinoDoc doc,
const wchar_t *  filename,
BOOL32  bMerge,
BOOL32  bReference 
)
virtual

WARNING: Never modify the Rhino document in an OnEndOpenDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnEndOpenDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnEndSaveDocument()

virtual void CRhinoEventWatcher::OnEndSaveDocument ( CRhinoDoc doc,
const wchar_t *  filename,
BOOL32  bExportSelected 
)
virtual

WARNING: Never modify the Rhino document in an OnEndSaveDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnEndSaveDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnInitRhino()

virtual void CRhinoEventWatcher::OnInitRhino ( class CRhinoApp app)
virtual

Application events / Description: / Called when Rhino starts. / / Parameters: / app - [in] instance of Rhino begin started. WARNING: Never modify the Rhino document in an OnInitRhino() override. If you need to change the Rhino document or post update messages to controls, then your OnInitRhino() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnModifyObjectAttributes()

virtual void CRhinoEventWatcher::OnModifyObjectAttributes ( CRhinoDoc doc,
CRhinoObject object,
const CRhinoObjectAttributes old_attributes 
)
virtual

/ Description: / Called if an object's attributes change. / / Parameters: / doc - [in] object's document / object - [in] object whose attributes were changed. The new / attributes are object.Attributes(). / old_attributes - [in] attributes before the change. WARNING: Never modify the Rhino document in a OnModifyObjectAttributes() override. If you need to change the Rhino document or post update messages to controls, then your OnModifyObjectAttributes() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnNewDocument()

virtual void CRhinoEventWatcher::OnNewDocument ( CRhinoDoc doc)
virtual

WARNING: Never modify the Rhino document in an OnNewDocument() override. If you need to change the Rhino document or post update messages to controls, then your OnNewDocument() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnObjectReplaced()

virtual void CRhinoEventWatcher::OnObjectReplaced ( unsigned int  rhino_doc_serial_number,
unsigned int  deleted_object_sn,
unsigned int  added_object_sn 
)
virtual

Description: When an object is replaced by calling CRhinoDoc::ReplaceObject(), the following CRhinoEventWatcher event notifications are sent:

CRhinoEventWatcher::OnReplaceObject(doc,objA,objB)

If the object being replace is selected, then a CRhinoEventWatcher::OnDeselectObject(objA) notification occurs.

CRhinoEventWatcher::OnDeleteObject(objA)

If a new object is being added, then a CRhinoEventWatcher::OnAddObject objB) notification occurs. If a previous relace object is being undone, then a CRhinoEventWatcher::OnUndeleteObject (objB) occurs.

If the object being replace is selected, then a CRhinoEventWatcher::OnSelectObject(objB) notification occurs

CRhinoEventWatcher::OnObjectReplaced(doc,objA,objB)

Parameters: rhino_doc_serial_number - [in] Serial number of the document. Use CRhinoDoc::FromRuntimeSerialNumber(rhino_doc_serial_number) to get a pointer to the document. Always check for nullptr before dereferencing the returned value. Never modify the document in the callback.

deleted_object_sn - [in] The value of the deleted object's CRhinoObject.RuntimeSerialNumber(). Depending on Rhino application state and settings, this object may no longer exist or may continue to exist for an undetermined duration to permit a possible future undo operation. Use CRhinoObjec::FromRuntimeSerialNumber( rhino_doc_serial_number, deleted_object_sn ) to get a pointer to the object. Always check for nullptr before dereferencing the returned value. Never modify this object.

added_object_sn - [in] The value of the new object's CRhinoObject.RuntimeSerialNumber() Use CRhinoObjec::FromRuntimeSerialNumber( rhino_doc_serial_number, added_object_sn ) to get a pointer to the object. Always check for nullptr before dereferencing the returned value. Never modify this object.

static const CRhinoObject* FromRuntimeSerialNumber( unsigned int rhino_doc_runtime_serial_number, unsigned int rhino_object_runtime_serial_number );

WARNING: Never modify any object or other Rhino document values in a OnObjectReplaced() override. If you need to change the Rhino document or post update messages to controls, then your OnObjectReplaced() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnPurgeObject()

virtual void CRhinoEventWatcher::OnPurgeObject ( CRhinoDoc doc,
CRhinoObject object 
)
virtual

/ Description: / Called if an object is begin purged from a document. / The object will cease to exist forever. / / Parameters: / doc - [in] object's document / object - [in] object to be purged. WARNING: Never modify the Rhino document in a OnPurgeObject() override. If you need to change the Rhino document or post update messages to controls, then your OnPurgeObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnRenameView()

virtual void CRhinoEventWatcher::OnRenameView ( CRhinoView rhino_view)
virtual

◆ OnReplaceObject()

virtual void CRhinoEventWatcher::OnReplaceObject ( CRhinoDoc doc,
CRhinoObject old_object,
CRhinoObject new_object 
)
virtual

Description: Called if an object is about to be replaced.

Parameters: doc - [in] object's document old_object - [in] existing object - about to be deleted. At the time OnReplaceObject() is called, old_object has not been deleted. new_object - [in] new object - about to be added. At the time OnReplaceObject() is called, new_object has not been added to doc.

Remarks: If both CRhinoDoc::UndoActive() or CRhinoDoc::RedoActive() are false, then immediatedly after OnReplaceObject(doc,old_object,new_object) is called there will be a call to OnDeleteObject(doc,old_object) and then a call to OnAddObject(doc,new_object).

If either CRhinoDoc::UndoActive() and CRhinoDoc::RedoActive() are true, then immediatedly after OnReplaceObject(doc,old_object,new_object) is called there will be a call to OnDeleteObject(doc,old_object) and then a call to OnUnDeleteObject(doc,new_object).

WARNING: Never modify the Rhino document in a OnReplaceObject() override. If you need to change the Rhino document or post update messages to controls, then your OnReplaceObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnSelectObject()

virtual void CRhinoEventWatcher::OnSelectObject ( CRhinoDoc doc,
const CRhinoObject object 
)
virtual

/ Description: / Called if an object is being selected. / Note, the seletion of grip objects will not trigger this event. / Grips selection is ignored, as these objects are transient and / are often deleted shortly after selection and deselection. / If you must be notified when grip objects are selected, use the / CRhinoOnChangeObjectSelectState class. / / Parameters: / doc - [in] object's document / object - [in] object to be purged. WARNING: Never modify the Rhino document in a OnSelectObject() override. If you need to change the Rhino document or post update messages to controls, then your OnSelectObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnSelectObjects()

virtual void CRhinoEventWatcher::OnSelectObjects ( CRhinoDoc doc,
const ON_SimpleArray< const CRhinoObject * > &  objects 
)
virtual

/ Description: / Called when a collection of objects is selected. / Note, the seletion of grip objects will not trigger this event. / Grips selection is ignored, as these objects are transient and / are often deleted shortly after selection and deselection. / If you must be notified when grip objects are selected, use the / CRhinoOnChangeObjectSelectState class. / / Parameters: / doc - [in] object's document / objects - [in] objects that were selected WARNING: Never modify the Rhino document in a OnSelectObjects() override. If you need to change the Rhino document or post update messages to controls, then your OnSelectObjects() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ OnSetActiveView()

virtual void CRhinoEventWatcher::OnSetActiveView ( CRhinoView rhino_view)
virtual

◆ OnUnDeleteObject()

virtual void CRhinoEventWatcher::OnUnDeleteObject ( CRhinoDoc doc,
CRhinoObject object 
)
virtual

/ Description: / Called if an object is un-deleted. / / Parameters: / doc - [in] object's document / object - [in] object tha was deleted and is now active. WARNING: Never modify the Rhino document in a OnUnDeleteObject() override. If you need to change the Rhino document or post update messages to controls, then your OnUnDeleteObject() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

Reimplemented in CRhRdkLightManagerSupport.

◆ OnUnitsChangedWithScaling()

virtual void CRhinoEventWatcher::OnUnitsChangedWithScaling ( CRhinoDoc doc,
double  scale 
)
virtual

Description: Called when a change in the model units results in a scaling operation on all of the objects in the document. This call is made before any of the objects are scaled. A call to OnDocumentPropertiesChanged follows.

◆ OnUpdateObjectMesh()

virtual void CRhinoEventWatcher::OnUpdateObjectMesh ( CRhinoDoc doc,
CRhinoObject object,
ON::mesh_type  mesh_type 
)
virtual

Description: Called if the object's render mesh or analysis mesh is updated. Parameters: doc - [in] object's document object - [in] object whose mesh was updated. The new mesh is attached to the object. mesh_type - [in] type of mesh (ON::render_mesh or ON::analysis_mesh)

WARNING: Never modify the Rhino document in a OnUpdateObjectMesh() override. If you need to change the Rhino document or post update messages to controls, then your OnUpdateObjectMesh() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ Register()

void CRhinoEventWatcher::Register ( )

Description: Adds event watcher to Rhino.

Example: class CMyEventWatcher : public CRhinoEventWatcher { ... } ... CMyEventWatcher* pEyes = new CMyEventWatcher(); ... pEyes->Register();

pEyes->Enable(TRUE); ... pEyes->Enable(FALSE); ... pEyes->Enable(TRUE); ... pEyes->Enable(FALSE); ...

pEyes->UnRegister();

Returns: TRUE if registration succeeds.

Remarks: Registration is computationally expensive and should be done sparingly. Enable is fast and can be used to quickly enable/disable an event watcher.

◆ SerialNumber()

unsigned int CRhinoEventWatcher::SerialNumber ( ) const

Description: Each instance of a CRhinoEventWatcher gets a unique runtime serial number to prevent multiple registrations.

◆ TextureMappingTableEvent()

virtual void CRhinoEventWatcher::TextureMappingTableEvent ( CRhinoEventWatcher::texture_mapping_event  event,
const CRhinoTextureMappingTable texture_mapping_table,
int  texture_mapping_index,
const ON_TextureMapping old_settings 
)
virtual

/ Description: / TextureMappingTableEvent() is called whenever the texture_mapping table is changed. / / Parameters: / event - [in] type of event / texture_mapping_table - [in] texture_mapping table / texture_mapping_index - [in] index of texture_mapping / If the event is texture_mapping_sorted, then texture_mapping_index is 0. / old_settings - [in] If the event is texture_mapping_modified, / then the old texture_mapping definition is / passed here. Otherwise, this parameter is NULL. / WARNING: Never modify the Rhino document in a TextureMappingTableEvent() override. If you need to change the Rhino document or post update messages to controls, then your TextureMappingTableEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ UndoEvent()

virtual void CRhinoEventWatcher::UndoEvent ( CRhinoEventWatcher::undo_event  event,
unsigned int  undo_record_serialnumber,
const CRhinoCommand cmd 
)
virtual

Description: Used to monitor Rhino's built in undo/redo support.

Parameters: undo_event - [in] Reports what is happening: undo_record_serialnumber - [in] Runtime serial number of the undo event cmd - [in] (can be NULL) If not NULL, this is the command whose activity is being recorded for possible undo. Remarks: "86" is restaurant slang for "nix" http://www.restaurantreport.com/qa/86d.html

WARNING: Never modify the Rhino document in a UndoEvent() override. If you need to change the Rhino document or post update messages to controls, then your UndoEvent() override should record what happened in an efficient way and then make any changes that are required in a CRhinoIsIdle.Notify() override.

◆ UnRegister()

void CRhinoEventWatcher::UnRegister ( )

Description: Removes event watcher from Rhino.

Remarks: Registration is computationally expensive and should be done sparingly. Enable is fast and can be used to quickly enable/disable an event watcher.

See Also: CRhinoEventWatcher::Register();