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jFlGiOjKjHpBjClHiBeC_xHqqkZx_
// _xZkqqHx_iDeBiDeOiDfKiDfIiDeMiBfLiMoDiCmMjGhLjFlGiCkKiOgOiCnMiCoJjFjEjFkKiCnMiCmFiCpAiDeKiDeFiDjDiDgHiBeC_xHqqkZx_
// _xZkqqHx_jHoBiBeG_xHqqkZx_&f) _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_ -> 4 (_xZkqqHx_iDhEiDeAiDeDiDiLjClMjBePiCmMiLpDjEjCiCpAiKnMiCnO_xHqqkZx_)
// _xZkqqHx_jHoBiBeG_xHqqkZx_&f ) _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_ -> 5 (_xZkqqHx_iDhEiDeAiDeDiDiLjClMjBePiCmMiLpDjEjCiCpAiKnMiCnO_xHqqkZx_)
#define FD_TOP_ACCESSKEY_LEN 4

// FD_TOP_ACCESSKEY_FORM
// _xZkqqHx_iDfCiDhNiDjDiDgIjFlGiOjKjHpBiCmMiDhEiDeIiBfLiDhNiDgCiDgHiBeC_xHqqkZx_
// _xZkqqHx_jHoBiBeG_xHqqkZx_&f) _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_ -> "&%c) %s"
// _xZkqqHx_jHoBiBeG_xHqqkZx_&f ) _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_ -> "&%c ) %s"
#define FD_TOP_ACCESSKEY_FORM L"&%c. %s"

#endif//FD_TOP_ACCESSKEY

//;----- <EXPORT TO SDK> -----;

/*************************************************************************
 * <_xZkqqHx_jHpBiLjD_xHqqkZx_>	FTCheckStr
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	CheckFloatStr_xZkqqHx_iKnGjAjEjDjJiCmMjFnEjCgMiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.11 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *************************************************************************/
enum FTCheckStr
{
	FDCS_ERROR = 0,	// _xZkqqHx_jFlGiOjKjHpBiCmJiDeHiDiJiBfLiCkKiCkAiCoJiBeC_xHqqkZx_
	FDCS_EMPTY,		// _xZkqqHx_jFlGiOjKjHpBiCkKiLpDiBeC_xHqqkZx_
	FDCS_NORMAL,	// _xZkqqHx_jAlDiPoNiBeC_xHqqkZx_
};

/*************************************************************************
 * <_xZkqqHx_jHpBiLjD_xHqqkZx_>	FTPopupSubmenuId
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDfMiBfLiDfIiCmMiDiBiDgKiDiFiBfLiCmM_xHqqkZx_ID_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.11 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *************************************************************************/
enum FTPopupSubmenuId
{
	//----- IDR_RBTN_TOOL _xZkqqHx_jCiGiCmMiDiBiDgKiDiFiBfL_xHqqkZx_ID -----
	FD_MENU_TOOL_BASE_ON_OBJECT					= 0,
	FD_MENU_TOOL_BASE_ON_BACKGROUND				= 1,
	FD_MENU_TOOL_BASE_LINK						= 2,
	FD_MENU_TOOL_POLY_EDIT						= 3,
	FD_MENU_TOOL_RICH_EDIT						= 4,
	FD_MENU_TOOL_SEL_EDIT_MOVE_OBJ				= 5,
	FD_MENU_TOOL_TABLE_EDIT						= 6,
	FD_MENU_TOOL_SELECT_ENCLOSE					= 7,
	FD_MENU_TOOL_BASE_ON_OBJECT_CHIPEDITOR		= 8,
	FD_MENU_TOOL_BASE_ON_OBJECT_ARROWEDITOR		= 9,
	FD_MENU_TOOL_BASE_ON_OBJECT_HISTVIEW		= 10,
	FD_MENU_TOOL_BASE_ON_BACKGROUND_HISTVIEW	= 11,
	FD_MENU_TOOL_TIME_LABEL_ON_OBJECT			= 12,
	FD_MENU_TOOL_TIME_LABEL_ON_BACKGROUND		= 13,
	FD_MENU_TOOL_LINK_ON_LINK					= 14,
	FD_MENU_TOOL_LINK_ON_BACKGROUND				= 15,

