AppGlobalF.h 7.8 KB

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