// EdIRREd.hpp : header file
//

#ifndef _EDIRRED_HPP_
#define _EDIRRED_HPP_

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

/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_EditCtrl
/////////////////////////////////////////////////////////////////////////////

#include "ITF\CPAMdf.hpp"
#include "edirdbls.hpp"
#include "RichEditCtrlWithLineManagement.hpp"

extern	CStringList			gm_clKeyWords;
extern	CStringList			gm_clActionWords;
extern	CStringList			gm_clConditionWords;
extern	CStringList			gm_clConstantWords;
extern	CStringList			gm_clKnownWords;

class CPA_EdIR_EditCtrl : public CRichEditCtrlWithLineManagement
{
	// Construction
	public:
		CPA_EdIR_EditCtrl();
		virtual ~CPA_EdIR_EditCtrl();

	// Attributes
	public:
		BOOL				mb_CanDefault;
		long				FindString(BOOL, CString ,CString);
		long				m_fn_lFindString(BOOL, long,CString);
	private:
//		CStringList			m_clKeyWords;
//		CStringList			m_clActionWords;
//		CStringList			m_clConditionWords;
//		CStringList			m_clConstantWords;
//		CStringList			m_clKnownWords;

		long				m_lOldCurrentCharIndex;
		long				m_lOldScrollPosition;
		CString				m_csOldSelectedText;
//Stefan Dumitrean 3-07-98 ( Ctrl key )
//		BOOL				m_bCtrlKeyIsPressed;
//End Stefan Dumitrean 3-07-98 ( Ctrl key )
		BOOL				m_bShiftKeyIsPressed;
		CPA_EditManager		m_clEditManager;
		BOOL				m_bHasBeenModified;
//ROMTEAM Delete (Ionut Grozea 17/03/98)
		BOOL				m_bSingleChar1;
		BOOL				m_bSingleChar2;
//		BOOL						m_bShiftKeyIsPressed;
//		CPA_EditManager	m_clEditManager;
//		BOOL						m_bHasBeenModified;

		//BEGIN ROMTEAM Cristi Petrescu 98-05-
		int					m_nID;
		CToolTipCtrl		m_clToolTip;
		CRect				m_crRect;
		//END ROMTEAM Cristi Petrescu 98-05-

	// Operations
	public:
		void				ReplaceInAllBehaviours(CString , CString );

//ROMTEAM Find&Replace (Ionut Grozea 23/03/98)
		COLORREF col_last;
		BOOL				m_bSearchIsFinished;
		long				m_lFirstSelectIndex;
		long				m_lLastSelectIndex;
		BOOL				m_bIsSelectAString;
		void				m_fnSetSelectAString(BOOL m_bool){m_bIsSelectAString=m_bool;};
		BOOL				m_fnGetSelectAString(){return m_bIsSelectAString;};
//		long				m_fn_lFindSting(BOOL ,long ,CString);
		void				m_fn_ReplaceString(long , CString , CString );
		void				m_fn_ReplaceAllString(BOOL , long  , CString  , CString  );
		void				RestoreCol();
		void				m_fn_vSetText(CString);
		CString				m_fn_csGetText();
		void				m_fn_vSetCursorPos(long);
		void				m_fn_vUpdateColorText(long,long);
		BOOL				m_fn_bIsInLineCommentedText(long);

		BOOL				ShowWindow(int);  

		//for Undo/Redo PressAKey
		void				m_fn_vAddChar(long,long,UINT);
		void				m_fn_vDelChar(long,long,UINT);

		//for Undo/Redo DeleteString (Delete,Cut and Paste)
		void				m_fn_vAddString(long,long,CString);
		void				m_fn_vDelString(long,long,CString);

		BOOL				m_fn_bHasBeenModified();
		void				m_fn_vSetModified(BOOL);

		long				m_fn_lGetLineNumberInPixel(long);