	//----- IDR_RBTN_MULTI _xZkqqHx_jCiGiCmMiDiBiDgKiDiFiBfL_xHqqkZx_ID -----
	FD_MENU_MULT_MTRX_STATIC		= 0,
	FD_MENU_MULT_MTRX_MOVING		= 1,
	FD_MENU_MULT_LAYER_STATIC		= 2,
	FD_MENU_MULT_LAYER_MOVING		= 3,
	FD_MENU_MULT_SHEET_STATIC		= 4,
	FD_MENU_MULT_SHEET_MOVING		= 5,
	FD_MENU_MULT_CHIP_STATIC		= 6,
// 06.10.23 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	FD_MENU_MULT_ARROW_STATIC		= 7,

	//----- IDR_RBTN_MISC _xZkqqHx_jCiGiCmMiDiBiDgKiDiFiBfL_xHqqkZx_ID -----
	FD_MENU_MISC_TOOLS					= 0,
	FD_MENU_MISC_HRULER					= 1,
	FD_MENU_WND_CHIP_STORE				= 2,
	FD_MENU_WND_HTREE_VIEW_ON_PROJECT	= 3,
	FD_MENU_WND_HTREE_VIEW_ON_DOCUMENT	= 4,
	FD_MENU_WND_HTREE_VIEW_ON_TAG		= 5,
//----- 06.03.27 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	FD_MENU_WND_HTREE_VIEW_ON_LABEL		= 6,
//	FD_MENU_WND_HTREE_VIEW_ON_TIME_LABEL= 7,
//	FD_MENU_WND_HTREE_VIEW_ON_SUB_DOCUMENT= 8,
//----- 06.03.27 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	FD_MENU_WND_HTREE_VIEW_ON_TIME_LABEL= 6,
	FD_MENU_WND_HTREE_VIEW_ON_SUB_DOCUMENT= 7,
//----- 06.03.27 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
}; // enum FTPopupSubmenuId.

