OSDN Git Service

Remove unused resource IDs
[winmerge-jp/winmerge-jp.git] / Src / FileActionScript.h
index 350cee4..3912f58 100644 (file)
@@ -1,32 +1,13 @@
-/////////////////////////////////////////////////////////////////////////////
-//    License (GPLv2+):
-//    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  FileActionScript.h
  *
  * @brief Declaration file for FileActionScript and related classes
  */
-// ID line follows -- this is updated by SVN
-// $Id$
-
-#ifndef _FILEACTIONSCRIPT_H_
-#define _FILEACTIONSCRIPT_H_
+#pragma once
 
 #include <vector>
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 class ShellFileOperations;
 
@@ -60,11 +41,12 @@ struct FileAction
                ACT_COPY = 1, /**< Copy the item(s). */
                ACT_MOVE,     /**< Move the item(s). */
                ACT_DEL,      /**< Delete the item(s). */
+               ACT_RENAME,   /**< Rename the item(s). */
        };
 
        String src; /**< Source for action */
        String dest; /**< Destination action */
-       BOOL dirflag; /**< Is it directory? (TRUE means directory) */
+       bool dirflag; /**< Is it directory? (`true` means directory) */
        ACT_TYPE atype; /**< Action's type */
 };
 
@@ -83,20 +65,9 @@ struct FileActionItem : public FileAction
        {
                UI_SYNC = 1,   /**< Make items identical (synchronized). */
                UI_DESYNC,     /**< Make items different. */
-               UI_DEL_LEFT,   /**< Remove left item. */
-               UI_DEL_RIGHT,  /**< Remove right item. */
-               UI_DEL_BOTH,   /**< Remove both items (removes the row). */
+               UI_DEL,        /**< Remove left item. */
                UI_DONT_CARE,  /**< Ignore the GUI change. */
-       };
-
-       /**
-        * @brief Side of the action.
-        * This lists possible values for origin and destination sides.
-        */
-       enum UI_SIDE
-       {
-               UI_LEFT,
-               UI_RIGHT
+               UI_RENAME      /**< Rename item. */
        };
 
        /**
@@ -105,9 +76,9 @@ struct FileActionItem : public FileAction
         * other items. This can be e.g. indext of the item in the GUI.
         */
        int context;
-       UI_RESULT UIResult; /**< Resulting UI action */
-       UI_SIDE UIOrigin; /**< Original UI-side */
-       UI_SIDE UIDestination; /**< Destination UI-side */
+       int UIResult; /**< Resulting UI action */
+       int UIOrigin; /**< Original UI-side */
+       int UIDestination; /**< Destination UI-side */
 };
 
 /** 
@@ -124,8 +95,8 @@ public:
        ~FileActionScript();
 
        void SetParentWindow(HWND hWnd);
-       void UseRecycleBin(BOOL bUseRecycleBin);
-       BOOL Run();
+       void UseRecycleBin(bool bUseRecycleBin);
+       bool Run();
 
        // Manipulate the FileActionList
        size_t GetActionItemCount() const;
@@ -144,23 +115,53 @@ public:
         */
        FileActionItem GetHeadActionItem() const { return m_actions[0]; }
 
+       bool IsCanceled() const { return m_bCanceled; }
+
        String m_destBase; /**< Base destination path for some operations */
 
 protected:
-       int VCSCheckOut(const String &path, BOOL &bApplyToAll);
        int CreateOperationsScripts();
        bool RunOp(ShellFileOperations *oplist, bool & userCancelled);
 
 private:
        std::vector<FileActionItem> m_actions; /**< List of all actions for this script. */
-       boost::scoped_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
-       BOOL m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
-       boost::scoped_ptr<ShellFileOperations> m_pMoveOperations; /**< Move operations. */
-       BOOL m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
-       boost::scoped_ptr<ShellFileOperations> m_pDelOperations; /**< Delete operations. */
-       BOOL m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
-       BOOL m_bUseRecycleBin; /**< Use recycle bin for script actions? */
+       std::unique_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
+       bool m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
+       std::unique_ptr<ShellFileOperations> m_pMoveOperations; /**< Move operations. */
+       bool m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
+       std::unique_ptr<ShellFileOperations> m_pRenameOperations; /**< Rename operations. */
+       bool m_bHasRenameOperations; /**< flag if we've put anything into m_pRenameOperations */
+       std::unique_ptr<ShellFileOperations> m_pDelOperations; /**< Delete operations. */
+       bool m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
+       bool m_bUseRecycleBin; /**< Use recycle bin for script actions? */
        HWND m_hParentWindow; /**< Parent window for showing messages */
+       bool m_bCanceled;
 };
 
-#endif // _FILEACTIONSCRIPT_H_
+/**
+ * @brief Set parent window used for showing MessageBoxes.
+ * @param [in] hWnd Handle to parent window.
+ */
+inline void FileActionScript::SetParentWindow(HWND hWnd)
+{
+       m_hParentWindow = hWnd;
+}
+
+/**
+ * @brief Does user want to move deleted files to Recycle Bin?
+ * @param [in] bUseRecycleBin If `true` deleted files are moved to Recycle Bin.
+ */
+inline void FileActionScript::UseRecycleBin(bool bUseRecycleBin)
+{
+       m_bUseRecycleBin = bUseRecycleBin;
+}
+
+/**
+ * @brief Return amount of actions (copy, move, etc) in script.
+ * @return Amount of actions.
+ */
+inline size_t FileActionScript::GetActionItemCount() const
+{
+       return m_actions.size();
+}
+