Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Nov 18, 2023
1 parent 0c158c0 commit de0401e
Show file tree
Hide file tree
Showing 46 changed files with 151 additions and 219 deletions.
20 changes: 16 additions & 4 deletions Src/Merge.rc
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,9 @@ BEGIN
MENUITEM "1280x800", ID_WEB_SIZE_1280x800
MENUITEM "1440x900", ID_WEB_SIZE_1440x900
END
POPUP "&Syncronize Events"
POPUP "&Event Synchronization"
BEGIN
MENUITEM "&Enable All", ID_WEB_SYNC_ENABLE_ALL
MENUITEM "&Disable All", ID_WEB_SYNC_DISABLE_ALL
MENUITEM "&Enabled", ID_WEB_SYNC_ENABLED
MENUITEM SEPARATOR
MENUITEM "&Scroll", ID_WEB_SYNC_SCROLL
MENUITEM "&Click", ID_WEB_SYNC_CLICK
Expand Down Expand Up @@ -1163,6 +1162,18 @@ BEGIN
END
END

IDR_POPUP_WEBPAGE_SYNC_EVENTS MENU
BEGIN
POPUP "_POPUP_"
BEGIN
MENUITEM "&Enabled", ID_WEB_SYNC_ENABLED
MENUITEM SEPARATOR
MENUITEM "&Scroll", ID_WEB_SYNC_SCROLL
MENUITEM "&Click", ID_WEB_SYNC_CLICK
MENUITEM "&Input", ID_WEB_SYNC_INPUT
END
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -2341,7 +2352,8 @@ BEGIN
EDITTEXT IDC_ZOOM,178,2,32,14,ES_AUTOHSCROLL,WS_EX_RIGHT
LTEXT "UA:",-1,214,4,16,10
EDITTEXT IDC_USERAGENT,230,2,128,14,ES_AUTOHSCROLL
CONTROL "View &Differences",IDC_SHOWDIFFERENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,362,2,96,14
CONTROL "&Event Synchronization",IDC_SYNC_EVENTS,"Button",BS_SPLITBUTTON | WS_TABSTOP,362,2,106,14
CONTROL "View &Differences",IDC_SHOWDIFFERENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,472,2,96,14
END


Expand Down
2 changes: 2 additions & 0 deletions Src/OptionsDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ inline const String OPT_CMP_WEB_VIEW_WIDTH {_T("Settings/WebPageViewWidth"s)};
inline const String OPT_CMP_WEB_VIEW_HEIGHT {_T("Settings/WebPageViewHeight"s)};
inline const String OPT_CMP_WEB_ZOOM {_T("Settings/WebZoom"s)};
inline const String OPT_CMP_WEB_USER_AGENT {_T("Settings/WebUserAgent"s)};
inline const String OPT_CMP_WEB_SYNC_EVENTS {_T("Settings/WebSyncEvents"s)};
inline const String OPT_CMP_WEB_SYNC_EVENT_FLAGS {_T("Settings/WebSyncEventFlags"s)};
inline const String OPT_CMP_WEB_URL_PATTERN_TO_INCLUDE {_T("Settings/WebPageURLPatternToInclude"s)};
inline const String OPT_CMP_WEB_URL_PATTERN_TO_EXCLUDE {_T("Settings/WebPageURLPatternToExclude"s)};

Expand Down
2 changes: 2 additions & 0 deletions Src/OptionsInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ void Init(COptionsMgr *pOptions)
pOptions->InitOption(OPT_CMP_WEB_USER_AGENT, _T(""));
pOptions->InitOption(OPT_CMP_WEB_URL_PATTERN_TO_INCLUDE, _T(""));
pOptions->InitOption(OPT_CMP_WEB_URL_PATTERN_TO_EXCLUDE, _T(""));
pOptions->InitOption(OPT_CMP_WEB_SYNC_EVENTS, false);
pOptions->InitOption(OPT_CMP_WEB_SYNC_EVENT_FLAGS, 0xff);