/*************************************************************************
 * <_xZkqqHx_iNfMjBkCjBmM_xHqqkZx_>	FCDlgLayoutRec
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfPiDeDiDeBiDiNiDePiDiKiDfEiDeDiDfJiCmJiCkIiCkCiCmEiBeBiDfCiDjDiDgHiDiNiBfLiDiLiCpAiNmEjEhKjChFiClHiCoJiClNiCnPiCmM_xHqqkZx_
 *			_xZkqqHx_iDiMiDeDiDeBiDeFiDgHiPoOjFpBiBeC_xHqqkZx_FFInitDlgLayout_xZkqqHx_iKnGjAjEjDjJiCmFiOgHjHhAiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.11.11 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
struct FCDlgLayoutRec
{
	enum {
		HOOK_LEFT	= (0x0001 << 0),
		HOOK_TOP	= (0x0001 << 1),
		HOOK_RIGHT	= (0x0001 << 2),
		HOOK_BOTTOM	= (0x0001 << 3),
		HOOK_ALL	= HOOK_LEFT | HOOK_TOP | HOOK_RIGHT | HOOK_BOTTOM,
	};
	FCDlgLayoutRec (DWORD dwOffsetFlag = 0,
					const CRect& rtOffset = CRect(LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX))
		:	m_dwOffsetFlag(dwOffsetFlag),
			m_rtOffset(rtOffset) {}

	DWORD	m_dwOffsetFlag;
	CRect	m_rtOffset;
}; // struct FCDlgLayoutRec.

typedef map<long, FCDlgLayoutRec> IdToDlgLayoutRecMap;

//;------ </EXPORT TO SDK> -----;

extern FTCheckStr CheckFloatStr (WString& str, CEdit* pEdit);
//----------<NOT EXPORT TO VIEWER>-----------
extern FTCheckStr CheckFloatStr (WString& str, CComboBox* pBox);
extern FTCheckStr CheckDWORDStr (WString& str, CEdit* pEdit, WORD wBase);
extern void SetStdBtnString (HWND hWndDlg);
//----------</NOT EXPORT TO VIEWER>-----------

extern void SetUnitString (HWND hWndDlg);
extern void RightByLeftHand (HWND hWndDlg);

//----------<NOT EXPORT TO VIEWER>-----------
extern void RightByLeftHand (HMENU hMenu, BOOL bToLeft);
// 06.02.27 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//extern _TCHAR RightByLeftHand (_TCHAR tc);
extern wchar_t RightByLeftHand (wchar_t tc);
extern BOOL RightByLeftHand (WString& wstr);
extern BOOL LeftByRightHand (WString& wstr);
extern void ShortenMenu (HMENU hMenu);
extern void LengthenMenu (HMENU hMenu);

// 06.03.04 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
extern WString FFMakeCommandText (const wchar_t* wcpTitle, wchar_t wcAccesskey);

extern void SetHiListByRealData (CComboBox* pCmb, int iDataSz, const mmetol mmaData[]);
extern void SetXtmListByTmsData (CComboBox* pCmb, int iDataSz, const tmsc tmsaData[]);
extern void SetAngleListByAngleData (CComboBox* pCmb, int iDataSz, const angle daData[]);

extern CPropertyPage* FindPropPage (const CPropertySheet* pSheet,
										CRuntimeClass* pClass);
//----------</NOT EXPORT TO VIEWER>-----------

extern void FFJustifyWindow (HWND hWnd, HWND hWndOffset);
extern void FFJustifyWindow (HWND hWnd, CPoint* pOffset = NULL);

//----------<NOT EXPORT TO VIEWER>-----------
extern void FFUpdateTextComboList (CComboBox* pBox);

// UNICODE_xZkqqHx_iCmFjFlGiOjKjHpBiCpAiOoGjDlOiBeC_xHqqkZx_
extern void FFGetDlgItemText (CWnd* pWnd, DWORD dwCtrl, WString& wstr);
extern void FFGetDlgItemText (HWND hwnd, DWORD dwCtrl, WString& wstr);
//----------</NOT EXPORT TO VIEWER>-----------

// UNICODE_xZkqqHx_iCmFjFlGiOjKjHpBiCpAjAnNjCoIiBeC_xHqqkZx_
extern void FFSetDlgItemText (CWnd* pWnd, DWORD dwCtrl, const wchar_t* wstr);
extern void FFSetDlgItemText (HWND hwnd, DWORD dwCtrl, const wchar_t* wstr);
extern void FFPopupSubmenu (CPoint scpt, DWORD dwMenuId, int iSubmenuIdx, CWnd* pParent, DWORD dwTopCommand = DWORD(-1));
extern void FFPopupSubmenu (const DBLPoint& mmpt, DWORD dwMenuId, int iSubmenuIdx, CWnd* pParent, DWORD dwTopCommand = DWORD(-1));

//----------<NOT EXPORT TO VIEWER>-----------
extern void FFInitKeyboardTable (const wchar_t* tcpPath, HMENU hMenu);
extern void FFInitHandsTable (astring& astrBuff, const wchar_t* tcpPath, long& lCurLine);
extern DWORD FFCommandStringToId (const char* cpCommandString);
extern void FFInitUserAccelerator (astring& strBuff, BOOL bLeft, const wchar_t* tcpPath,
									long& lCurLine, const DWORDSet& stCommandId);
extern void FFGetUserAccelerator (const ACCEL*& pAccel, long& lAccel, BOOL bLeft);

// _xZkqqHx_iDfGiDiHiBfLiDgHiDeKiDgCiDgHiDeMiBfLiPoOjFpBiCpAiPjBiCkLiNjOiCnOiBeC_xHqqkZx_
extern void FFAddShortcutText (HMENU hMenu, BOOL bLeft);

// _xZkqqHx_iDiBiDgCiDfKiBfLiDfHiDhAiDgMiDiLiCpAjFfMiOkGiBeC_xHqqkZx_
extern void FFShowMsgPanel (DWORD dwId, const wchar_t* tcpMsg = NULL);

// _xZkqqHx_iDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmMiDhEiDeCiDiLiDfOjFlGiOjKjHpBiBgJ_xHqqkZx_m_ofn.lpstrFilter_xZkqqHx_iBgKiCpAiOoGjDlOiBeC_xHqqkZx_
extern void FFGetFileDialogFilterString (CString& strFilter, BOOL bIsSave);

//----- 06.02.26 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//// OnUpdatePopupMenu _xZkqqHx_jCiGiCmMiDhNiDeOiDiNiBeC_xHqqkZx_
//#define ON_UPDATE_POPUP_MENU(id, val) \
//	pMenu->EnableMenuItem(id, MF_BYCOMMAND | (val) ? MF_ENABLED : MF_GRAYED);
//----- 06.02.26 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----------</NOT EXPORT TO VIEWER>-----------

extern void FFInitDlgLayout (	IdToDlgLayoutRecMap& mpLayoutInfo,
								const CWnd* pWnd,
								long lControlSize,
								const long aControlId[],
								DWORD dwOffsetFlag);
extern void FFDlgLayout (	const IdToDlgLayoutRecMap& mpLayoutInfo,
							CWnd* pWnd,
							const CSize& szWnd);

#endif//__UtilDlg_h

