AppGlobalF.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. //---------------------------------------------------------------------------
  2. #ifndef AppGlobalFH
  3. #define AppGlobalFH
  4. #include "VmsCommonLibF.h"
  5. //---------------------------------------------------------------------------
  6. #include <map.h>
  7. #include "ITSDbF.h"
  8. #include "ITSUtilF.h"
  9. #include "ITSLogF.h"
  10. #include "CenterCommF.h"
  11. #include "CDSCodeF.h"
  12. #include "CDSVmsObjTypeF.h"
  13. #include "VmsCommInfoF.h"
  14. #include "FrmLangF.h"
  15. /*
  16. ******************************************************************************
  17. * Defines
  18. ******************************************************************************
  19. */
  20. #define FORMSHOW(x) if (x) \
  21. { \
  22. try { \
  23. ShowWindow(x->Handle, SW_RESTORE); \
  24. x->BringToFront(); \
  25. } catch(...) {} \
  26. } \
  27. else \
  28. { \
  29. Application->CreateForm(__classid(T##x), &x); \
  30. if (x) x->Show(); \
  31. }
  32. typedef enum
  33. {
  34. icon_n = 0,
  35. icon_e,
  36. icon_m,
  37. icon_r,
  38. icon_s,
  39. } facility_icon;
  40. typedef struct
  41. {
  42. String ICON[5];
  43. } FACILITY_ICON;
  44. typedef struct tag_AppConfig
  45. {
  46. String sConfigFile;
  47. bool bAppClose;
  48. long lMainWinHandle; /* Main Window Handle */
  49. String sTitle;
  50. String sProcessId; /* ÇÁ·Î¼¼½º ID */
  51. int nVmsServerPort;
  52. String sSkinName;
  53. bool bSaveForm;
  54. bool bLoginPrompt;
  55. String sDefUseId;
  56. int nLogLevel;
  57. AnsiString sLogDay;
  58. bool bDebug;
  59. String sAppPath;
  60. String sLang;
  61. bool isDispOfflineMsg;
  62. struct
  63. {
  64. bool Window;
  65. bool Enabled;
  66. int TimeOut;
  67. } Alarm;
  68. struct
  69. {
  70. bool Window;
  71. bool Enabled;
  72. int TimeOut;
  73. } Incident;
  74. struct
  75. {
  76. int AlarmValue;
  77. } Temp;
  78. struct
  79. {
  80. bool Enabled;
  81. int IntervalMin;
  82. bool LogoutExit;
  83. } AutoLogout;
  84. FACILITY_ICON vms;
  85. FACILITY_ICON vds;
  86. struct
  87. {
  88. TThread *pThread;
  89. DWORD dwThreadId;
  90. unsigned int nHandle;
  91. bool bRunning;
  92. } thr;
  93. struct
  94. {
  95. String sConnectStr;
  96. String sProvider;
  97. String sServerName;
  98. String sUserName;
  99. String sPassword;
  100. bool bSqlLog;
  101. } itsdb;
  102. struct
  103. {
  104. String sProvider;
  105. String sServerName;
  106. String sUserName;
  107. String sPassword;
  108. bool bSqlLog;
  109. } utisdb;
  110. struct
  111. {
  112. String sMainMap;
  113. String sLinkMap;
  114. } flashmap;
  115. struct
  116. {
  117. String sComModel;
  118. String sDevModel;
  119. } vmscam;
  120. struct
  121. {
  122. String saveDir;
  123. String viewer;
  124. String server;
  125. int port;
  126. String user;
  127. String pswd;
  128. String dir;
  129. } blackbox;
  130. struct
  131. {
  132. String SERVER;
  133. int PORT;
  134. String USER;
  135. String PSWD;
  136. bool PASSIVE;
  137. } vmsFtp;
  138. bool bOnlyOneScreen;
  139. bool bTermChildProg;
  140. bool isLoadFromFile;
  141. String MAGIC_ID;
  142. String OPER_ID;
  143. } APP_CONFIG;
  144. /*
  145. ******************************************************************************
  146. * Global variable definitions
  147. ******************************************************************************
  148. */
  149. extern String g_IniFileDir;
  150. extern String g_IniFileName;
  151. extern int g_nPid; // Application Process ID
  152. extern String g_sAppDir; // Application Directory
  153. extern String g_sAppName; // Program name
  154. extern String g_sCfgDir; // Config File Directory
  155. extern String g_sLogDir; // Program Log Directory
  156. extern String g_sTempDir; // Program Temp Directory
  157. extern String g_sFormsDir; // Program Forms Directory
  158. extern String g_sBlackBox;
  159. extern String g_sLangDir;
  160. extern String g_sImageDir;
  161. extern String g_sVideoDir;
  162. extern String g_sMapDir;
  163. extern APP_CONFIG g_AppCfg;
  164. extern LOG_INFO g_LogCfg;
  165. extern TITSLog *ITSLog;
  166. extern String g_sLang;
  167. extern bool g_bControlAuth;
  168. /*
  169. ******************************************************************************
  170. * PlugIn Global variables
  171. ******************************************************************************
  172. */
  173. /*
  174. ******************************************************************************
  175. * Global function definitios
  176. ******************************************************************************
  177. */
  178. String DbPictTypeToReal(String APictType);
  179. String RealPictTypeToDb(String APictType);
  180. String DbMovieTypeToReal(String APictType);
  181. String RealMovieTypeToDb(String APictType);
  182. bool CheckApplicationParam();
  183. bool ApplicationSingleRun(String AClassName, String ATitle);
  184. bool LoadDefaultConfigInfo(String ACfgFile="");
  185. bool WriteConfigInfo(String sCfgFile, String sTitle, String sItem, String sValue);
  186. bool ReadConfigInfo(String sCfgFile, String sTitle, String sItem, String &sValue);
  187. bool DeleteLogFiles(PTCHAR pszPath, int nDays, PTCHAR pszFile);
  188. void ShowErrorMsg(String ATitle, String AErrMsg);
  189. #include "cxControls.hpp"
  190. #include "cxDropDownEdit.hpp"
  191. TDateTime APP_StrToDateTime(String AStrDateTime);
  192. String APP_FillCode(TcxComboBox *ACombo, String ACode);
  193. String APP_GetCode(TcxComboBox *ACombo);
  194. String APP_GetCodeDesc(TcxComboBox *ACombo, String ACode);
  195. String APP_GetCodeName(TcxComboBox *ACombo, String ACode);
  196. String APP_GetCodeName(TcxComboBox *ACombo);
  197. String APP_GetCodeIdByName(TcxComboBox *ACombo, String AName);
  198. String APP_GetCodeDefCode(TcxComboBox *ACombo);
  199. String APP_GetCodeDefDesc(TcxComboBox *ACombo);
  200. int APP_SetCode(TcxComboBox *ACombo, String ACode);
  201. //----------------------------------------------------------------------------
  202. #define MAX_DISPCOLOR 20
  203. extern TColor g_DispColor[MAX_DISPCOLOR];
  204. void APP_InitDisplayColor();
  205. TColor APP_GetDisplayColor(int ASeq);
  206. void APP_ImageClear(TCanvas *c, int offX, int offY, int w, int h, TColor color);
  207. void APP_DbLoading();
  208. //////////////////////////////////////////////////////////////////////////////////
  209. class TVmsSizeType : public TObject
  210. {
  211. public: // User declarations
  212. String TypeCd;
  213. String TypeNm;
  214. int Width;
  215. int Height;
  216. int Rows;
  217. int Cols;
  218. public: // User declarations
  219. __fastcall TVmsSizeType(String ATypeCd,
  220. String ATypeNm,
  221. int AWidth,
  222. int AHeight,
  223. int ARows,
  224. int ACols)
  225. {
  226. TypeCd = ATypeCd;
  227. TypeNm = ATypeNm;
  228. Width = AWidth;
  229. Height = AHeight;
  230. Rows = ARows;
  231. Cols = ACols;
  232. }
  233. };
  234. //////////////////////////////////////////////////////////////////////////////////
  235. void APP_DelVmsSizeCombo(TcxComboBox *cboBox);
  236. void APP_FillVmsSizeType(TcxComboBox *cboBox, bool bAddAll=false);
  237. TVmsSizeType* APP_GetVmsSizeTypeObject(TcxComboBox *cboBox);
  238. bool APP_CheckBmpFile(String AInFileName, String &AOutFileName);
  239. //----------------------------------------------------------------------------
  240. ULONG ProcIDFromWnd(HWND hwnd);
  241. HWND GetWinHandle(ULONG pid);
  242. #endif