MCPcopy Create free account
hub / github.com/WinMerge/winmerge / OnCreateClient

Method OnCreateClient

Src/MergeEditFrm.cpp:77–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77BOOL CMergeEditFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
78 CCreateContext* pContext)
79{
80 m_wndSplitter.HideBorders(true);
81 m_wndSplitter.Create(this, 2, 1, CSize(1, 1), pContext, WS_CHILD | WS_VISIBLE | 1/*SPLS_DYNAMIC_SPLIT*/);
82
83 // Merge frame has also a dockable bar at the very left
84 // This is not the client area, but we create it now because we want
85 // to use the CCreateContext
86 String sCaption = _("Location Pane");
87 if (!m_wndLocationBar.Create(this, sCaption.c_str(), WS_CHILD | WS_VISIBLE, ID_VIEW_LOCATION_BAR))
88 {
89 TRACE0("Failed to create LocationBar\n");
90 return FALSE;
91 }
92
93 CLocationView *pLocationView = new CLocationView;
94 DWORD dwStyle = AFX_WS_DEFAULT_VIEW & ~WS_BORDER;
95 pLocationView->Create(nullptr, nullptr, dwStyle, CRect(0,0,40,100), &m_wndLocationBar, 152, pContext);
96
97 // Merge frame has also a dockable bar at the very bottom
98 // This is not the client area, but we create it now because we want
99 // to use the CCreateContext
100 sCaption = _("Diff Pane");
101 if (!m_wndDetailBar.Create(this, sCaption.c_str(), WS_CHILD | WS_VISIBLE, ID_VIEW_DETAIL_BAR))
102 {
103 TRACE0("Failed to create DiffViewBar\n");
104 return FALSE;
105 }
106
107 m_pwndDetailMergeEditSplitterView = new CMergeEditSplitterView();
108 m_pwndDetailMergeEditSplitterView->m_bDetailView = true;
109 m_pwndDetailMergeEditSplitterView->Create(nullptr, nullptr, dwStyle, CRect(0,0,1,1), &m_wndDetailBar, ID_VIEW_DETAIL_BAR+1, pContext);
110
111 // tell merge doc about these views
112 m_pMergeDoc = dynamic_cast<CMergeDoc *>(pContext->m_pCurrentDoc);
113 m_pMergeDoc->ForEachView([&](auto& pView) {
114 pView->SetStatusInterface(m_wndStatusBar.GetIMergeEditStatus(pView->m_nThisPane));
115 });
116 m_pMergeDoc->SetLocationView(pLocationView);
117
118 m_wndFilePathBar.SetPaneCount(m_pMergeDoc->m_nBuffers);
119 m_wndFilePathBar.SetOnSetFocusCallback([&](int pane) {
120 const int nGroup = m_pMergeDoc->GetActiveMergeView()->m_nThisGroup;
121 m_pMergeDoc->GetView(nGroup, pane)->SetActivePane();
122 });
123 m_wndFilePathBar.SetOnCaptionChangedCallback([&](int pane, const String& sText) {
124 const int nGroup = m_pMergeDoc->GetActiveMergeView()->m_nThisGroup;
125 m_pMergeDoc->SetDescription(pane, sText);
126 m_pMergeDoc->UpdateHeaderPath(pane);
127 m_pMergeDoc->GetView(nGroup, pane)->SetFocus();
128 });
129 m_wndFilePathBar.SetOnFileSelectedCallback([&](int pane, const String& sFilepath) {
130 const int nGroup = m_pMergeDoc->GetActiveMergeView()->m_nThisGroup;
131 m_pMergeDoc->ChangeFile(pane, sFilepath);
132 m_pMergeDoc->GetView(nGroup, pane)->SetFocus();
133 });
134 m_wndStatusBar.SetPaneCount(m_pMergeDoc->m_nBuffers);

Callers

nothing calls this directly

Calls 15

CRectClass · 0.85
HideBordersMethod · 0.80
SetStatusInterfaceMethod · 0.80
GetIMergeEditStatusMethod · 0.80
SetLocationViewMethod · 0.80
SetOnSetFocusCallbackMethod · 0.80
CreateMethod · 0.45
ForEachViewMethod · 0.45
SetPaneCountMethod · 0.45
GetActiveMergeViewMethod · 0.45

Tested by

no test coverage detected