X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=Src%2FMainFrm.h;h=8063201753524a7302bd98baf044092c64ebbb70;hb=5ba83f07ae744cd249a0b9f4c4b385d693ac3cd6;hp=0d7fa7a91aa336b7efc78065ddaa0373e72de17c;hpb=8f957c8f76d61a755f690829a43663dcfe3a41d2;p=winmerge-jp%2Fwinmerge-jp.git diff --git a/Src/MainFrm.h b/Src/MainFrm.h index 0d7fa7a91..806320175 100644 --- a/Src/MainFrm.h +++ b/Src/MainFrm.h @@ -1,21 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // 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 @@ -27,11 +13,13 @@ #include #include +#include #include "MDITabBar.h" #include "PathContext.h" +#include "OptionsDef.h" +#include "OptionsMgr.h" class BCMenu; -class CDiffView; class CDirView; class COpenDoc; class CDirDoc; @@ -42,8 +30,9 @@ class SyntaxColors; class LineFiltersList; class TempFile; struct FileLocation; -class SourceControl; class DropHandler; +class CMainFrame; +class CImgMergeFrame; typedef std::shared_ptr TempFilePtr; @@ -54,7 +43,11 @@ typedef CTypedPtrList DirDocList; typedef CTypedPtrList HexMergeDocList; class PackingInfo; +class PrediffingInfo; class CLanguageSelect; +struct IMergeDoc; + +CMainFrame * GetMainFrame(); // access to the singleton main frame object /** * @brief Frame class containing save-routines etc @@ -76,16 +69,15 @@ public: FRAME_OTHER, /**< No frame? */ }; - enum { WM_NONINTERACTIVE = 888 }; // timer value - CMainFrame(); // Attributes public: - BOOL m_bShowErrors; /**< Show folder compare error items? */ + bool m_bShowErrors; /**< Show folder compare error items? */ LOGFONT m_lfDiff; /**< MergeView user-selected font */ LOGFONT m_lfDir; /**< DirView user-selected font */ static const TCHAR szClassName[]; + // Operations public: HMENU NewDirViewMenu(); @@ -94,32 +86,51 @@ public: HMENU NewImgMergeViewMenu(); HMENU NewOpenViewMenu(); HMENU NewDefaultMenu(int ID = 0); - HMENU GetScriptsSubmenu(HMENU mainMenu); HMENU GetPrediffersSubmenu(HMENU mainMenu); void UpdatePrediffersMenu(); - BOOL DoFileOpen(const PathContext *pFiles = NULL, - const DWORD dwFlags[] = NULL, bool bRecurse = false, CDirDoc *pDirDoc = NULL, String prediffer = _T(""), const PackingInfo * infoUnpacker = NULL); - int ShowAutoMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], - const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL); - int ShowMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], - const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL); - void ShowHexMergeDoc(CDirDoc * pDirDoc, - const PathContext &paths, const bool bRO[]); - int ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], - const DWORD dwFlags[], const PackingInfo * infoUnpacker = NULL); + void FileNew(int nPanes, FRAMETYPE frameType, bool table); + bool DoFileOpen(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); + bool DoFileOpen(UINT nID, const PathContext* pFiles = nullptr, + const DWORD dwFlags[] = nullptr, const String strDesc[] = nullptr, + const String& sReportFile = _T(""), const PackingInfo* infoUnpacker = 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(UINT nID, CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], + const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr); + bool ShowTextOrTableMergeDoc(std::optional table, CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], + const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr); + bool ShowTextMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], + const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr); + bool ShowTextMergeDoc(CDirDoc* pDirDoc, int nBuffers, const String text[], + const String strDesc[], const String& strFileExt); + bool ShowTableMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], + const DWORD dwFlags[], const String strDesc[], const String& sReportFile = _T(""), const PackingInfo * infoUnpacker = nullptr); + bool ShowHexMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[], + 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); void UpdateResources(); - CString SetStatus(LPCTSTR status); void ClearStatusbarItemCount(); void ApplyDiffOptions(); void SelectFilter(); void StartFlashing(); bool AskCloseConfirmation(); - BOOL DoOpenConflict(const String& conflictFile, bool checked = false); - FRAMETYPE GetFrameType(const CFrameWnd * pFrame) const; - void UpdateDocTitle(); - void ReloadMenu(); + 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); + static FRAMETYPE GetFrameType(const CFrameWnd * pFrame); + static void UpdateDocTitle(); + static void ReloadMenu(); + static void AppendPluginMenus(CMenu* pMenu, const String& filteredFilenames, + const std::vector events, bool addAllMenu, unsigned baseId); + static String GetPluginPipelineByMenuId(unsigned idSearch, const std::vector events, unsigned baseId); + DropHandler *GetDropHandler() const { return m_pDropHandler; } + const CTypedPtrArray* GetChildArray() const { return &m_arrChild; } + IMergeDoc* GetActiveIMergeDoc(); // Overrides virtual void GetMessageString(UINT nID, CString& rMessage) const; @@ -136,28 +147,52 @@ public: protected: virtual ~CMainFrame(); - // Public implementation data public: - BOOL m_bFirstTime; /**< If first time frame activated, get pos from reg */ - BOOL m_bFlashing; /**< Window is flashing. */ - - /** @brief Possible toolbar image sizes. */ - enum TOOLBAR_SIZE - { - TOOLBAR_SIZE_16x16, - TOOLBAR_SIZE_32x32, - }; + bool m_bFirstTime; /**< If first time frame activated, get pos from reg */ // Implementation data protected: - - // control bar embedded members CStatusBar m_wndStatusBar; CReBar m_wndReBar; CToolBar m_wndToolBar; CMDITabBar m_wndTabBar; + CTypedPtrArray m_arrChild; + + // Tweak MDI client window behavior + class CMDIClient : public CWnd + { + static UINT_PTR const m_nRedrawTimer = 1612; + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + case WM_MDICREATE: + case WM_MDIACTIVATE: + { + // To reduce flicker in maximized state, disable drawing while messing with MDI child frames + BOOL bMaximized; + HWND hwndActive = reinterpret_cast(SendMessage(WM_MDIGETACTIVE, 0, reinterpret_cast(&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); + } + break; + } + return CWnd::WindowProc(message, wParam, lParam); + } + } m_wndMDIClient; /** @brief Toolbar image table indexes. */ enum TOOLBAR_IMAGES @@ -203,6 +238,7 @@ protected: static const MENUITEM_ICON m_MenuIcons[]; std::unique_ptr m_pMenus[MENU_COUNT]; /**< Menus for different views */ + std::unique_ptr m_pImageMenu; std::vector m_tempFiles; /**< List of possibly needed temp files. */ DropHandler *m_pDropHandler; @@ -217,11 +253,8 @@ protected: afx_msg void OnHelpGnulicense(); afx_msg void OnOptions(); afx_msg void OnViewSelectfont(); - afx_msg void OnUpdateViewSelectfont(CCmdUI* pCmdUI); afx_msg void OnViewUsedefaultfont(); - afx_msg void OnUpdateViewUsedefaultfont(CCmdUI* pCmdUI); afx_msg void OnHelpContents(); - afx_msg void OnUpdateHelpContents(CCmdUI* pCmdUI); afx_msg void OnClose(); afx_msg void OnToolsGeneratePatch(); afx_msg void OnDropFiles(const std::vector& files); @@ -229,76 +262,83 @@ protected: 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 afx_msg void OnFileNew(); - afx_msg void OnFileNew3(); afx_msg void OnToolsFilters(); afx_msg void OnViewStatusBar(); - afx_msg void OnViewToolbar(); afx_msg void OnUpdateViewTabBar(CCmdUI* pCmdUI); afx_msg void OnViewTabBar(); afx_msg void OnUpdateResizePanes(CCmdUI* pCmdUI); afx_msg void OnResizePanes(); - afx_msg void OnFileOpenproject(); + afx_msg void OnFileOpenProject(); afx_msg LRESULT OnCopyData(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnUser1(WPARAM wParam, LPARAM lParam); - afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnWindowCloseAll(); afx_msg void OnUpdateWindowCloseAll(CCmdUI* pCmdUI); afx_msg void OnSaveProject(); - afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); #if _MFC_VER > 0x0600 afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID); #else afx_msg void OnActivateApp(BOOL bActive, HTASK hTask); #endif - afx_msg void OnToolbarNone(); - afx_msg void OnUpdateToolbarNone(CCmdUI* pCmdUI); - afx_msg void OnToolbarSmall(); - afx_msg void OnUpdateToolbarSmall(CCmdUI* pCmdUI); - afx_msg void OnToolbarBig(); - afx_msg void OnUpdateToolbarBig(CCmdUI* pCmdUI); + afx_msg void OnToolbarSize(UINT id); + afx_msg void OnUpdateToolbarSize(CCmdUI* pCmdUI); afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult); - afx_msg void OnHelpCheckForUpdates(); + afx_msg void OnHelpReleasenotes(); + afx_msg void OnHelpTranslations(); 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 OnUpdateDiffOptions(CCmdUI* pCmdUI); + 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 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: void addToMru(LPCTSTR szItem, LPCTSTR szRegSubKey, UINT nMaxItems = 20); - void FileNew(int nPanes); - const OpenDocList &GetAllOpenDocs(); - const MergeDocList &GetAllMergeDocs(); - const DirDocList &GetAllDirDocs(); - const HexMergeDocList &GetAllHexMergeDocs(); + OpenDocList &GetAllOpenDocs(); + MergeDocList &GetAllMergeDocs(); + DirDocList &GetAllDirDocs(); + HexMergeDocList &GetAllHexMergeDocs(); + std::list GetAllImgMergeFrames(); void UpdateFont(FRAMETYPE frame); BOOL CreateToolbar(); - BOOL CreateComboBoxOnToolbar(); CMergeEditView * GetActiveMergeEditView(); void LoadToolbarImages(); HMENU NewMenu( int view, int ID ); }; - -CMainFrame * GetMainFrame(); // access to the singleton main frame object - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line.