Clone
ixen
committed
on 01 Nov 20
Partial redesign of file overwrite dialog. Removed CMemDC in favor of MFC version.
src/ch/ClipboardMonitor.cpp (+5 -8)
89 89                 {
90 90                         // get data from clipboard
91 91                         OpenClipboard(nullptr);
92 92                         HANDLE handle=GetClipboardData(CF_HDROP);
93 93
94 94                         UINT nCount=DragQueryFile(static_cast<HDROP>(handle), 0xffffffff, nullptr, 0);
95 95
96 96                         chengine::TTaskDefinition tTaskDefinition;
97 97
98 98                         // list of files
99 99                         for(UINT stIndex = 0; stIndex < nCount; stIndex++)
100 100                         {
101 101                                 DragQueryFile(static_cast<HDROP>(handle), stIndex, path, _MAX_PATH);
102 102
103 103                                 tTaskDefinition.AddSourcePath(chcore::PathFromString(path));
104 104                         }
105 105
106 106                         // operation type
107 107                         chengine::EOperationType eOperation = chengine::eOperation_Copy;
108 108
109                           if(IsClipboardFormatAvailable(nFormat))
  109                         if(IsClipboardFormatAvailable(nFormat) && (handle = GetClipboardData(nFormat)) != nullptr)
110 110                         {
111                                   handle=GetClipboardData(nFormat);
112 111                                 LPVOID addr = GlobalLock(handle);
113 112
114 113                                 DWORD dwData = ((DWORD*)addr)[0];
115 114                                 if (dwData & DROPEFFECT_COPY)
116 115                                         eOperation = chengine::eOperation_Copy// copy
117 116                                 else if (dwData & DROPEFFECT_MOVE)
118 117                                         eOperation = chengine::eOperation_Move// move
119  
120                                   GlobalUnlock(handle);
121 118                         }
122 119                         else
123 120                                 eOperation = chengine::eOperation_Copy// default - copy
124 121
125 122                         tTaskDefinition.SetOperationType(eOperation);   // copy
126 123
127 124                         // set the default options for task
128 125                         GetConfig().ExtractSubConfig(BRANCH_TASK_SETTINGS, tTaskDefinition.GetConfiguration());
129 126
130 127                         EmptyClipboard();
131 128                         CloseClipboard();
132 129
133 130                         TSmartPath pathSelected;
134 131                         INT_PTR iResult = DirectoryChooser::ChooseDirectory(eOperation, tTaskDefinition.GetSourcePaths(), pathSelected);
135 132                         if(iResult == IDOK)
136 133                         {
137 134                                 // get dest path
138 135                                 tTaskDefinition.SetDestinationPath(pathSelected);
139 136
140 137                                 TTaskManagerWrapper tTaskManager(pData->m_spTasks);