1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#pragma once
 
#include "btnenh.h"
#include "General_Draw.h"
#include "FrameImg.h"
#include "Global_Define.h"
#include "ViewRecipeInspectionView.h"
#include "ViewRecipeProfileView.h"
#include "ViewRecipeChamferView.h"
 
// CViewRecipeSetting ´ëÈ­ »óÀÚÀÔ´Ï´Ù.
 
class CHardwareLightSettings;
class CGlassRecipe;
class CGlass_Data;
class CViewRecipeList;
class CViewUserDefectArea;
class CViewException;
class CViewLampControl;
class CViewRecipeSetting : public CDialogEx
                            ,public IUserDefectInterface2Parent            
                            , public IHoleRecipeView2Parent
                            , public IInspectRecipeView2Parent
{
    DECLARE_DYNAMIC(CViewRecipeSetting)
 
public:
    CViewRecipeSetting(CWnd* pParent = NULL);   // Ç¥ÁØ »ý¼ºÀÚÀÔ´Ï´Ù.
    virtual ~CViewRecipeSetting();
 
// ´ëÈ­ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù.
    enum { IDD = IDD_DLG_RECIPE_VIEW };
 
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV Áö¿øÀÔ´Ï´Ù.
    virtual BOOL OnInitDialog();
    virtual BOOL PreTranslateMessage(MSG* pMsg);
    LRESULT OnProcessStatus(WPARAM wParam, LPARAM lParam);
    afx_msg void OnPaint();    
    afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);    
    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnNMCustomdrawSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnNMReleasedcaptureSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
    afx_msg LRESULT OnSelectRecipe(WPARAM wParam, LPARAM lParam);    
    LRESULT    OnLightApplyRecipe(WPARAM wParam, LPARAM lParam);    
    LRESULT OnAreaModify(WPARAM wParam, LPARAM lParam);
    LRESULT OnAreaChange(WPARAM wParam, LPARAM lParam);    
    DECLARE_MESSAGE_MAP()
    DECLARE_EVENTSINK_MAP()
 
protected:        
    CBtnEnh            m_ctrlRecipeName,m_ctrlRecipList,m_ctrlRecipeComment;    
    IVisionEvent *m_pVisionEvent = nullptr;
 
public:
    void            SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
    void            SetV2M(IViewInterface2Parent* pV2M);
    void            SetGlassData(CGlass_Data *pGlass);
    void            ViewRefresh(PROG_MSG ProcMsg);
    void            InitView();
 
    static void             onMsgVisionEvent(int code, int eDir);
    static void          onMsgLogEvent(int level, std::string strText);
    void                DispAllResult(void);
    void                SetFrameRegion(void);
 
protected:
    enum            eViewSelect {eRcp_Inspection=0, eRcp_Profile, eRcp_Chamfer, eRcp_End};
    CBtnEnh            m_ctrlCmdSelect[eRcp_End];    
 
    void            ClickChkSelectlButton();
    void            SetButtonSelectEnableAll(const BOOL& bEnable);
    void            SetButtonSelectSel(eViewSelect eSelView, BOOL bEnable);
    void            ChangeRcpView(UINT nID);
    void            ChangeSelectView(UINT nViewID);
 
    void            ClickImgLoadButton();
    void            ClickImgSaveButton();
    void            ClickInitProcessButton();
    void            ClickInspectProcessButton();        
    void            ClickRecipeSaveButton();
    void            ClickRecipeListButton();    
    void            OnBnClickedBtnUserDefect();
    void            OnBnClickedBtnExpRegion();
    void            OnBnClickedBtnLightControl();
    void            OnClickButtonLang();
 
protected:
    virtual void        IU2P_DrawRect(BOOL bSet);
    virtual CRect        IU2P_GetCompareRect();
    virtual void        IU2P_DrawRefresh();
 
    virtual void        IE2P_SetExpArea(int iSide);
    virtual POINT        IE2P_GetFrameViewBasepoint();
    virtual void        IE2P_SetExpAreaTrackerReset();    
    virtual void        IE2P_SetExpAreaDlgClose();
 
    virtual BOOL        IHoleRecipe2RecipeView_AddHoleArea(int& nSideIdx, CRect& rtArea);
    virtual BOOL        IHoleRecipe2RecipeView_GetHoleAreaImage(int nHoleIdx, IplImage** pImageBuffer);
    virtual void        IHoleRecipe2RecipeView_UpdateFrameView();
    virtual void        IHoleRecipe2RecipeView_SaveRecipe();
    virtual BOOL        IHoleRecipe2RecipeVIew_HoleInspectProcess(int nHoleIdx, IplImage** pImageBuffer);
    virtual int            IHoleRecipe2RecipeView_GetCurrentSetSide();
 
    virtual BOOL        IInspectRecipe2RecipeView_SetMarker(int nPos,int nMarkPos);
    virtual void        IInspectRecipe2RecipeView_SetMarkerPos(int nOff_X,int nOff_Y);
    virtual void        IInspectRecipe2RecipeView_ModifyMarker(BOOL bModify);
    virtual void        IInspectRecipe2RecipeView_ChangeSide(int iSide);
 
protected:
    void            InitScrollInfo(BOOL bInitPos = FALSE);
    void            UpdateZoom();
    
    BOOL            LoadLinkFile(CString strFilePath);
    void            DeleteVectorList();
    BOOL            WriteLinkFile(CString strFilePath);
    void            ChangeRecipe();
    BOOL            ReadRecipe(CString strRecipe);        
    
protected:
    CvPoint2D32f    Get_MarkCenter(IplImage *IpScr,CvRect roi,int nMode,int nOffSet = 20);
    CvRect            Get_MaxPattern(IplImage *IpScr,CvRect roi,int nMode,int nOffSet = 20); 
 
protected:
    CHardwareSettings            *m_pHardware;
    CGlassRecipe            *m_pRecipe;
    CGlassRecipe            *m_pDlgRecipe;
    CGlass_Data                    *m_pGlassData;
    CViewRecipeList                *m_pViewRecipeList;    
    CViewUserDefectArea            *m_pViewUserDefect;
    CViewException                *m_pViewExpArea;    
    CViewLampControl            *m_pviewLightControl;
    CViewRecipeInspectionView    *m_pViewRecipeInspection;
    CViewRecipeProfileView        *m_pViewRecipeProfile;
    CViewRecipeChamferView        *m_pViewRecipeChamfer;
    BOOL                        m_bShowExpArea;
        
    VectorLinkList                m_VectorLinkList;    
    IViewInterface2Parent        *m_IV2M;    
    
 
    double                        m_dZoom;
    CFrameImg                    m_frameImg;
    CRect                        m_rcFrameImg;
    CScrollBar                    m_ctrlScrollV,m_ctrlScrollH;
    CSliderCtrl                    m_sliderZoom;
    CString                        m_strRecipeName,m_strPPIDName;
 
    CDialogEx* m_pVisionSetDlg;
 
    int                            m_nCndRDSide;    
    int                            m_nCndSelect;
public:
    void ClickButtonVisionSet();
};