AppGlobalF.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. //---------------------------------------------------------------------------
  2. #ifndef AppGlobalFH
  3. #define AppGlobalFH
  4. //---------------------------------------------------------------------------
  5. #include <map.h>
  6. #include "ITSDbF.h"
  7. #include "ITSUtilF.h"
  8. #include "DataTypesF.h"
  9. #include "ITSLogF.h"
  10. #include "CenterCommF.h"
  11. #include "CDSCodeF.h"
  12. #include "FrmResourceF.h"
  13. /*
  14. ******************************************************************************
  15. * Defines
  16. ******************************************************************************
  17. */
  18. #define FORMSHOW(x) if (x) \
  19. { \
  20. try { \
  21. ShowWindow(x->Handle, SW_RESTORE); \
  22. x->BringToFront(); \
  23. } catch(...) {} \
  24. } \
  25. else \
  26. { \
  27. Application->CreateForm(__classid(T##x), &x); \
  28. if (x) x->Show(); \
  29. }
  30. /*
  31. ******************************************************************************
  32. * User Data Types
  33. ******************************************************************************
  34. */
  35. #define STR_DATETIME "YYYY-MM-DD HH:NN:SS"
  36. #define STR_HHNN "YYYY-MM-DD HH:NN"
  37. #define STR_DATEHOUR "YYYY-MM-DD HH"
  38. #define STR_DATE "YYYY-MM-DD"
  39. #define STR_MM "YYYY-MM"
  40. typedef enum
  41. {
  42. icon_n = 0,
  43. icon_e,
  44. icon_m,
  45. icon_r,
  46. icon_s,
  47. } facility_icon;
  48. typedef struct
  49. {
  50. String ICON[5];
  51. } FACILITY_ICON;
  52. typedef struct tag_AppConfig
  53. {
  54. String sConfigFile;
  55. bool bAppClose;
  56. long lMainWinHandle; /* Main Window Handle */
  57. String sTitle;
  58. String sProcessId; /* 프로세스 ID */
  59. String sSkinName;
  60. bool bSaveForm;
  61. bool bLoginPrompt;
  62. String sDefUseId;
  63. int nLogLevel;
  64. AnsiString sLogDay;
  65. bool bDebug;
  66. String sAppPath;
  67. String sLang;
  68. struct
  69. {
  70. bool Window;
  71. bool Enabled;
  72. int TimeOut;
  73. } Alarm;
  74. struct
  75. {
  76. bool Window;
  77. bool Enabled;
  78. int TimeOut;
  79. } Incident;
  80. struct
  81. {
  82. int AlarmValue;
  83. } Temp;
  84. struct
  85. {
  86. bool Enabled;
  87. int IntervalMin;
  88. bool LogoutExit;
  89. } AutoLogout;
  90. FACILITY_ICON vms;
  91. FACILITY_ICON vds;
  92. struct
  93. {
  94. TThread *pThread;
  95. DWORD dwThreadId;
  96. unsigned int nHandle;
  97. bool bRunning;
  98. } thr;
  99. struct
  100. {
  101. String sProvider;
  102. String sServerName;
  103. String sUserName;
  104. String sPassword;
  105. bool bSqlLog;
  106. } itsdb;
  107. struct
  108. {
  109. String sProvider;
  110. String sServerName;
  111. String sUserName;
  112. String sPassword;
  113. bool bSqlLog;
  114. } utisdb;
  115. struct
  116. {
  117. String sMainMap;
  118. String sLinkMap;
  119. } flashmap;
  120. struct
  121. {
  122. String sComModel;
  123. String sDevModel;
  124. } vmscam;
  125. struct
  126. {
  127. String saveDir;
  128. String viewer;
  129. String server;
  130. int port;
  131. String user;
  132. String pswd;
  133. String dir;
  134. } blackbox;
  135. bool bOnlyOneScreen;
  136. bool bTermChildProg;
  137. } APP_CONFIG;
  138. /*
  139. ******************************************************************************
  140. * Global variable definitions
  141. ******************************************************************************
  142. */
  143. extern ST_GISINFO g_GisInfo;
  144. extern ST_SELLINK g_SelLink;
  145. extern String CenterCd; // 지역센터 코드
  146. extern String CenterId; // 지역센터 아이디
  147. extern String CenterName; // 지역센터 명칭
  148. extern int g_nPid; // Application Process ID
  149. extern String g_sAppDir; // Application Directory
  150. extern String g_sAppName; // Program name
  151. extern String g_sCfgDir; // Config File Directory
  152. extern String g_sLogDir; // Program Log Directory
  153. extern String g_sTempDir; // Program Temp Directory
  154. extern String g_sFormsDir; // Program Forms Directory
  155. extern String g_sBlackBox;
  156. extern String g_sLangDir;
  157. extern String g_sImageDir;
  158. extern String g_sVideoDir;
  159. extern APP_CONFIG g_AppCfg;
  160. extern LOGININFO *g_pLOGIN;
  161. extern LOG_INFO g_LogCfg;
  162. extern TITSLog *ITSLog;
  163. extern TITSLog *FDbLog;
  164. //extern TLangTrans *LangTrans;
  165. /*
  166. ******************************************************************************
  167. * PlugIn Global variables
  168. ******************************************************************************
  169. */
  170. /*
  171. ******************************************************************************
  172. * Global function definitios
  173. ******************************************************************************
  174. */
  175. bool LoadDefaultConfigInfo(String ACfgFile="");
  176. int UserLogin();
  177. int UserLogout();
  178. bool WriteConfigInfo(String sCfgFile, String sTitle, String sItem, String sValue);
  179. bool ReadConfigInfo(String sCfgFile, String sTitle, String sItem, String &sValue);
  180. bool DeleteLogFiles(PTCHAR pszPath, int nDays, PTCHAR pszFile);
  181. void ShowErrorMsg(String ATitle, String AErrMsg);
  182. #include "cxControls.hpp"
  183. #include "cxDropDownEdit.hpp"
  184. TDateTime APP_StrToDateTime(String AStrDateTime);
  185. String APP_FillCode(TcxComboBox *ACombo, String ACode);
  186. String APP_GetCode(TcxComboBox *ACombo);
  187. String APP_GetCodeDesc(TcxComboBox *ACombo, String ACode);
  188. String APP_GetCodeName(TcxComboBox *ACombo, String ACode);
  189. String APP_GetCodeIdByName(TcxComboBox *ACombo, String AName);
  190. String APP_GetCodeDefCode(TcxComboBox *ACombo);
  191. String APP_GetCodeDefDesc(TcxComboBox *ACombo);
  192. int APP_SetCode(TcxComboBox *ACombo, String ACode);
  193. String ITSUtil_FormatStr(String AStrDateTime, String AFormat);
  194. //----------------------------------------------------------------------------
  195. #define MAX_DISPCOLOR 22
  196. extern TColor g_DispColor[MAX_DISPCOLOR];
  197. void APP_InitDisplayColor();
  198. TColor APP_GetDisplayColor(int ASeq);
  199. void APP_ImageClear(TCanvas *c, int offX, int offY, int w, int h, TColor color);
  200. //////////////////////////////////////////////////////////////////////////////////
  201. class TVmsSizeType : public TObject
  202. {
  203. public: // User declarations
  204. String TypeCd;
  205. String TypeNm;
  206. int Width;
  207. int Height;
  208. public: // User declarations
  209. __fastcall TVmsSizeType(String ATypeCd,
  210. String ATypeNm,
  211. int AWidth,
  212. int AHeight)
  213. {
  214. TypeCd = ATypeCd;
  215. TypeNm = ATypeNm;
  216. Width = AWidth;
  217. Height = AHeight;
  218. }
  219. };
  220. //////////////////////////////////////////////////////////////////////////////////
  221. //----------------------------------------------------------------------------
  222. ULONG ProcIDFromWnd(HWND hwnd);
  223. HWND GetWinHandle(ULONG pid);
  224. #endif