AppGlobalF.h 7.8 KB

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