<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkInteractorStyle.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 1993-2002 <NAME>, <NAME>, <NAME> 
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkInteractorStyle.h"

#include "vtkActor.h"
#include "vtkActor2D.h"
#include "vtkAssemblyNode.h"
#include "vtkAssemblyPath.h"
#include "vtkCallbackCommand.h"
#include "vtkCellPicker.h"
#include "vtkMath.h" 
#include "vtkObjectFactory.h"
#include "vtkOldStyleCallbackCommand.h"
#include "vtkOutlineSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkProperty2D.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkTextProperty.h"

vtkCxxRevisionMacro(vtkInteractorStyle, "1.86");
vtkStandardNewMacro(vtkInteractorStyle);

//----------------------------------------------------------------------------
vtkInteractorStyle::vtkInteractorStyle() 
{
  this->State               = VTKIS_NONE;
  this->AnimState           = VTKIS_ANIM_OFF; 

  this->HandleObservers     = 1;
  this->UseTimers           = 0;

  this->AutoAdjustCameraClippingRange = 1;
  
  this->Interactor          = NULL;

  this->EventCallbackCommand->SetCallback(vtkInteractorStyle::ProcessEvents);

  // These widgets are not activated with a key

  this->KeyPressActivation  = 0; 

  this->CurrentRenderer     = NULL;

  this->Outline             = vtkOutlineSource::New();
  this->OutlineActor        = NULL;
  this->OutlineMapper       = vtkPolyDataMapper::New();

  this->OutlineMapper->SetInput(this->Outline->GetOutput());

  this->PickedRenderer      = NULL;
  this->CurrentProp         = NULL;
  this->PropPicked          = 0;

  this->PickColor[0]        = 1.0; 
  this->PickColor[1]        = 0.0; 
  this->PickColor[2]        = 0.0;
  this->PickedActor2D       = NULL;

  this->LeftButtonPressTag            = 0;
  this->LeftButtonReleaseTag          = 0;
  this->MiddleButtonPressTag          = 0;
  this->MiddleButtonReleaseTag        = 0;
  this->RightButtonPressTag           = 0;
  this->RightButtonReleaseTag         = 0;
}

//----------------------------------------------------------------------------
vtkInteractorStyle::~vtkInteractorStyle()
{
  // Remove observers

  this->SetInteractor(0);

  if ( this->OutlineActor ) 
    {
    // If we change style when an object is selected, we must remove the
    // actor from the renderer
    if (this->CurrentRenderer) 
      {
      this->CurrentRenderer->RemoveActor(this->OutlineActor);
      }
    this->OutlineActor->Delete();
    }

  if ( this->OutlineMapper ) 
    {
    this->OutlineMapper->Delete();
    }
  this->Outline->Delete();
  this->Outline = NULL;

  if ( this->CurrentRenderer)
    {
    this->CurrentRenderer->UnRegister(this);
    this->CurrentRenderer = NULL;
    }
}

//----------------------------------------------------------------------------<commit_msg>FIX: CurrentRenderer is was switched to ref-counted, but the rest of the code was not updated: potential leak<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkInteractorStyle.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 1993-2002 <NAME>, <NAME>, <NAME> 
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkInteractorStyle.h"

#include "vtkActor.h"
#include "vtkActor2D.h"
#include "vtkAssemblyNode.h"
#include "vtkAssemblyPath.h"
#include "vtkCallbackCommand.h"
#include "vtkCellPicker.h"
#include "vtkMath.h" 
#include "vtkObjectFactory.h"
#include "vtkOldStyleCallbackCommand.h"
#include "vtkOutlineSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkProperty2D.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkTextProperty.h"

vtkCxxRevisionMacro(vtkInteractorStyle, "1.87");
vtkStandardNewMacro(vtkInteractorStyle);

//----------------------------------------------------------------------------
vtkInteractorStyle::vtkInteractorStyle() 
{
  this->State               = VTKIS_NONE;
  this->AnimState           = VTKIS_ANIM_OFF; 

  this->HandleObservers     = 1;
  this->UseTimers           = 0;

  this->AutoAdjustCameraClippingRange = 1;
  
  this->Interactor          = NULL;

  this->EventCallbackCommand->SetCallback(vtkInteractorStyle::ProcessEvents);

  // These widgets are not activated with a key

  this->KeyPressActivation  = 0; 

  this->Outline             = vtkOutlineSource::New();
  this->OutlineActor        = NULL;
  this->OutlineMapper       = vtkPolyDataMapper::New();

  this->OutlineMapper->SetInput(this->Outline->GetOutput());

  this->PickedRenderer      = NULL;
  this->CurrentProp         = NULL;
  this->PropPicked          = 0;

  this->PickColor[0]        = 1.0; 
  this->PickColor[1]        = 0.0; 
  this->PickColor[2]        = 0.0;
  this->PickedActor2D       = NULL;

  this->LeftButtonPressTag            = 0;
  this->LeftButtonReleaseTag          = 0;
  this->MiddleButtonPressTag          = 0;
  this->MiddleButtonReleaseTag        = 0;
  this->RightButtonPressTag           = 0;
  this->RightButtonReleaseTag         = 0;
}

//----------------------------------------------------------------------------
vtkInteractorStyle::~vtkInteractorStyle()
{
  // Remove observers

  this->SetInteractor(0);

  if ( this->OutlineActor ) 
    {
    // If we change style when an object is selected, we must remove the
    // actor from the renderer
    if (this->CurrentRenderer) 
      {
      this->CurrentRenderer->RemoveActor(this->OutlineActor);
      }
    this->OutlineActor->Delete();
    }

  if ( this->OutlineMapper ) 
    {
    this->OutlineMapper->Delete();
    }
  this->Outline->Delete();
  this->Outline = NULL;

  this->SetCurrentRenderer(NULL);
}

//----------------------------------------------------------------------------
{'fraction_non_alphanumeric': 0.21778042959427207, 'fraction_numerical': 0.010441527446300716, 'mean_word_length': 2.4903695991671007, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3690867', 'n_tokens_mistral': 2050, 'n_tokens_neox': 1926, 'n_words': 393}