FLImaging 6.5.7.5
GUIManagerView.h
1#pragma once
2
3#include "GUIFixedViewPlacementSet.h"
4#include "GUIDefinitions.h"
5#include <map>
6#include <set>
7
8class CUIThread;
9
10namespace FLImaging
11{
12 namespace GUI
13 {
14 class CGUIViewImageBase;
15 class CGUIViewImage;
16 class CGUIView3D;
17 class CGUIView3DPathEditor;
18 class CGUIViewDrawing;
19 class CGUIViewGraph;
20 class CGUIViewSNAP;
21 class CGUIMainFrame;
22 class CGUIViewImageObjectFigure;
23 class CGUIChildFrameBase;
24 class CInternalViewManager;
25 class CGUIDialogCreateStencil;
26 class CGUIWndGrip;
27
28 class FL_EXPORT CGUIManagerView : public Base::CFLBase
29 {
30 CGUIManagerView();
31 CGUIManagerView(const CGUIManagerView& rh);
32 public:
33
34 virtual ~CGUIManagerView();
35
36 static CResult CreateView(CGUIViewImageBase* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
37 static CResult CreateViewImage(CGUIViewImage* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
38 static CResult CreateViewGraph(CGUIViewGraph* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
39 static CResult CreateView3D(CGUIView3D* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
40 static CResult CreateView3DPathEditor(CGUIView3DPathEditor* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
41 static CResult CreateViewDrawing(CGUIViewDrawing* pView, int32_t i32L, int32_t i32T, int32_t i32R, int32_t i32B, size_t stParentWindowHandle);
42
43 static const CResult CloseView(CGUIViewImageBase* pView);
44 static const CResult DestroyView(CGUIViewImageBase* pView);
45 static const CResult DestroyAllViews();
46
47 static void RemoveViewThread(CUIThread* pThread);
48
49 static bool IsAvailableView(CGUIViewImageBase* pView);
50
51 static bool IsUsedUIMultiThread();
52 static void UseUIMultiThread(bool bUse);
53
54 static void SetThumbnailDraggingMode(bool bSet);
55 static bool IsThumbnailDraggingMode();
56
57 static void UpdateClipboardViewImage();
58
59 static CResult SetCopySourceImage(Base::CFLImage* pFliSource, int32_t i32PageIndex = -1, double f64MinVal = 0., double f64MaxVal = 1.);
60 static const Base::CFLImage* GetCopySourceImage();
61 static const Base::CFLImage* GetIntrinsicCopySourceImage();
62 static int64_t GetCopySourcePageIndex();
63
64 static void SetViewImageThumbnailDraggingSource(CGUIViewImage* pViewSource);
65 static CGUIViewImage* GetViewImageThumbnailDraggingSource();
66 static CGUIViewImage* GetViewImageCopyFigureSource();
67
68 static void SetThumbnailDraggingImageSource(Base::CFLImage* pFliSource, int32_t i32SelectedPageIndex = -1);
69 static void SetThumbnailDraggingImageSource(Base::CFLImage* pFliSource, Base::CFLArray<int32_t>& flaSelectedThumbnailIndex);
70 static const Base::CFLImage* GetThumbnailDraggingImageSource();
71 static void GetSelectedThumbnailIndex(Base::CFLArray<int32_t>& flaSelectedThumbnailIndex);
72
73 static void CopyFigureObject(CGUIViewImageBase* pViewSource);
74 static void PasteFigureObject(CGUIViewImageBase* pViewTarget);
75
76 static void ShowHelpDialogViewImage(CGUIViewImage* pView);
77 static void ShowHelpDialogViewGraph(CGUIViewGraph* pView);
78 static void ShowHelpDialogView3D(CGUIView3D* pView);
79 static void ShowHelpDialogViewSNAP(CGUIViewSNAP* pView);
80 static void ShowHelpDialogViewDrawing(CGUIViewDrawing* pView);
81 static void ShowHelpDialogMainFrame(CGUIMainFrame* pMF);
82
83 static void InitializeClassContainer();
84 static std::string ExtractClassName(const type_info& rhs);
85 static std::string ExtractClassNameWithNamespace(const type_info& rhs);
86 static void CommonExtractClassName(std::string& strResult, size_t stInitialPosition);
87
88 static bool AddMultiDocTemplate(UINT uIDResource, CRuntimeClass* pDoc, CRuntimeClass* pFrame, CRuntimeClass* pView);
89 static bool AddWindow(CDocument* pDoc, CFrameWnd* pFrame, CView* pView);
90
91 static bool DeleteWindow(CDocument* pDoc);
92 static bool DeleteWindow(CFrameWnd* pFrame);
93 static bool DeleteWindow(CView* pView);
94
95 static int64_t GetMultiDocTemplateCount();
96
97 static CMultiDocTemplate* GetMultiDocTemplate(size_t stIndex);
98 static CMultiDocTemplate* GetMultiDocTemplate(std::string strMultiDocTemplateName);
99
100 static std::string GetMultiDocTemplateName(size_t stIndex);
101 static std::string GetMultiDocTemplateName(CRuntimeClass* pDoc, CRuntimeClass* pFrame, CRuntimeClass* pView);
102 static std::string GetMultiDocTemplateName(CMultiDocTemplate* pMultiDocTemplate);
103
104 static size_t GetViewCount();
105 static CGUIViewBase* FindViewByIndex(size_t stIndex);
106 static CGUIViewBase* FindViewByIndex(CRuntimeClass* pRtcView, size_t stIndex);
107 static CGUIViewBase* FindViewByIndexDerivedFrom(CRuntimeClass* pRtcView, size_t stIndex);
108
109 static CGUIViewBase* FindViewByViewNumber(size_t stViewNumber);
110 static CGUIViewBase* FindViewByViewNumber(const Base::CFLString<wchar_t>& strTitle);
111 static CGUIViewBase* FindViewByViewNumber(CRuntimeClass* pRtcView, size_t stViewNumber);
112 static CGUIViewBase* FindViewByViewNumber(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle);
113 static CGUIViewBase* FindViewByViewNumberDerivedFrom(CRuntimeClass* pRtcView, size_t stViewNumber);
114 static CGUIViewBase* FindViewByViewNumberDerivedFrom(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle);
115
116 static std::vector<CGUIViewBase*> FindView(const Base::CFLString<wchar_t>& strTitle);
117 static std::vector<CGUIViewBase*> FindView(CRuntimeClass* pRtcView);
118 static std::vector<CGUIViewBase*> FindViewDerivedFrom(CRuntimeClass* pRtcView);
119 static std::vector<CGUIViewBase*> FindView(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle);
120 static std::vector<CGUIViewBase*> FindViewDerivedFrom(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle);
121 static std::vector<CGUIViewImage*> FindViewImage();
122
123 static const CResult FindView(const Base::CFLString<wchar_t>& strTitle, std::vector<CGUIViewBase*>& vctResult);
124 static const CResult FindView(CRuntimeClass* pRtcView, std::vector<CGUIViewBase*>& vctResult);
125 static const CResult FindViewDerivedFrom(CRuntimeClass* pRtcView, std::vector<CGUIViewBase*>& vctResult);
126 static const CResult FindView(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle, std::vector<CGUIViewBase*>& vctResult);
127 static const CResult FindViewDerivedFrom(CRuntimeClass* pRtcView, const Base::CFLString<wchar_t>& strTitle, std::vector<CGUIViewBase*>& vctResult);
128 static const CResult FindViewImage(std::vector<CGUIViewImage*>& vctResult);
129
130 static bool DoesViewImageExist();
131 static bool DoesViewGraphExist();
132 static bool DoesView3DExist();
133 static bool DoesView3DPathEditorExist();
134 static bool DoesViewDrawingExist();
135 static bool DoesViewSNAPExist();
136
137 static bool DoesVisibleViewImageExist();
138 static bool DoesVisibleViewGraphExist();
139 static bool DoesVisibleView3DExist();
140 static bool DoesVisibleView3DPathEditorExist();
141 static bool DoesVisibleViewDrawingExist();
142 static bool DoesVisibleViewSNAPExist();
143
144 static std::vector<CGUIViewBase*> FindViewAnyOf(Base::CFLString<wchar_t> strTitle);
145
146 static CDocument* FindWindowVDocument(size_t stIndex);
147 static std::vector<CDocument*> FindWindowVDocument(Base::CFLString<wchar_t> strTitle);
148 static CFrameWnd* FindWindowFrame(size_t stIndex);
149 static std::vector <CFrameWnd*> FindWindowFrame(Base::CFLString<wchar_t> strTitle);
150 static CView* FindWindowView(size_t stIndex);
151 static std::vector <CView*>FindWindowView(Base::CFLString<wchar_t> strTitle);
152
153
154 static bool AddFixedViewDeclaration(CGUIFixedViewDeclaration* pFLImagingGUIFVP);
155 static int64_t GetFixedViewDeclarationCount();
156 static CResult RemoveFixedViewDeclaration(size_t stIndex);
157 static CResult RemoveFixedViewDeclaration(CGUIFixedViewDeclaration* pFLImagingGUIFVP);
158 static CGUIFixedViewDeclaration* GetFixedViewDeclaration(int64_t i64Index);
159
160 static void AddFixedViewPlacementSet(CGUIFixedViewPlacementSet& fvpSet, bool bAddMenuItem = true);
161 static void AddFixedViewPlacementSet(CGUIFixedViewPlacementSet* pFvpSet, bool bAddMenuItem = true);
162 static CResult RemoveFixedViewPlacementSet(size_t stIndex);
163 static int64_t GetFixedViewPlacementSetCount();
164 static CGUIFixedViewPlacementSet* GetFixedViewPlacementSet(size_t stIndex);
165 static CGUIFixedViewPlacementSet* GetFixedViewPlacementSet(const Base::CFLString<wchar_t>& strFvpSetName);
166 static int64_t GetFixedViewPlacementSetIndex(const CGUIFixedViewPlacementSet* pFvpSet);
167
168 static int64_t GetSelectedFixedViewPlacementSetIndex();
169 static CGUIFixedViewPlacementSet* GetSelectedFixedViewPlacementSet();
170
171 static bool SelectFixedViewPlacementSet(const Base::CFLString<wchar_t>& strFvpSetName);
172 static bool SelectFixedViewPlacementSet(size_t stIndex);
173
174 static bool CreateFixedView(size_t stIndex);
175 static bool RelocateFixedView();
176
177 static bool PreDestroyViewImage();
178 static bool PreDestroyViewGraph();
179 static bool PreDestroyView3D();
180 static bool PreDestroyView3DPathEditor();
181 static bool PreDestroyViewDrawing();
182 static bool PreDestroyViewSNAP();
183 static bool PreDestroyViewImageBase();
184
185 static void LButtonDownOnNcHitView(const Base::TPoint<int>& tpScreen);
186 static void LButtonUpOnNcHitView(const Base::TPoint<int>& tpScreen);
187 static void MouseMoveOnNcHitView(Base::TPoint<int>& tpScreen);
188 static bool InitializeLayoutGrip(CWnd* pWndParent);
189 static void HideLayoutGrip();
190 static void ViewNcHitTest(const Base::TPoint<int>& tpScreen);
191
192 static bool IsInitialized();
193
194 static int64_t GetSNAPViewSerialNumber();
195
196 DeclareGetClassType();
197
198 protected:
199 static Foundation::CStencil* GetInternalStencilPtr();
200
201 private:
202 static bool Initialize();
203 static bool Terminate();
204
205 static bool CreateFixedView();
206 static bool ShowOnlySelectedFixedViews();
207
208 static void SetInitialize(bool bSet);
209
210 virtual void OnReceiveBroadcast(const Base::CBroadcastMessage* pMessage) override;
211 static CGUIManagerView* GetObject();
212
213 private:
214 CInternalViewManager* m_pInternal;
215 Base::CFLImage* m_pFliCopySource;
216 Base::CFLImage m_fliIntrinsicCopySource;
217 int64_t m_i64FliCopySourcePageNum;
218 CGUIViewImage* m_pViewCopyFigureSource;
219
220 CGUIViewImage* m_pViewImageThumbnailDraggingSource;
221 Base::CFLImage* m_pFliThumbnailDraggingSource;
222 Base::CFLArray<int32_t> m_flaSelectedThumbnailIdx;
223 bool m_bThumbnailDraggingMode;
224
225 bool m_bUsedUIMultiThread;
226 std::map<CGUIViewImageBase*, CUIThread*>& m_mapThreads;
227 DWORD m_dwClipboardSequenceNumber;
228
229 volatile bool m_bInitialized;
230
231 CGUIWndGrip* m_pLayoutGripVert;
232 CGUIWndGrip* m_pLayoutGripHorz;
233 Base::TPoint<int> m_tpScreenPrev;
234 Base::TRect<int> m_trScreenVertRect;
235 Base::TRect<int> m_trScreenHorzRect;
236 int32_t m_i32MFOffsetX;
237 int32_t m_i32MFOffsetY;
238
239 bool m_bHorzRectVisible;
240 bool m_bVertRectVisible;
241 bool m_bLButtonDownOnNcHitView;
242
243 std::vector<CMultiDocTemplate*>& m_vctMultiDocTemplates;
244 std::map<std::string, CMultiDocTemplate*>& m_mapMultiDocTemplates;
245 std::map<CMultiDocTemplate*, std::string>& m_mapMultiDocTemplatesReverse;
246
247 std::vector<CGUIFixedViewDeclaration*>& m_vctFixedViewDeclaration;
248 std::vector<CGUIFixedViewPlacementSet*>& m_vctFixedViewPlacementSet;
249
250 std::vector<CDocument*>& m_vctDoc;
251 std::vector<CFrameWnd*>& m_vctFrame;
252 std::vector<CView*>& m_vctView;
253
254 std::vector <CGUIChildFrameBase*>& m_vctFrameToResize;
255 std::set <int32_t>& m_setI32FrameX;
256 std::set <int32_t>& m_setI32FrameY;
257
258 size_t m_stSelectedPlacementSet;
259
260 friend class CGUIManager;
261
262 friend class CInternalViewManager;
263 friend class CGUIDialogCreateStencil;
264 };
265 }
266}
267