OSDN Git Service

Improve plugin system (#797)
[winmerge-jp/winmerge-jp.git] / Src / ImgMergeFrm.h
index 2e28158..fa718fa 100644 (file)
@@ -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  ImgMergeFrm.h
@@ -33,6 +19,7 @@
 #include "LocationBar.h"
 #include "FileLocation.h"
 #include "MergeFrameCommon.h"
+#include "FileTransform.h"
 
 class CDirDoc;
 
@@ -42,12 +29,12 @@ class CDirDoc;
 class CImgMergeFrame : public CMergeFrameCommon,public IMergeDoc
 {
        private:
-       enum BUFFERTYPE
+       enum class BUFFERTYPE
        {
-               BUFFER_NORMAL = 0, /**< Normal, file loaded from disk */
-               BUFFER_NORMAL_NAMED, /**< Normal, description given */
-               BUFFER_UNNAMED, /**< Empty, created buffer */
-               BUFFER_UNNAMED_SAVED, /**< Empty buffer saved with filename */
+               NORMAL = 0, /**< Normal, file loaded from disk */
+               NORMAL_NAMED, /**< Normal, description given */
+               UNNAMED, /**< Empty, created buffer */
+               UNNAMED_SAVED, /**< Empty buffer saved with filename */
        };
 
        using CMDIChildWnd::Create;
@@ -62,6 +49,7 @@ public:
        bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], CMDIFrameWnd *pParent);
        void MoveOnLoad(int nPane = -1, int nLineIndex = -1);
        void ChangeFile(int pane, const String& path);
+       CDirDoc* GetDirDoc() const override { return m_pDirDoc; };
        void SetDirDoc(CDirDoc * pDirDoc) override;
        void UpdateResources();
        bool CloseNow() override;
@@ -70,6 +58,12 @@ public:
        void UpdateAutoPaneResize();
        void UpdateSplitter();
        bool GenerateReport(const String& sFileName) const override;
+       const PackingInfo* GetUnpacker() const override { return &m_infoUnpacker; };
+       void SetUnpacker(const PackingInfo* infoUnpacker) override { if (infoUnpacker) m_infoUnpacker = *infoUnpacker; };
+       const PrediffingInfo* GetPrediffer() const override { return nullptr; };
+       int GetFileCount() const override { return m_filePaths.GetSize(); }
+       String GetPath(int pane) const override { return m_filePaths[pane]; }
+       bool GetReadOnly(int pane) const override { return m_bRO[pane]; }
        void DoAutoMerge(int dstPane);
        bool IsModified() const;
        IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
@@ -105,12 +99,13 @@ private:
        void CreateImgWndStatusBar(CStatusBar &, CWnd *);
 // Generated message map functions
 private:
+       bool OpenImages();
        int UpdateDiffItem(CDirDoc * pDirDoc);
        void UpdateHeaderSizes();
        void UpdateHeaderPath(int pane);
        void SetTitle(LPCTSTR lpszTitle);
        bool DoFileSave(int pane);
-       bool DoFileSaveAs(int pane);
+       bool DoFileSaveAs(int pane, bool packing = true);
        bool PromptAndSaveIfNeeded(bool bAllowCancel);
        bool MergeModeKeyDown(MSG* pMsg);
        static void OnChildPaneEvent(const IImgMergeWindow::Event& evt);
@@ -127,11 +122,14 @@ private:
        bool m_bAutoMerged;
        CDirDoc *m_pDirDoc;
        int m_nActivePane;
+       PackingInfo m_infoUnpacker;
+       std::vector<int> m_unpackerSubcodes[3];
 
        //{{AFX_MSG(CImgMergeFrame)
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
        afx_msg void OnClose();
+       afx_msg void OnDestroy();
        afx_msg void OnFileSave();
        afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
        afx_msg void OnFileSaveLeft();
@@ -150,8 +148,9 @@ private:
        afx_msg void OnUpdateRightReadOnly(CCmdUI* pCmdUI);
        afx_msg void OnFileReload();
        afx_msg void OnFileClose();
-       afx_msg void OnFileRecompareAs(UINT nId);
+       afx_msg void OnFileRecompareAs(UINT nID);
        afx_msg void OnUpdateFileRecompareAs(CCmdUI* pCmdUI);
+       afx_msg void OnOpenWithUnpacker();
        afx_msg void OnWindowChangePane();
        afx_msg void OnSize(UINT nType, int cx, int cy);
        afx_msg void OnIdleUpdateCmdUI();
@@ -161,6 +160,13 @@ private:
        afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
        afx_msg void OnEditRedo();
        afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
+       afx_msg void OnEditCut();
+       afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
+       afx_msg void OnEditCopy();
+       afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
+       afx_msg void OnEditPaste();
+       afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
+       afx_msg void OnEditSelectAll();
        afx_msg void OnViewZoomIn();
        afx_msg void OnViewZoomOut();
        afx_msg void OnViewZoomNormal();
@@ -220,9 +226,11 @@ private:
        afx_msg void OnImgVectorImageScaling(UINT nId);
        afx_msg void OnUpdateImgVectorImageScaling(CCmdUI* pCmdUI);
        afx_msg void OnUpdateImgUseBackColor(CCmdUI* pCmdUI);
+       afx_msg void OnImgCompareExtractedText();
        afx_msg void OnToolsGenerateReport();
        afx_msg void OnRefresh();
        afx_msg void OnSetFocus(CWnd *pNewWnd);
+       afx_msg void OnHelp();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };