AppGlobalF.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 sProvider;
  107. String sServerName;
  108. String sUserName;
  109. String sPassword;
  110. bool bSqlLog;
  111. } itsdb;
  112. struct
  113. {
  114. String sProvider;
  115. String sServerName;
  116. String sUserName;
  117. String sPassword;
  118. bool bSqlLog;
  119. } utisdb;
  120. struct
  121. {
  122. String sMainMap;
  123. String sLinkMap;
  124. } flashmap;
  125. struct
  126. {
  127. String sComModel;
  128. String sDevModel;
  129. } vmscam;
  130. struct
  131. {
  132. String saveDir;
  133. String viewer;
  134. String server;
  135. int port;
  136. String user;
  137. String pswd;
  138. String dir;
  139. } blackbox;
  140. struct
  141. {
  142. String SERVER;
  143. int PORT;
  144. String USER;
  145. String PSWD;
  146. bool PASSIVE;
  147. } vmsFtp;
  148. bool bOnlyOneScreen;
  149. bool bTermChildProg;
  150. } APP_CONFIG;
  151. /*
  152. ******************************************************************************
  153. * Global variable definitions
  154. ******************************************************************************
  155. */
  156. extern ST_GISINFO g_GisInfo;
  157. extern ST_SELLINK g_SelLink;
  158. extern String CenterCd; // 지역센터 코드
  159. extern String CenterId; // 지역센터 아이디
  160. extern String CenterName; // 지역센터 명칭
  161. extern int g_nPid; // Application Process ID
  162. extern String g_sAppDir; // Application Directory
  163. extern String g_sAppName; // Program name
  164. extern String g_sCfgDir; // Config File Directory
  165. extern String g_sLogDir; // Program Log Directory
  166. extern String g_sTempDir; // Program Temp Directory
  167. extern String g_sFormsDir; // Program Forms Directory
  168. extern String g_sBlackBox;
  169. extern String g_sLangDir;
  170. extern String g_sImageDir;
  171. extern String g_sVideoDir;
  172. extern String g_sMapDir;
  173. extern APP_CONFIG g_AppCfg;
  174. extern LOGININFO *g_pLOGIN;
  175. extern LOG_INFO g_LogCfg;
  176. extern TITSLog *ITSLog;
  177. extern TITSLog *FDbLog;
  178. //extern TLangTrans *LangTrans;
  179. extern bool g_bControlAuth;
  180. /*
  181. ******************************************************************************
  182. * PlugIn Global variables
  183. ******************************************************************************
  184. */
  185. /*
  186. ******************************************************************************
  187. * Global function definitios
  188. ******************************************************************************
  189. */
  190. bool LoadDefaultConfigInfo(String ACfgFile="");
  191. int UserLogin();
  192. int UserLogout();
  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_GetCodeIdByName(TcxComboBox *ACombo, String AName);
  205. String APP_GetCodeDefCode(TcxComboBox *ACombo);
  206. String APP_GetCodeDefDesc(TcxComboBox *ACombo);
  207. int APP_SetCode(TcxComboBox *ACombo, String ACode);
  208. String ITSUtil_FormatStr(String AStrDateTime, String AFormat);
  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. public: // User declarations
  226. __fastcall TVmsSizeType(String ATypeCd,
  227. String ATypeNm,
  228. int AWidth,
  229. int AHeight,
  230. int ARows,
  231. int ACols)
  232. {
  233. TypeCd = ATypeCd;
  234. TypeNm = ATypeNm;
  235. Width = AWidth;
  236. Height = AHeight;
  237. Rows = ARows;
  238. Cols = ACols;
  239. }
  240. };
  241. //////////////////////////////////////////////////////////////////////////////////
  242. void APP_DelVmsSizeCombo(TcxComboBox *cboBox);
  243. void APP_FillVmsSizeType(TcxComboBox *cboBox, bool bAddAll=false);
  244. TVmsSizeType* APP_GetVmsSizeTypeObject(TcxComboBox *cboBox);
  245. bool APP_CheckBmpFile(String AInFileName, String &AOutFileName);
  246. bool CMM_InsertLoginHist(PLOGININFO pLogin, bool ALogin);
  247. //----------------------------------------------------------------------------
  248. ULONG ProcIDFromWnd(HWND hwnd);
  249. HWND GetWinHandle(ULONG pid);
  250. #endif