OSDN Git Service

Remove unused resource IDs
[winmerge-jp/winmerge-jp.git] / Src / FileActionScript.h
index 08a3e23..3912f58 100644 (file)
@@ -1,19 +1,4 @@
-/////////////////////////////////////////////////////////////////////////////
-//    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
  *
@@ -61,7 +46,7 @@ struct FileAction
 
        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 */
 };
 
@@ -110,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;
@@ -130,6 +115,8 @@ public:
         */
        FileActionItem GetHeadActionItem() const { return m_actions[0]; }
 
+       bool IsCanceled() const { return m_bCanceled; }
+
        String m_destBase; /**< Base destination path for some operations */
 
 protected:
@@ -139,13 +126,42 @@ protected:
 private:
        std::vector<FileActionItem> m_actions; /**< List of all actions for this script. */
        std::unique_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
-       BOOL m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
+       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 */
+       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 */
+       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? */
+       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;
 };
+
+/**
+ * @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();
+}
+