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

Method UpdateVisiblePos

Src/LocationView.cpp:943–978  ·  view source on GitHub ↗

* @brief Public function for updating visible area indicator. * * @param [in] nTopLine New topline for indicator * @param [in] nBottomLine New bottomline for indicator */

Source from the content-addressed store, hash-verified

941 * @param [in] nBottomLine New bottomline for indicator
942 */
943void CLocationView::UpdateVisiblePos(int nTopLine, int nBottomLine)
944{
945 if (m_bDrawn)
946 {
947 CMergeDoc *pDoc = GetDocument();
948 int nGroup = pDoc->GetActiveMergeView()->m_nThisGroup;
949 int pane = 0;
950 if (std::all_of(m_nSubLineCount, m_nSubLineCount + pDoc->m_nBuffers,
951 [&](int nSubLineCount) { return nSubLineCount == pDoc->GetView(nGroup, pane++)->GetSubLineCount(); }))
952 {
953 int nTopCoord = static_cast<int>(Y_OFFSET +
954 (static_cast<double>(nTopLine * m_lineInPix)));
955 int nBottomCoord = static_cast<int>(Y_OFFSET +
956 (static_cast<double>(nBottomLine * m_lineInPix)));
957 if (m_visibleTop != nTopCoord || m_visibleBottom != nBottomCoord)
958 {
959 // Visible area was changed
960 if (m_pSavedBackgroundBitmap != nullptr)
961 {
962 CClientDC dc(this);
963 CMyMemDC dcMem(&dc);
964 // Clear previous visible rect
965 DrawBitmap(&dcMem, 0, 0, m_pSavedBackgroundBitmap.get());
966
967 DrawVisibleAreaRect(&dcMem, nTopLine, nBottomLine);
968 }
969 }
970 }
971 else
972 {
973 InvalidateRect(nullptr);
974 for (pane = 0; pane < pDoc->m_nBuffers; pane++)
975 m_nSubLineCount[pane] = pDoc->GetView(nGroup, pane)->GetSubLineCount();
976 }
977 }
978}
979
980/**
981 * @brief Unset pointers to MergeEditView when location pane is closed.

Callers 1

Calls 5

DrawBitmapFunction · 0.85
GetSubLineCountMethod · 0.80
GetActiveMergeViewMethod · 0.45
GetViewMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected