Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2017-04-30 03:00:00 +0300
committerKornel <kornel@geekhood.net>2017-05-05 20:56:20 +0300
commit2efa10565ac395d2ce9a679ead46e70fb2f963eb (patch)
tree84c8df4deb69ec44ea15af9378f24347db55c357 /CPP/7zip/UI/FileManager
parent603abd5528c97346e9448c0ff47949f818fe558c (diff)
17.0017.00
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rw-r--r--CPP/7zip/UI/FileManager/AboutDialog.cpp15
-rw-r--r--CPP/7zip/UI/FileManager/AltStreamsFolder.cpp10
-rw-r--r--CPP/7zip/UI/FileManager/App.cpp40
-rw-r--r--CPP/7zip/UI/FileManager/App.h18
-rw-r--r--CPP/7zip/UI/FileManager/BrowseDialog.cpp37
-rw-r--r--CPP/7zip/UI/FileManager/EditPage.cpp33
-rw-r--r--CPP/7zip/UI/FileManager/ExtractCallback.cpp26
-rw-r--r--CPP/7zip/UI/FileManager/FM.cpp37
-rw-r--r--CPP/7zip/UI/FileManager/FM.dsp2
-rw-r--r--CPP/7zip/UI/FileManager/FSDrives.cpp21
-rw-r--r--CPP/7zip/UI/FileManager/FSFolder.cpp102
-rw-r--r--CPP/7zip/UI/FileManager/FSFolder.h4
-rw-r--r--CPP/7zip/UI/FileManager/FSFolderCopy.cpp7
-rw-r--r--CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp4
-rw-r--r--CPP/7zip/UI/FileManager/FoldersPage.cpp6
-rw-r--r--CPP/7zip/UI/FileManager/HelpUtils.cpp11
-rw-r--r--CPP/7zip/UI/FileManager/HelpUtils.h2
-rw-r--r--CPP/7zip/UI/FileManager/LangPage.cpp18
-rw-r--r--CPP/7zip/UI/FileManager/LangUtils.cpp27
-rw-r--r--CPP/7zip/UI/FileManager/LinkDialog.cpp6
-rw-r--r--CPP/7zip/UI/FileManager/MenuPage.cpp27
-rw-r--r--CPP/7zip/UI/FileManager/MyLoadMenu.cpp136
-rw-r--r--CPP/7zip/UI/FileManager/NetFolder.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/OpenCallback.cpp6
-rw-r--r--CPP/7zip/UI/FileManager/OverwriteDialog.cpp15
-rw-r--r--CPP/7zip/UI/FileManager/Panel.cpp19
-rw-r--r--CPP/7zip/UI/FileManager/Panel.h17
-rw-r--r--CPP/7zip/UI/FileManager/PanelCopy.cpp15
-rw-r--r--CPP/7zip/UI/FileManager/PanelCrc.cpp11
-rw-r--r--CPP/7zip/UI/FileManager/PanelDrag.cpp10
-rw-r--r--CPP/7zip/UI/FileManager/PanelFolderChange.cpp62
-rw-r--r--CPP/7zip/UI/FileManager/PanelItemOpen.cpp170
-rw-r--r--CPP/7zip/UI/FileManager/PanelItems.cpp50
-rw-r--r--CPP/7zip/UI/FileManager/PanelKey.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/PanelListNotify.cpp50
-rw-r--r--CPP/7zip/UI/FileManager/PanelMenu.cpp80
-rw-r--r--CPP/7zip/UI/FileManager/PanelOperations.cpp6
-rw-r--r--CPP/7zip/UI/FileManager/PanelSelect.cpp4
-rw-r--r--CPP/7zip/UI/FileManager/PanelSort.cpp8
-rw-r--r--CPP/7zip/UI/FileManager/PanelSplitFile.cpp18
-rw-r--r--CPP/7zip/UI/FileManager/ProgressDialog.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/ProgressDialog2.cpp26
-rw-r--r--CPP/7zip/UI/FileManager/RegistryAssociations.cpp31
-rw-r--r--CPP/7zip/UI/FileManager/RegistryPlugins.cpp18
-rw-r--r--CPP/7zip/UI/FileManager/RegistryUtils.cpp50
-rw-r--r--CPP/7zip/UI/FileManager/RootFolder.cpp10
-rw-r--r--CPP/7zip/UI/FileManager/SettingsPage.cpp4
-rw-r--r--CPP/7zip/UI/FileManager/SplitDialog.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/SplitUtils.cpp25
-rw-r--r--CPP/7zip/UI/FileManager/StringUtils.cpp6
-rw-r--r--CPP/7zip/UI/FileManager/SystemPage.cpp14
-rw-r--r--CPP/7zip/UI/FileManager/TextPairs.cpp8
-rw-r--r--CPP/7zip/UI/FileManager/ViewSettings.cpp27
-rw-r--r--CPP/7zip/UI/FileManager/resource.h2
-rw-r--r--CPP/7zip/UI/FileManager/resource.rc9
55 files changed, 897 insertions, 471 deletions
diff --git a/CPP/7zip/UI/FileManager/AboutDialog.cpp b/CPP/7zip/UI/FileManager/AboutDialog.cpp
index 35e67753..a644474b 100644
--- a/CPP/7zip/UI/FileManager/AboutDialog.cpp
+++ b/CPP/7zip/UI/FileManager/AboutDialog.cpp
@@ -17,8 +17,8 @@ static const UInt32 kLangIDs[] =
IDT_ABOUT_INFO
};
-static LPCTSTR kHomePageURL = TEXT("http://www.7-zip.org/");
-static LPCWSTR kHelpTopic = L"start.htm";
+#define kHomePageURL TEXT("http://www.7-zip.org/")
+#define kHelpTopic "start.htm"
#define LLL_(quote) L##quote
#define LLL(quote) LLL_(quote)
@@ -26,14 +26,7 @@ static LPCWSTR kHelpTopic = L"start.htm";
bool CAboutDialog::OnInit()
{
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
- UString s = L"7-Zip " LLL(MY_VERSION);
- #ifdef MY_CPU_64BIT
- s += L" [";
- AddLangString(s, IDS_PROP_BIT64);
- s += L']';
- #endif
-
- SetItemText(IDT_ABOUT_VERSION, s);
+ SetItemText(IDT_ABOUT_VERSION, UString("7-Zip " MY_VERSION_CPU));
SetItemText(IDT_ABOUT_DATE, LLL(MY_DATE));
LangSetWindowText(*this, IDD_ABOUT);
@@ -43,7 +36,7 @@ bool CAboutDialog::OnInit()
void CAboutDialog::OnHelp()
{
- ShowHelpWindow(NULL, kHelpTopic);
+ ShowHelpWindow(kHelpTopic);
}
bool CAboutDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
diff --git a/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp b/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp
index c209bf35..b7fbb235 100644
--- a/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp
+++ b/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp
@@ -274,7 +274,7 @@ STDMETHODIMP CAltStreamsFolder::BindToFolder(const wchar_t * /* name */, IFolder
return E_INVALIDARG;
}
-static const CFSTR kSuperPrefix = FTEXT("\\\\?\\");
+// static CFSTR const kSuperPrefix = FTEXT("\\\\?\\");
STDMETHODIMP CAltStreamsFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
@@ -408,7 +408,7 @@ static HRESULT SendMessageError(IFolderOperationsExtractCallback *callback,
const wchar_t *message, const FString &fileName)
{
UString s = message;
- s += L" : ";
+ s += " : ";
s += fs2us(fileName);
return callback->ShowMessage(s);
}
@@ -417,7 +417,7 @@ static HRESULT SendMessageError(IFolderArchiveUpdateCallback *callback,
const wchar_t *message, const FString &fileName)
{
UString s = message;
- s += L" : ";
+ s += " : ";
s += fs2us(fileName);
return callback->UpdateErrorMessage(s);
}
@@ -629,7 +629,7 @@ static HRESULT CopyStream(
if (IntToBool(writeAskResult))
{
RINOK(callback->SetCurrentFilePath(fs2us(srcPath)));
- FString destPathNew = us2fs((LPCOLESTR)destPathResult);
+ FString destPathNew (us2fs((LPCOLESTR)destPathResult));
RINOK(state.MyCopyFile(srcPath, destPathNew));
if (state.ErrorFileIndex >= 0)
{
@@ -712,7 +712,7 @@ STDMETHODIMP CAltStreamsFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UI
}
*/
- FString destPath = us2fs(path);
+ FString destPath (us2fs(path));
if (destPath.IsEmpty() /* && !ExtractToStreamCallback */)
return E_INVALIDARG;
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp
index 6d5662de..dfc75b69 100644
--- a/CPP/7zip/UI/FileManager/App.cpp
+++ b/CPP/7zip/UI/FileManager/App.cpp
@@ -23,6 +23,7 @@
#include "FormatUtils.h"
#include "IFolder.h"
#include "LangUtils.h"
+#include "MyLoadMenu.h"
#include "RegistryUtils.h"
#include "ViewSettings.h"
@@ -37,7 +38,7 @@ using namespace NName;
extern DWORD g_ComCtl32Version;
extern HINSTANCE g_hInstance;
-static CFSTR kTempDirPrefix = FTEXT("7zE");
+#define kTempDirPrefix FTEXT("7zE")
void CPanelCallbackImp::OnTab()
{
@@ -281,9 +282,6 @@ void CApp::SaveToolbarChanges()
}
-void MyLoadMenu();
-
-
HRESULT CApp::Create(HWND hwnd, const UString &mainPath, const UString &arcFormat, int xSizes[2], bool needOpenArc, bool &archiveIsOpened, bool &encrypted)
{
_window.Attach(hwnd);
@@ -460,7 +458,7 @@ static void AddSizeValue(UString &s, UInt64 size)
static void AddValuePair1(UString &s, UINT resourceID, UInt64 size)
{
AddLangString(s, resourceID);
- s += L": ";
+ s += ": ";
AddSizeValue(s, size);
s.Add_LF();
}
@@ -470,14 +468,14 @@ void AddValuePair2(UString &s, UINT resourceID, UInt64 num, UInt64 size)
if (num == 0)
return;
AddLangString(s, resourceID);
- s += L": ";
+ s += ": ";
s += ConvertSizeToString(num);
if (size != (UInt64)(Int64)-1)
{
- s += L" ( ";
+ s += " ( ";
AddSizeValue(s, size);
- s += L" )";
+ s += " )";
}
s.Add_LF();
}
@@ -529,14 +527,18 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
for (i = 0; i < indices.Size() && (int)i < (int)kCopyDialog_NumInfoLines - 6; i++)
{
- info += L"\n ";
+ info.Add_LF();
+ info += " ";
int index = indices[i];
info += GetItemRelPath(index);
if (IsItem_Folder(index))
info.Add_PathSepar();
}
if (i != indices.Size())
- info += L"\n ...";
+ {
+ info.Add_LF();
+ info += " ...";
+ }
return info;
}
@@ -697,7 +699,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
else
{
if (indices.Size() == 1 &&
- !destPath.IsEmpty() && destPath.Back() != WCHAR_PATH_SEPARATOR)
+ !destPath.IsEmpty() && !IS_PATH_SEPAR(destPath.Back()))
{
int pos = destPath.ReverseFind_PathSepar();
if (pos < 0)
@@ -810,7 +812,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
// srcPanel.InvalidateList(NULL, true);
if (result != E_ABORT)
- srcPanel.MessageBoxError(result, L"Error");
+ srcPanel.MessageBoxError(result);
// return;
}
@@ -862,12 +864,24 @@ void CApp::OnSetSubFolder(int srcPanelIndex)
{
if (srcPanel._folder->BindToParentFolder(&newFolder) != S_OK)
return;
+ if (!newFolder)
+ {
+ const UString parentPrefix = srcPanel.GetParentDirPrefix();
+ bool archiveIsOpened, encrypted;
+ destPanel.BindToPath(parentPrefix, UString(), archiveIsOpened, encrypted);
+ destPanel.RefreshListCtrl();
+ return;
+ }
}
else
{
if (srcPanel._folder->BindToFolder(realIndex, &newFolder) != S_OK)
return;
}
+
+ if (!newFolder)
+ return;
+
destPanel.CloseOpenFolders();
destPanel.SetNewFolder(newFolder);
destPanel.RefreshListCtrl();
@@ -927,7 +941,7 @@ void CApp::RefreshTitle(bool always)
{
UString path = GetFocusedPanel()._currentFolderPrefix;
if (path.IsEmpty())
- path = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ path = "7-Zip"; // LangString(IDS_APP_TITLE);
if (!always && path == PrevTitle)
return;
PrevTitle = path;
diff --git a/CPP/7zip/UI/FileManager/App.h b/CPP/7zip/UI/FileManager/App.h
index 9cc1066b..fa8eeaa7 100644
--- a/CPP/7zip/UI/FileManager/App.h
+++ b/CPP/7zip/UI/FileManager/App.h
@@ -195,7 +195,7 @@ public:
void MoveTo() { OnCopy(true, false, GetFocusedPanelIndex()); }
void Delete(bool toRecycleBin) { GetFocusedPanel().DeleteItems(toRecycleBin); }
HRESULT CalculateCrc2(const UString &methodName);
- void CalculateCrc(const UString &methodName);
+ void CalculateCrc(const char *methodName);
void DiffFiles();
void Split();
void Combine();
@@ -259,7 +259,23 @@ public:
void SetListSettings();
HRESULT SwitchOnOffOnePanel();
+ CIntVector _timestampLevels;
+
bool GetFlatMode() { return Panels[LastFocusedPanel].GetFlatMode(); }
+
+ int GetTimestampLevel() const { return Panels[LastFocusedPanel]._timestampLevel; }
+ void SetTimestampLevel(int level)
+ {
+ unsigned i;
+ for (i = 0; i < kNumPanelsMax; i++)
+ {
+ CPanel &panel = Panels[i];
+ panel._timestampLevel = level;
+ if (panel.PanelCreated)
+ panel.RedrawListItems();
+ }
+ }
+
// bool Get_ShowNtfsStrems_Mode() { return Panels[LastFocusedPanel].Get_ShowNtfsStrems_Mode(); }
void ChangeFlatMode() { Panels[LastFocusedPanel].ChangeFlatMode(); }
diff --git a/CPP/7zip/UI/FileManager/BrowseDialog.cpp b/CPP/7zip/UI/FileManager/BrowseDialog.cpp
index 066ac219..d8f9ebe8 100644
--- a/CPP/7zip/UI/FileManager/BrowseDialog.cpp
+++ b/CPP/7zip/UI/FileManager/BrowseDialog.cpp
@@ -209,7 +209,7 @@ bool CBrowseDialog::OnInit()
if (!FilterDescription.IsEmpty())
s = FilterDescription;
else if (ShowAllFiles)
- s = L"*.*";
+ s = "*.*";
else
{
FOR_VECTOR (i, Filters)
@@ -468,11 +468,11 @@ bool CBrowseDialog::GetParentPath(const UString &path, UString &parentPrefix, US
if (_topDirPrefix == path)
return false;
UString s = path;
- if (s.Back() == WCHAR_PATH_SEPARATOR)
+ if (IS_PATH_SEPAR(s.Back()))
s.DeleteBack();
if (s.IsEmpty())
return false;
- if (s.Back() == WCHAR_PATH_SEPARATOR)
+ if (IS_PATH_SEPAR(s.Back()))
return false;
int pos = s.ReverseFind_PathSepar();
parentPrefix.SetFrom(s, pos + 1);
@@ -531,7 +531,7 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
#ifndef UNDER_CE
bool isDrive = false;
- if (pathPrefix.IsEmpty() || pathPrefix == kSuperPathPrefix)
+ if (pathPrefix.IsEmpty() || pathPrefix.IsEqualTo(kSuperPathPrefix))
{
isDrive = true;
FStringVector drives;
@@ -551,7 +551,8 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
else
#endif
{
- CEnumerator enumerator(us2fs(pathPrefix + L'*'));
+ CEnumerator enumerator;
+ enumerator.SetDirPrefix(us2fs(pathPrefix));
for (;;)
{
bool found;
@@ -596,7 +597,7 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
if (_showDots && _topDirPrefix != DirPrefix)
{
item.iItem = index;
- const UString itemName = L"..";
+ const UString itemName ("..");
if (selectedName.IsEmpty())
cursorIndex = index;
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
@@ -642,16 +643,14 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
_list.InsertItem(&item);
wchar_t s[32];
{
- FILETIME ft;
s[0] = 0;
- if (FileTimeToLocalFileTime(&fi.MTime, &ft))
- ConvertFileTimeToString(ft, s,
+ ConvertUtcFileTimeToString(fi.MTime, s,
#ifndef UNDER_CE
- true
+ kTimestampPrintLevel_MIN
#else
- false
+ kTimestampPrintLevel_DAY
#endif
- , false);
+ );
_list.SetSubItem(index, subItem++, s);
}
{
@@ -780,8 +779,10 @@ void CBrowseDialog::OnItemEnter()
*/
return;
}
- UString s = DirPrefix + fs2us(file.Name) + WCHAR_PATH_SEPARATOR;
- HRESULT res = Reload(s, L"");
+ UString s = DirPrefix;
+ s += fs2us(file.Name);
+ s.Add_PathSepar();
+ HRESULT res = Reload(s, UString());
if (res != S_OK)
MessageBox_HResError(*this, res, s);
SetPathEditText();
@@ -853,17 +854,17 @@ bool MyBrowseForFile(HWND owner, LPCWSTR title, LPCWSTR path,
#else
// maybe we must use GetLastError in WinCE.
DWORD errorCode = CommDlgExtendedError();
- const wchar_t *errorMessage = NULL;
+ const char *errorMessage = NULL;
switch (errorCode)
{
case 0: return false; // cancel or close obn dialog
- case FNERR_INVALIDFILENAME: errorMessage = L"Invalid File Name"; break;
- default: errorMessage = L"Open Dialog Error";
+ case FNERR_INVALIDFILENAME: errorMessage = "Invalid File Name"; break;
+ default: errorMessage = "Open Dialog Error";
}
if (!errorMessage)
return false;
{
- UString s = errorMessage;
+ UString s (errorMessage);
s.Add_LF();
s += path;
MessageBox_Error_Global(owner, s);
diff --git a/CPP/7zip/UI/FileManager/EditPage.cpp b/CPP/7zip/UI/FileManager/EditPage.cpp
index b88c0f68..0108904d 100644
--- a/CPP/7zip/UI/FileManager/EditPage.cpp
+++ b/CPP/7zip/UI/FileManager/EditPage.cpp
@@ -23,7 +23,7 @@ static const UInt32 kLangIDs_Colon[] =
IDT_EDIT_VIEWER
};
-static LPCWSTR kEditTopic = L"FM/options.htm#editor";
+#define kEditTopic "FM/options.htm#editor"
bool CEditPage::OnInit()
{
@@ -76,17 +76,38 @@ LONG CEditPage::OnApply()
void CEditPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kEditTopic);
+ ShowHelpWindow(kEditTopic);
}
+void SplitCmdLineSmart(const UString &cmd, UString &prg, UString &params);
+
static void Edit_BrowseForFile(NWindows::NControl::CEdit &edit, HWND hwnd)
{
- UString path;
- edit.GetText(path);
+ UString cmd;
+ edit.GetText(cmd);
+
+ UString param;
+ UString prg;
+
+ SplitCmdLineSmart(cmd, prg, param);
+
UString resPath;
- if (MyBrowseForFile(hwnd, 0, path, NULL, L"*.exe", resPath))
+
+ if (MyBrowseForFile(hwnd, 0, prg, NULL, L"*.exe", resPath))
{
- edit.SetText(resPath);
+ resPath.Trim();
+ cmd = resPath;
+ /*
+ if (!param.IsEmpty() && !resPath.IsEmpty())
+ {
+ cmd.InsertAtFront(L'\"');
+ cmd += L'\"';
+ cmd.Add_Space();
+ cmd += param;
+ }
+ */
+
+ edit.SetText(cmd);
// Changed();
}
}
diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/CPP/7zip/UI/FileManager/ExtractCallback.cpp
index 7d61d14d..343bb0f8 100644
--- a/CPP/7zip/UI/FileManager/ExtractCallback.cpp
+++ b/CPP/7zip/UI/FileManager/ExtractCallback.cpp
@@ -335,20 +335,18 @@ void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileNam
s += msg;
else
{
- char temp[16];
- ConvertUInt32ToString(opRes, temp);
- s.AddAscii("Error #");
- s.AddAscii(temp);
+ s += "Error #";
+ s.Add_UInt32(opRes);
}
if (encrypted && opRes != NArchive::NExtract::NOperationResult::kWrongPassword)
{
- // s.AddAscii(" : ");
+ // s += " : ";
// AddLangString(s, IDS_EXTRACT_MSG_ENCRYPTED);
- s.AddAscii(" : ");
+ s += " : ";
AddLangString(s, IDS_EXTRACT_MSG_WRONG_PSW_GUESS);
}
- s.AddAscii(" : ");
+ s += " : ";
s += fileName;
}
}
@@ -466,7 +464,7 @@ UString GetOpenArcErrorMessage(UInt32 errorFlags)
continue;
if (f == kpv_ErrorFlags_EncryptedHeadersError)
{
- m.AddAscii(" : ");
+ m += " : ";
AddLangString(m, IDS_EXTRACT_MSG_WRONG_PSW_GUESS);
}
if (!s.IsEmpty())
@@ -483,7 +481,7 @@ UString GetOpenArcErrorMessage(UInt32 errorFlags)
ConvertUInt32ToHex(errorFlags, sz + 2);
if (!s.IsEmpty())
s.Add_LF();
- s.AddAscii(sz);
+ s += sz;
}
return s;
@@ -503,7 +501,7 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
if (warningFlags != 0)
{
s += GetNameOfProperty(kpidWarningFlags, L"Warnings");
- s.AddAscii(":");
+ s += ":";
s.Add_LF();
AddNewLineString(s, GetOpenArcErrorMessage(warningFlags));
}
@@ -511,7 +509,7 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
if (!er.WarningMessage.IsEmpty())
{
s += GetNameOfProperty(kpidWarning, L"Warning");
- s.AddAscii(": ");
+ s += ": ";
s += er.WarningMessage;
s.Add_LF();
}
@@ -519,9 +517,9 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
static UString GetBracedType(const wchar_t *type)
{
- UString s = L'[';
+ UString s ('[');
s += type;
- s += L']';
+ s += ']';
return s;
}
@@ -1009,7 +1007,7 @@ HRESULT CVirtFileSystem::FlushToDisk(bool closeLast)
{
_outFileStream.Release();
return E_FAIL;
- // MessageBoxMyError(UString(L"Can't create file ") + fs2us(tempFilePath));
+ // MessageBoxMyError(UString("Can't create file ") + fs2us(tempFilePath));
}
_fileIsOpen = true;
RINOK(WriteStream(_outFileStream, file.Data, (size_t)file.Size));
diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp
index ce39011e..fe5ae671 100644
--- a/CPP/7zip/UI/FileManager/FM.cpp
+++ b/CPP/7zip/UI/FileManager/FM.cpp
@@ -8,7 +8,6 @@
#include "../../../../C/Alloc.h"
-#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
@@ -43,16 +42,21 @@ using namespace NFind;
#define MENU_HEIGHT 26
bool g_RAM_Size_Defined;
+bool g_LargePagesMode = false;
+bool g_OpenArchive = false;
+
+static bool g_Maximized = false;
+
UInt64 g_RAM_Size;
#ifdef _WIN32
HINSTANCE g_hInstance;
#endif
+
HWND g_HWND;
-bool g_OpenArchive = false;
+
static UString g_MainPath;
static UString g_ArcFormat;
-static bool g_Maximized = false;
// HRESULT LoadGlobalCodecs();
void FreeGlobalCodecs();
@@ -166,7 +170,7 @@ CApp g_App;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-const wchar_t *kWindowClass = L"FM";
+static const wchar_t * const kWindowClass = L"FM";
#ifdef UNDER_CE
#define WS_OVERLAPPEDWINDOW ( \
@@ -185,7 +189,7 @@ static BOOL InitInstance(int nCmdShow)
// LoadString(hInstance, IDS_CLASS, windowClass, MAX_LOADSTRING);
- UString title = L"7-Zip"; // LangString(IDS_APP_TITLE, 0x03000000);
+ UString title ("7-Zip"); // LangString(IDS_APP_TITLE, 0x03000000);
/*
//If it is already running, then focus on the window
@@ -379,7 +383,7 @@ static void SetMemoryLock()
NSecurity::AddLockMemoryPrivilege();
if (ReadLockMemoryEnable())
- NSecurity::EnablePrivilege_LockMemory();
+ g_LargePagesMode = NSecurity::EnablePrivilege_LockMemory();
}
bool g_SymLink_Supported = false;
@@ -426,8 +430,13 @@ static void ErrorMessage(const wchar_t *s)
MessageBoxW(0, s, L"7-Zip", MB_ICONERROR);
}
+static void ErrorMessage(const char *s)
+{
+ ErrorMessage(GetUnicodeString(s));
+}
+
-#define NT_CHECK_FAIL_ACTION ErrorMessage(L"Unsupported Windows version"); return 1;
+#define NT_CHECK_FAIL_ACTION ErrorMessage("Unsupported Windows version"); return 1;
static int WINAPI WinMain2(int nCmdShow)
{
@@ -667,7 +676,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
}
catch(const AString &s)
{
- ErrorMessage(GetUnicodeString(s));
+ ErrorMessage(s.Ptr());
return 1;
}
catch(const wchar_t *s)
@@ -677,19 +686,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
}
catch(const char *s)
{
- ErrorMessage(GetUnicodeString(s));
+ ErrorMessage(s);
return 1;
}
catch(int v)
{
- wchar_t s[32];
- ConvertUInt32ToString(v, s);
- ErrorMessage(UString(L"Error: ") + s);
+ AString e ("Error: ");
+ e.Add_UInt32(v);
+ ErrorMessage(e);
return 1;
}
catch(...)
{
- ErrorMessage(L"Unknown error");
+ ErrorMessage("Unknown error");
return 1;
}
}
@@ -844,7 +853,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (needOpenFile && !archiveIsOpened || res != S_OK)
{
- UString m = L"Error";
+ UString m ("Error");
if (res == S_FALSE || res == S_OK)
{
m = MyFormatNew(encrypted ?
diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp
index f18e5441..3b2fb2e3 100644
--- a/CPP/7zip/UI/FileManager/FM.dsp
+++ b/CPP/7zip/UI/FileManager/FM.dsp
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /FAs /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /FAcs /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
diff --git a/CPP/7zip/UI/FileManager/FSDrives.cpp b/CPP/7zip/UI/FileManager/FSDrives.cpp
index dd4ba724..208cea4e 100644
--- a/CPP/7zip/UI/FileManager/FSDrives.cpp
+++ b/CPP/7zip/UI/FileManager/FSDrives.cpp
@@ -28,12 +28,14 @@ using namespace NWindows;
using namespace NFile;
using namespace NFind;
-static const CFSTR kVolPrefix = FTEXT("\\\\.\\");
-static const CFSTR kSuperPrefix = FTEXT("\\\\?\\");
+static const char * const kVolPrefix = "\\\\.\\";
+static const char * const kSuperPrefix = "\\\\?\\";
FString CDriveInfo::GetDeviceFileIoName() const
{
- return kVolPrefix + Name;
+ FString f (kVolPrefix);
+ f += Name;
+ return f;
}
struct CPhysTempBuffer
@@ -179,11 +181,10 @@ STDMETHODIMP CFSDrives::LoadItems()
// we must use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
for (unsigned n = 0; n < 16; n++) // why 16 ?
{
- FChar temp[16];
- ConvertUInt32ToString(n, temp);
- FString name = FTEXT("PhysicalDrive");
- name += temp;
- FString fullPath = kVolPrefix;
+ FString name ("PhysicalDrive");
+ name.Add_UInt32(n);
+
+ FString fullPath (kVolPrefix);
fullPath += name;
CFileInfo fi;
@@ -336,7 +337,7 @@ STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, Int32 *iconIndex)
void CFSDrives::AddExt(FString &s, unsigned index) const
{
- s += FTEXT('.');
+ s += '.';
const CDriveInfo &di = _drives[index];
const char *ext;
if (di.DriveType == DRIVE_CDROM)
@@ -347,7 +348,7 @@ void CFSDrives::AddExt(FString &s, unsigned index) const
ext = "fat";
else
ext = "img";
- s.AddAscii(ext);
+ s += ext;
}
HRESULT CFSDrives::GetFileSize(unsigned index, UInt64 &fileSize) const
diff --git a/CPP/7zip/UI/FileManager/FSFolder.cpp b/CPP/7zip/UI/FileManager/FSFolder.cpp
index e46afb9e..94cd04cb 100644
--- a/CPP/7zip/UI/FileManager/FSFolder.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolder.cpp
@@ -73,6 +73,8 @@ HRESULT CFSFolder::Init(const FString &path /* , IFolderFolder *parentFolder */)
// _parentFolder = parentFolder;
_path = path;
+ #ifdef _WIN32
+
_findChangeNotification.FindFirst(_path, false,
FILE_NOTIFY_CHANGE_FILE_NAME
| FILE_NOTIFY_CHANGE_DIR_NAME
@@ -85,17 +87,24 @@ HRESULT CFSFolder::Init(const FString &path /* , IFolderFolder *parentFolder */)
| FILE_NOTIFY_CHANGE_SECURITY
*/
);
+
if (!_findChangeNotification.IsHandleAllocated())
{
DWORD lastError = GetLastError();
CFindFile findFile;
CFileInfo fi;
- if (!findFile.FindFirst(_path + FCHAR_ANY_MASK, fi))
+ FString path2 = _path;
+ path2 += '*'; // CHAR_ANY_MASK;
+ if (!findFile.FindFirst(path2, fi))
return lastError;
}
+
+ #endif
+
return S_OK;
}
+
HRESULT CFsFolderStat::Enumerate()
{
if (Progress)
@@ -103,9 +112,9 @@ HRESULT CFsFolderStat::Enumerate()
RINOK(Progress->SetCompleted(NULL));
}
Path.Add_PathSepar();
- unsigned len = Path.Len();
- Path += FCHAR_ANY_MASK;
- CEnumerator enumerator(Path);
+ const unsigned len = Path.Len();
+ CEnumerator enumerator;
+ enumerator.SetDirPrefix(Path);
CFileInfo fi;
while (enumerator.Next(fi))
{
@@ -164,7 +173,8 @@ HRESULT CFSFolder::LoadSubItems(int dirItem, const FString &relPrefix)
{
unsigned startIndex = Folders.Size();
{
- CEnumerator enumerator(_path + relPrefix + FCHAR_ANY_MASK);
+ CEnumerator enumerator;
+ enumerator.SetDirPrefix(_path + relPrefix);
CDirItem fi;
fi.FolderStat_Defined = false;
fi.NumFolders = 0;
@@ -267,7 +277,7 @@ STDMETHODIMP CFSFolder::LoadItems()
return S_OK;
}
-static CFSTR kDescriptionFileName = FTEXT("descript.ion");
+static CFSTR const kDescriptionFileName = FTEXT("descript.ion");
bool CFSFolder::LoadComments()
{
@@ -389,6 +399,7 @@ bool CFSFolder::ReadFileInfo(CDirItem &di)
{
di.FileInfo_WasRequested = true;
BY_HANDLE_FILE_INFORMATION info;
+ memset(&info, 0, sizeof(info)); // for vc6-O2
if (!NIO::CFileBase::GetFileInformation(_path + GetRelPath(di), &info))
return false;
di.NumLinks = info.nNumberOfLinks;
@@ -744,8 +755,6 @@ STDMETHODIMP CFSFolder::BindToFolder(const wchar_t *name, IFolderFolder **result
return BindToFolderSpec(us2fs(name), resultFolder);
}
-static const CFSTR kSuperPrefix = FTEXT("\\\\?\\");
-
STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
*resultFolder = 0;
@@ -759,43 +768,39 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
*/
if (_path.IsEmpty())
return E_INVALIDARG;
- int pos = _path.ReverseFind_PathSepar();
- if (pos < 0 || pos != (int)_path.Len() - 1)
- return E_FAIL;
- FString parentPath = _path.Left(pos);
- pos = parentPath.ReverseFind_PathSepar();
- if (pos < 0)
+
+ #ifndef UNDER_CE
+
+ if (IsDriveRootPath_SuperAllowed(_path))
{
- #ifdef UNDER_CE
- *resultFolder = 0;
- #else
CFSDrives *drivesFolderSpec = new CFSDrives;
CMyComPtr<IFolderFolder> drivesFolder = drivesFolderSpec;
- drivesFolderSpec->Init();
+ drivesFolderSpec->Init(false, IsSuperPath(_path));
*resultFolder = drivesFolder.Detach();
- #endif
return S_OK;
}
- /*
+ int pos = _path.ReverseFind_PathSepar();
+ if (pos < 0 || pos != (int)_path.Len() - 1)
+ return E_FAIL;
+ FString parentPath = _path.Left(pos);
+ pos = parentPath.ReverseFind_PathSepar();
parentPath.DeleteFrom(pos + 1);
-
- if (parentPath == kSuperPrefix)
+
+ if (NName::IsDrivePath_SuperAllowed(parentPath))
{
- #ifdef UNDER_CE
- *resultFolder = 0;
- #else
- CFSDrives *drivesFolderSpec = new CFSDrives;
- CMyComPtr<IFolderFolder> drivesFolder = drivesFolderSpec;
- drivesFolderSpec->Init(false, true);
- *resultFolder = drivesFolder.Detach();
- #endif
- return S_OK;
+ CFSFolder *parentFolderSpec = new CFSFolder;
+ CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
+ if (parentFolderSpec->Init(parentPath) == S_OK)
+ {
+ *resultFolder = parentFolder.Detach();
+ return S_OK;
+ }
}
-
+
+ /*
FString parentPathReduced = parentPath.Left(pos);
- #ifndef UNDER_CE
pos = parentPathReduced.ReverseFind_PathSepar();
if (pos == 1)
{
@@ -807,13 +812,10 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
*resultFolder = netFolder.Detach();
return S_OK;
}
- #endif
-
- CFSFolder *parentFolderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
- RINOK(parentFolderSpec->Init(parentPath, 0));
- *resultFolder = parentFolder.Detach();
*/
+
+ #endif
+
return S_OK;
}
@@ -844,24 +846,22 @@ STDMETHODIMP CFSFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
STDMETHODIMP CFSFolder::WasChanged(Int32 *wasChanged)
{
bool wasChangedMain = false;
+
+ #ifdef _WIN32
+
for (;;)
{
if (!_findChangeNotification.IsHandleAllocated())
- {
- *wasChanged = BoolToInt(false);
- return S_OK;
- }
-
+ break;
DWORD waitResult = ::WaitForSingleObject(_findChangeNotification, 0);
- bool wasChangedLoc = (waitResult == WAIT_OBJECT_0);
- if (wasChangedLoc)
- {
- _findChangeNotification.FindNext();
- wasChangedMain = true;
- }
- else
+ if (waitResult != WAIT_OBJECT_0)
break;
+ _findChangeNotification.FindNext();
+ wasChangedMain = true;
}
+
+ #endif
+
*wasChanged = BoolToInt(wasChangedMain);
return S_OK;
}
diff --git a/CPP/7zip/UI/FileManager/FSFolder.h b/CPP/7zip/UI/FileManager/FSFolder.h
index 057ba14c..4cbace52 100644
--- a/CPP/7zip/UI/FileManager/FSFolder.h
+++ b/CPP/7zip/UI/FileManager/FSFolder.h
@@ -142,7 +142,9 @@ private:
// bool _scanAltStreams;
bool _flatMode;
+ #ifdef _WIN32
NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
+ #endif
HRESULT GetItemsFullSize(const UInt32 *indices, UInt32 numItems, CFsFolderStat &stat);
@@ -161,7 +163,7 @@ private:
public:
HRESULT Init(const FString &path /* , IFolderFolder *parentFolder */);
#if !defined(_WIN32) || defined(UNDER_CE)
- HRESULT InitToRoot() { return Init(FSTRING_PATH_SEPARATOR /* , NULL */); }
+ HRESULT InitToRoot() { return Init((FString) FSTRING_PATH_SEPARATOR /* , NULL */); }
#endif
CFSFolder() : _flatMode(false)
diff --git a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
index c91deb07..fa728b47 100644
--- a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
@@ -75,7 +75,7 @@ HRESULT CCopyStateIO::MyCopyFile(CFSTR inPath, CFSTR outPath)
}
if (written != num)
{
- ErrorMessage = L"Write error";
+ ErrorMessage = "Write error";
return S_OK;
}
CurrentSize += num;
@@ -357,7 +357,7 @@ static HRESULT SendMessageError(IFolderOperationsExtractCallback *callback,
const wchar_t *message, const FString &fileName)
{
UString s = message;
- s += L" : ";
+ s += " : ";
s += fs2us(fileName);
return callback->ShowMessage(s);
}
@@ -514,7 +514,8 @@ static HRESULT CopyFolder(
return E_ABORT;
}
- CEnumerator enumerator(CombinePath(srcPath, FSTRING_ANY_MASK));
+ CEnumerator enumerator;
+ enumerator.SetDirPrefix(CombinePath(srcPath, FString()));
for (;;)
{
diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
index dc46ff5b..4e964628 100644
--- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
+++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
@@ -68,7 +68,7 @@ static void SplitNameToPureNameAndExtension(const FString &fullName,
else
{
pureName.SetFrom(fullName, index);
- extensionDelimiter = FTEXT('.');
+ extensionDelimiter = '.';
extension = fullName.Ptr(index + 1);
}
}
@@ -151,7 +151,7 @@ HRESULT OpenFileFolderPlugin(
UString progressTitle = LangString(IDS_OPENNING);
t.OpenCallbackSpec->ProgressDialog.MainWindow = parentWindow;
- t.OpenCallbackSpec->ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ t.OpenCallbackSpec->ProgressDialog.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
t.OpenCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + L' ';
t.OpenCallbackSpec->ProgressDialog.WaitMode = true;
diff --git a/CPP/7zip/UI/FileManager/FoldersPage.cpp b/CPP/7zip/UI/FileManager/FoldersPage.cpp
index 42662153..d019bab8 100644
--- a/CPP/7zip/UI/FileManager/FoldersPage.cpp
+++ b/CPP/7zip/UI/FileManager/FoldersPage.cpp
@@ -27,6 +27,8 @@ static const int kWorkModeButtons[] =
IDR_FOLDERS_WORK_SPECIFIED
};
+#define kFoldersTopic "fm/options.htm#folders"
+
static const unsigned kNumWorkModeButtons = ARRAY_SIZE(kWorkModeButtons);
bool CFoldersPage::OnInit()
@@ -158,9 +160,7 @@ LONG CFoldersPage::OnApply()
return PSNRET_NOERROR;
}
-static LPCWSTR kFoldersTopic = L"fm/options.htm#folders";
-
void CFoldersPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kFoldersTopic);
+ ShowHelpWindow(kFoldersTopic);
}
diff --git a/CPP/7zip/UI/FileManager/HelpUtils.cpp b/CPP/7zip/UI/FileManager/HelpUtils.cpp
index bae2365e..c0f57990 100644
--- a/CPP/7zip/UI/FileManager/HelpUtils.cpp
+++ b/CPP/7zip/UI/FileManager/HelpUtils.cpp
@@ -6,7 +6,7 @@
#if defined(UNDER_CE) || !defined(_WIN32)
-void ShowHelpWindow(HWND, LPCWSTR)
+void ShowHelpWindow(LPCSTR)
{
}
@@ -18,12 +18,15 @@ void ShowHelpWindow(HWND, LPCWSTR)
#include "../../../Windows/DLL.h"
-static LPCWSTR kHelpFileName = L"7-zip.chm::/";
+#define kHelpFileName "7-zip.chm::/"
-void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
+void ShowHelpWindow(LPCSTR topicFile)
{
FString path = NWindows::NDLL::GetModuleDirPrefix();
- HtmlHelp(hwnd, GetSystemString(fs2us(path) + kHelpFileName + topicFile), HH_DISPLAY_TOPIC, 0);
+ path += kHelpFileName;
+ path += topicFile;
+ // HWND hwnd = NULL;
+ HtmlHelp(NULL, GetSystemString(fs2us(path)), HH_DISPLAY_TOPIC, 0);
}
#endif
diff --git a/CPP/7zip/UI/FileManager/HelpUtils.h b/CPP/7zip/UI/FileManager/HelpUtils.h
index 52b1418a..90c5f7d1 100644
--- a/CPP/7zip/UI/FileManager/HelpUtils.h
+++ b/CPP/7zip/UI/FileManager/HelpUtils.h
@@ -5,6 +5,6 @@
#include "../../../Common/MyString.h"
-void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile);
+void ShowHelpWindow(LPCSTR topicFile);
#endif
diff --git a/CPP/7zip/UI/FileManager/LangPage.cpp b/CPP/7zip/UI/FileManager/LangPage.cpp
index cb1bbaab..47e7894c 100644
--- a/CPP/7zip/UI/FileManager/LangPage.cpp
+++ b/CPP/7zip/UI/FileManager/LangPage.cpp
@@ -20,13 +20,13 @@ static const UInt32 kLangIDs[] =
IDT_LANG_LANG
};
-static LPCWSTR kLangTopic = L"fm/options.htm#language";
+#define kLangTopic "fm/options.htm#language"
static void NativeLangString(UString &dest, const wchar_t *s)
{
- dest += L" (";
+ dest += " (";
dest += s;
- dest += L')';
+ dest += ')';
}
bool LangOpen(CLang &lang, CFSTR fileName);
@@ -45,7 +45,8 @@ bool CLangPage::OnInit()
_langCombo.SetCurSel(0);
const FString dirPrefix = GetLangDirPrefix();
- NFile::NFind::CEnumerator enumerator(dirPrefix + FTEXT("*.txt"));
+ NFile::NFind::CEnumerator enumerator;
+ enumerator.SetDirPrefix(dirPrefix);
NFile::NFind::CFileInfo fi;
CLang lang;
UString error;
@@ -54,12 +55,15 @@ bool CLangPage::OnInit()
{
if (fi.IsDir())
continue;
- const int kExtSize = 4;
+ const unsigned kExtSize = 4;
if (fi.Name.Len() < kExtSize)
continue;
- unsigned pos = fi.Name.Len() - kExtSize;
+ const unsigned pos = fi.Name.Len() - kExtSize;
if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".txt"))
+ {
+ // if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".ttt"))
continue;
+ }
if (!LangOpen(lang, dirPrefix + fi.Name))
{
@@ -101,7 +105,7 @@ LONG CLangPage::OnApply()
void CLangPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kLangTopic);
+ ShowHelpWindow(kLangTopic);
}
bool CLangPage::OnCommand(int code, int itemID, LPARAM param)
diff --git a/CPP/7zip/UI/FileManager/LangUtils.cpp b/CPP/7zip/UI/FileManager/LangUtils.cpp
index 761319b5..94e9ecba 100644
--- a/CPP/7zip/UI/FileManager/LangUtils.cpp
+++ b/CPP/7zip/UI/FileManager/LangUtils.cpp
@@ -25,7 +25,7 @@ static NSynchronization::CCriticalSection g_CriticalSection;
bool LangOpen(CLang &lang, CFSTR fileName)
{
- return lang.Open(fileName, L"7-Zip");
+ return lang.Open(fileName, "7-Zip");
}
FString GetLangDirPrefix()
@@ -94,7 +94,7 @@ void LangSetDlgItems_Colon(HWND dialog, const UInt32 *ids, unsigned numItems)
{
CWindow window(GetDlgItem(dialog, id));
UString s2 = s;
- s2 += L':';
+ s2 += ':';
window.SetText(s2);
}
}
@@ -139,7 +139,7 @@ void LangString_OnlyFromLangFile(UInt32 langID, UString &dest)
dest = s;
}
-static const char *kLangs =
+static const char * const kLangs =
"ar.bg.ca.zh.-tw.-cn.cs.da.de.el.en.es.fi.fr.he.hu.is."
"it.ja.ko.nl.no.=nb.=nn.pl.pt.-br.rm.ro.ru.sr.=hr.-spl.-spc.sk.sq.sv.th.tr."
"ur.id.uk.be.sl.et.lv.lt.tg.fa.vi.hy.az.eu.hsb.mk."
@@ -153,7 +153,7 @@ static const char *kLangs =
// ".gd."
;
-static void FindShortNames(UInt32 primeLang, UStringVector &names)
+static void FindShortNames(UInt32 primeLang, AStringVector &names)
{
UInt32 index = 0;
for (const char *p = kLangs; *p != 0;)
@@ -167,7 +167,7 @@ static void FindShortNames(UInt32 primeLang, UStringVector &names)
{
if (index > primeLang)
break;
- UString s;
+ AString s;
if (isSub)
{
if (p[0] == '-')
@@ -176,7 +176,7 @@ static void FindShortNames(UInt32 primeLang, UStringVector &names)
p++;
}
while (p != p2)
- s += (wchar_t)(Byte)*p++;
+ s += (char)(Byte)*p++;
names.Add(s);
}
p = p2 + 1;
@@ -195,7 +195,7 @@ static struct CC1Lang
UString s;
char ttt[32];
ConvertUInt32ToHex(i, ttt);
- s.AddAscii(ttt);
+ s += ttt;
UStringVector names;
FindShortNames(i, names);
@@ -238,18 +238,21 @@ static void OpenDefaultLang()
WORD primLang = (WORD)(PRIMARYLANGID(langID));
WORD subLang = (WORD)(SUBLANGID(langID));
{
- UStringVector names;
+ AStringVector names;
FindShortNames(primLang, names);
- const FString dirPrefix = GetLangDirPrefix();
+ const FString dirPrefix (GetLangDirPrefix());
for (unsigned i = 0; i < 2; i++)
{
unsigned index = (i == 0 ? subLang : 0);
if (index < names.Size())
{
- const UString &name = names[index];
+ const AString &name = names[index];
if (!name.IsEmpty())
{
- if (LangOpen(g_Lang, dirPrefix + us2fs(name) + FTEXT(".txt")))
+ FString path (dirPrefix);
+ path += name;
+ path += ".txt";
+ if (LangOpen(g_Lang, path))
{
g_LangID = name;
return;
@@ -280,7 +283,7 @@ void ReloadLang()
if (s.Find(FCHAR_PATH_SEPARATOR) < 0)
{
if (s.Find(FTEXT('.')) < 0)
- s += FTEXT(".txt");
+ s += ".txt";
s.Insert(0, GetLangDirPrefix());
}
LangOpen(g_Lang, s);
diff --git a/CPP/7zip/UI/FileManager/LinkDialog.cpp b/CPP/7zip/UI/FileManager/LinkDialog.cpp
index 2ef2da5b..ba21c0c7 100644
--- a/CPP/7zip/UI/FileManager/LinkDialog.cpp
+++ b/CPP/7zip/UI/FileManager/LinkDialog.cpp
@@ -108,11 +108,11 @@ bool CLinkDialog::OnInit()
UString s = attr.PrintName;
if (!attr.IsOkNamePair())
{
- s += L" : ";
+ s += " : ";
s += attr.SubsName;
}
if (!res)
- s = L"ERROR: " + s;
+ s.Insert(0, L"ERROR: ");
SetItemText(IDT_LINK_PATH_TO_CUR, s);
@@ -214,7 +214,7 @@ void CLinkDialog::OnButton_SetPath(bool to)
_pathToCombo :
_pathFromCombo;
combo.GetText(currentPath);
- // UString title = L"Specify a location for output folder";
+ // UString title = "Specify a location for output folder";
UString title = LangString(IDS_SET_FOLDER);
UString resultPath;
diff --git a/CPP/7zip/UI/FileManager/MenuPage.cpp b/CPP/7zip/UI/FileManager/MenuPage.cpp
index 8852ce35..4067ad75 100644
--- a/CPP/7zip/UI/FileManager/MenuPage.cpp
+++ b/CPP/7zip/UI/FileManager/MenuPage.cpp
@@ -35,7 +35,7 @@ static const UInt32 kLangIDs[] =
IDT_SYSTEM_CONTEXT_MENU_ITEMS
};
-static LPCWSTR kSystemTopic = L"fm/options.htm#sevenZip";
+#define kMenuTopic "fm/options.htm#sevenZip"
struct CContextMenuItem
{
@@ -71,6 +71,13 @@ static const CContextMenuItem kMenuItems[] =
extern bool g_Is_Wow64;
#endif
+#ifndef KEY_WOW64_64KEY
+ #define KEY_WOW64_64KEY (0x0100)
+#endif
+
+#ifndef KEY_WOW64_32KEY
+ #define KEY_WOW64_32KEY (0x0200)
+#endif
bool CMenuPage::OnInit()
{
@@ -95,14 +102,14 @@ bool CMenuPage::OnInit()
}
UString bit64 = LangString(IDS_PROP_BIT64);
if (bit64.IsEmpty())
- bit64.SetFromAscii("64-bit");
+ bit64 = "64-bit";
#ifdef _WIN64
bit64.Replace(L"64", L"32");
#endif
s.Add_Space();
- s += L'(';
+ s += '(';
s += bit64;
- s += L')';
+ s += ')';
SetItemText(IDX_SYSTEM_INTEGRATE_TO_MENU_2, s);
}
@@ -136,7 +143,7 @@ bool CMenuPage::OnInit()
FString &path = dll.Path;
path = prefix;
- path.AddAscii(d == 0 ? "7-zip.dll" :
+ path += (d == 0 ? "7-zip.dll" :
#ifdef _WIN64
"7-zip32.dll"
#else
@@ -180,10 +187,10 @@ bool CMenuPage::OnInit()
UString s = LangString(menuItem.ControlID);
if (menuItem.Flag == kCRC)
- s.SetFromAscii("CRC SHA");
+ s = "CRC SHA";
if (menuItem.Flag == kOpenAs ||
menuItem.Flag == kCRC)
- s.AddAscii(" >");
+ s += " >";
switch (menuItem.ControlID)
{
@@ -200,11 +207,11 @@ bool CMenuPage::OnInit()
{
case kCompressTo7z:
case kCompressTo7zEmail:
- s2.AddAscii(".7z");
+ s2 += (".7z");
break;
case kCompressToZip:
case kCompressToZipEmail:
- s2.AddAscii(".zip");
+ s2 += (".zip");
break;
}
s = MyFormatNew(s, s2);
@@ -286,7 +293,7 @@ LONG CMenuPage::OnApply()
void CMenuPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kSystemTopic);
+ ShowHelpWindow(kMenuTopic);
}
bool CMenuPage::OnButtonClicked(int buttonID, HWND buttonHWND)
diff --git a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
index d3031f5a..50104950 100644
--- a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
+++ b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include "../../../Windows/Menu.h"
+#include "../../../Windows/TimeUtils.h"
#include "../../../Windows/Control/Dialog.h"
#include "../../PropID.h"
@@ -22,10 +23,12 @@ using namespace NWindows;
static const UINT kOpenBookmarkMenuID = 830;
static const UINT kSetBookmarkMenuID = 810;
+static const UINT kMenuID_Time_Parent = 760;
+static const UINT kMenuID_Time = 761;
extern HINSTANCE g_hInstance;
-static LPCWSTR kFMHelpTopic = L"FM/index.htm";
+#define kFMHelpTopic "FM/index.htm"
extern void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance);
@@ -115,10 +118,12 @@ static UINT Get_fMask_for_FType_and_String()
static inline UINT Get_fMask_for_String() { return MIIM_TYPE; }
static inline UINT Get_fMask_for_FType_and_String() { return MIIM_TYPE; }
+
static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
{
CMenu menu;
menu.Attach(menuLoc);
+
for (int i = 0;; i++)
{
CMenuItem item;
@@ -137,7 +142,12 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
{
MyChangeMenu(item.hSubMenu, level + 1, i);
if (level == 1 && menuIndex == kMenuIndex_View)
- langID = kToolbarsLangID;
+ {
+ if (item.wID == kMenuID_Time_Parent || item.StringValue.IsPrefixedBy_Ascii_NoCase("20"))
+ continue;
+ else
+ langID = kToolbarsLangID;
+ }
else if (level == 0 && i < ARRAY_SIZE(kTopMenuLangIDs))
langID = kTopMenuLangIDs[i];
else
@@ -168,7 +178,18 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
int tabPos = newString.Find(L"\t");
if (tabPos >= 0)
newString.DeleteFrom(tabPos);
- newString += (langID == IDM_OPEN_INSIDE_ONE ? L" *" : L" #");
+ newString += (langID == IDM_OPEN_INSIDE_ONE ? " *" : " #");
+ }
+ else if (langID == IDM_BENCHMARK2)
+ {
+ LangString_OnlyFromLangFile(IDM_BENCHMARK, newString);
+ if (newString.IsEmpty())
+ continue;
+ newString.Replace(L"&", L"");
+ int tabPos = newString.Find(L"\t");
+ if (tabPos >= 0)
+ newString.DeleteFrom(tabPos);
+ newString += " 2";
}
else
LangString_OnlyFromLangFile(langID, newString);
@@ -245,6 +266,8 @@ void MyLoadMenu()
::DestroyMenu(oldMenu);
/* BOOL b = */ g_App._commandBar.InsertMenubar(g_hInstance, IDM_MENU, 0);
baseMenu = g_App._commandBar.GetMenu(0);
+ // if (startInit)
+ // SetIdsForSubMenes(baseMenu, 0, 0);
if (!g_LangID.IsEmpty())
MyChangeMenu(baseMenu, 0, 0);
g_App._commandBar.DrawMenuBar(0);
@@ -256,6 +279,8 @@ void MyLoadMenu()
::SetMenu(hWnd, ::LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_MENU)));
::DestroyMenu(oldMenu);
baseMenu = ::GetMenu(hWnd);
+ // if (startInit)
+ // SetIdsForSubMenes(baseMenu, 0, 0);
if (!g_LangID.IsEmpty())
MyChangeMenu(baseMenu, 0, 0);
::DrawMenuBar(hWnd);
@@ -277,8 +302,10 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
::GetMenu(g_HWND)
#endif
;
+
if (::GetSubMenu(mainMenu, position) != hMenu)
return;
+
if (position == kMenuIndex_File)
{
CMenu menu;
@@ -316,6 +343,72 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
menu.CheckItemByID(IDM_VIEW_AUTO_REFRESH, g_App.Get_AutoRefresh_Mode());
// menu.CheckItemByID(IDM_VIEW_SHOW_STREAMS, g_App.Get_ShowNtfsStrems_Mode());
// menu.CheckItemByID(IDM_VIEW_SHOW_DELETED, g_App.ShowDeletedFiles);
+
+ for (int i = 0;; i++)
+ {
+ CMenuItem item;
+ item.fMask = Get_fMask_for_String() | MIIM_SUBMENU | MIIM_ID;
+ item.fType = MFT_STRING;
+ if (!menu.GetItem(i, true, item))
+ break;
+ if (item.hSubMenu && (item.wID == kMenuID_Time_Parent
+ || item.StringValue.IsPrefixedBy_Ascii_NoCase("20")
+ ))
+ {
+ FILETIME ft;
+ NTime::GetCurUtcFileTime(ft);
+
+ {
+ wchar_t s[64];
+ s[0] = 0;
+ if (ConvertUtcFileTimeToString(ft, s, kTimestampPrintLevel_DAY))
+ item.StringValue = s;
+ }
+
+ item.fMask = Get_fMask_for_String() | MIIM_ID;
+ item.fType = MFT_STRING;
+ item.wID = kMenuID_Time_Parent;
+ menu.SetItem(i, true, item);
+
+ CMenu subMenu;
+ subMenu.Attach(menu.GetSubMenu(i));
+ subMenu.RemoveAllItems();
+
+ const int k_TimeLevels[] =
+ {
+ kTimestampPrintLevel_DAY,
+ kTimestampPrintLevel_MIN,
+ kTimestampPrintLevel_SEC,
+ // 1,2,3,4,5,6,
+ kTimestampPrintLevel_NTFS
+ };
+
+ unsigned last = kMenuID_Time;
+ unsigned selectedCommand = 0;
+ g_App._timestampLevels.Clear();
+ unsigned id = kMenuID_Time;
+
+ for (unsigned k = 0; k < ARRAY_SIZE(k_TimeLevels); k++)
+ {
+ wchar_t s[64];
+ s[0] = 0;
+ int timestampLevel = k_TimeLevels[k];
+ if (ConvertUtcFileTimeToString(ft, s, timestampLevel))
+ {
+ if (subMenu.AppendItem(MF_STRING, id, s))
+ {
+ last = id;
+ g_App._timestampLevels.Add(timestampLevel);
+ if (g_App.GetTimestampLevel() == timestampLevel)
+ selectedCommand = id;
+ id++;
+ }
+ }
+ }
+ if (selectedCommand != 0)
+ menu.CheckRadioItem(kMenuID_Time, last, selectedCommand, MF_BYCOMMAND);
+ }
+ }
}
else if (position == kMenuIndex_Bookmarks)
{
@@ -331,9 +424,9 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
{
UString s = LangString(IDS_BOOKMARK);
s.Add_Space();
- wchar_t c = (wchar_t)(L'0' + i);
+ char c = (char)(L'0' + i);
s += c;
- s.AddAscii("\tAlt+Shift+");
+ s += "\tAlt+Shift+";
s += c;
subMenu.AppendItem(MF_STRING, kSetBookmarkMenuID + i, s);
}
@@ -351,9 +444,9 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
s.Insert(kFirstPartSize, L" ... ");
}
if (s.IsEmpty())
- s = L'-';
- s.AddAscii("\tAlt+");
- s += (wchar_t)(L'0' + i);
+ s = '-';
+ s += "\tAlt+";
+ s += (char)('0' + i);
menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
}
}
@@ -398,6 +491,15 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
if (item.wID == IDM_OPEN_INSIDE_ONE || item.wID == IDM_OPEN_INSIDE_PARSER)
{
// We use diff as "super mode" marker for additional commands.
+ /*
+ if (diffPath.IsEmpty())
+ continue;
+ */
+ }
+
+ if (item.wID == IDM_BENCHMARK2)
+ {
+ // We use diff as "super mode" marker for additional commands.
if (diffPath.IsEmpty())
continue;
}
@@ -473,11 +575,11 @@ bool ExecuteFileCommand(int id)
case IDM_MOVE_TO: g_App.MoveTo(); break;
case IDM_DELETE: g_App.Delete(!IsKeyDown(VK_SHIFT)); break;
- case IDM_HASH_ALL: g_App.CalculateCrc(L"*"); break;
- case IDM_CRC32: g_App.CalculateCrc(L"CRC32"); break;
- case IDM_CRC64: g_App.CalculateCrc(L"CRC64"); break;
- case IDM_SHA1: g_App.CalculateCrc(L"SHA1"); break;
- case IDM_SHA256: g_App.CalculateCrc(L"SHA256"); break;
+ case IDM_HASH_ALL: g_App.CalculateCrc("*"); break;
+ case IDM_CRC32: g_App.CalculateCrc("CRC32"); break;
+ case IDM_CRC64: g_App.CalculateCrc("CRC64"); break;
+ case IDM_SHA1: g_App.CalculateCrc("SHA1"); break;
+ case IDM_SHA256: g_App.CalculateCrc("SHA256"); break;
case IDM_DIFF: g_App.DiffFiles(); break;
case IDM_SPLIT: g_App.Split(); break;
@@ -614,7 +716,7 @@ bool OnMenuCommand(HWND hWnd, int id)
// Help
case IDM_HELP_CONTENTS:
- ShowHelpWindow(NULL, kFMHelpTopic);
+ ShowHelpWindow(kFMHelpTopic);
break;
case IDM_ABOUT:
{
@@ -634,6 +736,12 @@ bool OnMenuCommand(HWND hWnd, int id)
g_App.SetBookmark(id - kSetBookmarkMenuID);
return true;
}
+ else if (id >= kMenuID_Time && (unsigned)id <= kMenuID_Time + g_App._timestampLevels.Size())
+ {
+ unsigned index = id - kMenuID_Time;
+ g_App.SetTimestampLevel(g_App._timestampLevels[index]);
+ return true;
+ }
return false;
}
}
diff --git a/CPP/7zip/UI/FileManager/NetFolder.cpp b/CPP/7zip/UI/FileManager/NetFolder.cpp
index 112f8c06..a941e73d 100644
--- a/CPP/7zip/UI/FileManager/NetFolder.cpp
+++ b/CPP/7zip/UI/FileManager/NetFolder.cpp
@@ -232,7 +232,7 @@ STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
CNetFolder *netFolder = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolder;
- netFolder->Init(&resourceParent, 0, WCHAR_PATH_SEPARATOR);
+ netFolder->Init(&resourceParent, 0, WSTRING_PATH_SEPARATOR);
*resultFolder = subFolder.Detach();
}
return S_OK;
diff --git a/CPP/7zip/UI/FileManager/OpenCallback.cpp b/CPP/7zip/UI/FileManager/OpenCallback.cpp
index 331b171b..bf7abfb7 100644
--- a/CPP/7zip/UI/FileManager/OpenCallback.cpp
+++ b/CPP/7zip/UI/FileManager/OpenCallback.cpp
@@ -22,10 +22,10 @@ STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64
RINOK(ProgressDialog.Sync.CheckStop());
{
// NSynchronization::CCriticalSectionLock lock(_criticalSection);
- if (numFiles)
+ ProgressDialog.Sync.Set_NumFilesTotal(numFiles ? *numFiles : (UInt64)(Int64)-1);
+ // if (numFiles)
{
- ProgressDialog.Sync.Set_NumFilesTotal(*numFiles);
- ProgressDialog.Sync.Set_BytesProgressMode(false);
+ ProgressDialog.Sync.Set_BytesProgressMode(numFiles == NULL);
}
if (numBytes)
ProgressDialog.Sync.Set_NumBytesTotal(*numBytes);
diff --git a/CPP/7zip/UI/FileManager/OverwriteDialog.cpp b/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
index c6feb902..1c029132 100644
--- a/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
+++ b/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
@@ -40,6 +40,12 @@ void COverwriteDialog::ReduceString(UString &s)
s.Delete(size / 2, s.Len() - size);
s.Insert(size / 2, L" ... ");
}
+ if (!s.IsEmpty() && s.Back() == ' ')
+ {
+ // s += (wchar_t)(0x2423);
+ s.InsertAtFront(L'\"');
+ s += L'\"';
+ }
}
void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
@@ -66,13 +72,10 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
if (fileInfo.TimeIsDefined)
{
- FILETIME localFileTime;
- if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
- throw 4190402;
AddLangString(s, IDS_PROP_MTIME);
- s += L": ";
- wchar_t t[32];
- ConvertFileTimeToString(localFileTime, t);
+ s += ": ";
+ char t[32];
+ ConvertUtcFileTimeToString(fileInfo.Time, t);
s += t;
}
diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp
index 5e3ec8ef..6a067acb 100644
--- a/CPP/7zip/UI/FileManager/Panel.cpp
+++ b/CPP/7zip/UI/FileManager/Panel.cpp
@@ -68,7 +68,7 @@ HWND CPanel::GetParent()
return (h == 0) ? _mainWindow : h;
}
-static LPCWSTR kClassName = L"7-Zip::Panel";
+#define kClassName L"7-Zip::Panel"
HRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
@@ -933,7 +933,7 @@ void CPanel::ExtractArchives()
if (indices.Size() == 1)
outFolder += GetSubFolderNameForExtract2(GetItemRelPath(indices[0]));
else
- outFolder += L'*';
+ outFolder += '*';
outFolder.Add_PathSepar();
::ExtractArchives(paths, outFolder
@@ -947,9 +947,9 @@ static void AddValuePair(UINT resourceID, UInt64 value, UString &s)
{
AddLangString(s, resourceID);
char sz[32];
- s += L": ";
+ s += ": ";
ConvertUInt64ToString(value, sz);
- s.AddAsciiStr(sz);
+ s += sz;
s.Add_LF();
}
*/
@@ -999,11 +999,11 @@ static void AddSizePair(UInt32 langID, UInt64 value, UString &s)
AddLangString(s, langID);
s += L' ';
ConvertUInt64ToString(value, sz);
- s.AddAsciiStr(sz);
+ s += sz;
ConvertUInt64ToString(value >> 20, sz);
- s.AddAsciiStr(" (");
- s.AddAsciiStr(sz);
- s.AddAsciiStr(" MB)");
+ s += " (";
+ s += sz;
+ s += " MB)";
s.Add_LF();
}
*/
@@ -1051,11 +1051,10 @@ void CPanel::TestArchives()
extracter.Indices = indices;
UString title = LangString(IDS_PROGRESS_TESTING);
- UString progressWindowTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
extracter.ProgressDialog.CompressingMode = false;
extracter.ProgressDialog.MainWindow = GetParent();
- extracter.ProgressDialog.MainTitle = progressWindowTitle;
+ extracter.ProgressDialog.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
extracter.ProgressDialog.MainAddTitle = title + L' ';
extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
diff --git a/CPP/7zip/UI/FileManager/Panel.h b/CPP/7zip/UI/FileManager/Panel.h
index 0110ee9d..6402ec2c 100644
--- a/CPP/7zip/UI/FileManager/Panel.h
+++ b/CPP/7zip/UI/FileManager/Panel.h
@@ -17,6 +17,7 @@
#include "../../../Windows/FileFind.h"
#include "../../../Windows/FileName.h"
#include "../../../Windows/Handle.h"
+#include "../../../Windows/PropVariantConv.h"
#include "../../../Windows/Synchronization.h"
#include "../../../Windows/Control/ComboBox.h"
@@ -373,6 +374,16 @@ public:
// CUIntVector _realIndices;
bool _enableItemChangeNotify;
bool _mySelectMode;
+
+ int _timestampLevel;
+
+
+ void RedrawListItems()
+ {
+ _listView.RedrawAllItems();
+ }
+
+
CBoolVector _selectedStatusVector;
CSelectedState _selectedState;
@@ -466,6 +477,7 @@ public:
UString GetItemRelPath(int itemIndex) const;
UString GetItemRelPath2(int itemIndex) const;
UString GetItemFullPath(int itemIndex) const;
+ UInt64 GetItem_UInt64Prop(int itemIndex, PROPID propID) const;
UInt64 GetItemSize(int itemIndex) const;
////////////////////////
@@ -487,6 +499,7 @@ public:
void CloseOpenFolders();
void OpenRootFolder();
+ UString GetParentDirPrefix() const;
HRESULT Create(HWND mainWindow, HWND parentWindow,
UINT id,
@@ -526,7 +539,9 @@ public:
_thereAreDeletedItems(false),
_markDeletedItems(true),
_enableItemChangeNotify(true),
- _dontShowMode(false)
+ _dontShowMode(false),
+
+ _timestampLevel(kTimestampPrintLevel_MIN)
{}
void SetExtendedStyle()
diff --git a/CPP/7zip/UI/FileManager/PanelCopy.cpp b/CPP/7zip/UI/FileManager/PanelCopy.cpp
index fb418963..a64b4a90 100644
--- a/CPP/7zip/UI/FileManager/PanelCopy.cpp
+++ b/CPP/7zip/UI/FileManager/PanelCopy.cpp
@@ -183,7 +183,7 @@ HRESULT CPanel::CopyTo(CCopyToOptions &options, const CRecordVector<UInt32> &ind
title = LangString(titleID);
}
- UString progressWindowTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ UString progressWindowTitle ("7-Zip"); // LangString(IDS_APP_TITLE);
extracter.ProgressDialog.MainWindow = GetParent();
extracter.ProgressDialog.MainTitle = progressWindowTitle;
@@ -248,9 +248,12 @@ struct CThreadUpdate
}
};
+
HRESULT CPanel::CopyFrom(bool moveMode, const UString &folderPrefix, const UStringVector &filePaths,
bool showErrorMessages, UStringVector *messages)
{
+ // CDisableNotify disableNotify(*this);
+
HRESULT res;
if (!_folderOperations)
res = E_NOINTERFACE;
@@ -265,7 +268,7 @@ HRESULT CPanel::CopyFrom(bool moveMode, const UString &folderPrefix, const UStri
updater.UpdateCallbackSpec->ProgressDialog = &updater.ProgressDialog;
UString title = LangString(IDS_COPYING);
- UString progressWindowTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ UString progressWindowTitle ("7-Zip"); // LangString(IDS_APP_TITLE);
updater.ProgressDialog.MainWindow = GetParent();
updater.ProgressDialog.MainTitle = progressWindowTitle;
@@ -321,10 +324,10 @@ void CPanel::CopyFromNoAsk(const UStringVector &filePaths)
CSelectedState srcSelState;
SaveSelectedState(srcSelState);
- HRESULT result = CopyFrom(false, L"", filePaths, true, 0);
-
CDisableNotify disableNotify(*this);
+ HRESULT result = CopyFrom(false, L"", filePaths, true, 0);
+
if (result != S_OK)
{
disableNotify.Restore();
@@ -345,9 +348,9 @@ void CPanel::CopyFromAsk(const UStringVector &filePaths)
{
UString title = LangString(IDS_CONFIRM_FILE_COPY);
UString message = LangString(IDS_WANT_TO_COPY_FILES);
- message += L"\n\'";
+ message += "\n\'";
message += _currentFolderPrefix;
- message += L"\' ?";
+ message += "\' ?";
int res = ::MessageBoxW(*(this), message, title, MB_YESNOCANCEL | MB_ICONQUESTION);
if (res != IDYES)
return;
diff --git a/CPP/7zip/UI/FileManager/PanelCrc.cpp b/CPP/7zip/UI/FileManager/PanelCrc.cpp
index c9697e8b..8500a9a5 100644
--- a/CPP/7zip/UI/FileManager/PanelCrc.cpp
+++ b/CPP/7zip/UI/FileManager/PanelCrc.cpp
@@ -128,14 +128,15 @@ DWORD CDirEnumerator::GetNextFile(NFind::CFileInfo &fi, bool &filled, FString &r
FString s = resPath;
s.Add_PathSepar();
Prefixes.Add(s);
- s += FCHAR_ANY_MASK;
- Enumerators.Add(NFind::CEnumerator(BasePrefix + s));
+ Enumerators.AddNew().SetDirPrefix(BasePrefix + s);
}
filled = true;
return S_OK;
}
+
+
class CThreadCrc: public CProgressThreadVirt
{
HRESULT ProcessVirt();
@@ -364,7 +365,7 @@ HRESULT CApp::CalculateCrc2(const UString &methodName)
UString title = LangString(IDS_CHECKSUM_CALCULATING);
t.ProgressDialog.MainWindow = _window;
- t.ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ t.ProgressDialog.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
t.ProgressDialog.MainAddTitle = title;
t.ProgressDialog.MainAddTitle.Add_Space();
@@ -374,9 +375,9 @@ HRESULT CApp::CalculateCrc2(const UString &methodName)
return S_OK;
}
-void CApp::CalculateCrc(const UString &methodName)
+void CApp::CalculateCrc(const char *methodName)
{
- HRESULT res = CalculateCrc2(methodName);
+ HRESULT res = CalculateCrc2(UString(methodName));
if (res != S_OK && res != E_ABORT)
{
unsigned srcPanelIndex = GetFocusedPanelIndex();
diff --git a/CPP/7zip/UI/FileManager/PanelDrag.cpp b/CPP/7zip/UI/FileManager/PanelDrag.cpp
index ff16f24e..bdfccbb3 100644
--- a/CPP/7zip/UI/FileManager/PanelDrag.cpp
+++ b/CPP/7zip/UI/FileManager/PanelDrag.cpp
@@ -31,8 +31,9 @@ using namespace NDir;
extern bool g_IsNT;
#endif
-static CFSTR kTempDirPrefix = FTEXT("7zE");
-static LPCTSTR kSvenZipSetFolderFormat = TEXT("7-Zip::SetTargetFolder");
+#define kTempDirPrefix FTEXT("7zE")
+
+static LPCTSTR const kSvenZipSetFolderFormat = TEXT("7-Zip::SetTargetFolder");
////////////////////////////////////////////////////////
@@ -619,7 +620,10 @@ bool CDropTarget::IsItSameDrive() const
return false;
}
else if (m_Panel->IsFSDrivesFolder() && m_SelectionIndex >= 0)
- drive = m_SubFolderName + WCHAR_PATH_SEPARATOR;
+ {
+ drive = m_SubFolderName;
+ drive.Add_PathSepar();
+ }
else
return false;
diff --git a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
index 5a59d056..fad29cf1 100644
--- a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
+++ b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
@@ -67,6 +67,12 @@ void CPanel::SetToRootFolder()
rootFolderSpec->Init();
}
+
+static bool DoesNameContainWildcard_SkipRoot(const UString &path)
+{
+ return DoesNameContainWildcard(path.Ptr(NName::GetRootPrefixSize(path)));
+}
+
HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted)
{
UString path = fullPath;
@@ -178,11 +184,11 @@ HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bo
else if (fileInfo.IsDir())
{
#ifdef _WIN32
- if (DoesNameContainWildcard(sysPath))
+ if (DoesNameContainWildcard_SkipRoot(sysPath))
{
FString dirPrefix, fileName;
NDir::GetFullPathAndSplit(us2fs(sysPath), dirPrefix, fileName);
- if (DoesNameContainWildcard(dirPrefix))
+ if (DoesNameContainWildcard_SkipRoot(fs2us(dirPrefix)))
return E_INVALIDARG;
sysPath = fs2us(dirPrefix + fileInfo.Name);
}
@@ -200,10 +206,10 @@ HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bo
HRESULT res = S_OK;
#ifdef _WIN32
- if (DoesNameContainWildcard(dirPrefix))
+ if (DoesNameContainWildcard_SkipRoot(fs2us(dirPrefix)))
return E_INVALIDARG;
- if (DoesNameContainWildcard(fileName))
+ if (DoesNameContainWildcard(fs2us(fileName)))
res = S_FALSE;
else
#endif
@@ -281,7 +287,17 @@ HRESULT CPanel::BindToPathAndRefresh(const UString &path)
CDisableTimerProcessing disableTimerProcessing(*this);
CDisableNotify disableNotify(*this);
bool archiveIsOpened, encrypted;
- HRESULT res = BindToPath(path, UString(), archiveIsOpened, encrypted);
+ UString s = path;
+
+ #ifdef _WIN32
+ if (!s.IsEmpty() && s[0] == '\"' && s.Back() == '\"')
+ {
+ s.DeleteBack();
+ s.Delete(0);
+ }
+ #endif
+
+ HRESULT res = BindToPath(s, UString(), archiveIsOpened, encrypted);
RefreshListCtrl(UString(), -1, true, UStringVector());
return res;
}
@@ -349,14 +365,14 @@ void CPanel::LoadFullPathAndShow()
#else
1
#endif
- && path.Back() == WCHAR_PATH_SEPARATOR)
+ && IS_PATH_SEPAR(path.Back()))
path.DeleteBack();
DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
// GetRealIconIndex is slow for direct DVD/UDF path. So we use dummy path
if (path.IsPrefixedBy(L"\\\\.\\"))
- path = L"_TestFolder_";
+ path = "_TestFolder_";
else
{
CFileInfo fi;
@@ -456,7 +472,7 @@ void CPanel::AddComboBoxItem(const UString &name, int iconIndex, int indent, boo
UString s;
iconIndex = iconIndex;
for (int i = 0; i < indent; i++)
- s += L" ";
+ s += " ";
_headerComboBox.AddString(s + name);
#else
@@ -631,6 +647,30 @@ void CPanel::FoldersHistory()
BindToPathAndRefresh(selectString);
}
+
+UString CPanel::GetParentDirPrefix() const
+{
+ UString s;
+ if (!_currentFolderPrefix.IsEmpty())
+ {
+ wchar_t c = _currentFolderPrefix.Back();
+ if (IS_PATH_SEPAR(c) || c == ':')
+ {
+ s = _currentFolderPrefix;
+ s.DeleteBack();
+ if (s != L"\\\\." &&
+ s != L"\\\\?")
+ {
+ int pos = s.ReverseFind_PathSepar();
+ if (pos >= 0)
+ s.DeleteFrom(pos + 1);
+ }
+ }
+ }
+ return s;
+}
+
+
void CPanel::OpenParentFolder()
{
LoadFullPath(); // Maybe we don't need it ??
@@ -641,12 +681,12 @@ void CPanel::OpenParentFolder()
if (!_currentFolderPrefix.IsEmpty())
{
wchar_t c = _currentFolderPrefix.Back();
- if (c == WCHAR_PATH_SEPARATOR || c == ':')
+ if (IS_PATH_SEPAR(c) || c == ':')
{
focusedName = _currentFolderPrefix;
focusedName.DeleteBack();
/*
- if (c == ':' && !focusedName.IsEmpty() && focusedName.Back() == WCHAR_PATH_SEPARATOR)
+ if (c == ':' && !focusedName.IsEmpty() && IS_PATH_SEPAR(focusedName.Back()))
{
focusedName.DeleteBack();
}
@@ -825,7 +865,7 @@ void CPanel::OpenAltStreams()
path.DeleteBack();
}
- path += L':';
+ path += ':';
BindToPathAndRefresh(path);
#endif
}
diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
index cfbc5770..795e74b7 100644
--- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
@@ -46,7 +46,7 @@ extern UInt64 g_RAM_Size;
extern bool g_IsNT;
#endif
-static CFSTR kTempDirPrefix = FTEXT("7zO");
+#define kTempDirPrefix FTEXT("7zO")
// #define SHOW_DEBUG_INFO
@@ -534,23 +534,23 @@ HRESULT CPanel::OpenAsArc(IInStream *inStream,
UString s2;
if (!values[3].IsEmpty())
{
- s2 = L"Can not open the file as [" + values[3] + L"] archive";
+ s2 = "Can not open the file as [" + values[3] + "] archive";
if (level2 != 0)
- s2 += L"\nThe file is open as [" + values[2] + L"] archive";
+ s2 += "\nThe file is open as [" + values[2] + "] archive";
}
if (!values[0].IsEmpty())
{
if (!s2.IsEmpty())
s2.Add_LF();
- s2 += L"[";
+ s2 += "[";
s2 += values[2];
- s2 += L"] Error: ";
+ s2 += "] Error: ";
s2 += values[0];
}
if (!s2.IsEmpty())
{
if (!s.IsEmpty())
- s += L"--------------------\n";
+ s += "--------------------\n";
s += values[1];
s.Add_LF();
s += s2;
@@ -587,7 +587,7 @@ HRESULT CPanel::OpenAsArc_Msg(IInStream *inStream,
if (showErrorMessage && encrypted)
{
- UString message = L"Error";
+ UString message("Error");
if (res == S_FALSE)
{
message = MyFormatNew(
@@ -663,11 +663,15 @@ HRESULT CPanel::OpenParentArchiveFolder()
}
-static const char *kStartExtensions =
+static const char * const kExeExtensions =
+ " exe bat ps1 com"
+ " ";
+
+static const char * const kStartExtensions =
#ifdef UNDER_CE
" cab"
#endif
- " exe bat com"
+ " exe bat ps1 com"
" chm"
" msi doc xls ppt pps wps wpt wks xlr wdb vsd pub"
@@ -718,6 +722,51 @@ static bool DoItemAlwaysStart(const UString &name)
UString GetQuotedString(const UString &s);
+
+void SplitCmdLineSmart(const UString &cmd, UString &prg, UString &params)
+{
+ params.Empty();
+ prg = cmd;
+ prg.Trim();
+ if (prg.Len() >= 2 && prg[0] == L'"')
+ {
+ int pos = prg.Find(L'"', 1);
+ if (pos >= 0)
+ {
+ if ((unsigned)pos + 1 == prg.Len() || prg[pos + 1] == ' ')
+ {
+ params = prg.Ptr(pos + 1);
+ params.Trim();
+ prg.DeleteFrom(pos);
+ prg.DeleteFrontal(1);
+ }
+ }
+ }
+}
+
+
+static WRes StartAppWithParams(const UString &cmd, const UStringVector &paramVector, CProcess &process)
+{
+ UString param;
+ UString prg;
+
+ SplitCmdLineSmart(cmd, prg, param);
+
+ param.Trim();
+
+ // int pos = params.Find(L"%1");
+
+ FOR_VECTOR (i, paramVector)
+ {
+ if (!param.IsEmpty() && param.Back() != ' ')
+ param.Add_Space();
+ param += GetQuotedString(paramVector[i]);
+ }
+
+ return process.Create(prg, param, NULL);
+}
+
+
static HRESULT StartEditApplication(const UString &path, bool useEditor, HWND window, CProcess &process)
{
UString command;
@@ -725,7 +774,7 @@ static HRESULT StartEditApplication(const UString &path, bool useEditor, HWND wi
if (command.IsEmpty())
{
#ifdef UNDER_CE
- command = L"\\Windows\\";
+ command = "\\Windows\\";
#else
FString winDir;
if (!GetWindowsDir(winDir))
@@ -733,15 +782,19 @@ static HRESULT StartEditApplication(const UString &path, bool useEditor, HWND wi
NName::NormalizeDirPathPrefix(winDir);
command = fs2us(winDir);
#endif
- command += L"notepad.exe";
+ command += "notepad.exe";
}
- HRESULT res = process.Create(command, GetQuotedString(path), NULL);
+ UStringVector params;
+ params.Add(path);
+
+ HRESULT res = StartAppWithParams(command, params, process);
if (res != SZ_OK)
::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR), L"7-Zip", MB_OK | MB_ICONSTOP);
return res;
}
+
void CApp::DiffFiles()
{
const CPanel &panel = GetFocusedPanel();
@@ -779,16 +832,21 @@ void CApp::DiffFiles()
if (command.IsEmpty())
return;
- UString param = GetQuotedString(path1);
- param.Add_Space();
- param += GetQuotedString(path2);
+ UStringVector params;
+ params.Add(path1);
+ params.Add(path2);
- HRESULT res = MyCreateProcess(command, param);
+ HRESULT res;
+ {
+ CProcess process;
+ res = StartAppWithParams(command, params, process);
+ }
if (res == SZ_OK)
return;
::MessageBoxW(_window, LangString(IDS_CANNOT_START_EDITOR), L"7-Zip", MB_OK | MB_ICONSTOP);
}
+
#ifndef _UNICODE
typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
#endif
@@ -802,7 +860,7 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
int dot = path2.ReverseFind_Dot();
int separ = path2.ReverseFind_PathSepar();
if (dot < 0 || dot < separ)
- path2 += L'.';
+ path2 += '.';
}
#endif
@@ -841,8 +899,8 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
- const CSysString sysPath = GetSystemString(path2);
- const CSysString sysDir = GetSystemString(dir);
+ const CSysString sysPath (GetSystemString(path2));
+ const CSysString sysDir (GetSystemString(dir));
execInfo.lpFile = sysPath;
execInfo.lpParameters = NULL;
execInfo.lpDirectory =
@@ -896,27 +954,36 @@ void CPanel::EditItem(int index, bool useEditor)
StartEditApplication(GetItemFullPath(index), useEditor, (HWND)*this, process);
}
+
void CPanel::OpenFolderExternal(int index)
{
- UString fsPrefix = GetFsPath();
- UString name;
+ UString prefix = GetFsPath();
+ UString path = prefix;
+
if (index == kParentIndex)
{
- int pos = fsPrefix.ReverseFind_PathSepar();
- if (pos >= 0 && pos == (int)fsPrefix.Len() - 1)
- {
- UString s = fsPrefix.Left(pos);
- pos = s.ReverseFind_PathSepar();
- if (pos >= 0)
- fsPrefix.SetFrom(s, pos + 1);
- }
- name = fsPrefix;
+ if (prefix.IsEmpty())
+ return;
+ const wchar_t c = prefix.Back();
+ if (!IS_PATH_SEPAR(c) && c != ':')
+ return;
+ prefix.DeleteBack();
+ int pos = prefix.ReverseFind_PathSepar();
+ if (pos < 0)
+ return;
+ prefix.DeleteFrom(pos + 1);
+ path = prefix;
}
else
- name = fsPrefix + GetItemRelPath(index) + WCHAR_PATH_SEPARATOR;
- StartApplicationDontWait(fsPrefix, name, (HWND)*this);
+ {
+ path += GetItemRelPath(index);
+ path.Add_PathSepar();
+ }
+
+ StartApplicationDontWait(prefix, path, (HWND)*this);
}
+
bool CPanel::IsVirus_Message(const UString &name)
{
UString name2;
@@ -928,12 +995,12 @@ bool CPanel::IsVirus_Message(const UString &name)
if (name2.Find(cRLO) >= 0)
{
- UString badString = cRLO;
+ const UString badString(cRLO);
name2.Replace(badString, L"[RLO]");
isVirus = true;
}
{
- const wchar_t *kVirusSpaces = L" ";
+ const wchar_t * const kVirusSpaces = L" ";
// const unsigned kNumSpaces = strlen(kVirusSpaces);
for (;;)
{
@@ -945,6 +1012,27 @@ bool CPanel::IsVirus_Message(const UString &name)
name2.Replace(kVirusSpaces, L" ");
}
}
+
+ #ifdef _WIN32
+ {
+ unsigned i;
+ for (i = name2.Len(); i != 0;)
+ {
+ wchar_t c = name2[i - 1];
+ if (c != '.' && c != ' ')
+ break;
+ i--;
+ name2.ReplaceOneCharAtPos(i, '_');
+ }
+ if (i != name2.Len())
+ {
+ UString name3 = name2;
+ name3.DeleteFrom(i);
+ if (FindExt(kExeExtensions, name3))
+ isVirus = true;
+ }
+ }
+ #endif
if (!isVirus)
return false;
@@ -983,8 +1071,9 @@ void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal, const wchar
CDisableTimerProcessing disableTimerProcessing(*this);
UString name = GetItemRelPath2(index);
- if (IsVirus_Message(name))
- return;
+ if (tryExternal)
+ if (IsVirus_Message(name))
+ return;
if (!_parentFolders.IsEmpty())
{
@@ -1330,7 +1419,7 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param)
#if defined(_WIN32) && !defined(UNDER_CE)
-static const FChar *k_ZoneId_StreamName = FTEXT(":Zone.Identifier");
+static const FChar * const k_ZoneId_StreamName = FTEXT(":Zone.Identifier");
#endif
@@ -1443,7 +1532,7 @@ HRESULT CBufSeqOutStream_WithFile::FlushToFile()
{
outFileStream.Release();
return E_FAIL;
- // MessageBoxMyError(UString(L"Can't create file ") + fs2us(tempFilePath));
+ // MessageBoxMyError(UString("Can't create file ") + fs2us(tempFilePath));
}
}
while (_fileWritePos != _pos)
@@ -1494,8 +1583,9 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
const UString name = GetItemName(index);
const UString relPath = GetItemRelPath(index);
- if (IsVirus_Message(name))
- return;
+ if (tryExternal)
+ if (IsVirus_Message(name))
+ return;
if (!_folderOperations)
{
diff --git a/CPP/7zip/UI/FileManager/PanelItems.cpp b/CPP/7zip/UI/FileManager/PanelItems.cpp
index 55981d6d..2f32a143 100644
--- a/CPP/7zip/UI/FileManager/PanelItems.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItems.cpp
@@ -532,7 +532,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
if (showDots)
{
- UString itemName = L"..";
+ UString itemName ("..");
item.iItem = listViewItemCount;
if (itemName == focusedName)
cursorIndex = item.iItem;
@@ -587,7 +587,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
unsigned prefixLen = 0;
_folderGetItemName->GetItemPrefix(i, &prefix, &prefixLen);
if (prefix)
- relPath += prefix;
+ relPath = prefix;
}
if (!prefix)
{
@@ -595,7 +595,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
if (_folder->GetProperty(i, kpidPrefix, &prop) != S_OK)
throw 2723400;
if (prop.vt == VT_BSTR)
- relPath += prop.bstrVal;
+ relPath.SetFromBstr(prop.bstrVal);
}
}
relPath += name;
@@ -637,7 +637,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
if (j < finish)
{
correctedName.Empty();
- correctedName = L"virus";
+ correctedName = "virus";
int pos = 0;
for (;;)
{
@@ -648,7 +648,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
break;
}
correctedName += itemName.Mid(pos, posNew - pos);
- correctedName += L" ... ";
+ correctedName += " ... ";
pos = posNew;
while (itemName[++pos] == ' ');
}
@@ -664,19 +664,6 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
LPSTR_TEXTCALLBACKW can be 2-3 times faster for loading in this loop. */
}
- UInt32 attrib = 0;
- // for (int yyy = 0; yyy < 6000000; yyy++) {
- NCOM::CPropVariant prop;
- RINOK(_folder->GetProperty(i, kpidAttrib, &prop));
- if (prop.vt == VT_UI4)
- {
- // char s[256]; sprintf(s, "attrib = %7x", attrib); OutputDebugStringA(s);
- attrib = prop.ulVal;
- }
- else if (IsItem_Folder(i))
- attrib |= FILE_ATTRIBUTE_DIRECTORY;
- // }
-
bool defined = false;
if (folderGetSystemIconIndex)
@@ -684,8 +671,19 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
folderGetSystemIconIndex->GetSystemIconIndex(i, &item.iImage);
defined = (item.iImage > 0);
}
+
if (!defined)
{
+ UInt32 attrib = 0;
+ {
+ NCOM::CPropVariant prop;
+ RINOK(_folder->GetProperty(i, kpidAttrib, &prop));
+ if (prop.vt == VT_UI4)
+ attrib = prop.ulVal;
+ }
+ if (IsItem_Folder(i))
+ attrib |= FILE_ATTRIBUTE_DIRECTORY;
+
if (_currentFolderPrefix.IsEmpty())
{
int iconIndexTemp;
@@ -993,7 +991,7 @@ void CPanel::GetItemName(int itemIndex, UString &s) const
{
if (itemIndex == kParentIndex)
{
- s = L"..";
+ s = "..";
return;
}
NCOM::CPropVariant prop;
@@ -1073,14 +1071,12 @@ bool CPanel::IsItem_AltStream(int itemIndex) const
return GetItem_BoolProp(itemIndex, kpidIsAltStream);
}
-UInt64 CPanel::GetItemSize(int itemIndex) const
+UInt64 CPanel::GetItem_UInt64Prop(int itemIndex, PROPID propID) const
{
if (itemIndex == kParentIndex)
return 0;
- if (_folderGetItemName)
- return _folderGetItemName->GetItemSize(itemIndex);
NCOM::CPropVariant prop;
- if (_folder->GetProperty(itemIndex, kpidSize, &prop) != S_OK)
+ if (_folder->GetProperty(itemIndex, propID, &prop) != S_OK)
throw 2723400;
UInt64 val = 0;
if (ConvertPropVariantToUInt64(prop, val))
@@ -1088,6 +1084,14 @@ UInt64 CPanel::GetItemSize(int itemIndex) const
return 0;
}
+UInt64 CPanel::GetItemSize(int itemIndex) const
+{
+ if (itemIndex == kParentIndex)
+ return 0;
+ if (_folderGetItemName)
+ return _folderGetItemName->GetItemSize(itemIndex);
+ return GetItem_UInt64Prop(itemIndex, kpidSize);
+}
void CPanel::SaveListViewInfo()
{
diff --git a/CPP/7zip/UI/FileManager/PanelKey.cpp b/CPP/7zip/UI/FileManager/PanelKey.cpp
index 26aa0b2f..5603251f 100644
--- a/CPP/7zip/UI/FileManager/PanelKey.cpp
+++ b/CPP/7zip/UI/FileManager/PanelKey.cpp
@@ -10,7 +10,7 @@
using namespace NWindows;
-// static LPCWSTR kHelpTopic = L"FM/index.htm";
+// #define kHelpTopic "FM/index.htm"
struct CVKeyPropIDPair
{
diff --git a/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
index cc84f712..d7785d12 100644
--- a/CPP/7zip/UI/FileManager/PanelListNotify.cpp
+++ b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
@@ -19,6 +19,18 @@
using namespace NWindows;
+/* Unicode characters for space:
+0x009C STRING TERMINATOR
+0x00B7 Middle dot
+0x237D Shouldered open box
+0x2420 Symbol for space
+0x2422 Blank symbol
+0x2423 Open box
+*/
+
+#define SPACE_REPLACE_CHAR (wchar_t)(0x2423)
+#define SPACE_TERMINATOR_CHAR (wchar_t)(0x9C)
+
#define INT_TO_STR_SPEC(v) \
while (v >= 10) { temp[i++] = (unsigned char)('0' + (unsigned)(v % 10)); v /= 10; } \
*s++ = (unsigned char)('0' + (unsigned)v);
@@ -42,7 +54,7 @@ static void ConvertSizeToString(UInt64 val, wchar_t *s) throw()
{
if (i != 0)
{
- *s++ = temp[i - 1];
+ *s++ = temp[(size_t)i - 1];
if (i == 2)
*s++ = temp[0];
}
@@ -62,9 +74,9 @@ static void ConvertSizeToString(UInt64 val, wchar_t *s) throw()
do
{
s[0] = ' ';
- s[1] = temp[i - 1];
- s[2] = temp[i - 2];
- s[3] = temp[i - 3];
+ s[1] = temp[(size_t)i - 1];
+ s[2] = temp[(size_t)i - 2];
+ s[3] = temp[(size_t)i - 3];
s += 4;
}
while (i -= 3);
@@ -337,17 +349,17 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
{
if (c != 0x202E) // RLO
continue;
- text[dest - 1] = '_';
+ text[(size_t)dest - 1] = '_';
continue;
}
- if (name[i + 1] != ' ')
+ if (name[i] != ' ')
continue;
- unsigned t = 2;
+ unsigned t = 1;
for (; name[i + t] == ' '; t++);
-
- if (t >= 4 && dest + 4 <= limit)
+
+ if (t >= 4 && dest + 4 < limit)
{
text[dest++] = '.';
text[dest++] = '.';
@@ -356,6 +368,20 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
i += t;
}
}
+
+ if (dest == 0)
+ text[dest++]= '_';
+
+ #ifdef _WIN32
+ else if (text[(size_t)dest - 1] == ' ')
+ {
+ if (dest < limit)
+ text[dest++] = SPACE_TERMINATOR_CHAR;
+ else
+ text[dest - 1] = SPACE_REPLACE_CHAR;
+ }
+ #endif
+
text[dest] = 0;
// OutputDebugStringW(text);
return 0;
@@ -392,7 +418,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
if (res != S_OK)
{
MyStringCopy(text, L"Error: ");
- // s = UString(L"Error: ") + HResultToMessage(res);
+ // s = UString("Error: ") + HResultToMessage(res);
}
else if ((prop.vt == VT_UI8 || prop.vt == VT_UI4 || prop.vt == VT_UI2) && IsSizeProp(propID))
{
@@ -418,7 +444,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
else
{
char temp[64];
- ConvertPropertyToShortString(temp, prop, propID, false);
+ ConvertPropertyToShortString2(temp, prop, propID, _timestampLevel);
unsigned i;
unsigned limit = item.cchTextMax - 1;
for (i = 0; i < limit; i++)
@@ -712,7 +738,7 @@ void CPanel::Refresh_StatusBar()
{
char dateString2[32];
dateString2[0] = 0;
- ConvertPropertyToShortString(dateString2, prop, kpidMTime, false);
+ ConvertPropertyToShortString2(dateString2, prop, kpidMTime);
for (unsigned i = 0;; i++)
{
char c = dateString2[i];
diff --git a/CPP/7zip/UI/FileManager/PanelMenu.cpp b/CPP/7zip/UI/FileManager/PanelMenu.cpp
index c5b07825..b3f3a6b6 100644
--- a/CPP/7zip/UI/FileManager/PanelMenu.cpp
+++ b/CPP/7zip/UI/FileManager/PanelMenu.cpp
@@ -14,6 +14,7 @@
#include "../Explorer/ContextMenu.h"
#include "App.h"
+#include "FormatUtils.h"
#include "LangUtils.h"
#include "MyLoadMenu.h"
#include "PropertyName.h"
@@ -49,9 +50,9 @@ void CPanel::InvokeSystemCommand(const char *command)
contextMenu->InvokeCommand(&ci);
}
-static const char *kSeparator = "----------------------------\n";
-static const char *kSeparatorSmall = "----\n";
-static const char *kPropValueSeparator = ": ";
+static const char * const kSeparator = "----------------------------\n";
+static const char * const kSeparatorSmall = "----\n";
+static const char * const kPropValueSeparator = ": ";
extern UString ConvertSizeToString(UInt64 value) throw();
bool IsSizeProp(UINT propID) throw();
@@ -82,12 +83,12 @@ static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
val = ConvertSizeToString(v);
}
else
- ConvertPropertyToString(val, prop, propID);
+ ConvertPropertyToString2(val, prop, propID);
if (!val.IsEmpty())
{
s += GetNameOfProperty(propID, nameBSTR);
- s.AddAscii(kPropValueSeparator);
+ s += kPropValueSeparator;
/*
if (propID == kpidComment)
s.Add_LF();
@@ -98,6 +99,14 @@ static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
}
}
+
+static void AddPropertyString(PROPID propID, UInt64 val, UString &s)
+{
+ NCOM::CPropVariant prop = val;
+ AddPropertyString(propID, NULL, prop, s);
+}
+
+
static inline char GetHex(Byte value)
{
return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
@@ -132,10 +141,11 @@ void CPanel::Properties()
CRecordVector<UInt32> operatedIndices;
GetOperatedItemIndices(operatedIndices);
+
if (operatedIndices.Size() == 1)
{
UInt32 index = operatedIndices[0];
- // message += L"Item:\n";
+ // message += "Item:\n");
UInt32 numProps;
if (_folder->GetNumberOfProperties(&numProps) == S_OK)
{
@@ -182,10 +192,8 @@ void CPanel::Properties()
const UInt32 kMaxDataSize = 64;
if (dataSize > kMaxDataSize)
{
- char temp[64];
s += "data:";
- ConvertUInt32ToString(dataSize, temp);
- s += temp;
+ s.Add_UInt32(dataSize);
}
else
{
@@ -198,15 +206,53 @@ void CPanel::Properties()
}
}
message += GetNameOfProperty(propID, name);
- message.AddAscii(kPropValueSeparator);
- message.AddAscii(s);
+ message += kPropValueSeparator;
+ message += s.Ptr();
message.Add_LF();
}
}
}
- message.AddAscii(kSeparator);
+ message += kSeparator;
+ }
+ else if (operatedIndices.Size() >= 1)
+ {
+ UInt64 packSize = 0;
+ UInt64 unpackSize = 0;
+ UInt64 numFiles = 0;
+ UInt64 numDirs = 0;
+
+ FOR_VECTOR (i, operatedIndices)
+ {
+ const UInt32 index = operatedIndices[i];
+ unpackSize += GetItemSize(index);
+ packSize += GetItem_UInt64Prop(index, kpidPackSize);
+ if (IsItem_Folder(index))
+ {
+ numDirs++;
+ numDirs += GetItem_UInt64Prop(index, kpidNumSubDirs);
+ numFiles += GetItem_UInt64Prop(index, kpidNumSubFiles);;
+ }
+ else
+ numFiles++;
+ }
+ {
+ wchar_t temp[32];
+ ConvertUInt32ToString(operatedIndices.Size(), temp);
+ message += MyFormatNew(g_App.LangString_N_SELECTED_ITEMS, temp);
+ message.Add_LF();
+ }
+
+ if (numDirs != 0)
+ AddPropertyString(kpidNumSubDirs, numDirs, message);
+ if (numFiles != 0)
+ AddPropertyString(kpidNumSubFiles, numFiles, message);
+ AddPropertyString(kpidSize, unpackSize, message);
+ AddPropertyString(kpidPackSize, packSize, message);
+
+ message += kSeparator;
}
+
/*
AddLangString(message, IDS_PROP_FILE_TYPE);
@@ -263,7 +309,7 @@ void CPanel::Properties()
{
const int kNumSpecProps = ARRAY_SIZE(kSpecProps);
- message.AddAscii(kSeparator);
+ message += kSeparator;
for (Int32 i = -(int)kNumSpecProps; i < (Int32)numProps; i++)
{
@@ -288,7 +334,7 @@ void CPanel::Properties()
UInt32 numProps;
if (getProps->GetArcNumProps2(level, &numProps) == S_OK)
{
- message.AddAscii(kSeparatorSmall);
+ message += kSeparatorSmall;
for (Int32 i = 0; i < (Int32)numProps; i++)
{
CMyComBSTR name;
@@ -331,8 +377,8 @@ void CPanel::EditCopy()
GetSelectedItemsIndices(indices);
FOR_VECTOR (i, indices)
{
- if (i > 0)
- s += L"\xD\n";
+ if (i != 0)
+ s += "\xD\n";
s += GetItemName(indices[i]);
}
ClipboardSetText(_mainWindow, s);
@@ -755,7 +801,7 @@ bool CPanel::InvokePluginCommand(int id,
commandInfo.hwnd = GetParent();
commandInfo.lpVerb = (LPCSTR)(MAKEINTRESOURCE(offset));
commandInfo.lpParameters = NULL;
- CSysString currentFolderSys = GetSystemString(_currentFolderPrefix);
+ const CSysString currentFolderSys (GetSystemString(_currentFolderPrefix));
commandInfo.lpDirectory = (LPCSTR)(LPCTSTR)(currentFolderSys);
commandInfo.nShow = SW_SHOW;
diff --git a/CPP/7zip/UI/FileManager/PanelOperations.cpp b/CPP/7zip/UI/FileManager/PanelOperations.cpp
index 3331a4cf..3d852cdc 100644
--- a/CPP/7zip/UI/FileManager/PanelOperations.cpp
+++ b/CPP/7zip/UI/FileManager/PanelOperations.cpp
@@ -96,7 +96,7 @@ HRESULT CThreadFolderOperations::DoOperation(CPanel &panel, const UString &progr
ProgressDialog.MainWindow = panel._mainWindow; // panel.GetParent()
- ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ ProgressDialog.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
ProgressDialog.MainAddTitle = progressTitle + L' ';
RINOK(Create(progressTitle, ProgressDialog.MainWindow));
@@ -138,7 +138,7 @@ void CPanel::DeleteItems(bool NON_CE_VAR(toRecycleBin))
CDynamicBuffer<CHAR> buffer;
FOR_VECTOR (i, indices)
{
- const AString path = GetSystemString(GetItemFullPath(indices[i]));
+ const AString path (GetSystemString(GetItemFullPath(indices[i])));
buffer.AddData(path, path.Len() + 1);
}
*buffer.GetCurPtrAndGrow(1) = 0;
@@ -502,7 +502,7 @@ void CPanel::ChangeComment()
UString name = GetItemRelPath2(realIndex);
CComboDialog dlg;
dlg.Title = name;
- dlg.Title += L" : ";
+ dlg.Title += " : ";
AddLangString(dlg.Title, IDS_COMMENT);
dlg.Value = comment;
LangString(IDS_COMMENT2, dlg.Static);
diff --git a/CPP/7zip/UI/FileManager/PanelSelect.cpp b/CPP/7zip/UI/FileManager/PanelSelect.cpp
index 72cb4838..268b64af 100644
--- a/CPP/7zip/UI/FileManager/PanelSelect.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSelect.cpp
@@ -156,7 +156,7 @@ void CPanel::SelectSpec(bool selectMode)
CComboDialog dlg;
LangString(selectMode ? IDS_SELECT : IDS_DESELECT, dlg.Title );
LangString(IDS_SELECT_MASK, dlg.Static);
- dlg.Value = L'*';
+ dlg.Value = '*';
if (dlg.Create(GetParent()) != IDOK)
return;
const UString &mask = dlg.Value;
@@ -192,7 +192,7 @@ void CPanel::SelectByType(bool selectMode)
}
else
{
- UString mask = L'*';
+ UString mask ('*');
mask += name.Ptr(pos);
FOR_VECTOR (i, _selectedStatusVector)
if (IsItem_Folder(i) == isItemFolder && DoesWildcardMatchName(mask, GetItemName(i)))
diff --git a/CPP/7zip/UI/FileManager/PanelSort.cpp b/CPP/7zip/UI/FileManager/PanelSort.cpp
index 59b785b8..4adfc39f 100644
--- a/CPP/7zip/UI/FileManager/PanelSort.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSort.cpp
@@ -176,17 +176,13 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
panel->_folder->GetProperty((UInt32)lParam1, propID, &prop1);
panel->_folder->GetProperty((UInt32)lParam2, propID, &prop2);
if (prop1.vt != prop2.vt)
- {
return MyCompare(prop1.vt, prop2.vt);
- }
if (prop1.vt == VT_BSTR)
- {
- return _wcsicmp(prop1.bstrVal, prop2.bstrVal);
- }
+ return MyStringCompareNoCase(prop1.bstrVal, prop2.bstrVal);
return prop1.Compare(prop2);
- // return 0;
}
+
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == 0) return 0;
diff --git a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
index 7aaa97b1..604448e8 100644
--- a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
@@ -24,21 +24,21 @@ using namespace NWindows;
using namespace NFile;
using namespace NDir;
-static const wchar_t *g_Message_FileWriteError = L"File write error";
+static const char * const g_Message_FileWriteError = "File write error";
struct CVolSeqName
{
UString UnchangedPart;
UString ChangedPart;
- CVolSeqName(): ChangedPart(L"000") {};
+ CVolSeqName(): ChangedPart("000") {};
void SetNumDigits(UInt64 numVolumes)
{
- ChangedPart = L"000";
+ ChangedPart = "000";
while (numVolumes > 999)
{
numVolumes /= 10;
- ChangedPart += L'0';
+ ChangedPart += '0';
}
}
@@ -131,7 +131,7 @@ HRESULT CThreadSplit::ProcessVirt()
if (curVolSize == 0)
{
FString name = VolBasePath;
- name += FTEXT('.');
+ name += '.';
name += us2fs(seqName.GetNextName());
sync.Set_FilePath(fs2us(name));
sync.Set_NumFilesCur(numFiles++);
@@ -236,7 +236,7 @@ void CApp::Split()
CProgressDialog &progressDialog = spliter.ProgressDialog;
- UString progressWindowTitle = L"7-Zip"; // LangString(IDS_APP_TITLE, 0x03000000);
+ UString progressWindowTitle ("7-Zip"); // LangString(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_SPLITTING);
progressDialog.ShowCompressionInfo = false;
@@ -340,7 +340,7 @@ extern void AddValuePair2(UString &s, UINT resourceID, UInt64 num, UInt64 size);
static void AddInfoFileName(UString &dest, const UString &name)
{
- dest += L"\n ";
+ dest += "\n ";
dest += name;
}
@@ -450,7 +450,7 @@ void CApp::Combine()
outName.DeleteBack();
}
if (outName.IsEmpty())
- outName = L"file";
+ outName = "file";
NFind::CFileInfo fileInfo;
UString destFilePath = path + outName;
@@ -464,7 +464,7 @@ void CApp::Combine()
CProgressDialog &progressDialog = combiner.ProgressDialog;
progressDialog.ShowCompressionInfo = false;
- UString progressWindowTitle = L"7-Zip"; // LangString(IDS_APP_TITLE, 0x03000000);
+ UString progressWindowTitle ("7-Zip"); // LangString(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_COMBINING);
progressDialog.MainWindow = _window;
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog.cpp b/CPP/7zip/UI/FileManager/ProgressDialog.cpp
index 65201a9e..1bf115ad 100644
--- a/CPP/7zip/UI/FileManager/ProgressDialog.cpp
+++ b/CPP/7zip/UI/FileManager/ProgressDialog.cpp
@@ -120,7 +120,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
wchar_t s[64];
ConvertUInt64ToString(percentValue, s);
UString title = s;
- title += L"% ";
+ title += "% ";
SetText(title + _title);
#ifndef _SFX
AddToTitle(title + MainAddTitle);
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
index 8c38b81a..762f2492 100644
--- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
@@ -217,7 +217,7 @@ void CProgressSync::AddError_Message_Name(const wchar_t *message, const wchar_t
UString s;
if (name && *name != 0)
s += name;
- if (message && *message != 0 )
+ if (message && *message != 0)
{
if (!s.IsEmpty())
s.Add_LF();
@@ -232,7 +232,7 @@ void CProgressSync::AddError_Code_Name(DWORD systemError, const wchar_t *name)
{
UString s = NError::MyFormatMessage(systemError);
if (systemError == 0)
- s = L"Error";
+ s = "Error";
AddError_Message_Name(s, name);
}
@@ -828,8 +828,8 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
ConvertUInt64ToString(completedFiles, s);
if (IS_DEFINED_VAL(totalFiles))
{
- wcscat(s, L" / ");
- ConvertUInt64ToString(totalFiles, s + wcslen(s));
+ MyStringCat(s, L" / ");
+ ConvertUInt64ToString(totalFiles, s + MyStringLen(s));
}
if (_filesStr_Prev != s)
{
@@ -862,7 +862,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
{
_ratio_Prev = ratio;
ConvertUInt64ToString(ratio, s);
- wcscat(s, L"%");
+ MyStringCat(s, L"%");
SetItemText(IDT_PROGRESS_RATIO_VAL, s);
}
}
@@ -986,7 +986,7 @@ bool CProgressDialog::OnExternalCloseMessage()
{
MessagesDisplayed = true;
if (fm.ErrorMessage.Title.IsEmpty())
- fm.ErrorMessage.Title = L"7-Zip";
+ fm.ErrorMessage.Title = "7-Zip";
MessageBoxW(*this, fm.ErrorMessage.Message, fm.ErrorMessage.Title, MB_ICONERROR);
}
else if (!thereAreMessages)
@@ -995,7 +995,7 @@ bool CProgressDialog::OnExternalCloseMessage()
if (!fm.OkMessage.Message.IsEmpty())
{
if (fm.OkMessage.Title.IsEmpty())
- fm.OkMessage.Title = L"7-Zip";
+ fm.OkMessage.Title = "7-Zip";
MessageBoxW(*this, fm.OkMessage.Message, fm.OkMessage.Title, MB_OK);
}
}
@@ -1050,8 +1050,8 @@ void CProgressDialog::SetTitleText()
{
char temp[32];
ConvertUInt64ToString(_prevPercentValue, temp);
- s.AddAscii(temp);
- s += L'%';
+ s += temp;
+ s += '%';
}
if (!_foreground)
{
@@ -1273,12 +1273,10 @@ void CProgressThreadVirt::Process()
catch(const char *s) { m = GetUnicodeString(s); }
catch(int v)
{
- wchar_t s[16];
- ConvertUInt32ToString(v, s);
- m = L"Error #";
- m += s;
+ m = "Error #";
+ m.Add_UInt32(v);
}
- catch(...) { m = L"Error"; }
+ catch(...) { m = "Error"; }
if (Result != E_ABORT)
{
if (m.IsEmpty() && Result != S_OK)
diff --git a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
index 93ba40c2..e48dbb44 100644
--- a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
+++ b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
@@ -17,14 +17,14 @@ namespace NRegistryAssoc {
// static NSynchronization::CCriticalSection g_CriticalSection;
-static const TCHAR *kClasses = TEXT("Software\\Classes\\");
-// static const TCHAR *kShellNewKeyName = TEXT("ShellNew");
-// static const TCHAR *kShellNewDataValueName = TEXT("Data");
-static const TCHAR *kDefaultIconKeyName = TEXT("DefaultIcon");
-static const TCHAR *kShellKeyName = TEXT("shell");
-static const TCHAR *kOpenKeyName = TEXT("open");
-static const TCHAR *kCommandKeyName = TEXT("command");
-static const TCHAR *k7zipPrefix = TEXT("7-Zip.");
+static const TCHAR * const kClasses = TEXT("Software\\Classes\\");
+// static const TCHAR * const kShellNewKeyName = TEXT("ShellNew");
+// static const TCHAR * const kShellNewDataValueName = TEXT("Data");
+static const TCHAR * const kDefaultIconKeyName = TEXT("DefaultIcon");
+static const TCHAR * const kShellKeyName = TEXT("shell");
+static const TCHAR * const kOpenKeyName = TEXT("open");
+static const TCHAR * const kCommandKeyName = TEXT("command");
+static const char * const k7zipPrefix = "7-Zip.";
static CSysString GetExtProgramKeyName(const CSysString &ext)
{
@@ -59,7 +59,8 @@ bool CShellExtInfo::ReadFromRegistry(HKEY hkey, const CSysString &ext)
}
{
CKey iconKey;
- if (iconKey.Open(hkey, GetFullKeyPath(hkey, ProgramKey + CSysString(TEXT(CHAR_PATH_SEPARATOR)) + kDefaultIconKeyName), KEY_READ) == ERROR_SUCCESS)
+
+ if (iconKey.Open(hkey, GetFullKeyPath(hkey, ProgramKey + CSysString(CHAR_PATH_SEPARATOR) + kDefaultIconKeyName), KEY_READ) == ERROR_SUCCESS)
{
UString value;
if (iconKey.QueryValue(NULL, value) == ERROR_SUCCESS)
@@ -86,7 +87,7 @@ bool CShellExtInfo::ReadFromRegistry(HKEY hkey, const CSysString &ext)
bool CShellExtInfo::IsIt7Zip() const
{
- return IsString1PrefixedByString2_NoCase(GetUnicodeString(ProgramKey), GetUnicodeString(k7zipPrefix));
+ return ProgramKey.IsPrefixedBy_Ascii_NoCase(k7zipPrefix);
}
LONG DeleteShellExtensionInfo(HKEY hkey, const CSysString &ext)
@@ -114,9 +115,9 @@ LONG AddShellExtensionInfo(HKEY hkey,
// NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CSysString programKeyName;
{
- CSysString ext2 = ext;
+ CSysString ext2 (ext);
if (iconIndex < 0)
- ext2 = TEXT("*");
+ ext2 = "*";
programKeyName = GetExtProgramKeyName(ext2);
}
{
@@ -142,10 +143,8 @@ LONG AddShellExtensionInfo(HKEY hkey,
iconIndex = 0;
// if (iconIndex >= 0)
{
- iconPathFull += L',';
- wchar_t s[16];
- ConvertUInt32ToString((UInt32)iconIndex, s);
- iconPathFull += s;
+ iconPathFull += ',';
+ iconPathFull.Add_UInt32((UInt32)iconIndex);
}
iconKey.Create(programKey, kDefaultIconKeyName);
iconKey.SetValue(NULL, iconPathFull);
diff --git a/CPP/7zip/UI/FileManager/RegistryPlugins.cpp b/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
index ad70db80..a0753ca6 100644
--- a/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
+++ b/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
@@ -13,12 +13,12 @@ using namespace NWindows;
using namespace NFile;
/*
-static const TCHAR *kLMBasePath = TEXT("Software\\7-Zip\\FM");
+static LPCTSTR const kLMBasePath = TEXT("Software\\7-Zip\\FM");
-static const TCHAR *kPluginsKeyName = TEXT("Plugins");
-static const TCHAR *kPluginsOpenClassIDValue = TEXT("CLSID");
-static const TCHAR *kPluginsOptionsClassIDValue = TEXT("Options");
-static const TCHAR *kPluginsTypeValue = TEXT("Type");
+static LPCTSTR const kPluginsKeyName = TEXT("Plugins");
+static LPCTSTR const kPluginsOpenClassIDValue = TEXT("CLSID");
+static LPCTSTR const kPluginsOptionsClassIDValue = TEXT("Options");
+static LPCTSTR const kPluginsTypeValue = TEXT("Type");
static CSysString GetFileFolderPluginsKeyName()
{
@@ -101,8 +101,10 @@ void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
if (::ReadPluginInfo(pluginInfo, false))
plugins.Add(pluginInfo);
}
- FString folderPath = baseFolderPrefix + FTEXT("Plugins") FSTRING_PATH_SEPARATOR;
- NFind::CEnumerator enumerator(folderPath + FCHAR_ANY_MASK);
+ FString folderPath = baseFolderPrefix;
+ folderPath += "Plugins" STRING_PATH_SEPARATOR;
+ NFind::CEnumerator enumerator;
+ enumerator.SetDirPrefix(folderPath);
NFind::CFileInfo fileInfo;
while (enumerator.Next(fileInfo))
{
@@ -127,7 +129,7 @@ void ReadFileFolderPluginInfoList(CObjectVector<CPluginInfo> &plugins)
CPluginInfo p;
// p.FilePath.Empty();
p.Type = kPluginTypeFF;
- p.Name = L"7-Zip";
+ p.Name = "7-Zip";
// p.ClassID = CLSID_CAgentArchiveHandler;
p.ClassIDDefined = true;
// p.OptionsClassID;
diff --git a/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/CPP/7zip/UI/FileManager/RegistryUtils.cpp
index 9cc76c36..91b69a21 100644
--- a/CPP/7zip/UI/FileManager/RegistryUtils.cpp
+++ b/CPP/7zip/UI/FileManager/RegistryUtils.cpp
@@ -13,31 +13,31 @@ using namespace NRegistry;
#define REG_PATH_7Z TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip")
-static const TCHAR *kCUBasePath = REG_PATH_7Z;
-static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
-// static const TCHAR *kLM_Path = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
+static LPCTSTR const kCUBasePath = REG_PATH_7Z;
+static LPCTSTR const kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
+// static LPCTSTR const kLM_Path = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
-static const WCHAR *kLangValueName = L"Lang";
+static LPCWSTR const kLangValueName = L"Lang";
-static const WCHAR *kViewer = L"Viewer";
-static const WCHAR *kEditor = L"Editor";
-static const WCHAR *kDiff = L"Diff";
+static LPCWSTR const kViewer = L"Viewer";
+static LPCWSTR const kEditor = L"Editor";
+static LPCWSTR const kDiff = L"Diff";
-static const TCHAR *kShowDots = TEXT("ShowDots");
-static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons");
-static const TCHAR *kFullRow = TEXT("FullRow");
-static const TCHAR *kShowGrid = TEXT("ShowGrid");
-static const TCHAR *kSingleClick = TEXT("SingleClick");
-static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection");
-// static const TCHAR *kUnderline = TEXT("Underline");
+static LPCTSTR const kShowDots = TEXT("ShowDots");
+static LPCTSTR const kShowRealFileIcons = TEXT("ShowRealFileIcons");
+static LPCTSTR const kFullRow = TEXT("FullRow");
+static LPCTSTR const kShowGrid = TEXT("ShowGrid");
+static LPCTSTR const kSingleClick = TEXT("SingleClick");
+static LPCTSTR const kAlternativeSelection = TEXT("AlternativeSelection");
+// static LPCTSTR const kUnderline = TEXT("Underline");
-static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
+static LPCTSTR const kShowSystemMenu = TEXT("ShowSystemMenu");
-// static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd");
-static const TCHAR *kLargePages = TEXT("LargePages");
+// static LPCTSTR const kLockMemoryAdd = TEXT("LockMemoryAdd");
+static LPCTSTR const kLargePages = TEXT("LargePages");
-static const TCHAR *kFlatViewName = TEXT("FlatViewArc");
-// static const TCHAR *kShowDeletedFiles = TEXT("ShowDeleted");
+static LPCTSTR const kFlatViewName = TEXT("FlatViewArc");
+// static LPCTSTR const kShowDeletedFiles = TEXT("ShowDeleted");
static void SaveCuString(LPCTSTR keyPath, LPCWSTR valuePath, LPCWSTR value)
{
@@ -63,21 +63,21 @@ void ReadRegEditor(bool useEditor, UString &path) { ReadCuString(kCU_FMPath, use
void SaveRegDiff(const UString &path) { SaveCuString(kCU_FMPath, kDiff, path); }
void ReadRegDiff(UString &path) { ReadCuString(kCU_FMPath, kDiff, path); }
-static void Save7ZipOption(const TCHAR *value, bool enabled)
+static void Save7ZipOption(LPCTSTR value, bool enabled)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(value, enabled);
}
-static void SaveOption(const TCHAR *value, bool enabled)
+static void SaveOption(LPCTSTR value, bool enabled)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCU_FMPath);
key.SetValue(value, enabled);
}
-static bool Read7ZipOption(const TCHAR *value, bool defaultValue)
+static bool Read7ZipOption(LPCTSTR value, bool defaultValue)
{
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
@@ -89,7 +89,7 @@ static bool Read7ZipOption(const TCHAR *value, bool defaultValue)
return defaultValue;
}
-static void ReadOption(CKey &key, const TCHAR *value, bool &dest)
+static void ReadOption(CKey &key, LPCTSTR value, bool &dest)
{
bool enabled = false;
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
@@ -97,14 +97,14 @@ static void ReadOption(CKey &key, const TCHAR *value, bool &dest)
}
/*
-static void SaveLmOption(const TCHAR *value, bool enabled)
+static void SaveLmOption(LPCTSTR value, bool enabled)
{
CKey key;
key.Create(HKEY_LOCAL_MACHINE, kLM_Path);
key.SetValue(value, enabled);
}
-static bool ReadLmOption(const TCHAR *value, bool defaultValue)
+static bool ReadLmOption(LPCTSTR value, bool defaultValue)
{
CKey key;
if (key.Open(HKEY_LOCAL_MACHINE, kLM_Path, KEY_READ) == ERROR_SUCCESS)
diff --git a/CPP/7zip/UI/FileManager/RootFolder.cpp b/CPP/7zip/UI/FileManager/RootFolder.cpp
index b9629263..643f1066 100644
--- a/CPP/7zip/UI/FileManager/RootFolder.cpp
+++ b/CPP/7zip/UI/FileManager/RootFolder.cpp
@@ -79,7 +79,7 @@ enum
};
#ifdef USE_WIN_PATHS
-static const wchar_t *kVolPrefix = L"\\\\.";
+static const char * const kVolPrefix = "\\\\.";
#endif
void CRootFolder::Init()
@@ -194,7 +194,7 @@ static bool AreEqualNames(const UString &path, const wchar_t *name)
unsigned len = MyStringLen(name);
if (len > path.Len() || len + 1 < path.Len())
return false;
- if (len + 1 == path.Len() && path[len] != WCHAR_PATH_SEPARATOR)
+ if (len + 1 == path.Len() && !IS_PATH_SEPAR(path[len]))
return false;
return path.IsPrefixedBy(name);
}
@@ -244,13 +244,13 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
CMyComPtr<IFolderFolder> subFolder;
#ifdef USE_WIN_PATHS
- if (name2.IsPrefixedBy(kVolPrefix))
+ if (name2.IsPrefixedBy_Ascii_NoCase(kVolPrefix))
{
CFSDrives *folderSpec = new CFSDrives;
subFolder = folderSpec;
folderSpec->Init(true);
}
- else if (name2 == NFile::NName::kSuperPathPrefix)
+ else if (name2.IsEqualTo(NFile::NName::kSuperPathPrefix))
{
CFSDrives *folderSpec = new CFSDrives;
subFolder = folderSpec;
@@ -272,7 +272,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
if (fsFolderSpec->Init(us2fs(name2)) != S_OK)
{
#ifdef USE_WIN_PATHS
- if (name2[0] == WCHAR_PATH_SEPARATOR)
+ if (IS_PATH_SEPAR(name2[0]))
{
CNetFolder *netFolderSpec = new CNetFolder;
subFolder = netFolderSpec;
diff --git a/CPP/7zip/UI/FileManager/SettingsPage.cpp b/CPP/7zip/UI/FileManager/SettingsPage.cpp
index 07121b28..bdd62f71 100644
--- a/CPP/7zip/UI/FileManager/SettingsPage.cpp
+++ b/CPP/7zip/UI/FileManager/SettingsPage.cpp
@@ -29,7 +29,7 @@ static const UInt32 kLangIDs[] =
IDX_SETTINGS_LARGE_PAGES
};
-static LPCWSTR kEditTopic = L"FM/options.htm#settings";
+#define kSettingsTopic "FM/options.htm#settings"
extern bool IsLargePageSupported();
@@ -108,7 +108,7 @@ LONG CSettingsPage::OnApply()
void CSettingsPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kEditTopic); // change it
+ ShowHelpWindow(kSettingsTopic);
}
bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
diff --git a/CPP/7zip/UI/FileManager/SplitDialog.cpp b/CPP/7zip/UI/FileManager/SplitDialog.cpp
index 455874ef..0c9fdd17 100644
--- a/CPP/7zip/UI/FileManager/SplitDialog.cpp
+++ b/CPP/7zip/UI/FileManager/SplitDialog.cpp
@@ -90,7 +90,7 @@ void CSplitDialog::OnButtonSetPath()
{
UString currentPath;
_pathCombo.GetText(currentPath);
- // UString title = L"Specify a location for output folder";
+ // UString title = "Specify a location for output folder";
UString title = LangString(IDS_SET_FOLDER);
UString resultPath;
diff --git a/CPP/7zip/UI/FileManager/SplitUtils.cpp b/CPP/7zip/UI/FileManager/SplitUtils.cpp
index b0172a9f..4b6235b3 100644
--- a/CPP/7zip/UI/FileManager/SplitUtils.cpp
+++ b/CPP/7zip/UI/FileManager/SplitUtils.cpp
@@ -57,16 +57,25 @@ bool ParseVolumeSizes(const UString &s, CRecordVector<UInt64> &values)
return true;
}
+
+static const char * const k_Sizes[] =
+{
+ "10M"
+ , "100M"
+ , "1000M"
+ , "650M - CD"
+ , "700M - CD"
+ , "4092M - FAT"
+ , "4480M - DVD" // 4489 MiB limit
+ , "8128M - DVD DL" // 8147 MiB limit
+ , "23040M - BD" // 23866 MiB limit
+ // , "1457664 - 3.5\" floppy"
+};
+
void AddVolumeItems(NWindows::NControl::CComboBox &combo)
{
- combo.AddString(TEXT("10M"));
- combo.AddString(TEXT("650M - CD"));
- combo.AddString(TEXT("700M - CD"));
- combo.AddString(TEXT("4092M - FAT"));
- combo.AddString(TEXT("4480M - DVD")); // 4489 MiB limit
- combo.AddString(TEXT("8128M - DVD DL")); // 8147 MiB limit
- combo.AddString(TEXT("23040M - BD")); // 23866 MiB limit
- combo.AddString(TEXT("1457664 - 3.5\" floppy"));
+ for (unsigned i = 0; i < ARRAY_SIZE(k_Sizes); i++)
+ combo.AddString(CSysString(k_Sizes[i]));
}
UInt64 GetNumberOfVolumes(UInt64 size, const CRecordVector<UInt64> &volSizes)
diff --git a/CPP/7zip/UI/FileManager/StringUtils.cpp b/CPP/7zip/UI/FileManager/StringUtils.cpp
index 7c814f7f..04783992 100644
--- a/CPP/7zip/UI/FileManager/StringUtils.cpp
+++ b/CPP/7zip/UI/FileManager/StringUtils.cpp
@@ -12,9 +12,9 @@ void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2)
for (unsigned i = 0; i < src.Len(); i++)
{
const wchar_t c = src[i];
- if (c == L'\"')
+ if (c == '\"')
quoteMode = !quoteMode;
- else if (c == L' ' && !quoteMode)
+ else if (c == ' ' && !quoteMode)
{
dest2 = src.Ptr(i + 1);
return;
@@ -34,7 +34,7 @@ void SplitString(const UString &srcString, UStringVector &destStrings)
for (unsigned i = 0; i < len; i++)
{
wchar_t c = srcString[i];
- if (c == L' ')
+ if (c == ' ')
{
if (!s.IsEmpty())
{
diff --git a/CPP/7zip/UI/FileManager/SystemPage.cpp b/CPP/7zip/UI/FileManager/SystemPage.cpp
index 5214a55c..819443ee 100644
--- a/CPP/7zip/UI/FileManager/SystemPage.cpp
+++ b/CPP/7zip/UI/FileManager/SystemPage.cpp
@@ -30,7 +30,7 @@ static const UInt32 kLangIDs[] =
IDT_SYSTEM_ASSOCIATE
};
-static LPCWSTR kSystemTopic = L"FM/options.htm#system";
+#define kSystemTopic "FM/options.htm#system"
CSysString CModifiedExtInfo::GetString() const
{
@@ -165,7 +165,7 @@ bool CSystemPage::OnInit()
UString s;
#if NUM_EXT_GROUPS == 1
- s.SetFromAscii("Program");
+ s = "Program";
#else
#ifndef UNDER_CE
const unsigned kSize = 256;
@@ -190,7 +190,7 @@ bool CSystemPage::OnInit()
if (!res)
#endif
- s.SetFromAscii("Current User");
+ s = "Current User";
#endif
LV_COLUMNW ci;
@@ -257,9 +257,9 @@ bool CSystemPage::OnInit()
static UString GetProgramCommand()
{
- UString s = L"\"";
+ UString s ('\"');
s += fs2us(NDLL::GetModuleDirPrefix());
- s.AddAscii("7zFM.exe\" \"%1\"");
+ s += "7zFM.exe\" \"%1\"";
return s;
}
@@ -291,7 +291,7 @@ LONG CSystemPage::OnApply()
if (mi.State == kExtState_7Zip)
{
UString title = extInfo.Ext;
- title.AddAscii(" Archive");
+ title += " Archive";
const CPluginToIcon &plug = extInfo.Plugins[0];
res2 = NRegistryAssoc::AddShellExtensionInfo(key, GetSystemString(extInfo.Ext),
title, command, plug.IconPath, plug.IconIndex);
@@ -327,7 +327,7 @@ LONG CSystemPage::OnApply()
void CSystemPage::OnNotifyHelp()
{
- ShowHelpWindow(NULL, kSystemTopic);
+ ShowHelpWindow(kSystemTopic);
}
diff --git a/CPP/7zip/UI/FileManager/TextPairs.cpp b/CPP/7zip/UI/FileManager/TextPairs.cpp
index 0fac2506..d4002b45 100644
--- a/CPP/7zip/UI/FileManager/TextPairs.cpp
+++ b/CPP/7zip/UI/FileManager/TextPairs.cpp
@@ -178,13 +178,13 @@ void CPairsStorage::SaveToString(UString &text) const
const CTextPair &pair = Pairs[i];
bool multiWord = (pair.ID.Find(L' ') >= 0);
if (multiWord)
- text += L'\"';
+ text += '\"';
text += pair.ID;
if (multiWord)
- text += L'\"';
- text += L' ';
+ text += '\"';
+ text += ' ';
text += pair.Value;
- text += L'\x0D';
+ text += '\x0D';
text.Add_LF();
}
}
diff --git a/CPP/7zip/UI/FileManager/ViewSettings.cpp b/CPP/7zip/UI/FileManager/ViewSettings.cpp
index 9292d120..af61efcd 100644
--- a/CPP/7zip/UI/FileManager/ViewSettings.cpp
+++ b/CPP/7zip/UI/FileManager/ViewSettings.cpp
@@ -17,18 +17,19 @@ using namespace NRegistry;
#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
-static const TCHAR *kCUBasePath = REG_PATH_FM;
-static const TCHAR *kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
+static LPCTSTR const kCUBasePath = REG_PATH_FM;
+static LPCTSTR const kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
-static const TCHAR *kPositionValueName = TEXT("Position");
-static const TCHAR *kPanelsInfoValueName = TEXT("Panels");
-static const TCHAR *kToolbars = TEXT("Toolbars");
+static LPCTSTR const kPositionValueName = TEXT("Position");
+static LPCTSTR const kPanelsInfoValueName = TEXT("Panels");
+static LPCTSTR const kToolbars = TEXT("Toolbars");
-static const WCHAR *kPanelPathValueName = L"PanelPath";
-static const TCHAR *kListMode = TEXT("ListMode");
-static const TCHAR *kFolderHistoryValueName = TEXT("FolderHistory");
-static const TCHAR *kFastFoldersValueName = TEXT("FolderShortcuts");
-static const TCHAR *kCopyHistoryValueName = TEXT("CopyHistory");
+static LPCWSTR const kPanelPathValueName = L"PanelPath";
+
+static LPCTSTR const kListMode = TEXT("ListMode");
+static LPCTSTR const kFolderHistoryValueName = TEXT("FolderHistory");
+static LPCTSTR const kFastFoldersValueName = TEXT("FolderShortcuts");
+static LPCTSTR const kCopyHistoryValueName = TEXT("CopyHistory");
static NSynchronization::CCriticalSection g_CS;
@@ -246,9 +247,9 @@ void CListMode::Read()
static UString GetPanelPathName(UInt32 panelIndex)
{
- WCHAR s[16];
- ConvertUInt32ToString(panelIndex, s);
- return (UString)kPanelPathValueName + s;
+ UString s (kPanelPathValueName);
+ s.Add_UInt32(panelIndex);
+ return s;
}
void SavePanelPath(UInt32 panel, const UString &path)
diff --git a/CPP/7zip/UI/FileManager/resource.h b/CPP/7zip/UI/FileManager/resource.h
index b7ca17f1..bb0d7752 100644
--- a/CPP/7zip/UI/FileManager/resource.h
+++ b/CPP/7zip/UI/FileManager/resource.h
@@ -85,6 +85,8 @@
#define IDM_VIEW_TOOLBARS_LARGE_BUTTONS 752
#define IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT 753
+#define IDM_VIEW_TIME 761
+
#define IDS_BOOKMARK 801
#define IDM_OPTIONS 900
diff --git a/CPP/7zip/UI/FileManager/resource.rc b/CPP/7zip/UI/FileManager/resource.rc
index 7db5d3a1..a166129b 100644
--- a/CPP/7zip/UI/FileManager/resource.rc
+++ b/CPP/7zip/UI/FileManager/resource.rc
@@ -83,6 +83,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Flat View", IDM_VIEW_FLAT_VIEW
MENUITEM "&2 Panels\tF9", IDM_VIEW_TWO_PANELS
+
+ POPUP "2017"
+ BEGIN
+ MENUITEM "Time", IDM_VIEW_TIME
+ END
+
POPUP "Toolbars"
BEGIN
MENUITEM "Archive Toolbar", IDM_VIEW_ARCHIVE_TOOLBAR
@@ -112,9 +118,10 @@ BEGIN
POPUP "&Tools"
BEGIN
MENUITEM "&Options...", IDM_OPTIONS
+ MENUITEM SEPARATOR
MENUITEM "&Benchmark", IDM_BENCHMARK
#ifdef UNDER_CE
- MENUITEM "&Benchmark2", IDM_BENCHMARK2
+ MENUITEM "Benchmark 2", IDM_BENCHMARK2
#endif
#ifndef UNDER_CE
END