00001
00002
00004
00005 #if !defined(AFX_GUZIKVIEW_H__6C129010_E1EB_4343_9332_EB2D786EDC7B__INCLUDED_)
00006 #define AFX_GUZIKVIEW_H__6C129010_E1EB_4343_9332_EB2D786EDC7B__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include "DialogTemplate.h"
00013 #include "TObject.h"
00014 #include "MultiRectTracker.h"
00015 #include "ToolBarControls.h"
00016 #include "GridCtrl/GridCtrl.h"
00017 #include "CTList.h"
00018
00019 const bool UPD_ALLOBJECTS = false;
00020 const bool UPD_SELOBJECTS = true;
00021 const bool UPD_CURPOS = true;
00022 const bool UPD_OLDPOS = false;
00023
00024 const int FIND_LAST = 1;
00025 const int FIND_SELECTED = 0;
00026 const bool FIND_CHECKOBJECTFRAME = true;
00027 const bool FIND_CHECKALLOBJECT = false;
00028
00029 #ifdef _DEBUG
00030 #define ONDEBUG(str) cout << str << endl;
00031 #else
00032 #define ONDEBUG(str)
00033 #endif
00034 #define ABS(x) (x) < 0 ? -(x) : (x)
00035 #define MIN(x,y) ((x) < (y) ? (x) : (y))
00036 #define MAX(x,y) ((x) < (y) ? (y) : (x))
00037 #define KEY(key) m_key[key] & 0x80
00038
00039 #define MAXID 1000
00040 #define MAXSTR 500
00041
00042 #define WM_UPDATEDIALOG (WM_USER + 10001)
00043 class CFormCreatorView : public CScrollView
00044 {
00045 protected:
00046 CFormCreatorView();
00047 DECLARE_DYNCREATE(CFormCreatorView)
00048
00049
00050 public:
00051
00052 CFormCreatorDoc* GetDocument();
00053
00054 typedef CTList<CTObject *>::iterator objIterator;
00055
00056 struct listPos
00057 {
00058 objIterator it;
00059 CTList<CTObject *> * objects;
00060 };
00061
00062 struct CColumnInfo
00063 {
00064 int nCol;
00065 int nWidth;
00066 CString strName;
00067
00068 };
00069
00070 struct CSubStr
00071 {
00072 CString m_str;
00073 int nPosX;
00074
00075 } m_subStr[MAXSTR];
00076
00077 struct TFCObjBuffer
00078 {
00079 char sObjID[41];
00080 char sObjPrnID[41];
00081 char sObjType[16];
00082 char sObjName[16];
00083 char sObjCaption[2049];
00084 char sObjState[32];
00085 char sObjDescr[256];
00086
00087 int nObjPosX;
00088 int nObjPosY;
00089 int nObjWidth;
00090 int nObjHeight;
00091
00092
00093 };
00094 struct TFCHeaderBuffer
00095 {
00096 char sStateID[41];
00097 int nLeft;
00098 int nTop;
00099 int nWidth;
00100 int nHeight;
00101 int nObjCount;
00102
00103 };
00104
00105
00106
00107 listPos GetObjectIterator(CTList<CTObject *> * objects, CTObject * pTObject);
00108
00109 CRect GetDlgScreenRect();
00110 CRect GetTotalClipRect();
00111 void GetDlgBorderSize();
00112
00113 CRect GetObjectRect(CTObject * pTObject, CRect & rect);
00114 CRect GetObjectRealRect(CTObject * pTObject, CRect & rect);
00115 CRect GetObjectRealRect(CTObject * pTObject);
00116
00117 void AddChildObjects(CTObject * pTPParent, CTObject * pTParent, CTList<CTObject *> * objects, int nDepth);
00118 void CopyObject(CTObject * pTParent, CTObject * pTObject, CRect rect);
00119
00120
00121 CWnd * AddObject(CTObject * pTParent, int nType, CRect & objRect, bool bCreateTObject, bool bCreateObject, bool bUpdateTracker, DWORD dwFlags = 0, DWORD dwFlagsEx = 0);
00122 void _RemoveObjectWithChildren(CTList<CTObject *> * objects);
00123 void RemoveObjectWithChildren(CTObject * pTObject);
00124 void RemoveObjectsFromSheet(CTList<CTObject *> * objects, int nPage);
00125 void RemoveAllObjects();
00126
00127 void ChangeSheetNumbers(CTList<CTObject *> * objects, int nPage);
00128
00129 void AddToInfObjList(CTObject * pTObject);
00130 void AddToObjList(CTObject * pTObject);
00131
00132 CPoint PointToDlg(CPoint & point);
00133 bool PointIn(CPoint &p, CRect &r);
00134 bool PointInDlgObject(CPoint & point, CRect & rect);
00135 bool PointInDlgObjectFrame(CPoint &point, CRect & rect);
00136 bool RectInRect(CRect & rect0, CRect & rect1);
00137 bool IntersectRect(CRect & rect0, CRect & rect1);
00138
00139 void InsertObject(CPoint & point);
00140 bool CheckObject(CPoint & point);
00141 bool CheckSelection();
00142 bool CheckRubberband(CPoint & point);
00143 bool CheckDialog(CPoint & point);
00144 bool CheckPageControl(CPoint point);
00145
00146 void TestDialog(bool bStaus);
00147 void _TestDialog(CTList<CTObject *> * objects, CWnd * pParent);
00148
00149 void MoveSelObjects();
00150
00151 void ScaleObjects(CTList<CTObject *> * objects);
00152 void _ScaleObjects(CTList<CTObject *> * objects, float fdx, float fdy);
00153
00154 void UpdateObjectPos();
00155 void UpdateObjectDescInfo();
00156 void UpdateObjectNameInfo();
00157 void UpdateObjectCaptionInfo();
00158 void UpdateObjectPosInfo(CRect &rect);
00159 void UpdateObjectClassInfo();
00160 void UpdateObjInfList(CString & strName, CTObject * pTObject);
00161 void UpdateObjInfListNum();
00162
00163 void SelectRowOnObjInfList(CTObject * pTObject);
00164 void SelectRowOnObjList(CTObject * pTObject);
00165
00166 void SelectObject(CTObject * pTObject);
00167
00168 int JustifyString(CDC * pDC, int nMaxStr, int nColWidth);
00169 int SubstractString(CString & str);
00170 void DrawTrackerRect();
00171 void DrawGrid(CRect rect, DWORD color = RGB(100, 100, 100));
00172 void DrawA4Page(CDC * pDC);
00173 void EraseDlgDragRect();
00174 void DrawNumbers();
00175
00176 void _DrawNumbers(CDC * pDC,
00177 CDC * pMemDC,
00178 CTList<CTObject *> * objects,
00179 int & nNum
00180 );
00181
00182 void DrawInfo(CDC * pDC);
00183 void _DrawInfo(CDC * pDC, float & fPosY, int & cNum, int nCountColLeft, int nNameColLeft, int nInfoColLeft, int nInfoColWidth, CTList<CTObject *> * objects);
00184
00185 void ChangeGridSize(int nGridX, int nGridY);
00186
00187 void OnFilePrintPreview();
00188 void ComputePrintSizes(CDC *pDC, CPrintInfo* pInfo);
00189
00190 bool FileFindString(CFile & file, char * str);
00191 CString FileReadString(CFile & file);
00192
00193 bool DFM_LoadObjects(CFile & file, CTObject * pTObject);
00194 bool DFM_LoadObject(CFile & file, CTObject * pTObject, bool bObject);
00195 bool DFM_AddObject(CTObject * pTObject, CString & strClass, CString & strCaption, int nLeft, int nTop, int nWidth, int nHeight, bool bCreateObject);
00196 bool DFM_SaveObjects(CFile &file, CTList<CTObject *> * objects, CString strSpaces0, CString strSpaces1, int nPage);
00197 bool DFM_SaveHeader(CFile & file, CTList<CTObject *> * objects);
00198 bool LoadDFM(CFile &file);
00199
00200 void SetFileExt(CString & strFilename, CString strExt);
00201
00202 void FORM_LoadObjects(CFile & file, CTObject * pTParent);
00203 void FORM_SaveObjects(CFile & file, CTList<CTObject *> * objects);
00204
00205 void TMP_SaveObjects(CFile & file, CTList<CTObject *> * objects);
00206 void TMP_LoadObjects(CFile & file);
00207 bool TMP_AddObject(TFCObjBuffer * pObjBuffer);
00208
00209 void HTML_Save(CFile & file);
00210
00211 int GetObjectType(CString & strClass);
00212 int GetObjectClass(CString & strClass);
00213
00214 void UpdateDialog();
00215
00216 CString MakeObjectName(int nType);
00217 void FillObjectsID(CTList<CTObject *> * objects, CString & strName, int nType);
00218
00219 void OnObjListClick(NMHDR *pNotifyStruct, LRESULT* );
00220
00221 int GetObjectsCount(CTList<CTObject *> * objects, int & nCount);
00222
00223
00224 void OnObjInfListClick(NMHDR *pNotifyStruct, LRESULT* );
00225
00226 int FindRowInObjInfList(CString & strName);
00227 int FindRowInObjList(CString & strName);
00228
00229 void ResetScrollBars();
00230
00231
00232 CTObject * FindPrevObject(CTObject * pTObject);
00233 CTObject * FindNextObject(CTObject * pTObject);
00234 CTObject * FindObjectByName(CTList<CTObject *> * objects, CString & strName);
00235 CTObject * FindObjectByGuid(CTList<CTObject *> * objects, CString & strGuid);
00236 CTObject * FindLastObject(CTList<CTObject *> * objects);
00237 CTObject * FindObject(CTList<CTObject *> * objects, CPoint & point, bool bCheckObjectFrame = true);
00238 CTObject * RemoveSelObjects();
00239
00240 void CreateFlatObjects(CTList<CTObject *> * objects);
00241
00242 CString MakeLongNum(int nNum);
00243
00244 void ShowObjects(int nPage, CTList<CTObject *> * objects);
00245 void ShowAllObjects(int nPage, CTList<CTObject *> * objects);
00246 void ShowObjectProperties(CTObject * pTObject);
00247
00248 CTList<CTObject *> m_objects;
00249 CTList<CTObject *> m_selObjects;
00250 CTList<CTObject *> m_flatObjects;
00251 CTList<TFCObjBuffer *> m_objBuffer;
00252
00253 CMultiRectTracker * m_pTracker;
00254 CTObject * m_pTDlg;
00255 CTemplateDialog * m_pDlg;
00256 CTObject * m_pTObject;
00257 CTObject * m_pLstTObject;
00258
00259 CGridCtrl * m_pGrdInfObjList;
00260 CRect m_objGridRect;
00261
00262 int * m_pObjectsID;
00263 bool m_bInsert;
00264 bool m_bDrawDragRect;
00265 bool m_bObjChange;
00266 bool m_bShiftPressed;
00267 bool m_bControlPressed;
00268 bool m_bDlgSelected;
00269 bool m_bSaved;
00270 bool m_bChange;
00271 bool m_bGetFileName;
00272 bool m_bTestMode;
00273 bool m_bShowGrid;
00274 bool m_bSnapToGrid;
00275 bool m_bShowNumbers;
00276 bool m_bPopUpMenu;
00277
00278 int m_nObjSelected;
00279 int m_nCtrlID;
00280 int m_nObjType;
00281
00282 int m_nHitTest;
00283
00284 int m_nGridX;
00285 int m_nGridY;
00286 int m_nBorderX;
00287 int m_nBorderY;
00288
00289 int m_nTotalViewX;
00290 int m_nTotalViewY;
00291
00292 int m_PrintHeader;
00293 int m_PrintFooter;
00294 int m_nColPages;
00295 int m_nRowPages;
00296
00297 int m_nZeros;
00298
00299 int m_nObjectsCount;
00300
00301 int m_objectsID[MAXID];
00302
00303 unsigned char m_key[256];
00304
00305 CImageList m_imgList;
00306 CBitmap * m_pBitmap;
00307 CDC * m_pMemDC;
00308 CDC * m_pDC;
00309
00310 LOGFONT lf;
00311
00312 CRect m_clpRect;
00313 CRect m_dlgRect;
00314 CRect m_trkRect;
00315
00316 HFONT hfont;
00317
00318 CFont fontBold;
00319 CFont fontItalic;
00320 CFont fontNormal;
00321
00322 CString m_strDlgInfo;
00323 CString m_strFileName;
00324 CString m_strAppPath;
00325 CString m_strGuid;
00326 CString m_strDlgName;
00327
00328 CBitmap m_bmpMenu;
00329 CBitmap m_bmpPopupMenu;
00330 CBitmap m_bmpPicture;
00331 CBitmap * m_pBmpNumber;
00332
00333 int m_nTabLeft;
00334 int m_nTabRight;
00335 int m_nTabTop;
00336
00337
00338
00339 public:
00340
00341
00342
00343
00344 public:
00345 virtual void OnDraw(CDC* pDC);
00346 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00347 virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
00348 virtual void OnInitialUpdate();
00349 protected:
00350 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
00351 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
00352 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
00353 virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
00354
00355
00356
00357 public:
00358 virtual ~CFormCreatorView();
00359 #ifdef _DEBUG
00360 virtual void AssertValid() const;
00361 virtual void Dump(CDumpContext& dc) const;
00362 #endif
00363 protected:
00364
00365
00366 public:
00367
00368 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00369 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00370 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00371 afx_msg void OnTbButton();
00372 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00373 afx_msg void OnTbTextbox();
00374 afx_msg void OnTbCheckbutton();
00375 afx_msg void OnTbRadiobutton();
00376 afx_msg void OnTbStatictext();
00377 afx_msg void OnTbGroupbox();
00378 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00379 afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00380 afx_msg void OnTbVscrollbar();
00381 afx_msg void OnTbHscrollbar();
00382 afx_msg void OnTbListbox();
00383 afx_msg void OnTbPicture();
00384 afx_msg void OnTbProgressbar();
00385 afx_msg void OnTbSlider();
00386 afx_msg void OnTbTabcontrol();
00387 afx_msg void OnTbTreecontrol();
00388 afx_msg void OnTbCombobox();
00389 afx_msg void OnTbTestmode();
00390 afx_msg void OnTbListcontrol();
00391 afx_msg void OnTbSpin();
00392 afx_msg void OnTbIpaddress();
00393 afx_msg void OnTbHotkey();
00394 afx_msg void OnTbDatetimepicker();
00395 afx_msg void OnTbAlgnobjleft();
00396 afx_msg void OnTbAlgnobjright();
00397 afx_msg void OnTbAlgnobjtop();
00398 afx_msg void OnTbAlgnobjbottom();
00399 afx_msg void OnTbCenterv();
00400 afx_msg void OnTbCenterh();
00401 afx_msg void OnTbGrid();
00402 afx_msg void OnTbSamesizev();
00403 afx_msg void OnTbSamesizeh();
00404 afx_msg void OnTbSamesizevh();
00405 afx_msg void OnTbSpacev();
00406 afx_msg void OnTbSpaceh();
00407 afx_msg void OnTbCalendar();
00408 afx_msg void OnTbRichedit();
00409 afx_msg void OnTbSgrid();
00410 afx_msg void OnFileOpen();
00411 afx_msg void OnGridUser();
00412 afx_msg void OnGrid0();
00413 afx_msg void OnGrid1();
00414 afx_msg void OnGrid2();
00415 afx_msg void OnGrid3();
00416 afx_msg void OnGrid4();
00417 afx_msg void OnUpdateGrid0(CCmdUI* pCmdUI);
00418 afx_msg void OnUpdateGrid1(CCmdUI* pCmdUI);
00419 afx_msg void OnUpdateGrid2(CCmdUI* pCmdUI);
00420 afx_msg void OnUpdateGrid3(CCmdUI* pCmdUI);
00421 afx_msg void OnUpdateGrid4(CCmdUI* pCmdUI);
00422 afx_msg void OnUpdateGridUser(CCmdUI* pCmdUI);
00423 afx_msg void OnFileSaveAs();
00424 afx_msg void OnEditCopy();
00425 afx_msg void OnEditPaste();
00426 afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
00427 afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
00428 afx_msg void OnEditCut();
00429 afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
00430 afx_msg void OnFileImportDfm();
00431 afx_msg void OnFileExportDfm();
00432 afx_msg void OnTbPanel();
00433 afx_msg void OnFileSavehtml();
00434 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00435 afx_msg void OnTbSwitchwindow();
00436 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00437 afx_msg void OnMenu1Activ();
00438 afx_msg void OnMenu1Aligntoleft();
00439 afx_msg void OnMenu1Aligntoright();
00440 afx_msg void OnMenu1Aligntotop();
00441 afx_msg void OnMenu1Aligntobottom();
00442 afx_msg void OnMenu1Centerh();
00443 afx_msg void OnMenu1Centerv();
00444 afx_msg void OnMenu1Samesizeh();
00445 afx_msg void OnMenu1Samesizev();
00446 afx_msg void OnMenu1Samesizevh();
00447 afx_msg void OnMenu1Spaceh();
00448 afx_msg void OnMenu1Spacev();
00449 afx_msg void OnMenu1Switchapp();
00450 afx_msg void OnHelpContent();
00451 afx_msg void OnTbButtonedit();
00452 afx_msg void OnMenu1Properties();
00453 afx_msg void OnFileSave();
00454 afx_msg void OnTbMenu();
00455 afx_msg void OnTbPopupmenu();
00456 afx_msg void OnPaint();
00457 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00458 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00459 afx_msg void OnUserMessage(WPARAM wParam, LPARAM lParam);
00460 afx_msg void OnTbSnap();
00461
00462 DECLARE_MESSAGE_MAP()
00463 };
00464
00465 #ifndef _DEBUG // debug version in GuzikView.cpp
00466 inline CFormCreatorDoc* CFormCreatorView::GetDocument()
00467 { return (CFormCreatorDoc*)m_pDocument; }
00468 #endif
00469
00471
00472
00473
00474
00475 #endif // !defined(AFX_GUZIKVIEW_H__6C129010_E1EB_4343_9332_EB2D786EDC7B__INCLUDED_)