This commit is contained in:
Igor Pavlov
2023-12-22 17:17:05 +00:00
committed by Kornel
parent ec44a8a070
commit a36c48cece
954 changed files with 42199 additions and 25482 deletions

View File

@@ -8,9 +8,7 @@
#include "../../../Windows/FileIO.h"
#include "../../../Windows/FileName.h"
#ifdef LANG
#include "LangUtils.h"
#endif
#include "BrowseDialog.h"
#include "CopyDialogRes.h"
@@ -26,7 +24,7 @@ extern bool g_SymLink_Supported;
using namespace NWindows;
using namespace NFile;
#ifdef LANG
#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
IDB_LINK_LINK,
@@ -73,7 +71,7 @@ static bool GetSymLink(CFSTR path, CReparseAttr &attr, UString &errorMessage)
}
static const int k_LinkType_Buttons[] =
static const unsigned k_LinkType_Buttons[] =
{
IDR_LINK_TYPE_HARD,
IDR_LINK_TYPE_SYM_FILE,
@@ -82,16 +80,19 @@ static const int k_LinkType_Buttons[] =
IDR_LINK_TYPE_WSL
};
void CLinkDialog::Set_LinkType_Radio(int idb)
void CLinkDialog::Set_LinkType_Radio(unsigned idb)
{
CheckRadioButton(k_LinkType_Buttons[0], k_LinkType_Buttons[ARRAY_SIZE(k_LinkType_Buttons) - 1], idb);
CheckRadioButton(
k_LinkType_Buttons[0],
k_LinkType_Buttons[Z7_ARRAY_SIZE(k_LinkType_Buttons) - 1],
idb);
}
bool CLinkDialog::OnInit()
{
#ifdef LANG
#ifdef Z7_LANG
LangSetWindowText(*this, IDD_LINK);
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
#endif
_pathFromCombo.Attach(GetItem(IDC_LINK_PATH_FROM));
@@ -100,7 +101,7 @@ bool CLinkDialog::OnInit()
if (!FilePath.IsEmpty())
{
NFind::CFileInfo fi;
int linkType = 0;
unsigned linkType = 0;
if (!fi.Find(us2fs(FilePath)))
linkType = IDR_LINK_TYPE_SYM_FILE;
else
@@ -109,7 +110,7 @@ bool CLinkDialog::OnInit()
{
CReparseAttr attr;
UString error;
bool res = GetSymLink(us2fs(FilePath), attr, error);
const bool res = GetSymLink(us2fs(FilePath), attr, error);
if (!res && error.IsEmpty())
{
DWORD lastError = GetLastError();
@@ -138,7 +139,7 @@ bool CLinkDialog::OnInit()
SetItemText(IDT_LINK_PATH_TO_CUR, s);
UString destPath = attr.GetPath();
const UString destPath = attr.GetPath();
_pathFromCombo.SetText(FilePath);
_pathToCombo.SetText(destPath);
@@ -215,7 +216,7 @@ bool CLinkDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
return false;
}
bool CLinkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
bool CLinkDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
@@ -240,7 +241,7 @@ void CLinkDialog::OnButton_SetPath(bool to)
_pathFromCombo;
combo.GetText(currentPath);
// UString title = "Specify a location for output folder";
UString title = LangString(IDS_SET_FOLDER);
const UString title = LangString(IDS_SET_FOLDER);
UString resultPath;
if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
@@ -271,10 +272,10 @@ void CLinkDialog::OnButton_Link()
if (!NName::IsAbsolutePath(from))
from.Insert(0, CurDirPrefix);
int idb = -1;
unsigned idb = 0;
for (unsigned i = 0;; i++)
{
if (i >= ARRAY_SIZE(k_LinkType_Buttons))
if (i >= Z7_ARRAY_SIZE(k_LinkType_Buttons))
return;
idb = k_LinkType_Buttons[i];
if (IsButtonCheckedBool(idb))
@@ -355,7 +356,7 @@ void CLinkDialog::OnButton_Link()
void CApp::Link()
{
unsigned srcPanelIndex = GetFocusedPanelIndex();
const unsigned srcPanelIndex = GetFocusedPanelIndex();
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
@@ -363,7 +364,7 @@ void CApp::Link()
return;
}
CRecordVector<UInt32> indices;
srcPanel.GetOperatedItemIndices(indices);
srcPanel.Get_ItemIndices_Operated(indices);
if (indices.IsEmpty())
return;
if (indices.Size() != 1)
@@ -371,14 +372,14 @@ void CApp::Link()
srcPanel.MessageBox_Error_LangID(IDS_SELECT_ONE_FILE);
return;
}
int index = indices[0];
const UInt32 index = indices[0];
const UString itemName = srcPanel.GetItemName(index);
const UString fsPrefix = srcPanel.GetFsPath();
const UString srcPath = fsPrefix + srcPanel.GetItemPrefix(index);
UString path = srcPath;
{
unsigned destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
const unsigned destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
CPanel &destPanel = Panels[destPanelIndex];
if (NumPanels > 1)
if (destPanel.IsFSFolder())