		long				m_fn_lGetCurrentCharIndex();
		CString				m_fn_csGetWordIn(long,long &,long &);
		//BEGIN ROMTEAM Cristi Petrescu 98-05-
//Stefan Dumitrean 25-06-98
		void				m_fn_vColorText(long,long,COLORREF rgbColor ,COLORREF rgbBackgroundColor= -1, BOOL bRememberSel = TRUE );
//End Stefan Dumitrean 25-06-98
		//END ROMTEAM Cristi Petrescu 98-05-
//Stefan Dumitrean 8-06-98 ( new scroll )
		void				m_fn_vResizeToFitParent();
		CPoint				GetScrollPosition();
		void				ScrollToPosition(CPoint clPoint);
//End Stefan Dumitrean 8-06-98
//Stefan Dumitrean 19-06-98 ( choose font )
		void				m_fn_vSetFontTypeAndSize( );
//End Stefan Dumitrean 19-06-98 ( choose font )

	private:
//Stefan Dumitrean 28-04-98
		BOOL m_bParentsSeleIAObj;
		void m_fn_vDisplayIAObjectsAndCompleteWordNew( long, long );
		CString m_fn_csGetCompletedWordNew( CString csWord );
//End Stefan Dumitrean

//Stefan Dumitrean 3-07-98 ( Ctrl key )
		BOOL				m_fn_bCtrlKeyIsPressed() { return ( ( GetKeyState(VK_LCONTROL) & 32768 ) || ( GetKeyState(VK_RCONTROL) & 32768 ) ); }
//End Stefan Dumitrean 3-07-98 ( Ctrl key )

//Stefan Dumitrean 15-06-98
		BOOL				m_bRepaintParent;
		CString				m_csLastSearched;
//End Stefan Dumitrean 15-06-98

//Stefan Dumitrean 19-06-98 ( choose font )
		CString				m_csFontType;
		int					m_nFontSize;
//End Stefan Dumitrean 19-06-98 ( choose font )

//Stefan Dumitrean 10-06-98
		void				m_fn_vAddBlockTabulation( );
		void				m_fn_vDeleteBlockTabulation( );
//End Stefan Dumitrean 10-06-98

//Stefan Dumitrean 29-06-98 ( F3 keys )
		void				m_fn_vFindAndSelTextNext( long lStart, CString csText );
		void				m_fn_vFindAndSelTextPrevious( long lEnd, CString csText );
//End Stefan Dumitrean 29-06-98 ( F3 keys )


//ANNECY CB
		long				m_fn_lSkipLeftAlphaNumChar(CString&,long);
		long				m_fn_lSkipRightAlphaNumChar(CString&,long);
		long				m_fn_lSkipLeftNonAlphaNumChar(CString&,long);
		long				m_fn_lSkipRightNonAlphaNumChar(CString&,long);
//		long				m_fn_lSkipLeftAlphaNumChar(CString,long);
//		long				m_fn_lSkipRightAlphaNumChar(CString,long);
//		long				m_fn_lSkipLeftNonAlphaNumChar(CString,long);
//		long				m_fn_lSkipRightNonAlphaNumChar(CString,long);
//END
		CString				m_fn_csGetWordBefore(long,long &,long &);
		CString				m_fn_csGetWordAfter(long,long &,long &);

//ANNECY CB
		BOOL				m_fn_bIsInTheListString(CString&,CStringList *);
		BOOL				m_fn_bIsAKnownWord(CString&);
		BOOL				m_fn_bIsAKeyWord(CString&);
		BOOL				m_fn_bIsAnActionWord(CString&);
		BOOL				m_fn_bIsAConditionWord(CString&);
		BOOL				m_fn_bIsAConstantWord(CString&);
//Stefan Dumitrean 8-07-98 ( macro color )
		BOOL				m_fn_bIsAMacroWord(CString&);
//End Stefan Dumitrean 8-07-98 ( macro color )
		COLORREF			m_fn_rgbGetColor(CString&);
//		BOOL				m_fn_bIsInTheListString(CString,CStringList *);
//		BOOL				m_fn_bIsAKnownWord(CString);
//		BOOL				m_fn_bIsAKeyWord(CString);
//		BOOL				m_fn_bIsAnActionWord(CString);
//		BOOL				m_fn_bIsAConditionWord(CString);
//		BOOL				m_fn_bIsAConstantWord(CString);
//		COLORREF			m_fn_rgbGetColor(CString);
//END
		CStringList			*m_fn_pclGetListMatchWord(CString,CStringList *);

//ANNECY CB
//		void				m_fn_vColorText(long,long,COLORREF);
//		void				m_fn_vColorText(long,long);
//END ANNECY

