From baeee1989a3b7c5d17154e7bb1459007db12f040 Mon Sep 17 00:00:00 2001 From: Tu Dinh <1257909+dinhngtu@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:20:26 +0100 Subject: [PATCH] Implement fast drag drop support. --- NanaZip.UI.Classic/NanaZip.vcxproj | 1 + NanaZip.UI.Classic/NanaZip.vcxproj.filters | 5 +- .../SevenZip/CPP/7zip/UI/Explorer/CopyHook.h | 13 ++++ .../SevenZip/CPP/7zip/UI/FileManager/FM.cpp | 22 ++++++ .../CPP/7zip/UI/FileManager/PanelDrag.cpp | 72 ++++++++++++------- .../CPP/7zip/UI/FileManager/RegistryUtils.cpp | 4 ++ .../CPP/7zip/UI/FileManager/RegistryUtils.h | 1 + .../CPP/7zip/UI/FileManager/SettingsPage.cpp | 3 + .../CPP/7zip/UI/FileManager/SettingsPage2.rc | 2 + .../CPP/7zip/UI/FileManager/SettingsPageRes.h | 1 + NanaZip.UI.Modern/NanaZip.Modern.vcxproj | 3 +- .../NanaZip.Modern.vcxproj.filters | 5 +- .../SevenZip/CPP/7zip/UI/Explorer/CopyHook.h | 13 ++++ .../SevenZip/CPP/7zip/UI/FileManager/FM.cpp | 21 ++++++ .../CPP/7zip/UI/FileManager/PanelDrag.cpp | 72 ++++++++++++------- .../CPP/7zip/UI/FileManager/RegistryUtils.cpp | 4 ++ .../CPP/7zip/UI/FileManager/RegistryUtils.h | 1 + .../CPP/7zip/UI/FileManager/SettingsPage.cpp | 3 + .../CPP/7zip/UI/FileManager/SettingsPage2.rc | 2 + .../CPP/7zip/UI/FileManager/SettingsPageRes.h | 1 + 20 files changed, 196 insertions(+), 53 deletions(-) create mode 100644 NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h create mode 100644 NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h diff --git a/NanaZip.UI.Classic/NanaZip.vcxproj b/NanaZip.UI.Classic/NanaZip.vcxproj index 8d58e70b0..6050edec9 100644 --- a/NanaZip.UI.Classic/NanaZip.vcxproj +++ b/NanaZip.UI.Classic/NanaZip.vcxproj @@ -244,6 +244,7 @@ + diff --git a/NanaZip.UI.Classic/NanaZip.vcxproj.filters b/NanaZip.UI.Classic/NanaZip.vcxproj.filters index b03f15d64..70b7c05e0 100644 --- a/NanaZip.UI.Classic/NanaZip.vcxproj.filters +++ b/NanaZip.UI.Classic/NanaZip.vcxproj.filters @@ -1090,6 +1090,9 @@ AboutDialog + + SevenZip\UI\Explorer + @@ -1099,4 +1102,4 @@ SevenZip\Spec - \ No newline at end of file + diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h new file mode 100644 index 000000000..b905b04c0 --- /dev/null +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h @@ -0,0 +1,13 @@ +#ifndef __COPY_HOOK_H +#define __COPY_HOOK_H + +#include "../../../Common/MyWindows.h" + +#define COPYHOOK_UUID "{7F4FD2EA-8CC8-43C4-8440-CD76805B4E95}" +#define COPYHOOK_COPY 0x7F4FD2EA + +struct CopyHookData { + wchar_t filename[MAX_PATH]; +}; + +#endif diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/FM.cpp b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/FM.cpp index 8c4b58e91..c19affd05 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/FM.cpp +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/FM.cpp @@ -27,6 +27,8 @@ #include "../GUI/ExtractRes.h" +#include "../Explorer/CopyHook.h" + #include "resource.h" #include "App.h" @@ -1055,6 +1057,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) SWP_NOZORDER | SWP_NOACTIVATE); ::UpdateWindow(hWnd); + break; + } + + case WM_COPYDATA: + { + PCOPYDATASTRUCT lpCds = (PCOPYDATASTRUCT)lParam; + if (lpCds->dwData == COPYHOOK_COPY && lpCds->cbData == sizeof(CopyHookData)) { + CPanel& panel = g_App.Panels[g_App.LastFocusedPanel]; + CCopyToOptions options; + CopyHookData* data = static_cast(lpCds->lpData); + options.folder = UString(data->filename); + options.showErrorMessages = true; + CRecordVector indices; + panel.GetOperatedItemIndices(indices); + if (indices.Size() > 0) { + panel.CopyTo(options, indices, NULL); + } + return TRUE; + } + break; } } #ifndef _UNICODE diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp index fb1883230..10a67f961 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp @@ -18,10 +18,13 @@ #include "../Common/CompressCall.h" #include "../Common/ExtractingFilePath.h" +#include "../Explorer/CopyHook.h" + #include "MessagesDialog.h" #include "App.h" #include "EnumFormatEtc.h" +#include "RegistryUtils.h" using namespace NWindows; using namespace NFile; @@ -333,6 +336,10 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) FString dirPrefix; CTempDir tempDirectory; + CFmSettings st; + st.Load(); + FString fakeDirPath; + bool isFSFolder = IsFSFolder(); if (isFSFolder) dirPrefix = us2fs(GetFsPath()); @@ -346,6 +353,16 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) dirPrefix = tempDirectory.GetPath(); // dirPrefix2 = dirPrefix; NFile::NName::NormalizeDirPathPrefix(dirPrefix); + if (st.FastDragDrop) { + fakeDirPath = dirPrefix; + fakeDirPath += FTEXT(COPYHOOK_UUID) FTEXT("."); + fakeDirPath.Add_UInt64(reinterpret_cast(g_App._window.operator HWND())); + if (!CreateDir(fakeDirPath)) + { + MessageBox_Error(L"Can't create fake folder"); + return; + } + } } CDataObject *dataObjectSpec = new CDataObject; @@ -357,35 +374,40 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) // names variable is USED for drag and drop from NanaZip to Explorer or to NanaZip archive folder. // names variable is NOT USED for drag and drop from NanaZip to NanaZip File System folder. - FOR_VECTOR (i, indices) - { - UInt32 index = indices[i]; - UString s; - if (isFSFolder) - s = GetItemRelPath(index); - else + if (!isFSFolder && st.FastDragDrop) { + names.Add(fs2us(fakeDirPath)); + } + else { + FOR_VECTOR(i, indices) { - s = GetItemName(index); - /* - // We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract - // So the following code is not required. - // Maybe we also can change IFolder interface and send some flag also. - - if (s.IsEmpty()) + UInt32 index = indices[i]; + UString s; + if (isFSFolder) + s = GetItemRelPath(index); + else { - // Correct_FsFile_Name("") returns "_". - // If extracting code removes empty folder prefixes from path (as it was in old version), - // Explorer can't find "_" folder in temp folder. - // We can ask Explorer to copy parent temp folder "7zE" instead. + s = GetItemName(index); + /* + // We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract + // So the following code is not required. + // Maybe we also can change IFolder interface and send some flag also. - names.Clear(); - names.Add(dirPrefix2); - break; + if (s.IsEmpty()) + { + // Correct_FsFile_Name("") returns "_". + // If extracting code removes empty folder prefixes from path (as it was in old version), + // Explorer can't find "_" folder in temp folder. + // We can ask Explorer to copy parent temp folder "7zE" instead. + + names.Clear(); + names.Add(dirPrefix2); + break; + } + */ + s = Get_Correct_FsFile_Name(s); } - */ - s = Get_Correct_FsFile_Name(s); + names.Add(fs2us(dirPrefix) + s); } - names.Add(fs2us(dirPrefix) + s); } if (!CopyNamesToHGlobal(dataObjectSpec->hGlobal, names)) return; @@ -393,7 +415,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) CDropSource *dropSourceSpec = new CDropSource; CMyComPtr dropSource = dropSourceSpec; - dropSourceSpec->NeedExtract = !isFSFolder; + dropSourceSpec->NeedExtract = !st.FastDragDrop && !isFSFolder; dropSourceSpec->Panel = this; dropSourceSpec->Indices = indices; dropSourceSpec->Folder = fs2us(dirPrefix); diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp index 148b92746..ad66a4b49 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp @@ -33,6 +33,7 @@ static LPCTSTR const kAlternativeSelection = TEXT("AlternativeSelection"); // static LPCTSTR const kUnderline = TEXT("Underline"); static LPCTSTR const kShowSystemMenu = TEXT("ShowSystemMenu"); +static LPCTSTR const kFastDragDrop = TEXT("FastDragDrop"); // static LPCTSTR const kLockMemoryAdd = TEXT("LockMemoryAdd"); static LPCTSTR const kLargePages = TEXT("LargePages"); @@ -155,6 +156,7 @@ void CFmSettings::Save() const // SaveOption(kUnderline, Underline); SaveOption(kShowSystemMenu, ShowSystemMenu); + SaveOption(kFastDragDrop, FastDragDrop); } void CFmSettings::Load() @@ -173,6 +175,7 @@ void CFmSettings::Load() // Underline = false; ShowSystemMenu = false; + FastDragDrop = false; CKey key; if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) @@ -191,6 +194,7 @@ void CFmSettings::Load() // ReadOption(key, kUnderline, Underline); ReadOption(key, kShowSystemMenu, ShowSystemMenu ); + ReadOption(key, kFastDragDrop, FastDragDrop); } } diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h index 5d9ba1bbc..248dfde0a 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h @@ -33,6 +33,7 @@ struct CFmSettings // bool Underline; bool ShowSystemMenu; + bool FastDragDrop; void Save() const; void Load(); diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp index c7e9c9751..51b443271 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp @@ -128,6 +128,7 @@ bool CSettingsPage::OnInit() // CheckButton(IDX_SETTINGS_UNDERLINE, st.Underline); CheckButton(IDX_SETTINGS_SHOW_SYSTEM_MENU, st.ShowSystemMenu); + CheckButton(IDX_SETTINGS_FAST_DRAG_DROP, st.FastDragDrop); if (IsLargePageSupported()) CheckButton(IDX_SETTINGS_LARGE_PAGES, ReadLockMemoryEnable()); @@ -227,6 +228,7 @@ LONG CSettingsPage::OnApply() // st.Underline = IsButtonCheckedBool(IDX_SETTINGS_UNDERLINE); st.ShowSystemMenu = IsButtonCheckedBool(IDX_SETTINGS_SHOW_SYSTEM_MENU); + st.FastDragDrop = IsButtonCheckedBool(IDX_SETTINGS_FAST_DRAG_DROP); st.Save(); _wasChanged = false; @@ -346,6 +348,7 @@ bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND) case IDX_SETTINGS_WANT_COPY_HISTORY: case IDX_SETTINGS_WANT_FOLDER_HISTORY: case IDX_SETTINGS_LOWERCASE_HASHES: + case IDX_SETTINGS_FAST_DRAG_DROP: _wasChanged = true; break; diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc index c8f0e9d9d..97e140485 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc @@ -19,6 +19,8 @@ BEGIN CONTROL "Want FolderHistory", IDX_SETTINGS_WANT_FOLDER_HISTORY, MY_CHECKBOX, m, 182, xc, 10 CONTROL "Use Lowercase Hashes", IDX_SETTINGS_LOWERCASE_HASHES, MY_CHECKBOX, m, 196, xc, 10 + CONTROL "Use fast drag-and-drop (Experimental)", IDX_SETTINGS_FAST_DRAG_DROP, MY_CHECKBOX, m, 218, xc, 10 + // LTEXT "Memory usage for Compressing:", IDT_COMPRESS_MEMORY, m, 140, xc, 8 // COMBOBOX IDC_SETTINGS_MEM, m , 152, g1xs, yc - 152, MY_COMBO // LTEXT "/ RAM", IDT_SETTINGS_MEM_RAM, m + g1xs + m, 154, xc - g1xs - m, MY_TEXT_NOPREFIX diff --git a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h index a6c76e992..79ffcb236 100644 --- a/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h +++ b/NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h @@ -14,6 +14,7 @@ #define IDX_SETTINGS_WANT_COPY_HISTORY 2511 #define IDX_SETTINGS_WANT_FOLDER_HISTORY 2512 #define IDX_SETTINGS_LOWERCASE_HASHES 2513 +#define IDX_SETTINGS_FAST_DRAG_DROP 2514 // #define IDT_SETTINGS_MEM 100 diff --git a/NanaZip.UI.Modern/NanaZip.Modern.vcxproj b/NanaZip.UI.Modern/NanaZip.Modern.vcxproj index ac81c2c9f..7c9fb8f3c 100644 --- a/NanaZip.UI.Modern/NanaZip.Modern.vcxproj +++ b/NanaZip.UI.Modern/NanaZip.Modern.vcxproj @@ -224,6 +224,7 @@ + @@ -488,4 +489,4 @@ - \ No newline at end of file + diff --git a/NanaZip.UI.Modern/NanaZip.Modern.vcxproj.filters b/NanaZip.UI.Modern/NanaZip.Modern.vcxproj.filters index 9a4211ad0..cd313a9cc 100644 --- a/NanaZip.UI.Modern/NanaZip.Modern.vcxproj.filters +++ b/NanaZip.UI.Modern/NanaZip.Modern.vcxproj.filters @@ -1054,6 +1054,9 @@ SevenZip\Common + + SevenZip\UI\Explorer + @@ -1099,4 +1102,4 @@ Strings\pt-BR - \ No newline at end of file + diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h new file mode 100644 index 000000000..7534a3881 --- /dev/null +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/Explorer/CopyHook.h @@ -0,0 +1,13 @@ +#ifndef __COPY_HOOK_H +#define __COPY_HOOK_H + +#include "../../../Common/MyWindows.h" + +#define COPYHOOK_UUID "{7F4FD2EA-8CC8-43C4-8440-CD76805B4E95}" +#define COPYHOOK_COPY 0x7F4FD2EA + +struct CopyHookData { + wchar_t filename[MAX_PATH]; +}; + +#endif diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/FM.cpp b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/FM.cpp index aef2c5098..3c92141d5 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/FM.cpp +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/FM.cpp @@ -27,6 +27,8 @@ #include "../GUI/ExtractRes.h" +#include "../Explorer/CopyHook.h" + #include "resource.h" #include "App.h" @@ -1065,6 +1067,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; } + + case WM_COPYDATA: + { + PCOPYDATASTRUCT lpCds = (PCOPYDATASTRUCT)lParam; + if (lpCds->dwData == COPYHOOK_COPY && lpCds->cbData == sizeof(CopyHookData)) { + CPanel& panel = g_App.Panels[g_App.LastFocusedPanel]; + CCopyToOptions options; + CopyHookData* data = static_cast(lpCds->lpData); + options.folder = UString(data->filename); + options.showErrorMessages = true; + CRecordVector indices; + panel.GetOperatedItemIndices(indices); + if (indices.Size() > 0) { + panel.CopyTo(options, indices, NULL); + } + return TRUE; + } + break; + } default: break; } diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp index fb1883230..10a67f961 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/PanelDrag.cpp @@ -18,10 +18,13 @@ #include "../Common/CompressCall.h" #include "../Common/ExtractingFilePath.h" +#include "../Explorer/CopyHook.h" + #include "MessagesDialog.h" #include "App.h" #include "EnumFormatEtc.h" +#include "RegistryUtils.h" using namespace NWindows; using namespace NFile; @@ -333,6 +336,10 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) FString dirPrefix; CTempDir tempDirectory; + CFmSettings st; + st.Load(); + FString fakeDirPath; + bool isFSFolder = IsFSFolder(); if (isFSFolder) dirPrefix = us2fs(GetFsPath()); @@ -346,6 +353,16 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) dirPrefix = tempDirectory.GetPath(); // dirPrefix2 = dirPrefix; NFile::NName::NormalizeDirPathPrefix(dirPrefix); + if (st.FastDragDrop) { + fakeDirPath = dirPrefix; + fakeDirPath += FTEXT(COPYHOOK_UUID) FTEXT("."); + fakeDirPath.Add_UInt64(reinterpret_cast(g_App._window.operator HWND())); + if (!CreateDir(fakeDirPath)) + { + MessageBox_Error(L"Can't create fake folder"); + return; + } + } } CDataObject *dataObjectSpec = new CDataObject; @@ -357,35 +374,40 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) // names variable is USED for drag and drop from NanaZip to Explorer or to NanaZip archive folder. // names variable is NOT USED for drag and drop from NanaZip to NanaZip File System folder. - FOR_VECTOR (i, indices) - { - UInt32 index = indices[i]; - UString s; - if (isFSFolder) - s = GetItemRelPath(index); - else + if (!isFSFolder && st.FastDragDrop) { + names.Add(fs2us(fakeDirPath)); + } + else { + FOR_VECTOR(i, indices) { - s = GetItemName(index); - /* - // We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract - // So the following code is not required. - // Maybe we also can change IFolder interface and send some flag also. - - if (s.IsEmpty()) + UInt32 index = indices[i]; + UString s; + if (isFSFolder) + s = GetItemRelPath(index); + else { - // Correct_FsFile_Name("") returns "_". - // If extracting code removes empty folder prefixes from path (as it was in old version), - // Explorer can't find "_" folder in temp folder. - // We can ask Explorer to copy parent temp folder "7zE" instead. + s = GetItemName(index); + /* + // We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract + // So the following code is not required. + // Maybe we also can change IFolder interface and send some flag also. - names.Clear(); - names.Add(dirPrefix2); - break; + if (s.IsEmpty()) + { + // Correct_FsFile_Name("") returns "_". + // If extracting code removes empty folder prefixes from path (as it was in old version), + // Explorer can't find "_" folder in temp folder. + // We can ask Explorer to copy parent temp folder "7zE" instead. + + names.Clear(); + names.Add(dirPrefix2); + break; + } + */ + s = Get_Correct_FsFile_Name(s); } - */ - s = Get_Correct_FsFile_Name(s); + names.Add(fs2us(dirPrefix) + s); } - names.Add(fs2us(dirPrefix) + s); } if (!CopyNamesToHGlobal(dataObjectSpec->hGlobal, names)) return; @@ -393,7 +415,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */) CDropSource *dropSourceSpec = new CDropSource; CMyComPtr dropSource = dropSourceSpec; - dropSourceSpec->NeedExtract = !isFSFolder; + dropSourceSpec->NeedExtract = !st.FastDragDrop && !isFSFolder; dropSourceSpec->Panel = this; dropSourceSpec->Indices = indices; dropSourceSpec->Folder = fs2us(dirPrefix); diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp index 148b92746..ad66a4b49 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.cpp @@ -33,6 +33,7 @@ static LPCTSTR const kAlternativeSelection = TEXT("AlternativeSelection"); // static LPCTSTR const kUnderline = TEXT("Underline"); static LPCTSTR const kShowSystemMenu = TEXT("ShowSystemMenu"); +static LPCTSTR const kFastDragDrop = TEXT("FastDragDrop"); // static LPCTSTR const kLockMemoryAdd = TEXT("LockMemoryAdd"); static LPCTSTR const kLargePages = TEXT("LargePages"); @@ -155,6 +156,7 @@ void CFmSettings::Save() const // SaveOption(kUnderline, Underline); SaveOption(kShowSystemMenu, ShowSystemMenu); + SaveOption(kFastDragDrop, FastDragDrop); } void CFmSettings::Load() @@ -173,6 +175,7 @@ void CFmSettings::Load() // Underline = false; ShowSystemMenu = false; + FastDragDrop = false; CKey key; if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) @@ -191,6 +194,7 @@ void CFmSettings::Load() // ReadOption(key, kUnderline, Underline); ReadOption(key, kShowSystemMenu, ShowSystemMenu ); + ReadOption(key, kFastDragDrop, FastDragDrop); } } diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h index 5d9ba1bbc..248dfde0a 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/RegistryUtils.h @@ -33,6 +33,7 @@ struct CFmSettings // bool Underline; bool ShowSystemMenu; + bool FastDragDrop; void Save() const; void Load(); diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp index c7e9c9751..51b443271 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage.cpp @@ -128,6 +128,7 @@ bool CSettingsPage::OnInit() // CheckButton(IDX_SETTINGS_UNDERLINE, st.Underline); CheckButton(IDX_SETTINGS_SHOW_SYSTEM_MENU, st.ShowSystemMenu); + CheckButton(IDX_SETTINGS_FAST_DRAG_DROP, st.FastDragDrop); if (IsLargePageSupported()) CheckButton(IDX_SETTINGS_LARGE_PAGES, ReadLockMemoryEnable()); @@ -227,6 +228,7 @@ LONG CSettingsPage::OnApply() // st.Underline = IsButtonCheckedBool(IDX_SETTINGS_UNDERLINE); st.ShowSystemMenu = IsButtonCheckedBool(IDX_SETTINGS_SHOW_SYSTEM_MENU); + st.FastDragDrop = IsButtonCheckedBool(IDX_SETTINGS_FAST_DRAG_DROP); st.Save(); _wasChanged = false; @@ -346,6 +348,7 @@ bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND) case IDX_SETTINGS_WANT_COPY_HISTORY: case IDX_SETTINGS_WANT_FOLDER_HISTORY: case IDX_SETTINGS_LOWERCASE_HASHES: + case IDX_SETTINGS_FAST_DRAG_DROP: _wasChanged = true; break; diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc index c8f0e9d9d..97e140485 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPage2.rc @@ -19,6 +19,8 @@ BEGIN CONTROL "Want FolderHistory", IDX_SETTINGS_WANT_FOLDER_HISTORY, MY_CHECKBOX, m, 182, xc, 10 CONTROL "Use Lowercase Hashes", IDX_SETTINGS_LOWERCASE_HASHES, MY_CHECKBOX, m, 196, xc, 10 + CONTROL "Use fast drag-and-drop (Experimental)", IDX_SETTINGS_FAST_DRAG_DROP, MY_CHECKBOX, m, 218, xc, 10 + // LTEXT "Memory usage for Compressing:", IDT_COMPRESS_MEMORY, m, 140, xc, 8 // COMBOBOX IDC_SETTINGS_MEM, m , 152, g1xs, yc - 152, MY_COMBO // LTEXT "/ RAM", IDT_SETTINGS_MEM_RAM, m + g1xs + m, 154, xc - g1xs - m, MY_TEXT_NOPREFIX diff --git a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h index a6c76e992..79ffcb236 100644 --- a/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h +++ b/NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/SettingsPageRes.h @@ -14,6 +14,7 @@ #define IDX_SETTINGS_WANT_COPY_HISTORY 2511 #define IDX_SETTINGS_WANT_FOLDER_HISTORY 2512 #define IDX_SETTINGS_LOWERCASE_HASHES 2513 +#define IDX_SETTINGS_FAST_DRAG_DROP 2514 // #define IDT_SETTINGS_MEM 100