MultiLanguage.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 UpdateOptionQuickPasteKeyboard(CWnd *pParent);
  43. bool UpdateOptionFriends(CWnd *pParent);
  44. bool UpdateOptionFriendsDetail(CWnd *pParent);
  45. bool UpdateOptionStats(CWnd *pParent);
  46. bool UpdateOptionSupportedTypesAdd(CWnd *pParent);
  47. bool UpdateMoveToGroups(CWnd *pParent);
  48. bool UpdateOptionsSheet(CWnd *pParent);
  49. bool UpdateOptionCopyBuffers(CWnd *pParent);
  50. bool UpdateGlobalHotKeys(CWnd *pParent);
  51. bool UpdateDeleteClipData(CWnd *pParent);
  52. CString GetGlobalHotKeyString(CString csID, CString csDefault);
  53. CString GetDeleteClipDataString(CString csID, CString csDefault);
  54. CString GetQuickPasteKeyboardString(int id, CString csDefault);
  55. CString GetString(CString csID, CString csDefault);
  56. CString GetAuthor() { return m_csAuthor; }
  57. long GetVersion(){ return m_lFileVersion; }
  58. CString GetNotes() { return m_csNotes; }
  59. CString GetLangCode() { return m_csLangCode; }
  60. void SetOnlyGetHeader(bool bVal) { m_bOnlyGetHeader = true; }
  61. static CMenu* GetMenuPos(CMenu *pMenu, const CString &csLookingForMenuText, int &nMenuPos);
  62. CString m_csLastError;
  63. protected:
  64. LANGUAGE_ARRAY m_RightClickMenu;
  65. LANGUAGE_ARRAY m_GroupsRightClickMenu;
  66. LANGUAGE_ARRAY m_TrayIconRightClickMenu;
  67. LANGUAGE_ARRAY m_ClipProperties;
  68. LANGUAGE_ARRAY m_OptionsGeneral;
  69. LANGUAGE_ARRAY m_OptionsSupportedTypes;
  70. LANGUAGE_ARRAY m_OptionsShortcuts;
  71. LANGUAGE_ARRAY m_OptionsQuickPaste;
  72. LANGUAGE_ARRAY m_OptionsQuickPasteKeyboard;
  73. LANGUAGE_ARRAY m_OptionsFriends;
  74. LANGUAGE_ARRAY m_OptionsFriendsDetail;
  75. LANGUAGE_ARRAY m_OptionsStats;
  76. LANGUAGE_ARRAY m_OptionsSupportedTypesAdd;
  77. LANGUAGE_ARRAY m_MoveToGroups;
  78. LANGUAGE_ARRAY m_OptionsSheet;
  79. LANGUAGE_ARRAY m_OptionsCopyBuffers;
  80. LANGUAGE_ARRAY m_GlobalHotKeys;
  81. LANGUAGE_ARRAY m_DeleteClipData;
  82. LANGUAGE_MAP m_StringMap;
  83. CString m_csAuthor;
  84. CString m_csNotes;
  85. long m_lFileVersion;
  86. CString m_csLangCode;
  87. bool m_bOnlyGetHeader;
  88. protected:
  89. bool LoadSection(TiXmlNode &doc, LANGUAGE_ARRAY &Array, CString csSection);
  90. bool LoadStringTableSection(TiXmlNode &doc, LANGUAGE_MAP &Map, CString csSection);
  91. bool UpdateMenuToLanguage(CMenu *pMenu, LANGUAGE_ARRAY &Array);
  92. bool UpdateWindowToLanguage(CWnd *pParent, LANGUAGE_ARRAY &Array);
  93. void ClearArrays();
  94. void ClearArray(LANGUAGE_ARRAY &Array);
  95. void ClearMap(LANGUAGE_MAP &Map);
  96. };
  97. #endif // !defined(AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_)