<commit_before>/*!
  \copyright (c) RDO-Team, 2011
  \file      rdoframe.h
  \authors     (<EMAIL>)
  \authors     (<EMAIL>)
  \date      07.12.2008
  \brief       
  \indent    4T
*/

#ifndef _LIB_RUNTIME_FRAME_H_
#define _LIB_RUNTIME_FRAME_H_

// ----------------------------------------------------------------------- INCLUDES
#include <list>
#include <map>
// ----------------------------------------------------------------------- SYNOPSIS
#include "utils/rdoanimation.h"
#include "simulator/runtime/calc/calc_base.h"
#include "simulator/runtime/rdo_object.h"
// --------------------------------------------------------------------------------

OPEN_RDO_RUNTIME_NAMESPACE

PREDECLARE_POINTER(RDOFRMShow);
PREDECLARE_POINTER(RDOFRMItem);

/*!
  \class     RDOFRMSprite
  \brief     .    
*/
OBJECT(RDOFRMSprite)
	IS  INSTANCE_OF(RDORuntimeObject)
	AND INSTANCE_OF(RDOSrcInfo      )
{
DECLARE_FACTORY(RDOFRMSprite)
public:
	typedef std::list<tstring> ImageNameList;

	/*!
	  \class     RDOFRMPosition
	  \brief      
	*/
	OBJECT(RDOFRMPosition) IS INSTANCE_OF(RDORuntimeObject)
	{
	DECLARE_FACTORY(RDOFRMPosition)
	public:
		/*!
		  \enum      PositionType
		  \brief       
		*/
		enum PositionType
		{
			PT_ABSOLUTE,
			PT_DELTA,
			PT_GABARIT,
			PT_MULT,
			PT_RULET
		};

		PositionType    getType() const;
		CREF(LPRDOCalc) getCalc() const;

		int getX     (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getY     (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getWidth (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getHeight(CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);

	private:
		RDOFRMPosition(CREF(LPRDOCalc) pCalc, PositionType type = PT_ABSOLUTE, int ruletID = 0);
		RDOFRMPosition();
		virtual ~RDOFRMPosition();

		LPRDOCalc    m_pCalc;
		PositionType m_type;
		int          m_ruletID;
	};
	friend class RDOFRMPosition;

	/*!
	  \class     RDOFRMColor
	  \brief     -
	*/
	OBJECT(RDOFRMColor) IS INSTANCE_OF(RDORuntimeObject)
	{
	DECLARE_FACTORY(RDOFRMColor)
	public:
		/*!
		  \enum      ColorType
		  \brief      
		*/
		enum ColorType
		{
			CT_NONE,
			CT_RGB,
			CT_TRANSPARENT,
			CT_LAST_BG,
			CT_LAST_FG,
			CT_LAST_BG_TEXT,
			CT_LAST_FG_TEXT
		};

		rdo::animation::Color getColor(CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite) const;

		ColorType getType() const;
		void setType(ColorType type);

	private:
		RDOFRMColor(ColorType type = CT_NONE);
		RDOFRMColor(rbyte red, rbyte green, rbyte blue, CREF(RDOSrcInfo) srcInfo);
		RDOFRMColor(CREF(LPRDOCalc) pRedCalc, CREF(LPRDOCalc) pGreenCalc, CREF(LPRDOCalc) pBlueCalc);
		virtual ~RDOFRMColor();

		ColorType m_type;
		LPRDOCalc m_pRedCalc;
		LPRDOCalc m_pGreenCalc;
		LPRDOCalc m_pBlueCalc;
	};
	friend class RDOFRMColor;

	/*!
	  \class     RDOFRMRulet
	  \brief     -
	*/
	OBJECT(RDOFRMRulet)
		 IS  INSTANCE_OF(RDORuntimeObject)
		 AND INSTANCE_OF(RDOSrcInfo      )
	{
	DECLARE_FACTORY(RDOFRMRulet)
	public:
		ruint getIndex() const;
		CREF(LPRDOFRMPosition) getX() const;
		CREF(LPRDOFRMPosition) getY() const;

	private:
		RDOFRMRulet(CREF(RDOSrcInfo) src_info, ruint index, CREF(LPRDOFRMPosition) pX, CREF(LPRDOFRMPosition) pY);
		virtual ~RDOFRMRulet();

		ruint             m_index;
		LPRDOFRMPosition  m_pX;
		LPRDOFRMPosition  m_pY;
	};

public:
	LPRDOFRMShow  getLastShow       () const;
	CREF(tstring) name              () const;

	void          setBackgroundColor(CREF(LPRDOFRMColor) pBgColor   );
	void          startShow         (CREF(LPRDOCalc) pCalc = NULL   );
	void          addItem           (CREF(LPRDOFRMItem)  pItem      );
	void          addRulet          (CREF(LPRDOFRMRulet) pRulet     );
	rbool         checkCondition    (CREF(LPRDORuntime)  pRuntime   );

	void setColorLastBG    (RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastBg);
	void setColorLastFG    (RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastFg);
	void setColorLastBGText(RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastBgText);
	void setColorLastFGText(RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastFgText);
	void setLastXY         (double x, double y);
	void setLastXYWH       (double x, double y, double width, double height);

	int getRuletX(CREF(LPRDORuntime) pRuntime, ruint ruletID) const;
	int getRuletY(CREF(LPRDORuntime) pRuntime, ruint ruletID) const;
	LPRDOFRMRulet findRulet(ruint ruletID) const;
	RDOFRMSprite(CREF(RDOSrcInfo) src_info, CREF(LPRDOCalc) pConditionCalc = NULL);
	virtual ~RDOFRMSprite();

private:
	

	typedef std::list<LPRDOFRMShow>        ShowList;
	typedef std::map<ruint, LPRDOFRMRulet> RuletList;
protected:
	LPRDOCalc              m_pConditionCalc;
	LPRDOFRMColor          m_pBgColor;

	ShowList               m_showList;
	rdo::animation::Color  m_colorLastBg;
	rdo::animation::Color  m_colorLastFg;
	rdo::animation::Color  m_colorLastBgText;
	rdo::animation::Color  m_colorLastFgText;
	double                 m_lastX;<commit_msg> - конструктор и диструктор 'умных' объектов должны быть в private, но т.к. от него есть потомок, то в protected, но никак не public<commit_after>/*!
  \copyright (c) RDO-Team, 2011
  \file      rdoframe.h
  \authors     (<EMAIL>)
  \authors     (<EMAIL>)
  \date      07.12.2008
  \brief       
  \indent    4T
*/

#ifndef _LIB_RUNTIME_FRAME_H_
#define _LIB_RUNTIME_FRAME_H_

// ----------------------------------------------------------------------- INCLUDES
#include <list>
#include <map>
// ----------------------------------------------------------------------- SYNOPSIS
#include "utils/rdoanimation.h"
#include "simulator/runtime/calc/calc_base.h"
#include "simulator/runtime/rdo_object.h"
// --------------------------------------------------------------------------------

OPEN_RDO_RUNTIME_NAMESPACE

PREDECLARE_POINTER(RDOFRMShow);
PREDECLARE_POINTER(RDOFRMItem);

/*!
  \class     RDOFRMSprite
  \brief     .    
*/
OBJECT(RDOFRMSprite)
	IS  INSTANCE_OF(RDORuntimeObject)
	AND INSTANCE_OF(RDOSrcInfo      )
{
DECLARE_FACTORY(RDOFRMSprite)
public:
	typedef std::list<tstring> ImageNameList;

	/*!
	  \class     RDOFRMPosition
	  \brief      
	*/
	OBJECT(RDOFRMPosition) IS INSTANCE_OF(RDORuntimeObject)
	{
	DECLARE_FACTORY(RDOFRMPosition)
	public:
		/*!
		  \enum      PositionType
		  \brief       
		*/
		enum PositionType
		{
			PT_ABSOLUTE,
			PT_DELTA,
			PT_GABARIT,
			PT_MULT,
			PT_RULET
		};

		PositionType    getType() const;
		CREF(LPRDOCalc) getCalc() const;

		int getX     (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getY     (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getWidth (CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);
		int getHeight(CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite);

	private:
		RDOFRMPosition(CREF(LPRDOCalc) pCalc, PositionType type = PT_ABSOLUTE, int ruletID = 0);
		RDOFRMPosition();
		virtual ~RDOFRMPosition();

		LPRDOCalc    m_pCalc;
		PositionType m_type;
		int          m_ruletID;
	};
	friend class RDOFRMPosition;

	/*!
	  \class     RDOFRMColor
	  \brief     -
	*/
	OBJECT(RDOFRMColor) IS INSTANCE_OF(RDORuntimeObject)
	{
	DECLARE_FACTORY(RDOFRMColor)
	public:
		/*!
		  \enum      ColorType
		  \brief      
		*/
		enum ColorType
		{
			CT_NONE,
			CT_RGB,
			CT_TRANSPARENT,
			CT_LAST_BG,
			CT_LAST_FG,
			CT_LAST_BG_TEXT,
			CT_LAST_FG_TEXT
		};

		rdo::animation::Color getColor(CREF(LPRDORuntime) pRuntime, CREF(LPRDOFRMSprite) pSprite) const;

		ColorType getType() const;
		void setType(ColorType type);

	private:
		RDOFRMColor(ColorType type = CT_NONE);
		RDOFRMColor(rbyte red, rbyte green, rbyte blue, CREF(RDOSrcInfo) srcInfo);
		RDOFRMColor(CREF(LPRDOCalc) pRedCalc, CREF(LPRDOCalc) pGreenCalc, CREF(LPRDOCalc) pBlueCalc);
		virtual ~RDOFRMColor();

		ColorType m_type;
		LPRDOCalc m_pRedCalc;
		LPRDOCalc m_pGreenCalc;
		LPRDOCalc m_pBlueCalc;
	};
	friend class RDOFRMColor;

	/*!
	  \class     RDOFRMRulet
	  \brief     -
	*/
	OBJECT(RDOFRMRulet)
		 IS  INSTANCE_OF(RDORuntimeObject)
		 AND INSTANCE_OF(RDOSrcInfo      )
	{
	DECLARE_FACTORY(RDOFRMRulet)
	public:
		ruint getIndex() const;
		CREF(LPRDOFRMPosition) getX() const;
		CREF(LPRDOFRMPosition) getY() const;

	private:
		RDOFRMRulet(CREF(RDOSrcInfo) src_info, ruint index, CREF(LPRDOFRMPosition) pX, CREF(LPRDOFRMPosition) pY);
		virtual ~RDOFRMRulet();

		ruint             m_index;
		LPRDOFRMPosition  m_pX;
		LPRDOFRMPosition  m_pY;
	};

public:
	LPRDOFRMShow  getLastShow       () const;
	CREF(tstring) name              () const;

	void          setBackgroundColor(CREF(LPRDOFRMColor) pBgColor   );
	void          startShow         (CREF(LPRDOCalc) pCalc = NULL   );
	void          addItem           (CREF(LPRDOFRMItem)  pItem      );
	void          addRulet          (CREF(LPRDOFRMRulet) pRulet     );
	rbool         checkCondition    (CREF(LPRDORuntime)  pRuntime   );

	void setColorLastBG    (RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastBg);
	void setColorLastFG    (RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastFg);
	void setColorLastBGText(RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastBgText);
	void setColorLastFGText(RDOFRMColor::ColorType type, CREF(rdo::animation::Color) lastFgText);
	void setLastXY         (double x, double y);
	void setLastXYWH       (double x, double y, double width, double height);

	int getRuletX(CREF(LPRDORuntime) pRuntime, ruint ruletID) const;
	int getRuletY(CREF(LPRDORuntime) pRuntime, ruint ruletID) const;
	LPRDOFRMRulet findRulet(ruint ruletID) const;

protected:
	RDOFRMSprite(CREF(RDOSrcInfo) src_info, CREF(LPRDOCalc) pConditionCalc = NULL);
	virtual ~RDOFRMSprite();

private:
	

	typedef std::list<LPRDOFRMShow>        ShowList;
	typedef std::map<ruint, LPRDOFRMRulet> RuletList;
protected:
	LPRDOCalc              m_pConditionCalc;
	LPRDOFRMColor          m_pBgColor;

	ShowList               m_showList;
	rdo::animation::Color  m_colorLastBg;
	rdo::animation::Color  m_colorLastFg;
	rdo::animation::Color  m_colorLastBgText;
	rdo::animation::Color  m_colorLastFgText;
	double                 m_lastX;
{'fraction_non_alphanumeric': 0.13974447855798752, 'fraction_numerical': 0.002773100921065663, 'mean_word_length': 3.015109343936382, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5213113', 'n_tokens_mistral': 4180, 'n_tokens_neox': 3891, 'n_words': 678}