Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -r4d497e3545ae7c7b9fadedcffeb6960cfd19e724 -r4cd45795025411a82006a94d9c7f7f2d9ecda421 --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 4d497e3545ae7c7b9fadedcffeb6960cfd19e724) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 4cd45795025411a82006a94d9c7f7f2d9ecda421) @@ -98,22 +98,26 @@ spTask->AddClipboardData(spEntry); } + EOperationType eOperation = eOperation_Copy; + if (IsClipboardFormatAvailable(nFormat)) { handle=GetClipboardData(nFormat); LPVOID addr=GlobalLock(handle); DWORD dwData=((DWORD*)addr)[0]; - if (dwData & DROPEFFECT_COPY) - spTask->SetStatus(ST_COPY, ST_OPERATION_MASK); // copy - else if (dwData & DROPEFFECT_MOVE) - spTask->SetStatus(ST_MOVE, ST_OPERATION_MASK); // move + if(dwData & DROPEFFECT_COPY) + eOperation = eOperation_Copy; // copy + else if(dwData & DROPEFFECT_MOVE) + eOperation = eOperation_Move; // move GlobalUnlock(handle); } else - spTask->SetStatus(ST_COPY, ST_OPERATION_MASK); // default - copy + eOperation = eOperation_Copy; // default - copy + spTask->SetOperationType(eOperation); // copy + EmptyClipboard(); CloseClipboard(); @@ -156,14 +160,13 @@ dlg.m_bdData.strInitialDir=(dlg.m_bdData.cvRecent.size() > 0) ? dlg.m_bdData.cvRecent.at(0) : _T(""); - int iStatus=spTask->GetStatus(ST_OPERATION_MASK); - if (iStatus == ST_COPY) - dlg.m_bdData.strCaption=GetResManager().LoadString(IDS_TITLECOPY_STRING); - else if (iStatus == ST_MOVE) - dlg.m_bdData.strCaption=GetResManager().LoadString(IDS_TITLEMOVE_STRING); + if(eOperation == eOperation_Copy) + dlg.m_bdData.strCaption = GetResManager().LoadString(IDS_TITLECOPY_STRING); + else if(eOperation == eOperation_Move) + dlg.m_bdData.strCaption = GetResManager().LoadString(IDS_TITLEMOVE_STRING); else - dlg.m_bdData.strCaption=GetResManager().LoadString(IDS_TITLEUNKNOWNOPERATION_STRING); - dlg.m_bdData.strText=GetResManager().LoadString(IDS_MAINBROWSETEXT_STRING); + dlg.m_bdData.strCaption = GetResManager().LoadString(IDS_TITLEUNKNOWNOPERATION_STRING); + dlg.m_bdData.strText = GetResManager().LoadString(IDS_MAINBROWSETEXT_STRING); // set count of data to display size_t stClipboardSize = spTask->GetClipboardDataSize(); Index: src/ch/MainWnd.cpp =================================================================== diff -u -r012e8c96dde85616cf4ecbd594afa91517d81a0d -r4cd45795025411a82006a94d9c7f7f2d9ecda421 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 012e8c96dde85616cf4ecbd594afa91517d81a0d) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 4cd45795025411a82006a94d9c7f7f2d9ecda421) @@ -510,14 +510,14 @@ CClipboardEntryPtr spEntry; // files - for (int i=0;iSetPath(astrFiles.GetAt(i)); spTask->AddClipboardData(spEntry); } - spTask->SetStatus(bMove ? ST_MOVE : ST_COPY, ST_OPERATION_MASK); + spTask->SetOperationType(bMove ? eOperation_Move : eOperation_Copy); // special status spTask->SetStatus((bOnlyCreate ? ST_IGNORE_CONTENT : 0) | (bIgnoreDirs ? ST_IGNORE_DIRS : 0) | (bForceDirectories ? ST_FORCE_DIRS : 0), ST_SPECIAL_MASK); @@ -597,7 +597,7 @@ spTask->AddClipboardData(spEntry); } - spTask->SetStatus((dlg.m_ccData.m_iOperation == 1) ? ST_MOVE : ST_COPY, ST_OPERATION_MASK); + spTask->SetOperationType((dlg.m_ccData.m_iOperation == 1) ? eOperation_Move : eOperation_Copy); // special status spTask->SetStatus((dlg.m_ccData.m_bCreateStructure ? ST_IGNORE_CONTENT : 0) | (dlg.m_ccData.m_bIgnoreFolders ? ST_IGNORE_DIRS : 0) Index: src/ch/task.cpp =================================================================== diff -u -r4d497e3545ae7c7b9fadedcffeb6960cfd19e724 -r4cd45795025411a82006a94d9c7f7f2d9ecda421 --- src/ch/task.cpp (.../task.cpp) (revision 4d497e3545ae7c7b9fadedcffeb6960cfd19e724) +++ src/ch/task.cpp (.../task.cpp) (revision 4cd45795025411a82006a94d9c7f7f2d9ecda421) @@ -596,6 +596,18 @@ return m_eCurrentState; } +void CTask::SetOperationType(EOperationType eOperationType) +{ + boost::unique_lock lock(m_lock); + m_eOperation = eOperationType; +} + +EOperationType CTask::GetOperationType() const +{ + boost::shared_lock lock(m_lock); + return m_eOperation; +} + // m_nBufferSize void CTask::SetBufferSizes(const BUFFERSIZES* bsSizes) { @@ -978,13 +990,13 @@ _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_STATUS0_STRING+6)); else if( (m_nStatus & ST_STEP_MASK) == ST_SEARCHING ) _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_STATUS0_STRING+0)); - else if((m_nStatus & ST_OPERATION_MASK) == ST_COPY ) + else if(m_eOperation == eOperation_Copy) { _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_STATUS0_STRING+1)); if(!m_afFilters.IsEmpty()) _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_FILTERING_STRING)); } - else if( (m_nStatus & ST_OPERATION_MASK) == ST_MOVE ) + else if(m_eOperation == eOperation_Move) { _tcscat(pData->m_szStatusText, GetResManager().LoadString(IDS_STATUS0_STRING+2)); if(!m_afFilters.IsEmpty()) @@ -1206,7 +1218,7 @@ int iDestDrvNumber = GetDestDriveNumber(); bool bIgnoreDirs = (GetStatus(ST_SPECIAL_MASK) & ST_IGNORE_DIRS) != 0; bool bForceDirectories = (GetStatus(ST_SPECIAL_MASK) & ST_FORCE_DIRS) != 0; - bool bMove = GetStatus(ST_OPERATION_MASK) == ST_MOVE; + bool bMove = GetOperationType() == eOperation_Move; // add everything ictranslate::CFormat fmt; @@ -2180,7 +2192,7 @@ ccp.strDstFile = spFileInfo->GetDestinationPath(dpDestPath.GetPath(), ((int)bForceDirectories) << 1 | (int)bIgnoreFolders); // are the files/folders lie on the same partition ? - bool bMove=GetStatus(ST_OPERATION_MASK) == ST_MOVE; + bool bMove = GetOperationType() == eOperation_Move; if(bMove && dpDestPath.GetDriveNumber() != -1 && dpDestPath.GetDriveNumber() == spFileInfo->GetDriveNumber() && spFileInfo->GetMove()) { bool bRetry = true; @@ -2296,7 +2308,7 @@ ccp.dbBuffer.Delete(); // change status - if(GetStatus(ST_OPERATION_MASK) == ST_MOVE) + if(GetOperationType() == eOperation_Move) { SetStatus(ST_DELETING, ST_STEP_MASK); // set the index to 0 before deleting Index: src/ch/task.h =================================================================== diff -u -r4d497e3545ae7c7b9fadedcffeb6960cfd19e724 -r4cd45795025411a82006a94d9c7f7f2d9ecda421 --- src/ch/task.h (.../task.h) (revision 4d497e3545ae7c7b9fadedcffeb6960cfd19e724) +++ src/ch/task.h (.../task.h) (revision 4cd45795025411a82006a94d9c7f7f2d9ecda421) @@ -39,12 +39,6 @@ #define ST_DELETING 0x00000003 //------------------------------------ -#define ST_OPERATION_MASK 0x00000f00 -#define ST_COPY 0x00000100 -// moving - delete after copying all files -#define ST_MOVE 0x00000200 - -//------------------------------------ #define ST_SPECIAL_MASK 0x0000f000 // simultaneous flags #define ST_IGNORE_DIRS 0x00001000 @@ -65,6 +59,12 @@ eTaskState_Max }; +enum EOperationType +{ + eOperation_Copy, + eOperation_Move +}; + /////////////////////////////////////////////////////////////////////////// // Exceptions @@ -394,6 +394,9 @@ void SetTaskState(ETaskCurrentState eTaskState); ETaskCurrentState GetTaskState() const; + void SetOperationType(EOperationType eOperationType); + EOperationType GetOperationType() const; + // m_nBufferSize void SetBufferSizes(const BUFFERSIZES* bsSizes); const BUFFERSIZES* GetBufferSizes(); @@ -516,6 +519,8 @@ CClipboardArray m_clipboard; // original paths with which we started operation CDestPath m_dpDestPath; // destination path + EOperationType m_eOperation; // operation which is to be performed by this task object + // task settings int m_nPriority; // task priority (really processing thread priority) @@ -530,6 +535,7 @@ // changing fast volatile ETaskCurrentState m_eCurrentState; // current state of processing this task represents + volatile UINT m_nStatus; // what phase of the operation is this task in TTaskProgressInfo m_tTaskProgressInfo; // task progress information