		long				m_fn_lGetCurrentCharLine();
		long				m_fn_lGetCurrentCharCol();
		long				m_fn_lGetCurrentCharLineLength();

//		void				m_fn_vUpdateColorText(long,long);
		void				m_fn_vAddText(long,CString,COLORREF);
		void				m_fn_vReplaceText(long,long,CString,COLORREF);

		CString				m_fn_csGetWordInAList(CStringList *);
		void				m_fn_vAddCondition(long,COLORREF);
		void				m_fn_vAddAction(long,COLORREF);
		void				m_fn_vAddDesignerAction(long,COLORREF);

		CString				m_fn_csGetCompletedWord(CString,CStringList *);
		CString				m_fn_csGetCompletedWord(CString);
		void				m_fn_vCompleteWord(long,long);
		void				m_fn_vDisplayIAObjectsAndCompleteWord(long,long);
//ANNECY CB
		BOOL				m_fn_bIsInLineCommentedText(CString &,long);
//END
//		BOOL				m_fn_bIsInLineCommentedText(long);
		void				m_fn_vProcessLineCommentInsertion(long);
		void				m_fn_vProcessLineCommentDeletion(long);

		long				m_fn_lFind(long,char);
		long				m_fn_lReverseFind(long,char);
		long				m_fn_lFindCharInLine(long,char);
  
//Stefan Dumitrean 25-06-98 (new scroll)		
		void				m_fn_vSetCursorPos(long,long, long lScrollPositionH = -1, BOOL bScroll = FALSE);
//End Stefan Dumitrean 25-06-98 (new scroll)		

		void				m_fn_vOnChar(long,UINT);
		void				m_fn_vOnDelString(long,CString,UINT,BOOL);
		void				m_fn_vOnAddString(long,CString);

		void				m_fn_vCopyIntoClipBoard(CString);
		CString				m_fn_csGetStringFromClipBoard();

	// Overrides
		// ClassWizard generated virtual function overrides
		//{{AFX_VIRTUAL(CPA_EdIR_EditCtrl)
	public:
		virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
	//}}AFX_VIRTUAL

//ANNECY CB
	public:
//		void				m_fn_vColorText(long,long,COLORREF);
		//BEGIN ROMTEAM Cristi Petrescu 98-05-
		void				m_fn_vColorLines(int iStartLine, int iNumLines);
		void				m_fn_vColorText(long,long/*,CPA_EdIR_DebugInfoList * = NULL*/);
		void				m_fn_vHideNonExecutedLines (CPA_EdIR_DebugInfoList *);
		LRESULT				WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
		//END ROMTEAM Cristi Petrescu 98-05-
		CSize				m_clFontSize;
		long				m_lVScrollHeight;
		long				m_lHScrollWidth;
//END ANNECY

	// Generated message map functions
	protected:
		//{{AFX_MSG(CPA_EdIR_EditCtrl)
		afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
		afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
		afx_msg void OnMouseMove(UINT nFlags, CPoint point);
		afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
		afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
		afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
		afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
		afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
		afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
		afx_msg void OnIrRulesAddwatch();
		afx_msg void OnIrRulesFindreplace();
		afx_msg void OnIrRulesNext();
		afx_msg void OnIrRulesPrevious();
		afx_msg void OnIrChangeFont();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

#endif //_EDIRRED_HPP_
