////////////////////////////////////////////////////////////////////////////////
//
// gayka.h -    Visual C++ -  
//
////////////////////////////////////////////////////////////////////////////////
#ifndef __GAYKA_H
#define __GAYKA_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __CPAR_H
#include "CPar.h"
#endif

//-------------------------------------------------------------------------------
//    5915
// ---
struct G5915Flags {
  bool isp       : 1; // FALSE -  1,            TRUE -  2
  bool pitch     : 1; // FALSE -  ,             TRUE -  
  bool pitch_on  : 1; // FALSE -    , TRUE -      
  bool key_s     : 1; // FALSE -    , TRUE -    ,  
  bool key_s_on  : 1; // FALSE -  "   "
};

//-------------------------------------------------------------------------------
//    5915
// ---
struct GAYKA5915
{
  float	dr;             //    
  float	s;              //   ()
	float	D;              //    
  float	da;             //   
  float	h;              //  
  float	d2;
  float	p;              //    
  short	classAccuracy;  //  
  float	hatchAngle;     //    
  float	hatchStep;      //  
  short	version;        //  
  float	massa;          // 
  short	indexMassa;     // 0 - , 1 -  , 2 - 
  union {
    uint8      iFlags;    
    G5915Flags flags;   //   
  };
  GAYKA5915() { memset(&dr, 0, sizeof(GAYKA5915) ); } 
};

////////////////////////////////////////////////////////////////////////////////
//
//    5915
//
////////////////////////////////////////////////////////////////////////////////
class Gayka5915: public CPar 
{
protected :
  GAYKA5915			 m_paramGayka;   //    5915
  
public :

  Gayka5915( reference ref = 0 );
  Gayka5915( Gayka5915& other ); 

  void      InitParam(); 
  void		  Assign( Gayka5915& other );      // 

	GAYKA5915&	GetParamGayka() { return m_paramGayka; } //   
 
  void			Gayka_Sverhu( bool appl );                 //    (  )
  void			Gayka_P_K( int j, bool appl );	           //    ( -/- )

//*******************   *****************************
  //       
  virtual  bool      OpenBase();    //  
//  virtual  void      CloseBase();   //  

  virtual  void      GetGroup();        //   
                                        //    -  
  virtual  int       Size() { return CPar::Size() + sizeof(GAYKA5915); } //  
  virtual  bool     _EditSpcObj();      //   
  //        -  
  //          CfgDlg
  virtual  bool      IsSpcGostSection() { return true;  }

  //    -:       

  //        -  
  virtual  double    AttrNumber();

  virtual  double    HatchAngle() { return m_paramGayka.hatchAngle; } 
  virtual  double    HatchStep() { return m_paramGayka.hatchStep; } 
  virtual  void      SetHatchAngle(double hatch ) { m_paramGayka.hatchAngle = (float)hatch; }                     //  
  virtual  void      SetHatchStep(double step ) { m_paramGayka.hatchStep = (float) step;}                      //  
  // (  )
  //           true  
  virtual  bool      IsHatchObject() { return true; }
  // true -     
  virtual  bool      IsSpcObjCreate() { return true;}; //      
  virtual  void      ShowParam();

//******************************************************************************

// HOT_POINTS ##################################################################
  //   Hot 
  /* ILibHPObject */            
  virtual bool GetHotPoints( HotPointDescription* point, int index ); //   Hot 
  virtual bool SetHotPoint( HotPointDescription* point, int index );  //   Hot 
  virtual bool GetCursorText( int index, char** text );               //   Hot 
  virtual bool ExecuteCommand( int id );                              //  
  virtual bool EditComplete( int index, BOOL success );               //     ,    
  virtual bool Prepare();
  virtual int  GetMenu(int index = -1 );                                             // 
  virtual bool ChangeHotPointParam( double d );                       //   Hot 

  /* ILibHPObject1 */            
  virtual bool GetHotPointsEx( HotPointDescription1* point, int index ); //   Hot 
//  K10   virtual bool GetViewData( HotPointDescription1 * point, int index );
  virtual LPOLESTR GetCursorTextEx ( int index );
  virtual bool     UpdateCommand   ( int id    );                            
  virtual bool     SelectHotPoint  ( int index );
  virtual bool     UnselectHotPoint( int index );
// HOT_POINTS ##################################################################
//   ##################################################################
    //      
    // prButtonClick -  .
  virtual bool OnButtonClick( long buttonID );
    
    //prChangeControlValue -   
  virtual bool OnChangeControlValue( /*IPropertyControl* cntrl,*/ long ctrlID, const VARIANT& newVal );

//    //prControlCommand   
//  virtual bool OnControlCommand(LPUNKNOWN  ctrl);

//    //prButtonUpdate        -    .
//  virtual bool OnButtonUpdate(long buttonID, long* check, BOOL* _enable);
          //    
  
  //     
  virtual void  ShowControls();
  //  
  virtual void  RedrawPreview();
  //      
  virtual int   ParamCount() { return 4; }
//   ##################################################################
  
};


//-------------------------------------------------------------------------------
//  
// ---
//    (   )
void Gayka_K_Side  ( float ls, float s, float D, float d2, float H, int j, int j2, bool appl );
//    (  -  )
void Gayka_K_Y     ( float ls, GAYKA5915 *tmp, int j, bool appl );
//    (  )
void Gayka_K       ( float ls, float l, float d1, float s, float l1, float H, short j, int j1, float d2, int j2, bool appl );
//    
LPTSTR LoadStr     ( int id );           

//                    
bool OpenGaykaBase ( SimpleBase &base );  
//                                  
bool ReadGaykaBase ( float d, SimpleBase &base, GAYKA5915 *pGayka );  
//   
void CloseGaykaBase( SimpleBase &base );                           

//-------------------------------------------------------------------------------
// 
// ---
//  K10 extern AFX_EXTENSION_MODULE StepDLL;

//CPar* NewGayka5915( reference obj );

#endif // !defined(__GAYKA_H)
