From b013e20a6885f84e89ebad7527d1d237f18894a8 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Fri, 12 Jan 2024 09:10:56 +0900 Subject: [PATCH] WIP --- src/WinWebDiffLib/DiffLocation.hpp | 139 +++++++++-------- src/WinWebDiffLib/WebDiffWindow.hpp | 25 ++-- src/WinWebDiffLib/WebToolWindow.hpp | 222 +++++++++++++++------------- src/WinWebDiffLib/WinWebDiffLib.h | 27 ---- src/WinWebDiffLib/WinWebDiffLib.js | Bin 30812 -> 31130 bytes 5 files changed, 210 insertions(+), 203 deletions(-) diff --git a/src/WinWebDiffLib/DiffLocation.hpp b/src/WinWebDiffLib/DiffLocation.hpp index c14d09b..bbf90d2 100644 --- a/src/WinWebDiffLib/DiffLocation.hpp +++ b/src/WinWebDiffLib/DiffLocation.hpp @@ -1,4 +1,3 @@ -#include "WinWebDiffLib.h" #include #include #include @@ -10,14 +9,38 @@ using WValue = rapidjson::GenericValue>; class DiffLocation { public: - void read(int pane, const WDocument& doc) + struct Rect + { + float left; + float top; + float width; + float height; + }; + struct ContainerRect : public Rect + { + int id; + int containerId; + float scrollLeft; + float scrollTop; + float scrollWidth; + float scrollHeight; + float clientWidth; + float clientHeight; + }; + struct DiffRect : public Rect + { + int id; + int containerId; + }; + + void read(const WDocument& doc) { std::wstring window = doc[L"window"].GetString(); - std::vector containerRects; - std::vector diffRects; + std::vector containerRects; + std::vector diffRects; for (const auto& value : doc[L"diffRects"].GetArray()) { - IWebDiffWindow::DiffRect rect; + DiffRect rect; rect.id = value[L"id"].GetInt(); rect.containerId = value[L"containerId"].GetInt(); rect.left = value[L"left"].GetFloat(); @@ -28,7 +51,7 @@ class DiffLocation } for (const auto& value : doc[L"containerRects"].GetArray()) { - IWebDiffWindow::ContainerRect rect; + ContainerRect rect; rect.id = value[L"id"].GetInt(); rect.containerId = value[L"containerId"].GetInt(); rect.left = value[L"left"].GetFloat(); @@ -43,41 +66,36 @@ class DiffLocation rect.clientHeight = value[L"clientHeight"].GetFloat(); containerRects.push_back(rect); } - m_diffRects[pane].insert_or_assign(window, diffRects); - m_containerRects[pane].insert_or_assign(window, containerRects); + m_diffRects.insert_or_assign(window, diffRects); + m_containerRects.insert_or_assign(window, containerRects); if (window == L"") { - m_scrollX[pane] = doc[L"scrollX"].GetFloat(); - m_scrollY[pane] = doc[L"scrollY"].GetFloat(); - m_clientWidth[pane] = doc[L"clientWidth"].GetFloat(); - m_clientHeight[pane] = doc[L"clientHeight"].GetFloat(); + m_scrollX = doc[L"scrollX"].GetFloat(); + m_scrollY = doc[L"scrollY"].GetFloat(); + m_clientWidth = doc[L"clientWidth"].GetFloat(); + m_clientHeight = doc[L"clientHeight"].GetFloat(); } } void clear() { - for (int pane = 0; pane < 3; ++pane) - { - m_diffRects[pane].clear(); - m_containerRects[pane].clear(); - m_diffRectsSerialized[pane].clear(); - m_containerRectsSerialized[pane].clear(); - m_scrollX[pane] = 0.0f; - m_scrollY[pane] = 0.0f; - m_clientWidth[pane] = 0.0f; - m_clientHeight[pane] = 0.0f; - } + m_diffRects.clear(); + m_containerRects.clear(); + m_scrollX = 0.0f; + m_scrollY = 0.0f; + m_clientWidth = 0.0f; + m_clientHeight = 0.0f; } - IWebDiffWindow::DiffRect* getDiffRectArray(int pane, int& count) + std::vector getDiffRectArray() { - m_diffRectsSerialized[pane].clear(); - for (const auto& pair: m_diffRects[pane]) + std::vector diffRectsSerialized; + for (const auto& pair: m_diffRects) { const auto& key = pair.first; for (const auto& diffRect : pair.second) { - IWebDiffWindow::DiffRect rect; + DiffRect rect; rect.id = diffRect.id; rect.containerId = diffRect.containerId; rect.left = diffRect.left; @@ -86,32 +104,31 @@ class DiffLocation rect.height = diffRect.height; for (int containerId = diffRect.containerId; containerId != -1; ) { - IWebDiffWindow::ContainerRect containerRect = m_containerRects[pane][key][containerId]; + const ContainerRect& containerRect = m_containerRects[key][containerId]; clip(rect, containerRect); containerId = containerRect.containerId; } - rect.left += m_scrollX[pane]; - rect.top += m_scrollY[pane]; - m_diffRectsSerialized[pane].push_back(rect); + rect.left += m_scrollX; + rect.top += m_scrollY; + diffRectsSerialized.push_back(rect); } } - count = static_cast(m_diffRectsSerialized[pane].size()); - return m_diffRectsSerialized[pane].data(); + return diffRectsSerialized; } - IWebDiffWindow::ContainerRect* getContainerRectArray(int pane, int& count) + std::vector getContainerRectArray() { - m_containerRectsSerialized[pane].clear(); - for (const auto& pair: m_containerRects[pane]) + std::vector containerRectsSerialized; + for (const auto& pair: m_containerRects) { const auto& key = pair.first; for (const auto& containerRect : pair.second) { - IWebDiffWindow::ContainerRect rect; + ContainerRect rect; rect.id = containerRect.id; rect.containerId = containerRect.containerId; - rect.left = containerRect.left + m_scrollX[pane]; - rect.top = containerRect.top + m_scrollY[pane]; + rect.left = containerRect.left + m_scrollX; + rect.top = containerRect.top + m_scrollY; rect.width = containerRect.width; rect.height = containerRect.height; rect.scrollLeft = containerRect.scrollLeft; @@ -120,21 +137,31 @@ class DiffLocation rect.scrollHeight = containerRect.scrollHeight; rect.clientWidth = containerRect.clientWidth; rect.clientHeight = containerRect.clientHeight; - m_containerRectsSerialized[pane].push_back(rect); + containerRectsSerialized.push_back(rect); } } - count = static_cast(m_containerRectsSerialized[pane].size()); - return m_containerRectsSerialized[pane].data(); + return containerRectsSerialized; } - IWebDiffWindow::Rect getVisibleAreaRect(int pane) + Rect getVisibleAreaRect() { - return { m_scrollX[pane], m_scrollY[pane], m_clientWidth[pane], m_clientHeight[pane] }; + return { m_scrollX, m_scrollY, m_clientWidth, m_clientHeight }; } private: - bool clip(IWebDiffWindow::DiffRect& rect, const IWebDiffWindow::ContainerRect& containerRect) + bool clip(DiffRect& rect, const ContainerRect& containerRect) { + if (containerRect.id == 0 && (containerRect.width == 0 || containerRect.height == 0)) + return true; + if (rect.left + rect.width < containerRect.left || + rect.top + rect.height < containerRect.top || + rect.left > containerRect.left + containerRect.width || + rect.top > containerRect.top + containerRect.height) + { + rect.left = rect.top = -99999.9f; + rect.width = rect.height = 0.0f; + return true; + } if (rect.left < containerRect.left) { rect.width -= containerRect.left - rect.left; rect.left = containerRect.left; @@ -149,23 +176,13 @@ class DiffLocation if (rect.top + rect.height > containerRect.top + containerRect.height) { rect.height = containerRect.top + containerRect.height - rect.top; } - if (rect.left + rect.width < containerRect.left || - rect.top + rect.height < containerRect.top || - rect.left > containerRect.left + containerRect.width || - rect.top > containerRect.top + containerRect.height) - { - rect.left = rect.top = rect.width = rect.height = 0; - return true; - } return false; } - std::map> m_diffRects[3]; - std::map> m_containerRects[3]; - std::vector m_diffRectsSerialized[3]; - std::vector m_containerRectsSerialized[3]; - float m_scrollX[3] = { 0.0f, 0.0f, 0.0f }; - float m_scrollY[3] = { 0.0f, 0.0f, 0.0f }; - float m_clientWidth[3] = { 0.0f, 0.0f, 0.0f }; - float m_clientHeight[3] = { 0.0f, 0.0f, 0.0f }; + std::map> m_diffRects; + std::map> m_containerRects; + float m_scrollX = 0.0f; + float m_scrollY = 0.0f; + float m_clientWidth = 0.0f; + float m_clientHeight = 0.0f; }; diff --git a/src/WinWebDiffLib/WebDiffWindow.hpp b/src/WinWebDiffLib/WebDiffWindow.hpp index d523f5d..1842451 100644 --- a/src/WinWebDiffLib/WebDiffWindow.hpp +++ b/src/WinWebDiffLib/WebDiffWindow.hpp @@ -205,7 +205,7 @@ class CWebDiffWindow : public IWebDiffWindow } else if (event == L"diffRects") { - m_diffLocation.read(ev.pane, doc); + m_diffLocation[ev.pane].read(doc); } } for (const auto& listener : m_listeners) @@ -571,7 +571,8 @@ class CWebDiffWindow : public IWebDiffWindow listener->Invoke(ev); if (compareState == CompareState::COMPARED || compareState == CompareState::NOT_COMPARED) { - m_diffLocation.clear(); + if (ev.pane >= 0) + m_diffLocation[ev.pane].clear(); } if (compareState == CompareState::COMPARED) { @@ -808,19 +809,25 @@ class CWebDiffWindow : public IWebDiffWindow listener->Invoke(e); } - const DiffRect* GetDiffRectArray(int pane, int& count) override + std::vector GetDiffRectArray(int pane) { - return m_diffLocation.getDiffRectArray(pane, count); + return m_diffLocation[pane].getDiffRectArray(); } - const ContainerRect* GetContainerRectArray(int pane, int& count) override + std::vector GetContainerRectArray(int pane) { - return m_diffLocation.getContainerRectArray(pane, count); + return m_diffLocation[pane].getContainerRectArray(); } - Rect GetVisibleAreaRect(int pane) override + DiffLocation::Rect GetVisibleAreaRect(int pane) { - return m_diffLocation.getVisibleAreaRect(pane); + return m_diffLocation[pane].getVisibleAreaRect(); + } + + void ScrollTo(int pane, float scrollX, float scrollY) + { + std::wstring json = L"{\"event\": \"scrollTo\", \"window\": \"\", \"scrollX\": " + std::to_wstring(scrollX) + L", \"scrollY\": " + std::to_wstring(scrollY) + L"}"; + m_webWindow[pane].PostWebMessageAsJsonInAllFrames(json.c_str()); } private: @@ -1504,7 +1511,7 @@ class CWebDiffWindow : public IWebDiffWindow std::vector> m_listeners; int m_currentDiffIndex = -1; std::vector m_diffInfos; - DiffLocation m_diffLocation; + DiffLocation m_diffLocation[3]; DiffOptions m_diffOptions{}; bool m_bShowDifferences = true; bool m_bShowWordDifferences = true; diff --git a/src/WinWebDiffLib/WebToolWindow.hpp b/src/WinWebDiffLib/WebToolWindow.hpp index 30af0a2..55c7a7b 100644 --- a/src/WinWebDiffLib/WebToolWindow.hpp +++ b/src/WinWebDiffLib/WebToolWindow.hpp @@ -11,6 +11,8 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler { public: + const int MARGIN = 2; + CWebToolWindow() : m_hWnd(nullptr) , m_hInstance(nullptr) @@ -70,36 +72,6 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler EnableWindow(GetDlgItem(m_hWnd, IDC_WIDTH), !m_pWebDiffWindow->GetFitToWindow()); EnableWindow(GetDlgItem(m_hWnd, IDC_HEIGHT), !m_pWebDiffWindow->GetFitToWindow()); - /* - int w = static_cast(m_pWebDiffWindow)->GetDiffImageWidth(); - int h = static_cast(m_pWebDiffWindow)->GetDiffImageHeight(); - - RECT rc; - GetClientRect(m_hWnd, &rc); - int cx = rc.right - rc.left; - int cy = rc.bottom - rc.top; - - RECT rcTmp; - HWND hwndDiffMap = GetDlgItem(m_hWnd, IDC_DIFFMAP); - GetWindowRect(hwndDiffMap, &rcTmp); - POINT pt = { rcTmp.left, rcTmp.top }; - ScreenToClient(m_hWnd, &pt); - int mw = 0; - int mh = 0; - if (w > 0 && h > 0) - { - mh = h * (cx - 8) / w; - if (mh + pt.y > cy - 8) - mh = cy - 8 - pt.y; - mw = mh * w / h; - } - RECT rcDiffMap = { (cx - mw) / 2, pt.y, (cx + mw) / 2, pt.y + mh }; - SetWindowPos(hwndDiffMap, NULL, rcDiffMap.left, rcDiffMap.top, - rcDiffMap.right - rcDiffMap.left, rcDiffMap.bottom - rcDiffMap.top, SWP_NOZORDER); - - InvalidateRect(GetDlgItem(m_hWnd, IDC_DIFFMAP), NULL, TRUE); - */ - m_bInSync = false; } @@ -208,6 +180,30 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler TrackPopupMenu(hSubMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, 0, m_hWnd, nullptr); } + void OnClickDiffMap(HWND hwndDiffMap) + { + POINT pt; + GetCursorPos(&pt); + ScreenToClient(hwndDiffMap, &pt); + RECT rc; + GetClientRect(hwndDiffMap, &rc); + const int paneCount = m_pWebDiffWindow->GetPaneCount(); + + auto [scaleX, scaleY] = CalcScalingFactor(rc); + for (int pane = 0; pane < paneCount; ++pane) + { + RECT rcContainer = GetContainerRect(pane, 0, rc, scaleX, scaleY); + if (pt.x < rcContainer.right) + { + auto visibleArea = static_cast(m_pWebDiffWindow)->GetVisibleAreaRect(pane); + const float scrollX = std::clamp(static_cast((pt.x - rcContainer.left) / scaleX - visibleArea.width / 2), 0.0f, FLT_MAX); + const float scrollY = std::clamp(static_cast((pt.y - rcContainer.top) / scaleY - visibleArea.height / 2), 0.0f, FLT_MAX); + static_cast(m_pWebDiffWindow)->ScrollTo(pane, scrollX, scrollY); + break; + } + } + } + void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { if (m_bInSync) @@ -305,17 +301,7 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler case IDC_DIFFMAP: if (codeNotify == STN_CLICKED) { - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hwndCtl, &pt); - RECT rc; - GetClientRect(hwndCtl, &rc); - /* - m_pWebDiffWindow->ScrollTo( - pt.x * pImgMergeWindow->GetDiffImageWidth() / rc.right, - pt.y * pImgMergeWindow->GetDiffImageHeight() / rc.bottom, - true); - */ + OnClickDiffMap(hwndCtl); } break; } @@ -419,91 +405,113 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler DeleteObject(hBitmap); } - void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *pDrawItem) + std::pair CalcScalingFactor(const RECT& rc) const { - if (!m_pWebDiffWindow || m_pWebDiffWindow->GetPaneCount() == 0) - return; - IWebDiffWindow::ColorSettings colors; - m_pWebDiffWindow->GetDiffColorSettings(colors); - RECT rc; - GetClientRect(pDrawItem->hwndItem, &rc); - FillSolidRect(pDrawItem->hDC, { 0, 0, rc.right, rc.bottom }, RGB(255, 255, 255)); - const int left = rc.left; - const int top = rc.top; + float maxPaneWidth = 0, maxPaneHeight = 0; const int width = rc.right - rc.left; const int height = rc.bottom - rc.top; - - const IWebDiffWindow::ContainerRect* containerRects[3]; - const IWebDiffWindow::DiffRect* rects[3]; - int counts[3], containerCounts[3]; - float maxPaneWidth = 0, maxPaneHeight = 0; const int paneCount = m_pWebDiffWindow->GetPaneCount(); for (int pane = 0; pane < paneCount; ++pane) { - containerRects[pane] = m_pWebDiffWindow->GetContainerRectArray(pane, containerCounts[pane]); - rects[pane] = m_pWebDiffWindow->GetDiffRectArray(pane, counts[pane]); - if (containerCounts[pane] > 0) + if (!m_containerRects[pane].empty()) { - if (maxPaneWidth < containerRects[pane][0].scrollWidth) - maxPaneWidth = containerRects[pane][0].scrollWidth; - if (maxPaneHeight < containerRects[pane][0].scrollHeight) - maxPaneHeight = containerRects[pane][0].scrollHeight; + if (maxPaneWidth < m_containerRects[pane][0].scrollWidth) + maxPaneWidth = m_containerRects[pane][0].scrollWidth; + if (maxPaneHeight < m_containerRects[pane][0].scrollHeight) + maxPaneHeight = m_containerRects[pane][0].scrollHeight; } } - const int margin = 2; - double ratiox = static_cast(width - margin * (paneCount * 2)) / (maxPaneWidth * paneCount); - double ratioy = static_cast(height - margin * 2) / maxPaneHeight; - auto getContainerRect = [&](int pane, int i) -> RECT { - RECT rc; - if (i == 0) - { - rc.left = left + margin + width * pane / paneCount; - rc.top = top + margin; - rc.right = rc.left + static_cast(containerRects[pane][i].scrollWidth * ratiox); - rc.bottom = rc.top + static_cast(containerRects[pane][i].scrollHeight * ratioy); - } - else - { - rc.left = left + margin + width * pane / paneCount + static_cast(containerRects[pane][i].left * ratiox); - rc.top = top + margin + static_cast(containerRects[pane][i].top * ratioy); - rc.right = rc.left - margin + static_cast(containerRects[pane][i].width * ratiox); - rc.bottom = rc.top - margin + static_cast(containerRects[pane][i].height * ratioy); - } + double scaleX = static_cast(width - MARGIN * (paneCount * 2)) / (maxPaneWidth * paneCount); + double scaleY = static_cast(height - MARGIN * 2) / maxPaneHeight; + return { scaleX, scaleY }; + } + + RECT GetContainerRect(int pane, int i, const RECT& rcDiffMap, double scaleX, double scaleY) const + { + RECT rc{}; + if (m_containerRects[pane].empty()) return rc; - }; + const int left = rcDiffMap.left; + const int top = rcDiffMap.top; + const int width = rcDiffMap.right - rcDiffMap.left; + const int height = rcDiffMap.bottom - rcDiffMap.top; + const int paneCount = m_pWebDiffWindow->GetPaneCount(); + if (i == 0) + { + rc.left = left + MARGIN + width * pane / paneCount; + rc.top = top + MARGIN; + rc.right = rc.left + static_cast(m_containerRects[pane][i].scrollWidth * scaleX); + rc.bottom = rc.top + static_cast(m_containerRects[pane][i].scrollHeight * scaleY); + } + else + { + rc.left = left + MARGIN + width * pane / paneCount + static_cast(m_containerRects[pane][i].left * scaleX); + rc.top = top + MARGIN + static_cast(m_containerRects[pane][i].top * scaleY); + rc.right = rc.left - MARGIN + static_cast(m_containerRects[pane][i].width * scaleX); + rc.bottom = rc.top - MARGIN + static_cast(m_containerRects[pane][i].height * scaleY); + } + return rc; + }; + + void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *pDrawItem) + { + const int paneCount = m_pWebDiffWindow->GetPaneCount(); + if (!m_pWebDiffWindow || paneCount == 0) + return; + for (int pane = 0; pane < paneCount; ++pane) + { + m_containerRects[pane] = static_cast(m_pWebDiffWindow)->GetContainerRectArray(pane); + m_rects[pane] = static_cast(m_pWebDiffWindow)->GetDiffRectArray(pane); + } + for (int pane = 0; pane < paneCount; ++pane) + { + if (m_containerRects[pane].size() == 0) + return; + } + + IWebDiffWindow::ColorSettings colors; + m_pWebDiffWindow->GetDiffColorSettings(colors); + RECT rc; + GetClientRect(pDrawItem->hwndItem, &rc); + auto [scaleX, scaleY] = CalcScalingFactor(rc); + + FillSolidRect(pDrawItem->hDC, { 0, 0, rc.right, rc.bottom }, RGB(255, 255, 255)); const int curDiff = m_pWebDiffWindow->GetCurrentDiffIndex(); for (int pane = 0; pane < paneCount; ++pane) { - for (int i = 0; i < counts[pane]; ++i) + if (m_rects[pane].size() > 0) { - const RECT rcContainer = getContainerRect(pane, 0); - const int diffLeft = rcContainer.left + static_cast(rects[pane][i].left * ratiox); - const int diffTop = rcContainer.top + static_cast(rects[pane][i].top * ratioy); - const int diffRight = rcContainer.left + static_cast((rects[pane][i].left + rects[pane][i].width) * ratiox); - const int diffBottom = rcContainer.top + static_cast((rects[pane][i].top + rects[pane][i].height) * ratioy); - const RECT rc = {diffLeft, diffTop, diffRight, diffBottom}; - FillSolidRect(pDrawItem->hDC, rc, (curDiff == i) ? colors.clrSelDiff : colors.clrDiff); + const RECT rcContainer = GetContainerRect(pane, 0, rc, scaleX, scaleY); + for (int i = 0; i < m_rects[pane].size(); ++i) + { + if (m_rects[pane][i].left != -99999.9f || m_rects[pane][i].top != -99999.9f) + { + const int diffLeft = rcContainer.left + static_cast(m_rects[pane][i].left * scaleX); + const int diffTop = rcContainer.top + static_cast(m_rects[pane][i].top * scaleY); + const int diffRight = rcContainer.left + static_cast((m_rects[pane][i].left + m_rects[pane][i].width) * scaleX); + const int diffBottom = rcContainer.top + static_cast((m_rects[pane][i].top + m_rects[pane][i].height) * scaleY); + const RECT rc = { diffLeft, diffTop, diffRight, diffBottom }; + FillSolidRect(pDrawItem->hDC, rc, (curDiff == i) ? colors.clrSelDiff : colors.clrDiff); + } + } } HBRUSH hOldBrush = SelectBrush(pDrawItem->hDC, GetStockBrush(NULL_BRUSH)); - for (int i = 0; i < containerCounts[pane]; ++i) + for (int i = 0; i < m_containerRects[pane].size(); ++i) { - const RECT rcContainer = getContainerRect(pane, i); + const RECT rcContainer = GetContainerRect(pane, i, rc, scaleX, scaleY); Rectangle(pDrawItem->hDC, rcContainer.left, rcContainer.top, rcContainer.right, rcContainer.bottom); } - if (containerCounts[pane] > 0) - { - RECT rcContainer = getContainerRect(pane, 0); - auto visibleArea = m_pWebDiffWindow->GetVisibleAreaRect(pane); - - rcContainer.left += static_cast(visibleArea.left * ratiox); - rcContainer.right = static_cast(rcContainer.left + visibleArea.width * ratiox); - rcContainer.top += static_cast(visibleArea.top * ratioy); - rcContainer.bottom = static_cast(rcContainer.top + visibleArea.height * ratioy); - DrawTransparentRectangle(pDrawItem->hDC, - rcContainer.left, rcContainer.top, rcContainer.right, rcContainer.bottom, - RGB(96, 96, 255), 64); - } + RECT rcContainer = GetContainerRect(pane, 0, rc, scaleX, scaleY); + auto visibleArea = static_cast(m_pWebDiffWindow)->GetVisibleAreaRect(pane); + + rcContainer.left += static_cast(visibleArea.left * scaleX); + rcContainer.right = static_cast(rcContainer.left + visibleArea.width * scaleX); + rcContainer.top += static_cast(visibleArea.top * scaleY); + rcContainer.bottom = static_cast(rcContainer.top + visibleArea.height * scaleY); + DrawTransparentRectangle(pDrawItem->hDC, + rcContainer.left, rcContainer.top, rcContainer.right, rcContainer.bottom, + RGB(96, 96, 255), 64); SelectBrush(pDrawItem->hDC, hOldBrush); } @@ -568,6 +576,8 @@ class CWebToolWindow : public IWebToolWindow, IWebDiffEventHandler HMENU m_hComparePopup; HMENU m_hEventSyncPopup; IWebDiffWindow *m_pWebDiffWindow; + std::vector m_containerRects[3]; + std::vector m_rects[3]; bool m_bInSync; int m_nRef; diff --git a/src/WinWebDiffLib/WinWebDiffLib.h b/src/WinWebDiffLib/WinWebDiffLib.h index 53d8a4c..9c11fd9 100644 --- a/src/WinWebDiffLib/WinWebDiffLib.h +++ b/src/WinWebDiffLib/WinWebDiffLib.h @@ -115,30 +115,6 @@ struct IWebDiffWindow COLORREF clrSelWordDiffText; /**< Selected word difference text color */ }; - struct Rect - { - float left; - float top; - float width; - float height; - }; - struct ContainerRect : public Rect - { - int id; - int containerId; - float scrollLeft; - float scrollTop; - float scrollWidth; - float scrollHeight; - float clientWidth; - float clientHeight; - }; - struct DiffRect : public Rect - { - int id; - int containerId; - }; - virtual bool IsWebView2Installed() const = 0; virtual bool DownloadWebView2() const = 0; virtual void AddEventListener(IWebDiffEventHandler *handler) = 0; @@ -216,9 +192,6 @@ struct IWebDiffWindow virtual void SetSyncEventFlag(EventType event, bool flag) = 0; virtual CompareState GetCompareState() const = 0; virtual void RaiseEvent(const WebDiffEvent& e) = 0; - virtual const DiffRect* GetDiffRectArray(int pane, int& count) = 0; - virtual const ContainerRect* GetContainerRectArray(int pane, int& count) = 0; - virtual Rect GetVisibleAreaRect(int pane) = 0; }; struct IWebToolWindow diff --git a/src/WinWebDiffLib/WinWebDiffLib.js b/src/WinWebDiffLib/WinWebDiffLib.js index 2184274eaa12ee44c81a9f26b55743bd5b6cc6e1..dc09466897e5baac675f607e08a31d19528b10f2 100644 GIT binary patch delta 131 zcmccffpOMn#tl4WlP?qtOny+rGs%l(@*`V`$pMNSlM@mR*i#r18A=!uC$EoJoorAl zHhDuBk7Wo$K7$4WRE9y1p_n0=p$I6J1B4L_It&UpcgKvH7zheVOh I3S~A-0OIH+-~a#s delta 18 acmbRBneomC#tl4WlRqSiY>q3pVFCbIDhNyf