pOptions->InitOption(OPT_PROJECTS_PATH, _T(""));
pOptions->InitOption(OPT_USE_SYSTEM_TEMP_PATH, true);
Expand Down
45 changes: 34 additions & 11 deletions Src/WebPageDiffFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ BEGIN_MESSAGE_MAP(CWebPageDiffFrame, CMergeFrameCommon)
ON_COMMAND(ID_WEB_COMPARE_HTMLS, OnWebCompareHTMLs)
ON_COMMAND(ID_WEB_COMPARE_TEXTS, OnWebCompareTexts)
ON_COMMAND(ID_WEB_COMPARE_RESOURCETREES, OnWebCompareResourceTrees)
ON_COMMAND_RANGE(ID_WEB_SYNC_ENABLE_ALL, ID_WEB_SYNC_INPUT, OnWebSyncEvent)
ON_UPDATE_COMMAND_UI_RANGE(ID_WEB_SYNC_SCROLL, ID_WEB_SYNC_INPUT, OnUpdateWebSyncEvent)
ON_COMMAND_RANGE(ID_WEB_SYNC_ENABLED, ID_WEB_SYNC_INPUT, OnWebSyncEvent)
ON_UPDATE_COMMAND_UI_RANGE(ID_WEB_SYNC_ENABLED, ID_WEB_SYNC_INPUT, OnUpdateWebSyncEvent)
ON_COMMAND_RANGE(ID_WEB_CLEAR_DISK_CACHE, ID_WEB_CLEAR_ALL_PROFILE, OnWebClear)
// [Tools] menu
ON_COMMAND(ID_TOOLS_GENERATEREPORT, OnToolsGenerateReport)
Expand All @@ -131,6 +131,7 @@ BEGIN_MESSAGE_MAP(CWebPageDiffFrame, CMergeFrameCommon)
ON_BN_CLICKED(IDC_FITTOWINDOW, OnBnClickedFitToWindow)
ON_BN_CLICKED(IDC_SHOWDIFFERENCES, OnBnClickedShowDifferences)
ON_BN_CLICKED(IDC_COMPARE, OnBnClickedCompare)
ON_BN_CLICKED(IDC_SYNC_EVENTS, OnBnClickedSyncEvents)
ON_EN_CHANGE(IDC_WIDTH, OnEnChangeWidth)
ON_EN_CHANGE(IDC_HEIGHT, OnEnChangeHeight)
ON_EN_CHANGE(IDC_ZOOM, OnEnChangeZoom)
Expand All @@ -140,6 +141,7 @@ BEGIN_MESSAGE_MAP(CWebPageDiffFrame, CMergeFrameCommon)
ON_EN_KILLFOCUS(IDC_ZOOM, OnKillFocusBarControls)
ON_EN_KILLFOCUS(IDC_USERAGENT, OnKillFocusBarControls)
ON_NOTIFY(BCN_DROPDOWN, IDC_COMPARE, OnDropDownCompare)
ON_NOTIFY(BCN_DROPDOWN, IDC_SYNC_EVENTS, OnDropDownSyncEvents)
// Status bar
ON_UPDATE_COMMAND_UI(ID_STATUS_DIFFNUM, OnUpdateStatusNum)
//}}AFX_MSG_MAP
Expand Down Expand Up @@ -616,6 +618,8 @@ void CWebPageDiffFrame::LoadOptions()
m_pWebDiffWindow->SetShowDifferences(GetOptionsMgr()->GetBool(OPT_CMP_WEB_SHOWDIFFERENCES));
m_pWebDiffWindow->SetShowWordDifferences(GetOptionsMgr()->GetBool(OPT_WORDDIFF_HIGHLIGHT));
m_pWebDiffWindow->SetUserAgent(GetOptionsMgr()->GetString(OPT_CMP_WEB_USER_AGENT).c_str());
m_pWebDiffWindow->SetSyncEvents(GetOptionsMgr()->GetBool(OPT_CMP_WEB_SYNC_EVENTS));
m_pWebDiffWindow->SetSyncEventFlags(GetOptionsMgr()->GetInt(OPT_CMP_WEB_SYNC_EVENT_FLAGS));
COLORSETTINGS colors;
IWebDiffWindow::ColorSettings colorSettings;
Options::DiffColors::Load(GetOptionsMgr(), colors);
Expand Down Expand Up @@ -1078,6 +1082,24 @@ void CWebPageDiffFrame::OnDropDownCompare(NMHDR *pNMHDR, LRESULT *pResult)
point.x, point.y, AfxGetMainWnd());
}

void CWebPageDiffFrame::OnBnClickedSyncEvents()
{
CRect rc;
m_wndWebPageDiffBar.GetDlgItem(IDC_SYNC_EVENTS)->GetWindowRect(&rc);
CPoint point { rc.left, rc.bottom };
BCMenu menuPopup;
menuPopup.LoadMenu(MAKEINTRESOURCE(IDR_POPUP_WEBPAGE_SYNC_EVENTS));
theApp.TranslateMenu(menuPopup.m_hMenu);
BCMenu* pPopup = (BCMenu*)menuPopup.GetSubMenu(0);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
point.x, point.y, AfxGetMainWnd());
}

