/////////////////////////////////////////////////////////////////////////////
// WinMerge: an interactive diff/merge utility
// Copyright (C) 1997 Dean P. Grimm
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
+// SPDX-License-Identifier: GPL-2.0-or-later
/////////////////////////////////////////////////////////////////////////////
/**
* @file MainFrm.h
#include <vector>
#include <memory>
+#include <optional>
#include "MDITabBar.h"
#include "PathContext.h"
+#include "OptionsDef.h"
+#include "OptionsMgr.h"
class BCMenu;
class CDirView;
typedef CTypedPtrList<CPtrList, CHexMergeDoc *> HexMergeDocList;
class PackingInfo;
+class PrediffingInfo;
class CLanguageSelect;
+struct IMergeDoc;
CMainFrame * GetMainFrame(); // access to the singleton main frame object
FRAME_OTHER, /**< No frame? */
};
+ struct OpenTextFileParams
+ {
+ int m_line = -1;
+ std::optional<TCHAR> m_tableDelimiter;
+ std::optional<TCHAR> m_tableQuote;
+ std::optional<bool> m_tableAllowNewlinesInQuotes;
+ };
+
CMainFrame();
// Attributes
HMENU NewImgMergeViewMenu();
HMENU NewOpenViewMenu();
HMENU NewDefaultMenu(int ID = 0);
- HMENU GetScriptsSubmenu(HMENU mainMenu);
HMENU GetPrediffersSubmenu(HMENU mainMenu);
void UpdatePrediffersMenu();
- void FileNew(int nPanes);
- bool DoFileOpen(const PathContext *pFiles = nullptr,
- const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr, const String& sReportFile = _T(""), bool bRecurse = false, CDirDoc *pDirDoc = nullptr, String prediffer = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ bool DoFileOrFolderOpen(const PathContext *pFiles = nullptr,
+ const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr,
+ const String& sReportFile = _T(""), bool bRecurse = false, CDirDoc *pDirDoc = nullptr,
+ const PackingInfo * infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ UINT nID = 0, OpenTextFileParams *pOpenParams = nullptr);
+ bool DoFileOpen(UINT nID, const PathContext* pFiles = nullptr,
+ const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr,
+ const String& sReportFile = _T(""),
+ const PackingInfo* infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams *pOpenParams = nullptr);
+ bool DoFileNew(UINT nID, int nPanes, const String strDesc[] = nullptr,
+ const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams *pOpenParams = nullptr);
+ bool DoOpenConflict(const String& conflictFile, const String strDesc[] = nullptr, bool checked = false);
+ bool DoSelfCompare(UINT nID, const String& file, const String strDesc[] = nullptr,
+ const PackingInfo* infoUnpacker = nullptr, const PrediffingInfo * infoPrediffer = nullptr,
+ OpenTextFileParams* pOpenParams = nullptr);
bool ShowAutoMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
- bool ShowMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
+ bool ShowMergeDoc(UINT nID, CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
+ bool ShowTextOrTableMergeDoc(std::optional<bool> table, CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
+ bool ShowTextMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
+ bool ShowTextMergeDoc(CDirDoc* pDirDoc, int nBuffers, const String text[],
+ const String strDesc[], const String& strFileExt, OpenTextFileParams *pOpenParams = nullptr);
+ bool ShowTableMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr, OpenTextFileParams *pOpenParams = nullptr);
bool ShowHexMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr);
bool ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
- const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr);
+ const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""),
+ const PackingInfo * infoUnpacker = nullptr);
void UpdateResources();
void ClearStatusbarItemCount();
void SelectFilter();
void StartFlashing();
bool AskCloseConfirmation();
- bool DoOpenConflict(const String& conflictFile, const String strDesc[] = nullptr, bool checked = false);
- FRAMETYPE GetFrameType(const CFrameWnd * pFrame) const;
- void UpdateDocTitle();
- void ReloadMenu();
+ static FRAMETYPE GetFrameType(const CFrameWnd * pFrame);
+ static void UpdateDocTitle();
+ static void ReloadMenu();
+ static void AppendPluginMenus(CMenu* pMenu, const String& filteredFilenames,
+ const std::vector<std::wstring>& events, bool addAllMenu, unsigned baseId);
+ static String GetPluginPipelineByMenuId(unsigned idSearch, const std::vector<std::wstring>& events, unsigned baseId);
DropHandler *GetDropHandler() const { return m_pDropHandler; }
const CTypedPtrArray<CPtrArray, CMDIChildWnd*>* GetChildArray() const { return &m_arrChild; }
+ IMergeDoc* GetActiveIMergeDoc();
// Overrides
virtual void GetMessageString(UINT nID, CString& rMessage) const;
{
case WM_MDICREATE:
case WM_MDIACTIVATE:
+ {
// To reduce flicker in maximized state, disable drawing while messing with MDI child frames
BOOL bMaximized;
- if ((message == WM_MDICREATE || (SendMessage(WM_MDIGETACTIVE, 0, reinterpret_cast<LPARAM>(&bMaximized))
- && bMaximized)) && SetTimer(m_nRedrawTimer, USER_TIMER_MINIMUM, nullptr))
+ HWND hwndActive = reinterpret_cast<HWND>(SendMessage(WM_MDIGETACTIVE, 0, reinterpret_cast<LPARAM>(&bMaximized)));
+ if ((bMaximized || (message == WM_MDICREATE && !hwndActive)) &&
+ SetTimer(m_nRedrawTimer, USER_TIMER_MINIMUM, nullptr))
{
SetRedraw(FALSE);
}
break;
+ }
case WM_TIMER:
if (wParam == m_nRedrawTimer)
{
KillTimer(m_nRedrawTimer);
SetRedraw(TRUE);
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE);
- GetMainFrame()->GetActiveFrame()->OnUpdateFrameTitle(TRUE);
- GetMainFrame()->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, 0, TRUE, TRUE);
}
break;
}
static const MENUITEM_ICON m_MenuIcons[];
std::unique_ptr<BCMenu> m_pMenus[MENU_COUNT]; /**< Menus for different views */
+ std::unique_ptr<BCMenu> m_pImageMenu;
std::vector<TempFilePtr> m_tempFiles; /**< List of possibly needed temp files. */
DropHandler *m_pDropHandler;
afx_msg void OnPluginUnpackMode(UINT nID);
afx_msg void OnUpdatePluginPrediffMode(CCmdUI* pCmdUI);
afx_msg void OnPluginPrediffMode(UINT nID);
- afx_msg void OnUpdateReloadPlugins(CCmdUI* pCmdUI);
+ afx_msg void OnUpdatePluginRelatedMenu(CCmdUI* pCmdUI);
afx_msg void OnReloadPlugins();
afx_msg void OnSaveConfigData();
+ template <int nFiles, unsigned nID>
afx_msg void OnFileNew();
- afx_msg void OnFileNew3();
afx_msg void OnToolsFilters();
afx_msg void OnViewStatusBar();
afx_msg void OnUpdateViewTabBar(CCmdUI* pCmdUI);
afx_msg void OnFileOpenConflict();
afx_msg void OnPluginsList();
afx_msg void OnUpdatePluginName(CCmdUI* pCmdUI);
- afx_msg void OnDiffOptionsDropDown(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnToolbarButtonDropDown(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDiffWhitespace(UINT nID);
afx_msg void OnUpdateDiffWhitespace(CCmdUI* pCmdUI);
- afx_msg void OnDiffCaseSensitive();
- afx_msg void OnUpdateDiffCaseSensitive(CCmdUI* pCmdUI);
+ afx_msg void OnDiffIgnoreBlankLines();
+ afx_msg void OnUpdateDiffIgnoreBlankLines(CCmdUI* pCmdUI);
+ afx_msg void OnDiffIgnoreCase();
+ afx_msg void OnUpdateDiffIgnoreCase(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreEOL();
afx_msg void OnUpdateDiffIgnoreEOL(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreCP();
afx_msg void OnUpdateDiffIgnoreCP(CCmdUI* pCmdUI);
+ afx_msg void OnDiffIgnoreComments();
+ afx_msg void OnUpdateDiffIgnoreComments(CCmdUI* pCmdUI);
afx_msg void OnIncludeSubfolders();
afx_msg void OnUpdateIncludeSubfolders(CCmdUI* pCmdUI);
afx_msg void OnCompareMethod(UINT nID);
afx_msg void OnUpdateCompareMethod(CCmdUI* pCmdUI);
afx_msg void OnMRUs(UINT nID);
afx_msg void OnUpdateNoMRUs(CCmdUI* pCmdUI);
+ afx_msg void OnFirstFile();
+ afx_msg void OnUpdateFirstFile(CCmdUI* pCmdUI);
+ afx_msg void OnPrevFile();
+ afx_msg void OnUpdatePrevFile(CCmdUI* pCmdUI);
+ afx_msg void OnNextFile();
+ afx_msg void OnUpdateNextFile(CCmdUI* pCmdUI);
+ afx_msg void OnLastFile();
+ afx_msg void OnUpdateLastFile(CCmdUI* pCmdUI);
+ afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnAccelQuit();
- //}}AFX_MSG
afx_msg LRESULT OnChildFrameAdded(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameRemoved(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameActivate(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameActivated(WPARAM wParam, LPARAM lParam);
+ //}}AFX_MSG
DECLARE_MESSAGE_MAP()
private: