MultiLanguage.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // MultiLanguage.h: interface for the CMultiLanguage class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_)
  5. #define AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_
  6. #include "tinyxml\Tinyxml.h"
  7. #include "tinyxml\tinystr.h"
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11. class CLangItem
  12. {
  13. public:
  14. CLangItem()
  15. {
  16. m_nID = -1;
  17. m_csEnglishLang = "";
  18. m_csForeignLang = "";
  19. m_csID = "";
  20. }
  21. int m_nID;
  22. CString m_csID;
  23. CString m_csEnglishLang;
  24. CString m_csForeignLang;
  25. };
  26. typedef CArray<CLangItem*, CLangItem*> LANGUAGE_ARRAY;
  27. typedef CMap<CString, LPCTSTR, CLangItem*, CLangItem*> LANGUAGE_MAP;
  28. class CMultiLanguage
  29. {
  30. public:
  31. CMultiLanguage();
  32. virtual ~CMultiLanguage();
  33. bool LoadLanguageFile(CString csFile);
  34. bool UpdateRightClickMenu(CMenu *pMenu);
  35. bool UpdateGroupsRightClickMenu(CMenu *pMenu);
  36. bool UpdateTrayIconRightClickMenu(CMenu *pMenu);
  37. bool UpdateClipProperties(CWnd *pParent);
  38. bool UpdateOptionGeneral(CWnd *pParent);
  39. bool UpdateOptionSupportedTypes(CWnd *pParent);
  40. bool UpdateOptionShortcuts(CWnd *pParent);
  41. bool UpdateOptionQuickPaste(CWnd *pParent);
  42. bool UpdateOptionFriends(CWnd *pParent);
  43. bool UpdateOptionFriendsDetail(CWnd *pParent);
  44. bool UpdateOptionStats(CWnd *pParent);
  45. bool UpdateOptionSupportedTypesAdd(CWnd *pParent);
  46. bool UpdateMoveToGroups(CWnd *pParent);
  47. bool UpdateOptionsSheet(CWnd *pParent);
  48. bool UpdateOptionCopyBuffers(CWnd *pParent);
  49. bool UpdateGlobalHotKeys(CWnd *pParent);
  50. bool UpdateDeleteClipData(CWnd *pParent);
  51. CString GetGlobalHotKeyString(CString csID, CString csDefault);
  52. CString GetDeleteClipDataString(CString csID, CString csDefault);
  53. CString GetString(CString csID, CString csDefault);
  54. CString GetAuthor() { return m_csAuthor; }
  55. long GetVersion(){ return m_lFileVersion; }
  56. CString GetNotes() { return m_csNotes; }
  57. CString GetLangCode() { return m_csLangCode; }
  58. void SetOnlyGetHeader(bool bVal) { m_bOnlyGetHeader = true; }
  59. static CMenu* GetMenuPos(CMenu *pMenu, const CString &csLookingForMenuText, int &nMenuPos);
  60. CString m_csLastError;
  61. protected:
  62. LANGUAGE_ARRAY m_RightClickMenu;
  63. LANGUAGE_ARRAY m_GroupsRightClickMenu;
  64. LANGUAGE_ARRAY m_TrayIconRightClickMenu;
  65. LANGUAGE_ARRAY m_ClipProperties;
  66. LANGUAGE_ARRAY m_OptionsGeneral;
  67. LANGUAGE_ARRAY m_OptionsSupportedTypes;
  68. LANGUAGE_ARRAY m_OptionsShortcuts;
  69. LANGUAGE_ARRAY m_OptionsQuickPaste;
  70. LANGUAGE_ARRAY m_OptionsFriends;
  71. LANGUAGE_ARRAY m_OptionsFriendsDetail;
  72. LANGUAGE_ARRAY m_OptionsStats;
  73. LANGUAGE_ARRAY m_OptionsSupportedTypesAdd;
  74. LANGUAGE_ARRAY m_MoveToGroups;
  75. LANGUAGE_ARRAY m_OptionsSheet;
  76. LANGUAGE_ARRAY m_OptionsCopyBuffers;
  77. LANGUAGE_ARRAY m_GlobalHotKeys;
  78. LANGUAGE_ARRAY m_DeleteClipData;
  79. LANGUAGE_MAP m_StringMap;
  80. CString m_csAuthor;
  81. CString m_csNotes;
  82. long m_lFileVersion;
  83. CString m_csLangCode;
  84. bool m_bOnlyGetHeader;
  85. protected:
  86. bool LoadSection(TiXmlNode &doc, LANGUAGE_ARRAY &Array, CString csSection);
  87. bool LoadStringTableSection(TiXmlNode &doc, LANGUAGE_MAP &Map, CString csSection);
  88. bool UpdateMenuToLanguage(CMenu *pMenu, LANGUAGE_ARRAY &Array);
  89. bool UpdateWindowToLanguage(CWnd *pParent, LANGUAGE_ARRAY &Array);
  90. void ClearArrays();
  91. void ClearArray(LANGUAGE_ARRAY &Array);
  92. void ClearMap(LANGUAGE_MAP &Map);
  93. };
  94. #endif // !defined(AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_)