void CWebPageDiffFrame::OnDropDownSyncEvents(NMHDR *pNMHDR, LRESULT *pResult)
{
OnBnClickedSyncEvents();
}

void CWebPageDiffFrame::OnEnChangeWidth()
{
if (m_bInUpdateWebPageDiffBar)
Expand Down Expand Up @@ -1582,26 +1604,24 @@ void CWebPageDiffFrame::OnWebSyncEvent(UINT nID)
{
switch (nID)
{
case ID_WEB_SYNC_ENABLE_ALL:
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_SCROLL, true);
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_CLICK, true);
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_INPUT, true);
break;
case ID_WEB_SYNC_DISABLE_ALL:
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_SCROLL, false);
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_CLICK, false);
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_INPUT, false);
case ID_WEB_SYNC_ENABLED:
m_pWebDiffWindow->SetSyncEvents(!m_pWebDiffWindow->GetSyncEvents());
GetOptionsMgr()->SaveOption(OPT_CMP_WEB_SYNC_EVENTS, m_pWebDiffWindow->GetSyncEvents());
break;
case ID_WEB_SYNC_SCROLL:
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_SCROLL,
!m_pWebDiffWindow->GetSyncEventFlag(IWebDiffWindow::EVENT_SCROLL));
GetOptionsMgr()->SaveOption(OPT_CMP_WEB_SYNC_EVENT_FLAGS, m_pWebDiffWindow->GetSyncEventFlags());
break;
case ID_WEB_SYNC_CLICK:
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_CLICK,
!m_pWebDiffWindow->GetSyncEventFlag(IWebDiffWindow::EVENT_CLICK));
GetOptionsMgr()->SaveOption(OPT_CMP_WEB_SYNC_EVENT_FLAGS, m_pWebDiffWindow->GetSyncEventFlags());
break;
case ID_WEB_SYNC_INPUT:
m_pWebDiffWindow->SetSyncEventFlag(IWebDiffWindow::EVENT_INPUT,
!m_pWebDiffWindow->GetSyncEventFlag(IWebDiffWindow::EVENT_INPUT));
GetOptionsMgr()->SaveOption(OPT_CMP_WEB_SYNC_EVENT_FLAGS, m_pWebDiffWindow->GetSyncEventFlags());
break;
}
}
Expand All @@ -1610,6 +1630,9 @@ void CWebPageDiffFrame::OnUpdateWebSyncEvent(CCmdUI* pCmdUI)
{
switch (pCmdUI->m_nID)
{
case ID_WEB_SYNC_ENABLED:
pCmdUI->SetCheck(m_pWebDiffWindow->GetSyncEvents());
break;
case ID_WEB_SYNC_SCROLL:
pCmdUI->SetCheck(m_pWebDiffWindow->GetSyncEventFlag(IWebDiffWindow::EVENT_SCROLL));
break;
Expand Down
2 changes: 2 additions & 0 deletions Src/WebPageDiffFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ class CWebPageDiffFrame : public CMergeFrameCommon,public IMergeDoc
afx_msg void OnBnClickedFitToWindow();
afx_msg void OnBnClickedShowDifferences();
afx_msg void OnBnClickedCompare();
afx_msg void OnBnClickedSyncEvents();
afx_msg void OnEnChangeWidth();
afx_msg void OnEnChangeHeight();
afx_msg void OnEnChangeZoom();
afx_msg void OnEnChangeUserAgent();
afx_msg void OnKillFocusBarControls();
afx_msg void OnDropDownCompare(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDropDownSyncEvents(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
6 changes: 5 additions & 1 deletion Src/WinWebDiffLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

struct WebDiffEvent
{
enum EVENT_TYPE { ZoomFactorChanged, NewWindowRequested, WindowCloseRequested, NavigationStarting, FrameNavigationStarting, HistoryChanged, SourceChanged, DocumentTitleChanged, NavigationCompleted, FrameNavigationCompleted, WebMessageReceived, TabChanged, HSCROLL, VSCROLL };
enum EVENT_TYPE { ZoomFactorChanged, NewWindowRequested, WindowCloseRequested, NavigationStarting, FrameNavigationStarting, HistoryChanged, SourceChanged, DocumentTitleChanged, NavigationCompleted, FrameNavigationCompleted, WebMessageReceived, FrameWebMessageReceived, TabChanged, HSCROLL, VSCROLL };
EVENT_TYPE type;
int pane;
};
Expand Down Expand Up @@ -177,6 +177,10 @@ struct IWebDiffWindow
virtual bool CanRedo() = 0;
virtual const DiffOptions& GetDiffOptions() const = 0;
virtual void SetDiffOptions(const DiffOptions& diffOptions) = 0;
virtual bool GetSyncEvents() const = 0;
virtual void SetSyncEvents(bool syncEvents) = 0;
virtual unsigned GetSyncEventFlags() const = 0;
virtual void SetSyncEventFlags(unsigned flags) = 0;
virtual bool GetSyncEventFlag(EventType event) const = 0;
virtual void SetSyncEventFlag(EventType event, bool flag) = 0;
};
Expand Down
11 changes: 6 additions & 5 deletions Src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define IDR_POPUP_IMG_CTXT 121
#define IDR_POPUP_PROJECT_DIFF_OPTIONS 122
#define IDR_POPUP_WEBPAGE_COMPARE 123
#define IDR_POPUP_WEBPAGE_SYNC_EVENTS 124
#define IDD_ABOUTBOX 200
#define IDD_OPEN 202
#define IDD_SAVECLOSING 203
Expand Down Expand Up @@ -624,6 +625,7 @@
#define IDC_USERAGENT 1628
#define IDC_COMPARE 1630
#define IDC_SHOWDIFFERENCES 1631
#define IDC_SYNC_EVENTS 1632
#define IDC_EDIT_WHOLE_WORD 8603
#define IDC_EDIT_MATCH_CASE 8604
#define IDC_EDIT_FINDTEXT 8605
Expand Down Expand Up @@ -1058,11 +1060,10 @@
#define ID_WEB_COMPARE_HTMLS 33762
#define ID_WEB_COMPARE_TEXTS 33763
#define ID_WEB_COMPARE_RESOURCETREES 33764
#define ID_WEB_SYNC_ENABLE_ALL 33765
#define ID_WEB_SYNC_DISABLE_ALL 33766
#define ID_WEB_SYNC_SCROLL 33767
#define ID_WEB_SYNC_CLICK 33768
#define ID_WEB_SYNC_INPUT 33769
#define ID_WEB_SYNC_ENABLED 33765
#define ID_WEB_SYNC_SCROLL 33766
#define ID_WEB_SYNC_CLICK 33767
#define ID_WEB_SYNC_INPUT 33768
#define ID_WEB_CLEAR_DISK_CACHE 33780
#define ID_WEB_CLEAR_COOKIES 33781
#define ID_WEB_CLEAR_BROWSING_HISTORY 33782
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Arabic.po
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,10 @@ msgstr ""
msgid "Fit to Window"
msgstr ""

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Basque.po
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,10 @@ msgstr ""
msgid "Fit to Window"
msgstr ""

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Brazilian.po
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,10 @@ msgstr "Tamanho"
msgid "Fit to Window"
msgstr "Ajustar à Janela"

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Bulgarian.po
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,10 @@ msgstr ""
msgid "Fit to Window"
msgstr "Запълване на прозореца"

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Catalan.po
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,10 @@ msgstr ""
msgid "Fit to Window"
msgstr ""

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/ChineseSimplified.po
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,10 @@ msgstr "大小(&S)"
msgid "Fit to Window"
msgstr "窗口内显示"

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/ChineseTraditional.po
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,10 @@ msgstr "大小(&S)"
msgid "Fit to Window"
msgstr "自適應視窗(&F)"

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Corsican.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,10 @@ msgstr "&Dimensione"
msgid "Fit to Window"
msgstr "Adattà à a finestra"

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Croatian.po
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,10 @@ msgstr ""
msgid "Fit to Window"
msgstr ""

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
7 changes: 2 additions & 5 deletions Translations/WinMerge/Czech.po
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,10 @@ msgstr ""
msgid "Fit to Window"
msgstr ""

msgid "&Syncronize Events"
msgid "&Event Synchronization"
msgstr ""

msgid "&Enable All"
msgstr ""

msgid "&Disable All"
msgid "&Enabled"
msgstr ""

msgid "&Scroll"
Expand Down
Loading

0 comments on commit de0401e

Please sign in to comment.