mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 16:11:38 -06:00
4.44 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
804edc5756
commit
d9666cf046
124
CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp
Executable file
124
CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp
Executable file
@@ -0,0 +1,124 @@
|
||||
// OverwriteDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "OverwriteDialog.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
#include "Windows/Control/Static.h"
|
||||
#include "Windows/PropVariantConversions.h"
|
||||
|
||||
#include "../../FormatUtils.h"
|
||||
|
||||
// #include "../resource.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "../../LangUtils.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
#ifdef LANG
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDC_STATIC_OVERWRITE_HEADER, 0x02000901},
|
||||
{ IDC_STATIC_OVERWRITE_QUESTION_BEGIN, 0x02000902 },
|
||||
{ IDC_STATIC_OVERWRITE_QUESTION_END, 0x02000903 },
|
||||
{ IDYES, 0x02000705 },
|
||||
{ IDC_BUTTON_OVERWRITE_YES_TO_ALL, 0x02000707 },
|
||||
{ IDNO, 0x02000709 },
|
||||
{ IDC_BUTTON_OVERWRITE_NO_TO_ALL,0x0200070B },
|
||||
{ IDC_BUTTON_OVERWRITE_AUTO_RENAME, 0x02000911 },
|
||||
{ IDCANCEL, 0x02000711 }
|
||||
};
|
||||
#endif
|
||||
|
||||
void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
|
||||
const NOverwriteDialog::CFileInfo &fileInfo)
|
||||
{
|
||||
UString sizeString;
|
||||
if (fileInfo.SizeIsDefined)
|
||||
sizeString = MyFormatNew(IDS_FILE_SIZE,
|
||||
#ifdef LANG
|
||||
0x02000982,
|
||||
#endif
|
||||
NumberToString(fileInfo.Size));
|
||||
|
||||
UString reducedName;
|
||||
const int kLineSize = 88;
|
||||
for (int i = 0; i < fileInfo.Name.Length();)
|
||||
{
|
||||
reducedName += fileInfo.Name.Mid(i, kLineSize);
|
||||
reducedName += L" ";
|
||||
i += kLineSize;
|
||||
}
|
||||
|
||||
UString fullString = reducedName;
|
||||
fullString += L"\n";
|
||||
fullString += sizeString;
|
||||
fullString += L"\n";
|
||||
|
||||
if (fileInfo.TimeIsDefined)
|
||||
{
|
||||
UString timeString;
|
||||
FILETIME localFileTime;
|
||||
if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
|
||||
throw 4190402;
|
||||
timeString = ConvertFileTimeToString(localFileTime);
|
||||
|
||||
fullString +=
|
||||
#ifdef LANG
|
||||
LangString(IDS_FILE_MODIFIED, 0x02000983);
|
||||
#else
|
||||
MyLoadStringW(IDS_FILE_MODIFIED);
|
||||
#endif
|
||||
|
||||
fullString += L" ";
|
||||
fullString += timeString;
|
||||
}
|
||||
|
||||
NWindows::NControl::CDialogChildControl control;
|
||||
control.Init(*this, textID);
|
||||
control.SetText(fullString);
|
||||
|
||||
SHFILEINFO shellFileInfo;
|
||||
if (::SHGetFileInfo(
|
||||
GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
|
||||
sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
|
||||
{
|
||||
NControl::CStatic staticContol;
|
||||
staticContol.Attach(GetItem(iconID));
|
||||
staticContol.SetIcon(shellFileInfo.hIcon);
|
||||
}
|
||||
}
|
||||
|
||||
bool COverwriteDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetWindowText(HWND(*this), 0x02000900);
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
#endif
|
||||
SetFileInfoControl(IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME,
|
||||
IDC_STATIC_OVERWRITE_OLD_FILE_ICON, OldFileInfo);
|
||||
SetFileInfoControl(IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME,
|
||||
IDC_STATIC_OVERWRITE_NEW_FILE_ICON, NewFileInfo);
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch(buttonID)
|
||||
{
|
||||
case IDYES:
|
||||
case IDC_BUTTON_OVERWRITE_YES_TO_ALL:
|
||||
case IDNO:
|
||||
case IDC_BUTTON_OVERWRITE_NO_TO_ALL:
|
||||
case IDC_BUTTON_OVERWRITE_AUTO_RENAME:
|
||||
End(buttonID);
|
||||
return true;
|
||||
}
|
||||
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
34
CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h
Executable file
34
CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h
Executable file
@@ -0,0 +1,34 @@
|
||||
// OverwriteDialog.h
|
||||
|
||||
#ifndef __OVERWRITEDIALOG_H
|
||||
#define __OVERWRITEDIALOG_H
|
||||
|
||||
#include "resource.h"
|
||||
#include "Windows/Control/Dialog.h"
|
||||
|
||||
namespace NOverwriteDialog
|
||||
{
|
||||
struct CFileInfo
|
||||
{
|
||||
bool SizeIsDefined;
|
||||
UINT64 Size;
|
||||
bool TimeIsDefined;
|
||||
FILETIME Time;
|
||||
UString Name;
|
||||
};
|
||||
}
|
||||
|
||||
class COverwriteDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
void SetFileInfoControl(int textID, int iconID,
|
||||
const NOverwriteDialog::CFileInfo &fileInfo);
|
||||
virtual bool OnInit();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
public:
|
||||
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_OVERWRITE, parent); }
|
||||
|
||||
NOverwriteDialog::CFileInfo OldFileInfo;
|
||||
NOverwriteDialog::CFileInfo NewFileInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
16
CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h
Executable file
16
CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h
Executable file
@@ -0,0 +1,16 @@
|
||||
// stdafx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#define _WIN32_WINNT 0x0400
|
||||
|
||||
// it's for Windows NT supporting (MENUITEMINFOW)
|
||||
#define WINVER 0x0400
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "Common/NewHandler.h"
|
||||
|
||||
#endif
|
||||
19
CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h
Executable file
19
CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h
Executable file
@@ -0,0 +1,19 @@
|
||||
#define IDS_FILE_MODIFIED 600
|
||||
#define IDS_FILE_SIZE 601
|
||||
|
||||
#define IDD_DIALOG_OVERWRITE 502
|
||||
|
||||
#define IDC_STATIC_OVERWRITE_HEADER 1000
|
||||
|
||||
#define IDC_STATIC_OVERWRITE_QUESTION_BEGIN 1001
|
||||
#define IDC_STATIC_OVERWRITE_QUESTION_END 1002
|
||||
|
||||
#define IDC_STATIC_OVERWRITE_OLD_FILE_ICON 1003
|
||||
#define IDC_STATIC_OVERWRITE_NEW_FILE_ICON 1004
|
||||
|
||||
#define IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME 1005
|
||||
#define IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME 1006
|
||||
|
||||
#define IDC_BUTTON_OVERWRITE_YES_TO_ALL 1010
|
||||
#define IDC_BUTTON_OVERWRITE_NO_TO_ALL 1011
|
||||
#define IDC_BUTTON_OVERWRITE_AUTO_RENAME 1012
|
||||
47
CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc
Executable file
47
CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc
Executable file
@@ -0,0 +1,47 @@
|
||||
#include "resource.h"
|
||||
#include "../../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 357
|
||||
#define ySize2 204
|
||||
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
|
||||
#undef iconSize
|
||||
#define iconSize 20
|
||||
|
||||
#undef fiXPos
|
||||
#undef fiXSize
|
||||
#undef fiYSize
|
||||
#define fiXPos (iconSize + 12)
|
||||
#define fiXSize (xSize2 - fiXPos)
|
||||
#define fiYSize 50
|
||||
|
||||
#define b1YPos (ySize - marg - bYSize)
|
||||
#define b2YPos (b1YPos - bYSize - 10)
|
||||
|
||||
IDD_DIALOG_OVERWRITE DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
|
||||
CAPTION "Confirm File Replace"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
LTEXT "Destination folder already contains processed file.", IDC_STATIC_OVERWRITE_HEADER, marg, 7, xSize2, 8
|
||||
LTEXT "Would you like to replace the existing file", IDC_STATIC_OVERWRITE_QUESTION_BEGIN, marg, 28, xSize2, 8
|
||||
ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
|
||||
LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize, SS_NOPREFIX
|
||||
LTEXT "with this one?",IDC_STATIC_OVERWRITE_QUESTION_END, marg, 98, xSize2, 8
|
||||
ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
|
||||
LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize, SS_NOPREFIX
|
||||
PUSHBUTTON "&Yes", IDYES, 78, b2YPos, bXSize, bYSize
|
||||
PUSHBUTTON "Yes to &All", IDC_BUTTON_OVERWRITE_YES_TO_ALL, 152, b2YPos, bXSize, bYSize
|
||||
PUSHBUTTON "&No", IDNO, 226, b2YPos, bXSize, bYSize
|
||||
PUSHBUTTON "No to A&ll", IDC_BUTTON_OVERWRITE_NO_TO_ALL, 300, b2YPos, bXSize, bYSize
|
||||
PUSHBUTTON "A&uto Rename", IDC_BUTTON_OVERWRITE_AUTO_RENAME, 181, b1YPos, 109, bYSize
|
||||
PUSHBUTTON "&Cancel", IDCANCEL, 300, b1YPos, bXSize, bYSize
|
||||
END
|
||||
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_FILE_MODIFIED "modified on"
|
||||
IDS_FILE_SIZE "{0} bytes"
|
||||
END
|
||||
Reference in New Issue
Block a user