AppGlobalF.h 7.1 KB

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