// gayka.h : main header file for the GAYKA DLL
//

#if !defined(AFX_GAYKA_H__E5BADD45_D4CD_11D4_BF5E_0050BADBD5F5__INCLUDED_)
#define AFX_GAYKA_H__E5BADD45_D4CD_11D4_BF5E_0050BADBD5F5__INCLUDED_

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

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols
#include <ldefin2d.h>

#ifdef __LIGHT_VERSION__
#include <klAPI5.h>
#else
#include <kAPI5.h>
#endif

#define SPCOBJ_CREATE true                 //    

#define AXIS_OFF     0x1    // 0  >0  
#define PITCH        0x2    //   >0  
#define SIMPLE       0x10   //   >0  
#define ISPOLN       0x80   //  1 >0  2
#define TAKEISPOLN   0x100  // 0     >0  

// 
#define KEY_S_ON     0x1 // 0-      > 0 - 
#define KOEFF_MAT_ON 0x4 // 0-  , >0  
#define KEY_S        0x2 // 0-   ; > 0 
#define KEY_S_GRAY   0x8 // > 0  checkbox "   "
#define PITCHOFF     0x800  //      >0   
//        
#define MODSTEP_REAL 0.5412765877

/////////////////////////////////////////////////////////////////////////////
// CGaykaApp
// See gayka.cpp for the implementation of this class
//

class CGaykaApp : public CWinApp
{
public:
	CGaykaApp();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGaykaApp)
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CGaykaApp)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


//-------------------------------------------------------------------------------
//
// ---
struct BaseMakroParam {
  float          ang;
  unsigned short flagAttr;
  short          drawType;
  BYTE           typeSwitch;  //       0 Placement 1 Curso
                              //   0 -  +   0X ( Placement );
                              //   1 - ,     0X   ( Cursor ).
};

//-------------------------------------------------------------------------------
//    5915
// ---
struct GAYKA5915{
  float	dr;
  float	s;
	float	D;
  float	da;
  float	h;
  float	d2;
  float	p;
  short	f;					//  
  short	klass;			//  
  short	gost;       //  
  float	hatchAng;
  float	hatchShag;
  short	ver;        //  
  float	massa;
  short	indexMassa; // 0- 1-   2-
  short	f1;					//  
};

//-------------------------------------------------------------------------------
//     
// ---
struct SimpleBase {
  reference bg;	//  
  reference rg; //  
};

struct HotPointDescription;

//-------------------------------------------------------------------------------
//    5915
// ---
class  Gayka5915 {
protected :
  reference					refMacr;
  UINT							countObj;
  int								flagMode;
	ksUserParam				paramTmp; //    
	ksUserParam				param;    //   Get/SetMacroParam
	ksDataBaseObject	data;     //  
	SimpleBase				base;     //     
  BaseMakroParam		par;
	GAYKA5915					tmp;

public :
  Gayka5915();
  Gayka5915( Gayka5915& other ); 

  operator void* () { return &par.ang; }  //      void*
	
	void				Assign( Gayka5915& other );
	Gayka5915*	Dublicate();

           UINT				GetObjCount() { return countObj; }
           short&			GetDrawType() { return par.drawType; }
  unsigned short&			GetFlagAttr() { return par.flagAttr; }
					 void				SetAttr() { par.flagAttr = par.flagAttr ? false : true; }
					 int				GetFlagMode() { return flagMode; }

					 BaseMakroParam&		GetParam() { return par; }   
					 GAYKA5915&					GetGaykaParam() { return tmp; } 
					 ksDataBaseObject&	GetDataBase() { return data; }
					 SimpleBase&				GetBase() { return base; }
					 ksUserParam&       GetParamTmp() { return paramTmp; }

	void			SetSimple()    {};
	void			SetDimension() {};
	int				ServiceObj() { return 1;};
	void			ServiceObj1( float , float ) {};
  int				Size() { return sizeof(BaseMakroParam) + sizeof(GAYKA5915); }
  bool			IsSpcObjCreate() { return SPCOBJ_CREATE;}; //     
  void			CalkPaket() {} ; //    

	void      InitUserParamTmp();
	void      GetUserParamTmp();
	void      InitUserParam();
	void      SetUserParam();
	void      GetUserParam();
  int				ChoiceMenuId();
  void			SetHatchAngl();
  void			SetHatchShag();
  void			SetParam();
  reference	EditSpcObj( reference *spcObj, reference geom );
	void			GetGroup( reference &gr );
  void			gayka_sverhu();
  void			gayka_p_k( int j );
	bool      DrawSpcObj( reference group );
  void			Draw1();
  int				MacroElementParam();
	int				_ConnectDB( reference bd, char *name );
	int				OpenGaykaBase();
	void			CloseGaykaBase();
	int				ReadGaykaBase( float d = 0 );
	void      SetPlacement( double x, double y, double angl );

// HOT_POINTS ##################################################################
            bool        GetHotPoints( HotPointDescription* point,  int index );
            int         SetHotPoint ( HotPointDescription* point,  int index );
            bool        GetCursorText( int index, char** text );
            int         GetMenu();
            bool        ExecuteCommand( int id );
            bool        EditComplete( int index, BOOL success );
            bool        ChangeHotPointParam( double d );
// HOT_POINTS ##################################################################
};
/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GAYKA_H__E5BADD45_D4CD_11D4_BF5E_0050BADBD5F5__INCLUDED_)
